Page stripe processing method and device for power failure of solid state disk

By writing verification data when the storage device is powered off and adjusting the physical page data after powering on again, the data writing problem when the storage device is powered off is solved, and data reliability and resource utilization efficiency are improved.

CN120276911APending Publication Date: 2025-07-08MEMBLAZE TECH BEIJING
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510152305.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

When the storage device is powered off, how to effectively write page strip data to ensure verification effect and improve storage resource utilization efficiency, avoid large capacitance demand and waste of storage resources.

Method used

After the storage device powers off, determine the verification data corresponding to the written user data and write it to the target physical page. After the storage device powers up again, write the unwritten physical page to the data to make it consistent with the verification data of the user data, ensuring data reliability and resource utilization efficiency.

Benefits of technology

After the storage device is powered on again, it can respond to read operations immediately, avoid additional delays, reduce capacitor requirements, save storage resources, improve data reliability and verification effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276911A_ABST
    Figure CN120276911A_ABST
Patent Text Reader

Abstract

The invention relates to the field of storage, in particular to a page strip processing method and device for power failure of a solid state disk. The method comprises the following steps: determining first verification data corresponding to first user data written into a first page stripe after detecting that the storage equipment is powered down; writing the first verification data into a target physical page in the first page strip; the first page stripe further comprises one or more physical pages besides a physical page for storing the first user data and the target physical page; and after the storage device is powered on again, writing data into the one or more physical pages in the first page strip, so that verification data corresponding to the physical pages storing the first user data in the first page strip and the data in the one or more physical pages is the first verification data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage, and in particular, to a data storage method and apparatus for a power failure of a storage device. Background Art

[0002] Figure 1 A 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 a variety of ways, including but not limited to coupling the host and the solid-state storage device 102 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. 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] Common NVMs include NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), etc.

[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 transfer between 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 a variety of 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 also referred to as a media interface controller, a flash channel controller), and 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, the 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, the logical address is mapped to an intermediate address, and then the intermediate address is further mapped to a physical address.

[0008] The table structure that stores 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 units of data pages in the solid-state storage device.

[0009] The 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 IO 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 IO 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 IO commands and send them to the storage device. There are also multiple applications accessing the storage device and / or multiple operating systems (such as virtual machines) in the host, which causes the IO commands from multiple access parties to be interleaved, making the originally continuous address access become discontinuous.

[0011] Currently, in order to ensure that user data will not be lost when the storage device experiences abnormal power failure, a capacitor is often configured in the storage device. This capacitor is used to supply power to the storage device when the storage device experiences abnormal power failure, so that the storage device can write the data that has not been written yet.

[0012] In addition, in order to improve the reliability of the data stored in the storage device, currently, a Redundant Array of Inexpensive Disks (RAID) can be used to organize and protect the user data in the storage device. Thus, even if some of the user data in the storage device fails to be read, the failed user data can be recovered through the parity data generated by RAID.

[0013] Specifically, in the 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.

[0014] Among them, multiple physical pages can be combined into a page stripe. The page stripe includes physical pages storing user data and physical pages storing parity data. When writing data to the page stripe, the parity data in the page stripe can be obtained by calculating the user data written to the page stripe. In this way, when there is incorrect data in the page stripe, the incorrect data can be corrected based on other data in the page stripe, thereby realizing the protection of the data in the page stripe.

[0015] When the storage device experiences power failure, for the page stripe being written, how to write data to the page stripe so that, while minimizing the demand for the capacitor, both the parity effect of the page stripe and the efficient utilization of storage resources can be ensured is a problem that needs to be solved currently. Summary of the Invention

[0016] To solve the above technical problems, the present application provides a data storage method and apparatus for a power failure of a storage device.

[0017] In a first aspect, a data storage method for a power failure of a storage device is provided. The method includes: after detecting a power failure of the storage device, determining first check data corresponding to first user data written to a first page stripe among the plurality of page stripes; writing the first check data to a target physical page in the first page stripe; the first page stripe further includes one or more physical pages that have not been written with data in addition to the physical page storing the first user data and the target physical page; after the storage device is powered on again, writing data to the one or more physical pages in the first page stripe so that the check data corresponding to the data in the physical page storing the first user data and the one or more physical pages in the first page stripe is the first check data.

[0018] In some implementations, the determining, after detecting a power failure of the storage device, first check data corresponding to first user data written to a first page stripe includes: after detecting a power failure of the storage device, writing cached data to the first page stripe; determining first check data corresponding to first user data including the cached data written to the first page stripe.

[0019] In some implementations, after the storage device is powered on again, writing data to the one or more physical pages in the first page stripe includes: after the storage device is powered on again, writing a preset value to the one or more physical pages in the first page stripe so that the check data corresponding to the data in the physical page storing the first user data and the one or more physical pages in the first page stripe is the first check data.

[0020] In some implementations, the preset value is all 0.

[0021] In some implementations, after the storage device is powered on again, writing data to the one or more physical pages in the first page stripe includes: after the storage device is powered on again, writing second user data to the one or more physical pages so that the check data corresponding to the check data corresponding to the data in the physical page storing the first user data and the one or more physical pages in the first page stripe is the first check data.

[0022] In some implementations, writing the second user data into the one or more physical pages includes: if there are 2n physical pages in the first page strip, writing the second user data into the 2n physical pages twice, so that the exclusive OR result of the data in the 2n physical pages is all 0; where n is a positive integer, and the second user data includes data of n physical pages.

[0023] In some implementations, writing the second user data into the one or more physical pages includes: if there are 2n + 1 physical pages in the first page strip, writing the second user data into 2n of the 2n + 1 physical pages twice, and filling the physical page other than the 2n physical pages in the 2n + 1 physical pages with all 0s, so that the exclusive OR result of the data in the 2n + 1 physical pages is all 0; where n is a positive integer, and the second user data includes data of n physical pages.

[0024] In some implementations, writing the second user data into the one or more physical pages includes: repeatedly executing a first process until the one or more physical pages are exhausted or there is 1 remaining physical page among the one or more physical pages; the first process includes: writing the user data of the data volume of 1 physical page in the second user data into 2 of the one or more physical pages twice; if there is 1 remaining physical page among the one or more physical pages, filling the remaining 1 physical page with all 0s.

[0025] In some implementations, among the one or more physical pages, there are included: the physical pages storing the second user data and the physical pages filled with all 0s.

[0026] In some implementations, the method further includes: after the storage device is powered on again and before writing data into the one or more physical pages in the first page strip, obtaining a first read request; the first read request is used to indicate reading first data to be read included in the first user data; if an error occurs in the first read request, calculating first error correction data by using first read data; where the first error correction data is: the data stored in the first error physical page where an error occurs in the first data to be read; the first read data includes: the data read from the other physical pages except the first error physical page in the first part of physical pages; the first part of physical pages includes: the physical pages storing the first user data and the target physical page.

[0027] In some implementations, the method further includes: after writing data into the one or more physical pages in the first page strip, obtaining a second read request; the second read request is used to indicate reading second data to be read in the first page strip; the second data to be read includes: the first user data or user data stored in the one or more physical pages; if an error occurs in the second read request, calculating second error correction data by using second read data; wherein, the second error correction data is: data stored in a second error physical page with an error in the second data to be read; the second read data includes: data read from other physical pages in the first page strip except the second error physical page.

[0028] In some implementations, the method further includes: after writing data into the one or more physical pages in the first page strip, obtaining a third read request; the third read request is used to indicate reading third data to be read included in the first user data; if an error occurs in the third read request, calculating third error correction data by using third read data; wherein, the third error correction data is: data stored in a second error physical page with an error in the third data to be read; the third read data includes: data read from other physical pages in a first part of physical pages except the second error physical page; the first part of physical pages includes: physical pages storing the first user data and the target physical page.

[0029] In some implementations, the target physical page is a physical page in the first page strip that is pre-determined to store check data, and the target physical page does not need to be adjacent to the physical pages storing the first user data in the first page strip.

[0030] In some implementations, the method further includes: after the storage device is powered on again, if it is detected that the storage device powers off again when the one or more physical pages are written with some physical pages and the one or more physical pages are not completely written, writing the cached data into the one or more physical pages and no longer writing the target physical page.

[0031] In some implementations, the method further includes: in response to the physical pages storing user data in the second page strip among the multiple page strips being full, writing check data into the target physical page of the second page strip; wherein, the target physical page of the second page strip and the target physical page of the first page strip come from the same LUN.

[0032] Second aspect, a data storage method for power failure of a storage device is provided. The method includes: after detecting power failure of the storage device, determining first check data corresponding to first user data written to a first page stripe; writing the first check data to a target physical page in the first page stripe; in addition to the physical page storing the first user data and the target physical page in the first page stripe, there are also one or more physical pages not yet written with data; wherein, the target physical page is a physical page in the first page stripe determined in advance for storing check data, and the target physical page does not need to be adjacent to the physical page storing the first user data in the first page stripe.

[0033] In some implementation manners, the number of physical pages provided by the LUN where the target physical page is located for the first page stripe is not less than the number of physical pages provided by any LUN for the first page stripe.

[0034] In some implementation manners, the step of, after detecting power failure of the storage device, determining first check data corresponding to first user data written to a first page stripe includes: after detecting power failure of the storage device, writing cache data to the first page stripe; determining first check data corresponding to first user data including the cache data written to the first page stripe.

[0035] In some implementation manners, the method further includes: obtaining a first read request; the first read request is used to indicate reading first data to be read included in the first user data; if an error occurs in the first read request, calculating first error correction data using first read data; wherein, the first error correction data is: data stored in a first error physical page where an error occurs in the first data to be read; the first read data includes: data read from other physical pages except the first error physical page in a first part of physical pages; the first part of physical pages includes: the physical page storing the first user data and the target physical page.

[0036] Third aspect, a data storage method for power-on of a storage device is provided. The method includes: after the storage device is powered on, if a first part of physical pages of a first page stripe is written with data while a second part of physical pages is not written with data, and the first part of physical pages includes: the physical page storing first user data and the target physical page storing first check data corresponding to the first user data, then execute a second process; wherein, the second process includes: writing data to the second part of physical pages in the first page stripe so that the check data corresponding to the data in the second part of physical pages and the physical page storing the first user data in the first page stripe is the first check data.

[0037] In some implementations, after the storage device is powered on and before the second process is executed, the method further includes: obtaining a first read request; the first read request is used to indicate reading first data to be read included in the first user data; if an error occurs in the first read request, calculating first error correction data by using first read data; wherein, the first error correction data is: data stored in a first error physical page in which an error occurs in the first data to be read; the first read data includes: data read from other physical pages in a first part of physical pages except the first error physical page; the first part of physical pages includes: physical pages storing the first user data and the target physical page.

[0038] In some implementations, after the second process is executed, the method further includes: obtaining a second read request; the second read request is used to indicate reading second data to be read in the first page strip; the second data to be read includes: the first user data or user data stored in the one or more physical pages; if an error occurs in the second read request, calculating second error correction data by using second read data; wherein, the second error correction data is: data stored in a second error physical page in which an error occurs in the second data to be read; the second read data includes: data read from other physical pages in the first page strip except the second error physical page.

[0039] In some implementations, after the second process is executed, the method further includes: obtaining a third read request; the third read request is used to indicate reading third data to be read included in the first user data; if an error occurs in the third read request, calculating third error correction data by using third read data; wherein, the third error correction data is: data stored in a second error physical page in which an error occurs in the third data to be read; the third read data includes: data read from other physical pages in the first part of physical pages except the second error physical page.

[0040] In some implementations, writing data to the second part of physical pages in the first page strip includes: writing a preset value to the second part of physical pages in the first page strip, so that check data corresponding to data in the physical pages storing the first user data in the first page strip and the second part of physical pages is the first check data.

[0041] In some implementations, the preset value is all 0.

[0042] In some implementations, writing the second part of physical pages in the first page strip with data includes: writing second user data to the second part of physical pages, so that the check data corresponding to the data in the physical pages storing the first user data in the first page strip and the check data corresponding to the data in the second part of physical pages is the first check data.

[0043] In some implementations, writing the second user data to the second part of physical pages includes: if the second part of physical pages in the first page strip is 2n physical pages, writing the second user data twice to the 2n physical pages, so that the exclusive OR result of the data in the 2n physical pages is all 0; where n is a positive integer, and the second user data includes data of n physical pages.

[0044] In some implementations, writing the second user data to the second part of physical pages includes: if the second part of physical pages in the first page strip is 2n + 1 physical pages, writing the second user data twice to 2n of the 2n + 1 physical pages, and filling the physical page other than the 2n physical pages in the 2n + 1 physical pages with all 0s, so that the exclusive OR result of the data in the 2n + 1 physical pages is all 0; where n is a positive integer, and the second user data includes data of n physical pages.

[0045] In some implementations, writing the second user data to the one or more physical pages includes: repeatedly executing a first process until the second part of physical pages is exhausted or there is 1 physical page remaining in the second part of physical pages; the first process includes: writing the user data of the data volume of 1 physical page in the second user data twice to 2 physical pages in the second part of physical pages; if there is 1 physical page remaining in the second part of physical pages, filling the remaining 1 physical page with all 0s.

[0046] In some implementations, the second part of physical pages includes: the second user data and multiple physical pages filled with all 0s.

[0047] In some implementations, the target physical page is the physical page in the first page strip that is pre - determined to store check data, and the target physical page does not need to be adjacent to the physical pages storing the first user data in the first page strip.

[0048] In some implementations, the method further includes: if it is detected that the storage device loses power when some physical pages in the second part of physical pages are written and the second part of physical pages is not completely written, writing the cached data to the one or more physical pages and no longer writing to the target physical page.

[0049] In some implementations, the method further includes: in response to the physical page storing user data in the second page strip among the multiple page strips being full, writing check data to the target physical page of the second page strip; wherein, the target physical page of the second page strip and the target physical page of the first page strip come from the same LUN.

[0050] In a fourth aspect, a storage device is provided, including a controller and a non-volatile memory chip, and the controller is configured to execute the method according to the first aspect or any implementation manner in the first aspect or the second aspect or any implementation manner in the second aspect or the third aspect or any implementation manner in the third aspect as described above.

[0051] In a fifth aspect, a computer-readable storage medium is provided, and instructions are stored in the computer-readable storage medium, and when the instructions run on a processor, the method according to the first aspect or any implementation manner in the first aspect or the second aspect or any implementation manner in the second aspect or the third aspect or any implementation manner in the third aspect as described above is implemented.

[0052] In a sixth aspect, a computer program product is provided, and the computer program product includes instructions, and when the instructions run on a processor, the method according to the first aspect or any implementation manner in the first aspect or the second aspect or any implementation manner in the second aspect or the third aspect or any implementation manner in the third aspect as described above is implemented.

[0053] Through the technical solution provided by this application, on the one hand, before writing data to one or more physical pages in the first page strip, the first check data written to the target physical page can check the first user data in the first page strip; on the other hand, after writing data to one or more physical pages in the first page strip, the first check data written to the target physical page can also check the first user data in the first page strip and the data in one or more physical pages. Specifically, after the storage device is powered on again, if it is necessary to read the first user data stored in the first page strip, even if a read data error occurs, the error data can be reconstructed using the first check data, so that the user data of the first page strip that has not been completely written is protected, and its reliability is not affected and will not be reduced. Therefore, when the storage device is powered on, a read operation on the first page strip can be immediately responded to without introducing an additional delay for reconstructing intermediate state check data.

[0054] In the technical solution provided by the present application, on the one hand, the technical solution provided by the embodiments of the present application does not need to fill the page strip with useless data before the capacitance of the storage device is exhausted, so the demand for capacitance can be reduced and the waste of storage resources can be avoided; on the other hand, the method provided by the embodiments of the present application does not need to occupy too much SLC resource, so the processing flow can be simplified and SLC resources can be saved; on the other hand, in the method provided by the embodiments of the present application, even if an abnormal power failure occurs, after the first page strip is filled after the storage device is powered on again, only one copy of check data is stored, instead of storing multiple copies of check data, so the waste of storage resources can be avoided; on the other hand, in the method provided by the embodiments of the present application, the first check data can not only check the first user data in the first page strip, but also check the first user data in the first page strip and the data in one or more physical pages, so it has a better check effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.

[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use 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.

[0057] Figure 1 Schematic structural diagram of a storage device provided by an embodiment of the present application;

[0058] Figure 2 One of the schematic structural diagrams of a large block provided by an embodiment of the present application;

[0059] Figure 3 Another schematic structural diagram of a large block provided by an embodiment of the present application;

[0060] Figure 4 One of the schematic structural diagrams of a page strip provided by an embodiment of the present application;

[0061] Figure 5 One of the schematic flowcharts of a data storage method provided by an embodiment of the present application;

[0062] Figure 6 Another schematic flowchart of a data storage method provided by an embodiment of the present application;

[0063] Figure 7 Another schematic flowchart of a data storage method provided by an embodiment of the present application;

[0064] Figure 8 The fourth flowchart of a data storage method provided by an embodiment of the present application;

[0065] Figure 9 The fifth flowchart of a data storage method provided by an embodiment of the present application;

[0066] Figure 10 The sixth flowchart of a data storage method provided by an embodiment of the present application;

[0067] Figure 11 The third schematic diagram of the structure of a large block provided by an embodiment of the present application. Detailed implementation manners

[0068] In order to more clearly understand the above objects, features and advantages of the present application, the solution 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.

[0069] Many specific details are set forth in the following description 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 some embodiments of the present application, rather than all embodiments.

[0070] First, the related technologies involved in the embodiments of the present application are introduced:

[0071] 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.

[0072] 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 it is said that the granularity of the write command is 4 pages.

[0073] In some implementation manners, multiple LUNs may respectively provide physical blocks to form a superblock.

[0074] Exemplarily, as Figure 2As shown, taking the 16 LUNs from LUN 0 to LUN 15 as an example, one physical block can be selected from each of LUN 0 to LUN 15 to form a large block. For example, 16 physical blocks numbered "block 0" in LUN 0 to LUN 15 form large block 0, and 16 physical blocks numbered "block 1" in LUN 0 to LUN 15 form large block 1.

[0075] In some other implementation manners, one physical block can be provided by each plane in multiple LUNs to form a large block.

[0076] Exemplarily, as Figure 3 shown, taking the N LUNs from LUN 0 to LUNN as an example, each of the LUNs includes 4 planes. Figure 3 Taking LUN 1 as an example, the 4 planes (i.e., plane 0 to plane 3) included in LUN 1 are shown. The 4 planes in other LUNs from LUN 0 to LUNN can be understood in the same way. Furthermore, one physical block can be selected from each plane in LUN 0 to LUNN 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 LUNN 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 LUNN form large block 2.

[0077] When constructing page stripes in a large block, physical pages with the same page number in the physical blocks belonging to the same large block can be grouped to form page stripes.

[0078] For example Figure 2 in, among the 16 physical blocks included in large block 0, physical pages with page number P0 form page stripe 0, and physical pages with page number P2 form page stripe 2, and so on.

[0079] It can be understood that, it should be noted that in Figure 2Exemplarily, an example is given in which each physical block in a large block respectively outputs a physical page to construct a page strip. For example, block 0 in LUN 0 outputs a physical page P0-0, block 0 in LUN 1 outputs a physical page P0-1, and so on. In practical applications, multiple physical pages can also be respectively output from each physical block in the large block to construct a page strip. For example, physical pages P0-0, P1-0, and P2-0 (i.e., the physical pages in block 0 of LUN 0), physical pages P0-1, P1-1, and P2-1 (i.e., the physical pages in block 0 of LUN 1), until physical pages P0-x, P1-x, and P2-x (i.e., the physical pages in block 0 of LUN 15) can form a page strip. At this time, it can be understood that 3 physical pages are respectively output from each physical block in the large block to construct a page strip.

[0080] For another example Figure 3 In, among the N×4 physical blocks included in large block 0, the physical pages with the same page number can form a page strip (where 4 represents the number of planes), and so on. Specifically, among the N×4 physical blocks included in large block 0, each physical block can respectively provide a physical page to construct a page strip. At this time, a page strip can include N×4×1 physical pages; in addition, each physical block can also respectively provide multiple physical pages (denoted as x physical pages, x>1) to construct a page strip. At this time, a page strip can include N×4×x physical pages.

[0081] When constructing a page strip in a large block, a part of the physical blocks in the large block can be used to store user data, and another part of the physical blocks can be used to store parity data.

[0082] Exemplarily, taking the example that a large block includes N physical blocks from N LUNs, as Figure 4 shown in the large block includes physical blocks from N LUNs from LUN 0 to LUN N-1. Among them, the physical blocks from LUN N-4 are used to store parity data, and each physical page of this physical block stores parity data for each page strip.

[0083] In the related art, there are various methods to determine the physical blocks for storing parity data.

[0084] For example, for each large block, the physical blocks from a specific LUN are used to store parity data. Exemplarily, in Figure 4 shown, the physical blocks provided by LUN N-4 store parity data in all large blocks. For another example, for different large blocks, the physical blocks for storing parity data are provided in turn according to the LUN number. Exemplarily, when the number of the large block is i, the physical block provided by LUN i / N is selected to store parity data. Methods for selecting physical blocks for storing parity data are also provided in Chinese patents CN107807788B and CN112181276B.

[0085] In a scenario where a large block is formed by each plane in multiple LUNs providing one physical block respectively, physical blocks from planes with the same number in different LUNs in the large block can form a block stripe. For example Figure 3 in, for large block 0: N physical blocks (i.e., N physical blocks B00) from plane 0 in N LUNs form a block stripe, N physical blocks (i.e., N physical blocks B10) from plane 1 in N LUNs form a block stripe, N physical blocks (i.e., N physical blocks B20) from plane 2 in N LUNs form a block stripe, and N physical blocks (i.e., N physical blocks B30) from plane 3 in N LUNs form a block stripe.

[0086] Among them, physical pages with the same address in the block stripe form a sub - stripe in the page stripe. Taking Figure 3 large block 0 in as an example, if each physical block in large block 0 provides one physical page respectively to construct the page stripe, at this time a page stripe can include N×4×1 physical pages, then a page stripe can include 4 sub - stripes. Specifically, in a page stripe, physical pages of physical block B00 from each LUN form a sub - stripe, physical pages of physical block B10 from each LUN form a sub - stripe, physical pages of physical block B20 from each LUN form a sub - stripe, and physical pages of physical block B30 from each LUN form a sub - stripe, a total of 4 sub - stripes.

[0087] Among them, parity data can be calculated separately for each sub - stripe. For example Figure 3In the large block 0, on the one hand, in the physical pages of the physical blocks B00 from each LUN, each physical page in the physical block B00 of LUNN stores the parity data calculated from the user data in the sub-strip where the physical page is located (the user data in the sub-strip where the physical page is located is stored in the physical pages of the physical blocks B00 from LUN 0 to LUNN-1). On the other hand, in the physical pages of the physical blocks B10 from each LUN, each physical page in the physical block B10 of LUNN stores the parity data calculated from the user data in the sub-strip where the physical page is located (the user data in the sub-strip where the physical page is located is stored in the physical pages of the physical blocks B10 from LUN 0 to LUNN-1). On the one hand again, in the physical pages of the physical blocks B20 from each LUN, each physical page in the physical block B20 of LUNN stores the parity data calculated from the user data in the sub-strip where the physical page is located (the user data in the sub-strip where the physical page is located is stored in the physical pages of the physical blocks B20 from LUN 0 to LUNN-1). On the one hand further, in the physical pages of the physical blocks B30 from each LUN, each physical page in the physical block B30 of LUNN stores the parity data calculated from the user data in the sub-strip where the physical page is located (the user data in the sub-strip where the physical page is located is stored in the physical pages of the physical blocks B30 from LUN0 to LUNN-1).

[0088] Considering that there may be bad blocks in the LUN, which may lead to different numbers of physical blocks provided by multiple LUNs that make up the large block. At this time, multiple block stripes in the large block may include different numbers of physical blocks. To effectively record the parity data, the LUN that provides the largest number of physical blocks for the large block can be selected, and the physical blocks it provides for each block stripe of the large block are used as the physical blocks for storing the parity data, so as to ensure that the parity data can always be written into the page stripe.

[0089] The following introduces the processing methods of related technologies when the storage device experiences abnormal power failure:

[0090] In the first related technology, when the storage device experiences abnormal power failure, the user data in the cache can be first written into the page stripe, then the physical pages in the page stripe that have not been written with data are filled with useless data, and then the parity data corresponding to the page stripe is calculated and written into the physical page in the page stripe for storing the parity data.

[0091] Through the first related technology described above, although the verification effect of page stripes can be ensured, that is, the user data can be verified using the verification data in the page stripes, it is necessary to fill the page stripes with useless data before the capacitance of the storage device is exhausted. In extreme cases, it may occur that the useless data approaches the entire page stripe. Therefore, this related technology has problems of large capacitance requirements and waste of storage resources.

[0092] In the second related technology, when the storage device experiences abnormal power failure, the writing of the page stripe can be paused, and instead, the verification data (referred to as intermediate-state verification data) can be calculated based on the cached data and the user data already written to the page stripe, and then the cached data and the intermediate-state verification data are written into the single-level cell (SLC) of the NAND flash memory. When the storage device is powered on again, the above-mentioned cached data and intermediate-state verification data are read from the SLC, the intermediate-state verification data is restored to the verification data buffer, and the cached data is continuously written into the prepared page stripe. When a write command is received subsequently, the user data carried by the write command is written into the page stripe, and the user data of the write command and the intermediate-state verification data in the verification data buffer are left-operated to update the intermediate-state verification data. Until all the physical pages storing user data in the page stripe are written full, the verification data of the page stripe is obtained in the verification data buffer, and then the verification data is written into the physical page storing the verification data of the page stripe.

[0093] Through the second related technology described above, although the capacitance requirement of the storage device can be reduced, there are problems of complex processing flow and the need to occupy SLC resources.

[0094] In the third related technology, in the technical solution provided by Chinese Patent CN113391947B, when the storage device loses power, the intermediate-state verification data of the page stripe that has not been completely written is written into the physical page storing the user data of the page stripe, and then after the storage device is powered on, the verification data buffer of the page stripe that has not been completely written is initialized with all 0s as the new intermediate-state verification data, so that the subsequent newly written data can be XORed with the intermediate-state verification data (all 0s) in the verification data buffer to update the intermediate-state verification data.

[0095] Through the above-mentioned third related technology, although it is not necessary to write extra useless data to the page strip when power failure occurs and the recovery of the intermediate state verification data is relatively simple after power-on, in this related technology, it is necessary to record the intermediate state verification data in the page strip when the device loses power. Therefore, after the page strip is completely written, multiple versions of verification data (including intermediate state verification data and final verification data) will be stored on the page strip, increasing the data writing volume to the NAND flash memory, which is not conducive to the lifespan of the storage device. Moreover, since power failure occurs randomly, the physical pages of the intermediate state verification data may come from bad blocks, thus affecting the storage of the intermediate state verification data, that is, affecting the verification effect.

[0096] In the fourth related technology, in the technical solution of Chinese Patent CN110275596B, when power failure occurs, the intermediate state verification data is directly discarded, and after power-on, the user data is read from the page strip that has not been completely written, and the intermediate state verification data is recalculated based on the user data and filled into the verification data buffer.

[0097] Through the above-mentioned fourth related technology, although it is possible to avoid writing too much redundant data to the NAND flash memory, it takes a long time to recover the intermediate state verification data when power-on, and before the reconstruction of the intermediate state verification data is completed, the user data on the page strip that has not been completely written is not protected by RAID. If a read data error occurs at this time, the RAID technology cannot be used to reconstruct the error data.

[0098] To solve the technical problems existing in the above-mentioned related technologies, an embodiment of the present application provides a data storage method for power failure of a storage device. Specifically, as Figure 5 shown, this method can include the following S201 - S203:

[0099] S201. After the storage device detects that the storage device loses power, determine the first verification data corresponding to the first user data written to the first page strip.

[0100] Among them, the first page strip can be a page strip in the storage device that is being written with data and not full. Exemplarily, as shown in (a) of Figure 6 , the first page strip may include physical pages P-0 to P-11. Among them, the user data (i.e., the first user data) that has been written to the first page strip is stored in physical pages P-0 to P-5.

[0101] Among them, the first verification data can be the first user data calculated using RAID5.

[0102] Taking Figure 6 the (a) of as an example, the first verification data can be the calculation result of Equation (1):

[0103] (P - 0) XOR (P - 1) XOR (P - 2) XOR (P - 3) XOR (P - 4) XOR (P - 5), Equation (1)

[0104] Wherein, P - 0 to P - 5 represent the user data stored in physical pages P - 0 to P - 5, and XOR represents the exclusive - OR operation.

[0105] S202. The storage device writes the first check data into the target physical page in the first page stripe.

[0106] Wherein, in addition to the physical page storing the first user data and the target physical page in the first page stripe, the first page stripe further includes one or more physical pages.

[0107] Exemplarily, as shown in (b) of Figure 6 the storage device writes the first check data into physical page P - 8 (i.e., the target physical page in the first page stripe). Wherein, in addition to the physical page storing the first user data and the target physical page in the first page stripe, the first page stripe further includes physical pages P - 6, P - 7, P - 9, P - 10, and P - 11 (i.e., the above - mentioned one or more physical pages).

[0108] In some implementation manners, the target physical page is the physical page in the first page stripe that is pre - determined to store the check data, and the target physical page does not need to be adjacent to the physical page storing the first user data in the first page stripe.

[0109] For example, in the actual application process, the storage device can use the method of selecting the physical block for storing the check data provided in the related technology (such as the methods provided in Chinese patents CN107807788B and CN112181276B) to determine the physical page for storing the check data in the first page stripe, and then write the first check data into the target physical page in the first page stripe.

[0110] In some implementation manners, after writing the first check data into the target physical page in the first page stripe, the storage device can also record the first page stripe that is not completely written, and which physical pages from which LUNs in the first page stripe are not written with data, for identification when powering on.

[0111] Optionally, in the first page stripe, the physical pages not written with data present a special state when read, so that by reading data from the physical pages, it can be identified that they are in the unwritten state, and it can also be identified which physical pages from which LUN or LUNs in the page stripe are not written with data, so that information about the page stripe that is not completely written does not need to be recorded when powering off.

[0112] After writing the first check data into the first page stripe, the storage device can be turned off without filling the first page stripe with data before the storage device is turned off.

[0113] S203. After the storage device is powered on again, one or more physical pages in the first page stripe are written with data, so that the parity data corresponding to the data in the physical page storing the first user data in the first page stripe is the first parity data.

[0114] Exemplarily, as shown in (c) of Figure 6 After the storage device is powered on again, physical pages P-6, P-7, P-9, P-10, and P-11 in the first page stripe are written with data. Among them, the parity data corresponding to the data in the physical page storing the first user data in the first page stripe and the data in one or more physical pages (i.e., the data in physical pages P-0 to P-7 and P-9 to P-11) is the first parity data.

[0115] In other words, in the embodiments of the present application, on the one hand, before writing data to one or more physical pages in the first page stripe, the first parity data written to the target physical page can be used to verify the first user data in the first page stripe; on the other hand, after writing data to one or more physical pages in the first page stripe, the first parity data written to the target physical page can also be used to verify the first user data in the first page stripe and the data in one or more physical pages. Specifically, after the storage device is powered on again, if it is necessary to read the first user data stored in the first page stripe, even if a read data error occurs, the first parity data can be used to reconstruct the error data, so that the user data of the first page stripe that has not been completely written is protected, and its reliability is not affected and will not be reduced. Therefore, when the storage device is powered on, the read operation on the first page stripe can be immediately responded to without introducing an additional delay for reconstructing the intermediate state parity data.

[0116] It can be seen that compared with the first related art above, the method provided by the embodiments of the present application does not need to fill the page stripe with useless data before the capacitance of the storage device is exhausted, so the demand for capacitance can be reduced and the waste of storage resources can be avoided; compared with the second related art above, the method provided by the embodiments of the present application does not need to occupy too much SLC resource, so the processing flow can be simplified and the SLC resource can be saved; compared with the third related art above, in the method provided by the embodiments of the present application, even if an abnormal power failure occurs and the first page stripe is full after the storage device is powered on again, only one copy of parity data is stored, and multiple copies of parity data are not stored, so the waste of storage resources can be avoided; compared with the fourth related art above, in the method provided by the embodiments of the present application, the first parity data can be used to verify both the first user data in the first page stripe and the first user data in the first page stripe and the data in one or more physical pages, so it has a better verification effect.

[0117] It should be noted that, in order to simplify the description in the embodiments of the present application, the "first part of physical pages" may also be used to represent the physical pages storing the first user data and the target physical pages storing the first parity data in the first page stripe, and the "second part of physical pages" may be used to represent the other physical pages in the first page stripe except the first part of physical pages. In other words, the first part of physical pages includes the physical pages storing the first user data and the target physical pages storing the first parity data in the first page stripe; the second part of physical pages includes the other physical pages in the first page stripe except the first part of physical pages (i.e., the above one or more physical pages), and it can also be understood that the second part of physical pages includes the physical pages in the first page stripe that have not been written with data when the storage device is powered off and shut down.

[0118] In some implementation manners, such as Figure 7 shown, the above S201 may specifically include:

[0119] S2011. After detecting that the storage device is powered off, the storage device writes the cached data into the first page stripe.

[0120] For example, when the storage device is powered off, if there is still cached data in the cache of the storage device that has not been written, the storage device may continue to write the current cached data into the page stripe (i.e., the first page stripe).

[0121] Optionally, if the cached data is not enough to fill the physical page size or the data of multiple physical pages required by the write command granularity, a small amount of invalid data may be added to fill the write command granularity. It should be understood that here it is not to fill the first page stripe, but to fill the physical page size or the data of multiple physical pages required by the write command granularity.

[0122] S2012. The storage device determines the first parity data corresponding to the first user data including the cached data that has been written into the first page stripe.

[0123] Specifically, after writing the cached data into the first page stripe, the parity data (for example, performing an exclusive OR operation) may be calculated according to the first user data including the cached data that has been written into the first page stripe to obtain the first parity data. It can be understood that in the actual application process, the process of calculating the parity data may occur synchronously with the process of writing data into the page stripe, rather than starting to calculate after the power-off. Therefore, regardless of whether a power-off occurs, the process of calculating the parity data can occur synchronously when the process of writing data into the page stripe is executed. Therefore, in the embodiments of the present application, if there is no cached data to be written into the first page stripe when the storage device is powered off, the content of S2011-S2012 may not be executed.

[0124] The implementation process of the above S203 will be introduced below in two implementation manners:

[0125] In the first implementation, as Figure 8 shown, S203 may specifically include:

[0126] S203a. After the storage device is powered on again, the storage device writes one or more physical pages in the first page stripe with a preset value, so that the check data corresponding to the data in the physical pages storing the first user data in the first page stripe is the first check data.

[0127] Among them, in some designs, the above preset value may be all 0.

[0128] Specifically, considering that: the result of performing an exclusive OR operation between 0 and a value is the value itself, so the preset value can be set to all 0, that is, after the storage device is powered on again, the storage device writes one or more physical pages in the first page stripe with all 0. In this way, when using RAID5 for data verification, the check data corresponding to the data in the physical pages storing the first user data in the first page stripe can be the first check data.

[0129] It can be understood that the difference between the above design and Chinese Patent CN110275596B is that: in the above design, the intermediate state check data (i.e., the first check data) of the first page stripe is written into the page stripe during power-off, so that the first page stripe is always protected by RAID5, and when powered on, the remaining physical pages in the first page stripe are filled with all 0 data, and the check data of the first page stripe does not need to be changed when filling the data (while in the solution of Chinese Patent CN110275596B, after power-off, the page stripe does not satisfy the check relationship of RAID5, and when powered on, the page stripe is filled with arbitrary data, and the check data of the page stripe needs to be regenerated).

[0130] Through the above design, on the one hand, after the storage device is powered on again, the first page stripe can be filled as soon as possible, avoiding the first page stripe being in an unfilled state for a long time, so as to meet the requirements of NAND flash for data reliability; on the second hand, by writing all 0s to one or more physical pages in the first page stripe, the first page stripe written completely can still meet the requirements of RAID5; on the third hand, since all the data of the first page stripe still meets the requirements of RAID5, when any data in the first page stripe goes wrong, the existing RAID5 process for reconstructing the wrong data can still be used, and the wrong data can be reconstructed by reading out all other data except the wrong data. That is, when dealing with a read error, there is no need to identify whether the page stripe where the error occurs belongs to the page stripe filled with all 0s or the page stripe written completely normally, and the same RAID5 reconstruction process is used to reconstruct the wrong data, so it does not affect the normal processing process when a read error occurs; on the fourth hand, after the storage device is powered on, during the process of writing all 0 data to the first page stripe, if the storage device receives a read command, even if the read command is to access the user data (i.e., the first user data) in the first page stripe, the read command can be processed normally. Even if the read command reads an error, the first check data in the target physical page of the first page stripe can be used to reconstruct the wrong data. During this process, if the storage command receives a write command, physical pages can be allocated from other blank page stripes to carry the written data, so that the process of writing all 0 data to the first page stripe does not affect the storage device's processing of write commands even if it is not completed.

[0131] In some other designs, after the storage device is powered on again, the preset value written to the one or more physical pages in the first page stripe can also be other values than all 0s, as long as the exclusive OR result of all the filled data is all 0. For example, if the number of one or more physical pages to be filled is even, the same arbitrary data (not limited to all 0s) can be filled into these physical pages, and the exclusive OR result of these filled data is all 0. Another example, if the number of one or more physical pages to be filled is 2n + 1, the same arbitrary data (not limited to all 0s) can be filled into 2n of these physical pages, and all 0s can be filled into the remaining 1 physical page, so as to ensure that the exclusive OR result of these 2n + 1 physical pages is all 0.

[0132] In the second implementation manner, as Figure 9 shown, S203 may specifically include:

[0133] S203b. After the storage device is powered on again, the storage device writes the second user data to one or more physical pages so that the check data corresponding to the data in the physical pages storing the first user data in the first page stripe and the check data corresponding to the one or more physical pages is the first check data.

[0134] Among them, in the first design, S203b includes:

[0135] S203b1. After the storage device is powered on again, if one or more physical pages in the first page strip are 2n physical pages, the storage device writes the second user data twice into the 2n physical pages, so that the exclusive-or result of the data in the 2n physical pages is all 0.

[0136] Among them, n is a positive integer, and the second user data includes data of n physical pages.

[0137] Through the above design, when the storage device performs data verification using RAID5, after writing the second user data twice into 2n physical pages, the first page strip can still meet the requirements of RAID5, and the carried second user data is also protected by RAID5. In addition, this design can also reduce the amount of invalid data filled into the first page strip and improve the storage space utilization rate.

[0138] Among them, in the second design, S203b includes:

[0139] S203b2. After the storage device is powered on again, if the one or more physical pages in the first page strip are 2n + 1 physical pages, the storage device writes the second user data twice into 2n of the 2n + 1 physical pages, and fills the physical page other than the 2n physical pages in the 2n + 1 physical pages with all 0s, so that the exclusive-or result of the data in the 2n physical pages is all 0.

[0140] Among them, n is a positive integer, and the second user data includes data of n physical pages.

[0141] Through the above design, when the storage device performs data verification using RAID5, after writing data into one or more physical pages, the first page strip can still meet the requirements of RAID5, and the carried second user data is also protected by RAID5.

[0142] Among them, in the third design, S203b includes:

[0143] S203b3. The storage device repeatedly executes the first process until one or more physical pages are exhausted or there is 1 physical page remaining in one or more physical pages. If there is 1 physical page remaining in one or more physical pages, the storage device fills the remaining 1 physical page with all 0s.

[0144] Among them, the first process includes: writing the user data with the data volume of 1 physical page in the second user data twice into 2 of the one or more physical pages.

[0145] In addition, in the fourth design, one or more of the above physical pages may include physical pages storing second user data and a plurality of physical pages filled with all 0s. Different from the above first three designs: in this fourth design, one or more of the above physical pages may include more than one physical page filled with all 0s.

[0146] In some implementations, after the storage device is powered on again, if it is detected that the storage device is powered off again when one or more physical pages are partially written and one or more physical pages are not fully written, the cached data is written to one or more physical pages, and the target physical page is no longer written.

[0147] In some implementations, in response to the physical page storing user data in the second strip of multiple page strips being full, parity data is written to the target physical page of the second strip. Among them, the target physical page of the second strip and the target physical page of the first strip come from the same LUN.

[0148] In the case of storing data according to the content of S201 - S203 above, the process of reading data from the storage device is introduced below. Specifically, in the first implementation, the method may further include:

[0149] S211. After the storage device is powered on again and before writing data to one or more physical pages in the first strip, a first read request is obtained.

[0150] Among them, the first read request is used to indicate reading first data to be read included in the first user data.

[0151] S212. If the first read request has an error, first error correction data is calculated using the first read data.

[0152] Among them, the first error correction data is: the data stored in the first error physical page where an error occurs in the first data to be read; the first read data includes: the data read from other physical pages except the first error physical page in the first partial physical pages; the first partial physical pages include: the physical pages storing the first user data and the target physical page.

[0153] In the second implementation, the method may further include:

[0154] S221. After writing data to one or more physical pages in the first strip, a second read request is obtained.

[0155] The second read request is used to indicate reading second data to be read in the first strip; the second data to be read includes: the first user data or the user data stored in one or more physical pages.

[0156] S222. If an error occurs in the second read request, calculate second error correction data using the second read data.

[0157] Among them, the second error correction data is: the data stored in the second error physical page where an error occurs in the second data to be read; the second read data includes: the data read from other physical pages in the first page strip except the second error physical page.

[0158] In the third implementation manner, the method may further include:

[0159] S231. After writing data to one or more physical pages in the first page strip, obtain a third read request.

[0160] The third read request is used to indicate reading third data to be read included in the first user data.

[0161] S233. If an error occurs in the third read request, calculate third error correction data using the third read data.

[0162] Among them, the third error correction data is: the data stored in the second error physical page where an error occurs in the third data to be read; the third read data includes: the data read from other physical pages in the first part of physical pages except the second error physical page; the first part of physical pages includes: the physical pages storing the first user data and the target physical page.

[0163] Next, Figure 10 Taking the data writing process of page strip b in the large block S1 shown as an example, the implementation process of the data storage method for power failure of the storage device provided in the embodiments of the present application will be introduced.

[0164] Specifically, Figure 10 The large block S1 includes physical blocks from N LUNs from LUN 0 to LUNN - 1. Among them, it is assumed that the physical block from LUNN - 4 is used to store check data, and each physical page of this physical block stores check data for each page strip.

[0165] Among them, as shown in (a) of Figure 10 , the page strip a in the large block S1 has been completely written, and the page strip b has not been completely written. At this time, if a power failure of the storage device occurs, the method may include:

[0166] S301. After the storage device detects a power failure of the storage device, determine the first check data corresponding to the first user data written to the page strip b.

[0167] For example, the storage device may perform an exclusive OR operation on the user data (i.e., the first user data) in the physical pages from LUN 0 to LUN4 in the page strip b to obtain the first check data.

[0168] Among them, before determining the first check data, the storage device may first write the cached data into page strip b, and then determine the first check data corresponding to the first user data including the cached data in page strip b.

[0169] S302. The storage device writes the first check data into the target physical page from LUNN-4 in page strip b.

[0170] Among them, as Figure 10 shown in (b) of, in page strip b, in addition to the physical pages storing the first user data (i.e., the physical pages from LUN 0 to LUN 5) and the physical pages from LUNN-4, there are also one or more physical pages (i.e., the physical pages from LUN 5 to LUNN-5, LUNN-3 to LUNN-1).

[0171] In some implementation manners, the target physical page is the physical page for storing check data in the pre-determined first page strip, and the target physical page does not need to be adjacent to the physical page storing the first user data in the first page strip.

[0172] S303. After the storage device is powered on again, the storage device writes data into one or more physical pages (i.e., the physical pages from LUN 5 to LUNN-5, LUNN-3 to LUNN-1) in page strip b, so that the check data corresponding to the data in the physical pages from LUN 0 to LUNN-5, LUNN-3 to LUNN-1 in page strip b is the first check data.

[0173] In some implementation manners, S303 may specifically include:

[0174] S303a. After the storage device is powered on again, the storage device writes a preset value into one or more physical pages in page strip b, so that the check data corresponding to the data in the physical pages from LUN 0 to LUNN-5, LUNN-3 to LUNN-1 in page strip b is the first check data.

[0175] Among them, the preset value may be all 0.

[0176] In some other implementation manners, S303 may specifically include:

[0177] S303b. After the storage device is powered on again, the storage device writes the second user data into one or more physical pages, so that the check data corresponding to the data in the physical pages storing the first user data and the one or more physical pages in page strip b is the first check data.

[0178] Among them, in the first design, S303b may specifically include:

[0179] S303b1. After the storage device is powered on again, if one or more physical pages in page strip b are 2n physical pages, write the second user data twice into the 2n physical pages so that the exclusive OR result of the data in the 2n physical pages is all 0.

[0180] Where n is a positive integer, and the second user data includes data of n physical pages.

[0181] In the second design, S303b may specifically include:

[0182] S303b2. After the storage device is powered on again, if one or more physical pages in page strip b are 2n + 1 physical pages, write the second user data twice into 2n of the 2n + 1 physical pages, and fill the physical page other than the 2n physical pages in the 2n + 1 physical pages with all 0s so that the exclusive OR result of the data in the 2n + 1 physical pages is all 0.

[0183] Where n is a positive integer, and the second user data includes data of n physical pages.

[0184] In the third design, S303b includes:

[0185] S303b3. The storage device repeatedly executes the first process until one or more physical pages in page strip b are exhausted or one or more physical pages remain 1 physical page. If one or more physical pages remain 1 physical page, the storage device fills the remaining 1 physical page with all 0s.

[0186] Where the first process includes: writing the user data of the data volume of 1 physical page in the second user data twice into 2 of the one or more physical pages in page strip b.

[0187] In addition, in the fourth design, one or more physical pages in the above page strip b may include physical pages storing the second user data and multiple physical pages filled with all 0s. Different from the above three designs: in this fourth design, one or more physical pages in the above may include more than one physical page filled with all 0s.

[0188] In some implementation manners, after the storage device is powered on again, if it is detected that the storage device is powered off again when one or more physical pages are written with partial physical pages and one or more physical pages are not fully written, write the cached data into one or more physical pages and no longer write the target physical page.

[0189] In some implementations, in response to the physical page storing user data in the second page strip among multiple page strips being filled, parity data is written to the target physical page of the second page strip. Among them, the target physical page of the second page strip and the target physical page of the first page strip come from the same LUN.

[0190] In the case of storing data according to the content of S301 - S303 above, the process of reading data from the storage device will be introduced below. Specifically, in the first implementation, the method may further include:

[0191] S311. After the storage device is powered on again and before writing data to one or more physical pages in page strip b, a first read request is obtained.

[0192] Among them, the first read request is used to indicate reading the first data to be read included in the first user data.

[0193] S312. If an error occurs in the first read request, first error correction data is calculated using the first read data.

[0194] Among them, the first error correction data is: the data stored in the first error physical page where an error occurs in the first data to be read; the first read data includes: the data read from other physical pages in the first part of physical pages except the first error physical page; the first part of physical pages includes: the physical pages storing the first user data in page strip b and the target physical page.

[0195] In the second implementation, the method may further include:

[0196] S321. After writing data to one or more physical pages in page strip b, a second read request is obtained.

[0197] The second read request is used to indicate reading the second data to be read in page strip b; the second data to be read includes: the first user data or the user data stored in one or more physical pages.

[0198] S322. If an error occurs in the second read request, second error correction data is calculated using the second read data.

[0199] Among them, the second error correction data is: the data stored in the second error physical page where an error occurs in the second data to be read; the second read data includes: the data read from other physical pages in page strip b except the second error physical page.

[0200] In the third implementation, the method may further include:

[0201] S331. After writing data to one or more physical pages in page strip b, a third read request is obtained.

[0202] The third read request is used to indicate reading third data to be read included in the first user data.

[0203] S333. If an error occurs in the third read request, the third error correction data is calculated using the third read data.

[0204] Among them, the third error correction data is: the data stored in the second error physical page with an error in the third data to be read; the third read data includes: the data read from other physical pages except the second error physical page in the first part of physical pages; the first part of physical pages includes: the physical pages storing the first user data in the page strip b and the target physical page.

[0205] Next, Figure 11 taking the data writing process of the page strip b in the large block S2 shown as an example, the implementation process of the data storage method for power failure of the storage device provided by the embodiments of the present application will be introduced.

[0206] Specifically, Figure 11 the large block S2 includes physical blocks from N LUNs from LUN 0 to LUNN - 1. Among them, each LUN includes 4 planes, and each plane in the N LUNs provides a physical block for the large block S2, that is, the large block S2 includes N×4 physical blocks.

[0207] Among them, in the large block S, the physical pages in the first row form the page strip a, and the page strip a includes 4 sub - strips (denoted as sub - strip 0 - sub - strip 3). Among them, the physical pages of sub - strip i come from planei / 4 of each LUN. For example, the physical pages of sub - strip 0 come from plane 0 of each LUN, the physical pages of sub - strip 1 come from plane 1 of each LUN, the physical pages of sub - strip 2 come from plane 2 of each LUN, and the physical pages of sub - strip 3 come from plane 3 of each LUN.

[0208] The physical pages in the second row of the large block S2 form the page strip b, and the page strip b includes 4 sub - strips (denoted as sub - strip 4 - sub - strip 7). Among them, the physical pages of sub - strip i come from planei / 4 of each LUN. For example, the physical pages of sub - strip 4 come from plane 0 of each LUN, the physical pages of sub - strip 5 come from plane 1 of each LUN, the physical pages of sub - strip 6 come from plane 2 of each LUN, and the physical pages of sub - strip 7 come from plane 3 of each LUN.

[0209] Based on the Multi Plane Program operation, 4 physical pages from 4 planes in the same LUN located in the same row can be written with data simultaneously, and these 4 physical pages belong to 4 sub - strips.

[0210] Among them, since the 4 physical blocks provided by LUN 2 for the large block S2 are all good blocks, the physical blocks provided by LUN 2 for the large block S2 can be selected to store the parity data of the page stripe. In Figure 11 In the state shown, the page stripe a has been completely written, and the final parity data is stored in the physical pages provided by LUN 2 for the page stripe a, that is, the final parity data is stored in the physical pages P02, P12, P22, and P32. The first digit represents the sub-stripe to which it belongs, and the second digit represents the LUN from which it comes. For example, the physical page P02 stores the parity data of sub-stripe 0 in the page stripe a, the physical page P12 stores the parity data of sub-stripe 1 in the page stripe a, the physical page P22 stores the parity data of sub-stripe 2 in the page stripe a, and the physical page P32 stores the parity data of sub-stripe 3 in the page stripe a.

[0211] In addition, in Figure 11 In the state shown, the physical blocks (i.e., physical pages P11, P51, etc.) provided by Plane1 of LUN 1 for the large block S2 are bad blocks. In Figure 11 In the state shown, the page stripe b is not completely written. For the page stripe b, the physical pages from LUN 0 have been written with data (i.e., D0 - D3), and the other physical pages have not been written with data.

[0212] In Figure 11 In the state shown, if a power failure of the storage device occurs, the method provided by the embodiment of the present application may include:

[0213] S401. After detecting the power failure of the storage device, the storage device determines the first parity data corresponding to the first user data written in the page stripe b.

[0214] Specifically, the first user data may include: the user data written in sub-stripe 4 of the page stripe b (i.e., the user data written in the physical page of plane 0 in LUN0, hereinafter referred to as user data D0), the user data written in sub-stripe 5 of the page stripe b (i.e., the user data written in the physical page of plane 1 in LUN0, hereinafter referred to as user data D1), the user data written in sub-stripe 6 of the page stripe b (i.e., the user data written in the physical page of plane 2 in LUN0, hereinafter referred to as user data D2), and the user data written in sub-stripe 7 of the page stripe b (i.e., the user data written in the physical page of plane 3 in LUN0, hereinafter referred to as user data D3).

[0215] In addition, the first parity data may include: the parity data C0, parity data C1, parity data C2, and parity data C3 obtained by calculating the parity data for the user data D0, user data D1, user data D2, and user data D3 respectively.

[0216] S402. The storage device writes the first check data into the target physical page from LUN 2 in the page strip b.

[0217] In some implementations, the target physical page is the physical page in the first page strip pre-determined for storing check data, and the target physical page does not need to be adjacent to the physical page storing the first user data in the first page strip.

[0218] Specifically, the storage device can write the check data C0 of the user data D0 in the first check data into the physical page P42; write the check data C1 of the user data D1 in the first check data into the physical page P52; write the check data C2 of the user data D2 in the first check data into the physical page P62; write the check data C3 of the user data D3 in the first check data into the physical page P72.

[0219] Among them, the physical blocks provided by LUN 2 can be the physical blocks pre-specified for storing check data. Therefore, by writing the first check data into the physical pages from LUN 2 in the page strip b, it can be ensured that the physical pages provided by LUN 2 for the page strip b are sufficient to store all the current intermediate check data (i.e., the first check data), and there will be no lack of sufficient physical pages to accommodate the intermediate check data due to encountering bad blocks. Compared with the solution in CN113391947B, in the case of Figure 11 it will write the intermediate state check data into the physical page currently storing the user data, that is, the physical page provided by LUN 1 for the page strip b. However, since the physical page P51 comes from a bad block and cannot be written with data, the intermediate state check data cannot be written into the page strip, or additional complex processing is required, and additional processing is also required to identify the storage location of the intermediate state check data in each page strip.

[0220] S403. After the storage device is powered on again, the storage device writes data into one or more physical pages (i.e., the physical pages from LUN 1, LUN 3 to LUNN-1) in the page strip b, so that the check data corresponding to the data in the physical pages from LUN 0 to LUN2, LUN 3 to LUNN-1 in the page strip b is the first check data.

[0221] Among them, the check data corresponding to the data in the physical pages from LUN 0 to LUN 2, LUN 3 to LUNN-1 in the page strip b being the first check data can specifically include: the check data corresponding to the 4 sub-strips in the page strip b, which are the check data C0, check data C1, check data C2, and check data C3 in the first check data respectively.

[0222] In some implementations, S403 can specifically include:

[0223] S403a. After the storage device is powered on again, the storage device writes one or more physical pages in page strip b (i.e., physical pages from LUN 1, LUN 3 to LUNN-1) to a preset value, so that the check data corresponding to the data in the physical pages from LUN 0 to LUN 2, LUN3 to LUNN-1 in page strip b is the first check data.

[0224] Among them, the preset value can be all 0.

[0225] In some other implementation manners, S403 may specifically include:

[0226] S403b. After the storage device is powered on again, the storage device writes second user data to one or more physical pages (i.e., physical pages from LUN 1, LUN 3 to LUNN-1), so that the check data corresponding to the data in the physical pages storing the first user data in page strip b and the data in the one or more physical pages is the first check data.

[0227] Among them, in the first design, S403b may specifically include:

[0228] S403b1. After the storage device is powered on again, if there are 2n physical pages corresponding to multiple sub-strips in one or more physical pages in page strip b, the second user data is written twice to the 2n physical pages corresponding to the multiple sub-strips respectively, so that the exclusive OR result of the data in the 2n physical pages corresponding to the multiple sub-strips respectively is all 0.

[0229] Among them, n is a positive integer, the second user data includes data of n×s physical pages, and s is the number of sub-strips included in page strip b.

[0230] For example, the second user data may include: user data D4, user data D5, user data D6, and user data D7. Among them, user data D4 is written twice to the 2n physical pages in sub-strip 4 of page strip b, user data D5 is written twice to the 2n physical pages in sub-strip 5 of page strip b, user data D6 is written twice to the 2n physical pages in sub-strip 6 of page strip b, and user data D7 is written twice to the 2n physical pages in sub-strip 7 of page strip b.

[0231] In the second design, S403b may specifically include:

[0232] S403b2. After the storage device is powered on again, if one or more physical pages in the page strip b include 2n + 1 physical pages corresponding to multiple sub-stripes respectively, write the second user data twice into 2n physical pages out of the 2n + 1 physical pages corresponding to the multiple sub-stripes respectively, and fill the physical pages other than the 2n physical pages in the 2n + 1 physical pages corresponding to the multiple sub-stripes with all 0s, so that the exclusive OR result of the data in the 2n + 1 physical pages is all 0.

[0233] Wherein, n is a positive integer, the second user data includes data of n×s physical pages, and s is the number of sub-stripes included in the page strip b.

[0234] For example, the second user data may include: user data D4, user data D5, user data D6, and user data D7. Among them, after writing the user data D4 twice into the physical pages in the sub-stripe 4 of the page strip b, writing the user data D5 twice into the physical pages in the sub-stripe 5 of the page strip b, writing the user data D6 twice into the physical pages in the sub-stripe 6 of the page strip b, and writing the user data D7 twice into the physical pages in the sub-stripe 7 of the page strip b, the storage device also fills the physical pages other than the 2n physical pages in the 2n + 1 physical pages corresponding to the multiple sub-stripes with all 0s, so that the exclusive OR result of the data in the 2n + 1 physical pages is all 0.

[0235] In the third design, S403b includes:

[0236] S403b3. The storage device repeatedly executes the first process until one or more physical pages in the page strip b are exhausted or one or more physical pages remain with 1 physical page. If one or more physical pages remain with 1 physical page, the storage device fills the remaining 1 physical page with all 0s.

[0237] Wherein, the first process includes: writing the user data with the data volume of 1 physical page in the second user data twice into 2 physical pages in one or more physical pages in the page strip b.

[0238] In addition, in the fourth design, one or more physical pages in the above-mentioned page strip b may include physical pages storing the second user data and multiple physical pages filled with all 0s. Different from the above-mentioned first three designs: in this fourth design, one or more physical pages in the above-mentioned may include more than one physical page filled with all 0s.

[0239] In some implementation manners, after the storage device is powered on again, if it is detected that the storage device powers off again when one or more physical pages are written with partial physical pages and one or more physical pages are not completely written, write the cached data into one or more physical pages, and no longer write to the target physical page.

[0240] In some implementations, in response to the physical page storing user data in the second page strip among multiple page strips being filled, parity data is written to the target physical page of the second page strip. Among them, the target physical page of the second page strip and the target physical page of the first page strip come from the same LUN.

[0241] In the case of storing data according to the content of S401 - S403 above, the process of reading data from the storage device is introduced below. Specifically, in the first implementation, the method may further include:

[0242] S411. After the storage device is powered on again and before writing data to one or more physical pages in page strip b, a first read request is obtained.

[0243] Among them, the first read request is used to indicate reading first data to be read included in the first user data.

[0244] S412. If the first read request has an error, first error correction data is calculated using the first read data.

[0245] Among them, the first error correction data is: the data stored in the first error physical page where an error occurs in the first data to be read; the first read data includes: the data read from other physical pages except the first error physical page in the first part of physical pages; the first part of physical pages includes: the physical pages storing the first user data in page strip b and the target physical page.

[0246] In the second implementation, the method may further include:

[0247] S421. After writing data to one or more physical pages in page strip b, a second read request is obtained.

[0248] The second read request is used to indicate reading second data to be read in page strip b; the second data to be read includes: the first user data or the user data stored in one or more physical pages.

[0249] S422. If the second read request has an error, second error correction data is calculated using the second read data.

[0250] Among them, the second error correction data is: the data stored in the second error physical page where an error occurs in the second data to be read; the second read data includes: the data read from other physical pages except the second error physical page in page strip b.

[0251] In the third implementation, the method may further include:

[0252] S431. After writing data to one or more physical pages in page strip b, a third read request is obtained.

[0253] The third read request is used to indicate reading third data to be read included in the first user data.

[0254] S433. If an error occurs in the third read request, calculate third error correction data by using the third read data.

[0255] Wherein, the third error correction data is: the data stored in the second error physical page with an error in the third data to be read; the third read data includes: the data read from other physical pages except the second error physical page in the first part of physical pages; the first part of physical pages includes: the physical pages storing the first user data in the page strip b and the target physical page.

[0256] In an embodiment of the present application, a data storage method for power failure of a storage device is further provided, and the method includes:

[0257] S501. After detecting that the storage device has a power failure, determine first check data corresponding to the first user data written to the first page strip.

[0258] S502. Write the first check data to the target physical page in the first page strip.

[0259] Wherein, in addition to the physical pages storing the first user data and the target physical page in the first page strip, there are also one or more physical pages that have not been written with data.

[0260] Wherein, the target physical page is a physical page predetermined in the first page strip for storing check data, and the target physical page does not need to be adjacent to the physical page storing the first user data in the first page strip.

[0261] In some implementation manners, the number of physical pages provided by the LUN where the target physical page is located for the first page strip is not less than the number of physical pages provided by any LUN for the first page strip.

[0262] In some implementation manners, S501 may include:

[0263] S5011. After detecting that the storage device has a power failure, write the cache data to the first page strip.

[0264] S5012. Determine first check data corresponding to the first user data including the cache data written to the first page strip.

[0265] In some implementation manners, the method further includes:

[0266] S511. Obtain a first read request; the first read request is used to indicate reading first data to be read included in the first user data.

[0267] S512. If an error occurs in the first read request, calculate first error correction data using the first read data.

[0268] Wherein, the first error correction data is: data stored in the first error physical page with an error in the first data to be read; the first read data includes: data read from other physical pages except the first error physical page in the first part of physical pages; the first part of physical pages includes: physical pages storing the first user data and the target physical page.

[0269] In an embodiment of the present application, a data storage method for power failure of a storage device is further provided. The method includes:

[0270] S601. After the storage device is powered on, if the first part of physical pages of the first page stripe is written with data while the second part of physical pages is not written with data, and the first part of physical pages includes: physical pages storing the first user data and the target physical page storing the first check data corresponding to the first user data, then execute the second process.

[0271] Wherein, the second process includes: writing data to the second part of physical pages in the first page stripe, so that the check data corresponding to the data in the physical pages storing the first user data in the first page stripe and the second part of physical pages is the first check data.

[0272] In some implementation manners, after the storage device is powered on and before executing the second process, the method further includes:

[0273] S611. Obtain a first read request; the first read request is used to indicate reading first data to be read included in the first user data.

[0274] S612. If an error occurs in the first read request, calculate first error correction data using the first read data.

[0275] Wherein, the first error correction data is: data stored in the first error physical page with an error in the first data to be read; the first read data includes: data read from other physical pages except the first error physical page in the first part of physical pages; the first part of physical pages includes: physical pages storing the first user data and the target physical page.

[0276] In some implementation manners, after executing the second process, the method further includes:

[0277] S621. Obtain a second read request; the second read request is used to indicate reading second data to be read in the first page strip; the second data to be read includes: the first user data or user data stored in one or more physical pages.

[0278] S622. If an error occurs in the second read request, calculate second error correction data by using second read data.

[0279] Wherein, the second error correction data is: data stored in a second error physical page with an error in the second data to be read; the second read data includes: data read from other physical pages in the first page strip except the second error physical page.

[0280] In some implementation manners, after executing the second process, the method further includes:

[0281] S631. Obtain a third read request; the third read request is used to indicate reading third data to be read included in the first user data.

[0282] S632. If an error occurs in the third read request, calculate third error correction data by using third read data.

[0283] Wherein, the third error correction data is: data stored in a second error physical page with an error in the third data to be read; the third read data includes: data read from other physical pages in the first part of physical pages except the second error physical page.

[0284] In some implementation manners, writing data to the second part of physical pages in the first page strip includes:

[0285] Writing a preset value to the second part of physical pages in the first page strip, so that check data corresponding to data in the physical pages storing the first user data in the first page strip and the second part of physical pages is the first check data.

[0286] In some implementation manners, the preset value is all 0.

[0287] In some implementation manners, writing data to the second part of physical pages in the first page strip includes:

[0288] Writing second user data to the second part of physical pages, so that check data corresponding to data in the physical pages storing the first user data in the first page strip and the second part of physical pages is the first check data.

[0289] In some implementations, writing the second user data to the second partial physical pages includes:

[0290] If there are 2n physical pages in the second partial physical pages of the first page strip, write the second user data twice to the 2n physical pages, so that the exclusive - OR result of the data in the 2n physical pages is all 0; where n is a positive integer, and the second user data includes data of n physical pages.

[0291] In some implementations, writing the second user data to the second partial physical pages includes:

[0292] If there are 2n + 1 physical pages in the second partial physical pages of the first page strip, write the second user data twice to 2n of the 2n + 1 physical pages, and fill the physical page other than the 2n physical pages in the 2n + 1 physical pages with all 0s, so that the exclusive - OR result of the data in the 2n + 1 physical pages is all 0; where n is a positive integer, and the second user data includes data of n physical pages.

[0293] In some implementations, writing the second user data to the one or more physical pages includes:

[0294] Loop and execute the first process until the second partial physical pages are exhausted or there is 1 remaining physical page in the second partial physical pages; the first process includes: write the user data of the data volume of 1 physical page in the second user data twice to 2 physical pages in the second partial physical pages;

[0295] If there is 1 remaining physical page in the second partial physical pages, fill the remaining 1 physical page with all 0s.

[0296] In some implementations, the second partial physical pages include: the second user data and multiple physical pages filled with all 0s.

[0297] In some implementations, the target physical page is the physical page in the first page strip that is pre - determined to store check data, and the target physical page does not need to be adjacent to the physical page storing the first user data in the first page strip.

[0298] In some implementations, the method further includes:

[0299] If it is detected that the storage device loses power when some physical pages in the second partial physical pages have been written and the second partial physical pages have not been completely written, write the cached data to the one or more physical pages, and do not write the target physical page anymore.

[0300] In some implementations, the method further includes:

[0301] In response to the physical page storing user data in the second page strip among the multiple page strips being full, writing check data to the target physical page of the second page strip; wherein, the target physical page of the second page strip and the target physical page of the first page strip come from the same LUN.

[0302] Embodiments of the present disclosure further provide a computer-readable storage medium, in which computer instructions are stored; when the computer-readable storage medium runs on a processor, the processor is caused to execute the method provided by the embodiments of the present disclosure.

[0303] Embodiments of the present disclosure further provide a computer program product including computer instructions, which, when running on a processor, cause the processor to be able to execute the method provided by the embodiments of the present disclosure.

[0304] Embodiments of the present disclosure provide a chip, which includes a processor. When the processor executes instructions, the chip can execute the method provided by the embodiments of the present disclosure. The instructions can come from a memory inside the chip or a memory outside the chip. Optionally, the chip further includes an input-output circuit as a communication interface.

[0305] 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 term "comprising", "including" or any other variant thereof is intended to cover a non-exclusive inclusion, such that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.

[0306] 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 these embodiments described herein, but rather will be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data storage method for power failure of a storage device, the storage device including a plurality of page stripes; characterized in that, The method includes: After detecting power failure of the storage device, determining first check data corresponding to first user data written to a first page strip among the multiple page strips; Writing the first check data to a target physical page in the first page strip; in addition to the physical page storing the first user data and the target physical page in the first page strip, the first page strip further includes one or more physical pages to which data has not been written yet; After the storage device is powered on again, writing data to the one or more physical pages in the first page strip, so that the check data corresponding to the data in the physical page storing the first user data and the one or more physical pages in the first page strip is the first check data.

2. The method according to claim 1, characterized in that, The determining, after detecting power failure of the storage device, first check data corresponding to first user data written to the first page strip includes: After detecting power failure of the storage device, writing cache data to the first page strip; Determining first check data corresponding to first user data including the cache data written to the first page strip.

3. The method according to claim 1, wherein After the storage device is powered on again, the writing data to the one or more physical pages in the first page strip includes: After the storage device is powered on again, writing a preset value to the one or more physical pages in the first page strip, so that the check data corresponding to the data in the physical page storing the first user data and the one or more physical pages in the first page strip is the first check data.

4. The method according to any one of claims 1 to 3, characterized in that, After the storage device is powered on again, the writing data to the one or more physical pages in the first page strip includes: After the storage device is powered on again, writing second user data to the one or more physical pages, so that the check data corresponding to the data in the physical page storing the first user data and the one or more physical pages in the first page strip is the first check data.

5. The method according to any one of claims 1 to 3, characterized in that, The method further includes: After the storage device is powered on again and before writing data to the one or more physical pages in the first page strip, obtaining a first read request; the first read request is used to indicate reading first data to be read included in the first user data; If the first read request has an error, calculating first error correction data using first read data; Wherein, the first error correction data is: data stored in a first error physical page with an error among the first data to be read; the first read data includes: data read from other physical pages except the first error physical page in a first part of physical pages; the first part of physical pages includes: the physical page storing the first user data and the target physical page.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: After writing data to the one or more physical pages in the first page strip, obtaining a second read request; the second read request is used to indicate reading second data to be read in the first page strip; the second data to be read includes: the first user data or user data stored in the one or more physical pages; If the second read request has an error, calculating second error correction data using second read data; Wherein, the second error correction data is: the data stored in the second error physical page with an error in the second data to be read; the second read data includes: the data read from other physical pages in the first page stripe except the second error physical page.

7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: After the storage device is powered on again, if it is detected that the storage device is powered off again when a part of physical pages in the one or more physical pages are written with data and the one or more physical pages are not completely written, write the cache data into the one or more physical pages, and no longer write the target physical page.

8. A data storage method for power failure of a storage device, characterized in that, The method includes: After detecting that the storage device is powered off, determine the first check data corresponding to the first user data written in the first page stripe; Write the first check data into the target physical page in the first page stripe; in addition to the physical pages storing the first user data and the target physical page in the first page stripe, there are one or more physical pages that have not been written with data; Wherein, the target physical page is a physical page pre-determined in the first page stripe for storing check data, and the target physical page does not need to be adjacent to the physical page storing the first user data in the first page stripe.

9. A data storage method for powering on a storage device, characterized in that, The method includes: After the storage device is powered on, if a first part of physical pages in the first page stripe are written with data while a second part of physical pages are not written with data, and the first part of physical pages includes: the physical page storing the first user data and the target physical page storing the first check data corresponding to the first user data, then execute the second process; Wherein, the second process includes: writing data into the second part of physical pages in the first page stripe so that the check data corresponding to the data in the second part of physical pages and the physical page storing the first user data in the first page stripe is the first check data.

10. A storage device, characterized in that, It includes a controller and a non-volatile memory chip, and the controller is used to execute the method according to any one of claims 1-9.

Citation Information

Patent Citations

  • Block strip construction method, construction device and solid-state storage device

    CN107807788B

  • Solid-state drive-based power-on initialization acceleration method, apparatus, and computer device

    CN110275596B

  • Block architecture, allocation methods, and storage devices for improving the quality of service of storage devices

    CN112181276B

  • Methods, devices, computer equipment, and storage media for rapid power loss recovery of SSD RAID stripes.

    CN113391947B