A data storage device including a flash memory and a controller. The flash memory includes a plurality of blocks, and each of the blocks has a plurality of pages. The controller receives a write command which is arranged to write a plurality of data sectors into a plurality of first pages of a first block of the blocks, calculates an offset index according to a first erase count of the first block, retrieving a plurality of seeds from a random seed table according to the offset index, encodes the data sectors by using the retrieved seeds to obtain a plurality of encoded data sectors, and writes the encoded data sectors into the first pages.
|
8. A data storage device, comprising:
a flash memory, comprising a plurality of blocks, and each of the blocks has a plurality of pages; and
a controller, repeatedly writing a data sector into the pages of the blocks, wherein when the controller performs a write operation on a first block of the blocks, the controller calculates an offset index according to the number of times that the first block has been erased, encodes the data sector to produce a plurality of encoded data sectors according to the offset index, and writes the encoded data sectors into the first pages of the first block.
1. A data storage device, comprising:
a flash memory, comprising a plurality of blocks, wherein each of the blocks has a plurality of pages; and
a controller, receiving a write command which is arranged to write a plurality of data sectors into a plurality of first pages of a first block of the blocks, calculating an offset index according to a first erase count of the first block, retrieving a plurality of seeds from a random seed table according to the offset index, encoding the data sectors by using the retrieved seeds to obtain a plurality of encoded data sectors, and writing the encoded data sectors into the first pages.
13. A data maintenance method, applied to a data storage device, wherein the data storage device has a plurality of blocks, each of the blocks has a plurality of pages, and the data maintenance method comprises:
receiving a write command which is arranged to write a plurality of data sectors into a plurality of first pages of a first block of the blocks;
reading a first erase count of the first block to calculate an offset index according to the first erase count;
retrieving a plurality of seeds from a random seed table according to the offset index for obtaining a plurality of encoded data sectors by using the retrieved seeds to encode the data sectors; and
writing the encoded data sectors into the first pages.
20. A data maintenance method, applied in a data storage device, wherein the data storage device has a plurality of blocks, and each of the blocks has a plurality of pages, the data maintenance method comprises:
receiving a write command which is arranged to repeatedly write a data sector into a plurality of first pages of a first block of the blocks;
reading a first erase count of the first block in response to the write command to obtain the number of times that the first block has been erased;
calculating an offset index according to the number of times that the first block has been erased;
encoding the data sector according to the offset index to produce a plurality of encoded data sectors; and
writing the encoded data sectors into the first pages of the first block, sequentially.
2. The data storage device as claimed in
3. The data storage device as claimed in
4. The data storage device as claimed in
5. The data storage device as claimed in
6. The data storage device as claimed in
7. The data storage device as claimed in
9. The data storage device as claimed in
10. The data storage device as claimed in
11. The data storage device as claimed in
12. The data storage device as claimed in
14. The data maintenance method as claimed in
15. The data maintenance method as claimed in
16. The data maintenance method as claimed in
17. The data maintenance method as claimed in
locating a target seed from the seeds according to the offset index; and
retrieving the seeds starting from the target seed in the predetermined order to encode the data sectors by the retrieved seed.
18. The data maintenance method as claimed in
19. The data maintenance method as claimed in
21. The data maintenance method as claimed in
22. The data maintenance method as claimed in
23. The data maintenance method as claimed in
24. The data maintenance method as claimed in
|
This Application claims priority of Taiwan Patent Application No. 104123194, filed on Jul. 17, 2015, the entirety of which is incorporated by reference herein.
Field of the Invention
The present invention is related to a data maintenance method of memory device; in particular to a data maintenance method for encoding data.
Description of the Related Art
Flash memory is considered a non-volatile data-storage device, using electrical methods to erase and program itself. NAND Flash, for example, is often used in memory cards, USB flash devices, solid state devices, eMMCs, and other memory devices.
Flash memory such as NAND Flash uses a multiple-block structure to store data. Each block contains multiple pages, wherein the write unit of the flash memory is the page, and the erase unit of the flash memory is the block. The data stored in the flash memory may be damaged due to repeatedly accessing the same page or the same block. Therefore, a data maintenance method that can prevent the data stored in the flash memory from damage is needed.
A detailed description is given in the following embodiments with reference to the accompanying drawings.
An exemplary embodiment provides a data storage device including a flash memory and a controller. The flash memory includes a plurality of blocks, and each of the blocks has a plurality of pages. The controller receives a write command which is arranged to write a plurality of data sectors into a plurality of first pages of a first block of the blocks, calculates an offset index according to a first erase count of the first block, retrieving a plurality of seeds from a random seed table according to the offset index, encodes the data sectors by using the retrieved seeds to obtain a plurality of encoded data sectors, and writes the encoded data sectors into the first pages.
Another exemplary embodiment provides a data storage device including a flash memory and a controller. The flash memory includes a plurality of blocks, and each of the blocks has a plurality of pages. The controller repeatedly writes a data sector into the pages of the blocks. When the controller performs a write operation on a first block of the blocks, the controller calculates an offset index according to the number of times that the first block has been erased, encodes the data sector to produce a plurality of encoded data sectors according to the offset index, and writes the encoded data sectors into the first pages of the first block.
Yet another exemplary embodiment provides a data maintenance method applied to a data storage device, wherein the data storage device has a plurality of blocks, each of the blocks has a plurality of pages. The data maintenance method including: receiving a write command which is arranged to write a plurality of data sectors into a plurality of first pages of a first block of the blocks; reading a first erase count of the first block to calculate an offset index according to the first erase count; retrieving a plurality of seeds from a random seed table according to the offset index for obtaining a plurality of encoded data sectors by using the retrieved seeds to encode the data sectors; and writing the encoded data sectors into the first pages.
Yet another exemplary embodiment provides a data maintenance method applied in a data storage device, wherein the data storage device has a plurality of blocks, and each of the blocks has a plurality of pages. The data maintenance method includes: receiving a write command which is arranged to repeatedly write a data sector into a plurality of first pages of a first block of the blocks; reading a first erase count of the first block in response to the write command to obtain the number of times that the first block has been erased; calculating an offset index according to the number of times that the first has been erased; encoding the data sector according to the offset index to produce a plurality of encoded data sectors; and writing the encoded data sectors into the first pages of the first block, sequentially.
The present invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
The controller 160 includes a computing unit 162, a non-volatile memory 164 (ROM) and a random access memory 166 (RAM). The non-volatile memory 164, the program code stored in the non-volatile memory 164 and data stored in the non-volatile memory 164 constitute firmware executed by the processing unit 162, and the controller 160 is configured to control the flash memory 180 based on the firmware.
The flash memory 180 includes a plurality of blocks B0˜BN, each of the blocks B0˜BN includes a plurality of pages P0˜PN, as shown in
In some embodiments, the controller 160 is required to write the same data into the pages. However, the page of the flash memory 180 may be damaged when the page has been written onto too many times or the same data is written to the adjacent page. Therefore, the controller 160 scrambles the data which is arranged to be repeatedly written into the pages by using the seeds RS_0˜RS_N of the random seed table RST to prevent the pages to be damaged.
More specifically, when the controller 160 receives a write command arranged to write a plurality of data sectors separately into a plurality of first pages of a first block, the controller 160 calculates an offset index according to a first erase count of the first block. Next, the controller 160 sequentially retrieves a plurality of seeds RS_0˜RS_N from the random seed table RST according to the offset index, and uses the retrieved seeds to encode the data sectors to obtain a plurality of encoded data sectors. Lastly, the controller 160 writes the encoded data sectors into the first pages. It should be noted that, in this embodiment, the data sectors can be different from each other, or the data sectors can be the same.
In one of the embodiments, the controller 160 performs a hash algorithm by using the first erase count to obtain the offset index, wherein the divisor of the hash algorithm is the number of the pages in each of the blocks, but it is not limited thereto. In other embodiments, the controller 160 can also perform other algorithms by using the first erase count to obtain the offset index. Next, the controller 160 further selects one of the seeds RS_0˜RS_N from the random seed table RST according to the offset index, and serves the selected seed as a target seed. Next, the controller 160 retrieves the seeds RS_0˜RS_N sequentially in the predetermined order starting from the target seed to sequentially use the retrieved seed to encode the data sector, and one data sector is arranged to be stored in one first page. Moreover, in one of the embodiments, the data sectors are the same while the seeds RS_0˜RS_N are different from each other and the encoded data sectors are also different from each other.
Namely, in the embodiment of the same data sectors, the controller 160 is arranged to repeatedly write the data sector into the pages of the blocks. For example, in the performance testing of the flash memory 180, the controller 160 is usually required to repeatedly write the same data into the flash memory 180, and erase the data to continue to write the same data into the flash memory 180 when the flash memory 180 is full. Therefore, in the above condition, the adjacent pages of the blocks and the blocks have been repeatedly overwritten with the same data are easily damaged. In one of the embodiments, the controller 160 can scramble the data arranged to be repeatedly written into the flash memory 180 by using the seeds RS_0˜RS_N of the random seed table RST to protect the flash memory 180.
More specifically, when the controller 160 is required to write a first block of the blocks, the controller 160 calculates an offset index according to the number of times that the first block has been erased (the first erase count). Next, the controller 160 encodes the data sector according to the offset index to produce a plurality of encoded data sectors, and sequentially writes the encoded data sectors into a plurality of first page of the first block. As described above, the controller 160 performs the hash algorithm on the first erase count to obtain the offset index, wherein the divisor of the hash algorithm is the number of pages in each of the blocks, but it is not limited thereto. Moreover, the controller 160 locates a target seed from the seeds of the random seed table RST according to the offset index to use the seeds to encode the data sector. In one of the embodiments, the controller 160 retrieves the seeds RS_0˜RS_N starting from the target seed in the predetermined order to sequentially use the retrieved seed to encode the data sector, wherein each of the seeds RS_0˜RS_N is arranged to encode the data sector once to obtain an encoded data sector, such that the encoded data sectors are different from each other, and one first page stores one encoded data sector.
Moreover, when the controller 160 performs a write operation on the first block again, the first erase count of the first block will be greater than the previous write operation. Therefore, when the same data is repeatedly written to the first block, the controller 160 will obtain on offset index which is different from the previous write operation of the first block due to the increased first erase count. Therefore, the controller 160 retrieves the seeds RS_0˜RS_N from the random seed table RST starting from the different seed according to the current offset index. Namely, the encoded data sectors written into the pages will be different from the previous write operation.
When the controller 160 has performed the write operation on all of the pages of the block B0, the controller 160 may continue to perform a write operation on the other blocks using the above steps, but it is not limited thereto. The block B0 may be erased and re-assigned as a spare block by the controller 160 due to the memory space shortage, host commands or data maintenance. It should be noted that, when the block B0 is erased, the controller 160 increases the erase count of the block B0 by one. Therefore, the controller 160 obtains the different offset indexes by the different erase counts when the controller 160 is required to perform write operation on the block B0 again. As shown in
In step S600, the controller 160 receives a write command from the host 120 or other devices, wherein the write command is arranged to write a plurality of data sectors into a plurality of first pages of a first block. It should be noted that, in this embodiment, the data sectors are the same, but it is not limited thereto. In other embodiments, the data sectors can be different from each other. Namely, in the embodiment of the same data sector, the controller 160 receives a write command arranged to write a data sector into the first pages of the first block.
Next, in step S602, the controller 160 reads a first erase count of the first block to obtain the number of times that the first block has been erased, and calculates an offset index according to the first erase count. Namely, the flash memory 180 or the non-volatile memory 164 has an erase count table arranged to record the number of times that each of the blocks B0˜BN has been erased since the flash memory 180 has been used, but it is not limited thereto. In other embodiments, the erase counts of the blocks B0˜BN can be stored in the corresponding blocks B0˜BN. In one of the embodiments, the controller 160 is arranged to perform a hash algorithm on the first erase count to obtain the offset index, wherein the divisor of the hash algorithm is the number of the pages in each of the blocks. Taking
Next, in step S604, the controller 160 produces a plurality of encoded data sectors by encoding the data sectors according to the offset index, and writes the encoded data sectors into the first pages of the first blocks. The process ends at step S604.
In step S700, the controller 160 retrieves one of the seeds RS_0˜RS_N of the random seed table RST according to the offset index. More specifically, the seeds RS_0˜RS_N are arranged in the random seed table RST in a predetermined order, as shown in
Next, in step S702, the controller 160 uses the retrieved seed to encode the data sector to obtain an encoded data sectors.
Next, in step S704, the controller 160 writes the encoded data sector obtained in step S702 into the first page. It should be noted that one first page is arranged to store one encoded data sector. One seed is arranged to encode one data sector, and one the data sector is arranged to be stored in one first page. In one embodiment, the data sectors are the same while the seeds RS_0˜RS_N are different from each other and the encoded data sectors are different from each other.
Next, in step S706, the controller 160 determines whether any of the other pages of the first block is required to be written. When the controller 160 determines that at least one of the page of the first block needs to be written, the process returns to step S700, otherwise, the process ends at step S706. Taking
The data storage device and the data maintenance method can reduce the damaged page.
Data transmission methods, or certain aspects or portions thereof, may take the form of a program code (i.e., executable instructions) embodied in tangible media, such as floppy diskettes, CD-ROMS, hard drives, or any other machine-readable storage medium, wherein, when the program code is loaded into and executed by a machine such as a computer, the machine thereby becomes an apparatus for practicing the methods. The methods may also be embodied in the form of a program code transmitted over some transmission medium, such as electrical wiring or cabling, through fiber optics, or via any other form of transmission, wherein, when the program code is received and loaded into and executed by a machine such as a computer, the machine becomes an apparatus for practicing the disclosed methods. When implemented on a general-purpose processor, the program code combines with the processor to provide a unique apparatus that operates analogously to application-specific logic circuits.
While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.
Huang, Kuo-Tung, Chiang, Chang-Hao, Lai, De-Wei, Li, Yueh-Hsien
Patent | Priority | Assignee | Title |
Patent | Priority | Assignee | Title |
8352808, | Oct 08 2008 | Samsung Electronics Co., Ltd. | Data storage system and device with randomizer/de-randomizer |
8595422, | Aug 12 2008 | U S BANK NATIONAL ASSOCIATION, AS COLLATERAL AGENT | Memory devices and methods of storing data on a memory device |
8751729, | Dec 23 2010 | Samsung Electronics Co., Ltd. | Flash memory device and memory system including the same |
9268531, | Oct 10 2014 | Samsung Electronics Co., Ltd. | Nonvolatile memory system, storage device and method for operating nonvolatile memory device |
20070300130, | |||
20120290783, | |||
20130124781, | |||
20130219247, | |||
20140195725, | |||
20150095550, | |||
TW201250582, | |||
TW438778, | |||
TW455136, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Jul 06 2016 | CHIANG, CHANG-HAO | SILICON MOTION, INC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 039161 | /0109 | |
Jul 06 2016 | HUANG, KUO-TUNG | SILICON MOTION, INC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 039161 | /0109 | |
Jul 06 2016 | LI, YUEH-HSIEN | SILICON MOTION, INC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 039161 | /0109 | |
Jul 06 2016 | LAI, DE-WEI | SILICON MOTION, INC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 039161 | /0109 | |
Jul 14 2016 | Silicon Motion, Inc. | (assignment on the face of the patent) | / |
Date | Maintenance Fee Events |
Sep 16 2021 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Date | Maintenance Schedule |
Apr 03 2021 | 4 years fee payment window open |
Oct 03 2021 | 6 months grace period start (w surcharge) |
Apr 03 2022 | patent expiry (for year 4) |
Apr 03 2024 | 2 years to revive unintentionally abandoned end. (for year 4) |
Apr 03 2025 | 8 years fee payment window open |
Oct 03 2025 | 6 months grace period start (w surcharge) |
Apr 03 2026 | patent expiry (for year 8) |
Apr 03 2028 | 2 years to revive unintentionally abandoned end. (for year 8) |
Apr 03 2029 | 12 years fee payment window open |
Oct 03 2029 | 6 months grace period start (w surcharge) |
Apr 03 2030 | patent expiry (for year 12) |
Apr 03 2032 | 2 years to revive unintentionally abandoned end. (for year 12) |