Data protection method and device
By dividing molecular banding in RAID6 and storing verification data, the problem of excessive verification data occupancy in RAID6 is solved, and sufficient data protection and storage space are achieved.
Patent Information
- Application Number
- CN202510152256.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-11
- Publication Date
- 2025-06-13
AI Technical Summary
When using RAID6 for data protection, how to make the verification data account for as little as possible in the storage resources, while still allowing the data to be fully protected has become a problem that needs to be solved.
By dividing molecular bands in the page band and storing two verification data calculated according to RAID6 in each subband, it is possible to correct data errors of no more than 2 planes using these data. Specifically, the sub-band includes physical pages from the same numbered planes in N LUNs, and the two verification data are stored on different planes in the same LUN, or on the same numbered planes in different LUNs.
It realizes that when the data occupies as little storage resources as possible, the data can still be fully protected, saving storage space, and reducing the use of spare storage space in the storage device, thereby improving the random write performance.
Smart Images

Figure CN120144352A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the storage field, and particularly to a data protection method and apparatus. Background Art
[0002] Figure 1 The block diagram of a solid-state storage device is shown. The solid-state storage device 102 is coupled to a host for providing storage capabilities to the host. The host and the solid-state storage device 102 can be coupled in various ways, including but not limited to coupling through, for example, SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIE (Peripheral Component Interconnect Express), NVMe (NVM Express), Ethernet, Fibre Channel, a wireless communication network, etc. to connect the host and the solid-state storage device 102. The host can be an information processing device capable of communicating with the storage device through the above-mentioned ways. For example, a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 102 includes an interface 103, a control component 104, one or more NVM chips 105, and DRAM (Dynamic Random Access Memory) 110.
[0003] NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), etc. are common NVMs.
[0004] The interface 103 can be adapted to exchange data with the host through, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fibre Channel, etc.
[0005] The control component 104 is used to control data transmission among the interface 103, the NVM chip 105, and the DRAM 110, and is also used for storage management, mapping of host logical addresses to flash physical addresses, wear leveling, bad block management, etc. The control component 104 can be implemented in various ways such as software, hardware, firmware, or a combination thereof. For example, the control component 104 can be in the form of an FPGA (Field Programmable Gate Array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control component 104 can also include a processor or a controller, and software is executed in the processor or controller to manipulate the hardware of the control component 104 to process IO (Input / Output) commands. The control component 104 can also be coupled to the DRAM 110 and can access the data in the DRAM 110. The FTL table and / or the data of the cached IO commands can be stored in the DRAM.
[0006] The control component 104 includes a flash interface controller (or referred to as a media interface controller, a flash channel controller). The flash interface controller is coupled to the NVM chip 105 and issues commands to the NVM chip 105 in a manner that conforms to the interface protocol of the NVM chip 105 to operate the NVM chip 105 and receives the command execution results output from the NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI", etc.
[0007] In a solid-state storage device, an FTL (Flash Translation Layer) is used to maintain the mapping information from logical addresses to physical addresses. The logical addresses constitute the storage space of the solid-state storage device perceived by upper-layer software such as the operating system. The physical address is the address used to access the physical storage units of the solid-state storage device. In related technologies, address mapping can also be implemented using an intermediate address form. For example, a logical address is mapped to an intermediate address, and then the intermediate address is further mapped to a physical address.
[0008] The table structure storing the mapping information from logical addresses to physical addresses is called the FTL table. The FTL table is important metadata in a solid-state storage device. Usually, the data items of the FTL table record the address mapping relationship in the solid-state storage device in units of data pages.
[0009] A storage device is used to process IO commands. The IO commands can be sent to a storage device (such as a disk, a solid-state drive, a USB flash drive, an optical disc, etc.), a storage server, or a storage system (such as cloud storage). If the addresses accessed by multiple IO commands are consecutive or approximately consecutive, these IO commands are said to belong to the same sequential stream.
[0010] Each I / O command carries or indicates the address (logical address or physical address) of the data to be accessed. The length of the data to be accessed by each I / O command can be a fixed length or variable. When the host accesses the storage device, a data access party such as an application may split a large block of data access into multiple I / O commands and send them to the storage device. There may also be multiple applications accessing the storage device and / or multiple operating systems (such as virtual machines) in the host, which causes the I / O commands from multiple access parties to be interleaved, making the originally continuous address access become discontinuous.
[0011] Currently, in order to improve the reliability of the data stored in the storage device, a redundant array of inexpensive disks (RAID) is usually used to organize and protect the user data in the storage device. RAID specifically includes multiple levels. For example, RAID0, RAID1, RAID5, and RAID6 are all commonly used RAID levels.
[0012] Among them, when using RAID6 for data protection, how to minimize the proportion of parity data in the storage resources while fully protecting the data is a problem that needs to be solved currently. Summary of the Invention
[0013] To solve the above technical problems, the present application provides a data protection method and device.
[0014] In a first aspect, a data writing method is provided. The method includes: writing user data into a first sub-strip; the first sub-strip is part of a page strip or one of multiple sub-strips included in the page strip; the page strip includes: physical pages from N*M planes, where the N*M planes include M planes respectively included in each of the N LUNs; each of the N*M planes provides X physical pages for the page strip, and X is a positive integer; each of the sub-strips includes physical pages of P planes in the page strip; N, M, and P are positive integers greater than 1, and P is greater than N; determining two pieces of parity data corresponding to the user data; the two pieces of parity data are the parity data corresponding to the user data obtained according to RAID6; writing the two pieces of parity data into the first sub-strip so that the data stored in the first sub-strip can correct data errors of no more than 2 planes in the first sub-strip.
[0015] Through the above method of the present application, data can be relatively fully protected while minimizing the proportion of verification data in the storage resources. Specifically, in the first aspect, when P = 2N, the method provided by the present application can correct the data in the sub-stripes in the case where the planes with the same number in two LUNs fail. If the related technology is used, in the case where the planes with the same number in two LUNs fail, if RAID5 at the LUN level is used, the data cannot be corrected; if RAID6 at the LUN level is used, although the data can be corrected, the verification data needs to occupy the physical pages provided by 2 LUNs, while the method of the above embodiment of the present application requires a smaller proportion of the generated verification data volume relative to the written user data volume, saving storage space and reducing the occupation of the free storage space in the storage device, thereby improving the random write performance. In the second aspect, when P is greater than N and less than 2N, the method provided by the present application can achieve correcting at most two pieces of user data in P pieces of user data (N < P < 2N) with every two pieces of verification data. If the related technology is used, if RAID5 at the LUN level is used, only 1 piece of verification data can be used to correct 1 piece of user data in N - 2 pieces of user data, and when two pieces of user data in N - 2 pieces of user data are in error, the error cannot be corrected, while the method provided by the embodiment of the present application can correct the error; if RAID6 at the LUN level is used, although the data can be corrected, the verification data needs to occupy the physical pages provided by 2 LUNs, while the method of the above embodiment of the present application requires a smaller proportion of the generated verification data volume relative to the written user data volume, saving storage space and reducing the occupation of the free storage space in the storage device. In the third aspect, when P is greater than 2N, the method provided by the present application can achieve correcting at most two pieces of user data in P pieces of user data (P > 2N) with every two pieces of verification data. If the related technology is used, if RAID5 at the LUN level is used, it cannot correct the error when the physical pages of the planes with the same number in different LUNs fail, while the method provided by the present application can correct the error; if RAID6 at the LUN level is used, the verification data needs to occupy the physical pages provided by 2 LUNs, while the method of the above embodiment of the present application requires a smaller proportion of the generated verification data volume relative to the written user data volume, saving storage space and reducing the occupation of the free storage space in the storage device.
[0016] In some implementations, P is greater than N and less than 2N; each of the sub-stripes in the page stripe includes physical pages from P1 first planes and physical pages from P2 second planes; P = P1 + P2, the P1 first planes include P1 planes with the same numbers from the P1 LUNs, the P2 second planes include P2 planes with the same numbers from the P2 LUNs, and the numbers between the first plane and the second plane are different.
[0017] In some implementations, P = 2N; each of the sub-stripes in the page stripe includes physical pages from N first planes and physical pages from N second planes; the N first planes and the N second planes respectively include N planes with the same numbers from the N LUNs, and the numbers between the first plane and the second plane are different.
[0018] In some implementations, in the first sub-stripe, the two pieces of parity data are respectively stored in the physical pages of the third plane and the fourth plane; the third plane and the fourth plane belong to the same LUN, the number of the third plane is the same as that of the first plane, and the number of the fourth plane is the same as that of the second plane.
[0019] In some implementations, in the first sub-stripe, the two pieces of parity data are respectively stored in the physical pages of the fifth plane and the sixth plane; the fifth plane and the sixth plane are planes with the same number in different LUNs, the fifth plane and the sixth plane have the same number as the first plane, or the fifth plane and the sixth plane have the same number as the second plane.
[0020] In some implementations, in the first sub-stripe, the two pieces of parity data are respectively stored in the physical pages of the seventh plane and the eighth plane; the seventh plane and the eighth plane are planes with different numbers in different LUNs, the number of the seventh plane is the same as that of the first plane, and the number of the eighth plane is the same as that of the second plane.
[0021] Second aspect, a data reading method is provided, and the method includes: obtaining a read request; the read request is used to indicate reading data to be read in a first sub-strip; wherein, the first sub-strip is a part of a page strip or one of multiple sub-strips included in the page strip; the page strip includes: physical pages from N*M planes, and the N*M planes include M planes respectively included in each of the N LUNs; each of the sub-strips respectively includes physical pages of P planes in the page strip; each of the N*M planes provides X physical pages for the page strip, and X is a positive integer; N, M, and P are respectively positive integers greater than 1, and P is greater than N; user data including the data to be read and two copies of check data corresponding to the user data obtained according to RAID6 are stored in the first sub-strip; if an error occurs in the read request, error correction data is calculated by using the read data; wherein, the error correction data is the data stored in the physical page with a read error in the data to be read; the read data includes: other data in the user data read from the first sub-strip except the data stored in the physical page with a read error and the check data of the first sub-strip.
[0022] In some implementation manners, the if an error occurs in the read request, error correction data is calculated by using the read data includes: if an error occurs in the read request and the error is a read error of a physical page from 1 plane, first error correction data is calculated by using first read data; wherein, the first error correction data is the data stored in the physical page with a read error in the data to be read; the first read data includes: other data in the user data read from the first sub-strip except the data stored in the physical page with a read error and one copy of the two copies of check data.
[0023] In some implementation manners, the if an error occurs in the read request, error correction data is calculated by using the read data includes: if an error occurs in the read request and the error is a read error of physical pages from 2 planes, second error correction data is calculated by using second read data; wherein, the second error correction data is the data stored in the physical page with a read error in the data to be read; the second read data includes: other data in the user data read from the first sub-strip except the data stored in the physical page with a read error and the two copies of check data.
[0024] In some implementations, P is greater than N and less than 2N; each of the sub-stripes in the page stripe includes physical pages from P1 first planes and physical pages from P2 second planes; where P = P1 + P2, the P1 first planes include P1 planes with the same numbers from the P1 LUNs, the P2 second planes include P2 planes with the same numbers from the P2 LUNs, and the numbers between the first plane and the second plane are different.
[0025] In some implementations, P = 2N; each of the sub-stripes in the page stripe includes physical pages from N first planes and physical pages from N second planes; where the N first planes and the N second planes respectively include N planes with the same numbers from the N LUNs, and the numbers between the first plane and the second plane are different.
[0026] In some implementations, in the first sub-stripe, the two pieces of parity data are respectively stored in physical pages of a third plane and a fourth plane; the third plane and the fourth plane belong to the same LUN, the number of the third plane is the same as that of the first plane, and the number of the fourth plane is the same as that of the second plane.
[0027] In some implementations, in the first sub-stripe, the two pieces of parity data are respectively stored in physical pages of a fifth plane and a sixth plane; the fifth plane and the sixth plane are planes with the same number in different LUNs, the number of the fifth plane and the sixth plane is the same as that of the first plane, or the number of the fifth plane and the sixth plane is the same as that of the second plane.
[0028] In some implementations, in the first sub-stripe, the two pieces of parity data are respectively stored in physical pages of a seventh plane and an eighth plane; the seventh plane and the eighth plane are planes with different numbers in different LUNs, the number of the seventh plane is the same as that of the first plane, and the number of the eighth plane is the same as that of the second plane.
[0029] In a third aspect, a storage device is provided, including a controller and a non-volatile memory chip, where the controller is configured to execute the method described in the first aspect or any implementation manner of the first aspect, or the controller is configured to execute the method described in the second aspect or any implementation manner of the second aspect.
[0030] In a fourth aspect, a computer-readable storage medium is provided, in which instructions are stored, and when the instructions run on a processor, the method described in the first aspect or any implementation manner of the first aspect is implemented, or when the instructions run on a processor, the method described in the second aspect or any implementation manner of the second aspect is implemented.
[0031] In a fifth aspect, a computer program product is provided, the computer program product includes instructions, and when the instructions run on a processor, the method described in the first aspect or any implementation manner of the first aspect is implemented, or when the instructions run on a processor, the method described in the second aspect or any implementation manner of the second aspect is implemented.
[0032] Through the above method of the present application, it is possible to make the data be relatively fully protected while minimizing the proportion of the verification data in the storage resources. Specifically, in the first aspect, when P = 2N, the method provided by the present application can correct the data in the sub-stripes in the case where the planes with the same number in two LUNs fail. If the related technology is adopted, in the case where the planes with the same number in two LUNs fail, if RAID5 at the LUN level is used, the data cannot be corrected; if RAID6 at the LUN level is used, although the data can be corrected, the verification data needs to occupy the physical pages provided by 2 LUNs, while the method of the above embodiment of the present application requires a smaller proportion of the amount of the generated verification data relative to the amount of the written user data, saving storage space and reducing the occupation of the free storage space in the storage device. In the second aspect, when P is greater than N and less than 2N, the method provided by the present application can achieve that every two pieces of verification data can correct at most two pieces of user data in P pieces of user data (N < P < 2N). If the related technology is adopted, if RAID5 at the LUN level is used, only 1 piece of verification data can be used to correct 1 piece of user data in N - 2 pieces of user data, and when two pieces of user data in N - 2 pieces of user data are in error, the data cannot be corrected, while the method provided by the embodiment of the present application can correct the data; if RAID6 at the LUN level is used, although the data can be corrected, the verification data needs to occupy the physical pages provided by 2 LUNs, while the method of the above embodiment of the present application requires a smaller proportion of the amount of the generated verification data relative to the amount of the written user data, saving storage space and reducing the occupation of the free storage space in the storage device. In the third aspect, when P is greater than 2N, the method provided by the present application can achieve that every two pieces of verification data can correct at most two pieces of user data in P pieces of user data (P > 2N). If the related technology is adopted, if RAID5 at the LUN level is used, it is impossible to correct the data when the physical pages of the planes with the same number in different LUNs fail, while the method provided by the present application can correct the data; if RAID6 at the LUN level is used, the verification data needs to occupy the physical pages provided by 2 LUNs, while the method of the above embodiment of the present application requires a smaller proportion of the amount of the generated verification data relative to the amount of the written user data, saving storage space and reducing the occupation of the free storage space in the storage device. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application and, together with the specification, are used to explain the principles of the present application.
[0034] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0035] Figure 1 Schematic structural diagram of a storage device provided by an embodiment of the present application;
[0036] Figure 2 Schematic diagram of dividing a large block provided by an embodiment of the present application;
[0037] Figure 3 Schematic diagram of dividing page stripes provided by an embodiment of the present application;
[0038] Figure 4 One of the schematic structural diagrams of a page stripe provided by an embodiment of the present application;
[0039] Figure 5 Another schematic structural diagram of a page stripe provided by an embodiment of the present application;
[0040] Figure 6 Still another schematic structural diagram of a page stripe provided by an embodiment of the present application;
[0041] Figure 7 Yet another schematic structural diagram of a page stripe provided by an embodiment of the present application;
[0042] Figure 8 One more schematic structural diagram of a page stripe provided by an embodiment of the present application;
[0043] Figure 9 Schematic flowchart of a data writing method provided by an embodiment of the present application;
[0044] Figure 10 Another schematic structural diagram of a page stripe provided by an embodiment of the present application;
[0045] Figure 11 Schematic flowchart of a data reading method provided by an embodiment of the present application;
[0046] Figure 12 Another schematic structural diagram of a page stripe provided by an embodiment of the present application;
[0047] Figure 13 One more schematic structural diagram of a page stripe provided by an embodiment of the present application;
[0048] Figure 14 Another schematic structural diagram of a page stripe provided by an embodiment of the present application;
[0049] Figure 15 FIG. 10 is a schematic structural diagram of a page strip provided by an embodiment of the present application;
[0050] Figure 16 FIG. 11 is a schematic structural diagram of a page strip provided by an embodiment of the present application. Detailed implementation manners
[0051] In order to more clearly understand the above objects, features and advantages of the present application, the solutions of the present application will be further described below. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments may be combined with each other.
[0052] In the following description, many specific details are set forth in order to fully understand the present application, but the present application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of the present application, rather than all the embodiments.
[0053] First, the related technologies involved in the embodiments of the present application are introduced:
[0054] In a storage device, each NVM chip may include one or more logical units (LUNs), each LUN may include one or more planes, each plane may include multiple physical blocks, and each physical block may include multiple physical pages.
[0055] Among them, in order to make full use of the data throughput bandwidth of the backend NVM, when the storage device writes data to the NVM, it may send a write command to the NVM in an operation mode of multi-plane program. For example, when a LUN has 4 planes, a single write command sent to the NVM may carry data of 4 physical pages, and the granularity of the write command is called 4 pages.
[0056] In a storage device, a large block may be formed by each plane of multiple LUNs respectively providing a physical block.
[0057] Exemplarily, as Figure 2 shown, taking N LUNs from LUN 0 to LUN N-1 as an example, each of the LUNs includes 4 planes respectively, Figure 2Taking LUN 1 as an example, 4 planes included in LUN 1 (i.e., plane 0 to plane 3) are shown. The same understanding can be applied to the 4 planes in other LUNs from LUN 0 to LUN N - 1. Furthermore, one physical block can be taken out from each plane in LUNs from LUN 0 to LUN N - 1 to form a large block. For example, physical block B00 (from plane 0 in the LUN), physical block B10 (from plane 1 in the LUN), physical block B20 (from plane 2 in the LUN), and physical block B30 (from plane 3 in the LUN) in each LUN from LUN 0 to LUN N - 1 are used to form large block 0; for another example, physical block B02 (from plane 0 in the LUN), physical block B12 (from plane 1 in the LUN), physical block B22 (from plane 2 in the LUN), and physical block B32 (from plane 3 in the LUN) in each LUN from LUN 0 to LUN N - 1 are used to form large block 2.
[0058] When constructing a page stripe in a large block, physical pages with the same page number in physical blocks belonging to the same large block can be grouped to form a page stripe.
[0059] For example Figure 2 in, among the N×4 physical blocks included in large block 0 (4 is the number of Planes in the LUN), physical pages with the same page number can be grouped to form a page stripe, and so on. Specifically, among the N×4 physical blocks included in large block 0, one physical page can be provided by each physical block to construct a page stripe. At this time, a page stripe can include N×4×1 physical pages; in addition, multiple physical pages (denoted as x physical pages, x > 1) can be provided by each physical block to construct a page stripe. At this time, a page stripe can include N×4×x physical pages.
[0060] Exemplarily, in Figure 3 the shown large block 0, it includes physical blocks from N LUNs from LUN 0 to LUN N - 1. Among them, each LUN includes 4 planes, and each plane in the N LUNs provides one physical block for large block 0, that is, large block 0 includes N×4 physical blocks. Among the N×4 physical blocks in large block 0, physical pages with the same page number can form a page stripe. For example, among the N×4 physical blocks in large block 0, the physical pages in the first row form page stripe a, and the physical pages in the second row form page stripe b.
[0061] Taking Figure 3 page stripe a in as an example, the structure of a page stripe can be as Figure 4As shown, where the page strip a includes physical pages from each plane of N LUNs.
[0062] It should be noted that in Figure 3 and Figure 4 , a unit square represents the physical page provided by a physical block for a page strip. For example Figure 3 and Figure 4 , the unit square P00 represents the physical page provided by the physical block of LUN0 for the page strip a. In practical applications, a unit square can include one physical page (in this case, the unit square P00 can include one physical page), and at this time, it can be understood that each physical block in the large block provides one physical page for the page strip; in addition, a unit square can include multiple physical pages (in this case, the unit square P00 can include multiple physical pages), and at this time, it can be understood that each physical block in the large block provides multiple physical pages for the page strip.
[0063] In the related art, in the case of using RAID5 for data protection, two methods can be adopted at the plane level and the LUN level.
[0064] On the one hand, in the RAID5 at the plane level, in a page strip, the physical pages provided by one plane can be used to store parity data, and other physical pages are used to store user data. For example Figure 5 in the page strip shown, the physical pages from plane3 in LUNN-1 are used to store parity data, and other physical pages in the page strip are all used to store user data.
[0065] In the above RAID5 at the plane level, since the parity data in a page strip only occupies the physical pages provided by one plane, it has the advantage of a small proportion of parity data. However, the data protection effect in this method is poor. For example, if 1 LUN fails or multiple planes fail in different LUNs, the user data cannot be restored.
[0066] On the other hand, in the RAID5 at the LUN level, in a page strip, the physical pages provided by one LUN can be used to store parity data, and other physical pages are used to store user data.
[0067] For example Figure 6 shown, in the page strip, the physical pages from LUNN-1 are used to store parity data (i.e., parity data 0, parity data 1, parity data 2, and parity data 3), and other physical pages in the page strip are all used to store user data.
[0068] Specifically, in the page strip, the physical pages with the same plane number can form a sub-strip. As Figure 6Among them, the physical pages numbered plane0 from each LUN form sub-strip 0, the physical pages numbered plane1 from each LUN form sub-strip 1, the physical pages numbered plane2 from each LUN form sub-strip 2, and the physical pages numbered plane3 from each LUN form sub-strip 3. Among them, the parity data in each sub-strip is used to protect the data in that sub-strip.
[0069] For example Figure 6 Among them, in sub-strip 0, parity data 0 can be calculated using the following formula (1):
[0070] Parity data 0 = (LUN 0_plane0) XOR (LUN 1_plane0) XOR... XOR (LUN N-2_plane0)
[0071] Formula (1)
[0072] Among them, LUN x_plane y in formula (1) represents: the data value stored in the physical page belonging to plane y in LUNx in sub-strip 0. In this way, RAID5 can be used to correct the data in sub-strip 0. For other sub-strips, the parity data can also be calculated according to the same calculation method as formula (1) to correct the data in each sub-strip using RAID5.
[0073] In the above RAID5 at the LUN level, since the parity data in a page strip only occupies the physical pages provided by one plane, it has the advantage of a small proportion of parity data. However, the data protection effect in this way is relatively poor. For example, if one LUN fails or multiple planes in different LUNs fail, the user data cannot be recovered.
[0074] It can be seen that in the above RAID5 at the LUN level, when one LUN fails, the user data can be recovered, but if the planes with the same number in different LUNs fail, the user data cannot be recovered. For example Figure 6 if plane0 of LUN 0 and LUN1 both fail in, the user data cannot be recovered.
[0075] Furthermore, RAID6 at the LUN level can be used for data protection. In RAID6 at the LUN level, as Figure 7 shown, in a page strip, the physical pages provided by 2 LUNs can be used to store the parity data, and the other physical pages store the user data.
[0076] For example Figure 7 Among them, in sub-strip 0, parity data P0 can be calculated using the following formula (2):
[0077] Check data P0 = (LUN 0_plane0) XOR (LUN 1_plane0) XOR... XOR (LUN N-3_plane0)
[0078] Equation (2)
[0079] In sub-strip 0, the check data Q0 can be calculated using the following Equation (3):
[0080] Check data Q0 = (A0 × LUN 0_plane0) XOR (A1 × LUN 1_plane0) XOR... XOR (AN-3 × LUN N-3_plane0)
[0081] Equation (3)
[0082] Where A0, A1,..., AN-3 are the polynomial coefficients for calculating the second check data (Q) of RAID6, and can specifically be the values of polynomials in the Galois field, such as the values of polynomials in GF(2^8).
[0083] Where, in RAID6 at the LUN level, user data can be recovered in the case where no more than 2 planes with the same number fail. For example, in Figure 7 if plane0 of both LUN 0 and LUN 1 fails, the user data cannot be recovered, then the user data can be recovered using the check data Q0 and the check data P0.
[0084] However, in RAID6 at the LUN level, in one page strip, the check data needs to occupy physical pages provided by 2 LUNs, so the storage space consumed is excessive, which will in turn lead to a reduction in the free storage space in the storage device and a decrease in the random write performance.
[0085] Based on the above related technologies, an embodiment of the present application provides a technical solution. The following introduces the technical solution provided by the embodiment of the present application in combination with examples.
[0086] In the first implementation manner, in the technical solution provided by the embodiment of the present application, as Figure 8 shown, the page strip includes physical pages from N*M planes, where the N*M planes include M planes respectively included in each of the N LUNs, and N and M are positive integers greater than 1.
[0087] Where, in some designs, the page strip may include multiple sub-strips, and each sub-strip includes physical pages of 2N planes in the page strip.
[0088] Specifically, each sub-strip may include physical pages from N first planes and physical pages from N second planes. Among them, the N first planes and the N second planes respectively include N planes with the same numbers from N LUNs, and the numbers between the first plane and the second plane are different.
[0089] For example, Figure 8 the first sub-strip in includes physical pages from the plane numbered plane0 (which can be understood as N first planes) in N LUNs and physical pages from the plane numbered plane 1 (which can be understood as N second planes) in N LUNs. The second sub-strip includes physical pages from the plane numbered plane 2 (which can be understood as N first planes) in N LUNs and physical pages from the plane numbered plane 3 (which can be understood as N second planes) in N LUNs. And so on, other sub-strips in the page strip can also respectively include physical pages from N first planes and physical pages from N second planes.
[0090] In addition, in some other designs, the page strip may only include 1 sub-strip. In addition to the physical pages corresponding to this sub-strip, the page strip may also include other unused physical pages.
[0091] Next, taking Figure 8 the read and write process of the first sub-strip in the shown page strip as an example, the data writing method and data reading method provided by the embodiments of the present application will be introduced.
[0092] In the first design, as Figure 9 shown, the data writing method provided by the embodiments of the present application may include:
[0093] S201. The storage device writes user data into the first sub-strip.
[0094] Among them, in some possible designs, as Figure 10 shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes: physical pages from N*M planes, and the N*M planes include M planes respectively included in each of the N LUNs. Each plane in the N*M planes provides X physical pages for the page strip, where X is a positive integer. In other words, the page strip may include N×M×X physical pages. Each sub-strip respectively includes physical pages from P planes in the page strip, and P = 2N. In other words, each sub-strip may respectively include 2N×X physical pages.
[0095] Among them, each sub-strip in the page strip includes physical pages from N first planes and physical pages from N second planes; among them, the N first planes and the N second planes respectively include N planes with the same numbers from N LUNs, and the numbers between the first plane and the second plane are different.
[0096] In some other designs, the page strip may only include 1 sub-strip (i.e., the first sub-strip). In other words, the first sub-strip is a part of the page strip. In addition, in addition to the physical pages corresponding to the first sub-strip, the page strip may also include other unused physical pages.
[0097] Among them, in the first sub-strip, two parity data of RAID6 are respectively stored in the physical pages of the third plane and the fourth plane. The third plane and the fourth plane belong to the same LUN. The numbers of the third plane and the first plane are the same, and the numbers of the fourth plane and the second plane are the same. Specifically, as Figure 10 shown, in the first sub-strip, two parity data (denoted as P0 and Q0) of RAID6 are respectively stored in the physical pages of plane0 and plane1 belonging to LUN N-1. Therefore, user data can be written into a total of (2N - 2) × X physical pages of plane0 and plane1 belonging to LUN 0 to LUN N-2. Thus, in the sub-page strip of the present application, the ratio of the parity data to the total storage capacity of the sub-page strip is 1 / N, while in the RAID6 scheme of the prior art, the ratio of the parity data to the total storage capacity is 2 / N. Thus, the embodiment of the present application not only reduces the proportion of the parity data in the total storage capacity, but also realizes the fault tolerance ability of the RAID6 level.
[0098] S202. The storage device determines two parity data corresponding to the user data.
[0099] Among them, the two parity data are the parity data corresponding to the user data obtained according to RAID6.
[0100] For example, two parity data corresponding to the user data written into the first page strip can be calculated respectively according to the following formulas (4) and (5): parity data P0 and parity data Q0:
[0101] Parity data P0 =
[0102] (LUN 0_plane0) XOR (LUN 1_plane0) XOR... XOR (LUN N-2_plane0)
[0103] XOR(LUN 0_plane1) XOR(LUN 1_plane1) XOR... XOR(LUN N-2_plane1)
[0104] Equation (4) check data Q0 =
[0105] (A0 × LUN 0_plane0) XOR(A1 × LUN 1_plane0) XOR... XOR(AN-2 × LUN N-2_plane0) (AN-1 × LUN 0_plane1) XOR(AN × LUN 1_plane1) XOR... XOR(A2N-3 × LUN N-2_plane1)
[0106] Equation (5)
[0107] Wherein, A0, A1,..., A2N-3 are the polynomial coefficients for calculating the second parity data of RAID6, and can specifically be the numerical values of polynomials in the Galois field, such as the numerical values of polynomials in GF(2^8).
[0108] S203. The storage device writes the two parity data into the first sub-strip, so that the data stored in the first sub-strip can correct data errors of no more than 2 planes in the first sub-strip.
[0109] It can be understood that the user data written in step S201 and the two parity data written in step S203 fill the first sub-strip.
[0110] Wherein, in the first sub-strip, the two parity data of RAID6 are respectively stored in the physical pages of the third plane and the fourth plane, and the third plane and the fourth plane belong to the same LUN. Specifically, as Figure 10 shown, the two parity data can be written into the physical pages of plane0 and plane1 belonging to LUN N-1 in the first sub-strip.
[0111] As Figure 11 shown, the data reading method provided by the embodiment of the present application may include:
[0112] S301. The storage device obtains a read request.
[0113] Wherein, the read request is used to indicate reading the data to be read in the first sub-strip.
[0114] Wherein, the first sub-strip is a part of the page strip. Or, as Figure 10As shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes: physical pages from N*M planes, and the N*M planes include M planes respectively included in each of the N LUNs. Each sub-strip respectively includes physical pages of P planes in the page strip, and P = 2N. Each of the N*M planes provides X physical pages for the page strip, and X is a positive integer.
[0115] Among them, the first sub-strip stores user data containing the data to be read and two copies of check data corresponding to the user data obtained according to RAID6.
[0116] Among them, each sub-strip in the page strip includes physical pages from N first planes and physical pages from N second planes; among them, the N first planes and the N second planes respectively include N planes with the same number from the N LUNs, and the numbers between the first plane and the second plane are different.
[0117] Among them, in the first sub-strip, two copies of check data corresponding to the user data obtained according to RAID6 are respectively stored in the physical pages of the third plane and the fourth plane, and the third plane and the fourth plane belong to the same LUN. Specifically, as Figure 10 shown, in the first sub-strip, two copies of check data of RAID6 are respectively stored in the physical pages of plane0 and plane1 (i.e., the third plane and the fourth plane) belonging to LUN N-1.
[0118] S302. If a read request has an error, calculate error correction data using the read data.
[0119] Among them, the error correction data is the data stored in the physical page with a read error in the data to be read; the read data includes: other data in the user data read from the first sub-strip except for the data stored in the physical page with a read error and the check data of the first sub-strip.
[0120] In a first possible design, if a read request has an error, calculating error correction data using the read data includes: if a read request has an error and the error is a read error of a physical page from 1 plane, calculate first error correction data using first read data; among them, the first error correction data is the data stored in the physical page with a read error in the data to be read; the first read data includes: other data in the user data read from the first sub-strip except for the data stored in the physical page with a read error and one copy of the check data among the two copies of check data.
[0121] In a second possible design, if a read request encounters an error, error correction data is calculated using the read data, including: if a read request encounters an error, and the error is a read error of physical pages from two planes, then second error correction data is calculated using second read data; wherein, the second error correction data is the data stored in the physical pages with read errors in the data to be read; the second read data includes: other data in the user data read from the first sub-strip except for the data stored in the physical pages with read errors and two copies of parity data.
[0122] For example, when a whole LUN fails in a storage device, as Figure 12 shown in (a) of Figure 12 taking LUN 0 as an example of failure, this causes read errors in the physical pages from plane 0 and plane 1 in LUN 0 in the first sub-strip (indicated by cross marks in the figure). Then, in the embodiment of the present application, according to the above second possible design, error correction can be performed on the data to be verified to obtain the user data corresponding to the data to be verified. Another example, when one plane fails in each of two LUNs in a storage device, for example Figure 12 when plane 0 of LUN 0 fails and plane 1 of LUN 1 fails as shown in (b) of Figure 12 or when plane 0 of LUN 0 fails and plane 0 of LUN 1 fails as shown in (c) of
[0123] Figure 12 Figure 6 Figure 7
[0124]
[0125]
[0126] In the second design, the data writing method provided by the embodiment of the present application may include:
[0125] S401. The storage device writes user data into the first sub-strip.
[0126] Among some possible designs, such as Figure 13 shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes: physical pages from N*M planes, and the N*M planes include M planes respectively included in each of the N LUNs. Each plane in the N*M planes provides X physical pages for the page strip, where X is a positive integer. In other words, the page strip may include N×M×X physical pages. Each sub-strip respectively includes physical pages of P planes in the page strip, where P = 2N. In other words, each sub-strip may respectively include 2N×X physical pages.
[0127] Among them, each sub-strip in the page strip includes physical pages from N first planes and physical pages from N second planes; among them, the N first planes and the N second planes respectively include N planes with the same numbers from the N LUNs, and the numbers between the first plane and the second plane are different.
[0128] In some other designs, the page strip may only include 1 sub-strip (i.e., the first sub-strip). In other words, the first sub-strip is part of the page strip. In addition, in addition to the physical pages corresponding to the first sub-strip, the page strip may also include other unused physical pages.
[0129] Among them, in the first sub-strip, two parity data of RAID6 are respectively stored in the physical pages of the fifth plane and the sixth plane. The fifth plane and the sixth plane are planes with the same numbers in different LUNs, and the fifth plane and the sixth plane have the same number as the first plane, or the fifth plane and the sixth plane have the same number as the second plane. Specifically, as Figure 13 shown, in the first sub-strip, two parity data of RAID6 are respectively stored in the physical pages of plane1 belonging to LUN N-2 and the physical pages of plane1 belonging to LUN N-1 (where plane1 of LUN N-2 and plane1 of LUN N-1 can be understood as the fifth plane and the sixth plane). Therefore, user data can be written into the physical pages of plane0 belonging to LUN 0 to LUN N-1 and the physical pages of plane1 belonging to LUN 0 to LUN N-3.
[0130] S402. The storage device determines two parity data corresponding to the user data.
[0131] Among them, the two parity data are the parity data corresponding to the user data obtained according to RAID6.
[0132] For example, two parity data corresponding to the user data written to the first page stripe can be calculated according to the following formulas (6) and (7): parity data P0 and parity data Q0:
[0133] Parity data P0 =
[0134] (LUN 0_plane0) XOR (LUN 1_plane0) XOR... XOR (LUN N - 1_plane0)
[0135] XOR (LUN 0_plane1) XOR (LUN 1_plane1) XOR... XOR (LUN N - 3_plane1)
[0136] Formula (6) Parity data Q0 =
[0137] (A0 × LUN 0_plane0) XOR (A1 × LUN 1_plane0) XOR... XOR (AN - 1 × LUN N - 1_plane0)(AN × LUN 0_plane1) XOR (AN + 1 × LUN 1_plane1) XOR... XOR (A2N - 3 × LUN N - 3_plane1)
[0138] Formula (7)
[0139] Among them, A0, A1,..., A2N - 3 are the polynomial coefficients for calculating the second parity data of RAID6, and can specifically be the numerical values of polynomials in the Galois field, such as the numerical values of polynomials in GF(2^8).
[0140] S403. The storage device writes the two parity data into the first sub - stripe, so that the data stored in the first sub - stripe can correct data errors in no more than 2 planes in the first sub - stripe.
[0141] It can be understood that the user data written in step S401 and the two parity data written in step S403 fill the first sub - stripe.
[0142] Among them, in the first sub - stripe, the two parity data are respectively stored in the physical pages of the fifth plane and the sixth plane. The fifth plane and the sixth plane are planes with the same number in different LUNs. Specifically, as Figure 13 shown, in the first sub - stripe, the two parity data can be respectively stored in the physical page of plane1 belonging to LUNN - 2 and the physical page of plane1 belonging to LUNN - 1 (where plane1 of LUNN - 2 and plane1 of LUNN - 1 can be understood as the fifth plane and the sixth plane).
[0143] In addition, the data reading method provided by the embodiments of the present application may include:
[0144] S501. The storage device obtains a read request.
[0145] The read request is used to indicate reading the data to be read in the first sub-strip.
[0146] The first sub-strip is a part of the page strip. Or, as Figure 13 shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes: physical pages from N*M planes, and the N*M planes include M planes respectively included in each of the N LUNs. Each sub-strip includes physical pages of P planes in the page strip, and P = 2N. Each plane in the N*M planes provides X physical pages for the page strip, and X is a positive integer.
[0147] The first sub-strip stores user data containing the data to be read and two copies of check data corresponding to the user data obtained according to RAID6.
[0148] Each sub-strip in the page strip includes physical pages from N first planes and physical pages from N second planes; among them, the N first planes and the N second planes respectively include N planes with the same numbers from the N LUNs, and the numbers between the first plane and the second plane are different.
[0149] Among them, in the first sub-strip, two copies of check data corresponding to the user data obtained according to RAID6 are respectively stored in the physical pages of the fifth plane and the sixth plane. The fifth plane and the sixth plane are planes with the same number in different LUNs. Specifically, as Figure 13 shown, in the first sub-strip, the two copies of check data are respectively stored in the physical pages of plane1 belonging to LUNN-2 and the physical pages of plane1 belonging to LUNN-1 (where plane1 of LUNN-2 and plane1 of LUNN-1 can be understood as the fifth plane and the sixth plane).
[0150] S502. If an error occurs in the read request, error correction data is calculated using the read data.
[0151] The error correction data is the data stored in the physical page where a read error occurs in the data to be read; the read data includes: other data in the user data read from the first sub-strip except for the data stored in the physical page where a read error occurs and the check data of the first sub-strip.
[0152] In a first possible design, if a read request encounters an error, error correction data is calculated using the read data, including: if the read request encounters an error and the error is a read error of a physical page from 1 plane, then the first error correction data is calculated using the first read data; wherein, the first error correction data is the data stored in the physical page with a read error among the data to be read; the first read data includes: the other data in the user data read from the first sub-strip except the data stored in the physical page with a read error and one of the two parity data.
[0153] In a second possible design, if a read request encounters an error, error correction data is calculated using the read data, including: if the read request encounters an error and the error is a read error of physical pages from 2 planes, then the second error correction data is calculated using the second read data; wherein, the second error correction data is the data stored in the physical page with a read error among the data to be read; the second read data includes: the other data in the user data read from the first sub-strip except the data stored in the physical page with a read error and the two parity data.
[0154] For example, when a whole LUN fails in a storage device, as Figure 12 shown in (a) of, taking LUN 0 as an example of failure, at this time, it causes read errors of the physical pages of plane 0 and plane 1 in LUN 0 (represented by cross marks in the figure), then in the embodiment of the present application, according to the above second possible design, error correction can be performed on the data to be verified to obtain the user data corresponding to the data to be verified. For another example, when one plane fails in each of two LUNs in a storage device, for example Figure 12 in (b) where plane 0 of LUN 0 fails and plane 1 of LUN 1 fails, and for another example Figure 12 in (c) where plane 0 of LUN0 fails and plane 0 of LUN 1 fails, then in the embodiment of the present application, according to the above second possible design, error correction can be performed on the data to be verified to obtain the user data corresponding to the data to be verified.
[0155] In the related art, in the case of Figure 12 (c) of, on the one hand, if the LUN-level RAID5 shown in Figure 6 is used, the data cannot be error-corrected; on the other hand, if the LUN-level RAID6 shown in Figure 7 is used, although error correction can be performed, the parity data needs to occupy the physical pages provided by 2 LUNs, while the method in the embodiment of the present application requires a smaller proportion of the amount of parity data generated relative to the amount of user data written, saving storage space and reducing the occupation of the free storage space in the storage device.
[0156] In the third design, the data writing method provided by the embodiments of the present application may include:
[0157] S601. The storage device writes user data into the first sub-strip.
[0158] Wherein, in some possible designs, as Figure 14 shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes: physical pages from N*M planes, and the N*M planes include M planes respectively included in each of the N LUNs. Each plane in the N*M planes provides X physical pages for the page strip, where X is a positive integer. In other words, the page strip may include N×M×X physical pages. Each sub-strip respectively includes physical pages of P planes in the page strip, and P = 2N. In other words, each sub-strip may respectively include 2N×X physical pages.
[0159] Wherein, each sub-strip in the page strip includes physical pages from N first planes and physical pages from N second planes; wherein, the N first planes and the N second planes respectively include N planes with the same numbers from the N LUNs, and the numbers between the first plane and the second plane are different.
[0160] In some other designs, the page strip may only include 1 sub-strip (i.e., the first sub-strip). In other words, the first sub-strip is a part of the page strip. In addition, in addition to the physical pages corresponding to the first sub-strip, the page strip may also include other unused physical pages.
[0161] Wherein, in the first sub-strip, two parity data of RAID6 are respectively stored in the physical pages of the seventh plane and the eighth plane. The seventh plane and the eighth plane are planes with different numbers in different LUNs, the number of the seventh plane is the same as that of the first plane, and the number of the eighth plane is the same as that of the second plane. Specifically, as Figure 14 shown, in the first sub-strip, two parity data of RAID6 (denoted as P0 and Q0) are respectively stored in the physical pages of plane0 belonging to LUNN-2 and the physical pages of plane1 belonging to LUNN-1 (wherein, plane0 of LUNN-2 and plane1 of LUNN-1 can be understood as the seventh plane and the eighth plane). Therefore, user data can be written into the physical pages of plane0 belonging to LUN 0 to LUNN-3 and LUNN-1 and the physical pages of plane1 belonging to LUN 0 to LUNN-2.
[0162] S602. The storage device determines two pieces of verification data corresponding to the user data.
[0163] Among them, the two pieces of verification data are the verification data corresponding to the user data obtained according to RAID6.
[0164] For example, the two pieces of verification data corresponding to the user data written to the first page stripe can be calculated according to the following formulas (8) and (9): verification data P0 and verification data Q0:
[0165] Verification data P0 =
[0166] (LUN 0_plane0) XOR... XOR (LUN N - 3_plane0) XOR (LUN N - 1_plane0)
[0167] XOR (LUN 0_plane1) XOR (LUN 1_plane1) XOR... XOR (LUN N - 3_plane1)
[0168] Formula (8) Verification data Q0 =
[0169] (A0 × LUN 0_plane0) XOR... XOR (AN - 3 × LUN N - 3_plane0) XOR (AN - 2 × LUN N - 1_plane0) (AN - 1 × LUN 0_plane1) XOR (AN + 1 × LUN 1_plane1) XOR... XOR (A2N - 3 × LUN N - 3_plane1)
[0170] Formula (9)
[0171] Among them, A0, A1,..., A2N - 3 are the polynomial coefficients for calculating the second piece of verification data of RAID6, and can specifically be the values of polynomials in the Galois field, such as the values of polynomials in GF(2^8).
[0172] S603. The storage device writes the two pieces of verification data into the first sub - stripe, so that the data stored in the first sub - stripe can correct data errors of no more than 2 planes in the first sub - stripe.
[0173] Among them, in the first sub - stripe, the two pieces of verification data are respectively stored in the physical pages of the seventh plane and the eighth plane. The seventh plane and the eighth plane are planes with different numbers in different LUNs. Specifically, such as Figure 14As shown in the figure, in the first sub-strip, two pieces of parity data can be stored in the physical pages of plane0 belonging to LUNN-2 and the physical pages of plane1 belonging to LUNN-1 respectively (where plane0 of LUNN-2 and plane1 of LUNN-1 can be understood as the seventh plane and the eighth plane).
[0174] In addition, the data reading method provided by the embodiments of the present application may include:
[0175] S701. The storage device obtains a read request.
[0176] The read request is used to indicate reading the data to be read in the first sub-strip.
[0177] The first sub-strip is part of the page strip. Or, as Figure 14 shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes physical pages from N*M planes, and the N*M planes include M planes respectively included in each of the N LUNs. Each sub-strip includes physical pages of P planes in the page strip, P = 2N. Each plane in the N*M planes provides X physical pages for the page strip, and X is a positive integer.
[0178] The first sub-strip stores user data containing the data to be read and two pieces of parity data corresponding to the user data obtained according to RAID6.
[0179] Each sub-strip in the page strip includes physical pages from N first planes and physical pages from N second planes; among them, the N first planes and the N second planes respectively include N planes with the same number from the N LUNs, and the numbers of the first plane and the second plane are different.
[0180] In the first sub-strip, the two pieces of parity data corresponding to the user data obtained according to RAID6 are respectively stored in the physical pages of the seventh plane and the eighth plane. The seventh plane and the eighth plane are planes with different numbers in different LUNs. The number of the seventh plane is the same as that of the first plane, and the number of the eighth plane is the same as that of the second plane.
[0181] S702. If the read request has an error, error correction data is calculated using the read data.
[0182] Among them, the error correction data is the data stored in the physical page with a read error in the data to be read; the read data includes: other data in the user data read from the first sub-strip except for the data stored in the physical page with a read error and the parity data of the first sub-strip.
[0183] In a first possible design, if a read request has an error, the error correction data is calculated using the read data, including: if the read request has an error and the error is a read error of a physical page from 1 plane, the first error correction data is calculated using the first read data; wherein, the first error correction data is the data stored in the physical page with a read error in the data to be read; the first read data includes: other data in the user data read from the first sub-strip except for the data stored in the physical page with a read error and one of the two parity data.
[0184] In a second possible design, if a read request has an error, the error correction data is calculated using the read data, including: if the read request has an error and the error is a read error of physical pages from 2 planes, the second error correction data is calculated using the second read data; wherein, the second error correction data is the data stored in the physical page with a read error in the data to be read; the second read data includes: other data in the user data read from the first sub-strip except for the data stored in the physical page with a read error and the two parity data.
[0185] For example, when a whole LUN fails in the storage device, as Figure 12 shown in (a) of Figure 12 taking LUN 0 as an example of failure, at this time, it causes read errors of physical pages from plane 0 and plane 1 in LUN 0 in the first sub-strip (represented by cross marks in the figure), then in the embodiment of the present application, according to the above second possible design, it is possible to correct the data to be verified and obtain the user data corresponding to the data to be verified. For another example, when one plane fails in each of two LUNs in the storage device, for example Figure 12 when plane 0 of LUN 0 and plane 1 of LUN 1 fail in (b) of
[0186] or when plane 0 of LUN 0 and plane 0 of LUN 1 fail in (c) of Figure 12 Figure 6 shown inFigure 7 For the RAID6 at the LUN level shown, although error correction is possible, the parity data needs to occupy the physical pages provided by 2 LUNs. However, in the method of the embodiments of the present application, the proportion of the amount of parity data to be generated relative to the amount of user data written is less, saving storage space and reducing the occupation of the free storage space in the storage device.
[0187] In the first implementation manner described above, it mainly introduces the implementation manner in which each sub-strip in the page strip includes the physical pages of 2N planes in the page strip in the case where the page strip includes the physical pages from N*M planes (where N*M planes include M planes respectively included in each of the N LUNs, and N and M are positive integers greater than 1).
[0188] In the second implementation manner, in the embodiments of the present application, each sub-strip in the page strip may further include the physical pages of P planes, where P is greater than N and less than 2N. Among them, each sub-strip in the page strip includes the physical pages from P1 first planes and the physical pages from P2 second planes; where P = P1 + P2, the P1 first planes include P1 planes with the same numbers in P1 LUNs, the P2 second planes include P2 planes with the same numbers in P2 LUNs, and the numbers between the first planes and the second planes are different.
[0189] For example, in the page strip, the physical pages from N + 1 planes can be sequentially divided into 1 sub-strip. Exemplarily, as Figure 15 In it, in the page strip, the first sub-strip includes the physical pages of plane0 from N LUNs and the physical pages of plane1 from LUN 0; the second sub-strip includes the physical pages of plane1 from LUN 1 to LUNN-1 and the physical pages of plane2 from LUN 0 and LUN 1; and so on.
[0190] Next, taking Figure 15 the read and write process of the first sub-strip in the shown page strip as an example, the data writing method and data reading method provided by the embodiments of the present application will be introduced.
[0191] The data writing method provided by the embodiments of the present application may include:
[0192] S801. The storage device writes the user data into the first sub-strip.
[0193] Among them, in some designs, such as Figure 15As shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes: physical pages from N*M planes, where the N*M planes include M planes respectively included in each of the N LUNs, and N and M are positive integers greater than 1. Each of the N*M planes provides X physical pages for the page strip, where X is a positive integer. In other words, the page strip can include N×M×X physical pages.
[0194] Each sub-strip respectively includes physical pages of P planes in the page strip, where P is greater than N and less than 2N. In other words, each sub-strip can respectively include P×X physical pages. Figure 15 Taking P as N + 1 as an example.
[0195] In some other designs, the page strip can include only 1 sub-strip (i.e., the first sub-strip). In other words, the first sub-strip is a part of the page strip. In addition, in addition to the physical pages corresponding to the first sub-strip, the page strip can also include other unused physical pages.
[0196] Exemplarily, in the first sub-strip, two parity data of RAID6 can be respectively stored in the physical pages of plane0 of LUN N - 2 and plane0 of LUN N - 1. Therefore, user data can be written into other physical pages except the physical pages of plane0 of LUN N - 2 and plane0 of LUN N - 1. It should be noted that in the actual application process, two parity data of RAID6 can also be stored in other physical pages in the sub-strip, and then user data can also be stored in the corresponding physical pages.
[0197] S802. The storage device determines two parity data corresponding to the user data.
[0198] Among them, the two parity data are the parity data corresponding to the user data obtained according to RAID6.
[0199] For example, two parity data corresponding to the user data written into the first page strip can be calculated respectively according to the following formulas (10) and (11): parity data P0 and parity data Q0:
[0200] Parity data P0 = (LUN 0_plane0) XOR... XOR (LUN N - 2_plane0) XOR (LUN N - 1_plane0) XOR (LUN 0_plane1)
[0201] Formula (10)
[0202] Check data Q0 = (A0 × LUN 0_plane0) XOR... XOR (AN-2 × LUN N-2_plane0) XOR (AN-1 × LUN N-1_plane0) XOR (AN × LUN 0_plane1)
[0203] Equation (11)
[0204] Among them, A0, A1,..., AN are the polynomial coefficients for calculating the second parity data of RAID6, and can specifically be the numerical values of polynomials in the Galois field, such as the numerical values of polynomials in GF(2^8).
[0205] S803. The storage device writes the two parity data into the first sub-strip, so that the data stored in the first sub-strip can correct data errors of no more than 2 planes in the first sub-strip.
[0206] Exemplarily, in the first sub-strip, the two parity data of RAID6 can be respectively stored in the physical pages of LUN N-2's plane0 and LUN N-1's plane0. In this embodiment, the ratio of the parity data to the total storage capacity of the sub-page strip is 1 / (N + 1), while in the existing RAID6 scheme, the ratio of the parity data to the total storage capacity is 2 / N. Thus, this embodiment also reduces the proportion of the parity data in the total storage capacity and realizes the fault tolerance ability at the RAID6 level.
[0207] In addition, the data reading method provided by the embodiment of the present application may include:
[0208] S901. The storage device obtains a read request.
[0209] Among them, the read request is used to indicate reading the data to be read in the first sub-strip.
[0210] Among them, the first sub-strip is a part of the page strip. Or, as Figure 15 shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes: physical pages from N*M planes, and the N*M planes include M planes respectively included in each of the N LUNs, and N and M are positive integers greater than 1. Each sub-strip respectively includes physical pages of P planes in the page strip, P is greater than N and less than 2N, Figure 15 taking P as N + 1 as an example. Among them, each of the N*M planes provides X physical pages for the page strip, and X is a positive integer.
[0211] Among them, the first sub-strip stores user data including the data to be read and two parity data corresponding to the user data obtained according to RAID6.
[0212] S902. If a read request encounters an error, calculate error correction data using the read data.
[0213] Among them, the error correction data is the data stored in the physical pages with read errors in the data to be read; the read data includes: other data in the user data read from the first sub-strip except the data stored in the physical pages with read errors and the parity data of the first sub-strip.
[0214] In a first possible design, if a read request encounters an error, calculate error correction data using the read data, including: if a read request encounters an error and the error is a read error of a physical page from 1 plane, calculate first error correction data using the first read data; among them, the first error correction data is the data stored in the physical pages with read errors in the data to be read; the first read data includes: other data in the user data read from the first sub-strip except the data stored in the physical pages with read errors and one of the two parity data.
[0215] In a second possible design, if a read request encounters an error, calculate error correction data using the read data, including: if a read request encounters an error and the error is a read error of physical pages from 2 planes, calculate second error correction data using the second read data; among them, the second error correction data is the data stored in the physical pages with read errors in the data to be read; the second read data includes: other data in the user data read from the first sub-strip except the data stored in the physical pages with read errors and the two parity data.
[0216] It can be seen that in Figure 15 the implementation shown, in each sub-strip, the user data in the physical pages of at most two planes can be error-corrected, that is, every two parity data can error-correct at most two of the N - 2 user data. In the related art, on the one hand, if the RAID5 at the LUN level shown in Figure 6 is used, only 1 parity data can be used to error-correct 1 of the N - 2 user data. If two user data in the N - 2 user data have errors, error correction cannot be performed. On the other hand, if the RAID6 at the LUN level shown in Figure 7 is used, there is a problem that the parity data occupies more physical pages.
[0217] In the third implementation manner, in the embodiments of the present application, when a page strip includes physical pages from N*M planes (where N*M planes include M planes respectively included in each of the N LUNs among the N LUNs, and N and M are positive integers greater than 1), each sub-strip in the page strip may further include physical pages of P planes, where P is greater than 2N.
[0218] For example, in the page strip, the physical pages from 2N+1 planes can be sequentially divided into 1 sub-strip. Exemplarily, as Figure 16 shown, in the page strip, the first sub-strip includes the physical pages of plane0 and plane1 from N LUNs and the physical pages of plane2 from LUN 0; the second sub-strip includes the physical pages of plane2 from LUN 1 to LUNN-1, the physical pages of plane3 from LUN 0 to LUNN-1, and the physical pages of plane4 from LUN 0 and LUN 1; and so on.
[0219] Next, taking Figure 16 the read and write process of the first sub-strip in the shown page strip as an example, the data writing method and data reading method provided by the embodiments of the present application will be introduced.
[0220] The data writing method provided by the embodiments of the present application may include:
[0221] S1001. The storage device writes user data into the first sub-strip.
[0222] Among them, as Figure 16 shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes: physical pages from N*M planes, where N*M planes include M planes respectively included in each of the N LUNs among the N LUNs, and N and M are positive integers greater than 1. Each sub-strip respectively includes physical pages of P planes in the page strip, P is greater than 2N, Figure 15 taking P as 2N+1 as an example. Among them, each of the N*M planes provides X physical pages for the page strip, and X is a positive integer. In other words, the page strip may include N×M×X physical pages.
[0223] Exemplarily, in the first sub-strip, two parity data of RAID6 can be respectively stored in the physical pages from plane0 of LUNN-1 and plane1 of LUNN-1. Therefore, user data can be written into other physical pages except for the physical pages from plane0 of LUNN-1 and plane1 of LUNN-1. It should be noted that in the actual application process, two parity data of RAID6 can also be stored in other physical pages in the sub-strip, and then user data can also be stored in the corresponding physical pages.
[0224] S1002. The storage device determines two parity data corresponding to the user data.
[0225] Among them, the two parity data are the parity data corresponding to the user data obtained according to RAID6.
[0226] For example, two parity data corresponding to the user data written into the first page strip can be calculated respectively according to the following formulas (12) and (13): parity data P0 and parity data Q0:
[0227] Parity data P0 =
[0228] (LUN 0_plane0) XOR (LUN 1_plane0) XOR... XOR (LUN N-2_plane0)
[0229] XOR (LUN 0_plane1) XOR (LUN 1_plane1) XOR... XOR (LUN N-2_plane1)
[0230] XOR (LUN 0_plane2)
[0231] Formula (12) Parity data Q0 =
[0232] (A0 × LUN 0_plane0) XOR (A1 × LUN 1_plane0) XOR... XOR (AN-2 × LUN N-2_plane0) XOR (AN-1 × LUN 0_plane1) XOR (LUN 1_plane1) XOR... XOR (A2N-3 × LUN N-2_plane1) XOR (A2N-2 × LUN 0_plane2)
[0233] Formula (13)
[0234] Among them, A0, A1,..., A2N-2 are the polynomial coefficients for calculating the second parity data of RAID6, and can specifically be the numerical values of polynomials in the Galois field, such as the numerical values of polynomials in GF(2^8).
[0235] S1003. The storage device writes two pieces of parity data into the first sub-strip, so that the data stored in the first sub-strip can correct data errors of no more than 2 planes in the first sub-strip.
[0236] Exemplarily, in the first sub-strip, the two pieces of parity data of RAID6 can be respectively stored in the physical pages of plane0 from LUNN-1 and plane1 from LUNN-1.
[0237] In addition, the data reading method provided by the embodiments of the present application may include:
[0238] S1101. The storage device obtains a read request.
[0239] The read request is used to indicate reading the data to be read in the first sub-strip.
[0240] The first sub-strip is part of the page strip. Or, as Figure 16 shown, the first sub-strip is one of the multiple sub-strips included in the page strip. The page strip includes: physical pages from N*M planes, where N*M planes include M planes respectively included in each of the N LUNs, and N and M are positive integers greater than 1. Each sub-strip respectively includes physical pages of P planes in the page strip, P is greater than 2N, Figure 15 taking P as 2N+1 as an example. Each plane in the N*M planes provides X physical pages for the page strip, and X is a positive integer.
[0241] The first sub-strip stores user data including the data to be read and two pieces of parity data corresponding to the user data obtained according to RAID6.
[0242] S1102. If the read request has an error, error correction data is calculated using the read data.
[0243] The error correction data is the data stored in the physical page where a read error occurs in the data to be read; the read data includes: other data in the user data read from the first sub-strip except the data stored in the physical page where a read error occurs and the parity data of the first sub-strip.
[0244] In a first possible design, if a read request encounters an error, error correction data is calculated using the read data, including: if the read request encounters an error and the error is a read error of a physical page from 1 plane, then first error correction data is calculated using first read data; wherein, the first error correction data is the data stored in the physical page with a read error among the data to be read; the first read data includes: other data in the user data read from the first sub-strip except for the data stored in the physical page with a read error and one of the two parity data.
[0245] In a second possible design, if a read request encounters an error, error correction data is calculated using the read data, including: if the read request encounters an error and the error is a read error of physical pages from 2 planes, then second error correction data is calculated using second read data; wherein, the second error correction data is the data stored in the physical page with a read error among the data to be read; the second read data includes: other data in the user data read from the first sub-strip except for the data stored in the physical page with a read error and the two parity data.
[0246] It can be seen that in Figure 16 the implementation shown, in each sub-strip, error correction can be performed on the user data in the physical pages of at most two planes. That is to say, every two parity data can correct at most two pieces of user data among 2N - 1 pieces of user data. In the related art, on the one hand, if the RAID5 at the LUN level shown in Figure 6 is used, it is impossible to perform error correction for the case where physical pages of the same numbered plane in different LUNs fail. For example, in Figure 16 if the RAID5 at the LUN level is used and plane 0 of LUN 0 and LUN 1 fails simultaneously, then error correction cannot be performed in the first sub-strip, while the above implementation can perform error correction; on the other hand, if the RAID6 at the LUN level shown in Figure 7 is used, there is a problem that the parity data needs to occupy more physical pages.
[0247] It should be noted that, in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising said element.
[0248] The above are only specific embodiments of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data writing method, characterized in that: The method comprises: Write user data into a first sub-strip; the first sub-strip is a part of a page stripe or one of a plurality of sub-strips included in a page stripe; the page stripe includes: physical pages from N*M planes, the N*M planes include M planes respectively included in each of N LUNs; each of the N*M planes provides X physical pages for the page stripe, where X is a positive integer; each of the sub-strips includes physical pages of P planes in the page stripe; N, M and P are respectively positive integers greater than 1, and P is greater than N; Determine two pieces of verification data corresponding to the user data; the two pieces of verification data are verification data corresponding to the user data obtained according to RAID6; The two copies of the check data are written into the first sub-strip, so that data errors of no more than 2 planes in the first sub-strip can be corrected by using the data stored in the first sub-strip.
2. The method according to claim 1, characterized in that in, P is greater than N, and P is less than 2N; wherein each of the sub-strips in the page stripe includes physical pages from P1 first planes and physical pages from P2 second planes; wherein, P=P1+P2, the P1 first planes include P1 planes with the same number from the P1 LUNs, the P2 second planes include P2 planes with the same number from the P2 LUNs, and the first plane and the second plane are numbered differently.
3. The method according to claim 1, characterized in that in, P = 2N; Each of the sub-strips in the page stripe includes physical pages from N first planes and physical pages from N second planes; wherein the N first planes and the N second planes respectively include N planes with the same number from the N LUNs, and the numbers between the first plane and the second plane are different.
4. The method according to claim 3, characterized in that In the first sub-strip, the two copies of the check data are stored in the physical pages of the third plane and the fourth plane respectively; the third plane and the fourth plane belong to the same LUN, the third plane and the first plane have the same number, and the fourth plane and the second plane have the same number.
5. The method according to claim 3, characterized in that: In the first sub-strip, the two copies of the check data are respectively stored in the physical pages of the fifth plane and the sixth plane; the fifth plane and the sixth plane are planes with the same number in different LUNs, the fifth plane and the sixth plane have the same number as the first plane, or the fifth plane and the sixth plane have the same number as the second plane.
6. The method according to claim 3, characterized in that: In the first sub-strip, the two copies of the check data are respectively stored in the physical pages of the seventh plane and the eighth plane; the seventh plane and the eighth plane are planes with different numbers in different LUNs, the seventh plane has the same number as the first plane, and the eighth plane has the same number as the second plane.
7. A data reading method, characterized in that: The method comprises: Obtaining a read request; the read request is used to instruct reading the to-be-read data in the first sub-strip; The first sub-strip is a part of the page stripe or one of the multiple sub-strips included in the page stripe; the page stripe includes: physical pages from N*M planes, the N*M planes include M planes respectively included in each LUN of N LUNs; each of the sub-strips includes physical pages of P planes in the page stripe; each plane in the N*M planes provides X physical pages for the page stripe, X is a positive integer; N, M and P are positive integers greater than 1, respectively, and P is greater than N; the first sub-strip stores user data including the data to be read and two copies of check data corresponding to the user data obtained according to RAID6; If an error occurs in the read request, error correction data is calculated using the read data; wherein the error correction data is data stored in a physical page where a read error occurs in the data to be read; the read data includes: other data in the user data read from the first sub-stripe except the data stored in the physical page where a read error occurs, and verification data of the first sub-stripe.
8. The method according to claim 7, characterized in that in, P is greater than N, and P is less than 2N; wherein each of the sub-strips in the page stripe includes physical pages from P1 first planes and physical pages from P2 second planes; wherein, P=P1+P2, the P1 first planes include P1 planes with the same number from the P1 LUNs, the P2 second planes include P2 planes with the same number from the P2 LUNs, and the first plane and the second plane are numbered differently.
9. The method according to claim 7, characterized in that: in, P = 2N; Each of the sub-strips in the page stripe includes physical pages from N first planes and physical pages from N second planes; wherein the N first planes and the N second planes respectively include N planes with the same number from the N LUNs, and the numbers between the first plane and the second plane are different.
10. A storage device, characterized in that: It comprises a controller and a non-volatile memory chip, wherein the controller is used to execute the method as claimed in any one of claims 1 to 6, or the controller is used to execute the method as claimed in any one of claims 7 to 9.