Data storage method, device, medium and product

By managing the writing of target stripes and check values ​​in the disk array controller, it solves the problems of low write performance and waste of hot spare disk space in RAID5 arrays, and achieves RAID6 array-level data security protection and data recovery capabilities.

CN118779146BActive Publication Date: 2025-01-24SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411268036.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2025-01-24
Estimated Expiration
2044-09-11

AI Technical Summary

Technical Problem

The RAID5 array has low performance when writing data, and the hot spare disk is idle for most of the time, so it cannot make full use of the space; if disk corruption occurs again during data recovery, data loss may occur.

Method used

In the controller of the disk arrays, receive the request of the host side, calculate the target strip, and write the target data and the first school inspection to the data disk area, and write the second school's test value into the heat disk area. Through cache space management and red and black tree structures, delay the writing value of the second school, improve the writing performance, and rationally use the heat disk space.

Benefits of technology

It achieves the same data reading and writing performance as a RAID5 array, while rationally utilizing the hot spare disk space, providing the same double check value data security protection mechanism as a RAID6 array, and can cope with data recovery when two data disks fail.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779146B_ABST
    Figure CN118779146B_ABST
Patent Text Reader

Abstract

The present application provides a data storage method, device, medium and product, which relate to the field of data processing technology and are applied to a controller of a disk array including a data disk and a hot spare disk. The method comprises: receiving a write request sent by a host end, calculating a target stripe based on the write request, and writing the target data corresponding to the write request and a first check value corresponding to the target data into a data disk area of ​​the target stripe; writing a second check value corresponding to the target data into a hot spare disk area of ​​the target stripe. By storing the data and the first check value in the data disk, the same data reading and writing performance as that of a RAID 5 array can be achieved. At the same time, the second check value is stored in the hot spare disk, so that the space in the hot spare disk can be reasonably used to store the second check value, thereby avoiding idleness and waste of the hot spare disk space, and providing a data security protection mechanism with dual check values ​​that is the same as that of a RAID 6 array.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data storage method, device, medium and product. Background Art

[0002] In recent years, RAID (Redundant Array of Independent Disks) is a storage technology that improves storage performance and reliability by increasing the ability to verify redundancy. RAID technology can combine multiple disks to provide a single usable logical disk with larger capacity, concurrent I / O read and write capabilities, and data redundancy capabilities. RAID arrays use striping, mirroring, and verification to ensure data security. Its development has mainly gone through the following: RAID0, RAID1, RAID10, RAID5, and RAID6. Among them, RAID5 adds P verification blocks to the disk array, and the data of a failed disk can be restored through the P verification blocks. Subsequently, RAID6 adds Q verification blocks to the disk array, and the data of two failed disks in the RAID6 array can be restored by verifying the P and Q verification blocks. At present, the industry has proposed hard RAID storage technology (RAID card) based on soft RAID storage technology. As the name suggests, hard RAID storage technology is to hand over some algorithms, data management, and some functions in soft RAID storage technology to hardware management and implementation to improve the I / O performance of the storage system.

[0003] RAID5 / RAID6 array technology has the following advantages and disadvantages:

[0004] RAID6 array has two check blocks, so it can tolerate the damage of two disks without data loss. Its data security is higher, but compared with RAID5 array, it needs to calculate one more check value when writing data, and writes to the disk once more, so the performance is relatively low.

[0005] If a disk fails during use of a RAID5 array, data redundancy protection will be lost. A common practice is to equip a RAID5 array with a hot spare disk. When a disk fails, the data on the damaged disk can be reconstructed and re-stored on the hot spare disk through a data recovery algorithm. This leads to a problem that the hot spare disk is idle most of the time, and the space of the hot spare disk cannot be fully utilized.

[0006] In addition, when a RAID5 array is reconstructed after a disk is damaged, if other disks are damaged again, data loss may occur. Summary of the invention

[0007] In view of this, embodiments of the present application provide a data storage method, device, medium and product to overcome the above problems or at least partially solve the above problems.

[0008] A first aspect of an embodiment of the present application provides a data storage method, which is applied to a controller of a disk array, wherein the disk array includes a data disk and a hot spare disk, and the method includes:

[0009] Receive a write request from a host end, and based on the write request, calculate a target stripe in the disk array corresponding to the write request, wherein the target stripe includes a data disk area and a hot spare disk area, wherein the data disk includes data disk areas of multiple stripes, and the hot spare disk includes hot spare disk areas of multiple stripes;

[0010] Writing the target data corresponding to the write request and the first check value corresponding to the target data into the data disk area of ​​the target stripe;

[0011] The second check value corresponding to the target data is written into the hot spare disk area of ​​the target stripe.

[0012] Optionally, after writing the target data corresponding to the write request and the first check value corresponding to the target data into the data disk area of ​​the target stripe, the method further includes:

[0013] Returning a write success response to the write request to the host end;

[0014] Writing the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe includes:

[0015] After returning a write success response to the write request to the host, a second check value corresponding to the target data is written into the hot spare disk area of ​​the target stripe.

[0016] Optionally, the method further comprises:

[0017] Allocating storage space from the memory of the controller as a cache space for the disk array, wherein the cache space is used to cache the second check value;

[0018] Before writing the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe, the method further includes: caching the second check value corresponding to the target data in the cache space.

[0019] Optionally, writing the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe includes:

[0020] When a preset condition for writing the second check value into the hot spare disk area is triggered, writing the second check value cached in the cache space into the hot spare disk area;

[0021] The preset condition includes any one of the following:

[0022] The current load of the controller of the disk array is lower than a first preset threshold;

[0023] And / or, the occupancy of the cache space reaches a second preset threshold.

[0024] Optionally, the second check value is managed in the cache space in the form of a red-black tree, and each node of the red-black tree corresponds to the second check value of a stripe; and writing the second check value cached in the cache space into the hot spare disk area comprises:

[0025] Calculating the second check value, and judging whether there is a node corresponding to the target stripe in the red-black tree based on the stripe ID of the target stripe;

[0026] When there is a node corresponding to the target stripe in the red-black tree, updating the data of the first cache area in the cache space pointed to by the node corresponding to the target stripe to the second check value, and making the node corresponding to the target stripe point to the logical block address in the write request;

[0027] When there is no node corresponding to the target stripe in the red-black tree, applying for a second cache area in the cache space, and writing the second check value into the second cache area;

[0028] A new node is constructed in the red-black tree, and relevant information of the second check value is filled in the new node, wherein the relevant information of the second check value includes: the data block address corresponding to the second cache area, the disk array ID of the disk array, the stripe ID of the target stripe, and the node corresponding to the target stripe points to the logical block address in the write request.

[0029] Optionally, writing the second check value cached in the cache space into the hot spare disk area includes:

[0030] Mark the red-black tree as a write state;

[0031] Creating a new red-black tree, and associating the new red-black tree with the disk array;

[0032] The red-black tree is traversed in order, and multiple second check values ​​corresponding to the red-black tree are written into the hot spare disk area in an ascending order of the logical block address in the write request.

[0033] Optionally, after creating a new red-black tree and associating the new red-black tree with the disk array, the method further includes:

[0034] When a new second check value needs to be written, a new node is created in the new red-black tree;

[0035] The relevant information of the second check value is written into the new node, and the relevant information of the second check value includes: the data block address corresponding to the second cache area, the disk array ID of the disk array, the stripe ID of the target stripe, and the node corresponding to the target stripe points to the logical block address in the write request.

[0036] Optionally, the calculating, based on the write request, a target stripe in the disk array corresponding to the write request includes:

[0037] Obtaining a logical block address in the write request, a length of the target data, and a size of a single data block contained in the stripe;

[0038] The target stripe corresponding to the write request is calculated according to the logical block address, the length of the target data, and the size of a single data block contained in the stripe.

[0039] Optionally, the method further comprises:

[0040] When a data disk in the disk array fails, the data stored in the failed data disk is restored based on the data stored in other non-failed data disks in the disk array except the failed data disk and the first check value, and / or the second check value stored in the hot spare disk.

[0041] Optionally, the method further comprises:

[0042] When a first data disk in the disk array fails, based on data and first check values ​​stored in other data disks other than the first data disk in the disk array that are not failed, the data and first check values ​​in each data disk area contained in the failed first data disk are sequentially restored;

[0043] According to the same stripe, the recovered data and the first check value are stored in a hot spare disk area in the hot spare disk corresponding to each data disk area included in the failed first data disk.

[0044] Optionally, the method further comprises:

[0045] In the event that a second data disk fails during fault recovery of the failed first data disk, the data that has not yet been recovered in the first data disk and the data contained in each data disk area in the second data disk are recovered in sequence based on the data and the first check value in other non-failed data disks in the disk array except the first data disk and the second data disk, and the second check value in the hot spare disk.

[0046] Optionally, the method further comprises:

[0047] When no data disk failure or only one data disk failure occurs in the disk array, the hot spare disk is removed, or other requests from the host are responded to through the hot spare disk.

[0048] A second aspect of an embodiment of the present application provides a data storage device, which is applied to a controller of a disk array, wherein the disk array includes a data disk and a hot spare disk, and the device includes:

[0049] A calculation module, configured to receive a write request from a host end, and based on the write request, calculate a target stripe in the disk array corresponding to the write request, wherein the target stripe includes a data disk area and a hot spare disk area, wherein the data disk includes data disk areas of multiple stripes, and the hot spare disk includes hot spare disk areas of multiple stripes;

[0050] A first writing module, used for writing the target data corresponding to the write request and a first check value corresponding to the target data into a data disk area of ​​the target stripe;

[0051] The second writing module is used to write the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe.

[0052] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method described in the first aspect.

[0053] In a fourth aspect of the embodiments of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements the method described in the first aspect.

[0054] According to a fifth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the method described in the first aspect is implemented.

[0055] Beneficial effects of this application:

[0056] The embodiments of the present application provide a data reading method, device, medium and product, which are applied to a controller of a disk array, wherein the disk array includes a data disk and a hot spare disk, and the method includes: receiving a write request issued by a host end, and based on the write request, calculating a target stripe corresponding to the write request in the disk array, wherein the target stripe includes a data disk area and a hot spare disk area, wherein the data disk includes data disk areas of multiple stripes, and the hot spare disk includes hot spare disk areas of multiple stripes; writing target data corresponding to the write request and a first check value corresponding to the target data into the data disk area of ​​the target stripe; and writing a second check value corresponding to the target data into the hot spare disk area of ​​the target stripe.

[0057] Through the above embodiments, a new disk array is provided, in which target data and check values ​​are stored according to a new data storage method, wherein the data and the first check value are stored in the data disk, which can achieve the same data reading and writing performance as the RAID5 array. At the same time, the second check value is stored in the hot spare disk, which can reasonably utilize the space in the hot spare disk to store the second check value, avoiding the idleness and waste of the hot spare disk space, and can provide the same dual check value data security protection mechanism as the RAID6 array, and can cope with data recovery in the event of failure of two data disks. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application.

[0059] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0060] Figure 1 It is a flowchart of a data storage method provided by an embodiment of the present application;

[0061] Figure 2 This is a schematic diagram of a traditional RAID5 array;

[0062] Figure 3 This is a schematic diagram of a traditional RAID6 array;

[0063] Figure 4 is a schematic diagram of a disk array provided by an embodiment of the present application;

[0064] Figure 5It is a schematic diagram of a disk array and cache space provided by an embodiment of the present application;

[0065] Figure 6 is a flow chart of a data storage method provided by another embodiment of the present application;

[0066] Figure 7 It is a schematic diagram of a process of writing a second check value into a hot spare disk provided by an embodiment of the present application;

[0067] Figure 8 It is a schematic diagram of data recovery of a RAID5 array shown in the related art;

[0068] Fig. 9 It is a schematic diagram of data recovery of a disk array shown in an embodiment of the present application;

[0069] Fig.10 It is a schematic diagram of a data storage device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0070] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.

[0071] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0072] RAID: Redundant Array of Independent Disks, a redundant array composed of independent disks. RAID is a large-capacity disk group composed of many independent disks. It uses the additive effect of individual disks to provide data to improve the performance of the entire disk system. Using this technology, data is divided into many segments and stored on each hard disk.

[0073] Chunk: Also known as strip; a partition is divided into multiple blocks of equal size and adjacent addresses. These blocks are called chunks. Chunks are usually considered to be elements of stripes. Virtual disks use chunks as units to map virtual disk addresses to member disk addresses.

[0074] Stripe: Also known as stripe; it is a collection of position-related strips on different partitions of the array, and is the unit for organizing blocks on different partitions. In RAID5 and RAID6, the parity block is obtained from the data block using a certain algorithm with the stripe as the unit.

[0075] RAID5: A disk array configuration that provides data redundancy and performance enhancement by distributing and storing data and parity information on multiple hard drives. Each stripe of the Raid array stores a parity data block while storing the user data block. When one disk drive in the array is damaged, the lost data stripe can be regenerated by the remaining hard drives.

[0076] RAID6: A disk array configuration that provides higher data redundancy and fault tolerance over RAID5. RAID6 uses two parity blocks in each data stripe instead of one. This means that even if two hard drives fail at the same time, the system can continue to operate and the lost data stripes can be regenerated by the remaining hard drives:

[0077] Hot Spare: A spare disk used to replace a failed disk in a RAID (Redundant Array of Independent Disks) array. A hot spare disk usually remains active in a RAID array, but does not participate in data read and write operations. Instead, it automatically replaces the failed disk and restores the normal operation of the RAID array when a failure of another disk is detected.

[0078] Red-black tree: A self-balancing binary search tree whose nodes can be red or black. By adjusting the color of the nodes and rotating the positions of the nodes, it can automatically maintain balance after operations such as insertion and deletion, thereby ensuring that the time complexity of its query, insertion, deletion and other operations is O(log n). Moreover, it has high space efficiency and does not require additional space to store information such as balance factors. Each node only needs a color flag bit, so it has higher space efficiency than other balanced tree data structures. After operations such as insertion and deletion, the red-black tree can maintain the relative order of the input data, that is, the relative position of elements of the same size will not change after insertion. Therefore, the red-black tree is an ideal data structure for sorting random IO data in the cache.

[0079] LBA: Logical Block Addressing is a method used to locate data in computer storage devices. In LBA, each logical block is assigned a unique address instead of using a combination of cylinders, heads, and sectors as before. This simplifies the management of data access while increasing the capacity and performance of storage devices. LBA is commonly used in storage devices such as hard drives and optical drives.

[0080] Based on the technical problems described in the above background technology, it is necessary to improve the traditional RAID array technology to further improve the data security of the RAID5 array without reducing the performance of the RAID5 array, and reduce the waste of hot spare disk space in the RAID array.

[0081] In view of this, the present application proposes a technology for improving the security of RAID5 array data without reducing the performance of the RAID5 array. Specifically, the hot spare disk of the RAID5 array is used to store the second check value, and the second check value is aggregated and then written with a delay. In this way, the data security of the RAID5 array can be improved without reducing the IO performance of the RAID5 array.

[0082] The hot spare disk used to store the second check value can also be kicked out of the array at any time for other uses. The array technology provided by the present application is between RAID5 and RAID6, and is referred to as RAID5+ array or RAID5plus array in the present application.

[0083] Figure 1 is a flow chart of a data storage method provided by an embodiment of the present application, such as Figure 1 shown.

[0084] An embodiment of the present application provides a data storage method, which is applied to a controller of a disk array, wherein the disk array includes a data disk and a hot spare disk, and the method includes:

[0085] In step S101, a write request sent by a host is received, and based on the write request, a target stripe corresponding to the write request in the disk array is calculated, wherein the target stripe includes a data disk area and a hot spare disk area, wherein the data disk includes data disk areas of multiple stripes, and the hot spare disk includes hot spare disk areas of multiple stripes;

[0086] In step S102, the target data corresponding to the write request and the first check value corresponding to the target data are written into the data disk area of ​​the target stripe;

[0087] In step S103, the second check value corresponding to the target data is written into the hot spare disk area of ​​the target stripe.

[0088] first, Figure 2 This is a schematic diagram of a traditional RAID5 array. Figure 3 This is a schematic diagram of a traditional RAID6 array. Figure 2 and Figure 3 As shown, Figure 2 and Figure 3 The digital part in represents data, P represents the first check value P, and Q represents the second check value Q.

[0089] If the traditional RAID5 array technology is used, firstly, the traditional RAID5 array can only provide data protection for a single parity block, and at the same time, the space of the hot spare disk is wasted.

[0090] If RAID6 array technology is used, although it provides data protection for two parity values, it will reduce data writing performance.

[0091] Figure 4 is a schematic diagram of a disk array provided by an embodiment of the present application, and a data storage method provided by the present application is applied to Figure 4 In the controller of the disk array shown, the disk array includes a data disk and a hot spare disk.

[0092] In step S101, when the host needs to write target data to the disk array, it will send a write request for writing the target data to the controller of the disk array. After receiving the write request sent by the host, the controller of the disk array can calculate the target stripe corresponding to the write request in the disk array based on the received write request. The target stripe is used to store the target data corresponding to the write request.

[0093] Among them, Figure 4 As shown, the disk array contains multiple disks. Figure 4 Each column in corresponds to a disk. Figure 4 Each row in the table corresponds to a stripe. Disks are divided into two types: data disks and hot spare disks. Each data disk can be divided into multiple data disk areas. Different data disk areas are distributed on different stripes. Similarly, each hot spare disk can be divided into multiple hot spare disk areas. Different hot spare disk areas are also distributed on different stripes. The data disk area is used to store the first check value and data, and the hot spare disk area is used to store the second check value. A stripe contains both data disk areas and hot spare disk areas. That is to say, the target stripe includes data disk areas and hot spare disk areas. The data disk contains data disk areas of multiple stripes, and the hot spare disk contains hot spare disk areas of multiple stripes. The target data and check values ​​of the write request are stored in each area of ​​the target stripe.

[0094] Further, in step S102, the target data is stored in various disks of the disk array in a dispersed manner. After determining the target stripe for writing the target data, the target data corresponding to the write request and the first check value corresponding to the target data are written to the multiple data disk areas contained in the target stripe.

[0095] Finally, in step S103, when writing the second check value, the present application does not adopt the traditional RAID6 array to store the second check value in each disk in a dispersed manner, but stores the second check value in the storage space of the hot spare disk, fully considering the fact that the hot spare disk may be replaced at any time, and ensures that the data is not affected during the replacement of the hot spare disk. Therefore, after writing the target data and the first check value corresponding to the target data, the second check value corresponding to the target data is written to the hot spare disk area of ​​the target stripe.

[0096] Through the above embodiments, a new disk array is provided, in which target data and check values ​​are stored according to a new data storage method, wherein the data and the first check value are stored in the data disk, which can achieve the same data reading and writing performance as the RAID5 array. At the same time, the second check value is stored in the hot spare disk, which can reasonably utilize the space in the hot spare disk to store the second check value, avoiding the idleness and waste of the hot spare disk space, and can provide the same dual check value data security protection mechanism as the RAID6 array.

[0097] Optionally, after step S102, the method further includes:

[0098] Returning a write success response to the write request to the host end;

[0099] The step S103 includes:

[0100] After returning a write success response to the write request to the host, a second check value corresponding to the target data is written into the hot spare disk area of ​​the target stripe.

[0101] Specifically, in one embodiment, the second check value is written after the target data and the first check value are written, in order to further improve the write performance of the disk array and avoid the hot spare disk writing time being too long, which affects the response time of the write request. Therefore, after step S102 is completed, a write success response to the write request can be immediately returned to the host end to inform the host end that the target data has been successfully written into the disk array.

[0102] After returning a successful write response to the host, the second check value corresponding to the target data is calculated and written to the hot spare disk area of ​​the target stripe. In this way, the host does not need to wait for the second check value to be written to the hot spare disk.

[0103] Through the above embodiments, it is possible to provide IO write performance and latency comparable to those of traditional raid5. After the first check value P and target data are written to the disk array, a response is immediately given to the host, thereby improving the write performance of the disk array, reducing latency, improving the user experience on the host side, and improving scalability.

[0104] Optionally, to ensure data integrity and availability in the event of unexpected situations (such as power failure or hardware error), you can use the following methods:

[0105] Redundant writing: Write the target data and the first checksum to multiple data disks. If one data disk fails, the data can still be recovered from other data disks.

[0106] Checksum: A checksum algorithm is used to verify the integrity of the data. If an error is detected, the damaged data can be reconstructed based on the checksum.

[0107] Copy-on-write: Before writing the target data to the primary storage device, it is copied to another device (such as flash memory). If the primary storage device fails, the copy can be used to restore the data.

[0108] Hot spare disk: Use one or more hot spare disks in a disk array. If a data disk fails, the hot spare disk can automatically take over and rebuild the lost data.

[0109] Optionally, the method further comprises:

[0110] Allocating storage space from the memory of the controller as a cache space for the disk array, wherein the cache space is used to cache the second check value;

[0111] Before step S103, the method further includes: caching a second check value corresponding to the target data in the cache space.

[0112] Specifically, in one embodiment, in order to further optimize the write performance of the disk array, the controller of the disk array can pre-allocate a portion of storage space in the memory of the controller for the disk array as a cache space for caching the second check value.

[0113] The second check values ​​corresponding to multiple write requests can be cached in the cache space before being written to the hot spare disk. By caching the second check value in the memory of the controller instead of directly writing it to the hot spare disk after each write request, the write operation to the hot spare disk can be reduced. In addition, caching the second check value in the memory of the controller can increase the write speed because writing to the memory of the controller is much faster than writing to the hot spare disk. This is beneficial for applications that need to write data quickly (such as databases or logging systems).

[0114] The above embodiments can improve the writing performance of the disk array, and are particularly suitable for applications that require rapid writing of large amounts of data and check values.

[0115] Optionally, the step S103 includes:

[0116] When a preset condition for writing the second check value into the hot spare disk area is triggered, writing the second check value cached in the cache space into the hot spare disk area;

[0117] The preset condition includes any one of the following:

[0118] The current load of the controller of the disk array is lower than a first preset threshold;

[0119] And / or, the occupancy of the cache space reaches a second preset threshold.

[0120] Specifically, in one embodiment, the preset conditions for triggering the writing of the second check value from the cache space to the hot spare disk area include two conditions. One is when the current load of the controller of the disk array is lower than the first preset threshold, that is, when the current load of the controller of the disk array is low, the disk array is in an idle state at this time, and the second check value cached in the cache space can be written into the hot spare disk area during this time without affecting the progress of other tasks. The other is when the occupancy of the cache space reaches the second preset threshold, that is, when there is insufficient free space in the cache space, the second check values ​​corresponding to the multiple cached write requests need to be written into the hot spare disk area at this time to ensure that the cache space can accommodate the second check values ​​corresponding to the new write request. Both triggering methods are monitored by the controller.

[0121] Among them, the first preset threshold and the second preset threshold can be set according to actual needs. When the controller mode load is lower than the first preset threshold, it means that the controller is currently in an idle state. When the occupancy of the storage space reaches the second preset threshold, it means that there is insufficient free space in the storage space.

[0122] Through the above embodiments, two triggering methods for writing the second verification value from the cache space to the hot spare disk are provided. The second verification value is written to the disk when the controller is idle or the data accumulates to a certain amount. This can effectively utilize the idle time when the controller load is low and can timely free up free space for other second verification value writing operations when the cache space occupancy rate is high.

[0123] In addition, there are several other ways to trigger the writing operation of the second check value:

[0124] Timed interval: Trigger the writing of the second checksum value at regular intervals (for example, every 5 minutes or every hour). This ensures that the second checksum value is regularly written to the hot spare disk area even if the controller load is high or the cache space usage is low.

[0125] Direct writing: When the expander load is low, the second check value is directly written to the hot spare disk area without passing through the cache space, thereby simplifying the writing process of the second check value.

[0126] Data protection strategy: Combine the write trigger of the second check value with the data protection strategy. For example, the write operation of the second check value can be triggered when creating a new snapshot or backup to ensure that the second check value is included in these protection operations.

[0127] For example:

[0128] File server: Trigger the writing of the second checksum value every 30 minutes to ensure that the checksum value is regularly written to the hot spare disk area even when the server load is high.

[0129] Hypervisor: triggers writing of the second checksum when creating a snapshot of the virtual machine to ensure that the checksum is included in the snapshot.

[0130] The specific trigger method selected will depend on the requirements of the application or data protection policy.

[0131] Optionally, the second check value is managed in the cache space in the form of a red-black tree, and each node of the red-black tree corresponds to the second check value of a stripe; and writing the second check value cached in the cache space into the hot spare disk area comprises:

[0132] Calculating the second check value, and judging whether there is a node corresponding to the target stripe in the red-black tree based on the stripe ID of the target stripe;

[0133] When there is a node corresponding to the target stripe in the red-black tree, updating the data of the first cache area in the cache space pointed to by the node corresponding to the target stripe to the second check value, and making the node corresponding to the target stripe point to the logical block address in the write request;

[0134] When there is no node corresponding to the target stripe in the red-black tree, applying for a second cache area in the cache space, and writing the second check value into the second cache area;

[0135] A new node is constructed in the red-black tree, and relevant information of the second check value is filled in the new node, wherein the relevant information of the second check value includes: the data block address corresponding to the second cache area, the disk array ID of the disk array, the stripe ID of the target stripe, and the node corresponding to the target stripe points to the logical block address in the write request.

[0136] Figure 5 is a schematic diagram of a disk array and cache space provided in an embodiment of the present application. Figure 6 It is a flowchart of a data storage method provided by another embodiment of the present application.

[0137] Specifically, in one embodiment, Figure 5 As shown, a plurality of second check values ​​in the cache space can be managed by a red-black tree, wherein each node of the red-black tree corresponds to a second check value of data stored in a stripe of the disk array, and each node stores relevant information of the associated second check value. Figure 5 For example, each disk array is marked with the array ID, array type, data disk, hot spare disk and cache address of the cache space where the second check value is located. For the cache space, the data blocks where multiple second check values ​​are located are managed through each node of the red-black tree, and each node records the array ID, stripe ID and data block address of the data block where the second check value is located for each second check value.

[0138] After writing the first check value and the target data, the second check value corresponding to the target data is calculated, and according to the stripe ID corresponding to the target stripe storing the target data, the existing nodes in the red-black tree are traversed to determine whether there is a node corresponding to the target stripe in the red-black tree.

[0139] When there is a node corresponding to the target stripe in the red-black tree, it means that the write request at this time is to change the target data. Therefore, it is necessary to update the data of the first cache area in the cache space pointed to by the node corresponding to the target stripe to the second verification value. At this time, the data of the first cache area in the cache space pointed to by the node corresponding to the target stripe is the second verification value corresponding to the target data before the change. After the second verification value is updated, the node corresponding to the target stripe is pointed to the logical block address in the write request, so as to associate the node corresponding to the second verification value in the red-black tree with the logical block address of the target stripe where the target data in the write request is located, so as to facilitate the subsequent writing of the second verification value into the hot spare disk area in the target stripe.

[0140] When there is no node corresponding to the target stripe in the red-black tree, it means that the target data is newly written data. At this time, it is necessary to apply for a second cache area in the cache space. The second cache area is empty, and the second check value is written into the second cache area. Further, a new node is constructed in the red-black tree, and relevant information of the second check value is filled in the new node to associate the new node with the second cache area, wherein the relevant information of the second check value includes: the data block address of the data block corresponding to the second cache area in the cache space, the disk array ID of the disk array, the stripe ID of the target stripe, and the logical block address in the write request, wherein the logical block address in the write request represents the logical block address of the target stripe in the disk array.

[0141] Through the above embodiment, using a red-black tree to manage the second check value can improve the writing performance of the second check value. Since the red-black tree is a self-balancing binary search tree, operations such as node search and node insertion can be quickly implemented. It is then convenient to quickly find the node corresponding to the target stripe and update or insert the second check value. In addition, by updating the existing node instead of creating a new node to write the second check value, write amplification can be reduced. Write amplification refers to the ratio of the amount of written data to the amount of data that actually needs to be updated. In addition, the red-black tree supports concurrent access, which allows multiple applications to write the second check values ​​of different stripes at the same time without affecting each other.

[0142] In the process of writing the second check value into the cache space, it is first determined whether there is a node corresponding to the target stripe, and then it is determined whether a new node needs to be created, so that there will be no situation where one target stripe corresponds to multiple nodes, and further, there will be no situation where two second check values ​​are written to the same target stripe during the process of writing the second check value into the hot spare disk, thus avoiding the problem of data recovery errors caused by incorrect second check values ​​when the data disk fails.

[0143] Optionally, the step S101 includes:

[0144] Obtaining a logical block address in the write request, a length of the target data, and a size of a single data block contained in the stripe;

[0145] The target stripe corresponding to the write request is calculated according to the logical block address, the length of the target data, and the size of a single data block contained in the stripe.

[0146] Specifically, in one embodiment, the write request carries the address of the logical block to be written in the disk array, the length of the target data, and the size of a single data block contained in each stripe in the disk array.

[0147] Then, according to the logical block address, the length of the target data and the size of a single data block contained in the stripe, the stripe ID of the stripe corresponding to the write request is calculated, and the stripe corresponding to the stripe ID is the target stripe.

[0148] Through the above embodiment, after receiving the write request from the primary node, it is necessary to calculate the target stripe for storing the target data and the check value in the disk array according to the write request.

[0149] As an example, Figure 6 Taking as an example, the process of a data storage method proposed in the present application is explained. First, the controller of the disk array receives a write request sent by the host end, calculates the stripe ID of the target stripe based on the logical block address carried by the write request, the length of the target data, and the size of a single data block contained in the stripe, that is, determines which stripe the target data needs to be written to, and then calculates a first check value (P), writes the first check value together with the target data into the data disk area contained in the target stripe, and then returns a write success response to the write request to the host end. After that, calculates a second check value (Q), and searches the red-black tree for an existing node and a corresponding node. The target stripe is corresponding. If so, the second check value previously stored in the data block pointed to by this node is updated and stored according to the second check value corresponding to the target data, and then the node is updated according to the relevant information of the second check value corresponding to the target data; if not, a data block is applied for in the cache space, the second check value corresponding to the target data is written into this database, and then a new node is established in the red-black tree, the relevant information of the second check value corresponding to the target data is written into this node, and it is associated with the data block where the second check value corresponding to the target data is located, and finally this node is inserted into the red-black tree.

[0150] Optionally, writing the second check value cached in the cache space into the hot spare disk area includes:

[0151] Mark the red-black tree as a write state;

[0152] Creating a new red-black tree, and associating the new red-black tree with the disk array;

[0153] The red-black tree is traversed in order, and multiple second check values ​​corresponding to the red-black tree are written into the hot spare disk area in an ascending order of the logical block address in the write request.

[0154] Figure 7 It is a schematic diagram of a process of writing a second verification value into a hot spare disk provided by an embodiment of the present application.

[0155] Specifically, Figure 7 As shown, in one embodiment, after the preset condition of the operation of writing the second check value cached in the cache space into the hot spare disk area is triggered, the red-black tree corresponding to the multiple second check values ​​that need to be written is first marked as a write state. The red-black tree marked as a write state cannot cache the second check value. Therefore, a new red-black tree needs to be created to respond to the subsequent writing process of the second check value. After the new red-black tree is created, the created new red-black tree is associated with the disk array. In this way, the new second check value will not be recorded in the red-black tree marked as a write state, but will be recorded in the new red-black tree.

[0156] For a red-black tree that needs to write multiple second check values, since the red-black tree is stored according to the size of the logical block address corresponding to the write request, the red-black tree can be traversed in an in-order manner. During the traversal, the multiple second check values ​​corresponding to the red-black tree are written into the corresponding hot spare disk area in sequence according to the order of the logical block address in the write request from small to large. Writing multiple second check values ​​in the order of the logical block address from small to large can improve the write performance and reduce the disk seek time.

[0157] Through the above embodiments, the process of writing the second check value in the cache space to the hot spare disk and the process of creating a new red-black tree are described in detail. This method of first aggregating multiple second check values ​​in the cache space and then delaying writing them to the hot spare disk reduces the number of writes to the disk array and improves the performance of the disk array.

[0158] Optionally, after creating a new red-black tree and associating the new red-black tree with the disk array, the method further includes:

[0159] When a new second check value needs to be written, a new node is created in the new red-black tree;

[0160] The relevant information of the second check value is written into the new node, and the relevant information of the second check value includes: the data block address corresponding to the second cache area, the disk array ID of the disk array, the stripe ID of the target stripe, and the node corresponding to the target stripe points to the logical block address in the write request.

[0161] Specifically, in one embodiment, after the red-black tree is marked as being in a write state, a new second check value will be recorded on the new red-black tree. Therefore, when a new second check value needs to be written, a new node is created in the new red-black tree. The second check value that needs to be cached subsequently needs to determine whether there is a corresponding node with the same target stripe in the existing nodes on the new red-black tree. If so, the original second check value is updated using the new second check value according to the steps of the above embodiment.

[0162] Furthermore, relevant information of the second verification value is written into the new node, and the relevant information of the second verification value includes: the data block address corresponding to the second cache area, the disk array ID of the disk array, the stripe ID of the target stripe, and the logical block address in the write request pointed to by the node corresponding to the target stripe.

[0163] Through the above embodiment, after the red-black trees corresponding to multiple second check values ​​that need to be written to the hot spare disk are marked as written, a new red-black tree can be used to respond to the subsequent recording process of new second check values ​​that need to be cached.

[0164] Optionally, the method further comprises:

[0165] When a data disk in the disk array fails, the data stored in the failed data disk is restored based on the data stored in other non-failed data disks in the disk array except the failed data disk and the first check value, and / or the second check value stored in the hot spare disk.

[0166] Specifically, in one embodiment, since the disk array contains dual check values, namely a first check value and a second check value, it is possible to effectively cope with the situation of data disk failure. In this case, when a failed data disk occurs, the data stored in the failed data disk can be restored based on the data stored in other non-failed data disks in the disk array except the failed data disk and the first check value, and / or the second check value stored in the hot spare disk. In the process of data recovery, the data stored in other non-failed data disks and the first check value are necessary, and the second check value stored in the hot spare disk can be used to determine whether it needs to be used based on actual needs.

[0167] Through the above embodiment, when a data disk fails, the data in the failed data disk can be restored through the data stored in other intact data disks and the first check value, and / or the second check value stored in the hot spare disk, to ensure that data is not lost.

[0168] Optionally, the method further comprises:

[0169] When a first data disk in the disk array fails, based on data and first check values ​​stored in other data disks other than the first data disk in the disk array that are not failed, the data and first check values ​​in each data disk area contained in the failed first data disk are sequentially restored;

[0170] According to the same stripe, the recovered data and the first check value are stored in a hot spare disk area in the hot spare disk corresponding to each data disk area included in the failed first data disk.

[0171] Specifically, in one embodiment, the first data disk is any data disk in the disk array. When the first data disk in the disk array fails, since only one data disk fails, the data and the first verification value in each data disk area contained in the failed first data disk can be directly restored based on the data and the first verification value stored in other non-failed data disks in the disk array except the first data disk.

[0172] The recovered data and the first check value are stored in the hot spare disk. In this process, data recovery is performed based on whether they are the same stripe. That is, the data in each data disk area contained in the failed data disk is recovered in the hot spare disk area in the stripe where the data disk area is located, and the second check value in the hot spare disk area is overwritten.

[0173] Through the above embodiment, in the event of a data disk failure, the data in the failed data disk can be restored to the hot spare disk through the data stored in other intact data disks except the failed data disk and the first verification value, thereby avoiding data loss.

[0174] Optionally, the method further comprises:

[0175] In the event that a second data disk fails during fault recovery of the failed first data disk, the data that has not yet been recovered in the first data disk and the data contained in each data disk area in the second data disk are recovered in sequence based on the data and the first check value in other non-failed data disks in the disk array except the first data disk and the second data disk, and the second check value in the hot spare disk.

[0176] Specifically, in one embodiment, when a second data disk fails during the recovery of a first data disk, it is impossible to recover all the data in the failed data disk only by using the data stored in other non-failed data disks except the failed data disk and the first verification value. Instead, it is necessary to combine the second verification value in the hot spare disk. Through the double verification value, the data recovery process after the failure of two data disks can be completed.

[0177] Figure 8 FIG. 1 is a schematic diagram of a RAID5 array for data recovery shown in the related art. Figure 8 shown.

[0178] First, data disk 3 failed, causing Figure 8 The data and check values ​​corresponding to "2, P, 7, 10" are lost, where P is the first check value. At this time, since only one data disk fails, the data of data disk 3 can be restored in the order of stripes according to data disk 1, data disk 2, and data disk 4, and the restored data is written to the hot spare disk. After the lost data "2, P" in stripe 2 is restored to the hot spare disk, if data disk 2 fails again, the lost data in stripes 3 and stripe 4 cannot be restored through the first check value P and other data due to the existence of two data disk failures. Therefore, for the RAID5 array, when two data disks fail, data integrity cannot be supported.

[0179] Fig. 9 FIG. 1 is a schematic diagram of a disk array performing data recovery according to an embodiment of the present application. Fig. 9 shown.

[0180] First, in the case where data disk 3 is damaged alone, data can be recovered only through the first check value and other data. When data disk 2 is damaged during the recovery of data disk 3, for example, after the data "2, P" of stripe 1 and stripe 2 in data disk 3 has been recovered and written to the hot spare disk, data disk 2 fails. At this time, the data that needs to be recovered in stripe 3 and stripe 4 can also be recovered using the second check value Q in the hot spare disk and written to the hot spare disk after recovery.

[0181] Through the above embodiment, after a data disk fails, when a second data disk fails during data recovery of the failed data disk, the second check value stored in the hot spare disk can be used to cope with the data recovery process of the two data disk failures, thereby avoiding data loss.

[0182] Optionally, the method further comprises:

[0183] When no data disk failure or only one data disk failure occurs in the disk array, the hot spare disk is removed, or other requests from the host are responded to through the hot spare disk.

[0184] Specifically, in one embodiment, unlike the traditional RAID6 array, since the second check values ​​are all uniformly stored in the hot spare disk, the hot spare disk only contains the second check value. Therefore, for the disk array, the hot spare disk is flexible. For example, when there is no data disk failure in the disk array or only one data disk failure occurs, it can be removed at any time for other purposes. When the second check value is needed, it can be re-added to the disk array. Since the data is stored in the data disk, during the movement of the hot spare disk, there is no need to make any adjustments to the distribution of the data stored in the disk array, so that the data is not affected. In addition, the hot spare disk can also respond to other requests from the primary node.

[0185] Through the above embodiments, the distribution method of data and check values ​​in the disk array provided by the present application can uniformly write the second check value into the hot spare disk, thereby improving the flexibility of the disk array on the basis of strengthening data security. When the user needs the hot spare disk for other purposes, it can be unplugged at any time for other purposes, and the data distribution of the disk array does not need to be adjusted.

[0186] In summary, the data storage method shown in each embodiment of the present application has the following beneficial effects:

[0187] 1. The method of using a hot spare disk to improve the data security of a traditional RAID 5 array mentioned in the present application improves the data security of a traditional RAID 5 array.

[0188] 2. The method of delaying writing the second check value Q mentioned in this application improves the writing performance comparable to that of the traditional raid5 array while providing higher data security.

[0189] 3. The method of using a red-black tree to sort the second check value Q mentioned in the present application avoids the problem of data write amplification and improves the writing performance of the second check value Q.

[0190] 4. The disk array shown in the present application is used for data storage, which fully utilizes the space of the hot spare disk and avoids the waste of the hot spare disk space.

[0191] 5. The disk array shown in the present application is used for data storage, and the second check value Q is uniformly written into the hot spare disk. On the basis of strengthening data security, the flexibility of using the hot spare disk is improved. When the user needs the hot spare disk for other purposes, it can be unplugged at any time for other purposes, and the data distribution of the disk array does not need to be adjusted.

[0192] 6. The method of using a hot spare disk to improve disk array data security mentioned in the present application can ensure that data will not be lost if the disk is lost again during the data recovery process in response to a data disk failure.

[0193] Fig.10 is a schematic diagram of a data storage device provided by an embodiment of the present application. Fig.10 shown.

[0194] Based on the same inventive concept, a second aspect of an embodiment of the present application provides a data storage device, which is applied to a controller of a disk array, wherein the disk array includes a data disk and a hot spare disk, and the device includes:

[0195] The calculation module 11 is used to receive a write request sent by the host end, and based on the write request, calculate the target stripe corresponding to the write request in the disk array, wherein the target stripe includes a data disk area and a hot spare disk area, wherein the data disk includes a plurality of stripes of data disk areas, and the hot spare disk includes a plurality of stripes of hot spare disk areas;

[0196] A first writing module 12, configured to write the target data corresponding to the write request and a first check value corresponding to the target data into a data disk area of ​​the target stripe;

[0197] The second writing module 13 is used to write the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe.

[0198] Optionally, the device further comprises:

[0199] a response module, configured to return a write success response to the write request to the host end after writing the target data corresponding to the write request and the first check value corresponding to the target data into the data disk area of ​​the target stripe;

[0200] The second writing module 13 includes:

[0201] The second writing unit is used to write the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe after returning a write success response to the write request to the host end.

[0202] Optionally, the device further comprises:

[0203] A cache space allocation module, used to allocate storage space from the memory of the controller to the disk array as cache space, wherein the cache space is used to cache the second check value;

[0204] The cache module is used to cache the second check value corresponding to the target data in the cache space before writing the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe.

[0205] Optionally, the cache module includes:

[0206] a cache unit, configured to write the second check value cached in the cache space into the hot spare disk area when a preset condition for writing the second check value into the hot spare disk area is triggered;

[0207] The preset condition includes any one of the following:

[0208] The current load of the controller of the disk array is lower than a first preset threshold;

[0209] And / or, the occupancy of the cache space reaches a second preset threshold.

[0210] Optionally, the second check value is managed in the cache space in the form of a red-black tree, and each node of the red-black tree corresponds to the second check value of a stripe; the cache unit includes:

[0211] a calculation unit, configured to calculate the second check value, and determine whether there is a node corresponding to the target stripe in the red-black tree based on the stripe ID of the target stripe;

[0212] a first cache unit, configured to update data of a first cache area in a cache space pointed to by the node corresponding to the target stripe to the second check value when a node corresponding to the target stripe exists in the red-black tree, and to make the node corresponding to the target stripe point to a logical block address in the write request;

[0213] A second cache unit, configured to apply for a second cache area in the cache space and write the second check value into the second cache area when there is no node corresponding to the target stripe in the red-black tree;

[0214] The first related information writing unit is used to construct a new node in the red-black tree and fill in the related information of the second check value in the new node. The related information of the second check value includes: the data block address corresponding to the second cache area, the disk array ID of the disk array, the stripe ID of the target stripe, and the node corresponding to the target stripe points to the logical block address in the write request.

[0215] Optionally, the cache unit includes:

[0216] A marking unit, used for marking the red-black tree as a written state;

[0217] A red-black tree creation unit, used for creating a new red-black tree and associating the new red-black tree with the disk array;

[0218] The traversal unit is used to perform an in-order traversal on the red-black tree, and write multiple second check values ​​corresponding to the red-black tree into the hot spare disk area in the ascending order of the logical block address in the write request.

[0219] Optionally, the device further comprises:

[0220] A new second check value writing unit is used to create a new node in the new red-black tree when a new second check value needs to be written after creating a new red-black tree and associating the new red-black tree with the disk array;

[0221] A second related information writing unit is used to write related information of the second check value into the new node, and the related information of the second check value includes: the data block address corresponding to the second cache area, the disk array ID of the disk array, the stripe ID of the target stripe, and the node corresponding to the target stripe points to the logical block address in the write request.

[0222] Optionally, the calculation module 11 includes:

[0223] An acquisition unit, configured to acquire a logical block address in the write request, a length of the target data, and a size of a single data block contained in the stripe;

[0224] A calculation unit is used to calculate the target stripe corresponding to the write request according to the logical block address, the length of the target data and the size of a single data block contained in the stripe.

[0225] Optionally, the device further comprises:

[0226] A recovery module is used to recover the data stored in the failed data disk based on the data stored in other non-failed data disks in the disk array except the failed data disk and the first check value, and / or the second check value stored in the hot spare disk when a data disk in the disk array fails.

[0227] Optionally, the device further comprises:

[0228] A first recovery module is used to, when a first data disk in the disk array fails, restore the data and the first check value in turn in each data disk area contained in the failed first data disk based on the data and the first check value stored in other non-failed data disks in the disk array except the first data disk;

[0229] The storage unit is used to store the recovered data and the first check value in a hot spare disk area in the hot spare disk corresponding to each data disk area included in the failed first data disk according to the same stripe.

[0230] Optionally, the device further comprises:

[0231] A second recovery unit is used to recover the data that has not been recovered in the first data disk and the data contained in each data disk area in the second data disk in sequence based on the data and the first check value in other non-failed data disks in the disk array except the first data disk and the second data disk, and the second check value in the hot spare disk when a second data disk fails during the fault recovery of the failed first data disk.

[0232] Optionally, the device further comprises:

[0233] The removal module is used to remove the hot spare disk when no data disk failure or only one data disk failure occurs in the disk array, or to respond to other requests from the host through the hot spare disk.

[0234] Based on the same inventive concept, another embodiment of the present application further provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the data storage method as described in any of the above embodiments.

[0235] Based on the same inventive concept, another embodiment of the present application further provides a computer program product, including a computer program, which is executed by a processor to perform the data storage method described in any of the above embodiments.

[0236] Based on the same inventive concept, another embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, wherein when the program is executed by a processor, the data storage method as described in any of the above embodiments is implemented.

[0237] As for the device, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0238] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0239] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0240] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0241] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0242] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0243] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0244] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0245] The above is a detailed introduction to a data storage method, electronic device, product and medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A data storage method, characterized in that: A controller applied to a disk array, wherein the disk array includes a data disk and a hot spare disk, and the method includes: Receive a write request from a host end, and based on the write request, calculate a target stripe in the disk array corresponding to the write request, wherein the target stripe includes a data disk area and a hot spare disk area, wherein the data disk includes data disk areas of multiple stripes, and the hot spare disk includes hot spare disk areas of multiple stripes; Writing the target data corresponding to the write request and the first check value corresponding to the target data into the data disk area of ​​the target stripe; Writing a second check value corresponding to the target data into the hot spare disk area of ​​the target stripe; The method further includes: when no data disk failure or only one data disk failure occurs in the disk array, removing the hot spare disk, or responding to other requests from the host end through the hot spare disk.

2. The data storage method according to claim 1, characterized in that: After writing the target data corresponding to the write request and the first check value corresponding to the target data into the data disk area of ​​the target stripe, the method further includes: Returning a write success response to the write request to the host end; Writing the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe includes: After returning a write success response to the write request to the host, a second check value corresponding to the target data is written into the hot spare disk area of ​​the target stripe.

3. The data storage method according to claim 1, characterized in that: The method further comprises: Allocating storage space from the memory of the controller as a cache space for the disk array, wherein the cache space is used to cache the second check value; Before writing the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe, the method further includes: caching the second check value corresponding to the target data in the cache space.

4. The data storage method according to claim 3, characterized in that: The step of writing the second check value corresponding to the target data into the hot spare disk area of ​​the target stripe includes: When a preset condition for writing the second check value into the hot spare disk area is triggered, writing the second check value cached in the cache space into the hot spare disk area; The preset condition includes any one of the following: The current load of the controller of the disk array is lower than a first preset threshold; And / or, the occupancy of the cache space reaches a second preset threshold.

5. The data storage method according to claim 3, characterized in that: The second check value is managed in the cache space in the form of a red-black tree, and each node of the red-black tree corresponds to the second check value of a stripe; Writing the second check value cached in the cache space into the hot spare disk area includes: Calculating the second check value, and judging whether there is a node corresponding to the target stripe in the red-black tree based on the stripe ID of the target stripe; When there is a node corresponding to the target stripe in the red-black tree, updating the data of the first cache area in the cache space pointed to by the node corresponding to the target stripe to the second check value, and making the node corresponding to the target stripe point to the logical block address in the write request; When there is no node corresponding to the target stripe in the red-black tree, applying for a second cache area in the cache space, and writing the second check value into the second cache area; A new node is constructed in the red-black tree, and relevant information of the second check value is filled in the new node, wherein the relevant information of the second check value includes: the data block address corresponding to the second cache area, the disk array ID of the disk array, the stripe ID of the target stripe, and the node corresponding to the target stripe points to the logical block address in the write request.

6. The data storage method according to claim 5, characterized in that: The step of writing the second check value cached in the cache space into the hot spare disk area includes: Mark the red-black tree as a write state; Creating a new red-black tree, and associating the new red-black tree with the disk array; The red-black tree is traversed in order, and multiple second check values ​​corresponding to the red-black tree are written into the hot spare disk area in an ascending order of the logical block address in the write request.

7. The data storage method according to claim 6, characterized in that: After creating a new red-black tree and associating the new red-black tree with the disk array, the method further includes: When a new second check value needs to be written, a new node is created in the new red-black tree; The relevant information of the second check value is written into the new node, and the relevant information of the second check value includes: the data block address corresponding to the second cache area, the disk array ID of the disk array, the stripe ID of the target stripe, and the node corresponding to the target stripe points to the logical block address in the write request.

8. The data storage method according to claim 1, characterized in that: The calculating, based on the write request, a target stripe in the disk array corresponding to the write request includes: Obtaining a logical block address in the write request, a length of the target data, and a size of a single data block contained in the stripe; The target stripe corresponding to the write request is calculated according to the logical block address, the length of the target data, and the size of a single data block contained in the stripe.

9. The data storage method according to claim 1, characterized in that: The method further comprises: When a data disk in the disk array fails, the data stored in the failed data disk is restored based on the data stored in other non-failed data disks in the disk array except the failed data disk and the first check value, and / or the second check value stored in the hot spare disk.

10. The data storage method according to claim 9, characterized in that: The method further comprises: When a first data disk in the disk array fails, based on data and first check values ​​stored in other data disks other than the first data disk in the disk array that are not failed, the data and first check values ​​in each data disk area contained in the failed first data disk are sequentially restored; According to the same stripe, the recovered data and the first check value are stored in a hot spare disk area in the hot spare disk corresponding to each data disk area included in the failed first data disk.

11. The data storage method according to claim 10, characterized in that: The method further comprises: In the event that a second data disk fails during fault recovery of the failed first data disk, the data that has not yet been recovered in the first data disk and the data contained in each data disk area in the second data disk are recovered in sequence based on the data and the first check value in other non-failed data disks in the disk array except the first data disk and the second data disk, and the second check value in the hot spare disk.

12. An electronic device, characterized in that: The device comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the data storage method according to any one of claims 1 to 11.

13. A computer-readable storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the data storage method according to any one of claims 1 to 11 is implemented.

14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the data storage method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Data recovery method, device and equipment and readable storage medium

    CN115454727A