Data writing method and device, electronic equipment and storage medium

By determining the backup parameters according to the abnormal mode in RAID technology, and backing up IO data in whole or splitting it to the data sub-region, the data loss problem caused by abnormal disks in RAID technology is solved, and data security and backup and recovery efficiency are improved.

CN119847816AActive Publication Date: 2025-04-18SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 14 Cites 0 Cited by

Patent Information

Application Number
CN202510344500.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-04-18
Estimated Expiration
2045-03-24

AI Technical Summary

Technical Problem

In the write-back mode of independent disk redundant array (RAID) technology, if the number of burst abnormal disks is greater than the number of check disks in RAID, and the IO data is originally going to fall on the disk with burst abnormality, the IO data cannot be dropped, resulting in data loss and data security cannot be guaranteed.

Method used

When the RAID is in an abnormal state, the backup parameters are determined according to the exception mode. If the disk occurs abnormally in the non-write disk stage, the overall IO data will be backed up to the data sub-region; if the disk occurs abnormally in the disk stage, the IO data not yet written to the disk will be divided into sub-IO data and backed up to the data sub-region respectively, and the corresponding backup parameters will be stored in the parameter sub-region.

Benefits of technology

Through different backup and recovery solutions based on the exception occurrence stage, the security of IO data and backup and recovery efficiency of disk abnormalities are improved, ensuring that data will not be lost in abnormal situations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847816A_ABST
    Figure CN119847816A_ABST
Patent Text Reader

Abstract

The invention provides a data writing method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: in response to an abnormal state of a redundant array of independent disks (RAID), determining an abnormal mode of the RAID; in response to the abnormal mode being a first mode, determining a first backup parameter of the IO data; the first backup parameter comprises a backup initial position of the IO data in a data subarea of a reserved area of the RAID; backing up the IO data to a data sub-area based on the first backup parameter, and storing the first backup parameter to a parameter sub-area in the reserved area; in response to the fact that the abnormal mode is a second mode, determining a second backup parameter of sub IO data corresponding to each disk in the IO data which is not written into the disk; the second backup parameter comprises a backup initial position of the sub-IO data in the data sub-region; and backing up the sub IO data to the data sub-region based on the second backup parameter, and storing the second backup parameter to the parameter sub-region. Therefore, the security of the IO data in the RAID can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data writing method, device, electronic device and storage medium. Background Art

[0002] Redundant Array of Independent Disks (RAID) is a storage technology that improves storage performance and reliability by increasing verification redundancy. In RAID technology, when input / output (IO) data is written to disk, in order to improve IO execution efficiency, the host will usually be replied to complete when the IO is moved from the host to the cache and has not yet been written to the disk. This mode is usually called the write back (WB) mode, and then the data continues to be calculated until it is written to the disk. Therefore, while the previous IO is executed and written to the disk, the host can issue the next IO and move the data of the next IO to the cache, thereby increasing the number of read and write operations per second (IOPS) and reducing write latency.

[0003] However, in the WB mode of traditional RAID technology, when IO data is written to disk, if the number of disks with sudden abnormalities is greater than the number of check disks in the RAID, and the IO data was originally supposed to be written to the disk with sudden abnormalities, the IO data cannot be written to disk, and the data on the disk cannot be restored through data from other disks. At this time, the IO data writing cannot be completed, and because the host has been replied to complete, the host believes that the IO has been successfully written to disk, but the actual writing is not completed. Even if the failed disk returns to normal later, the IO data will be lost, making data security not guaranteed.

[0004] Therefore, how to ensure data security in the WB mode of RAID technology is an urgent problem to be solved. Summary of the invention

[0005] The present disclosure provides a data writing method, device, electronic device and storage medium to at least solve the above technical problems existing in the prior art.

[0006] According to a first aspect of the present disclosure, a data writing method is provided, comprising: in response to a redundant array of independent disks RAID being in an abnormal state, determining an abnormal mode of the RAID; the abnormal state characterizing that the number of abnormal disks among a plurality of disks of the RAID is greater than a first threshold; in response to the abnormal mode being a first mode, determining a first backup parameter of input and output IO data; the first mode characterizing that an abnormality occurs in a disk during a non-disk writing phase, and the first backup parameter includes a backup start position of the IO data in a data sub-area of ​​a reserved area of ​​the RAID; backing up the IO data to the data sub-area based on the first backup parameter, and storing the first backup parameter in a parameter sub-area of ​​the reserved area; in response to the abnormal mode being a second mode, determining a second backup parameter of sub-IO data corresponding to each disk in the IO data that has not yet been written to the disk; the second mode characterizing that an abnormality occurs in a disk writing phase, and the second backup parameter includes a backup start position of the sub-IO data in the data sub-area; backing up the sub-IO data to the data sub-area based on the second backup parameter, and storing the second backup parameter in the parameter sub-area.

[0007] In one possible implementation, the determining of the first backup parameter of the input and output IO data includes: determining the starting position of the data sub-area in the reserved area; determining the starting position of the latest IO data in the data sub-area and the length of the latest IO data from a backup parameter record table; and determining the backup starting position of the IO data in the data sub-area based on the starting position of the data sub-area in the reserved area, the starting position of the latest IO data in the data sub-area, and the length of the latest IO data.

[0008] In one possible implementation, backing up the IO data to the data sub-area based on the first backup parameter includes: writing the IO data from a cache to the data sub-area, where a writing start position is a backup start position of the IO data in the data sub-area.

[0009] In one possible implementation, storing the first backup parameter in the parameter sub-area in the reserved area includes: determining the number of backup parameters stored in the parameter sub-area from a backup parameter record table; determining the storage starting position of the first backup parameter in the parameter sub-area based on the starting position of the parameter sub-area in the reserved area, the number of backup parameters and the length of the backup parameters; and writing the first backup parameter into the parameter sub-area, the writing starting position being the storage starting position of the first backup parameter in the parameter sub-area.

[0010] In one possible implementation, after storing the first backup parameter in the parameter sub-area in the reserved area, the method further includes: adding 1 to the number of backup parameters in the backup parameter record table; updating the starting position of the latest IO data in the backup parameter record table to the starting position of the original latest IO data plus the length of the original latest IO data; and updating the length of the latest IO data in the backup parameter record table to the length of the IO data.

[0011] In one possible implementation, the first backup parameter further includes at least one of a validity identifier of the first backup parameter, an abnormal mode identifier, a starting position of the IO data in the RAID, and a length of the IO data.

[0012] In one possible implementation, the second backup parameter also includes at least one of a validity identifier of the second backup parameter, an abnormal mode identifier, a disk identifier corresponding to the sub-IO data, a starting position of the sub-IO data in the corresponding disk, and a length of the sub-IO data.

[0013] In one possible implementation, a data writing method further includes: in response to the abnormal disk returning to normal, reading the backup parameters in the parameter sub-area in sequence; based on the backup start position in the read target backup parameters and the length of the IO data or sub-IO data, reading the target IO data or target sub-IO data from the data sub-area to the cache; based on the abnormal mode identifier in the target backup parameters, writing the target IO data or target sub-IO data in the cache into the target area of ​​the RAID.

[0014] In one possible implementation, writing the target IO data or target sub-IO data in the cache into the target area of ​​the RAID based on the abnormal pattern identifier in the target backup parameter includes: in response to the abnormal pattern identifier in the target backup parameter representing a first pattern, based on the starting position of the IO data in the target backup parameter in the RAID and the length of the IO data, writing the target IO data in the cache into the target area of ​​the RAID; or, in response to the abnormal pattern identifier in the target backup parameter representing a second pattern, based on the disk identifier corresponding to the sub-IO data in the target backup parameter, the starting position of the sub-IO data in the corresponding disk, and the length of the sub-IO data, writing the target sub-IO data in the cache into the target area of ​​the disk corresponding to the target sub-IO data.

[0015] In one possible implementation, before writing the target IO data in the cache into the target area of ​​the RAID, the method further includes: calculating a check data block based on the target IO data in the cache, and writing the check data block into the cache.

[0016] In one possible implementation, a data writing device further includes: clearing IO data and / or sub-IO data in the data sub-area; and clearing backup parameters in the parameter sub-area.

[0017] According to a second aspect of the present disclosure, a data writing device is provided, comprising: a determination module, for determining an abnormal mode of a redundant array of independent disks RAID in response to a redundant array of independent disks RAID being in an abnormal state; the abnormal state indicates that the number of abnormal disks among the multiple disks of the RAID is greater than a first threshold value; the determination module, further for determining a first backup parameter of input and output IO data in response to the abnormal mode being a first mode; the first mode indicates that an abnormality occurs in a disk during a non-disk writing phase, and the first backup parameter includes a backup start position of the IO data in a data sub-area of ​​a reserved area of ​​the RAID; a backup module, for backing up the IO data to the data sub-area based on the first backup parameter, and storing the first backup parameter in a parameter sub-area of ​​the reserved area; the determination module, further for determining a second backup parameter of sub-IO data corresponding to each disk in the IO data that has not yet been written to the disk in response to the abnormal mode being a second mode; the second mode indicates that an abnormality occurs in a disk during a disk writing phase, and the second backup parameter includes a backup start position of the sub-IO data in the data sub-area; the backup module, further for backing up the sub-IO data to the data sub-area based on the second backup parameter, and storing the second backup parameter in the parameter sub-area.

[0018] In one possible implementation, the determination module is further used to: determine the starting position of the data sub-area in the reserved area; determine the starting position of the latest IO data in the data sub-area and the length of the latest IO data from the backup parameter record table; and determine the backup starting position of the IO data in the data sub-area based on the starting position of the data sub-area in the reserved area, the starting position of the latest IO data in the data sub-area, and the length of the latest IO data.

[0019] In one possible implementation, the backup module is further used to: write the IO data from the cache into the data sub-area, and the starting position of writing is the backup starting position of the IO data in the data sub-area.

[0020] In one possible implementation, the backup module is further used to: determine the number of backup parameters stored in the parameter sub-area from the backup parameter record table; determine the storage starting position of the first backup parameter in the parameter sub-area based on the starting position of the parameter sub-area in the reserved area, the number of the backup parameters and the length of the backup parameters; write the first backup parameter into the parameter sub-area, and the writing starting position is the storage starting position of the first backup parameter in the parameter sub-area.

[0021] In one embodiment, the data writing device also includes an update module, which is used to: increase the number of backup parameters in the backup parameter record table by 1; update the starting position of the latest IO data in the backup parameter record table to the starting position of the original latest IO data plus the length of the original latest IO data; update the length of the latest IO data in the backup parameter record table to the length of the IO data.

[0022] In one possible implementation, the first backup parameter further includes at least one of a validity identifier of the first backup parameter, an abnormal mode identifier, a starting position of the IO data in the RAID, and a length of the IO data.

[0023] In one possible implementation, the second backup parameter also includes at least one of a validity identifier of the second backup parameter, an abnormal mode identifier, a disk identifier corresponding to the sub-IO data, a starting position of the sub-IO data in the corresponding disk, and a length of the sub-IO data.

[0024] According to a third aspect of the present disclosure, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.

[0025] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.

[0026] The present invention discloses a data writing method, device, electronic device and storage medium. When RAID is in an abnormal state, if the disk is abnormal in the non-write stage, the IO data is directly backed up as a whole to the data sub-area based on the backup parameters of the IO data, and the backup parameters of the IO data are stored in the parameter sub-area. If the disk is abnormal in the write stage, the IO data that has not been written to the disk is divided into multiple sub-IO data according to the corresponding disk, and then the multiple sub-IO data are backed up to the data sub-area based on the backup parameters of each sub-IO data, and the backup parameters of the sub-IO data are stored in the parameter sub-area. Therefore, when the disk is abnormal, the present invention adopts different backup and recovery schemes based on the stage where the abnormality occurs, and the reserved area for backup includes a data sub-area and a parameter sub-area. Through the memory design of the reserved area, free space can be quickly found to back up IO data during backup; during recovery, the target IO data can be quickly accessed for recovery, so that in the face of disk abnormalities at different stages, the security of IO data can be improved and the efficiency of the IO data backup and recovery process can be guaranteed.

[0027] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which: In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0029] Figure 1 A schematic diagram showing a process of a data writing method according to an embodiment of the present disclosure Figure 1 ; Figure 2 A schematic diagram showing a process of a data writing method according to an embodiment of the present disclosure Figure 2 ; Figure 3 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 1 ; Figure 4 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 2 ; Figure 5 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 3 ; Figure 6 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 4 ; Figure 7 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 5 ; Figure 8 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 6 ; Fig. 9 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 7 ; Fig.10 A schematic diagram of the structure of a data writing device according to an embodiment of the present disclosure is shown; Fig.11 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0030] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0031] Figure 1 A schematic diagram showing a process of a data writing method according to an embodiment of the present disclosure Figure 1 ,like Figure 1 As shown, a data writing method includes: Step S101 , in response to a redundant array of independent disks RAID being in an abnormal state, determining an abnormal mode of the RAID.

[0032] In this embodiment, the abnormal state indicates that the number of abnormal disks among the multiple disks of the RAID is greater than a first threshold value, wherein the first threshold value can be determined based on the number of RAID check disks, and the RAID check disk is used to store check information so that data can be recovered when a disk fails. For any type of RAID, when the number of abnormal disks does not exceed the number of RAID check disks, data in the abnormal disks can be recovered through other disks; when the number of abnormal disks exceeds the number of RAID check disks, data in the failed disk cannot be recovered through other disks. In one example, there is 1 check disk in RAID5, so the first threshold value can be 1; there are 2 check disks in RAID6, so the first threshold value can be 2.

[0033] In this embodiment, the abnormal mode of RAID is determined based on the stage of abnormal disk failure. If all IO data has not been written to the corresponding disk, it is considered that the abnormal disk has failed in the non-write stage, and this abnormal mode is called the first mode; if the IO data has been partially written to the corresponding disk, it is considered that the abnormal disk has failed in the write stage, and this abnormal mode is called the second mode.

[0034] Step S102 , in response to the abnormal mode being the first mode, determining a first backup parameter of input and output IO data.

[0035] In this embodiment, the first mode indicates that an abnormality occurs in the disk during the non-write phase. At this time, all IO data has not yet been written to the corresponding disk, that is, the IO data is complete, so the IO data can be backed up as a whole. Before the backup, the first backup parameter of the input and output IO data needs to be determined. The first backup parameter includes the backup starting position of the IO data in the data sub-area of ​​the reserved area of ​​the RAID.

[0036] Figure 6 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 4 ,like Figure 6 As shown, in the present disclosure, a reserved area is set for backing up IO data, and the reserved area includes a parameter sub-area and a data sub-area. The parameter sub-area is used to store the backup parameters of the IO data, such as Figure 6 The header0, header1, ..., header256n in are the backup parameters of an IO data, and the data sub-area is used to store IO data, such as Figure 6 The data in the reserved area is the IO data. If the reserved area stores at most nM IO data, assuming that the minimum unit of all IO data being written is 4K when the number of IOs is the largest, then when an exception occurs, there are at most The IO data is being written; the maximum size of the header area is: , so the memory size allocated to the header area is 8nK, and the size of the data area is nM. Among them, n is the maximum amount of data that can be stored in the reserved area, M is megabytes, M is the unit of n, and K is kilobytes.

[0037] Step S103: backing up the IO data to the data sub-area based on the first backup parameter, and storing the first backup parameter to the parameter sub-area in the reserved area.

[0038] In this embodiment, the IO data can be backed up to the data sub-area based on the first backup parameter. The starting position of the IO data in the data sub-area is the backup starting position determined in step S102. The first backup parameter can also be stored in the parameter sub-area in the reserved area for subsequent extraction of the IO data in the data sub-area.

[0039] Figure 3 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 1 ,like Figure 3 As shown, Figure 3 Take RAID5 as an example. RAID5 includes 4 disks, namely Disk 0, Disk 1, Disk 2 and Disk 3. Disk 1 and Disk 2 are abnormal disks. The data blocks with "'" in the disks of RAID5 indicate the location where IO data will be stored on the disk. The dark-colored data blocks in the disks of RAID5 are the locations where IO data has been stored on the disk. The host puts the IO data stream into the cache, as shown in step ①, and then the cache replies to the host that it is completed, as shown in step ②. After that, the IO data stream is written from the cache to RAID5, as shown in step ③. In step ③, it is found that Disk 1 and Disk 2 are abnormal, and the IO data stream that should be written to the 14' to 22' position in RAID5 cannot be stored on the disk. At this time, there are no dark-colored data blocks in the disks of RAID5, which proves that the IO data stream has not been written to the corresponding disks. The IO data stream is complete, so the IO data stream from 14' to 22' is backed up as a whole to the data sub-area, as shown in step ④.

[0040] Figure 4 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 2 ,like Figure 4 As shown, if disk 1 and disk 2 are normal, that is, RAID5 is restored to a normal state, the IO data stream at positions 14' to 22' is read from the data sub-area to the cache, as in step ①, and then the corresponding 4 check data blocks P' in disk 2 are calculated based on the IO data stream at positions 14' to 22', and the IO data stream at positions 14' to 22' is written from the cache to the corresponding position of RAID5, as in step 2.

[0041] Step S104: in response to the abnormal mode being the second mode, determining a second backup parameter of the sub-IO data corresponding to each disk in the IO data that has not been written to the disk.

[0042] In this embodiment, the second mode indicates that an abnormality occurs in the disk writing stage. At this time, the IO data has been partially written to the corresponding disk. The part of the IO data that has been written to the disk will be released in the cache, and the IO data is incomplete. Since the disk writing operation of IO data is based on the disk, the IO data that has not been written to the disk can be divided into sub-IO data based on the corresponding disk, and all sub-IO data can be backed up separately. Before backing up, it is necessary to determine the second backup parameters of the sub-IO data corresponding to each disk. The second backup parameters include the backup starting position of the sub-IO data in the data sub-area.

[0043] Step S105: backing up the sub-IO data to the data sub-area based on the second backup parameter, and storing the second backup parameter to the parameter sub-area.

[0044] In this embodiment, the sub-IO data can be backed up to the data sub-area based on the second backup parameter. The starting position of the sub-IO data in the data sub-area is the backup starting position determined in step S104. The second backup parameter can also be stored in the parameter sub-area in the reserved area for subsequent extraction of the sub-IO data in the data sub-area.

[0045] Figure 5 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 3 ,like Figure 5 As shown, the host puts the IO data stream into the cache, as shown in step ①, and then the cache replies to the host that it is completed, as shown in step ②, and then writes the IO data stream from the cache to the RAID5, as shown in step ③. In step ③, it is found that disk 1 and disk 2 are abnormal. At this time, data blocks 14' and 15' in the disk of RAID5 are dark data blocks, which proves that data blocks 14' and 15' have been completed. The data corresponding to data blocks 14' and 15' have been released from the cache, and the data corresponding to the remaining IO data 16' to 22' needs to be divided into sub-IO data based on the corresponding disk, that is, the data corresponding to 16' to 19' in disk 1 is a sub-IO data, and the data corresponding to 20' to 22' in disk 3 is A sub-IO data, and because the data corresponding to data blocks 14' and 15' have been released from the cache, the check data blocks cannot be calculated through the backed-up data, and the check data blocks in the cache must be backed up, that is, the data corresponding to the 4 P' check data blocks in disk 2 are used as a sub-IO data, and then the data corresponding to 16' to 19' in disk 1 are backed up as IO1 to the data sub-area, and the data corresponding to the 4 P' check data blocks in disk 2 are backed up as IO2 to the data sub-area. For easy distinction, the 4 P' check data blocks can be marked as P0', P1', P2', and P3' respectively, and the data corresponding to 20' to 22' in disk 3 can be backed up as IO3 to the data sub-area, as shown in step ④. After RAID5 is restored to normal state, IO1, IO2, and IO3 in the data sub-area can also be read from the data sub-area to the cache, and IO1, IO2, and IO3 can be written from the cache to the corresponding positions of RAID5.

[0046] In the present disclosure, when a disk anomaly occurs, different backup and recovery schemes are adopted based on the stage at which the anomaly occurs, and the reserved area for backup includes a data sub-area and a parameter sub-area. Through the memory design of the reserved area, free space can be quickly found to back up IO data during backup; during recovery, target IO data can be quickly accessed for recovery, thereby improving the security of IO data and ensuring the efficiency of the IO data backup and recovery process in the face of disk anomalies at different stages.

[0047] In another embodiment, the step S102 of “determining a first backup parameter of input / output IO data” includes: Determine the starting position of the data sub-area in the reserved area; Determine the starting position of the latest IO data and the length of the latest IO data in the data sub-area from the backup parameter record table; A backup starting position of the IO data in the data sub-area is determined based on the starting position of the data sub-area in the reserved area, the starting position of the latest IO data in the data sub-area, and the length of the latest IO data.

[0048] In this embodiment, the backup parameter record table records the summarized backup parameters. The fields and sizes included in the backup parameter record table are shown in Table 1 below: Table 1

[0049] Among them, is_valid is used to indicate whether the data is valid. 0X5A5A5A5A indicates valid, and the others indicate invalid. is_valid is 8 bytes. num indicates the number of valid backup parameters stored in the parameter sub-area. num is 4 bytes. last_slba indicates the starting position of the latest IO data backed up in the data sub-area. last_slba is 8 bytes. last_nlb indicates the length of the latest IO data backed up in the data sub-area. last_nlb is 4 bytes.

[0050] In this embodiment, the starting position of the data sub-area in the reserved area can be determined first. The starting position of the data sub-area in the reserved area is fixed and can be represented by slba_data0. Then, the values ​​of the last_slba field and the last_nlb field are read from the backup parameter record table to obtain the starting position of the latest IO data in the data sub-area and the length of the latest IO data. Finally, the backup starting position of the IO data in the data sub-area is determined based on slba_data0, last_slba and last_nlb. The calculation formula of the backup starting position save_slba of the IO data in the data sub-area is as shown in Formula 1: Formula 1 It should be emphasized that the implementation process of "determining the second backup parameters of the sub-IO data corresponding to each disk in the IO data that has not yet been written to the disk" in step S104 is similar to the implementation process of "determining the first backup parameters of the input and output IO data" in step S102, and will not be repeated here.

[0051] In another embodiment, the step S103 of “backing up the IO data to the data sub-area based on the first backup parameter” includes: The IO data is written from the cache to the data sub-area, and the starting position of the writing is the backup starting position of the IO data in the data sub-area.

[0052] In this embodiment, after determining the backup starting position of the IO data in the data sub-area, the IO data can be extracted from the cache and written into the data sub-area, and the writing starting position is the backup starting position of the IO data in the data sub-area.

[0053] It should be emphasized that the implementation details of "backing up the sub-IO data to the data sub-area based on the second backup parameter" in step S105 are similar to the implementation details of "backing up the IO data to the data sub-area based on the first backup parameter" in step S103, which will not be repeated here.

[0054] In another embodiment, the step S103 of “storing the first backup parameter into the parameter sub-area in the reserved area” includes: Determining the number of backup parameters stored in the parameter sub-area from the backup parameter record table; Determine a storage start position of the first backup parameter in the parameter sub-area based on a start position of the parameter sub-area in the reserved area, the number of backup parameters, and the length of the backup parameters; The first backup parameter is written into the parameter sub-area, and the starting position of writing is the storage starting position of the first backup parameter in the parameter sub-area.

[0055] In this embodiment, it is necessary to first determine the storage starting position of the first backup parameter in the parameter sub-area. The value of the num field, that is, the number of valid backup parameters stored in the parameter sub-area, can be extracted from the backup parameter record table, and the starting position of the parameter sub-area in the reserved area is determined. The starting position of the parameter sub-area in the reserved area is also fixed and can be set to addr_header0, and the length of each backup parameter is also the same and can be set to Len_Par. Then the calculation formula of the storage starting position save_Par of the first backup parameter in the parameter sub-area is as shown in Formula 2: Formula 2 In an example, the length Len_Par of each backup parameter may be 32 bytes.

[0056] In this embodiment, after determining the storage start position of the first backup parameter in the parameter sub-area, the first backup parameter may be written into the parameter sub-area, and the writing start position is the storage start position of the first backup parameter in the parameter sub-area.

[0057] It should be emphasized that the implementation details of "storing the second backup parameter to the parameter sub-area" in step S105 are similar to the implementation details of "storing the first backup parameter to the parameter sub-area in the reserved area" in step S103, and will not be repeated here.

[0058] In another embodiment, after "storing the first backup parameter into the parameter sub-area in the reserved area" in step S103, a data writing method further includes: Add 1 to the number of backup parameters in the backup parameter record table; Update the starting position of the latest IO data in the backup parameter record table to the starting position of the original latest IO data plus the length of the original latest IO data; Update the length of the latest IO data in the backup parameter record table to the length of the IO data.

[0059] In this embodiment, after the IO data is backed up to the data sub-area based on the first backup parameter and the first backup parameter is stored in the parameter sub-area in the reserved area, the backup parameter record table needs to be updated. The value of the num field in the backup parameter record table shown in Table 1 can be increased by 1, that is, the number of backup parameters can be increased by 1; the starting position of the latest IO data in the backup parameter record table shown in Table 1 can also be updated to the starting position of the original latest IO data plus the length of the original latest IO data. For example, if the starting position of the original latest IO data is , the length of the original latest IO data is , then update the value of the last_slba field in the backup parameter record table shown in Table 1 to ; The last_nlb field in the backup parameter record table shown in Table 1 can also be updated to the length of the IO data, that is, the length of the latest IO data in the backup parameter record table is updated to the length of the IO data stored this time.

[0060] It should be emphasized that after step S105 "backing up the sub-IO data to the data sub-area based on the second backup parameter, and storing the second backup parameter to the parameter sub-area", the data in the backup parameter record table will also be updated. The update process is similar to the update after "storing the first backup parameter to the parameter sub-area in the reserved area" in step S103, and will not be repeated here.

[0061] In another embodiment, the first backup parameter further includes at least one of a validity identifier of the first backup parameter, an abnormal mode identifier, a starting position of the IO data in the RAID, and a length of the IO data.

[0062] In another embodiment, the second backup parameter also includes at least one of a validity identifier of the second backup parameter, an abnormal mode identifier, a disk identifier corresponding to the sub-IO data, a starting position of the sub-IO data in the corresponding disk, and a length of the sub-IO data.

[0063] In the present disclosure, the structure of each backup parameter is shown in Table 2 below: Table 2

[0064] Among them, is_vaid is used to indicate whether the data is valid, that is, the validity mark. 0X5A5A5A5A indicates valid, and other indicates invalid. is_valid is 8 bytes. io_type represents the abnormal mode of RAID, that is, the abnormal mode identifier. In the first mode, the value of io_type is 1, and in the second mode, the value of io_type is 0. io_type is 1 byte. disk_id represents the disk ID corresponding to the sub-IO data. disk_id is only valid when the value of io_type is 0. disk_id is 1 byte. When the value of io_type is 1, slba indicates the starting position of the IO data in the RAID. When the value of io_type is 0, it indicates the starting position of the sub-IO data in the corresponding disk. Figure 5 As shown, if the value of io_type is 1, the slba of data block 14' in RAID is 14, and if the value of io_type is 0, the slba of data block 14' in disk 0 is 6, and slba is 8 bytes; When the value of nlb is 1, it indicates the length of the IO data. When the value of nlb is 0, it indicates the length of the sub-IO data. When the value of save_slba is 1, it indicates the backup starting position of the IO data in the data sub-area. When the value of io_type is 0, it indicates the backup starting position of the sub-IO data in the data sub-area. The reserve field is a reserved field that does not store any content. It is used to round up to 32 bytes so that the backup parameter can be divided by 4K. Because data access is in units of 4K, this ensures 4K alignment and prevents a backup parameter from spanning two 4K.

[0065] Figure 2A schematic diagram showing a process of a data writing method according to an embodiment of the present disclosure Figure 2 ,like Figure 2 As shown, a data writing method includes: Step S201, in response to a redundant array of independent disks RAID being in an abnormal state, determining an abnormal mode of the RAID.

[0066] Step S202 , in response to the abnormal mode being the first mode, determining a first backup parameter of input and output IO data.

[0067] Step S203: back up the IO data to the data sub-area based on the first backup parameter, and store the first backup parameter to the parameter sub-area in the reserved area.

[0068] Step S204: in response to the abnormal mode being the second mode, determining a second backup parameter of the sub-IO data corresponding to each disk in the IO data that has not been written to the disk.

[0069] Step S205: backing up the sub-IO data to the data sub-area based on the second backup parameter, and storing the second backup parameter to the parameter sub-area.

[0070] The specific implementation details of step S201 to step S205 are similar to those of step S101 to step S105 and will not be repeated here.

[0071] Step S206, in response to the abnormal disk returning to normal, the backup parameters in the parameter sub-area are read in sequence.

[0072] Step S207 , based on the backup start position in the read target backup parameters and the length of the IO data or the sub-IO data, read the target IO data or the target sub-IO data from the data sub-area into the cache.

[0073] Step S208: writing the target IO data or target sub-IO data in the cache into the target area of ​​the RAID based on the abnormal mode identifier in the target backup parameter.

[0074] In this embodiment, if the abnormal disk returns to normal, the backed-up data in the data sub-area needs to be rewritten into the RAID disk. First, the backup parameters in the parameter sub-area need to be read. Then, based on the backup start position in the read target backup parameters and the length of the IO data or sub-IO data, the target IO data or target sub-IO data is read from the data sub-area to the cache. Based on the abnormal mode identifier in the target backup parameters, the target IO data or target sub-IO data in the cache is written into the target area of ​​the RAID.

[0075] In another embodiment, step S208 "writing the target IO data or target sub-IO data in the cache into the target area of ​​the RAID based on the abnormal mode identifier in the target backup parameter" includes: In response to the abnormal mode identifier in the target backup parameter representing the first mode, based on the starting position of the IO data in the RAID and the length of the IO data in the target backup parameter, the target IO data in the cache is written into the target area of ​​the RAID; or, In response to the abnormal mode identifier in the target backup parameters representing the second mode, based on the disk identifier corresponding to the sub-IO data in the target backup parameters, the starting position of the sub-IO data in the corresponding disk and the length of the sub-IO data, the target sub-IO data in the cache is written into the target area of ​​the disk corresponding to the target sub-IO data.

[0076] In this embodiment, if the abnormal mode identifier in the target backup parameters represents the first mode, that is, the non-write phase abnormality, the target IO data is complete at this time, and the verification data block can be calculated based on the target IO data in the cache, and the verification data block can be written into the cache. Then, based on the starting position of the IO data in the target backup parameters in the RAID and the length of the IO data, the target IO data in the cache is written into the target area of ​​the RAID. The target area is the position where the target IO data should originally be written in the RAID, and based on the corresponding position of the verification data block in the RAID, the verification data block is written to the disk.

[0077] In this embodiment, if the abnormal mode identifier in the target backup parameters represents the second mode, that is, the write phase is abnormal, then based on the disk identifier corresponding to the sub-IO data in the target backup parameters, the starting position of the sub-IO data in the corresponding disk and the length of the sub-IO data, the target sub-IO data in the cache is written into the target area of ​​the disk corresponding to the target sub-IO data, and the target area is the position where the sub-IO data should originally be written in the corresponding disk.

[0078] In another embodiment, a data writing method further includes: clearing IO data and / or sub-IO data in the data sub-area; and clearing backup parameters in the parameter sub-area.

[0079] In this embodiment, after the backed-up data in the data sub-area is rewritten into the disk of the RAID, it is necessary to clear the IO data and / or sub-IO data in the data sub-area, and clear the backup parameters in the parameter sub-area. In one example, if the data is directly overwritten when the IO data or sub-IO data is written into the data sub-area, then the data sub-area does not need to be cleared; when clearing the backup parameters in the parameter sub-area, all values ​​of the backup parameters can be written as 0; and all values ​​in the backup parameter record table also need to be written as 0.

[0080] In order to facilitate the understanding of the present disclosure, the following Figure 7 , Figure 8 , Fig. 9 A data writing method in the present disclosure is explained: Figure 7 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 5 , Figure 8 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 6 , Fig. 9 A schematic diagram showing a scenario of a data writing method according to an embodiment of the present disclosure Figure 7 , assuming that the starting position of the data sub-area in the reserved area is slba0, and there are three IO inputs being written when the disk is abnormal.

[0081] The first IO data is abnormal in the non-write stage, and the IO data falls in the data block 2' to 6' position in the RAID. After the first IO data is backed up, the IO data flow path, the data sub-area and parameter sub-area in the reserved area, and the backup parameter record table are as follows: Figure 7 As shown, Figure 7 Header_contex in is the backup parameter record table, and IO1 is the IO data corresponding to the backup data block 2' to 6'.

[0082] The second IO data has a disk exception during the write phase, and the IO data falls on data blocks 14' to 22' in the RAID. In addition, data blocks 14' to 15' have been written to the disk during the write phase. When backing up, the data corresponding to data blocks 16' to 22' need to be divided into sub-IO data corresponding to data blocks 16' to 19' (data in disk 1) and sub-IO data corresponding to data blocks 20' to 22' (data in disk 3). Then, the sub-IO data corresponding to data blocks 16' to 19', the sub-IO data corresponding to data blocks 20' to 22', and the four check data blocks P' in disk 2 are backed up to the data sub-area respectively. After the backup is completed, the IO data flow path, the data sub-area and parameter sub-area in the reserved area, and the backup parameter record table are as follows: Figure 8 As shown, Figure 8 IO2 is the sub-IO data corresponding to the backed-up data blocks 16' to 19', IO3 is the 4 check data blocks P' in the backed-up disk 2, and IO3 is the sub-IO data corresponding to the backed-up data blocks 20' to 22'. In addition, for easy distinction, the 4 P' check data blocks in IO3 are marked as P0', P1', P2', and P3' respectively.

[0083] The third IO has a disk exception during the non-write phase, and the IO data falls on data blocks 29' to 34' in the RAID. After the third IO data is backed up, the IO data flow path, the data sub-area and parameter sub-area in the reserved area, and the backup parameter record table are as follows: Fig. 9 As shown, Fig. 9 IO5 in the figure is the IO data corresponding to the positions of the backed-up data blocks 29' to 34'.

[0084] When restoring the IO data backed up in the data subarea, Fig. 9 According to the first backup parameter of the parameter sub-area, IO1 is written into the 2' to 6' data blocks of the RAID; according to the second backup parameter of the parameter sub-area, IO2 is written into the 4th to 7th data blocks of the disk 1, that is, the 16' to 19' data blocks of the RAID; according to the third backup parameter of the parameter sub-area, IO3 is written into the 4th to 7th data blocks of the disk 2; according to the fourth backup parameter of the parameter sub-area, IO4 is written into the 4th to 6th data blocks of the disk 3, that is, the 20' to 22' data blocks of the RAID; according to the fifth backup parameter of the parameter sub-area, IO5 is written into the 29' to 34' data blocks of the RAID.

[0085] Fig.10 A schematic diagram of the structure of a data writing device according to an embodiment of the present disclosure is shown. Fig.10 The data writing device comprises: The determination module 10 is used to determine the abnormal mode of the RAID in response to the redundant array of independent disks RAID being in an abnormal state; the abnormal state indicates that the number of abnormal disks among the multiple disks of the RAID is greater than a first threshold value; the determination module 10 is also used to determine the first backup parameter of the input and output IO data in response to the abnormal mode being the first mode; the first mode indicates that the disk is abnormal in the non-write stage, and the first backup parameter includes the backup starting position of the IO data in the data sub-area of ​​the reserved area of ​​the RAID; the backup module 20 is used to back up the IO data to the data sub-area based on the first backup parameter, and store the first backup parameter to the parameter sub-area in the reserved area; the determination module 10 is also used to determine the second backup parameter of the sub-IO data corresponding to each disk in the IO data that has not been written to the disk in response to the abnormal mode being the second mode; the second mode indicates that the disk is abnormal in the write stage, and the second backup parameter includes the backup starting position of the sub-IO data in the data sub-area; the backup module 20 is also used to back up the sub-IO data to the data sub-area based on the second backup parameter, and store the second backup parameter to the parameter sub-area.

[0086] In one embodiment, the determination module 10 is further used to: determine the starting position of the data sub-area in the reserved area; determine the starting position of the latest IO data in the data sub-area and the length of the latest IO data from the backup parameter record table; and determine the backup starting position of the IO data in the data sub-area based on the starting position of the data sub-area in the reserved area, the starting position of the latest IO data in the data sub-area, and the length of the latest IO data.

[0087] In one possible implementation, the backup module 20 is further used to: write the IO data from the cache into the data sub-area, and the starting position of the writing is the backup starting position of the IO data in the data sub-area.

[0088] In one embodiment, the backup module 20 is further used to: determine the number of backup parameters stored in the parameter sub-area from the backup parameter record table; determine the storage starting position of the first backup parameter in the parameter sub-area based on the starting position of the parameter sub-area in the reserved area, the number of backup parameters and the length of the backup parameters; write the first backup parameter into the parameter sub-area, and the writing starting position is the storage starting position of the first backup parameter in the parameter sub-area.

[0089] In one embodiment, the data writing device also includes an update module, which is used to: increase the number of backup parameters in the backup parameter record table by 1; update the starting position of the latest IO data in the backup parameter record table to the starting position of the original latest IO data plus the length of the original latest IO data; update the length of the latest IO data in the backup parameter record table to the length of the IO data.

[0090] In one possible implementation, the first backup parameter further includes at least one of a validity identifier of the first backup parameter, an abnormal mode identifier, a starting position of the IO data in the RAID, and a length of the IO data.

[0091] In one embodiment, the second backup parameter also includes at least one of a validity identifier of the second backup parameter, an abnormal mode identifier, a disk identifier corresponding to the sub-IO data, a starting position of the sub-IO data in the corresponding disk, and a length of the sub-IO data.

[0092] In one possible implementation, the data writing device also includes a recovery module, which is used to: in response to the abnormal disk returning to normal, read the backup parameters in the parameter sub-area in sequence; based on the backup start position in the read target backup parameters and the length of the IO data or sub-IO data, read the target IO data or target sub-IO data from the data sub-area to the cache; based on the abnormal mode identifier in the target backup parameters, write the target IO data or target sub-IO data in the cache into the target area of ​​RAID.

[0093] In one embodiment, the recovery module is further used to: in response to the abnormal mode identifier in the target backup parameter representing the first mode, write the target IO data in the cache into the target area of ​​the RAID based on the starting position of the IO data in the target backup parameter in the RAID and the length of the IO data; or, in response to the abnormal mode identifier in the target backup parameter representing the second mode, write the target sub-IO data in the cache into the target area of ​​the disk corresponding to the target sub-IO data based on the disk identifier corresponding to the sub-IO data in the target backup parameter, the starting position of the sub-IO data in the corresponding disk, and the length of the sub-IO data.

[0094] In one possible implementation, the recovery module is further used to: calculate a check data block based on the target IO data in the cache, and write the check data block into the cache.

[0095] In one possible implementation, the data writing device further includes a clearing module, which is used to: clear IO data and / or sub-IO data in the data sub-area; and clear backup parameters in the parameter sub-area.

[0096] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0097] Fig.11 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0098] like Fig.11 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0099] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0100] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as a data writing method. For example, in some embodiments, a data writing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of a data writing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform a data writing method in any other appropriate manner (e.g., by means of firmware).

[0101] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0102] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0103] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0104] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0105] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0106] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0107] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0108] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0109] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A data writing method, characterized in that: The method comprises: In response to a redundant array of independent disks RAID being in an abnormal state, determining an abnormal mode of the RAID; the abnormal state indicating that the number of abnormal disks among the plurality of disks of the RAID is greater than a first threshold; In response to the abnormal mode being the first mode, determining a first backup parameter of the input / output IO data; the first mode indicates that an abnormality occurs in the disk during a non-write phase, and the first backup parameter includes a backup start position of the IO data in a data sub-area of ​​a reserved area of ​​the RAID; Backing up the IO data to the data sub-area based on the first backup parameter, and storing the first backup parameter to the parameter sub-area in the reserved area; In response to the abnormal mode being the second mode, determining a second backup parameter of the sub-IO data corresponding to each disk in the IO data that has not been written to the disk; the second mode indicates that an abnormality occurs in the disk writing phase, and the second backup parameter includes a backup start position of the sub-IO data in the data sub-area; The sub-IO data is backed up to the data sub-area based on the second backup parameter, and the second backup parameter is stored in the parameter sub-area.

2. The method according to claim 1, characterized in that The step of determining the first backup parameter of the input and output IO data includes: Determine a starting position of the data sub-area in the reserved area; Determine the starting position of the latest IO data in the data sub-area and the length of the latest IO data from the backup parameter record table; A backup starting position of the IO data in the data sub-area is determined based on the starting position of the data sub-area in the reserved area, the starting position of the latest IO data in the data sub-area, and the length of the latest IO data.

3. The method according to claim 1, characterized in that The backing up the IO data to the data sub-area based on the first backup parameter includes: The IO data is written from the cache into the data sub-area, and the writing start position is the backup start position of the IO data in the data sub-area.

4. The method according to claim 1, characterized in that: The storing the first backup parameter in the parameter sub-area in the reserved area includes: Determining the number of backup parameters stored in the parameter sub-area from the backup parameter record table; Determine a storage starting position of the first backup parameter in the parameter sub-area based on a starting position of the parameter sub-area in the reserved area, the number of the backup parameters, and the length of the backup parameters; The first backup parameter is written into the parameter sub-area, and the writing start position is the storage start position of the first backup parameter in the parameter sub-area.

5. The method according to claim 1, characterized in that After storing the first backup parameter in the parameter sub-area in the reserved area, the method further includes: Add 1 to the number of backup parameters in the backup parameter record table; Update the starting position of the latest IO data in the backup parameter record table to the starting position of the original latest IO data plus the length of the original latest IO data; The length of the latest IO data in the backup parameter record table is updated to the length of the IO data.

6. The method according to claim 1, characterized in that The first backup parameter also includes at least one of a validity identifier of the first backup parameter, an abnormal mode identifier, a starting position of the IO data in the RAID, and a length of the IO data.

7. The method according to claim 1, characterized in that The second backup parameter also includes at least one of a validity identifier of the second backup parameter, an abnormal mode identifier, a disk identifier corresponding to the sub-IO data, a starting position of the sub-IO data in the corresponding disk, and a length of the sub-IO data.

8. The method according to claim 1, characterized in that The method further comprises: In response to the abnormal disk returning to normal, reading the backup parameters in the parameter sub-area in sequence; Based on the backup start position in the read target backup parameters and the length of the IO data or the sub-IO data, read the target IO data or the target sub-IO data from the data sub-area into the cache; Based on the abnormal mode identifier in the target backup parameter, the target IO data or the target sub-IO data in the cache is written into the target area of ​​the RAID.

9. The method according to claim 8, characterized in that The step of writing the target IO data or the target sub-IO data in the cache into the target area of ​​the RAID based on the abnormal mode identifier in the target backup parameter comprises: In response to the abnormal mode identifier in the target backup parameter representing the first mode, based on the starting position of the IO data in the target backup parameter in the RAID and the length of the IO data, the target IO data in the cache is written into the target area of ​​the RAID; or, In response to the abnormal mode identifier in the target backup parameters representing the second mode, based on the disk identifier corresponding to the sub-IO data in the target backup parameters, the starting position of the sub-IO data in the corresponding disk and the length of the sub-IO data, the target sub-IO data in the cache is written into the target area of ​​the disk corresponding to the target sub-IO data.

10. The method according to claim 9, characterized in that Before writing the target IO data in the cache into the target area of ​​the RAID, the method further includes: A check data block is calculated based on the target IO data in the cache, and the check data block is written into the cache.

11. The method according to claim 10, characterized in that The method further comprises: Clearing the IO data and / or sub-IO data in the data sub-area; Clear the backup parameters in the parameter sub-area.

12. A data writing device, characterized in that: The device comprises: A determination module, configured to determine an abnormal mode of the RAID in response to a redundant array of independent disks RAID being in an abnormal state; the abnormal state indicates that the number of abnormal disks among the multiple disks of the RAID is greater than a first threshold; The determination module is further configured to determine a first backup parameter of input / output IO data in response to the abnormal mode being a first mode; the first mode indicates that an abnormality occurs in the disk during a non-write phase, and the first backup parameter includes a backup start position of the IO data in a data sub-area of ​​a reserved area of ​​the RAID; A backup module, configured to back up the IO data to the data sub-area based on the first backup parameter, and store the first backup parameter to the parameter sub-area in the reserved area; The determination module is further configured to determine, in response to the abnormal mode being the second mode, a second backup parameter of the sub-IO data corresponding to each disk in the IO data that has not yet been written to the disk; the second mode indicates that an abnormality occurs in the disk writing phase, and the second backup parameter includes a backup start position of the sub-IO data in the data sub-area; The backup module is further configured to back up the sub-IO data to the data sub-area based on the second backup parameter, and store the second backup parameter to the parameter sub-area.

13. The device according to claim 12, characterized in that The determining module is further used for: Determine a starting position of the data sub-area in the reserved area; Determine the starting position of the latest IO data in the data sub-area and the length of the latest IO data from the backup parameter record table; A backup starting position of the IO data in the data sub-area is determined based on the starting position of the data sub-area in the reserved area, the starting position of the latest IO data in the data sub-area, and the length of the latest IO data.

14. The device according to claim 12, characterized in that The backup module is further used for: The IO data is written from the cache into the data sub-area, and the writing start position is the backup start position of the IO data in the data sub-area.

15. The device according to claim 12, characterized in that The backup module is further used for: Determining the number of backup parameters stored in the parameter sub-area from the backup parameter record table; Determine a storage starting position of the first backup parameter in the parameter sub-area based on a starting position of the parameter sub-area in the reserved area, the number of the backup parameters, and the length of the backup parameters; The first backup parameter is written into the parameter sub-area, and the writing start position is the storage start position of the first backup parameter in the parameter sub-area.

16. The device according to claim 12, characterized in that The data writing device further includes an updating module, which is used for: Add 1 to the number of backup parameters in the backup parameter record table; Update the starting position of the latest IO data in the backup parameter record table to the starting position of the original latest IO data plus the length of the original latest IO data; The length of the latest IO data in the backup parameter record table is updated to the length of the IO data.

17. The device according to claim 12, characterized in that The first backup parameter also includes at least one of a validity identifier of the first backup parameter, an abnormal mode identifier, a starting position of the IO data in the RAID, and a length of the IO data.

18. The device according to claim 12, characterized in that The second backup parameter also includes at least one of a validity identifier of the second backup parameter, an abnormal mode identifier, a disk identifier corresponding to the sub-IO data, a starting position of the sub-IO data in the corresponding disk, and a length of the sub-IO data.

19. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.

20. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1-11.

Citation Information

Patent Citations

  • Method for managing Nandflash memory data

    CN106407130A

  • Data recovery method and related equipment

    CN111240903A

  • Array access method and device, storage equipment and machine readable storage medium

    CN112181298A

  • Data backup method and device, storage medium and electronic equipment

    CN112817794A

  • Secure storage method and device, equipment and storage medium

    CN115793985A