Field of the Invention
The present invention relates to data storage devices with flash memory and flash memory control methods.
Description of the Related Art
Flash memory, a data storage medium, is common in today's data storage devices. For example, flash memory is typically used in memory cards, USB flash devices, solid-state drives, and so on. In another application with multi-chip package technology, a NAND flash chip and a controller chip are combined in one package as an embedded multi-media card (e.g. eMMC).
A flash memory device provides storage space which is divided into blocks, and each block includes a plurality of pages. An erase operation designed for flash memory is performed on a block-by-block basis, to release space one block at a time. When updating data, the new data is written into a spare space rather than being overwritten on the old data. It is more complex to manage a flash memory rather than other conventional storage mediums, especially if an unexpected power-off event occurred. An unexpected power-off event may damage a run-time write block (for reception of write data) of a flash memory.
Furthermore, for the convenient management of the flash memory, the physical-to-logical address mapping information of each block is dynamically collected in a volatile memory (e.g., an SRAM). The physical-to-logical address mapping information dynamically collected in the volatile memory has to be uploaded to the flash memory for non-volatile storage. It can be very tricky to determine when and how the mapping information uploading is performed.
A data storage device in accordance with an exemplary embodiment of the disclosure includes a flash memory and a control unit. The flash memory is divided into a plurality of blocks with each block comprising a plurality of pages. The control unit couples the flash memory to a host and has a microcontroller. The microcontroller is configured to allocate the flash memory to provide a first block from the blocks to work as a run-time write block for reception of write data. Furthermore, during a power recovery process due to an unexpected power-off event that interrupted write operations on the first block, the microcontroller is configured to allocate the flash memory to provide a second block from the blocks for complete data recovery of the first block and to replace the first block as the run-time write block.
In an exemplary embodiment, the control unit further comprises a random access memory. The microcontroller is configured to establish a physical-to-logical address mapping table in the random access memory to record logical addresses corresponding to physical addresses of a table-outdated block between the blocks of the flash memory. The microcontroller is configured to allocate the flash memory to provide the first block as the run-time write block when finishing the writing of the table-outdated block. The microcontroller is configured to update a logical-to-physical address mapping table in accordance with the physical-to-logical address mapping table at intervals between write operations on the run-time write block. The logical-to-physical address mapping table is provided within the flash memory. In an exemplary embodiment, the microcontroller is configured to allocate the flash memory to provide the first block as the run-time write block when the table-outdated block is full. In another exemplary embodiment, the microcontroller is configured to allocate the flash memory to provide the first block as the run-time write block during a power recovery process due to an unexpected power-off event that interrupted write operations on the table-outdated block.
A flash memory control method in accordance with an exemplary embodiment of the disclosure includes the following steps: allocating a flash memory to provide a first block from a plurality of blocks of the flash memory to work as a run-time write block for reception of write data; and, during a power recovery process due to an unexpected power-off event that interrupted write operations on the first block, allocating the flash memory to provide a second block from the blocks for complete data recovery of the first block and to replace the first block as the run-time write block.
In an exemplary embodiment, the flash memory control method further comprises the following steps: establishing a physical-to-logical address mapping table in a random access memory to record logical addresses corresponding to physical addresses of a table-outdated block between the blocks of the flash memory; allocating the flash memory to provide the first block as the run-time write block when finishing the writing of the table-outdated block; and updating a logical-to-physical address mapping table in accordance with the physical-to-logical address mapping table at intervals between write operations on the run-time write block, wherein the logical-to-physical address mapping table is provided within the flash memory.
In an exemplary embodiment, the flash memory is allocated to provide the first block as the run-time write block when the table-outdated block is full. In another exemplary embodiment, the flash memory is allocated to provide the first block as the run-time write block during a power recovery process due to an unexpected power-off event that interrupted write operations on the table-outdated block.
A detailed description is given in the following embodiments with reference to the accompanying drawings.
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.
In an exemplary embodiment, the flash memory is allocated to provide the block 200 as the run-time write block when the former run-time write block (i.e. the table-outdated block TOB) is full. In another exemplary embodiment, the flash memory is allocated to provide the block 200 as the run-time write block during a power recovery process due to an unexpected power-off event that interrupted write operations on the former run-time write block (i.e. the table-outdated block TOB). Note that in the power recovery process due to the unexpected power-off event that interrupted write operations on the former run-time write block (i.e. the table-outdated block TOB), the physical-to-logical address mapping table F2H_TOB has to be restored into the random access memory. Thus, the logical-to-physical address mapping table H2F is updated in accordance with the restored physical-to-logical address mapping table F2H_TOB at intervals between write operations on the run-time write block 200.
However, an unexpected power-off event may also occur to interrupt write operations on the run-time write block 200. A power recovery process for an unexpected power-off event that interrupted write operations on the run-time write block 200 is discussed in the following paragraphs.
The control unit 306 couples the flash memory 304 to the host 302 and comprises a microcontroller 320, a random access memory 322 and a read-only memory 324. A ROM code is stored in the read-only memory 324. The microcontroller 320 operates the flash memory 304 by executing the ROM code stored in the read-only memory 324 or/and by executing the ISPs stored in the blocks 308 of the flash memory 304. The microcontroller 320 is configured to perform the block allocation of the flash memory 304 (as shown in
If an unexpected power-off event SPO was occurred and interrupted write operations on the block 314_1, a specific power-recovery process (e.g. an SPOR (abbreviated from “Sudden Power-Off Recovery”) process) is called for. During a power recovery process (SPOR) for the unexpected power-off event SPO that interrupted write operations on the block 314_1, the microcontroller 320 is configured to allocate the flash memory 304 to provide a block 314_2 from the spare blocks 312 for complete data recovery of the block 314_1 and to replace the block 314_1 as the run-time write block. Note that during the power recovery process (SPOR) due to the unexpected power-off event SPO that interrupted write operations on the block 314_1, the microcontroller 320 may restore the physical-to-logical mapping table F2H_TOB into the random access memory 322 based on physical-to-logical mapping information contained in the table-outdated block TOB if there remains any mapping information that has not been updated to the logical-to-physical address mapping table H2F. After the data of block 314_1 is finished being restored in the block 314_2, the remaining mapping information may be used in updating the logical-to-physical address mapping table H2F between the subsequent write operations on the block 314_2. In an exemplary embodiment, the microcontroller 320 is configured to perform the complete data recovery from the block 314_1 to the block 314_2 based on an error checking and correction (ECC) algorithm.
In this manner, even though the unexpected power-off events repeats, the data of the run-time write block is completely recovered in a single block rather than being divided into sections and scattered over several blocks.
Any technique using the aforementioned concept to control a flash memory is within the scope of the invention. The invention further involves flash memory control methods, which are not limited to any specific controller architecture.
While the invention has been described by way of example and in terms of the 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.
This application claims the benefit of U.S. Provisional Application No. 61/920,830, filed Dec. 26, 2013, the entirety of which is incorporated by reference herein.
Number | Name | Date | Kind |
---|---|---|---|
6895490 | Moore et al. | May 2005 | B1 |
6970890 | Bruce | Nov 2005 | B1 |
6988175 | Lasser | Jan 2006 | B2 |
7603525 | Lasser | Oct 2009 | B2 |
7886108 | Lee et al. | Feb 2011 | B2 |
7904635 | Deng | Mar 2011 | B2 |
8078794 | Lee et al. | Dec 2011 | B2 |
8352706 | Yano et al. | Jan 2013 | B2 |
8688894 | Kuehne | Apr 2014 | B2 |
9311006 | Moshayedi | Apr 2016 | B2 |
9355028 | Cheng | May 2016 | B2 |
20030163630 | Aasheim | Aug 2003 | A1 |
20040268063 | Lasser | Dec 2004 | A1 |
20060282644 | Wong | Dec 2006 | A1 |
20070021963 | Deng et al. | Jan 2007 | A1 |
20080104309 | Cheon et al. | May 2008 | A1 |
20080126680 | Lee et al. | May 2008 | A1 |
20080215800 | Lee et al. | Sep 2008 | A1 |
20090144501 | Yim et al. | Jun 2009 | A2 |
20090172262 | Olbrich | Jul 2009 | A1 |
20090240871 | Yano et al. | Sep 2009 | A1 |
20090240873 | Yu et al. | Sep 2009 | A1 |
20090327589 | Moshayedi | Dec 2009 | A1 |
20090327591 | Moshayedi | Dec 2009 | A1 |
20090327840 | Moshayedi | Dec 2009 | A1 |
20100082883 | Chen et al. | Apr 2010 | A1 |
20100169551 | Yano et al. | Jul 2010 | A1 |
20100174851 | Leibowitz et al. | Jul 2010 | A1 |
20100306451 | Johnson | Dec 2010 | A1 |
20110055458 | Kuehne | Mar 2011 | A1 |
20110289255 | Wang et al. | Nov 2011 | A1 |
20120239862 | Seo et al. | Sep 2012 | A1 |
20120297121 | Gorobets et al. | Nov 2012 | A1 |
20120311245 | Yano et al. | Dec 2012 | A1 |
20130304975 | Wang et al. | Nov 2013 | A1 |
20130326120 | Cheng | Dec 2013 | A1 |
20130326169 | Shaharabany et al. | Dec 2013 | A1 |
20140006898 | Sharon et al. | Jan 2014 | A1 |
20140101369 | Tomlin et al. | Apr 2014 | A1 |
20140122776 | El Maghraoui et al. | May 2014 | A1 |
20140136753 | Tomlin et al. | May 2014 | A1 |
20150261444 | Yoshii et al. | Sep 2015 | A1 |
Number | Date | Country |
---|---|---|
201142589 | Dec 2011 | TW |
201305817 | Feb 2013 | TW |
201348958 | Dec 2013 | TW |
201348959 | Dec 2013 | TW |
Entry |
---|
Non-Final Office Action mailed Apr. 18, 2016, issued in U.S. Appl. No. 14/534,488. |
Non-Final Office Action dated Jun. 30, 2016, issued in U.S. Appl. No. 14/534,633. |
Non-Final Office Action dated Jul. 1, 2016, issued in U.S. Appl. No. 14/534,603. |
Office Action dated May 26, 2016, issued in U.S. Appl. No. 14/534,686. |
Number | Date | Country | |
---|---|---|---|
20150186224 A1 | Jul 2015 | US |
Number | Date | Country | |
---|---|---|---|
61920830 | Dec 2013 | US |