Parity generation method and device based on block raid and computer device
By allocating TLC Super Blocks and SLC Parity Blocks in Block RAID, data and temporary parity are written to each stripe one by one, solving the problem of needing to allocate multiple sets of blocks when writing Block RAID, and achieving the effect of improving product yield.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU UNIONMEMORY INFORMATION SYST LTD
- Filing Date
- 2023-04-27
- Publication Date
- 2026-07-31
AI Technical Summary
Existing Block RAID requires the allocation of multiple blocks simultaneously when writing data, resulting in a large number of blocks reserved for SSDs, which affects product yield.
During the write process, a TLC Super Block is allocated for user data, and an SLC Parity Block is allocated for storing temporary Parity. User data and temporary Parity are written one stripe at a time. The next SLC Parity Block is allocated only after the current SLC Parity Block is full. The next TLC Super Block is allocated only after the current TLC Super Block is full. Finally, when writing the last group of blocks, the final Parity is written to the TLC Super Block.
While maintaining the data protection capabilities of Block RAID, the number of blocks that the SSD needs to retain is reduced, thus improving product yield.
Smart Images

Figure CN116382591B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of solid-state drive technology, and in particular to a method, apparatus, computer device, and storage medium for generating parity based on Block RAID. Background Technology
[0002] SSD (Solid State Drive), as a new type of storage medium, uses NAND flash memory chips for data storage and has been widely used in various fields such as PCs, laptops, and servers, gradually replacing HDD (Hard Disk Drive) as the mainstream application product in the storage field.
[0003] To enhance user data protection, SSDs typically employ RAID (Redundant Array of Independent Disks) internally. Two common RAID implementations are Block RAID and WordLine RAID. Block RAID allows data recovery from other blocks in the event of a complete block failure. However, this method usually requires allocating multiple blocks simultaneously during data writing, resulting in a larger reserve of blocks for the SSD to function properly, thus reducing the allowable number of bad blocks at the factory and impacting product yield. WordLine RAID, on the other hand, allocates only one block at a time. However, because a single block contains multiple pages within a stripe, data cannot be recovered from a block-level failure. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, apparatus, computer device, and storage medium for generating Parity based on BlockRAID to address the aforementioned technical problems.
[0005] A method for generating Parity based on Block RAID, the method comprising:
[0006] During the write process, a TLC Super Block is allocated for writing user data, and an SLC Parity Block is allocated for storing temporary Parity;
[0007] Write user data and temporary Parity strip by strip;
[0008] For newly allocated TLC Super Blocks, the corresponding temporary Parity is read from the SLC ParityBlock before writing data to each stripe;
[0009] Write the data back into the strips one by one, and write the final Parity into the last TLCSuperBlock while writing the last block.
[0010] In one embodiment, after the step of re-writing data strip by strip and writing the final Parity to the last plane of the last group of TLCSuperBlocks, the method further includes:
[0011] Recycle SLCParityBlock.
[0012] In one embodiment, the step of writing user data and temporary Parity strip by strip further includes:
[0013] Once the current SLCParityBlock is full, the next SLCParityBlock will be allocated.
[0014] Once the current TLCSuperBlock is full, the next TLCSuperBlock will be allocated.
[0015] In one embodiment, the method further includes:
[0016] If user data reading fails, check if the final parity of the stripe has been generated; if not, check if the temporary parity has been generated.
[0017] If a temporary parity exists, the data of the page that failed to be read is recovered by reading the temporary parity corresponding to the stripe and the data of other pages.
[0018] A Parity generation apparatus based on BlockRAID, the apparatus comprising:
[0019] The first allocation module is used to allocate a TLCSuper Block for writing user data during the writing process, and allocate an SLCParityBlock for storing temporary Parity.
[0020] The first writing module is used to write user data and temporary Parity strip by strip;
[0021] The data reading module is used to read the corresponding temporary Parity from the SLCParityBlock before writing data to each stripe of the newly allocated TLCSuperBlock.
[0022] The second writing module is used to rewrite data strip by strip in sequence, and write the final Parity to the last TLCSuperBlock while writing the last group of Blocks.
[0023] In one embodiment, the apparatus further includes a recycling module, the recycling module being used for:
[0024] Recycle SLCParityBlock.
[0025] In one embodiment, the apparatus further includes a second allocation module, the second allocation module being used for:
[0026] Once the current SLCParityBlock is full, the next SLCParityBlock will be allocated.
[0027] Once the current TLCSuperBlock is full, the next TLCSuperBlock will be allocated.
[0028] In one embodiment, the apparatus further includes a data recovery module, the data recovery module being used for:
[0029] If user data reading fails, check if the final parity of the stripe has been generated; if not, check if the temporary parity has been generated.
[0030] If a temporary parity exists, the data of the page that failed to be read is recovered by reading the temporary parity corresponding to the stripe and the data of other pages.
[0031] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the methods described above.
[0032] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above methods.
[0033] The aforementioned method, apparatus, computer equipment, and storage medium for generating parity based on BlockRAID allocate only one group of blocks at a time when writing data, and temporarily store the parity generated by the current group of blocks in SLC Block. Before writing the next group of blocks, the parity temporarily stored in SLC is read, and parity generation continues; when writing the last group of blocks, the finally generated parity is written simultaneously. In this way, the strong data protection capability of Block RAID can be maintained while reducing the number of reserved blocks, thereby improving product yield. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of the traditional BlockRAIDParity generation method;
[0035] Figure 2 This is a flowchart illustrating a BlockRAID-based Parity generation method in one embodiment;
[0036] Figure 3 This is a flowchart illustrating the Parity generation method based on BlockRAID in another embodiment;
[0037] Figure 4 This is a schematic diagram of Parity data writing based on BlockRAID in one embodiment;
[0038] Figure 5 This is a schematic diagram of Parity data recovery based on BlockRAID in one embodiment;
[0039] Figure 6 This is a structural block diagram of a Parity generation device based on BlockRAID in one embodiment;
[0040] Figure 7 This is a structural block diagram of a Parity generation device based on BlockRAID in another embodiment;
[0041] Figure 8 This is a structural block diagram of a Parity generation device based on BlockRAID in another embodiment;
[0042] Figure 9 This is a structural block diagram of a Parity generation device based on BlockRAID in another embodiment;
[0043] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0045] like Figure 1The diagram illustrates the traditional BlockRAIDParity generation method. For an SSD with 8 planes and a RAID configuration of 15+1, two superblocks are allocated at a time during data writing. Pages with the same number in the two superblocks form a RAID stripe, and the Parity is located on the last plane of the last superblock. The writing process, as shown in the diagram, sequentially completes the writing of stripes 0, 1, ... of the two superblocks.
[0046] Obviously, the above method of generating parity requires that the current stripe can only be written after the next stripe is written. This results in the need to allocate multiple sets of blocks at once when allocating blocks, so the SSD will need to reserve more blocks, which will reduce the number of bad blocks allowed at the factory and is detrimental to the mass production yield.
[0047] Based on this, the present invention proposes a Parity generation method based on BlockRAID, which aims to maintain the data protection capability of BlockRAID while reducing the number of blocks that SSDs need to retain, so as to tolerate more bad blocks at the factory and improve mass production yield.
[0048] To more clearly illustrate the content of this plan, the Chinese names and explanations of the English or abbreviations appearing in this document are as follows:
[0049]
[0050]
[0051] In one embodiment, such as Figure 2 As shown, a method for generating Parity based on Block RAID is provided, which includes:
[0052] Step 202: During the writing process, allocate a TLC Super Block for writing user data and allocate an SLC Parity Block for storing temporary Parity.
[0053] Step 204: Write user data and temporary Parity to each stripe;
[0054] Step 206: For a newly allocated TLC Super Block, read the corresponding temporary Parity from the SLCParity Block before writing data to each stripe;
[0055] Step 208: Write the data back to each stripe one by one, and write the final Parity to the last TLC Super Block while writing the last group of Blocks.
[0056] In this embodiment, a Parity generation method based on Block RAID is provided. When writing data, this method only needs to allocate a group of Blocks at a time and temporarily store the Parity generated by the current group of Blocks in the SLC Block.
[0057] For specific details, please refer to Figure 4 The diagram shown illustrates Parity data writing based on Block RAID. First, during the writing process, a TLC Super Block is allocated for writing user data, and an SLC Block is allocated for temporary Parity storage.
[0058] Then, the user data and temporary Parity are written one strip at a time.
[0059] In one embodiment, after the step of writing user data and temporary parity to each stripe, the method further includes: allocating the next SLC parity block after the current SLC parity block is full; and allocating the next TLC super block after the current TLC super block is full.
[0060] In one embodiment, after the step of rewriting data sequentially strip by strip and writing the final Parity to the last plane of the last group of TLC Super Blocks, the method further includes: recycling the SLC Parity Block.
[0061] For each newly allocated TLC Super Block, before writing each stripe, the corresponding temporary Parity is read from the SLC Parity Block, and data is rewritten stripe by stripe (stripes 0-98) sequentially. The final Parity is then written to the last plane of the last group of TLC Super Blocks. Finally, the SLC Parity Block is reclaimed.
[0062] In the above embodiment, when writing data, only one group of blocks needs to be allocated at a time, and the parity generated by the current group of blocks is temporarily stored in SLCBlock. Before writing the next group of blocks, the parity temporarily stored in SLC is read, and parity continues to be generated; when writing the last group of blocks, the finally generated parity is written simultaneously. In this way, the strong data protection capability of BlockRAID can be maintained, while reducing the number of reserved blocks, thereby improving product yield.
[0063] In one embodiment, the method further includes: if a user data reading failure is detected, checking whether the final parity of the stripe has been generated; if not, checking whether a temporary parity has been generated; if a temporary parity exists, recovering the data of the page that failed to read by reading the temporary parity corresponding to the stripe and the data of other pages.
[0064] In one embodiment, such as Figure 3 As shown, a method for generating Parity based on BlockRAID is provided, which includes:
[0065] Step 302: During the writing process, allocate a TLCSuperBlock for writing user data and allocate an SLCParityBlock for storing temporary Parity.
[0066] Step 304: Write user data and temporary Parity to each stripe;
[0067] Step 306: After the current SLCParityBlock is full, allocate the next SLCParityBlock. After the current TLCSuperBlock is full, allocate the next TLCSuperBlock.
[0068] Step 308: For the newly allocated TLCSuperBlock, read the corresponding temporary Parity from SLCParityBlock before writing data to each stripe;
[0069] Step 310: Write the data back into the strips one by one, and write the final Parity into the last plane of the last TLCSuperBlock while writing the last group of Blocks.
[0070] Step 312, reclaim SLCParityBlock;
[0071] Step 314: If user data reading fails, check if the final parity of the stripe has been generated. If not, check if the temporary parity has been generated. If the temporary parity exists, recover the data of the page that failed to read by reading the temporary parity corresponding to the stripe and the data of other pages.
[0072] For specific details, please refer to Figure 4 The diagram shown illustrates Parity data writing based on BlockRAID. Figure 5 The diagram shown illustrates Parity data recovery based on BlockRAID, where the process of generating RAIDParity is as follows:
[0073] Figure 4 The following example illustrates a TLCSSD with 8 planes and a RAID configuration of 15+1 (assuming each TLCBlock has 99 pages). The numbers in the pages indicate the logical order in which data is written.
[0074] 4.1) The write process first allocates a TLCSuperBlock for writing user data and an SLCBlock for temporary Parity storage.
[0075] 4.2) Write user data and temporary Parity strip by strip.
[0076] 4.3) Once the current SLCParityBlock is full, allocate the next SLCParityBlock.
[0077] 4.4) Once the current TLCSuperBlock is full, allocate the next TLCSuperBlock.
[0078] 4.5) For a newly allocated TLCSuperBlock, before writing each stripe, first read the corresponding temporary Parity from SLCParityBlock, rewrite the data stripe by stripe (stripe 0 to 98) in sequence, and write the final Parity to the last plane of the last group of TLCSuperBlocks.
[0079] 4.6) Recycle SLCParityBlock.
[0080] During the data recovery process for the final Parity-ungenerated scenario:
[0081] Because the generation of the final parity for a stripe is delayed, this embodiment uses SLCBlock to store a temporary parity, ensuring that even if the final parity for the stripe is not generated, the user's lost data can still be recovered based on the temporary parity. The process is as follows: Figure 5 As shown: When a user data reading failure is detected, check whether the final parity of the stripe has been generated. If not, check whether the temporary parity has been generated. If it exists, recover the data of the page that failed to read by reading the temporary parity corresponding to the stripe and the data of other pages.
[0082] In this embodiment, when SSD data is corrupted, if the final parity has not yet been generated but a temporary parity exists, the data can be recovered based on the temporary parity, reducing the number of blocks that the SSD needs to retain and improving the mass production yield.
[0083] It should be understood that, although Figure 1-5The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1-5 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0084] In one embodiment, such as Figure 6 As shown, a BlockRAID-based Parity generation device 600 is provided, which includes:
[0085] The first allocation module 601 is used to allocate a TLCSuperBlock for writing user data during the writing process, and allocate an SLCParityBlock for storing temporary Parity.
[0086] The first writing module 602 is used to write user data and temporary Parity strip by strip;
[0087] Data reading module 603, the data reading module is used to read the corresponding temporary Parity from SLCParityBlock before writing data for each stripe of the newly allocated TLCSuperBlock;
[0088] The second writing module 604 is used to rewrite data strip by strip in sequence, and write the final Parity to the last TLCSuperBlock while writing the last group of Blocks.
[0089] In one embodiment, such as Figure 7 As shown, a BlockRAID-based Parity generation device 600 is provided, which further includes a recycling module 605, the recycling module being used for:
[0090] Recycle SLCParityBlock.
[0091] In one embodiment, such as Figure 8 As shown, a BlockRAID-based Parity generation device 600 is provided. This device further includes a second allocation module 606, which is used for:
[0092] Once the current SLCParityBlock is full, the next SLCParityBlock will be allocated.
[0093] Once the current TLCSuperBlock is full, the next TLCSuperBlock will be allocated.
[0094] In one embodiment, such as Figure 9 As shown, a Parity generation device 600 based on BlockRAID is provided. This device also includes a data recovery module 607, which is used for:
[0095] If user data reading fails, check if the final parity of the stripe has been generated; if not, check if the temporary parity has been generated.
[0096] If a temporary parity exists, the data of the page that failed to be read is recovered by reading the temporary parity corresponding to the stripe and the data of other pages.
[0097] For specific limitations on the BlockRAID-based Parity generation device, please refer to the limitations on the BlockRAID-based Parity generation method mentioned above, which will not be repeated here.
[0098] In one embodiment, a computer device is provided, the internal structure of which can be shown as follows: Figure 10 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a BlockRAID-based Parity generation method.
[0099] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0100] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the various method embodiments described above.
[0101] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the various method embodiments described above.
[0102] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0103] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0104] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for generating Parity based on Block RAID, the method comprising: During the write process, a TLC Super Block is allocated for writing user data, and an SLC Parity Block is allocated for storing temporary Parity; Write user data and temporary Parity strip by strip; Once the current SLC Parity Block is full, the next SLC Parity Block will be allocated. Once the current TLC Super Block is full, the next TLC Super Block will be allocated. For a newly allocated TLC Super Block, before writing data to each stripe, the corresponding temporary Parity is read from the SLC Parity Block, and then Parity is generated. Write the data back to each strip sequentially, and write the final Parity to the last TLC Super Block at the same time as writing the last TLC Super Block.
2. The Parity generation method based on Block RAID according to claim 1, characterized in that, After the step of rewriting data strip by strip sequentially, and writing the final Parity to the last TLC Super Block at the same time as writing the last TLC Super Block, the following is also included: Recycle SLC Parity Block.
3. The Parity generation method based on Block RAID according to any one of claims 1-2, characterized in that, The method further includes: If user data reading fails, check if the final parity of the stripe has been generated; if not, check if the temporary parity has been generated. If a temporary parity exists, the data of the page that failed to be read is recovered by reading the temporary parity corresponding to the stripe and the data of other pages.
4. A Parity generation device based on Block RAID, characterized in that, The device includes: The first allocation module is used to allocate a TLC Super Block for writing user data during the writing process, and allocate an SLC Parity Block for storing temporary Parity. The first writing module is used to write user data and temporary Parity strip by strip; The second allocation module is used for: Once the current SLC Parity Block is full, the next SLC Parity Block will be allocated. Once the current TLC Super Block is full, the next TLC Super Block will be allocated. The data reading module is used to read the corresponding temporary parity from the SLC parity block before writing data to each stripe of the newly allocated TLC Super Block, and then continue to generate parity. The second write module is used to rewrite data strip by strip in sequence, and write the final Parity to the last TLC Super Block at the same time as writing the last TLC Super Block.
5. The Parity generation device based on Block RAID according to claim 4, characterized in that, The device further includes a recycling module, the recycling module being used for: Recycle SLC Parity Block.
6. The Parity generation apparatus based on Block RAID according to any one of claims 4-5, characterized in that, The device further includes a data recovery module, the data recovery module being used for: If user data reading fails, check if the final parity of the stripe has been generated; if not, check if the temporary parity has been generated. If a temporary parity exists, the data of the page that failed to be read is recovered by reading the temporary parity corresponding to the stripe and the data of other pages.
7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 3.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.