Patent ID: 9075707
Filing Date: 2015-07-07
Classification: G06F

Abstract:
1. A data writing method for a memory, wherein the memory comprises a data area and a spare area, the data area comprises a plurality of data blocks storing data, and the spare area comprises a plurality of spare blocks having no data stored therein, comprising: receiving a write command for writing a write data to a first data block of the memory from a host; sorting the plurality of spare blocks of the spare area according to erase counts of the plurality of spare blocks; calculating a total number of worn-out blocks in the spare area, wherein erase counts of the worn-out blocks are greater than a first threshold; checking whether the total number of the worn-out blocks is greater than a specific number, wherein the specific number is equal to two; if the total number of the worn-out blocks is greater than the specific number, performing a wear-leveling process to swap the worn-out blocks in the spare area for the data blocks in the data area; selecting a first spare block with the least erase counts from the plurality of spare blocks of the spare area; writing the write data to the first spare block; and erasing data from the first data block to convert the first data block to a spare block, wherein the performing of the wear-leveling process comprises: wherein obtaining of the second data block comprises: