Embodiments of the present disclosure relate to the technical field of data storing, and more specifically, to a data storage method, an apparatus, a storage device, and a computer-readable storage medium.
A Nand Flash, serving as a non-volatile storage medium, has a low cost, a high speed, and low power consumption, and therefore, the Nand Flash brings better experience to users. In the art, the Nand Flash is widely used in various storage devices. However, as time passes by, low reliability of the Nand Flash is more prominent. Due to a structure of the Nand Flash, data stored in the Nand Flash may be bit flipped. When the number of bit flip exceeds an error correction capability of Error Checking and Correction (ECC), another error correction algorithm is required. A Solid State Disk is usually composed of a plurality of logical units (LUN), any error in data of one logical unit may affect integrity of the data, such that a probability of data errors is increased. For error correction algorithms in the art, similar to disk redundant arrays, a user-available over provisioning (OP) space is reduced, write amplification (WA) becomes larger, and performance may be reduced.
The present disclosure provides a data storage method, an apparatus, a storage device, and a computer-readable storage medium, so as to reduce a loss in the user-available OP space.
In a first aspect, the present disclosure provides a data storage method, including: binding storage blocks, which are corresponding to each plane of each of a plurality of logical units in a storage device, to each other to form a superblock; performing, using a corresponding disk redundancy array protection mechanism, data storage operations based on a type of the superblock and a data type of to-be-written data.
In some embodiments, the superblock is at least one of: a first class private data SLC block, a second class private data SLC block, a user data SLC block, and a user data XLC block.
In some embodiments, the superblock is a first class private data SLC block; and the performing, using the corresponding disk redundancy array protection mechanism, data storage operations based on the type of the superblock and the data type of to-be-written data, includes: writing the to-be-written data into both a first logical unit of the superblock and a second logical unit of the superblock when receiving a request of writing the to-be-written data, wherein the second logical unit is mirrored with the first logical unit; restoring, when an error occurring in the data in the first logical unit, the data by mirroring the data in the second logical unit.
In some embodiments, the superblock is a second class private data SLC block; and the performing, using the corresponding disk redundancy array protection mechanism, data storage operations based on the type of the superblock and the data type of to-be-written data, includes: writing the to-be-written data sequentially into the plurality of logical units of the superblock when receiving a request of writing the to-be-written data; performing an exclusive-OR (XOR) operation on the to-be-written data to obtain parity data; writing the parity data into a last plane of a last logical unit of the plurality of logical units; restoring, when an error occurring in the data in any plane of any one of the plurality of logical units, the data by performing the XOR operation on the data in the plurality of logical units.
In some embodiments, the superblock is a user data SLC block or a user data XLC block; and the performing, using the corresponding disk redundancy array protection mechanism, data storage operations based on the type of the superblock and the data type of to-be-written data, includes: dividing the superblock into a plurality of disk redundancy array groups, wherein the number of the plurality of disk redundancy array groups is determined based on the number of pages contained in the predetermined number of WordLines in the storage block; writing the to-be-written data are written into the plurality of the disk redundant array groups when receiving a request of writing the to-be-written data; obtaining parity data corresponding to each of the plurality of disk redundant array groups; writing the parity data corresponding to each of the plurality of disk redundancy array groups into a last plane of a last logical unit in the corresponding one of the plurality of disk redundancy array groups; and restoring, when an error occurring in the data in one plane, the data by performing an XOR operation on the data that is in a same disk redundancy array group as the plane having the error.
In some embodiments, the obtaining parity data corresponding to each of the plurality of disk redundant array groups, includes: performing the XOR operation on the data of each of the plurality of disk redundancy array groups to obtain the parity data corresponding to each of the plurality of disk redundancy array groups; or obtaining, through a buffer swapping mechanism, the parity data corresponding to each of the plurality of disk redundancy array groups.
In some embodiments, the obtaining, through the buffer swapping mechanism, the parity data corresponding to each of the plurality of disk redundancy array groups, includes: parsing the request of writing the to-be-written data to determine one disk redundant array group of the plurality of disk redundant array groups corresponding to the to-be-written data; searching whether parity data of the disk redundant array group corresponding to the to-be-written data exists in a disk redundant array memory; performing, when the parity data existing, the XOR operation on the data of each of the plurality of disk redundant array groups to obtain the parity data corresponding to each of the plurality of disk redundant array groups; and writing, when the parity data not existing, parity data of the other disk redundancy array groups into a swap block; and reading the parity data of the disk redundancy array group corresponding to the to-be-written data from the swap block.
In a second aspect, the present disclosure provides a data storage apparatus, including: a dividing module, configured to bind storage blocks, which are corresponding to each plane of each of a plurality of logical units in a storage device, to each other to form a superblock; and a processing module, configured to perform, using a corresponding disk redundancy array protection mechanism, data storage operations based on a type of the superblock and a data type of to-be-written data.
In a third aspect, the present disclosure provides a storage device, including a processor and a memory connected to the processor. The memory is configured to store program instructions, the processor is configured to execute the program instructions to implement the data storage method of the first aspect.
In a fourth aspect, the present disclosure provides a computer-readable storage medium, storing program instructions. The program instructions, when being executed by a processor, are configured to implement the data storage method of the first aspect.
According to the present disclosure, storage blocks corresponding to each plane of the plurality of logical units in the storage device are bound to each other to form a superblock. Data are stored using a corresponding disk redundant array protection mechanism, based on a type of the superblock and a data type of the to-be-written data. By binding the storage blocks corresponding to each plane of the plurality of logical units in the storage device as one superblock and setting the corresponding disk redundant array protection mechanism based on an application scenario of the superblock, an overall protection capability is improved, and a loss in the user-available OP is reduced.
In order to more clearly illustrate technical solutions in embodiments of the present disclosure, accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description show only some of the embodiments of the present disclosure, and any ordinary skilled person in the art may obtain other accompanying drawings based on these drawings without creative work.
Technical solutions of embodiments of the present disclosure will be described in detail in the following by referring to the accompanying drawings of the specification.
In the following description, specific details such as particular system structures, interfaces, techniques, and the like are presented for illustrative purposes rather than for limitation, such that the present disclosure can be understood thoroughly.
Terms “system” and “network” are often used interchangeably herein. The term “and/or”, as used herein, is merely a description of an association relationship of associated objects, indicating that three types of relationships may exist. For example, A and/or B means that A is present alone, both A and B are present, and B is present alone. In addition, the character “/” indicates that the objects before the character “or” the object after the character. In addition, “a plurality of” means two or more than two.
As shown in
In a block S11, storage blocks corresponding to each plane of each of a plurality of logical units (LUN) in a storage device are bound to each other to form a superblock.
The data storage method of the present disclosure can be applied to a solid state drive or another storage device using a Nand Flash as a storage medium. As shown in
In a block S12, a data storage operation is performed using a corresponding disk redundant array protection mechanism, based on a type of the superblock and a data type of to-be-written data.
In an embodiment, the superblock may be at least one of: a first class private data SLC block, a second class private data SLC block, a user data SLC block, and a user data XLC block. Specifically, the first class private data SLC block is a most important Table storage area with a small amount of data. The second class private data SLC block is an important Table and debugging information storage area with a small amount of data. The user data SLC block is a data cache area into which data can be written at a fast writing speed. The user data XLC block is a data storage area.
In the above embodiment, the storage blocks corresponding to each plane of each of the plurality of logical units in the storage device are bound to each other to form one superblock, and the data storage operation can be performed using the corresponding disk redundant array protection mechanism based on the type of the superblock and the data type of the to-be-written data. By binding the storage blocks corresponding to each plane of each of the plurality of logical units in the storage device as one superblock and setting the corresponding disk redundant array protection mechanism according to application scenarios of the superblock, an overall protection capability is improved, and a loss in a user-available OP is reduced.
As shown in
In an embodiment, the superblock is the first class private data SLC block; the block S12 specifically includes following blocks.
In a block S1201, when receiving a request of writing the to-be-written data, the to-be-written data is written into both a first logical unit of the superblock and a second logical unit of the superblock, and the second logical unit is mirrored with the first logical unit.
In a block S1202, when an error occurs in the data in the first logical unit, the data is restored by mirroring the data in the second logical unit.
As shown in
As shown in
In a block S1211, when receiving the request of writing the to-be-written data, the to-be-written data are sequentially written into a plurality of logical units of the superblock; an exclusive-OR (XOR) operation is performed on the to-be-written data to obtain the parity data.
In a block S1212, the parity data are written into a last plane of a last logical unit of the plurality of logical units.
In a block S1213, when an error occurs in the data in any one of the plurality of planes of any one of the plurality of logical units, the data is restored by performing an XOR operation on the data in the plurality of logical units.
As shown in
As shown in
In a block S1221, the superblock is divided into a plurality of disk redundancy array groups, the number of plurality of disk redundancy array groups corresponds to the number of pages contained in the predetermined number of WordLines in the storage block.
The specific number of disk redundancy array groups formed by dividing depends on characteristics of the Nand Flash. For example, the dividing can be performed based on the number of pages contained in one word line, the number of pages contained in two WordLines, the number of pages contained in three WordLines, and so on.
In a block S1222, when receiving the request of writing the to-be-written data, the to-be-written data are written into the plurality of the disk redundant array groups.
In a block S1223, the parity data corresponding to each of the plurality of disk redundant array groups is obtained.
In a block S1224, the parity data corresponding to each of the plurality of disk redundancy array groups is written into a last plane of a last logical unit in the corresponding one of the plurality of disk redundancy array groups.
In a block S1225, when an error occurs in the data in one plane, the data are restored by performing the XOR operation on the data that is in the same disk redundancy array group as the plane having the error.
As shown in
As shown in
In the present embodiment, various RAID protection strengths are designed according to different application scenarios of the superblock, the overall protection capability is improved, and the loss in the user-available OP is reduced. When the plurality of RAID groups operate at the same time, the influence on the writing speed is reduced. In addition, the RAID size can be determined according to the requirements for user-available OP, such that write amplification is reduced. After (127+1), (255+1), or the entire superblock is finished written, the parity data is written. The size of the RAID group and the size of the RAID can be configured flexibly to adapt to different applications.
In an embodiment, the above block S1223 may specifically include: performing the XOR operation on the data of each disk redundancy array group to obtain the parity data corresponding to each disk redundancy array group; or, obtaining, through a buffer swapping mechanism, the parity data corresponding to each disk redundancy array group.
Generally speaking, after writing the to-be-written data, the corresponding parity data can be obtained by performing the XOR operation on the to-be-written data. However, when operations are performed for the plurality of RAID groups at the same time, a RAID buffer may have insufficient resources. In this case, a buffer swap needs to be performed, the corresponding parity data can be obtained through the buffer swapping mechanism.
Specifically, as shown in
swapping mechanism, parity data corresponding to each disk redundant array set, in the data storage method according to an embodiment of the present disclosure. The step of obtaining the parity data corresponding to each of the plurality of disk redundancy array groups through the buffer swapping mechanism includes following blocks.
In a block S101, the request for writing the to-be-written data is parsed to determine the disk redundant array group corresponding to the to-be-written data.
In a block S102, it is searched whether the parity data of the disk redundant array group corresponding to the to-be-written data exists in a disk redundant array memory. When the parity data exists, a block S103 is performed, and when the parity data does not exist, a block S104 is performed.
In the block S103, the XOR operation is performed on the data of each disk redundant array group to obtain the parity data corresponding to each disk redundant array group.
In the block S104, the parity data of the other disk redundancy array groups are written into a swap block, the parity data of the disk redundancy array group corresponding to the to-be-written data are read from the swap block.
Further, after the block S103 and the block S104, the above block S1224 is performed.
Specifically, after receiving the request writing the to-be-written data, the request is parsed to analyze to which RAID group the instant to-be-written data belongs. Subsequently, it is searched whether the parity data of the RAID group to which the to-be-written data belongs is saved in a RAID buffer. Understandably, when the parity data of the RAID group to which the to-be-written data belongs exists in the RAID buffer, buffer swapping is not required. When the parity data of the RAID group to which the to-be-written data belongs does not exist in the RAID buffer, the parity data of the other RAID groups are written into the swap block, and subsequently, the parity data of the RAID group to which the to-be-written data belongs is read from the swap block. In this way, the corresponding parity data can be written into the page corresponding to the superblock, such that writing of the to-be-written data is completed. By designing a buffer swap process, the RAID protection method in the present disclosure is adapted to any master control platform having more or fewer RAID buffer resources.
As shown in
apparatus according to an embodiment of the present disclosure. The data storage apparatus 110 in the present embodiment includes a dividing module 1100 and a processing module 1102 connected to the dividing module 1100. The dividing module 1100 is configured to bind the storage blocks corresponding to each plane of each logical unit in the storage device to each other to form the superblock. The processing module 1102 is configured to use, based on the type of the superblock and the data type of the to-be-written data, the corresponding disk redundancy array protection mechanism to perform data storage operations.
In an embodiment, the superblock is at least one of: the first class private data SLC block, the second class private data SLC block, the user data SLC block, and the user data XLC block.
In an embodiment, the superblock is the first class private data SLC block; the processing module 1102 using, based on the type of the superblock and the data type of the to-be-written data, the corresponding disk redundancy array protection mechanism to perform data storage operations, includes the following. When receiving the request of writing the to-be-written data, the to-be-written data is written into both the first logical unit of the superblock and the second logical unit of the superblock, and the second logical unit is mirrored with the first logical unit. When an error occurs in the data in the first logical unit, the data is restored by mirroring the data in the second logical unit.
In an embodiment, the superblock is the user data SLC block or the user data XLC block, and the processing module 1102 using the corresponding disk redundant array protection mechanism to perform the data storage operation, based on the type of the superblock and the data type of to-be-written data, includes the following. The superblock is divided into a plurality of disk redundancy array groups, the number of the plurality of disk redundancy array groups corresponds to the number of pages contained in the predetermined number of WordLines in the storage block. When receiving the request of writing the to-be-written data, the to-be-written data are written into the plurality of the disk redundant array groups. The parity data corresponding to each of the plurality of disk redundant array groups is obtained. The parity data corresponding to each of the plurality of disk redundancy array groups is written into the last plane of the last logical unit in the corresponding one of the plurality of disk redundancy array groups. When the error occurs in the data in one plane, the data are restored by performing the XOR operation on the data that is in the same disk redundancy array group as the plane having the error.
In an embodiment, the processing module 1102 obtaining the parity data corresponding to each of the plurality of disk redundant array groups includes the following. The XOR operation is performed on the data of each disk redundancy array group to obtain the parity data corresponding to each disk redundancy array group; or, obtaining, through the buffer swapping mechanism, the parity data corresponding to each disk redundancy array group.
In an embodiment, the processing module 1102 obtaining, through the buffer swapping mechanism, the parity data corresponding to each disk redundancy array group includes the following. The request for writing the to-be-written data is parsed to determine the disk redundant array group corresponding to the to-be-written data. It is searched whether the parity data of the disk redundant array group corresponding to the to-be-written data exists in the disk redundant array memory. When the parity data exists, the XOR operation is performed on the data of each disk redundant array group to obtain the parity data corresponding to each disk redundant array group. When the parity data does not exist, the parity data of the other disk redundancy array groups are written into the swap block, the parity data of the disk redundancy array group corresponding to the to-be-written data are read from the swap block.
Details of the data storage apparatus 110 of the present disclosure implementing the data storage method may be referred to the data storage method in the above embodiments, which will not be repeated herein.
As shown in
Specifically, the processor 1202 is configured to control the processor 1202 itself and the memory 1201 to implement the steps of the data storage method in the above embodiments.
The processor 1202 may also be referred to as a central processing unit (CPU). The processor 1202 may be an integrated circuit chip having signal processing capabilities. The processor 1202 may alternatively be a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, a discrete gate or transistor logic device, or a discrete hardware component. The general purpose processor may be a microprocessor or any conventional processor. In addition, the processor 1202 may be configured as an integrated circuit chip.
As shown in
The computer-readable storage medium 130 may specifically be a medium that can store the program instructions 1300, such as a USB flash drive, a removable hard drive, a read-only memory (ROM), a random-access memory (RAM), a magnetic disc, or an optical disc. Alternatively, the computer-readable storage medium 130 may be a server that stores the program instructions 1300. The server may send the stored program instructions 1300 to other devices to run or may run the stored program instructions 1300 itself.
In various embodiments provided in the present disclosure, it is understood that the methods, the apparatus and the device may be implemented in other ways. For example, the apparatus and the device described in the above are merely schematic, for example, modules or units are divided merely based on logical functions, and in practice, modules or units may be divided in other ways. For example, a plurality of units or components may be combined with each other or integrated into another system; or some features may be omitted or not implemented. Furthermore, mutual coupling or direct coupling or communicative connection shown or discussed may be indirect coupling or communicative connection through some interfaces, devices or units, and the connection may be electrical or mechanical.
Units illustrated as separated units may or may not be physically separated from each other. Components shown as units may or may not be physical units, i.e., the components may be located at one place or may also be distributed over a plurality of network units. Some or all of the units may be selected to fulfil the purpose of the present embodiment according to the actual need. In addition, functional units in various embodiments of the present disclosure may be integrated in a single processing unit or may be physically present separate from each other; or two or more units may be integrated in one single unit. The above integrated units may be implemented either in the form of hardware or in the form of software functional units.
The integrated unit may be stored in a computer-readable storage medium when implemented the software functional unit and sold or used as a stand-alone product. Based on the above understanding, the technical solution of the present disclosure in essence, or a part of the technical solution contributed to the prior art, or a part or an entirety of the technical solution may be configured in the form of the software product. The software product is stored in a storage medium including instructions to cause a computer device (which may be a personal computer, a server, or a network device, and so on) or a processor to perform all or part of the methods of the various embodiments of the present disclosure. The aforementioned storage media include: the USB flash drive, the portable hard drive, the read-only memory (ROM), the random access memory (RAM), the magnetic disk, or the optical disk, and other media that can store program codes.
Number | Date | Country | Kind |
---|---|---|---|
202210943076.2 | Aug 2022 | CN | national |
The present application is a continuation application of the international patent application No. PCT/CN2022/115837, filed on Aug. 30, 2022, which claims the priority of the Chinese patent application No. 202210943076.2, filed on Aug. 5, 2022, and contents of which are incorporated herein by its entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2022/115837 | Aug 2022 | WO |
Child | 19029393 | US |