Flash memory management method, storage control chip and flash memory equipment
By introducing multiple storage modes in flash devices and converting storage modes when errors occur, the problem of reduction of available physical blocks caused by bad block replacement is solved, achieving higher durability and data stability.
Patent Information
- Application Number
- CN202411934146.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-23
AI Technical Summary
During the replacement of bad blocks, existing flash memory devices will result in a decrease in the number of available physical blocks, which will in turn cause the device to enter a read-only state, reducing durability and data stability.
By introducing a variety of storage modes (first storage mode and second storage mode) into the flash memory device, the storage mode of the physical block is converted when an error occurs, in order to extend the usage cycle of the physical block and improve the stability of data operations.
It extends the usage cycle of physical blocks, reduces the probability of being directly marked as bad blocks, and improves the durability of flash memory devices and data stability.
Smart Images

Figure CN120029535A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the application field of storage devices, and in particular to a flash memory management method, a storage control chip and a flash memory device. Background Art
[0002] Flash memory devices, such as Solid State Drives (SSDs), are storage devices that use semiconductor flash memory (NAND Flash) as a medium.
[0003] At present, the storage mode of physical blocks in flash memory is single. When an error occurs in a physical block, it will be marked as a bad block and stop being used. For example, when reading data, if an uncorrectable error occurs and it still fails after rereading, the physical block will be marked as a bad block, and the data stored in its corresponding super block will be migrated to other super blocks. At the same time, a spare physical block will be used to replace the bad block.
[0004] In the process of implementing this application, the inventors found that there are at least the following problems in the prior art:
[0005] Each time a bad block replacement operation is performed, the number of available physical blocks of the flash memory device will decrease by one. As the number of bad blocks increases, the spare physical blocks are gradually exhausted, and there will be no free physical blocks available for writing, causing the flash memory device to enter a read-only state, thereby reducing the durability of the flash memory device and the stability of the data. Summary of the invention
[0006] Embodiments of the present application provide a flash memory management method, a storage control chip, and a flash memory device to improve the stability of data stored in the flash memory device and the durability of the flash memory device.
[0007] The embodiments of the present application provide the following technical solutions:
[0008] In a first aspect, an embodiment of the present application provides a flash memory management method, the flash memory management method is applied to a flash memory device, the flash memory device includes a super block, the super block includes a plurality of physical blocks, the flash memory management method includes:
[0009] Based on the storage mode of each physical block in the super block, perform data operations on the physical blocks in the super block;
[0010] When an error occurs during an operation, the storage mode of the physical block is converted so that the physical block can be operated according to the converted storage mode.
[0011] In some embodiments, the storage mode includes a first storage mode or a second storage mode, and the data operation includes an erase operation, a write operation, or a read operation;
[0012] In the first storage mode, each word line in the physical block corresponds to a first number of physical pages;
[0013] In the second storage mode, each word line in the physical block corresponds to a second number of physical pages, and the first number is different from the second number.
[0014] In some embodiments, performing data operations on physical blocks within a super block based on a storage mode of each physical block within the super block includes:
[0015] Acquire management information of the super block to be operated, wherein the management information includes a storage mode of each physical block included in the super block to be operated;
[0016] Querying the storage mode of the physical block to be operated from the management information;
[0017] When the storage mode of the physical block to be operated is the first storage mode, performing data operation on the physical block to be operated based on the first storage mode;
[0018] When the storage mode of the physical block to be operated is the second storage mode, a data operation is performed on the physical block to be operated based on the second storage mode.
[0019] In some embodiments, the super block includes a data block and a check block;
[0020] When the data operation is a write operation, based on the storage mode of each physical block in the super block, performing the data operation on the physical blocks in the super block includes:
[0021] Splitting the data contained in the write command to obtain at least two pieces of data to be written;
[0022] Query the management information of the super block to be written, and determine the first data block and the second data block included in the super block to be written;
[0023] Performing XOR processing on the first data to be written and the second data to be written corresponding to the same first page address to generate verification data corresponding to each first page address, and recording the corresponding XOR times;
[0024] and / or, performing XOR processing on the first data to be written corresponding to the same second page address to generate verification data corresponding to each second page address, and recording the corresponding XOR times;
[0025] Write each to-be-written data into the corresponding data block, and write the verification data into the verification block;
[0026] The first data block is a physical block in a first storage mode, the second data block is a physical block in a second storage mode, the first data to be written is the data to be written corresponding to any physical page of any first data block, and the second data to be written is the data to be written corresponding to any physical page of any second data block;
[0027] The first page address is any page address corresponding to the word lines of the first data block and the second data block, the second page address is any page address corresponding to the word line of the first data block and not corresponding to the word line of the second data block, and the number of XOR times is the number of times XOR processing is performed on several data to be written corresponding to the same page address.
[0028] In some embodiments, when an error occurs during an operation, converting the storage mode of a physical block includes:
[0029] If an uncorrectable error occurs when reading the target physical block, a diagnostic operation in the first storage mode is performed on the target physical block to obtain a third diagnostic result, wherein the target physical block is a physical block in the first storage mode;
[0030] When the third diagnosis result is an abnormal result, performing a replacement operation on the target physical block and updating management information of the target super block, wherein the target super block includes the target physical block;
[0031] performing a diagnostic operation in a second storage mode on the target physical block to obtain a fourth diagnostic result;
[0032] When the fourth diagnostic result is a normal result, the storage mode of the target physical block is converted into the second storage mode, and the address of the target physical block is recorded in the second list.
[0033] In some embodiments, the method further comprises:
[0034] When the third diagnosis result is a normal result, keeping the storage mode of the target physical block unchanged;
[0035] When the fourth diagnostic result is an abnormal result, the target physical block is marked as a bad block.
[0036] In some embodiments, the superblock includes a data block and a check block;
[0037] Perform a replacement operation on the target physical block, including:
[0038] If the first list is not empty, a first replacement block is selected, the target physical block is replaced with the first replacement block, and the management information of the first list and the target super block is updated;
[0039] If the first list is empty, and the target physical block is a data block, and the second list is not empty, then a second replacement block is selected, the target physical block is replaced with the second replacement block, and the management information of the second list and the target super block is updated;
[0040] If the first list is empty and the target physical block is a check block, or if both the first list and the second list are empty and the target physical block is a data block, then the mapping relationship between the target super block and the target physical block is deleted;
[0041] The first replacement block is a physical block recorded in the first list and used for performing a replacement operation and in the first storage mode, and the second replacement block is a physical block recorded in the second list and used for performing a replacement operation and in the second storage mode.
[0042] In some embodiments, the method further comprises:
[0043] If an uncorrectable error occurs when reading a target word line of a target physical block, querying management information of the target super block to determine a storage mode of the target physical block;
[0044] Determining a target physical page corresponding to a target word line based on a storage mode of a target physical block;
[0045] The data stored in each physical page having the same address as the target physical page in the target super block is XORed to obtain the reconstructed data corresponding to the target physical page.
[0046] In some embodiments, the method further comprises:
[0047] During the production process of the flash memory device, a diagnostic operation in a first storage mode and / or a second storage mode is performed on each physical block to generate a first list and a second list, wherein the first list is used to store addresses of physical blocks in the first storage mode, and the second list is used to store addresses of physical blocks in the second storage mode, and the diagnostic operation includes an erase diagnostic operation, a write diagnostic operation, and a read diagnostic operation;
[0048] When the flash memory device is initialized, the management information of each super block is initialized according to the first list and the second list, wherein the management information includes the storage mode of each physical block included in the super block.
[0049] In some embodiments, performing a diagnostic operation in a first storage mode and / or a second storage mode on each physical block to generate a first list and a second list includes:
[0050] Selecting a physical block, and performing a diagnostic operation in a first storage mode on the physical block to obtain a first diagnostic result;
[0051] If the first diagnostic result is a normal result, determining that the storage mode of the physical block is the first storage mode, and recording the address of the physical block into the first list;
[0052] If the first diagnostic result is an abnormal result, performing a diagnostic operation in a second storage mode on the physical block to obtain a second diagnostic result;
[0053] If the second diagnostic result is a normal result, determining that the storage mode of the physical block is the second storage mode, and recording the address of the physical block into the second list;
[0054] If the second diagnostic result is an abnormal result, the physical block is marked as a bad block;
[0055] After recording the address of any physical block into the first list, or recording the address of any physical block into the second list, or marking any physical block as a bad block, a diagnostic operation is performed on the next physical block until the diagnostic operation is completed on all physical blocks.
[0056] In a second aspect, an embodiment of the present application provides a storage control chip, including:
[0057] at least one processor; and,
[0058] a memory communicatively connected to at least one processor; wherein,
[0059] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the flash memory management method according to the first aspect.
[0060] In a third aspect, an embodiment of the present application provides a flash memory device, including:
[0061] The storage control chip of the second aspect;
[0062] At least one flash memory medium is communicatively connected to the storage control chip.
[0063] In a fourth aspect, an embodiment of the present application further provides a non-volatile computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable a flash memory device to execute a flash memory management method as in the first aspect.
[0064] The beneficial effects of the embodiments of the present application are as follows: different from the prior art, the embodiments of the present application provide a flash memory management method, a storage control chip and a flash memory device, the flash memory management method is applied to the flash memory device, the flash memory device includes a super block, the super block includes a plurality of physical blocks, the flash memory management method includes: based on the storage mode of each physical block in the super block, performing data operations on the physical blocks in the super block; when an error occurs during the operation process, converting the storage mode of the physical block to operate the physical block according to the converted storage mode.
[0065] On the one hand, by converting the storage mode of the physical block when an error occurs during the operation process, the present application can enable the physical block to continue to perform data operations, reduce the probability of the physical block being directly marked as a bad block, and extend the service life of the physical block. On the other hand, by performing data operations on the physical blocks in the super block based on the storage mode of each physical block in the super block, the present application can perform refined management of the super block in the mixed mode (that is, there are physical blocks in different storage modes in the super block), and further improve the stability of the flash memory device storing data and the durability of the flash memory device. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0067] Figure 1 It is a structural schematic diagram of a main control system of a flash memory device provided in an embodiment of the present application;
[0068] Figure 2 It is a flowchart of a flash memory management method provided in an embodiment of the present application;
[0069] Figure 3 is a schematic diagram of the structure of the first super block provided in the embodiment of the present application;
[0070] Figure 4 is a schematic diagram of the structure of a second super block provided in an embodiment of the present application;
[0071] Figure 5 is a schematic diagram of the structure of the third super block provided in the embodiment of the present application;
[0072] Figure 6 It is a flowchart of a diagnostic operation performed on a physical block in a first storage mode and / or a second storage mode provided by an embodiment of the present application;
[0073] Figure 7 yes Figure 2 A detailed flow chart of step S201 in FIG.
[0074] Figure 8 is a schematic diagram of the structure of the fourth super block provided in an embodiment of the present application;
[0075] Fig. 9 This is a schematic diagram of a data writing process provided by an embodiment of the present application;
[0076] Fig.10 yes Figure 2 A detailed flow chart of step S202;
[0077] Fig.11 It is a flowchart of a replacement operation on a target physical block provided by an embodiment of the present application;
[0078] Fig.12 is a schematic diagram of the structure of a storage control chip provided in an embodiment of the present application;
[0079] Fig.13 It is a structural schematic diagram of a flash memory device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0080] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0081] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional module division is performed in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a sequence different from the module division in the device or the flow chart. Furthermore, the words "first", "second", "third", etc. used in this application do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.
[0082] The technical solution of this application is described in detail below with reference to the accompanying drawings:
[0083] Flash memory devices, such as Solid State Drives (SSDs), are storage devices that use semiconductor flash memory (NAND Flash) as a medium.
[0084] In an embodiment of the present application, the flash memory device includes a solid state drive or other storage device using flash memory as storage medium, and the storage control chip includes a controller of the solid state drive or other storage device using flash memory as storage medium.
[0085] See also Figure 1 , Figure 1 It is a structural schematic diagram of a main control system of a flash memory device provided in an embodiment of the present application;
[0086] It is understandable that the storage control chip of the flash memory device includes a main control system, and the main control system is used to connect the host and the flash memory array to realize data input and output (Input / Output, I / O) processing.
[0087] like Figure 1 As shown, the main control system 100 includes:
[0088] The front end module 101 (Front End, FE) is used to obtain host commands to generate IO operations.
[0089] The flash algorithm module 102, namely the flash translation layer (FTL), is connected to the front-end module 101 and is used to map the IO operation to determine the flash array to be sent.
[0090] The flash algorithm module 102 sends an IO operation to a back-end module 103 (BE) of the storage control chip, so that the back-end module 103 receives the IO operation sent by the flash algorithm module 102 .
[0091] The back-end module 103 (Back End, BE) is connected to the flash algorithm module 102 and is used to receive IO operations sent by the flash algorithm module 102 and control the hardware module 104 to perform read / write / erase operations on the flash array.
[0092] The hardware module 104 (HW Op Nand Mode) is connected to the backend module 103 and is controlled by the backend module 103 to operate the flash memory array.
[0093] Among them, after the front-end module 101 obtains the host command, it processes it to generate an IO operation, and sequentially passes through the flash algorithm module 102, the back-end module 103 and the hardware module 104 to operate the flash array. For example: when the host needs to read data, the host (Host) sends a host command to the flash device (Device), and the front-end module 101 (FE) of the flash device receives the host command, processes it and distributes it to the flash algorithm module 102 (FTL). After receiving it, the flash algorithm module 102 converts it from logic to physical, and then sends the NAND read operation request to the back-end module 103 (BE). After receiving it, the back-end module 103 sends the hardware instruction to the hardware module 104, so that the hardware module 104 performs NAND processing in parallel.
[0094] At present, the storage mode of physical blocks in flash memory is single. When an error occurs in a physical block, it will be marked as a bad block and stop being used. For example, when reading data, if an uncorrectable error occurs and it still fails after rereading, the physical block will be marked as a bad block, and the data stored in its corresponding super block will be migrated to other super blocks. At the same time, a spare physical block will be used to replace the bad block.
[0095] Each time a bad block replacement operation is performed, the number of available physical blocks of the flash memory device will decrease by one. As the number of bad blocks increases, the spare physical blocks are gradually exhausted, and there will be no free physical blocks available for writing, causing the flash memory device to enter a read-only state, thereby reducing the durability of the flash memory device and the stability of the data.
[0096] Based on this, an embodiment of the present application proposes a flash memory management method. On the one hand, by converting the storage mode of a physical block when an error occurs during the operation process, the present application can enable the physical block to continue to perform data operations, reduce the probability of the physical block being directly marked as a bad block, and extend the service life of the physical block. On the other hand, by performing data operations on the physical blocks in a super block based on the storage mode of each physical block in the super block, the present application can perform refined management of super blocks in a mixed mode (i.e., there are physical blocks in different storage modes in the super block), thereby further improving the stability of data storage in the flash memory device and the durability of the flash memory device.
[0097] See also Figure 2 , Figure 2 It is a flowchart of a flash memory management method provided in an embodiment of the present application;
[0098] The flash memory management method is applied to a flash memory device, and specifically, to at least one processor of the flash memory device.
[0099] The flash memory device includes a data logic unit (Die), which is the smallest unit of an independent chip in the flash memory medium. The flash memory device also includes a super block, each of which includes a number of physical blocks, and each physical block in the same super block is in a different data logic unit.
[0100] See also Figure 3 , Figure 3 is a schematic diagram of the structure of the first super block provided in the embodiment of the present application;
[0101] like Figure 3 As shown, a super block is composed of physical blocks A in data logic unit 0, data logic unit 1, ..., data logic unit n, and each physical block is in a different Die. Each physical block is composed of multiple physical pages, for example: physical block A is composed of physical page 0, physical page 1, ..., physical page P, ..., physical page M.
[0102] The superblock supports parallel read and write operations. For example, when performing a write operation, Figure 3 Each data logic unit in the Figure 3 Data is read from different data logic units in the RAID controller, thereby accelerating read and write performance.
[0103] In the embodiment of the present application, the physical blocks contained in each super block must be in different data logical units, and the physical block numbers can be different. For example, physical block 2 in data logical unit 0, physical block 3 in data logical unit 1, and physical block 4 in data logical unit 2 belong to the same super block.
[0104] like Figure 2 As shown, the flash memory management method includes:
[0105] Step S201: Based on the storage mode of each physical block in the super block, perform data operations on the physical blocks in the super block;
[0106] The data operation includes an erase operation, a write operation or a read operation. Each physical block consists of multiple word lines (WL), each word line consists of multiple physical pages, and each physical page consists of multiple storage cells. The storage mode refers to the working mode in which each storage cell in the flash memory stores a specific number of data bits through different voltage threshold states. In different storage modes, the number of physical pages corresponding to each word line of the same physical block is different.
[0107] The storage mode includes a first storage mode or a second storage mode. In the first storage mode, each word line in the physical block corresponds to a first number of physical pages; in the second storage mode, each word line in the physical block corresponds to a second number of physical pages, and the first number is different from the second number.
[0108] The first storage mode and the second storage mode can be set by those skilled in the art according to the storage cell structure of the flash memory device, etc., and are not limited here. Preferably, the first storage mode is a quad-level cell (QLC) mode, and the first number is four, that is, for QLC Flash, one word line corresponds to four physical pages; the second storage mode is a triple level cell (TLC) mode, and the second number is three, that is, for TLC Flash, one word line corresponds to three physical pages.
[0109] Specifically, a host command is obtained, and based on the storage mode of each physical block in the super block, a corresponding data operation is performed on the physical block in the super block, wherein the host command includes an erase command, a write command or a read command.
[0110] See also Figure 4 , Figure 4 is a schematic diagram of the structure of a second super block provided in an embodiment of the present application;
[0111] like Figure 4 As shown, Figure 4 The super block A in includes physical blocks A in data logic unit 0, data logic unit 1, ..., data logic unit n-1, and each physical block A is in the first storage mode.
[0112] See also Figure 5 , Figure 5 is a schematic diagram of the structure of the third super block provided in the embodiment of the present application;
[0113] like Figure 5 As shown, Figure 5 The super block A in the data logic unit 0, the data logic unit 1, ..., the data logic unit X, ..., the data logic unit n-1 includes the physical blocks A, at least one physical block A in the super block A (for example: the physical block A in the data logic unit X) is in the second storage mode, and at least one physical block A is in the first storage mode, at this time, the super block A is in the hybrid mode. The hybrid mode means that in the super block, at least two physical blocks are in different storage modes.
[0114] In some embodiments, before step S201, the method further includes: generating a first list and a second list, and initializing management information of each super block, specifically including steps S1-S2:
[0115] Step S1: During the production process of the flash memory device, a diagnostic operation in a first storage mode and / or a second storage mode is performed on each physical block to generate a first list and a second list;
[0116] The first list is used to store the addresses of the physical blocks in the first storage mode, the second list is used to store the addresses of the physical blocks in the second storage mode, and the diagnostic operation includes an erase diagnostic operation, a write diagnostic operation, and a read diagnostic operation. The erase diagnostic operation refers to performing an erase operation on a physical block to test the erase performance of the physical block; the write diagnostic operation refers to performing a write operation on a physical block to test the write performance of the physical block; and the read diagnostic operation refers to performing a read operation on a physical block to test the read performance of the physical block.
[0117] Specifically, during the testing and screening stage of the flash memory device before it leaves the factory, each physical block in the flash memory device is scanned in turn, and a diagnostic operation is performed on each physical block in the first storage mode and / or the second storage mode to determine the storage mode of each physical block, thereby recording the address of the physical block into the corresponding first list or second list.
[0118] See also Figure 6 , Figure 6It is a flowchart of a diagnostic operation performed on a physical block in a first storage mode and / or a second storage mode provided by an embodiment of the present application;
[0119] like Figure 6 As shown, the process of performing a diagnostic operation on a physical block in a first storage mode and / or a second storage mode includes:
[0120] Step S601: Select a physical block;
[0121] Specifically, each physical block in the flash memory device is scanned in sequence, and steps S601 to S608 are performed in sequence for each physical block until all physical blocks are scanned.
[0122] Step S602: performing a diagnostic operation in a first storage mode on the physical block to obtain a first diagnostic result;
[0123] Specifically, a physical block is selected, and a diagnostic operation in a first storage mode is performed on the physical block to obtain a first diagnostic result.
[0124] The diagnostic operation in the first storage mode refers to performing an erase diagnostic operation, a write diagnostic operation, and a read diagnostic operation on the physical block in sequence when the physical block is set to the first storage mode. For example, when the first storage mode is the QLC mode, the diagnostic operation in the first storage mode refers to performing an erase diagnostic operation, a write diagnostic operation, and a read diagnostic operation on the physical block in sequence when the physical block is used as a QLC Flash.
[0125] The first diagnostic result is a diagnostic result obtained by performing a diagnostic operation on the physical block in the first storage mode. The first diagnostic result includes a normal result or an abnormal result. The normal result means that no error occurs during the erase diagnostic operation, the write diagnostic operation, and the read diagnostic operation. The abnormal result means that an error occurs during any of the erase diagnostic operation, the write diagnostic operation, and the read diagnostic operation.
[0126] That is, when an erase diagnostic operation is performed, if an error occurs during the erase process, the first diagnostic result is an abnormal result. Alternatively, when a write diagnostic operation is performed, if an error occurs during the write process, the first diagnostic result is an abnormal result. Alternatively, when a read diagnostic operation is performed, if an error occurs during the read process, the first diagnostic result is an abnormal result.
[0127] Step S603: determining whether the first diagnosis result is a normal result;
[0128] Specifically, if the first diagnosis result is a normal result, the process proceeds to step S604; if the first diagnosis result is an abnormal result, the process proceeds to step S605.
[0129] Step S604: determining that the storage mode of the physical block is the first storage mode, and recording the address of the physical block into the first list;
[0130] Specifically, if the first diagnostic result is a normal result, the storage mode of the physical block is determined to be the first storage mode, and the address of the physical block is recorded in the first list.
[0131] Step S605: performing a diagnostic operation in a second storage mode on the physical block to obtain a second diagnostic result;
[0132] Specifically, if the first diagnostic result is an abnormal result, a diagnostic operation in the second storage mode is performed on the physical block to obtain a second diagnostic result.
[0133] The diagnostic operation in the second storage mode refers to performing an erase diagnostic operation, a write diagnostic operation, and a read diagnostic operation on the physical block in sequence when the physical block is set to the second storage mode. For example, when the second storage mode is the TLC mode, the diagnostic operation in the second storage mode refers to performing an erase diagnostic operation, a write diagnostic operation, and a read diagnostic operation on the physical block in sequence when the physical block is used as a TLC Flash.
[0134] The second diagnostic result is a diagnostic result obtained by performing a diagnostic operation on the physical block in the second storage mode. The second diagnostic result includes a normal result or an abnormal result. A normal result means that no error occurs during the erase diagnostic operation, write diagnostic operation, and read diagnostic operation. An abnormal result means that an error occurs during any of the erase diagnostic operation, write diagnostic operation, or read diagnostic operation.
[0135] Step S606: determining whether the second diagnosis result is a normal result;
[0136] Specifically, if the second diagnostic result is an abnormal result, the process proceeds to step S607 ; if the second diagnostic result is a normal result, the process proceeds to step S608 .
[0137] Step S607: Mark the physical block as a bad block;
[0138] Specifically, if the second diagnostic result is an abnormal result, the physical block is marked as a bad block, and the address of the physical block is recorded in a bad block table, wherein the bad block table is used to store the address of each bad block.
[0139] Step S608: Determine that the storage mode of the physical block is the second storage mode, and record the address of the physical block into the second list;
[0140] Specifically, if the second diagnostic result is a normal result, the storage mode of the physical block is determined to be the second storage mode, and the address of the physical block is recorded in the second list.
[0141] Step S609: Determine whether all physical blocks have been scanned.
[0142] Specifically, after recording the address of any physical block into the first list, or recording the address of any physical block into the second list, or marking any physical block as a bad block, determine whether all physical blocks have been scanned, that is, confirm whether the diagnostic operation has been performed on each physical block.
[0143] If all physical blocks have been scanned, end the process. If not all physical blocks have been scanned, return to step S601 to select the next physical block and execute steps S601 - S608 until all physical blocks have been scanned. That is, after recording the address of any physical block into the first list, or recording the address of any physical block into the second list, or marking any physical block as a bad block, perform a diagnostic operation on the next physical block until the diagnostic operation has been performed on all physical blocks.
[0144] In the embodiment of the present application, by performing a diagnostic operation on a physical block in the first storage mode and then performing a diagnostic operation on the physical block in the second storage mode after obtaining an abnormal result, compared with the existing solution of directly marking the physical block as a bad block after obtaining an abnormal result, the present application can adjust the storage mode of the physical block so that the physical block can continue to perform data operations in a mode with a lower storage density, thereby reducing the probability of the physical block being directly marked as a bad block and extending the usage cycle of the physical block.
[0145] Step S2: When the flash memory device is initialized, initialize the management information of each superblock according to the first list and the second list.
[0146] Among them, the management information of the superblock includes the storage mode of each physical block included in the superblock. Each superblock corresponds to a structure, and the management information of the superblock is recorded through the structure.
[0147] Specifically, when the flash memory device is initialized, determine the storage mode of each physical block according to the first list and the second list, and record it in the management information of the corresponding superblock in the form of an array.
[0148] In the embodiment of the present application, the management information of the superblock includes the array information of the physical block types. Recording the storage mode of the physical block in the management information of the corresponding superblock in the form of an array includes: recording the storage mode of the physical block, the address of the physical block, and the address of the corresponding data logical unit into the array information of the physical block types in the form of an array.
[0149] The type array information of the physical block includes the address of the data logic unit, the address of the physical block corresponding to the super block in the data logic unit, and the storage mode mark of the physical block. The subscript of the array represents the address of the data logic unit, and the subscript is the index of the data logic unit starting from 0, which is used to indicate which data logic unit the array records the type array information of the physical block. The storage mode mark is used to record the storage mode of the physical block, that is, the first storage mode or the second storage mode.
[0150] In some embodiments, the management information of the super block also includes the capacity of the super block. It is understandable that during the initialization phase or use of the flash memory device, the capacity of the super block may change due to bad block replacement and other situations.
[0151] See also Figure 7 , Figure 7 yes Figure 2 A detailed flow chart of step S201 in FIG.
[0152] like Figure 7 As shown, step S201 includes:
[0153] Step S211: Determine the super block to be operated and the physical block to be operated;
[0154] Among them, the super block to be operated is the super block for data operation this time, the super block to be operated includes the physical block to be operated located on the data logical unit to be operated, the data logical unit to be operated is the data logical unit for data operation this time, and the physical block to be operated is the physical block for data operation this time.
[0155] Specifically, the host command is obtained and parsed to determine the address of the super block to be operated, the address of the data logical unit to be operated, and the address of the physical block to be operated. These addresses can be determined by the flash algorithm module, which will not be described in detail here.
[0156] Step S212: Obtaining management information of the super block to be operated;
[0157] The management information of the super block to be operated includes the storage mode of each physical block included in the super block to be operated.
[0158] Step S213: querying the storage mode of the physical block to be operated from the management information;
[0159] Specifically, the storage mode of the physical block to be operated is queried from the management information of the super block to be operated. For example, the type array information of the physical block located in the data logical unit to be operated is queried from the management information of the super block to be operated, and the storage mode of the physical block to be operated is determined by the storage mode mark of the physical block.
[0160] Step S214: determining whether the storage mode of the physical block to be operated is the first storage mode;
[0161] Specifically, if the storage mode of the physical block to be operated is the first storage mode, the process proceeds to step S215; if the storage mode of the physical block to be operated is the second storage mode, the process proceeds to step S216.
[0162] Step S215: performing data operation on the physical block to be operated based on the first storage mode;
[0163] Specifically, when the storage mode of the physical block to be operated is the first storage mode, data operation is performed on the physical block to be operated based on the first storage mode, that is, an erase operation, a write operation or a read operation matching the first storage mode is performed on the physical block to be operated.
[0164] For example, when the first storage mode is the QLC mode, the physical block to be operated is used as a QLC Flash, and an erase operation, a write operation, or a read operation is performed on the physical block to be operated in the same manner as a data operation is performed on the QLC Flash.
[0165] Step S216: performing data operation on the physical block to be operated based on the second storage mode.
[0166] Specifically, when the storage mode of the physical block to be operated is the second storage mode, data operation is performed on the physical block to be operated based on the second storage mode, that is, an erase operation, a write operation or a read operation matching the second storage mode is performed on the physical block to be operated.
[0167] For example, when the second storage mode is the TLC mode, the physical block to be operated is used as a TLC Flash, and an erase operation, a write operation, or a read operation is performed on the physical block to be operated in the same manner as a data operation is performed on the TLC Flash.
[0168] It is understandable that in different storage modes, the erase voltage required for the erase operation is different. For example, due to its higher storage density, the QLC mode has a more complex control of the erase voltage and requires more erase pulses to ensure that the data is completely cleared, while the TLC mode has a relatively simple erase process and takes less time.
[0169] In different storage modes, the number of voltage states involved in write operations is different. For example, the QLC mode needs to control 16 voltage states to store 4 bits of data, and the TLC mode needs to control 8 voltage states to store 3 bits of data. In different storage modes, read operations need to parse different numbers of voltage states. For example, the QLC mode needs to read and parse 16 voltage states to distinguish the stored 4 bits of information, while the TLC mode only needs to read and parse 8 voltage states to distinguish 3 bits of information.
[0170] In an embodiment of the present application, the flash memory device supports performing data operations matching the storage mode on the physical block to be operated through specific commands. The specific commands are implemented based on the NAND interface protocol or the custom protocol of the chip manufacturer, which is not limited here. The method of performing an erase operation, a write operation, or a read operation on QLC Flash or TLC Flash is a prior art and will not be repeated here.
[0171] In some embodiments, the flash memory device uses Redundant Arrays of Inexpensive Disks (RAID) technology, where RAID technology is a data storage virtualization technology that combines multiple disk drives into a logical unit to provide data redundancy and improve performance by distributing data among disks.
[0172] Among them, the data logic unit is divided into a normal data logic unit and a check data logic unit (ParityDie). The normal data logic unit is used to store normal data, and the check data logic unit is used to store check data. The super block includes data blocks and check blocks. Each super block consists of at least two data blocks and one check block. The data block is a physical block located on the normal data logic unit in the super block. Each data block in the same super block is located in a different normal data logic unit. The check block is a physical block located on the check data logic unit in the super block.
[0173] by Figure 3 For example, data logic unit 0, data logic unit 1, ..., data logic unit n-1 are used as common data logic units, data logic unit n is used as a check data logic unit, the physical block A in each common data logic unit is a data block, and the physical block A in the check data logic unit is a check block.
[0174] In some embodiments, the flash memory device further includes a cache space and a redundant buffer. The cache space includes at least two data buffers, and the flash memory medium includes at least two normal data logic units and one check data logic unit, wherein each normal data logic unit corresponds to a data buffer one by one, and the check data logic unit corresponds to the redundant buffer.
[0175] The data buffer is used to store the data to be written, and the redundant buffer is used to store the data after XOR processing in several data buffers, and the data after XOR processing includes verification data. The ordinary data logic unit is used to store the data written by the corresponding data buffer in the cache space (i.e., the data to be written), and the verification data logic unit is used to store the verification data written by the redundant data buffer.
[0176] The cache space includes but is not limited to memory such as Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), etc. The redundant buffer includes but is not limited to disk arrays such as Redundant Array of Independent Disks (RAID), etc.
[0177] In some embodiments, for a flash memory device using RAID technology, step S201 includes steps S3 to S7:
[0178] Step S3: Split the data contained in the write command to obtain at least two data to be written;
[0179] Specifically, the front-end module divides the data included in the write command to obtain at least two data to be written (ie, the ordinary data mentioned above), and stores each data to be written into the corresponding data buffer one by one.
[0180] Step S4: querying the management information of the super block to be written, and determining the first data block and the second data block included in the super block to be written;
[0181] The first data block is a physical block in the first storage mode, and the second data block is a physical block in the second storage mode. For example, the first data block is in the QLC mode, and the second data block is in the TLC mode. For a physical block in the QLC mode, one word line corresponds to four physical pages, and for a physical block in the TLC mode, one word line corresponds to three physical pages. Compared with the first data block, each word line in the second data block has one less physical page.
[0182] Specifically, the management information of the super block to be written is queried, and the physical block is determined to be the first data block or the second data block according to the storage mode of each physical block, thereby determining each first data block and each second data block included in the super block to be written.
[0183] See also Figure 8 , Figure 8 is a schematic diagram of the structure of the fourth super block provided in an embodiment of the present application;
[0184] like Figure 8As shown, a super block is composed of physical blocks A in normal data logic unit 0, normal data logic unit 1, ..., and check data logic unit n. The word line P of each physical block A in normal data logic unit 0, normal data logic unit 1, and check data logic unit n corresponds to 4 physical pages: physical page 0, physical page 1, physical page 2, and physical page 3, and the word line P of physical block A in normal data logic unit 2 corresponds to only 3 physical pages: physical page 0, physical page 1, and physical page 2.
[0185] Among them, each physical block A in the normal data logic unit 0 and the normal data logic unit 1 is a first data block, the physical block A in the normal data logic unit 2 is a second data block, and the physical block A in the check data logic unit n is a check block.
[0186] Step S5: performing XOR processing on the first data to be written and the second data to be written corresponding to the same first page address to generate verification data corresponding to each first page address, and recording the corresponding XOR times;
[0187] The first data to be written is the data to be written corresponding to any physical page of any first data block, and the second data to be written is the data to be written corresponding to any physical page of any second data block. The first page address is any page address corresponding to the word lines of the first data block and the second data block. Figure 8 For example, the first page address is the address of physical page 0, physical page 1 or physical page 2.
[0188] The XOR times are the times that the XOR processing is performed on a number of data to be written corresponding to the same page address. Each page address corresponds to one XOR times, and the page address is the address of the physical page. XOR processing includes XOR operation or modulo-2 addition. XOR operation is a binary operation, and its result is 1 only when the two input bits are different, otherwise it is 0. Modulo-2 addition is a binary operation, which is equivalent to the "XOR" operation. Its operation rule is to add two sequences bit by bit modulo 2, that is, the corresponding bits in the two sequences are added, no carry is carried, the same is 0, and the different is 1.
[0189] Specifically, for each first page address, a number of first data to be written and corresponding to the same first page address stored in a number of data buffers are XORed with a number of second data to be written to generate verification data corresponding to each first page address, the verification data is stored in a redundant buffer, and the number of XORs corresponding to the first page address is recorded.
[0190] For example: the word lines of the first data block and the second data block both correspond to physical page 0, the first page address is the address of physical page 0, and the to-be-written data corresponding to physical page 0 stored in each data buffer is XORed to generate verification data corresponding to physical page 0, the verification data is stored in the redundant buffer, and the number of XORs corresponding to physical page 0 is recorded.
[0191] Step S6: performing XOR processing on the first data to be written corresponding to the same second page address to generate verification data corresponding to each second page address, and recording the corresponding XOR times;
[0192] The second page address is any page address corresponding to the word line of the first data block and not corresponding to the word line of the second data block. Figure 8 For example, the second page address is the address of physical page 3.
[0193] Specifically, when the second page address exists, for each second page address, the first data to be written corresponding to the same second page address stored in the data buffer is XORed to generate verification data corresponding to each second page address, and the number of XORs corresponding to the second page address is recorded.
[0194] For example: the word line of the first data block corresponds to physical page 3, the word line of the second data block does not correspond to physical page 3, the second page address is the address of physical page 3, the first data to be written corresponding to physical page 3 stored in the data buffer is XORed to generate verification data corresponding to physical page 3, the verification data is stored in the redundant buffer, and the number of XORs corresponding to physical page 3 is recorded.
[0195] Step S7: Write each to-be-written data into the corresponding data block, and write the verification data into the verification block.
[0196] Specifically, each data to be written is written into the corresponding page address in the corresponding data block, and the verification data is written into the corresponding page address in the verification block. Since the XOR processing speed is very fast, the hardware module can ensure that the verification data in the redundant buffer can be read only when the XOR processing of the data to be written in all the data buffers is completed.
[0197] See also Fig. 9 , Fig. 9 This is a schematic diagram of a data writing process provided by an embodiment of the present application;
[0198] like Fig. 9As shown, the cache space includes a first data buffer, a second data buffer, and a third data buffer, each of which is used to store normal data to be written (i.e., the first data to be written or the second data to be written). The flash memory medium includes a first normal data logic unit, a second normal data logic unit, and a check data logic unit. Each normal data logic unit is used to store normal data in a corresponding data buffer in the cache space, and the check data logic unit is used to store check data written in the redundant data buffer.
[0199] The hardware module performs XOR processing on the normal data in each data buffer serially according to the page address to obtain the verification data, and then saves the verification data to the redundant buffer and records the number of XOR operations corresponding to each page address. The hardware module writes the normal data in the three data buffers into the corresponding normal data logic unit, and after obtaining the verification data, the hardware writes the verification data in the redundant buffer into the verification data logic unit in the flash memory medium.
[0200] In the embodiment of the present application, compared with the existing solution, when performing XOR processing, the number of physical pages corresponding to the word line of each data block is the same. Taking QLC as an example, one word line is fixed to correspond to 4 physical pages, and the number of XOR processing of the data to be written corresponding to each page address is the same. Since the super block in the present application adopts a hybrid mode management, the number of XOR processing of the data to be written corresponding to each page address will change. Figure 8 For example, the number of XORs corresponding to physical page 0, physical page 1, and physical page 2 is the same, which is the total number of data logical units minus one, while the number of XORs corresponding to physical page 3 depends on the number of second data blocks, and the number of XORs will change. Therefore, this application records the number of XORs corresponding to each page address.
[0201] Step S202: when an error occurs during the operation, the storage mode of the physical block is converted, so as to operate the physical block according to the converted storage mode.
[0202] Specifically, when an error occurs during the reading operation, the storage mode of the target physical block is converted, so that the target physical block is operated according to the converted storage mode, wherein the target physical block is the physical block for the reading operation.
[0203] It is understandable that the storage mode of some flash media can be converted to a lower density storage mode. For example, for QLC Flash, due to its particle characteristics, a QLC physical block can be used in QLC mode, in which case its erase and write life cycle is about 4,000 times, and can also be switched to TLC mode, in which case its erase and write life cycle is about 10,000 times.
[0204] See also Fig.10 , Fig.10 yes Figure 2 A detailed flow chart of step S202;
[0205] like Fig.10 As shown, step S202 includes:
[0206] Step S221: performing a diagnostic operation in the first storage mode on the target physical block to obtain a third diagnostic result;
[0207] Specifically, if an uncorrectable error occurs when reading the target physical block, a diagnostic operation in the first storage mode is performed on the target physical block to obtain a third diagnostic result.
[0208] The target physical block is a physical block in the first storage mode, for example, the target physical block is a physical block in the QLC mode, and the third diagnostic result is a diagnostic result obtained by performing a diagnostic operation on the target physical block in the first storage mode. The third diagnostic result includes a normal result or an abnormal result. The specific implementation of performing a diagnostic operation on the target physical block in the first storage mode is similar to the specific implementation of step S602, and will not be repeated here.
[0209] In an embodiment of the present application, before performing a diagnostic operation in the first storage mode on the target physical block, the method further includes: performing garbage collection on the target super block. The target super block includes the target physical block. Specifically, the target super block to which the target physical block belongs is marked as a to-be-collected state; garbage collection is performed on the target super block, and the data stored in the target super block is written into the remaining super blocks in an idle state.
[0210] Among them, garbage collection (GC) is a prior art and will not be described in detail here. The pending state is a state of waiting for garbage collection, and the idle state refers to a state in which no valid data is stored in the super block and new data can be directly written.
[0211] Step S222: determining whether the third diagnosis result is a normal result;
[0212] Specifically, if the third diagnostic result is a normal result, the process proceeds to step S223; if the third diagnostic result is an abnormal result, the process proceeds to step S224.
[0213] Step S223: Keep the storage mode of the target physical block unchanged;
[0214] Specifically, when the third diagnostic result is a normal result, the storage mode of the target physical block is kept unchanged.
[0215] Step S224: performing a replacement operation on the target physical block and updating the management information of the target super block;
[0216] Specifically, when the third diagnosis result is an abnormal result, a replacement operation is performed on the target physical block, and the management information of the target superblock is updated. The replacement operation includes migrating the data stored in the target physical block and updating the mapping relationship between the logical block address (LBA) and the physical block address (PBA).
[0217] Please refer to Fig.11 , Fig.11 which is a schematic flowchart of a process for performing a replacement operation on a target physical block provided by an embodiment of the present application;
[0218] As Fig.11 shown, the process of performing a replacement operation on the target physical block includes:
[0219] Step S111: Query the first list;
[0220] The first list is further used to record the number of first replacement blocks. The first replacement block is a physical block that is recorded in the first list and is in the first storage mode for performing the replacement operation. After using any first replacement block to perform the replacement operation, the flash memory device deletes the address of the first replacement block from the first list and decrements the number of first replacement blocks by one.
[0221] In some embodiments, after deleting an element (i.e., the address of the first replacement block) from the first list, each element in the first list after that element will sequentially overwrite the previous element to fill the deleted space. The first list includes, but is not limited to, a linked list.
[0222] Step S112: Determine whether the first list is empty;
[0223] Specifically, by determining whether the number of first replacement blocks is zero, it is determined whether the first list is empty. If the number of first replacement blocks is greater than zero, there is an address of any physical block recorded in the first list, that is, the first list is not empty, and step S113 is entered; if the number of first replacement blocks is equal to zero, there is no address of a physical block recorded in the first list, that is, the first list is empty, and step S114 is entered.
[0224] Step S113: Select a first replacement block, replace the target physical block with the first replacement block, and update the management information of the first list and the target superblock;
[0225] Specifically, if the first list is not empty, a first replacement block is selected, the target physical block is replaced with the first replacement block, and the management information of the first list and the target superblock is updated.
[0226] Among them, the step of replacing the target physical block with the first replacement block includes: performing an erase operation on the first replacement block; writing the data stored in the target physical block into the first replacement block; and updating the mapping relationship from the logical address corresponding to the target physical block to the physical address of the target physical block to the mapping relationship from the logical address corresponding to the target physical block to the physical address of the first replacement block.
[0227] The step of updating the first list includes: deleting the address of the first replacement block used in the current replacement operation in the first list, and reducing the number of the first replacement blocks by one.
[0228] The step of updating the management information of the target super block includes: deleting the type array information of the target physical block and adding the type array information of the first replacement block in the management information of the target super block.
[0229] Step S114: determining whether the target physical block is a check block;
[0230] Specifically, if the target physical block is a check block, the process ends; if the target physical block is not a check block, the target physical block is a data block, and the process goes to step S115.
[0231] In the embodiment of the present application, the check block cannot be replaced. If the check block is replaced, the RAID protection function is not implemented. Therefore, when the target physical block is a check block, the replacement operation is not performed, and the target super block has no RAID protection function.
[0232] Step S115: query the second list;
[0233] The second list is also used to record the number of second replacement blocks, where the second replacement blocks are physical blocks recorded in the second list and used to perform the replacement operation and in the second storage mode. After using any second replacement block to perform the replacement operation, the flash memory device deletes the address of the second replacement block in the second list and reduces the number of second replacement blocks by one.
[0234] In some embodiments, after deleting an element (i.e., the address of the second replacement block) in the second list, each element after the element in the second list will sequentially overwrite the previous element to fill the deleted vacancy. The second list includes but is not limited to a linked list.
[0235] Step S116: Determine whether the second list is empty;
[0236] Specifically, by judging whether the number of the second replacement blocks is zero, it is determined whether the second list is empty. If the number of the second replacement blocks is greater than zero, the address of any physical block recorded in the second list exists, that is, the second list is not empty, and the process proceeds to step S117; if the number of the second replacement blocks is zero, the second list is empty, and the process proceeds to step S118.
[0237] Step S117: selecting a second replacement block, replacing the target physical block with the second replacement block, and updating the management information of the second list and the target super block;
[0238] Specifically, if the first list is empty, and the target physical block is a data block, and the second list is not empty, a second replacement block is selected, the target physical block is replaced with the second replacement block, and the management information of the second list and the target super block is updated.
[0239] The step of updating the second list includes: deleting the address of the second replacement block used in the current replacement operation in the second list, and reducing the number of the second replacement blocks by one.
[0240] The step of updating the management information of the target super block includes: deleting the type array information of the target physical block and adding the type array information of the second replacement block in the management information of the target super block.
[0241] The step of updating the management information of the target super block further includes: reducing the number of XOR operations corresponding to each second page address by 1. For example, when the first storage mode is the QLC mode and the second storage mode is the TLC mode, the number of XOR operations corresponding to the physical page 3 is reduced by 1.
[0242] Step S118: Delete the mapping relationship between the target super block and the target physical block.
[0243] Specifically, if the first list is empty and the target physical block is a check block, or if both the first list and the second list are empty and the target physical block is a data block, the mapping relationship between the target super block and the target physical block is deleted.
[0244] In this case, since there are no first replacement blocks and second replacement blocks that can perform the replacement operation, the mapping relationship between the target super block and the target physical block is deleted in the management information of the target super block. At this time, the target super block has one less bound physical block and its capacity will become smaller.
[0245] Step S225: performing a diagnostic operation in the second storage mode on the target physical block to obtain a fourth diagnostic result;
[0246] Among them, the fourth diagnostic result is the diagnostic result obtained by performing a diagnostic operation on the target physical block in the second storage mode. The fourth diagnostic result includes a normal result or an abnormal result. The specific implementation of performing a diagnostic operation on the target physical block in the second storage mode is similar to the specific implementation of step S605, and will not be elaborated here.
[0247] Step S226: Determine whether the fourth diagnostic result is a normal result;
[0248] Specifically, if the fourth diagnostic result is a normal result, proceed to step S227; if the fourth diagnostic result is an abnormal result, proceed to step S228.
[0249] Step S227: Convert the storage mode of the target physical block to the second storage mode, and record the address of the target physical block in the second list;
[0250] Specifically, when the fourth diagnostic result is a normal result, convert the storage mode of the target physical block to the second storage mode, and record the address of the target physical block in the second list. For example: convert the storage mode of the target physical block from the QLC mode to the TLC mode.
[0251] Step S228: Mark the target physical block as a bad block.
[0252] Specifically, when the fourth diagnostic result is an abnormal result, mark the target physical block as a bad block, and store the address of the target physical block in the bad block table.
[0253] In the embodiments of the present application, by converting the storage mode of the physical block from the QLC mode to the TLC mode when an error occurs in the read operation, the present application can enable the physical block to continue to perform data operations normally during the use of the QLC flash memory device, especially at the end of its life, extend its service life without incurring additional costs.
[0254] In some embodiments, when the target physical block is a physical block in the second storage mode, for example: the target physical block is a physical block in the TLC mode, the method further includes: performing garbage collection on the target superblock; marking the target physical block as a bad block, and storing the address of the target physical block in the bad block table.
[0255] In some embodiments, the method further includes: if an uncorrectable error occurs when reading data, recovering the data through RAID technology.
[0256] Take Figure 8 as an example. Each word line P of the physical block A in the normal data logical unit 0 and the normal data logical unit 1 is a word line in the QLC mode, and the word line P of the physical block A in the normal data logical unit 2 is a word line in the TLC mode.
[0257] At this time, the word line P of the check block (physical block A in the check data logic unit n) is also a word line in the QLC mode, and the valid data in physical page 0, physical page 1, and physical page 2 in the word line P of each ordinary data logic unit can be protected by RAID.
[0258] Since the word line P in the TLC mode does not have a physical page 3, there is no need to perform XOR processing on the physical page 3 in the TLC mode when writing data and restoring data. In this way, the physical page 3 of the verification data logic unit lacks the XOR result of the physical page 3 of the ordinary data logic unit 2, but it also has a protective effect. When an uncorrectable error occurs in reading the physical page 3 of the word line P of any first data block, the physical page 3 of the word line P in the verification data logic unit and the physical page 3 of the word line P of other first data blocks can also be XORed to obtain reconstructed data of the physical page 3 with the uncorrectable error.
[0259] The data is recovered by using RAID technology, specifically including steps S11 to S13:
[0260] Step S11: if an uncorrectable error occurs when reading a target word line of a target physical block, query the management information of the target super block to determine the storage mode of the target physical block;
[0261] The target physical block includes a target word line, and the target word line is a word line where an uncorrectable error occurs when reading the target physical block.
[0262] Step S12: determining a target physical page corresponding to a target word line based on a storage mode of a target physical block;
[0263] The target physical page is a physical page corresponding to the target word line and having an uncorrectable error when reading. In the first storage mode, the target word line corresponds to a first number of physical pages, and in the second storage mode, the target word line corresponds to a second number of physical pages.
[0264] For example: in QLC mode, the target word line corresponds to 4 physical pages, and the target physical page is physical page 0, physical page 1, physical page 2 or physical page 3; in TLC mode, the target word line corresponds to 3 physical pages, and the target physical page is physical page 0, physical page 1 or physical page 2.
[0265] Step S13: performing an XOR process on the data stored in each physical page of the target super block having the same address as the target physical page, so as to obtain the reconstructed data corresponding to the target physical page.
[0266] The reconstructed data is data obtained through XOR processing, and the reconstructed data is consistent with the data stored in the target physical page.
[0267] Specifically, each physical block except the target physical block in the target super block is traversed, data stored in the physical page with the same address as the target physical page is extracted, and an XOR operation is performed on the data to obtain the reconstructed data.
[0268] In an embodiment of the present application, by converting the storage mode of the physical block from the QLC mode to the TLC mode when an error occurs in a read operation, and combining RAID technology to manage data on the super block in the hybrid mode, the present application can not only extend the service life of the physical block, but also recover data when an error occurs, protect data integrity, reduce the risk of data loss, and further improve the stability of the flash memory device storing data and the durability of the flash memory device, especially improve the stability and durability of the flash memory device at the end of its life.
[0269] In an embodiment of the present application, a flash memory management method, a storage control chip and a flash memory device are provided. The flash memory management method is applied to the flash memory device. The flash memory device includes a super block. The super block includes a plurality of physical blocks. The flash memory management method includes: based on the storage mode of each physical block in the super block, performing data operations on the physical blocks in the super block; when an error occurs during the operation process, converting the storage mode of the physical block to operate the physical block according to the converted storage mode.
[0270] By performing data operations on physical blocks in a super block based on the storage mode of each physical block in the super block, when an error occurs during the operation, the storage mode of the physical block is converted to operate the physical block according to the converted storage mode. The present application can enable the physical block to continue to perform data operations by converting the storage mode of the physical block, reduce the probability of the physical block being directly marked as a bad block, extend the service life of the physical block, and improve the stability of data storage in the flash memory device and the durability of the flash memory device.
[0271] See also Fig.12 , Fig.12 is a schematic diagram of the structure of a storage control chip provided in an embodiment of the present application;
[0272] like Fig.12 As shown, the storage control chip 120 includes one or more processors 121 and a memory 122. Among them, Fig.12 A processor 121 is taken as an example.
[0273] The processor 121 and the memory 122 may be connected via a bus or other means. Fig.12 The example of connecting through bus is taken in the following.
[0274] The processor 121 is used to provide computing and control capabilities to control the flash memory device 130 to perform corresponding tasks, for example, to control the flash memory device 130 to perform the flash memory management method in any of the above method embodiments, the flash memory management method is applied to the flash memory device, the flash memory device includes a super block, the super block includes a plurality of physical blocks, the flash memory management method includes: based on the storage mode of each physical block in the super block, performing data operations on the physical blocks in the super block; when an error occurs during the operation process, converting the storage mode of the physical block to operate the physical block according to the converted storage mode.
[0275] On the one hand, by converting the storage mode of the physical block when an error occurs during the operation process, the present application can enable the physical block to continue to perform data operations, reduce the probability of the physical block being directly marked as a bad block, and extend the service life of the physical block. On the other hand, by performing data operations on the physical blocks in the super block based on the storage mode of each physical block in the super block, the present application can perform refined management of the super block in the mixed mode (that is, there are physical blocks in different storage modes in the super block), and further improve the stability of the flash memory device storing data and the durability of the flash memory device.
[0276] The processor 121 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a hardware chip or any combination thereof; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0277] The memory 122, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the flash memory management method in the embodiment of the present application. The processor 121 can implement the flash memory management method in any of the above method embodiments by running the non-transitory software programs, instructions and modules stored in the memory 122. Specifically, the memory 122 may include a volatile memory (VM), such as a random access memory (RAM); the memory 122 may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory (Flash Memory), a hard disk (HDD) or a solid-state drive (SSD) or other non-transitory solid-state storage device; the memory 122 may also include a combination of the above types of memories.
[0278] The memory 122 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 122 may optionally include a memory remotely arranged relative to the processor 121, and these remote memories may be connected to the processor 121 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0279] One or more modules are stored in the memory 122, and when executed by one or more processors 121, the flash memory management method in any of the above method embodiments is executed, for example, the flash memory management method described above is executed. Figure 2 The steps shown.
[0280] See also Fig.13 , Fig.13 is a structural schematic diagram of a flash memory device provided in an embodiment of the present application;
[0281] like Fig.13 As shown, the flash memory device 130 includes a storage control chip 120 and at least one flash memory medium 131 . Fig.13 Taking a flash memory medium 131 as an example, the storage control chip 120 and the flash memory medium 131 are communicatively connected.
[0282] The storage control chip 120 is used to execute the flash memory management method in any of the above embodiments, and the flash memory management method includes: based on the storage mode of each physical block in the super block, performing data operations on the physical blocks in the super block; when an error occurs during the operation process, converting the storage mode of the physical block to operate the physical block according to the converted storage mode.
[0283] At least one flash memory medium 131 is connected to the storage control chip 120 for storing data. The flash memory medium 131 includes a super block, and the super block includes a plurality of physical blocks.
[0284] The flash memory device includes a storage control chip and at least one flash memory medium, the flash memory medium includes a super block, the super block includes a plurality of physical blocks, the storage control chip is used to execute the flash memory management method in any of the above embodiments, and the flash memory medium is used to store data. The present application can reduce the probability of physical blocks being directly marked as bad blocks, extend the service life of physical blocks, and can perform refined management of super blocks in mixed mode (i.e., there are physical blocks in different storage modes in the super block), thereby improving the stability of data storage in the flash memory device and the durability of the flash memory device.
[0285] An embodiment of the present application also provides a non-volatile computer storage medium, which stores computer executable instructions, and the computer executable instructions are executed by one or more processors. For example, the one or more processors can execute the flash memory management method in any of the above method embodiments, for example, execute the flash memory management method in any of the above method embodiments, for example, execute the various steps described above.
[0286] The above-described device or equipment embodiments are merely illustrative, wherein the unit modules described as separate components may or may not be physically separated, and the components displayed as module units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network module units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0287] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution can be essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute various embodiments or certain parts of the embodiments.
[0288] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A flash memory management method, characterized in that: Applied to a flash memory device, the flash memory device includes a super block, the super block includes a plurality of physical blocks, the method includes: Based on the storage mode of each physical block in the super block, performing data operations on the physical blocks in the super block; When an error occurs during the operation, the storage mode of the physical block is converted so as to operate the physical block according to the converted storage mode.
2. The method according to claim 1, characterized in that The storage mode includes a first storage mode or a second storage mode, and the data operation includes an erase operation, a write operation or a read operation; In a first storage mode, each word line in the physical block corresponds to a first number of physical pages; In the second storage mode, each word line in the physical block corresponds to a second number of physical pages, and the first number is different from the second number.
3. The method according to claim 2, characterized in that The performing of data operations on the physical blocks in the super block based on the storage mode of each physical block in the super block includes: Acquire management information of the super block to be operated, wherein the management information includes a storage mode of each physical block included in the super block to be operated; Querying the storage mode of the physical block to be operated from the management information; When the storage mode of the physical block to be operated is the first storage mode, performing data operation on the physical block to be operated based on the first storage mode; When the storage mode of the physical block to be operated is the second storage mode, a data operation is performed on the physical block to be operated based on the second storage mode.
4. The method according to claim 2, characterized in that: The super block includes a data block and a check block; When the data operation is a write operation, performing the data operation on the physical blocks in the super block based on the storage mode of each physical block in the super block includes: Splitting the data contained in the write command to obtain at least two pieces of data to be written; Query the management information of the super block to be written, and determine the first data block and the second data block included in the super block to be written; Performing XOR processing on the first data to be written and the second data to be written corresponding to the same first page address to generate verification data corresponding to each first page address, and recording the corresponding XOR times; and / or, performing XOR processing on the first data to be written corresponding to the same second page address to generate verification data corresponding to each second page address, and recording the corresponding XOR times; Write each to-be-written data into the corresponding data block, and write the verification data into the verification block; The first data block is a physical block in a first storage mode, the second data block is a physical block in a second storage mode, the first data to be written is data to be written corresponding to any physical page of any of the first data blocks, and the second data to be written is data to be written corresponding to any physical page of any of the second data blocks; The first page address is any page address corresponding to the word lines of the first data block and the second data block, the second page address is any page address corresponding to the word line of the first data block and not corresponding to the word line of the second data block, and the number of XOR times is the number of times XOR processing is performed on several data to be written corresponding to the same page address.
5. The method according to claim 1, characterized in that When an error occurs during the operation, converting the storage mode of the physical block includes: If an uncorrectable error occurs when reading a target physical block, a diagnostic operation in a first storage mode is performed on the target physical block to obtain a third diagnostic result, wherein the target physical block is a physical block in the first storage mode; When the third diagnostic result is an abnormal result, performing a replacement operation on the target physical block and updating management information of a target super block, wherein the target super block includes a target physical block; performing a diagnostic operation in a second storage mode on the target physical block to obtain a fourth diagnostic result; When the fourth diagnostic result is a normal result, converting the storage mode of the target physical block to a second storage mode, and recording the address of the target physical block into a second list; The method further comprises: When the third diagnostic result is a normal result, keeping the storage mode of the target physical block unchanged; When the fourth diagnostic result is an abnormal result, the target physical block is marked as a bad block.
6. The method according to claim 5, characterized in that The super block includes a data block and a check block; The replacing operation on the target physical block includes: If the first list is not empty, a first replacement block is selected, the target physical block is replaced with the first replacement block, and the management information of the first list and the target super block is updated; If the first list is empty, and the target physical block is a data block, and the second list is not empty, then a second replacement block is selected, the target physical block is replaced with the second replacement block, and the management information of the second list and the target super block is updated; If the first list is empty and the target physical block is a check block, or if both the first list and the second list are empty and the target physical block is a data block, then the mapping relationship between the target super block and the target physical block is deleted; The first replacement block is a physical block recorded in the first list and used for performing a replacement operation and in the first storage mode, and the second replacement block is a physical block recorded in the second list and used for performing a replacement operation and in the second storage mode.
7. The method according to claim 6, characterized in that The method further comprises: If an uncorrectable error occurs when reading a target word line of a target physical block, querying management information of the target super block to determine a storage mode of the target physical block; Determining a target physical page corresponding to the target word line based on a storage mode of the target physical block; An XOR process is performed on the data stored in each physical page of the target super block having the same address as the target physical page to obtain the reconstructed data corresponding to the target physical page.
8. The method according to any one of claims 1-3, 5-7, characterized in that: The method further comprises: During the production process of the flash memory device, a diagnostic operation in the first storage mode and / or the second storage mode is performed on each of the physical blocks to generate a first list and a second list, wherein the first list is used to store addresses of physical blocks in the first storage mode, and the second list is used to store addresses of physical blocks in the second storage mode, and the diagnostic operation includes an erase diagnostic operation, a write diagnostic operation, and a read diagnostic operation; When the flash memory device is initialized, management information of each super block is initialized according to the first list and the second list, wherein the management information includes a storage mode of each physical block included in the super block.
9. The method according to claim 8, characterized in that The performing of the diagnostic operation in the first storage mode and / or the second storage mode on each of the physical blocks to generate the first list and the second list includes: Selecting a physical block, and performing a diagnostic operation in a first storage mode on the physical block to obtain a first diagnostic result; If the first diagnostic result is a normal result, determining that the storage mode of the physical block is the first storage mode, and recording the address of the physical block into the first list; If the first diagnostic result is an abnormal result, performing a diagnostic operation in a second storage mode on the physical block to obtain a second diagnostic result; If the second diagnostic result is a normal result, determining that the storage mode of the physical block is the second storage mode, and recording the address of the physical block into the second list; If the second diagnostic result is an abnormal result, marking the physical block as a bad block; After recording the address of any physical block into the first list, or recording the address of any physical block into the second list, or marking any physical block as a bad block, a diagnostic operation is performed on the next physical block until the diagnostic operation is completed on all physical blocks.
10. A storage control chip, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the flash memory management method according to any one of claims 1 to 9.
11. A flash memory device, characterized in that: include: The storage control chip as claimed in claim 10; At least one flash memory medium is communicatively connected to the storage control chip.
Citation Information
Cited By
Physical block management method and related equipment
CN121478199A
A physical block management method and related device
CN121478199B