Flash memory management method and system, electronic equipment and storage medium

By detecting and diagnosing error information in super blocks of flash memory, accurately identifying bad blocks and replacing alternative blocks, the problem of space and life damage caused by incorrect marking in the existing technology is solved, and the stability and availability of flash memory are improved.

CN118538276APending Publication Date: 2024-08-23DAPUSTOR CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410721027.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Existing flash memory management technology directly marks physical blocks as bad blocks when an error is detected, resulting in loss of available space and lifespan damage. It lacks a method to accurately detect bad blocks to improve the stability of flash memory.

Method used

By managing the physical blocks of multiple Dies in the super block, after detecting the error message, the target physical block is determined and diagnosed. If the number is less than the number of check Dies, it is determined to be a normal or bad block, and an alternative is replaced if necessary. Physical blocks to avoid unnecessary bad block marking.

Benefits of technology

Under the premise of ensuring the life of flash memory, it can accurately detect bad blocks, reduce misjudgments, and improve the stability and available space utilization of flash memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118538276A
    Figure CN118538276A
Patent Text Reader

Abstract

The invention discloses a flash memory management method and system, electronic equipment and a storage medium, and belongs to the technical field of data storage technologies. The flash memory management method comprises the following steps: if error reporting information is detected, determining a target physical block with the error reporting information; determining a target Die according to the corresponding relationship between the target super block and the Die; determining the number p of the target Die with the error report information; judging whether the number p is smaller than m or not; if the number p is smaller than m, diagnosing the target physical block; if the diagnosis result of the target physical block is normal, judging that the target physical block is not a bad block so as to continue to use the target super block; and if the diagnosis result of the target physical block is abnormal, determining that the target physical block is a bad block. The bad block can be accurately detected on the premise of guaranteeing the service life of the flash memory, and the stability of the flash memory is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data storage, and in particular to a flash memory management method, system, electronic device and storage medium. Background Art

[0002] Nand Flash is also called flash memory. It consists of multiple Dies (chip grains before packaging), and each Die contains multiple physical blocks (physical blocks, phy blk). Super block (sblk) is a logical concept defined in the flash management system to simplify data management and improve performance. A super block includes multiple physical blocks from different Dies, which are logically regarded as a whole.

[0003] When an error message (uncorrected error, unc) appears in the flash memory, the physical block corresponding to the error message is usually directly marked as a bad block. This method loses the available space of the flash memory and causes great damage to the life of the flash memory.

[0004] Therefore, how to accurately detect bad blocks while ensuring the life of the flash memory and improve the stability of the flash memory is a technical problem that those skilled in the art currently need to solve. Summary of the invention

[0005] The purpose of the present application is to provide a flash memory management method, system, electronic device and storage medium, which can accurately detect bad blocks while ensuring the life of the flash memory and improve the stability of the flash memory.

[0006] In order to solve the above technical problems, the present application provides a flash memory management method, wherein each super block is used to manage physical blocks of multiple Dies, and all Dies corresponding to the super block include n data Dies and m check Dies. The flash memory management method includes:

[0007] If error information is detected, determining a target physical block where the error information appears; wherein the super block corresponding to the target physical block is the target super block;

[0008] Determine the target Die according to the correspondence between the target super block and Die; wherein the target Die is all Dies corresponding to the target super block except the Die where the target physical block is located;

[0009] Determine the number p of target Dies that have reported error messages;

[0010] Determine whether the quantity p is less than m;

[0011] If the number p is less than m, the target physical block is diagnosed; if the diagnosis result of the target physical block is normal, the target physical block is determined not to be a bad block so that the target super block can continue to be used; if the diagnosis result of the target physical block is abnormal, the target physical block is determined to be a bad block.

[0012] Optionally, after determining the target physical block where the error message appears, the method further includes:

[0013] Determine an error record table of the target super block; wherein the error record table is used to record whether error information has appeared in the physical blocks of all Dies corresponding to the target super block;

[0014] Adding a preset identifier to a target entry in the error log table; wherein the target entry is an entry corresponding to the target physical block;

[0015] Accordingly, the number p of target Dies that have error messages is determined, including:

[0016] The number p of target Dies that have reported error information is determined according to the error record table.

[0017] Optionally, if the number p is less than m, after determining that the target physical block is a bad block, the method further includes:

[0018] The target physical block is replaced by a candidate physical block in the Die where the target physical block is located, and the preset identifier added to the target table entry is removed in the error record table.

[0019] Optionally, replacing the target physical block with a candidate physical block in the Die where the target physical block is located includes:

[0020] Selecting the candidate physical block in an idle state in the Die where the target physical block is located;

[0021] The target Die is used to restore the data of the target physical block in the candidate physical block.

[0022] Optionally, after determining whether the number p is less than m, the method further includes:

[0023] If the number p is greater than or equal to m, determine that the physical blocks corresponding to all the entries in the error record table to which the preset identifier is added are bad blocks;

[0024] Determine a candidate physical block for each bad block, and use the candidate physical block to replace the corresponding bad block;

[0025] All the preset identifiers in the error record table are removed.

[0026] Optionally, also include:

[0027] If error information is detected, the target super block is set as an abnormal super block, and the data in the target super block is transferred to other super blocks;

[0028] Correspondingly, after determining that the target physical block is not a bad block, the method further includes:

[0029] The target super block is set as a free super block.

[0030] Optionally, diagnosing the target physical block includes:

[0031] Performing a preset test on the target physical block to obtain a test result; wherein the preset test includes a read operation test, an erase operation test, and a write operation test;

[0032] Determine whether the test result meets the preset requirements;

[0033] If so, determining that the diagnosis result of the target physical block is normal;

[0034] If not, it is determined that the diagnosis result of the target physical block is abnormal.

[0035] The present application also provides a flash memory management system, wherein the flash memory includes a plurality of super blocks, each of the super blocks is used to manage a plurality of physical blocks of Dies, all Dies corresponding to the super block include n data Dies and m check Dies, and the flash memory management system includes:

[0036] A physical block determination module, used for determining a target physical block where the error information appears if the error information is detected; wherein the super block corresponding to the target physical block is the target super block;

[0037] A Die determination module, configured to determine a target Die according to a correspondence between the target super block and Die; wherein the target Die is all Dies corresponding to the target super block except the Die where the target physical block is located;

[0038] The quantity detection module is used to determine the number p of target Dies that have reported error information;

[0039] A bad block identification module is used to determine whether the number p is less than m; if the number p is less than m, diagnose the target physical block; if the diagnosis result of the target physical block is normal, determine that the target physical block is not a bad block so as to continue to use the target super block; if the diagnosis result of the target physical block is abnormal, determine that the target physical block is a bad block.

[0040] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps of the flash memory management method are implemented.

[0041] The present application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned flash memory management method when calling the computer program in the memory.

[0042] The present application provides a flash memory management method, the flash memory includes multiple super blocks, each of the super blocks is used to manage multiple physical blocks of Die, all Dies corresponding to the super block include n data Dies and m check Dies, the flash memory management method includes: if error information is detected, then determine the target physical block where the error information appears; wherein the super block corresponding to the target physical block is the target super block; determine the target Die according to the correspondence between the target super block and Die; wherein the target Die is all Dies corresponding to the target super block except the Die where the target physical block is located; determine the number p of target Dies that have appeared error information; determine whether the number p is less than m; if the number p is less than m, diagnose the target physical block; if the diagnosis result of the target physical block is normal, determine that the target physical block is not a bad block, so that the target super block can continue to be used; if the diagnosis result of the target physical block is abnormal, determine that the target physical block is a bad block.

[0043] When the error message is detected, the present application determines the target physical block where the error occurs and the target super block corresponding to the target physical block. The target super block includes a physical block of multiple Dies, and the Die corresponding to the target super block includes n data Dies and m check Dies. When no more than m physical blocks in the target super block become bad blocks, the data can be restored by the remaining data Dies and check Dies. The present application determines the target Die according to the corresponding relationship between the target super block and the Die, and the above-mentioned target Die is all Dies corresponding to the target super block except the Die where the target physical block is located. The present application determines the number p of target Dies that have had error messages. If the number p is less than m, it means that no more than m physical blocks will become bad blocks. In this case, the target physical block is diagnosed to reduce the possibility of misjudgment. In the above process, after the error message is detected, instead of directly marking all related physical blocks as bad blocks, the target physical block is first diagnosed and then determined whether it is a bad block, thereby avoiding unnecessary bad block marking. Therefore, the present application can accurately detect bad blocks and improve the stability of the flash memory under the premise of ensuring the life of the flash memory. The present application also provides a flash memory management system, a storage medium and an electronic device, which have the above-mentioned beneficial effects and are not described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0045] Figure 1 A flowchart of a flash memory management method provided in an embodiment of the present application;

[0046] Figure 2 A schematic diagram of a module flow of host reading and writing data provided by an embodiment of the present application;

[0047] Figure 3 A schematic diagram of the first Nand internal die configuration provided in an embodiment of the present application;

[0048] Figure 4 A schematic diagram of the second Nand internal die configuration provided in the embodiment of the present application;

[0049] Figure 5 A schematic diagram of Raid protection and data writing provided by an embodiment of the present application;

[0050] Figure 6 A schematic diagram of a super block managed by an FTL provided in an embodiment of the present application;

[0051] Figure 7 The first unc processing flow chart provided in the embodiment of the present application;

[0052] Figure 8 A second unc processing flow chart provided in an embodiment of the present application;

[0053] Fig. 9 A schematic diagram of the principle of an error record table of a super block provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0055] See below Figure 1 , Figure 1A flowchart of a flash memory management method provided in an embodiment of the present application.

[0056] Specific steps may include:

[0057] S101: If error information is detected, determine the target physical block where the error information appears;

[0058] The operation of this embodiment can be implemented based on the firmware algorithm of the flash memory. The flash memory includes multiple super blocks (sblk), each of which is used to manage the physical blocks of multiple Dies. All Dies corresponding to the super block include n data Dies and m check Dies (i.e., parity Dies). This embodiment can set all general Dies except the check Die in all Dies corresponding to the super block as data Dies. The check Die is a Die used to store check data, and the data Die is a Die used to store data. The check data in the check Die is calculated based on the data in the data Die. Die is the smallest unit of an independent chip in a flash memory particle. Each physical block managed by the super block belongs to a different Die.

[0059] If an error message is detected during the operation of the flash memory, the target physical block where the error message appears can be determined by parsing the error message. Each physical block has its corresponding super block. After determining the target physical block, the super block corresponding to the physical block, i.e., the target super block, can be queried according to the identifier of the target physical block.

[0060] S102: Determine a target Die according to the correspondence between the target super block and Die;

[0061] Among them, this embodiment can pre-store the correspondence between each super block and Die, and all Dies corresponding to the target super block can be determined based on the correspondence. The Dies corresponding to the above-mentioned target super block include the Dies where the target physical block is located. The target Die determined by this step operation is all Dies corresponding to the target super block except the Die where the target physical block is located.

[0062] Taking the above process as an example, the physical blocks managed by the target super block are block1, block2, block3 and block4, the Die where block1 is located is A, the Die where block2 is located is B, the Die where block3 is located is C, and the Die where block4 is located is D; if block2 is the physical block where the error message appears, the target Dies are determined to be A, C and D according to the corresponding relationship between the target super block and Die.

[0063] S103: Determine the number p of target Dies that have reported error information;

[0064] The target Die that has error information refers to the target Die where the physical block diagnosed as normal after the error information appears. As a feasible implementation, this embodiment can use a preset identifier to mark the target Die that has error information, and the number p of target Dies that have error information can be obtained by counting the preset identifiers.

[0065] After the physical block has an error message, if the diagnosis result of the physical block is normal, then the physical block is not a bad block. In this solution, the number p can be determined based on the physical blocks whose diagnosis result is normal after the error message appears. Specifically, each target Die contains a physical block. This embodiment can determine whether the physical blocks in the target Die meet the counting conditions. Each time a physical block in the target Die is detected to meet the counting conditions, the value of p is increased by 1. The above counting condition is: the diagnosis result is normal after the error message appears.

[0066] S104: Determine whether the number p is less than m; if so, proceed to S105; if not, end the process;

[0067] Among them, the number p refers to the number of target Dies that have error information, and m is the number of verification Dies. If the number p is less than m, it means that if the target super block is diagnosed normally, the data can be recovered when error information appears in the same au (a 4k programming unit) of different Dies, and there will be no data loss, so the relevant operations of S105 can be performed. If the number p is greater than or equal to m, it means that if the target super block is diagnosed normally, the data cannot be recovered when error information appears in the same au (a 4k programming unit) of different Dies, resulting in data loss.

[0068] S105: diagnose the target physical block; if the diagnosis result of the target physical block is normal, determine that the target physical block is not a bad block, so that the target super block can continue to be used; if the diagnosis result of the target physical block is abnormal, determine that the target physical block is a bad block.

[0069] Among them, this step is based on the premise that the number p is less than m, and the target physical block can be diagnosed to determine whether the target physical block can normally perform read, write and erase operations. If the diagnosis result of the target physical block is normal, the target physical block passes the diagnosis, and it is determined that the target physical block is not a bad block, and the target super block can continue to be used. If the diagnosis result of the target physical block is abnormal, the target physical block fails the diagnosis, and it is determined that the target physical block is a bad block, and the target super block cannot continue to be used; after the target physical block is replaced, the target super block can continue to be used.

[0070] Specifically, diagnosing the target physical block may include the following steps: performing a preset test on the target physical block to obtain a test result; wherein the preset test includes a read operation test, an erase operation test, and a write operation test; determining whether the test result meets the preset requirements; if so, determining that the diagnostic result of the target physical block is normal; if not, determining that the diagnostic result of the target physical block is abnormal. The above test results include the result of the read operation test, the result of the erase operation test, and the result of the write operation test.

[0071] When the error message is detected, the present embodiment determines the target physical block where the error occurs and the target super block corresponding to the target physical block. The target super block includes a plurality of physical blocks of Die, and the Die corresponding to the target super block includes n data Dies and m check Dies. When no more than m physical blocks in the target super block become bad blocks, data can be restored through the remaining data Dies and check Dies. The present embodiment determines the target Die according to the corresponding relationship between the target super block and Die, and the above-mentioned target Die is all Dies corresponding to the target super block except the Die where the target physical block is located. The present embodiment determines the number p of target Dies where the error message has occurred. If the number p is less than m, it means that no more than m physical blocks will become bad blocks. In this case, the target physical block is diagnosed to reduce the possibility of misjudgment. In the above process, after the error message is detected, instead of directly marking all related physical blocks as bad blocks, the target physical block is diagnosed first and then determined whether it is a bad block, thereby avoiding unnecessary bad block marking. Therefore, the present embodiment can accurately detect bad blocks under the premise of ensuring the life of the flash memory, thereby improving the stability of the flash memory.

[0072] As for Figure 1 Further introduction to the corresponding embodiment, after determining the target physical block where the error information appears, the error record table of the target super block can also be determined, and a preset identifier can be added to the target table item in the error record table. The above error record table is used to record whether the physical blocks in all Dies corresponding to the target super block have appeared error information, and the target table item is the table item corresponding to the target physical block. The error record table can be used to determine the target Die where the error information has appeared in the above manner. Specifically, before the target physical block is diagnosed, this embodiment can subtract the number of table items in the error record table to which the preset identifier is added from the number of physical blocks that have not been diagnosed to obtain the number p of target Dies that have appeared error information.

[0073] Furthermore, if the number p is less than m, after determining that the target physical block is a bad block, the target physical block can be replaced by an alternative physical block in the Die where the target physical block is located, and the preset identifier added to the target table entry can be removed from the error record table.

[0074] Specifically, this embodiment can provide the following method to replace the target physical block: select the candidate physical block in the idle state in the Die where the target physical block is located; and use the target Die to restore the data of the target physical block in the candidate physical block.

[0075] This embodiment can search for a candidate physical block in an idle state in the Die where the target physical block is located. The candidate physical block is not allocated for storing data, and thus can be used to replace the physical block with an error.

[0076] This embodiment can read data from all target Dies (including data Dies and check Dies) related to the target physical block, and then perform data recovery operations based on the read data. After the data recovery is successful, this embodiment can write the recovered data to the selected candidate physical block. In the above manner, the target Die related to the target physical block can be used to recover the data of the target physical block with an error, which can improve the reliability and stability of the system.

[0077] As for Figure 1 Further introduction to the corresponding embodiment, after determining whether the number p is less than m, if the number p is greater than or equal to m, the data cannot be recovered when an error message appears in the same au (a 4k programming unit) of different Dies, so it can be determined that all physical blocks corresponding to the entries in the error record table to which the preset identifier is added are bad blocks. This embodiment can determine an alternative physical block for each bad block, and use the alternative physical block to replace the corresponding bad block, and remove all the preset identifiers in the error record table.

[0078] As for Figure 1 Further introduction to the corresponding embodiment: if error information is detected, the target super block is set as an abnormal super block, and the data in the target super block is transferred to other super blocks so that other super blocks can provide data read and write services. Correspondingly, after determining that the target physical block is not a bad block, the target super block can also be set as an idle super block. An idle super block means that the super block is not currently used to store data and is ready to accept new data write requests. The above method can improve the reliability, performance and resource utilization of the flash memory.

[0079] The process described in the above embodiment is explained below through an embodiment in actual application.

[0080] The full name of Flash memory is Nand flash. Flash memory has the characteristics of high-speed reading and writing, non-volatility, small size, low power consumption, and impact resistance, and has been widely used. Nand's access address is: Die address + plane address + block address + WL address. Plane is the unit in Die that can be operated in parallel, block is the smallest erase unit of Flash memory; WL (word line) refers to the smallest programming (writing) unit of Flash memory.

[0081] In flash memory, a super block (sblk) consists of multiple physical blocks (phy blk), which are scattered on different dies. When the host or disk performs read and write operations, it triggers access to the Nand memory. If an error unc is encountered during the read process, it indicates that there is a problem with the data on the Nand.

[0082] One processing method in the related art is: first locate the super block where the erroneous data is located, and then find the problematic physical block therein, and diagnose and mark the problematic physical block. Before diagnosis, the data of the super block will be migrated to another super block, and then the problematic physical block will be diagnosed by erase and read. If the diagnosis result shows no abnormality, the physical block can continue to be used, and the original super block will also resume normal use; if the diagnosis finds an abnormality (that is, a failure occurs during the erase and read process), the physical block will be marked as a bad block, and replaced with another physical block in the same Die, and the super block will be rebound and mapped. However, if the physical blocks in multiple Dies of this super block are all normal after diagnosis, but the same au in different Dies in the subsequent use of the super block has an unc situation, it may cause data loss and serious product failure.

[0083] Another processing method in the related art is to directly mark a physical block with an error unc as a bad block, and replace and remap it with a new physical block without diagnosis. Although this method is fast, it will lose available space and reduce the writable capacity of the disk, thus having a significant impact on the life of the disk product.

[0084] In response to the technical problems existing in the above-mentioned related technologies, when unc occurs, this embodiment will mark which specific Die in the super block where unc occurs has a problem. If subsequent diagnosis finds that m (m is the number of verification Dies) or more Dies have experienced unc, no further diagnosis will be performed, but the physical blocks in these Dies where unc occurs will be directly marked as bad blocks, and the sblk will be remapped. This solution greatly reduces the risk of aligned unc, while retaining the significance of diagnosis and helping to increase the service life of the product. Aligned unc means: unc occurs in the same Raid protection unit in more than two Dies (the same au address in different Dies), and the data cannot be recovered; au refers to: a 4k programming unit, usually an LDPC encoding and decoding unit.

[0085] See also Figure 2 , Figure 2 A module flow diagram of a host reading and writing data provided by an embodiment of the present application, in which HOST represents a host (such as a PC, server, etc.), FE represents a front-end module; FTL represents a module of a flash conversion layer; BE represents a back-end module; HW Op Nand Mode is a hardware module for operating flash memory, which is controlled by BE. This embodiment uses software to record the address of the die where sblk unc occurs, and then determines the summary statistics of unc occurring in multiple Dies in the same slbk to decide whether to mark the bad block, so as to improve the stability and quality of the product. This embodiment retains the diagnostic function to improve the life of the product. After unc occurs in multiple Dies, it is directly marked as a bad block and remap Sblk with a new physical block mapping to ensure the stability of the flash memory.

[0086] When the host reads data, the Host sends a command to the device. The front-end FE module of the device receives the command, processes it, and distributes it to the FTL. After receiving it, the FTL converts it from logical to physical, and then sends the request for nand read and write operations to the BE. After receiving it, the BE sends the hardware instruction to the HW Op Nand Mode to perform Nand processing in parallel.

[0087] A super block can contain any number of data Dies and any number of check Dies.

[0088] See also Figure 3 , Figure 3 This is a schematic diagram of the first Nand die configuration provided in the embodiment of the present application. Figure 3 Among them, Die0, Die 1 and Die 2 are data Dies, and Die n is a check Die (i.e., parity Die). Figure 3In the corresponding scheme, there are n data Dies and 1 check Die. In this scheme, Nand allows one Die to have unc, and other Dies can recover data through parity Die.

[0089] See also Figure 4 , Figure 4 This is a schematic diagram of the second Nand die configuration provided in the embodiment of the present application. Figure 4 Among them, Die0, Die 1, Die 2, ..., Die n are data Dies, and Die n+1, ..., Die n+m are check Dies (i.e., parity Dies). Figure 4 In the corresponding scheme, there are n data Dies and m check Dies. In this scheme, Nand allows m Dies to have unc, and the other Dies can recover data through the check Die.

[0090] See also Figure 5 , Figure 5 A schematic diagram of Raid protection and data writing provided in an embodiment of the present application, Die 0, Die 1 and Die 2 in Nand are data Dies, Die n is a check Die (i.e., parity Die), DDR (double rate synchronous dynamic random access memory) includes Die 0 buffer, Die 1 buffer and Die 2 buffer representing the cache corresponding to each Die, Write to Nand represents a write operation, XOR represents an exclusive OR operation, and Raid Buffer A represents a disk array cache.

[0091] Die n is a check die, which is used to store check data. The data from Die 0 to Die n-1 will be written to Nand after XOR to Raid buffer A. That is to say, the hardware will automatically XOR all the written data from Die 0 to Die n-1 to Raid buffer A and store them. At the same time, the data from Die 0 buffer to Die n-1 buffer in DDR will be written to Nand. The writing of parity die (check die) is directly written from Raid buffer A to Nand. When the data of a certain Die from Die 0 to Dien-1 shows unc, the data of the wrong Die can be restored by checking the Die.

[0092] See also Figure 6 , Figure 6A schematic diagram of a super block managed by FTL provided in an embodiment of the present application shows the physical blocks of each Die, Die 0 blk A, Die 1 blk A, Die 2 blk A, Die 3 blk A, and each physical block includes multiple Page pages, such as Page 0, Page 1, Page 2, etc.

[0093] Each super block includes multiple physical blocks, each of which is in a different Die. When writing data to the flash memory, data can be written to these Dies at the same time, and when reading data, data can be read from different Dies at the same time, thereby accelerating the read and write performance. Among them, Die n is a parity die, Figure 6 Only one Die is allowed to have unc. The physical blocks contained in each superblock are in different Dies, and the numbers of the physical blocks can be different; for example, the physical block phy blk 2 of Die 0, the physical block phy blk 3 of Die 1, and the physical block phy blk 4 of Die 2 can all belong to the same superblock.

[0094] The processing method after unc appears in the related technology is as follows:

[0095] Uncertain block (unc) occurs when reading data. This uncertain block occurs in sblk A. Perform address analysis on the sblk where uncertain block occurs, find out the specific uncertain block address (phy blk B), and diagnose phy blk B. Determine whether the diagnosis is abnormal. If the diagnosis is normal, continue to use sblk A as a free block (free sblk) without replacing it. If the diagnosis is abnormal, mark phy blk B as a bad block, replace phy blk B with another block with the same die, and rebind and map sblk A. The new sblk A is used as a free block.

[0096] See also Figure 7 , Figure 7 This is a first UNC processing flow chart provided in an embodiment of the present application. Figure 7 In the corresponding solution, there are n-1 data Dies and 1 check Die, so only one Die is allowed to occur UNC, and the data is recovered through Raid. If more than 2 Dies occur UNC, data will be lost. Figure 7 The illustrated scheme includes the following steps:

[0097] Step A1: Read data unc occurs at sblk A.

[0098] Step A2: Call up the Die unc table of sblk A and query it.

[0099] Die unc table is the error record table.

[0100] Step A3: Determine whether sblk A has had other Die with unc; if so, proceed to step A4; if not, proceed to step A5.

[0101] Among them, this step determines whether other Dies have experienced unc; if other Dies have experienced unc, it means that sblk A has experienced unc in two Dies. At this time, if these two Dies have unc on the same page, it is very likely that aligned unc will occur, causing data loss. At this time, this risk needs to be reduced to a very small probability. If other Dies have experienced unc, go to step A4; if other Dies have not experienced unc, go to step A5.

[0102] Step A4: Mark the unc blk of other Dies as bad blocks, and replace them with another phy blk of the same Die, rebind and map sblkA, clear the corresponding marks in the die unc table, and go to step A7;

[0103] Step A5: Mark the Die where phy blk B in slbk A is located as having had an unc mark, update the dieunc table, and go to step A6.

[0104] Step A6: diagnose whether phy blk B is normal; if so, proceed to step A8; if not, proceed to step A7;

[0105] This step continues to diagnose phy blk B that has gone out of unc. In this step, sblk A can be GCed to other sblks first, and then the diagnosis of phy blk B can be started after there is no valid data on sblk A.

[0106] Step A7: Mark phy blk B as a bad block and replace it with another phy blk D of the same Die, rebind and map sblk A, and clear the corresponding mark of the Die in the Die unc table.

[0107] Step A8: Continue to use the sblk A.

[0108] Specifically, in step A8, if sblk A is normal, sblk A continues to be used as a free blk.

[0109] See also Figure 8 , Figure 8 This is a second UNC processing flow chart provided in an embodiment of the present application. Figure 8In the corresponding solution, there are n data Dies and m check Dies, so at most m Dies are allowed to become unc, and the data can be recovered through Raid. If more than m Dies become unc, data will be lost. Figure 8 The illustrated scheme includes the following steps:

[0110] Step B1: Read data at phy blk B of sblk A and unc occurs.

[0111] Step B2: Call up the Die unc table of sblk A and query it.

[0112] Step B3: Determine whether sblk A has already had unc in other m-1 Dies; if so, proceed to step B4; if not, proceed to step B5;

[0113] Step B4: Mark the phy blk of other Dies with UNC flag 1 in Die unc table as bad blocks, and replace them with phy blks in the same Die, and clear the information of the replaced die in Die unc table of slbk A, and go to step B8;

[0114] Step B5: diagnose phy blk B of unc;

[0115] Step B6: Mark the Die where phy blk B in slbk A is located as having unc, and update the Die unc table information of slbkA;

[0116] Step B7: diagnose whether phy blk B is normal; if so, proceed to step B9; if not, proceed to step B8;

[0117] This step continues to diagnose phy blk B that has gone out of the unc. In this step, sblk A can be GCed to other sblks first, and then the diagnosis of phy blk B can be started after there is no valid data on sblk A.

[0118] Step B8: Mark phy blk B as a bad block, replace it with other phy blks in the same Die, remap sblk A, and clean up the Die unc table of sblk A.

[0119] Step B9: Continue to use the sblk A.

[0120] Specifically, in step B9, if sblk A has no abnormality, sblk A continues to be used as a free blk.

[0121] See also Fig. 9 , Fig. 9 A schematic diagram of the principle of an error record table of a super block provided in an embodiment of the present application. The super block sblk can record in the error record table Die unc talbe whether Die 0, Die 1, Die 2, ..., Die n have unc, and if unc appears, a preset flag unc flag is added.

[0122] Specifically, whenever unc appears, the unc flag of the Die will be set. After power off, this information will be persisted in the disk, and after power on, the history records will be there. When sblk is remapped and the new phy blk is mapped to sblk, the Die position of the Die unc table will be cleared to 0.

[0123] This embodiment diagnoses and records the address of the die where sblk unc occurs, and determines whether more than m dies of this sblk have unc before the next diagnosis. If so, all phy blks of the die where unc has occurred are marked as bad blocks. This embodiment also replaces these bad blocks with replacement blocks of the same die and rebinds the mapped sblk, thereby improving the quality and stability of the product and reducing the risk of data loss.

[0124] A flash memory management system provided in an embodiment of the present application includes a plurality of super blocks, each of which is used to manage physical blocks of a plurality of Dies, and all Dies corresponding to the super block include n data Dies and m check Dies. The flash memory management system includes:

[0125] A physical block determination module, used for determining a target physical block where the error information appears if the error information is detected; wherein the super block corresponding to the target physical block is the target super block;

[0126] A Die determination module, configured to determine a target Die according to a correspondence between the target super block and Die; wherein the target Die is all Dies corresponding to the target super block except the Die where the target physical block is located;

[0127] The quantity detection module is used to determine the number p of target Dies that have reported error information;

[0128] A bad block identification module is used to determine whether the number p is less than m; if the number p is less than m, diagnose the target physical block; if the diagnosis result of the target physical block is normal, determine that the target physical block is not a bad block so as to continue to use the target super block; if the diagnosis result of the target physical block is abnormal, determine that the target physical block is a bad block.

[0129] When the error message is detected, the present embodiment determines the target physical block where the error occurs and the target super block corresponding to the target physical block. The target super block includes a plurality of physical blocks of Die, and the Die corresponding to the target super block includes n data Dies and m check Dies. When no more than m physical blocks in the target super block become bad blocks, data can be restored through the remaining data Dies and check Dies. The present embodiment determines the target Die according to the corresponding relationship between the target super block and Die, and the above-mentioned target Die is all Dies corresponding to the target super block except the Die where the target physical block is located. The present embodiment determines the number p of target Dies where the error message has occurred. If the number p is less than m, it means that no more than m physical blocks will become bad blocks. In this case, the target physical block is diagnosed to reduce the possibility of misjudgment. In the above process, after the error message is detected, instead of directly marking all related physical blocks as bad blocks, the target physical block is diagnosed first and then determined whether it is a bad block, thereby avoiding unnecessary bad block marking. Therefore, the present embodiment can accurately detect bad blocks under the premise of ensuring the life of the flash memory, thereby improving the stability of the flash memory.

[0130] Furthermore, it also includes:

[0131] A marking module is used to determine the error record table of the target super block after determining the target physical block where the error information appears; wherein the error record table is used to record whether the physical blocks in all Dies corresponding to the target super block have ever had error information; and is also used to add a preset identifier to the target table item in the error record table; wherein the target table item is the table item corresponding to the target physical block;

[0132] Correspondingly, the process in which the quantity detection module determines the quantity p of the target Dies that have reported error information includes: determining the quantity p of the target Dies that have reported error information according to the error record table.

[0133] Furthermore, it also includes:

[0134] A bad block processing module is used to replace the target physical block with an alternative physical block in the Die where the target physical block is located if the number p is less than m, after determining that the target physical block is a bad block, and remove the preset identifier added to the target table entry in the error record table.

[0135] Furthermore, the process of the bad block processing module replacing the target physical block with the alternative physical block in the Die where the target physical block is located includes: selecting the alternative physical block in the idle state in the Die where the target physical block is located; and restoring the data of the target physical block in the alternative physical block using the target Die.

[0136] Furthermore, it also includes:

[0137] The identification update module is used to determine whether the number p is less than m, if the number p is greater than or equal to m, that the physical blocks corresponding to all the entries in the error record table to which the preset identification is added are bad blocks; it is also used to determine an alternative physical block for each bad block, and use the alternative physical block to replace the corresponding bad block; it is also used to remove all the preset identifications in the error record table.

[0138] Furthermore, it also includes:

[0139] The super block management module is used to set the target super block as an abnormal super block and transfer the data in the target super block to other super blocks if error information is detected; and is also used to set the target super block as a free super block after determining that the target physical block is not a bad block.

[0140] Furthermore, the process of the bad block identification module diagnosing the target physical block includes: performing a preset test on the target physical block to obtain a test result; wherein the preset test includes a read operation test, an erase operation test, and a write operation test; determining whether the test result meets the preset requirements; if so, determining that the diagnosis result of the target physical block is normal; if not, determining that the diagnosis result of the target physical block is abnormal.

[0141] Since the embodiments of the system part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the system part, which will not be repeated here.

[0142] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0143] The present application also provides an electronic device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the electronic device may also include various network interfaces, power supplies and other components.

[0144] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of this application.

[0145] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A flash memory management method, characterized in that: The flash memory includes a plurality of super blocks, each of which is used to manage physical blocks of a plurality of Dies, and all Dies corresponding to the super block include n data Dies and m check Dies. The flash memory management method includes: If error information is detected, determining a target physical block where the error information appears; wherein the super block corresponding to the target physical block is the target super block; Determine the target Die according to the correspondence between the target super block and Die; wherein the target Die is all Dies corresponding to the target super block except the Die where the target physical block is located; Determine the number p of target Dies that have reported error messages; Determine whether the quantity p is less than m; If the number p is less than m, the target physical block is diagnosed; if the diagnosis result of the target physical block is normal, the target physical block is determined not to be a bad block so that the target super block can continue to be used; if the diagnosis result of the target physical block is abnormal, the target physical block is determined to be a bad block.

2. The flash memory management method according to claim 1, characterized in that: After determining the target physical block where the error message appears, it also includes: Determine an error record table of the target super block; wherein the error record table is used to record whether error information has appeared in the physical blocks of all Dies corresponding to the target super block; Adding a preset identifier to a target entry in the error log table; wherein the target entry is an entry corresponding to the target physical block; Accordingly, the number p of target Dies that have error messages is determined, including: The number p of target Dies that have reported error information is determined according to the error record table.

3. The flash memory management method according to claim 2, characterized in that: If the number p is less than m, after determining that the target physical block is a bad block, the method further includes: The target physical block is replaced by a candidate physical block in the Die where the target physical block is located, and the preset identifier added to the target table entry is removed in the error record table.

4. The flash memory management method according to claim 3, characterized in that: Replacing the target physical block with a candidate physical block in the Die where the target physical block is located includes: Selecting the candidate physical block in an idle state in the Die where the target physical block is located; The target Die is used to restore the data of the target physical block in the candidate physical block.

5. The flash memory management method according to claim 2, characterized in that: After determining whether the number p is less than m, the method further includes: If the number p is greater than or equal to m, determine that the physical blocks corresponding to all the entries in the error record table to which the preset identifier is added are bad blocks; Determine a candidate physical block for each bad block, and use the candidate physical block to replace the corresponding bad block; All the preset identifiers in the error record table are removed.

6. The flash memory management method according to claim 1, characterized in that: Also includes: If error information is detected, the target super block is set as an abnormal super block, and the data in the target super block is transferred to other super blocks; Correspondingly, after determining that the target physical block is not a bad block, the method further includes: The target super block is set as a free super block.

7. The flash memory management method according to any one of claims 1 to 6, characterized in that: The target physical block is diagnosed, including: Performing a preset test on the target physical block to obtain a test result; wherein the preset test includes a read operation test, an erase operation test, and a write operation test; Determine whether the test result meets the preset requirements; If so, determining that the diagnosis result of the target physical block is normal; If not, it is determined that the diagnosis result of the target physical block is abnormal.

8. A flash memory management system, characterized in that: The flash memory includes multiple super blocks, each of which is used to manage physical blocks of multiple Dies. All Dies corresponding to the super block include n data Dies and m check Dies. The flash memory management system includes: A physical block determination module, used for determining a target physical block where the error information appears if the error information is detected; wherein the super block corresponding to the target physical block is the target super block; A Die determination module, configured to determine a target Die according to a correspondence between the target super block and Die; wherein the target Die is all Dies corresponding to the target super block except the Die where the target physical block is located; The quantity detection module is used to determine the number p of target Dies that have reported error information; A bad block identification module is used to determine whether the number p is less than m; if the number p is less than m, diagnose the target physical block; if the diagnosis result of the target physical block is normal, determine that the target physical block is not a bad block so as to continue to use the target super block; if the diagnosis result of the target physical block is abnormal, determine that the target physical block is a bad block.

9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps of the flash memory management method according to any one of claims 1 to 7 are implemented.

10. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the flash memory management method according to any one of claims 1 to 7 are implemented.