Momentary power failure recovery processing method and computer readable storage medium and device

By reading and marking the correct pages of NAND flash memory in the processing unit, and discarding incorrect data based on the protection information of the temporary block, the problem of data damage caused by instantaneous power outages is solved, and the order and integrity of data recovery are achieved.

CN112286721BActive Publication Date: 2024-10-08SILICON MOTION INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910664125.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-23
Publication Date
2024-10-08
Estimated Expiration
2039-07-23

AI Technical Summary

Technical Problem

NAND flash memory may interrupt writing operations in the event of a momentary power outage, resulting in data corruption that is difficult to effectively recover with existing technology.

Method used

When the program code of the software or firmware module is loaded and executed by the processing unit, the page status of the current block and the temporary block is read, the last correct page is identified, and the data of the incorrect page is discarded according to the protection information of the temporary block. Ensure page order and data integrity.

Benefits of technology

Effectively restores the order of pages in the current block and temporary block after a momentary power outage, avoids the inclusion of invalid data between correct pages, and ensures the time order and integrity of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112286721B_ABST
    Figure CN112286721B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for recovering from a momentary power failure, which is executed by a processing unit and includes: after a momentary power failure and power restart, sequentially reading pages of a current block; identifying the last correct page in the current block according to the page reading status of the current block; sequentially reading protection information of pages of a temporary storage block to identify the first incorrect page in the temporary storage block, wherein the protection information of the first incorrect page in the temporary storage block includes address information pointing to a page after the last correct page in the current block; and discarding page data after the first incorrect page in the temporary storage block. By discarding page data in the temporary storage block whose storage time is later than the last correct page in the current block according to the protection information in the temporary storage block, the time sequence of the restored pages in the current block and the temporary storage block can be ensured, and the unrestored page data can be avoided from being mixed between the restored correct pages.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] Flash memory is usually divided into NOR flash memory and NAND flash memory. NOR flash memory is a random access device. The host can provide any address to access the NOR flash memory on the address pin and obtain the data stored at the address from the data pin of the NOR flash memory in a timely manner. In contrast, NAND flash memory is not random access, but serial access. NAND flash memory cannot access any random address like NOR flash memory. Instead, the host needs to write the value of serial bytes into the NAND flash memory to define the type of request command (such as read, write, erase, etc.) and the address used in this command. The address can point to a page (the smallest data block for write operations in flash memory) or a block (the smallest data block for erase operations in flash memory).

[0003] Since a natural or man-made power outage may interrupt the write operation of a NAND flash memory storage device, an embodiment of the present invention provides a power outage recovery processing method and a computer-readable storage medium and device for recovering the interrupted write operation. Summary of the invention

[0004] In view of this, how to alleviate or eliminate the deficiencies in the above-mentioned related fields is indeed a problem to be solved.

[0005] The present invention relates to a method for recovering from an instantaneous power failure, which is implemented by a processing unit when loading and executing a program code of a software or firmware module, and comprises: after an instantaneous power failure and restarting the power supply, sequentially reading pages of a current block; identifying the last correct page in the current block according to the page reading status of the current block; sequentially reading protection information of pages of a temporary storage block to identify the first incorrect page in the temporary storage block, wherein the protection information of the first incorrect page in the temporary storage block includes address information pointing to a page after the last correct page in the current block; and discarding page data after the first incorrect page in the temporary storage block.

[0006] The present invention further relates to a computer-readable storage medium for instantaneous power failure recovery processing, which is used to store a computer program that can be executed by a processing unit, and the computer program implements the above method steps when executed by the processing unit.

[0007] The present invention further relates to a device for processing instantaneous power failure recovery, comprising: a flash memory access interface and a processing unit. The processing unit executes the method as described above.

[0008] One of the advantages of the above embodiment is that in the instantaneous power failure recovery process, by discarding the page data in the temporary block that is stored later than the last correct page in the current block according to the protection information in the temporary block, the time sequence of the restored pages in the current block and the temporary block can be ensured, avoiding the mixing of unrestored page data between the correct pages after the recovery.

[0009] Other advantages of the present invention will be explained in more detail with reference to the following description and accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application.

[0011] Figure 1 FIG. 4 is a schematic diagram of a system architecture of a flash memory according to an embodiment of the present invention.

[0012] Figure 2 FIG. 4 is a schematic diagram of the connection between an access sub-interface and a plurality of storage sub-units according to an embodiment of the present invention.

[0013] Figure 3 FIG. 4 is a schematic diagram of data organization according to an embodiment of the present invention.

[0014] Figure 4 FIG. 4 is a schematic diagram of data block configuration for recovery in response to momentary power failure according to an embodiment of the present invention.

[0015] Figure 5 and Figure 6 Schematic diagram of protection information stored in a current block, a temporary block, and a backup block according to an embodiment of the present invention.

[0016] Figure 7 The flowchart is a method for writing less than a full page of data into an empty page of a temporary storage block according to an embodiment of the present invention.

[0017] Figure 8 The flowchart is a method for writing a whole page of data into an empty page of a current block according to an embodiment of the present invention.

[0018] Fig. 9 The present invention is a flowchart of a method for identifying a correct page in a momentary power failure recovery process according to an embodiment of the present invention.

[0019] Fig.10 Schematic diagram of data and protection information stored in a current block, a temporary block, and a backup block according to an embodiment of the present invention.

[0020] Fig.11The present invention is a flowchart of a method for migrating adjacent pages of an uncorrectable ECC (UECC) page in a power failure recovery process according to an embodiment of the present invention.

[0021] Fig.12 FIG. 4 is a schematic diagram of processing neighboring pages of a UECC page according to an embodiment of the present invention.

[0022] Fig.13 The flowchart is a method for migrating adjacent pages of a UECC page in a power failure recovery process according to an embodiment of the present invention.

[0023] [List of Reference Numerals]

[0024] 100 Flash Memory System

[0025] 110 Host side

[0026] 130 Device side

[0027] 131 Physical Layer

[0028] 132 Data Link Layer

[0029] 133 Flash Memory Controller

[0030] 134 Processing Units

[0031] 136 Static Random Access Memory

[0032] 139 Flash memory access interface

[0033] 150 storage units

[0034] 170 Universal Flash Storage Interconnection Layer

[0035] 139_0 Access sub-interface

[0036] 150_0~150_i storage subunit

[0037] 210 Data cable

[0038] 230_0~230_i Chip start control signal

[0039] 310, 330 Data plane

[0040] 310_0~310_m、330_0~330_m blocks

[0041] 410 Data Buffer

[0042] 451 Current Block

[0043] 453 Temporary Block

[0044] 455 Backup Block

[0045] 510, 510a, 510b, 530, 550a, 550b remaining space

[0046] S710~S730 Method steps

[0047] S810~S860 Method Steps

[0048] S910~S990 Method Steps

[0049] 1010a~1014a、1010a~1014b、1050a~1050b、1030、1031 remaining space

[0050] S1110~S1150 Method steps

[0051] S1300~S1330 Method Steps DETAILED DESCRIPTION

[0052] The embodiments of the present invention will be described below with reference to the accompanying drawings. In these drawings, the same reference numerals represent the same or similar components or method flows.

[0053] It must be understood that the words "comprise", "include" and the like used in this specification are used to indicate the existence of specific technical features, values, method steps, job processing, components and / or assemblies, but do not exclude the addition of more technical features, values, method steps, job processing, components, assemblies, or any combination of the above.

[0054] The words "first", "second", "third", etc. used in the present invention are used to modify the components in the claims, and are not used to indicate a priority order, a prior relationship, or that one component precedes another, or a time sequence when executing method steps. They are only used to distinguish components with the same name.

[0055] It should be understood that when a component is described as being "connected" or "coupled" to another component, it can be directly connected or coupled to the other component, and there may be intervening components. Conversely, when a component is described as being "directly connected" or "directly coupled" to another component, there are no intervening components. Other words used to describe the relationship between components can also be interpreted in a similar manner, such as "between" versus "directly between", or "adjacent" versus "directly adjacent", etc.

[0056] refer to Figure 1. The flash memory system architecture 100 includes a host 110, a device 130 and a storage unit 150. This system architecture can be implemented in electronic products such as personal computers, laptop computers (Laptop PCs), tablet computers, mobile phones, digital cameras, digital video cameras, etc. The device 130 may include a processing unit 133. The host 110 and the device 130 can communicate with each other using a flash memory communication protocol (for example, Universal Flash Storage, UFS). The flash memory controller 133 is electrically connected (coupled) to the host 110 via a data link layer 132 and a physical layer 131. The flash memory controller 133 can access the host 110 through a direct memory access controller (not shown). Figure 1 ) from the data buffer (not shown in Figure 1 ) reads the user data obtained from the storage unit 150, and sequentially sends it to the host end 110 by driving the data link layer 132 and the physical layer 131. The flash memory controller 133 can access the flash memory through a direct memory access controller (not shown in FIG. Figure 1 ) stores the user data to be written by the host end 110 to the data buffer. The processing unit 134 can be implemented in a variety of ways, such as using general-purpose hardware, such as a single processor, a multi-processor with parallel processing capabilities, a graphics processor, a lightweight general-purpose processor (Lightweight General-Purpose Processor) or other processors with computing capabilities, and provides the functions described later when executing instructions (Instructions), macrocodes (Macrocode) or microcodes (Microcode). The flash memory controller 133 can be a UFS controller, which communicates with the host end 110 through the UFS communication protocol. Although the embodiment of the present invention takes the UFS communication protocol as an example, the present invention can also be applied to other communication protocols, such as Universal Serial Bus (USB), advanced technology attachment (ATA), serial advanced technology attachment (SATA), peripheral component interconnect express (PCI-E) or other interface communication protocols.

[0057] The device end 130 further includes a flash memory access interface 139, so that the processing unit 134 can communicate with the storage unit 150 through the flash memory access interface 139. Specifically, a double data rate (DDR) communication protocol can be used, such as an open NAND flash interface (ONFI), a double data rate switch (DDR Toggle) or other interfaces. The processing unit 134 writes user data to a specified address (destination address) in the storage unit 150 through the flash memory access interface 139, and reads user data from a specified address (source address) in the storage unit 150. The flash memory access interface 139 uses a number of electronic signals to coordinate the data and command transmission between the processing unit 134 and the storage unit 150, including a data line, a clock signal, and a control signal. The data lines can be used to transmit commands, addresses, read and write data; the control signal lines can be used to transmit control signals such as chip enable (Chip Enable CE), address extraction enable (Address Latch Enable ALE), command extraction enable (Command Latch Enable CLE), and write enable (Write Enable WE).

[0058] The storage unit 150 may include a plurality of storage subunits, each of which uses an associated access sub-interface to communicate with the processing unit 134. One or more storage subunits may be encapsulated in a die. The flash memory access interface 139 may include j access sub-interfaces, each of which is connected to i storage subunits. The access sub-interface and the storage subunits connected thereto may be collectively referred to as output-input channels, and each storage subunit may be identified by a logical unit number (LogicUnit Number LUN). In other words, i storage subunits share one access sub-interface. For example, when the device end 130 includes 4 outputs and inputs and each output and input is connected to 4 storage subunits, the device end 130 may access 16 storage subunits. The processing unit 134 may drive one of the access sub-interfaces to read from a specified storage subunit or write data to a specified storage subunit. Each storage subunit has an independent chip enable (CE) control signal. In other words, when data is to be read or written to a specified storage sub-unit, the associated access sub-interface needs to be driven to activate the chip activation control signal of the storage sub-unit. Figure 2The processing unit 134 can select one of the connected storage sub-units 150_0 to 150_i using the independent chip enable control signals 230_0 to 230_i through the access sub-interface 139_0, and then read data from the specified address of the selected storage sub-unit through the shared data line 210, or transmit user data to be written to the specified address to the selected storage sub-unit.

[0059] Each storage subunit may include multiple data planes, each data plane may include multiple blocks, and each block may include multiple pages. Figure 3 , taking the storage subunit 150_0 as an example. The storage subunit 150_0 includes two data planes 310 and 330. The data plane 310 includes blocks 310_0 to 310_m, and the data plane 330 includes blocks 330_0 to 330_m. Each block includes n+1 pages. Each block can be configured as a single-level cell block (SingleLogical Cell SLC block), a multi-level cell block (Multi-Level Cell MLC block) or a triple-level cell block (Triple Level Cell TLC block). Each memory cell (memorycells) in the SLC, MLC and TLC blocks can store two, four and eight states, respectively. Each word line (word line) in the SLC block can store one page of data. Each word line in the MLC block can store two pages of data, including the most significant bit page (MostSignificant Bit MSB page) and the least significant bit page (Least Significant Bit LSB page). Each word line in a TLC block can store three pages of data, including a most significant bit page, a center significant bit page (CSB page), and a least significant bit page.

[0060] refer to Figure 4. In direct-write mode, there is no cache space configured in the static random access memory (SRAM) 136 to cache a large number of host write commands and data to be written issued by the host end 110. Only a command queue and a data buffer 410 with limited space are configured to store the host write commands and the data to be written. Different from the cache mode, the processing unit 134 drives the flash memory access interface 139 to write the data to be written into the storage unit 150 according to the host write command in the direct-write mode, and then completes the processing of the host write command. In order to process various host write commands issued by the host end 110, the storage subunit 150_0 can be configured with two blocks: a current block 451 and a temporary block 453. The current block 451 is configured as an MLC or TLC block, and the temporary block 453 is configured as an SLC block. Assume that the minimum unit of data management by the host end 110 is 4K bytes, and the length of data stored in each page in the storage subunit 150_0 is 16K bytes: when the host write command indicates to write data of one or more page lengths, the processing unit 134 drives the flash memory access interface 139 to write the data to one or more empty pages in the current block 451 in MLC or TLC mode. When the host write command indicates to write data less than the page length, the processing unit 134 drives the flash memory access interface 139 to write the data to one or more sectors of the empty page in the temporary block 453 in SLC mode, wherein each sector stores 4K bytes of data. Once any page in the temporary block 453 is filled with data, the processing unit 134 can drive the flash memory access interface 139 to write the entire page of data in the temporary block 453 to an empty page in the current block 451 in MLC or TLC mode.

[0061] Since the current block 451 is an MLC or TLC block, that is, two or three pages of data are stored in the same word line, if a sudden power off (SPO) occurs during the process of writing data into the current block 451, the previously written page data may be damaged. Figure 3 , when block 310_0 is an MLC block (current block), page P#0 is the LSB page of a word line, and page P#3 is the MSB page of the same word line, pages P#0 and P#3 can be called a page pair. If a power outage occurs during the process of writing data to page P#3 of block 310_0, the data previously written to page P#0 may be damaged. In order to prevent the above problems, refer to Figure 4, the storage subunit 150_0 can be further configured with a backup block 455, which is configured as an SLC block. Before writing data to an MSB page (such as page P#3) in the current block (such as block 310_0), the processing unit 134 drives the flash memory access interface 139 to first store (back up) the data of the corresponding LSB page (such as page P#0) of the MSB page in the current block to an empty page in the backup block 455, and then write the data to the MSB page.

[0062] Similarly, in the case where the current block is a TLC block, the processing unit 134 may drive the flash memory access interface 139 to first store (back up) the data of the CSB page corresponding to the MSB page in the current block to an empty page in the backup block 455, and then write the data to the MSB page. Alternatively, the processing unit 134 may drive the flash memory access interface 139 to first store (back up) the data of the LSB page corresponding to the CSB page in the current block to an empty page in the backup block 455, and then write the data to the CSB page.

[0063] Those skilled in the art may implement any one of the current block 451, the temporary block 453, and the backup block 455 on any data plane (eg, Figure 3 Data plane 310 or 330 shown).

[0064] In order to shorten the processing time of sudden power off recovery, the processing unit 134 does not spend time to rewrite data to the current block 451 through the flash memory access interface 139 as much as possible, but obtains the corresponding data from the temporary block 453 and / or the backup block 455 to rebuild the current block 451. The embodiment of the present invention uses the spare space of each page in the current block 451, the temporary block 453 and the backup block 455 to store protection information for use in the possible sudden power off recovery process (SPOR process) in the future. In order to maintain the storage order of page data in the current block 451, the temporary block 453 and the backup block 455, the remaining space of a page of the current block 451 can be recorded in the address information of the first empty page of the temporary block 453 pointed to when the page data is stored (for example, the number of the temporary block 453 and the number of the first empty page therein), and the remaining space of a page of the temporary block 453 can be recorded in the address information of the first empty page of the current block 451 pointed to when the page data is stored (for example, the number of the current block 451 and the number of the first empty page therein). Since the data of the CSB page or LSB page (which can be called the original page) of the current block 451 may be backed up to a page (which can be called the backup page) in the backup block 455, the remaining space of one or more pages of the backup block 455 can record the address information of the first empty page of the current block 451 (for example, the number of the current block 451 and the number of the first empty page therein) when storing this page data, and the address information of the first empty page of the temporary block 453 (for example, the number of the temporary block 453 and the number of the first empty page therein).

[0065] In some embodiments, the remaining space of each page in the current block 451, the temporary block 453, and the backup block 455 can store information pointing to more than two pages. Figure 5 For example, the data in the Nth page of the current block 451 is backed up to the Oth page of the backup block 455. Figure 5 The square with diagonal lines in the middle represents an empty page. The remaining space 510 of the Nth page of the current block 451 can store address information pointing to the M+1th page of the temporary block 453. The remaining space 530 of the Mth page of the temporary block 453 can store address information pointing to the N+1th page of the current block 451. The remaining space 550a of the Oth page of the backup block 455 can store address information pointing to the N+1th page of the current block 451, and the remaining space 550b can store address information pointing to the M+1th page of the temporary block 453.

[0066] In some other embodiments, the remaining space of each page in the current block 451, the temporary block 453, and the backup block 455 can only store information pointing to one page. To completely record the protection information that needs to be stored in the remaining space of the backup block 455 as described above, the processing unit 134 stores the data in the empty pages of the current blocks of the data plane 310 and the data plane 330 in an alternating manner, and regards the two pages of the data plane 310 and the data plane 330 as a page group. For example, referring to Figure 4 , assuming that block 310_1 is the current block of the data plane 310, and block 330_1 is the current block of the data plane 330: the processing unit 134 may sequentially write data into page P#0 of the current block 310_1, page P#0 of the current block 330_1, page P#1 of the current block 310_1, and page P#1 of the current block 330_1, wherein the current block 310_1 and page P#0 of the current block 330_1 are one page group, and the current block 310_1 and page P#1 of the current block 330_1 are another page group. Figure 6 For example, the current block 451a is set in the data plane 310, and the current block 451b is set in the data plane 330. The data of the Nth page of the current block 451a is backed up to the Oth page of the backup block 455, and the data of the Nth page of the current block 451b is backed up to the O+1th page of the backup block 455. Figure 6 The square with the slash in the middle represents an empty page. The Nth page of the current block 451a and the current block 451b are a page group. The remaining space 510a of the Nth page of the current block 451a can store address information pointing to the Mth page of the temporary block 453, and the remaining space 510b of the Nth page of the current block 451b can not store any address information. The remaining space 530 of the Mth page of the temporary block 453 can store address information pointing to the N+1th page of the current block 451a. The remaining space 550a of the Oth page of the backup block 455 can store address information pointing to the N+1th page of the current block 451a, and the remaining space 550b of the O+1th page of the backup block 455 can store address information pointing to the Mth page of the temporary block 453.

[0067] refer to Figure 7 . Figure 7 The method shown can be implemented by the processing unit 134 when loading and executing specific firmware or software instructions. After the processing unit 134 prepares to write data less than a full page length (such as 4K, 8K, 12K data) to an empty page of the temporary storage block according to the host write instruction in the command queue (step S710), it generates protection information of the temporary storage page, including address information pointing to the first empty page of the current block (step S730). For example, the processing unit 134 generates Figure 6 The remaining space 530 in the temporary storage block 453, or Figure 7 The remaining space 530a or 530b of the temporary storage block 453 is used to store the protection information. Next, the processing unit 134 drives the flash memory access interface 139 to write the data and the protection information into the first empty page of the temporary storage block (step S750).

[0068] refer to Figure 8 . Figure 8 The method shown may be implemented by the processing unit 134 when loading and executing specific firmware or software instructions. The processing unit 134 prepares to write an entire page of data to an empty page of the current block according to the host write instruction in the command queue (step S810). Personnel in the relevant technical field understand that an entire page of data may or may not include data obtained from the temporary block. Next, the processing unit 134 determines whether there is page data that has been written to the word line (wordline) of the page to be written (step S820). For example, whether there is LSB or CSB page data that has been written to the word line when processing the previous host write command. If the judgment is no (the "no" path in step S820), for example, the page to be written is the LSB page of a word line, or the LSB or CSB page data that has been written is data written when processing the same host write command, the processing unit 134 generates protection information for the current page, including address information pointing to the first empty page in the temporary block (step S830). For example, the processing unit 134 generates Figure 6 The remaining space 510 of the current block 451, or Figure 7 Next, the processing unit 134 drives the flash memory access interface 139 to write the data and the protection information into the first empty page of the current block (step S840).

[0069] If the judgment is yes (the "yes" path in step S820), the processing unit 134 generates protection information for the backup page, including address information pointing to the first empty page of the current block and address information pointing to the first empty page of the temporary block (step S850). Figure 6 or Figure 7 The remaining spaces 550a and 550b of the backup block 455 are used to store the protection information. The processing unit 134 drives the flash memory access interface 139 to write the written page data and protection information into the first empty page of the backup block (step S860). Then, the processing unit 134 executes the processing of steps S830 and S840 as described above.

[0070] Since a momentary power failure may damage page data that has been written or is being written, when the power is restarted after a momentary power failure, the processing unit 134 may perform a momentary power failure recovery process to identify the correct data in the current block and the temporary block. Fig. 9 . Fig. 9 The method shown can be implemented by the processing unit 134 when loading and executing specific firmware or software instructions. The processing unit 134 uses the variable i to record the page number being scanned in the current block, which is initially 0 (step S910). The processing unit 134 repeatedly executes a loop (steps S920 to S940) to find the page in the current block that is damaged by the momentary power failure. In each round, the processing unit 134 drives the flash memory access interface 139 to read the i-th page of the current block (step S920), and performs two judgments (steps S930 and S940). When the read page is not irreparable (the "No" path in step S930) or the read page is irreparable but has been backed up in the backup block (the "Yes" path in step S930 followed by the "Yes" path in step S940), the data of the read page is judged to be correct data, and the variable i is increased by 1 to perform the judgment of the next page (step S935). When the page being read cannot be repaired (the "Yes" path in step S930) and is not backed up in the backup block (the "No" path in step S940), the data of the read page is determined to be incorrect data and the loop ends. The page being read cannot be repaired means that the processing unit 134 still cannot repair the error bits in the read data using the error check and correction ECC code in the read page data. The page that cannot be repaired can be called an uncorrectable ECC-UECC page. After the loop ends, the processing unit 134 uses the variable v1=i-1 to record the number of the last correct page in the current block. In other words, the i-th page and subsequent pages in the current block are pages damaged by the instantaneous power failure. Personnel in the relevant technical field may not add a backup mechanism of the backup block when writing data to the current block, so that the method described above may not perform the judgment of step S940.

[0071] Next, the processing unit 134 uses the variable j to record the page number being scanned in the temporary block, which is initially 0 (step S960). The processing unit 134 repeatedly executes a loop (steps S970 to S980) to find the correct page in the temporary block. In each round, the processing unit 134 drives the flash memory access interface 139 to read the protection information of the jth page of the temporary block (step S970), and determines whether the protection information points to the page after the v1th page of the current block (step S980). When the read protection information does not point to the page after the v1th page of the current block, that is, it points to the page before or after the v1th page of the current block (the "no" path in step S980), the data of the read page is judged to be correct data, and the variable j is increased by 1 to judge the next page (step S975). When the read protection information points to the page after the v1th page of the current block (the "yes" path in step S980), the data of the read page is judged to be incorrect data, and the loop ends. After the loop ends, the processing unit 134 uses the variable v2=j-1 to record the number of the last correct page in the temporary storage block. In other words, the jth page in the temporary storage block (that is, the first incorrect page in the temporary storage block) and subsequent pages are temporary storage data that cannot be used after a momentary power outage.

[0072] From one aspect, an embodiment of the present invention proposes a method step implemented by executing relevant program codes by the processing unit 134 in the device end 130: after a momentary power outage and then restarting the power supply, driving the flash memory access interface 139 to sequentially read the pages of the current block 451; identifying the last correct page in the current block 451 according to the page read status of the current block 451; driving the flash memory access interface 139 to sequentially read the protection information of the pages of the temporary block 453 to identify the first incorrect page in the temporary block 453, wherein the protection information of the first incorrect page in the temporary block 453 includes address information pointing to the page after the last correct page in the current block 451; and discarding the page data after the first incorrect page in the temporary block 453. In the instant power failure recovery process, by discarding all page data in the temporary block 453 that is later than the last correct page in the current block 451 based on the protection information in the temporary block 453, the time sequence of the restored pages in the current block 451 and the temporary block 453 can be ensured, avoiding the mixing of unrestored page data between the correct pages after the restoration.

[0073] refer to Fig.10Assume that the current block 451a is set in the data plane 310, and the current block 451b is set in the data plane 330, the Q+1th page of the current block 451a is stored in the Pth page of the backup block 455, the Q+1th page of the current block 451b is stored in the P+1th page of the backup block 455, the protection information 1030 of the Rth page of the temporary block 453 points to the Q+3th page of the current blocks 451a and 451b, and the protection information 1031 of the R+1th page of the temporary block 453 points to the Q+4th page of the current blocks 451a and 451b. When the processing unit 134 scans that the Q+1th page of the current blocks 451a and 451b is a UECC page (the "Yes" path in step S930) but has been backed up in the backup block 455 (the "Yes" path in step S940), the data of the Pth page and the P+1th page in the backup block 455 are used to replace the data of the Q+1th page of the current blocks 451a and 451b, and the scanning continues. When the processing unit 134 scans that the Q+4th page of the current blocks 451a and 451b is a UECC page (the "Yes" path in step S930) but has not been backed up in the backup block 455 (the "No" path in step S940), the processing unit 134 determines that the last correct page in the current blocks 451a and 451b is the Q+3th page (step S950).

[0074] In addition, when the processing unit 134 scans that the protection information of the R+1th page of the temporary storage block 453 points to the page after the last correct page in the current blocks 451a and 451b (the "yes" path in step S980), the processing unit 134 determines that the last correct page in the temporary storage block 453 is the Rth page (step S990).

[0075] Although the data of the pages before the UECC page detected in the end are all correct data, when a momentary power outage occurs, the physical word lines and pages adjacent to the UECC page may be affected, thereby reducing the availability of its storage cells, such as reducing the number of normal reads. Fig.11 . Fig.11The method shown can be implemented by the processing unit 134 when loading and executing specific firmware or software instructions. The processing unit 134 drives the flash memory access interface 139 to copy the data of the last correct page and the previous t-1 pages in the current block to the empty page of the temporary block (step S1110). t can be set to any integer between 2 and 5 according to different system requirements. Then, the processing unit 134 configures the t pages after the UECC page detected in the current block as dummy pages (step S1130). In some embodiments, the processing unit 134 can drive the flash memory access interface 139 to fill the t pages after the UECC page detected in the current block with dummy values, such as 0xFF. Then, the processing unit 134 drives the flash memory access interface 139 to write the data stored in the temporary block to the empty page of the new current block or the empty page after the last dummy page in this current block (step S1150).

[0076] Continue Fig.10 For use cases, see Fig.12 The data and protection information 1011a to 1013c of the Q+1 to Q+3 pages in the current blocks 451a and 451b are copied and stored in the Q+1 to Q+3 pages in the current blocks 451a and 451b (steps S1110 and S1150). The Q+5 to Q+7 pages in the current blocks 451a and 451b are configured as dummy pages (step S1130).

[0077] However, the same current block may experience two or more instantaneous power outages during the data writing process, causing the previously migrated page data to be misjudged as the correct page data. To solve this problem, each record in the Flash-to-Host F2H table associated with the current block in the static random access memory 136 is added with a valid field to indicate whether the data in a specific page of the current block is valid or invalid. In addition, Fig.11 The method shown can be modified to Fig.13 After successfully allocating the data of the dummy page and the migration candidate page in the current block to the empty page after the last dummy page in the current block (steps S1110, S1130 and S1310), the valid fields of the records associated with the migrated page, UECC page and dummy page in the F2H table of the current block are set to invalid (step S1330). Fig.12, the valid fields of the records associated with the Q+1 to Q+7 pages in the F2H table of the current blocks 451a and 451b are set to invalid. Personnel in the relevant technical field understand that the host end 110 can issue a host erase command to the processing unit 134 to instruct to erase the data of a specific logical address. After address translation, the processing unit 134 knows which segment or segments of which page of the current block the logical address is mapped to. After the data of all segments in a page of the current block are deleted due to the host erase command, the processing unit 134 can set the valid fields in the records associated with this page in the F2H table to invalid.

[0078] also, Fig.11 Step S1110 is modified to Fig.13 In step S1300, the processing unit 1340 also checks the validity of the last correct page in the current block and the t-1 pages before it in the F2H table. If the last correct page in the current block and the t-1 pages before it are invalid pages, the processing unit 1340 will not perform the migration operation as in steps S1310 and S1330. In other words, the last correct page and the t-1 pages before it described in step S1330 are all valid.

[0079] Although the numbers of migration pages and false pages in the above-described embodiments are the same, those skilled in the art may configure the numbers of migration pages and false pages to different numbers, for example, the total number of migration pages is n2, the total number of false pages is n1, and each of n1 and n2 may be an integer between 2 and 5.

[0080] The processing unit 134 executes Figures 7 to 9 , Fig.11 and Fig.13 The method steps can be implemented by a computer program product composed of one or more functional modules. These functional modules are stored in a non-volatile storage device and can be loaded and executed by the processing unit 134 at a specific time point. All or part of the steps in the method described in the present invention can be implemented by a computer program, such as an operating system of a computer, a driver for specific hardware in a computer, or a software program. In addition, it can also be implemented in other types of programs as shown above. A person with ordinary knowledge in the relevant technical field can write the method of the embodiment of the present invention into a computer program, which will not be described for the sake of simplicity. The computer program implemented according to the method of the embodiment of the present invention can be stored in an appropriate computer-readable storage medium, such as a DVD, CD-ROM, USB, hard disk, or placed on a network server that can be accessed through a network (for example, the Internet, or other appropriate carriers).

[0081] Although Figure 1 , Figure 2 and Figure 4The components described above are included, but it does not exclude the use of more additional components without violating the spirit of the invention to achieve better technical effects. Figures 7 to 9 , Fig.11 and Fig.13 The flowchart is executed in a specified order, but without violating the spirit of the invention, a person skilled in the art can modify the order of these steps while achieving the same effect, so the present invention is not limited to the order described above. In addition, a person skilled in the art can also integrate several steps into one step, or perform more steps sequentially or in parallel in addition to these steps, and the present invention is not limited thereto.

[0082] Although the present invention is described using the above embodiments, it should be noted that these descriptions are not intended to limit the present invention. On the contrary, the present invention covers obvious modifications and similar arrangements that are obvious to those skilled in the art. Therefore, the scope of the claims should be interpreted in the broadest way to include all obvious modifications and similar arrangements.

Claims

1. A computer-readable storage medium for instantaneous power failure recovery processing, used to store a computer program that can be executed by a processing unit, characterized in that: When the computer program is executed by the processing unit, the following steps are implemented: After a power failure and power restart, the flash memory access interface is driven to sequentially read pages of a current block, wherein the current block is a multi-layer unit block or a three-layer unit block; When reading the first page of the current block, it is found that the first page is a page that cannot be error-checked and corrected, but the data of the first page has been stored in the second page of the backup block, and the data of the second page is used to replace the data of the first page, wherein the backup block is a single-layer unit block; Identifying the last correct page in the current block according to the page read status of the current block; The flash memory access interface is driven to sequentially read the protection information of the pages of the temporary block to identify the first incorrect page in the temporary block, wherein the temporary block is a single-layer unit block, the protection information of each page in the temporary block includes the address information of the first empty page of the current block pointed to by the storage page data at that time, and the protection information of the first incorrect page in the temporary block includes the address information pointing to the page after the last correct page in the current block; discarding page data after the first incorrect page in the temporary storage block; configuring a preset number of pages after the next page of the last correct page in the current block to be false pages; and The flash memory access interface is driven to store the last correct page in the current block and the previous pages equal to the preset number minus one into a new current block or an empty page after the last false page in the current block.

2. The computer-readable storage medium for instant power failure recovery processing according to claim 1, characterized in that: When the computer program is executed by the processing unit, the following steps are implemented: Before the instantaneous power failure, the protection information of each of the pages in the temporary storage block is generated, including the address information of the first empty page of the current block pointed to by the page data at that time; as well as The flash memory access interface is driven to write the data less than a full page length and the protection information into the first empty page of the temporary storage block.

3. The computer-readable storage medium for instantaneous power failure recovery processing according to claim 1, characterized in that: The next page of the last correct page in the current block is a page that cannot be error checked and corrected.

4. The computer-readable storage medium for instant power failure recovery processing according to claim 1, wherein: The next page of the last correct page in the current block is a page that cannot be error-checked and corrected, and the data therein is not stored in the backup block.

5. The computer-readable storage medium for instant power failure recovery processing according to claim 1, wherein: The first page is a least significant bit page or a middle significant bit page.

6. The computer-readable storage medium for instant power failure recovery processing according to claim 1, characterized in that: The preset number is an integer between 2 and 5.

7. A method for recovering from a momentary power failure, implemented by a processing unit at a device end when loading and executing a program code of a software or firmware module, characterized in that: Include: After a momentary power outage and a power restart, sequentially reading pages of a current block, wherein the current block is a multi-layer unit block or a three-layer unit block; When reading the first page of the current block, it is found that the first page is a page that cannot be error-checked and corrected, but the data of the first page has been stored in the second page of the backup block, and the data of the second page is used to replace the data of the first page, wherein the backup block is a single-layer unit block; Identifying the last correct page in the current block according to the page read status of the current block; Sequentially reading protection information of pages of a temporary storage block to identify a first incorrect page in the temporary storage block, wherein the temporary storage block is a single-layer unit block, the protection information of each page in the temporary storage block includes address information of a first empty page of the current block pointed to by the stored page data at that time, and the protection information of the first incorrect page in the temporary storage block includes address information pointing to a page after the last correct page in the current block; discarding page data after the first incorrect page in the temporary storage block; configuring a preset number of pages after the next page of the last correct page in the current block to be false pages; and The last correct page in the current block and the pages before it that are the preset number minus one are stored in a new current block or an empty page after the last false page in the current block.

8. The instantaneous power failure recovery processing method according to claim 7, characterized in that: Include: Before the instantaneous power failure, the protection information of each of the pages in the temporary storage block is generated, including the address information of the first empty page of the current block pointed to by the page data at that time; as well as The data less than a full page length and the protection information are written into the first empty page of the temporary storage block.

9. A device for recovering from instantaneous power failure, characterized in that: Include: Flash memory access interface; and A processing unit is coupled to the flash memory access interface, and after a power failure and power restart, drives the flash memory access interface to sequentially read pages of a current block, wherein the current block is a multi-layer unit block or a three-layer unit block; when reading a first page of the current block, it is found that the first page is a page that cannot be error-checked and corrected, but the data of the first page has been stored in a second page of a backup block, and the data of the first page is replaced by the data of the second page, wherein the backup block is a single-layer unit block; identifies the last correct page in the current block according to the page reading status of the current block; drives the flash memory access interface to sequentially read the protection information of the pages of the temporary block to identify the first incorrect page in the temporary block, wherein, The temporary block is a single-layer unit block, and the protection information of each page in the temporary block includes the address information of the first empty page of the current block pointed to by the data of this page at that time, and the protection information of the first incorrect page in the temporary block includes the address information pointing to the page after the last correct page in the current block; the page data after the first incorrect page in the temporary block is discarded; the pages after the next page of the last correct page in the current block are configured as false pages with a preset number of pages; and the flash memory access interface is driven to store the last correct page in the current block and the preset number of pages minus one before it into a new current block or an empty page after the last false page in the current block.

10. The instantaneous power failure recovery processing device as claimed in claim 9, characterized in that: Before the power is instantly cut off, the processing unit generates the protection information for each of the pages in the temporary storage block, including the address information of the first empty page of the current block pointed to by the page data at that time; and drives the flash memory access interface to write the data that is less than a full page length and the protection information into the first empty page of the temporary storage block.

11. The instantaneous power failure recovery processing device as claimed in claim 9, characterized in that: The next page of the last correct page in the current block is a page that cannot be error checked and corrected.

12. The instantaneous power failure recovery processing device as claimed in claim 9, characterized in that: The next page of the last correct page in the current block is a page that cannot be error-checked and corrected, and the data therein is not stored in the backup block.

13. The instantaneous power failure recovery processing device as claimed in claim 9, characterized in that: The first page is a least significant bit page or a middle significant bit page.

14. The instantaneous power failure recovery processing device as claimed in claim 9, characterized in that: The preset number is an integer between 2 and 5.