Data reconstruction method and RAID card
By setting up hot standby storage blocks of different stripes on different hard disks in the RAID group, parallel processing of data reconstruction is realized, solving the problem of long reconstruction time of RAID group, and improving data reconstruction efficiency and read and write performance.
Patent Information
- Application Number
- CN202510127883.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-07-29
AI Technical Summary
The existing RAID group has a long time to reconstruct, high risk of secondary failures, and low data reconstruction efficiency.
The storage blocks at the same location in multiple hard disks are determined as one strip, the hot spare storage blocks of different strips are set on different hard disks, and the redundant storage blocks are used for data reconstruction, allowing the reconstruction data writing process of different strips to be carried out in parallel.
It improves the read and write performance and data reconstruction efficiency of RAID groups, reduces the processing capability requirements for processors and memory, reduces the amount of data in the mapping table, and improves the processing efficiency.
Smart Images

Figure CN120386665A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage technology, and in particular, to a data reconstruction method and a RAID card. Background Art
[0002] A Redundant Array of Independent Disks (RAID) card, an important component in a server, is connected between the CPU and hard disks and is used to form a RAID group with multiple hard disks for use by the OS. When forming a RAID group, the RAID card organizes each hard disk at a specified RAID level to provide redundant protection for the hard disk data. The RAID card usually also provides a hot spare disk configuration and a reconstruction function. When a hard disk in the RAID group fails, the RAID card can use the hot spare disk to start the reconstruction of the degraded RAID group to restore the data redundancy ability of the RAID group.
[0003] The time for RAID group reconstruction is directly related to the performance and capacity of the hard disks. As the hard disk capacity becomes larger and larger, the time for RAID group reconstruction becomes longer and longer, and the corresponding risk of secondary failure also becomes larger and larger. Summary of the Invention
[0004] Embodiments of this application provide a data reconstruction method and a RAID card, which can improve the data reconstruction efficiency.
[0005] In a first aspect, an embodiment of this application provides a data reconstruction method applied to a RAID card. The RAID card is electrically connected to multiple hard disks. The method includes:
[0006] Determine the storage blocks at the same position in the multiple hard disks as the multiple storage blocks included in a stripe;
[0007] Use at least one of the multiple storage blocks as a hot spare storage block in the stripe, and the hot spare storage blocks in different stripes belong to different hard disks;
[0008] Use the storage blocks other than the hot spare storage block among the multiple storage blocks as redundant storage blocks in the stripe;
[0009] For any stripe, determine a first storage block that has failed in the stripe, and determine the other storage blocks among the multiple redundant storage blocks in the stripe except the first storage block as second storage blocks;
[0010] Calculate the reconstruction data corresponding to the first storage block according to the redundant data in the second storage blocks;
[0011] Store the reconstruction data in the hot spare storage block in the stripe.
[0012] In this solution, the RAID card is electrically connected to multiple hard disks. The RAID card can determine the storage blocks at the same position in multiple hard disks as the multiple storage blocks included in a stripe. The RAID card can use at least one of the multiple storage blocks as the hot spare storage block in the stripe, and the hot spare storage blocks in different stripes belong to different hard disks. The RAID card can use the storage blocks other than the hot spare storage block among the multiple storage blocks as the redundant storage blocks in the stripe. For any stripe, the RAID card can determine the first storage block that has failed in the stripe, and determine the other storage blocks among the multiple redundant storage blocks in the stripe except the first storage block as the second storage blocks. The RAID card can calculate the reconstructed data corresponding to the first storage block according to the redundant data in the second storage blocks, and store the reconstructed data in the hot spare storage block (the storage block that can be used to store the reconstructed data) in the stripe. Compared with the related technology where a hard disk is directly used as the hot spare hard disk and the hot spare hard disk is in a standby state without any usage contribution when there is no hard disk failure in the RAID group, in the embodiments of the present application, by using the above method of using the hot spare storage block as a storage block in the stripe and setting the hot spare storage blocks of different stripes in different hard disks, the hot spare hard disk can be added to the RAID group as an ordinary hard disk for reading and writing, improving the read and write performance of the RAID group. In addition, compared with the related technology where a hard disk is directly used as the hot spare hard disk and the RAID card needs to receive the write completion command corresponding to a stripe fed back by the hot spare hard disk before sending the write command corresponding to the next stripe to the hot spare hard disk, resulting in low data reconstruction efficiency, in the embodiments of the present application, by using the hot spare storage block as a storage block in the stripe and setting the hot spare storage blocks of different stripes in different hard disks, the writing processes of the reconstructed data of different stripes can be parallel, improving the data reconstruction efficiency.
[0013] In one implementation, calculating the reconstructed data corresponding to the first storage block according to the redundant data in the second storage blocks includes:
[0014] Determine whether the first storage block is a hot spare storage block;
[0015] If not, read the redundant data in the second storage block;
[0016] Calculate the reconstructed data according to the redundant data.
[0017] In this solution, when the first storage block is a hot spare storage block, it indicates that the first storage block has not stored data yet. The RAID card does not need to calculate the reconstruction data corresponding to the first storage block, and the RAID card can directly end the processing process of this stripe. When the first storage block is not a hot spare storage block, the RAID card can calculate the reconstruction data corresponding to the first storage block. Through the above method, the processing efficiency of the RAID card for the faulty first storage block in each stripe is improved.
[0018] In one implementation, the storage blocks among multiple storage blocks, excluding the hot spare storage block, are used as redundant storage blocks in a stripe, including:
[0019] At least one storage block among multiple storage blocks is used as a parity storage block in a stripe; multiple redundant storage blocks in a stripe include the parity storage block;
[0020] The storage blocks among multiple storage blocks, excluding the hot spare storage block and the parity storage block, are used as data storage blocks in a stripe; multiple redundant storage blocks in a stripe include the data storage block.
[0021] In this solution, the RAID card can use at least one storage block among multiple storage blocks as a parity storage block in a stripe (multiple redundant storage blocks in a stripe include this parity storage block). The hot spare storage block and the parity storage block are not the same storage block. The RAID card can use the storage blocks among multiple storage blocks, excluding the hot spare storage block and the parity storage block, as data storage blocks in a stripe (multiple redundant storage blocks in a stripe include this parity storage block). Through the above method, the parity storage block and the data storage block in a stripe can be quickly determined, improving the construction efficiency of the RAID group.
[0022] In one implementation, using at least one storage block among multiple storage blocks as a hot spare storage block in a stripe includes:
[0023] When the stripe is not the first stripe, obtain the first position serial number of the hot spare storage block in the previous stripe, and determine the hot spare storage block in the stripe according to the first position serial number; or,
[0024] When the stripe is the first stripe, use the storage block with the position serial number M among multiple storage blocks as the hot spare storage block in the stripe; M is an integer greater than or equal to 1 and less than or equal to N; N is the total number of multiple hard disks.
[0025] In this solution, when the stripe is not the first stripe, the RAID card can obtain the first position serial number of the hot spare storage block in the previous stripe, and determine the hot spare storage block in the stripe according to the first position serial number. When the stripe is the first stripe, the RAID card can use the storage block with the position serial number M among multiple storage blocks as the hot spare storage block in the stripe. Through the above method, on the one hand, there is no need to construct a mapping table with a large amount of data, and the hot spare storage block in each stripe can be quickly determined, improving the efficiency of forming the RAID group. On the other hand, compared with the related technology, it is necessary to use a mapping table with a large amount of data to record the hot spare storage block and the hard disk to which it belongs, resulting in a large memory occupation, and the mapping table needs to be frequently accessed during the processing process (business read / write process and reconstruction process), resulting in low processing efficiency. In the embodiments of the present application, there is no need to maintain a mapping table with a large amount of data. Based on the sequential relationship of multiple hard disks connected to the RAID card and simple rules, the hot spare storage block can be quickly determined, improving the processing efficiency and reducing the requirements for the processing capabilities of the processor (such as CPU) and memory.
[0026] In one implementation, determining the hot spare storage block in the stripe according to the first position serial number includes:
[0027] Determining the second position serial number of the hot spare storage block in the stripe according to the first position serial number and the first preset serial number difference;
[0028] Determining the hot spare storage block in the stripe from multiple storage blocks in the stripe according to the second position serial number.
[0029] In this solution, the RAID card can determine the second position serial number of the hot spare storage block in the stripe according to the first position serial number and the first preset serial number difference. The RAID card can determine the hot spare storage block in the stripe from multiple storage blocks in the stripe according to the second position serial number. Through the above method, using the sequential relationship of multiple hard disks connected to the RAID card and simple rules, the hot spare storage block in the stripe can be quickly determined, improving the efficiency of determining the hot spare storage block.
[0030] In one implementation, determining the second position serial number of the hot spare storage block in the stripe according to the first position serial number and the first preset serial number difference includes:
[0031] Calculating the initial position serial number according to the first position serial number and the first preset serial number difference;
[0032] Determining whether the initial position serial number is greater than or equal to 1 and less than or equal to N;
[0033] If so, determining the initial position serial number as the second position serial number;
[0034] Otherwise, calculate the second position number according to the initial position number and N.
[0035] In this solution, the RAID card can calculate the initial position number according to the first position number and the difference of the first preset number. The RAID card can determine whether the initial position number is greater than or equal to 1 and less than or equal to N; if so, determine the initial position number as the second position number; otherwise, calculate the second position number according to the initial position number and N. Through the above method, the hot standby storage blocks of adjacent hard disks can be regularly arranged in a left-handed or right-handed manner, realizing the orderly setting of the hot standby storage blocks.
[0036] In one implementation, the difference of the first preset number is an integer greater than or equal to 1 and less than N; when the difference of the first preset number is greater than 1, the difference of the first preset number is not a factor of N.
[0037] In this solution, the difference of the first preset number is an integer greater than or equal to 1 and less than N; when the difference of the first preset number is greater than 1, the difference of the first preset number is not a factor of N. Through the above method, on the one hand, the hot standby storage blocks of adjacent hard disks can be regularly arranged in a left-handed or right-handed manner, realizing the orderly setting of the hot standby storage blocks. On the other hand, it can be avoided that the hot standby storage blocks of different stripes are set on the same hard disk. In other words, through the above method, the hot standby storage blocks of different stripes can be set on different hard disks, so that the writing processes of the reconstructed data of different stripes can be parallel, improving the data reconstruction efficiency.
[0038] In one implementation, regarding at least one storage block among multiple storage blocks as the parity storage block in the stripe, includes:
[0039] Determine the third position number of the parity storage block according to the second position number of the hot standby storage block in the stripe and the difference of the second preset number;
[0040] Determine the parity storage block in the stripe according to the third position number.
[0041] In this solution, the RAID card can determine the third position serial number of the parity storage block according to the second position serial number of the hot spare storage block in the stripe and the difference between the second preset serial numbers; the RAID card can determine the parity storage block in the stripe according to the third position serial number. Through the above method, on the one hand, there is no need to construct a mapping table with a large amount of data, and the parity storage block in each stripe can be quickly determined, improving the efficiency of forming the RAID group. On the other hand, compared with the related technology, it is necessary to use a mapping table with a large amount of data to record the parity storage block and the hard disk to which it belongs, resulting in a large amount of memory occupation, and the mapping table needs to be frequently accessed during the processing process (business read-write process and reconstruction process), resulting in low processing efficiency. In the embodiments of the present application, there is no need to maintain a mapping table with a large amount of data, and only based on the sequential relationship of multiple hard disks connected to the RAID card and simple rules, the parity storage block can be quickly determined, improving the processing efficiency and reducing the requirements for the processing capabilities of the processor and memory.
[0042] In one implementation, determining the third position serial number of the parity storage block according to the second position serial number of the hot spare storage block in the stripe and the difference between the second preset serial numbers includes:
[0043] Calculate the candidate position serial number according to the second position serial number and the difference between the second preset serial numbers;
[0044] Determine whether the candidate position serial number is greater than or equal to 1 and less than or equal to N; N is the total number of multiple hard disks;
[0045] If so, determine the candidate position serial number as the third position serial number;
[0046] If not, calculate the third position serial number according to the candidate position serial number and N.
[0047] In this solution, the RAID card can calculate the candidate position serial number according to the second position serial number and the difference between the second preset serial numbers. The RAID card can determine whether the candidate position serial number is greater than or equal to 1 and less than or equal to N; N is the total number of multiple hard disks; if so, determine the candidate position serial number as the third position serial number; if not, calculate the third position serial number according to the candidate position serial number and N. Through the above method, the parity storage block can be regularly arranged along with the hot spare storage block, realizing the orderly setting of the parity storage block.
[0048] In one implementation, the difference between the second preset serial numbers is an integer greater than or equal to 1 and less than N.
[0049] In this solution, the difference between the second preset serial numbers can be an integer greater than or equal to 1 and less than N. Through the above method, the parity storage block can be arranged along with the hot spare storage block according to the difference between the second preset serial numbers, realizing the orderly setting of the parity storage block.
[0050] In a second aspect, an embodiment of the present application provides a RAID card, which is electrically connected to a plurality of hard disks; the RAID card is configured to:
[0051] Determine storage blocks at the same position in the plurality of hard disks as the plurality of storage blocks included in one stripe;
[0052] Use at least one of the plurality of storage blocks as a hot spare storage block in the stripe, and the hot spare storage blocks in different stripes belong to different hard disks;
[0053] Use the storage blocks other than the hot spare storage block among the plurality of storage blocks as redundant storage blocks in the stripe;
[0054] For any stripe, determine a first storage block that fails in the stripe, and determine other storage blocks other than the first storage block among the plurality of redundant storage blocks in the stripe as second storage blocks;
[0055] Calculate reconstruction data corresponding to the first storage block according to the redundant data in the second storage block;
[0056] Store the reconstruction data in the hot spare storage block in the stripe.
[0057] In one implementation, the RAID card is specifically configured to:
[0058] Determine whether the first storage block is a hot spare storage block;
[0059] If not, read the redundant data in the second storage block; [[ID=3`0]]
[0060] Calculate reconstruction data according to the redundant data.
[0061] The RAID card provided by the embodiment of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, and will not be elaborated here.
[0062] In one implementation, the RAID card is specifically configured to:
[0063] Use at least one of the plurality of storage blocks as a parity storage block in the stripe; the plurality of redundant storage blocks in one stripe include a parity storage block;
[0064] Use the storage blocks other than the hot spare storage block and the parity storage block among the plurality of storage blocks as data storage blocks in the stripe; the plurality of redundant storage blocks in one stripe include data storage blocks.
[0065] The RAID card provided by the embodiment of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, and will not be elaborated here.
[0066] In one implementation, the RAID card is specifically configured to:
[0067] When the stripe is not the first stripe, obtain the first position serial number of the hot spare storage block in the previous stripe, and determine the hot spare storage block in the stripe according to the first position serial number; or,
[0068] When the stripe is the first stripe, use the storage block with the position serial number M among the multiple storage blocks as the hot spare storage block in the stripe; M is an integer greater than or equal to 1 and less than or equal to N; N is the total number of multiple hard disks.
[0069] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be elaborated here.
[0070] In one implementation, the RAID card is specifically configured to:
[0071] Determine the second position serial number of the hot spare storage block in the stripe according to the first position serial number and the first preset serial number difference;
[0072] Determine the hot spare storage block in the stripe from the multiple storage blocks in the stripe according to the second position serial number.
[0073] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be elaborated here.
[0074] In one implementation, the RAID card is specifically configured to:
[0075] Calculate the initial position serial number according to the first position serial number and the first preset serial number difference;
[0076] Determine whether the initial position serial number is greater than or equal to 1 and less than or equal to N;
[0077] If so, determine the initial position serial number as the second position serial number;
[0078] If not, calculate the second position serial number according to the initial position serial number and N.
[0079] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be elaborated here.
[0080] In one implementation, the first preset serial number difference is an integer greater than or equal to 1 and less than N; when the first preset serial number difference is greater than 1, the first preset serial number difference is not a factor of N.
[0081] The RAID card provided by the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, so details are not described herein again.
[0082] In one implementation, the RAID card is specifically configured to:
[0083] Determine the third position serial number of the parity storage block according to the second position serial number of the hot spare storage block in the stripe and the second preset serial number difference;
[0084] Determine the parity storage block in the stripe according to the third position serial number.
[0085] The RAID card provided by the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, so details are not described herein again.
[0086] In one implementation, the RAID card is specifically configured to:
[0087] Calculate the candidate position serial number according to the second position serial number and the second preset serial number difference;
[0088] Determine whether the candidate position serial number is greater than or equal to 1 and less than or equal to N; N is the total number of multiple hard disks;
[0089] If so, determine the candidate position serial number as the third position serial number;
[0090] If not, calculate the third position serial number according to the candidate position serial number and N.
[0091] The RAID card provided by the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, so details are not described herein again.
[0092] In one implementation, the second preset serial number difference is an integer greater than or equal to 1 and less than N.
[0093] The RAID card provided by the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, so details are not described herein again.
[0094] In a third aspect, an embodiment of the present application provides a server, including:
[0095] A RAID card and multiple hard disks electrically connected to the RAID card;
[0096] The RAID card is used to execute the method of the first aspect.
[0097] The server provided by this embodiment can execute the technical solution shown in the above method embodiment, and its beneficial effects are similar, so details are not described herein again. BRIEF DESCRIPTION OF THE DRAWINGS
[0098] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0099] Figure 1 Schematic diagram of multiple strips in the related art;
[0100] Figure 2 Schematic diagram of the hard disk failure scenario in the related art;
[0101] Figure 3 Schematic diagram of the structure of a server provided by an embodiment of the present application;
[0102] Figure 4a Schematic diagram of the flowchart of the first embodiment of a data reconstruction method provided by an embodiment of the present application;
[0103] Figure 4b Schematic diagram of a RAID group provided by an embodiment of the present application;
[0104] Figure 4c Schematic diagram of a failed hard disk in a RAID group provided by an embodiment of the present application;
[0105] Figure 5 Schematic diagram of the flowchart of a data reconstruction provided by an embodiment of the present application;
[0106] Figure 6 Schematic diagram of the flowchart of the third embodiment of a data reconstruction method provided by an embodiment of the present application;
[0107] Figure 7a Schematic diagram of the flowchart of the fourth embodiment of a data reconstruction method provided by an embodiment of the present application;
[0108] Figure 7b Schematic diagram of another RAID group provided by an embodiment of the present application;
[0109] Figure 7c Schematic diagram of yet another RAID group provided by an embodiment of the present application;
[0110] Figure 8 Schematic diagram of the structure of another server provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0111] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some, but not all, of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of this application under the inspiration of this embodiment belong to the scope protected by this application.
[0112] The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0113] Glossary:
[0114] Redundant Array of Independent Disks (RAID for short): Also known as disk array, it is composed of many independent hard disks combined into a hard disk group with a huge capacity. The performance of the entire hard disk group is improved by leveraging the additive effect of data provided by multiple hard disks.
[0115] RAID firmware (FW for short): Refers to the code or program running in the RAID card, which is used to implement functions such as data reading, data storage, and data redundancy backup of the RAID card.
[0116] Working mode of Redundant Array of Independent Disks (RAID for short): In the RAID working mode, when storing data, the RAID card needs to calculate the parity data of the data to be written and store the data to be written and the parity data in the physical address group respectively. In the RAID working mode, when reading data, the RAID card can directly read the data to be read stored in the physical address group.
[0117] Redundant Array of Independent Disks (RAID) working mode: In the non-RAID working mode, when storing data, there is no need to calculate parity data, and the RAID card can directly store the data to be written into the physical address group. In the non-RAID working mode, when reading data, the RAID card can directly read the data to be read from the physical address group.
[0118] The RAID card is an important component in the server. The RAID card can combine multiple independent hard disks into a hard disk group (RAID group) for use by the server's processor (such as the central processing unit).
[0119] Figure 1 It is a schematic diagram of multiple stripes in the related art. As Figure 1 shown, when the RAID card combines multiple independent hard disks into a RAID group, the RAID card can divide the storage space of each hard disk in the multiple hard disks into multiple storage blocks (stripe units). The RAID card can form a stripe by combining the storage blocks at the same position in multiple hard disks (for example, when multiple hard disks are placed side by side, the storage blocks in the same row can be called storage blocks at the same position). It should be noted that the parity storage blocks are evenly distributed on each hard disk in the RIAD group according to a fixed rule. As Figure 1 shown, in adjacent stripes, the parity storage blocks are allocated to adjacent hard disks in the same direction.
[0120] When storing data, the RAID card can write the data into each storage block of the first stripe in sequence according to the order of the hard disks. After filling one stripe, the RAID card continues to write the data into the next stripe.
[0121] In addition, the RAID card can also use a separate hard disk as a hot spare hard disk.
[0122] Figure 2 It is a schematic diagram of the scenario of hard disk failure in the related art. As Figure 2 shown, when some hard disks in the RAID group fail, in each stripe, the storage blocks corresponding to the failed hard disk fail. For any stripe, the RAID card can use the redundant data stored in the non-failed storage blocks in the stripe to reconstruct the data stored in the failed storage blocks, and send a write command to the hot spare hard disk to write the reconstructed data into the hot spare hard disk.
[0123] In the related art, for a stripe (such as the first stripe), the RAID card can utilize the redundant data stored in the non-failed storage blocks in the stripe to reconstruct the data stored in the failed storage block, and send the write command corresponding to the stripe (such as the write command corresponding to the first stripe) to the hot spare hard disk, so as to write the reconstructed data into the hot spare hard disk.
[0124] For the next stripe (such as the second stripe), the RAID card can utilize the redundant data stored in the non-failed storage blocks in the next stripe to reconstruct the data stored in the failed storage block.
[0125] However, limited by the queue depth n of the hard disk (for example, the queue depth of the SATA hard disk is 32), in the related art, after the RAID card sends the write commands corresponding to n stripes to the hot spare hard disk at the same time, the RAID card needs to receive the write completion command corresponding to at least one stripe feedback from the hot spare hard disk before it can send the write command corresponding to the next stripe to the hot spare hard disk, resulting in the problem of low data reconstruction efficiency in the method of the related art.
[0126] Based on the above technical problems, the embodiment of the present application proposes a data reconstruction method. After setting the hot spare storage blocks in different stripes on different hard disks in the hard disk group, the RAID card can directly store the reconstructed data into the hot spare storage block in the stripe after obtaining the reconstructed data, improving the data reconstruction efficiency.
[0127] The data reconstruction method of the embodiment of the present application will be described in detail below.
[0128] First, the structure of the server will be introduced.
[0129] Figure 3 It is a schematic structural diagram of a server provided by an embodiment of the present application. As Figure 3 shown, the server 10 may include a processor 101, a RAID card 102, and multiple hard disks. Exemplarily, Figure 3 five hard disks are shown, namely the first hard disk 103, the second hard disk 104, the third hard disk 105, the fourth hard disk 106, and the fifth hard disk 107.
[0130] In addition, the server may also include a hard disk backplane ( Figure 3 not shown). Among them, the hard disk backplane is used to carry the first hard disk 103, the second hard disk 104, the third hard disk 105, the fourth hard disk 106, and the fifth hard disk 107 to complete the communication interaction between the first hard disk 103, the second hard disk 104, the third hard disk 105, the fourth hard disk 106, and the fifth hard disk 107, and the RAID card 102.
[0131] The processor 101 can be a Central Processing Unit (CPU), can be a Baseboard Management Controller (BMC), or can be other devices with processing capabilities.
[0132] Among them, the Central Processing Unit (CPU): As the operation and control core of the server 10, it is the final execution unit for information processing and program operation. The central processing unit is a very large-scale integrated circuit, composed of an arithmetic unit, a controller, registers, etc., and its main task is to process and handle various data.
[0133] The Baseboard Management Controller (BMC): As an independent processor embedded in the server 10, it can be used to monitor the software and hardware information, health status, and operating status of the server. It should be noted that servers 10 from different companies have different names for the BMC. For example, some companies call it BMC, some companies call it Integrated Lights-Out (abbreviated as iLO), and some other companies call it Integrated Dell RemoteAccess Controller (abbreviated as iDRAC). Whether it is called BMC, or iLO or iDRAC, it can be understood as the BMC in the embodiments of the present application.
[0134] The RAID card 102: A component used to form a hard disk group with a huge capacity from many independent hard disks.
[0135] Taking the first hard disk 103 as an example, the first hard disk 103 can be a Solid State Disk (SSD) or a Hard Disk Drive (HDD). Among them, the hard disk stores data through magnetic disks, and the solid state disk stores data through flash memory particles. It should be noted that the description of the first hard disk 103 also applies to the second hard disk 104, the third hard disk 105, the fourth hard disk 106, and the fifth hard disk 107.
[0136] It should be noted that between the processor 101 and the RAID card 102, they can be communicatively connected through an interface of the Peripheral Component Interconnect Express (PCIe) high-speed serial computer expansion bus standard, or can also be communicatively connected through other interfaces. The embodiments of the present application do not limit this.
[0137] Between the RAID card 102 and multiple hard disks, communication connections can be made through the Serial Attached Small Computer System Interface (SAS for short), through the Non-Volatile Memory Express (NVME) interface, through the Serial Advanced Technology Attachment (SATA) interface, or through other interfaces. The embodiments of the present application do not limit this.
[0138] It should be noted that Figure 3 This is only a structural diagram of a server provided by the embodiments of the present application. The embodiments of the present application do not limit Figure 3 the actual forms of various devices included therein, nor do they limit Figure 3 the interaction methods between the devices therein. In the application of the solution, it can be set according to actual needs.
[0139] Next, the technical solution of the present application will be described in detail through specific embodiments. It should be noted that these specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0140] It should be noted that the method of the embodiments of the present application is executed by the RAID card from a hardware perspective and by the RAID firmware in the RAID card from a software perspective.
[0141] Figure 4a This is a schematic flowchart of the first embodiment of a data reconstruction method provided by the embodiments of the present application. Refer to Figure 4a and the method specifically includes the following steps:
[0142] S401: Determine the storage blocks at the same positions in multiple hard disks as the multiple storage blocks included in a stripe.
[0143] In this embodiment, the RAID card can be electrically connected to multiple hard disks.
[0144] These multiple hard disks can form a RAID group (hard disk group). It should be noted that the level of the RAID group can be RAID5, RAID6, RAID50, RAID60, or other levels. The embodiments of the present application do not limit this.
[0145] During the process of forming multiple hard disks into a RAID group, the RAID card can determine the storage blocks at the same position in multiple hard disks as the multiple storage blocks included in one stripe. It should be noted that one RAID group can include multiple stripes.
[0146] It should be noted that, exemplarily, when multiple hard disks are placed side by side, the storage blocks in the same row can be referred to as the storage blocks at the same position.
[0147] S402: Use at least one of the multiple storage blocks as the hot spare storage block in the stripe, and the hot spare storage blocks in different stripes belong to different hard disks.
[0148] In this embodiment, the RAID card can use at least one of the multiple storage blocks as the hot spare storage block in the stripe.
[0149] It should be noted that the hot spare storage blocks in different stripes belong to different hard disks.
[0150] Exemplarily, Figure 4b FIG. is a schematic diagram of a RAID group provided by an embodiment of the present application. As Figure 4b shown, the first hard disk, the second hard disk, the third hard disk, the fourth hard disk, and the fifth hard disk can form a RAID group. This RAID group includes 5 stripes. Among them, the hot spare storage block in stripe 1 belongs to the fifth hard disk, the hot spare storage block in stripe 2 belongs to the fourth hard disk, the hot spare storage block in stripe 3 belongs to the third hard disk, the hot spare storage block in stripe 4 belongs to the second hard disk, and the hot spare storage block in stripe 5 belongs to the first hard disk.
[0151] It should also be noted that the hot spare storage block refers to a storage block that can be used to store reconstructed data. When there is no failed first storage block in the stripe, the hot spare storage block does not store data; when there is a failed first storage block in the stripe, the hot spare storage block can be used to store the reconstructed data corresponding to the first storage block.
[0152] Next, the process of the RAID card using at least one of the multiple storage blocks as the hot spare storage block in the stripe will be described.
[0153] In one implementation:
[0154] In the case where the stripe is the first stripe, the RAID card can use the storage block with the position serial number M in the multiple storage blocks as the hot spare storage block in the stripe. Among them, M is an integer greater than or equal to 1 and less than or equal to N. N is the total number of multiple hard disks. Exemplarily, M is 5 and N is 5.
[0155] It should be noted that the position serial number is used to indicate the position sorting of the storage blocks in all the storage blocks included in a stripe. Understandably, based on the different storage blocks in a stripe belonging to different hard disks, therefore, the position serial number can also be used to indicate the position sorting of the hard disk to which the storage block belongs among all the hard disks.
[0156] When the stripe is not the first stripe, the RAID card can obtain the first position serial number of the hot standby storage block in the previous stripe, and determine the hot standby storage block in the stripe according to the first position serial number.
[0157] In one implementation, the RAID card can determine the second position serial number of the hot standby storage block in the stripe according to the first position serial number and the first preset serial number difference. The RAID card can determine the hot standby storage block in the stripe from multiple storage blocks in the stripe according to the second position serial number. In one implementation, the first preset serial number difference can be an integer greater than or equal to 1 and less than N. It should be noted that when the first preset serial number difference is greater than 1, the first preset serial number difference is not a factor of N.
[0158] S403: Use the storage blocks other than the hot standby storage block among the multiple storage blocks as the redundant storage blocks in the stripe.
[0159] In this embodiment, the RAID card can use the storage blocks other than the hot standby storage block among the multiple storage blocks as the redundant storage blocks in the stripe.
[0160] In one implementation, the multiple redundant storage blocks in a stripe can include a parity storage block and multiple data storage blocks.
[0161] Among them, the data storage block is used to store the written data.
[0162] The parity storage block is used to store parity data. It should be noted that the parity data is calculated by the RAID card according to the written data.
[0163] Next, the process of the RAID card using the storage blocks other than the hot standby storage block among the multiple storage blocks as the redundant storage blocks in the stripe will be described.
[0164] In one implementation,
[0165] The RAID card can use at least one storage block among the multiple storage blocks as the parity storage block in the stripe. Among them, the multiple redundant storage blocks in a stripe include a parity storage block.
[0166] The RAID card can use the storage blocks other than the hot standby storage block and the parity storage block among the multiple storage blocks as the data storage blocks in the stripe. Among them, the multiple redundant storage blocks in a stripe include data storage blocks.
[0167] S404: For any stripe, determine the first storage block that has failed in the stripe, and determine the other storage blocks in the multiple redundant storage blocks in the stripe, excluding the first storage block, as the second storage blocks.
[0168] In this embodiment, when there is a failed hard disk among multiple hard disks, for any stripe, the RAID card can determine the first storage block that has failed in the stripe, and determine the other storage blocks in the multiple redundant storage blocks in the stripe, excluding the first storage block, as the second storage blocks.
[0169] In one implementation
[0170] The RAID card can obtain a reconstruction command sent by the processor. Understandably, in one implementation, the processor can send a reconstruction command to the RAID card based on a user request. Among them, the reconstruction command includes the identifier of the failed hard disk. In one implementation, the identifier of the failed hard disk can be the number of the failed hard disk. Understandably, the identifier of the failed hard disk can also be other information that can reflect the identity of the failed hard disk, and the embodiments of the present application do not limit this.
[0171] In response to the reconstruction command, for any stripe, the RAID card can determine the first storage block that has failed in the stripe, and determine the other storage blocks in the multiple redundant storage blocks in the stripe, excluding the first storage block, as the second storage blocks. Understandably, the second storage blocks can include at least one storage block.
[0172] In one implementation
[0173] The RAID card can monitor multiple hard disks.
[0174] When the RAID card monitors that there is a failed hard disk among multiple hard disks, for any stripe, the RAID card can determine the first storage block that has failed in the stripe, and determine the other storage blocks in the multiple redundant storage blocks in the stripe, excluding the first storage block, as the second storage blocks. Understandably, the second storage blocks can include at least one storage block.
[0175] It should be noted that the first storage block refers to the storage block in the failed hard disk that belongs to the stripe. Exemplarily, Figure 4c is a schematic diagram of a failed hard disk in a RAID group provided by an embodiment of the present application. As Figure 4c shown, when the first hard disk is the failed hard disk, for stripe 1, the RAID card can determine that D1 that has failed in stripe 1 is the first storage block, and determine D2, D3, and P1 as the second storage blocks.
[0176] S405: Calculate the reconstructed data corresponding to the first storage block according to the redundant data in the second storage block.
[0177] In this embodiment, the RAID card can calculate the reconstructed data corresponding to the first storage block according to the redundant data in the second storage block.
[0178] In one implementation, the RAID card can determine whether the first storage block is a hot spare storage block.
[0179] If so, it means that the first storage block has not stored data yet. The RAID card does not need to calculate the reconstructed data corresponding to the first storage block, and the RAID card can end the processing process of this stripe.
[0180] If not, the RAID card can read the redundant data in the second storage block and calculate the reconstructed data according to the redundant data.
[0181] Next, the process of the RAID card calculating the reconstructed data according to the redundant data will be described.
[0182] In one implementation, when the redundant data is the mirror data of the reconstructed data (the data stored in the failed first storage block), the RAID card can directly copy the redundant data to obtain the reconstructed data.
[0183] In one implementation, when the redundant data is the parity data participating in the XOR operation and another written data (such as the second written data), the RAID card can use the XOR operation method to obtain the reconstructed data (such as the first written data).
[0184] In one implementation, when the redundant data are all written data (such as the first written data and the second written data) and the reconstructed data is the parity data, the RAID card can use the XOR operation method to obtain the reconstructed data (parity data).
[0185] Next, the principle of the RAID card obtaining the reconstructed data by using the XOR operation will be described.
[0186] P = A XOR B
[0187] Among them, P (XOR result) is the parity data; A and B are the written data.
[0188] Table 1 is the parity principle of the XOR operation, as shown in Table 1:
[0189] Table 1 Parity Principle of XOR Operation
[0190] A B value XOR result 0 0 0 1 0 1 0 1 1 1 1 0
[0191] As can be seen from Table 1, when A is the same as B, the XOR result is 0; when A is different from B, the XOR result is 1. That is to say, given the XOR result and any one of the values of A and B, the other value can be deduced. Exemplarily, when A is 1 and the XOR result is 1, B is 0. When A is 1 and the XOR result is 0, B is 1.
[0192] The RAID card has a RAID working mode and a non-RAID working mode. When the RAID working mode is enabled, during the process of writing data to the hard disks in the RAID group, the RAID card can calculate the parity data corresponding to the written data (such as the first written data) and another written data (such as the second written data) based on exclusive-or operation, and store it in the hard disks of the RAID group.
[0193] Therefore, when a written data (such as the first written data) needs to be reconstructed, that is, when the reconstructed data is the written data for writing to a storage block, the RAID card can use the parity data and the written data for writing to other storage blocks (such as the second written data) to perform exclusive-or operation to calculate the written data (reconstructed data) (such as the first written data). When the parity data needs to be reconstructed, that is, when the parity data is the reconstructed data, the RAID card can use multiple written data (such as the first written data and the second written data) to perform exclusive-or operation to calculate the parity data (reconstructed data).
[0194] S406: Store the reconstructed data in the hot spare storage block in the stripe.
[0195] In this embodiment, the RAID card can store the reconstructed data in the hot spare storage block in the stripe.
[0196] It should be noted that the hot spare storage blocks in different stripes belong to different hard disks.
[0197] It should also be noted that since the hot spare storage blocks in different stripes belong to different hard disks, the process of the RAID card writing the reconstructed data of different stripes into the hot spare storage blocks in the stripes can be executed in parallel. That is to say, the RAID card does not need to wait for the hard disk to which the hot spare storage block in the previous stripe belongs to send a write completion command, and can send a write command to the hard disk to which the hot spare storage block in the next stripe belongs to store the reconstructed data in the hot spare storage block in the next stripe, thereby improving the reconstruction efficiency.
[0198] Advantages of this embodiment: In this embodiment, the RAID card is electrically connected to multiple hard disks. The RAID card can determine the storage blocks at the same position in the multiple hard disks as the multiple storage blocks included in one stripe. The RAID card can use at least one of the multiple storage blocks as the hot standby storage block in the stripe. The hot standby storage blocks in different stripes belong to different hard disks. The RAID card can use the storage blocks other than the hot standby storage block among the multiple storage blocks as the redundant storage blocks in the stripe. For any stripe, the RAID card can determine the first storage block that fails in the stripe, and determine the other storage blocks among the multiple redundant storage blocks in the stripe except the first storage block as the second storage blocks. The RAID card can calculate the reconstructed data corresponding to the first storage block according to the redundant data in the second storage blocks, and store the reconstructed data in the hot standby storage block (the storage block that can be used to store the reconstructed data) in the stripe. Compared with the related art where a hard disk is directly used as the hot standby hard disk and the hot standby hard disk is in a standby state without any contribution when there is no hard disk failure in the RAID group, in the embodiment of the present application, by using the above method of using the hot standby storage block as a storage block of the stripe and setting the hot standby storage blocks of different stripes in different hard disks, the hot standby hard disk can be used as an ordinary hard disk and added to the RAID group for reading and writing, improving the read and write performance of the RAID group. In addition, compared with the related art where a hard disk is directly used as the hot standby hard disk and the RAID card needs to receive the write completion command corresponding to one stripe feedback from the hot standby hard disk before sending the write command corresponding to the next stripe to the hot standby hard disk, resulting in low data reconstruction efficiency, in the embodiment of the present application, by using the hot standby storage block as a storage block of the stripe and setting the hot standby storage blocks of different stripes in different hard disks, the writing processes of the reconstructed data of different stripes can be parallel, improving the data reconstruction efficiency.
[0199] Figure 5 It is a schematic flowchart of a data reconstruction provided by an embodiment of the present application. Next, in combination with Figure 4c and Figure 5 , through specific examples, the data reconstruction process will be described.
[0200] Exemplarily, as Figure 4c shown, the first hard disk, the second hard disk, the third hard disk, the fourth hard disk, and the fifth hard disk can form a RAID group. The RAID group includes 5 stripes. Among them, the hot standby storage block H1 in stripe 1 belongs to the fifth hard disk, the hot standby storage block H2 in stripe 2 belongs to the fourth hard disk, the hot standby storage block H3 in stripe 3 belongs to the third hard disk, the hot standby storage block H4 in stripe 4 belongs to the second hard disk, and the hot standby storage block H5 in stripe 5 belongs to the first hard disk.
[0201] The first hard disk fails. Correspondingly, the redundant storage block (data storage block) D1 in stripe 1 fails, the redundant storage block (data storage block) D4 in stripe 2 fails, the redundant storage block (data storage block) D7 in stripe 3 fails, the redundant storage block (parity storage block) P4 in stripe 4 fails, and the hot spare storage block H5 in stripe 5 fails.
[0202] In this embodiment, for stripe 1, the RAID card can determine the first storage block D1 that fails in stripe 1. The RAID card can determine the other storage blocks (D2, D3, and P1) in the multiple redundant storage blocks in the stripe, except for the first storage block, as the second storage blocks.
[0203] For stripe 2, the RAID card can determine the first storage block D4 that fails in stripe 2. The RAID card can determine the other storage blocks (D5, P2, and D6) in the multiple redundant storage blocks in the stripe, except for the first storage block, as the second storage blocks.
[0204] For stripe 3, the RAID card can determine the first storage block D7 that fails in stripe 3. The RAID card can determine the other storage blocks (P3, D8, and D9) in the multiple redundant storage blocks in the stripe, except for the first storage block, as the second storage blocks.
[0205] For stripe 4, the RAID card can determine the first storage block P4 that fails in stripe 4. The RAID card can determine the other storage blocks (D10, D11, and D12) in the multiple redundant storage blocks in the stripe, except for the first storage block, as the second storage blocks.
[0206] For stripe 5, the RAID card can determine the first storage block H5 that fails in stripe 5. The RAID card can determine the other storage blocks (D13, D14, D15, and P5) in the multiple redundant storage blocks in the stripe, except for the first storage block, as the second storage blocks.
[0207] For stripe 1:
[0208] As Figure 5 shown, (1) The RAID card can send a read command corresponding to stripe 1 to the second hard disk (the hard disk to which D2 belongs). It should be noted that taking the read command sent to the second hard disk as an example, the read command can include the logical block address (Logical Block Addressing, abbreviated as LBA) of D2.
[0209] (2) The RAID card can send a read command corresponding to stripe 1 to the third hard disk.
[0210] (3) The RAID card can send a read command corresponding to stripe 1 to the fourth hard disk (the hard disk to which P1 belongs).
[0211] (4) Additionally, the RAID card can also send a read command corresponding to stripe 2 to the fifth hard disk. Next, the reason why the RAID card sends a read command corresponding to stripe 2 to the fifth hard disk will be explained. Based on H1 in the fifth hard disk being the hot spare storage block for stripe 1, therefore, for stripe 1, the RAID card does not need to send a read command to the fifth hard disk. However, to improve the data reconstruction efficiency, when the RAID card sends a read command corresponding to stripe 1 to the second hard disk, the third hard disk, and the fourth hard disk, it can send a read command corresponding to stripe 2 to the fifth hard disk. It should also be noted that the read command corresponding to stripe 2 sent to the fifth hard disk can include the LBA of D6.
[0212] (5) The second hard disk can read the redundant data in D2 according to the read command corresponding to stripe 1 (including the LBA of D2).
[0213] (6) The second hard disk can send the redundant data in D2 to the RAID card.
[0214] (7) The third hard disk can read the redundant data in D3 according to the read command corresponding to stripe 1 (including the LBA of D3).
[0215] (8) The third hard disk can send the redundant data in D3 to the RAID card.
[0216] (9) The fourth hard disk can read the redundant data in P1 according to the read command corresponding to stripe 1 (including the LBA of P1).
[0217] (10) The fourth hard disk can send the redundant data in P1 to the RAID card.
[0218] (11) The fifth hard disk can read the redundant data in D6 according to the read command corresponding to stripe 2 (including the LBA of D5).
[0219] (12) The fifth hard disk can send the redundant data in D6 to the RAID card.
[0220] It should be noted that the processes of the second hard disk, the third hard disk, the fourth hard disk, and the fifth hard disk reading data can be executed in parallel without interfering with each other.
[0221] (13) For stripe 1, the RAID card can calculate the reconstructed data corresponding to the first storage block D1 based on the redundant data in the second storage block (the redundant data in D2, the redundant data in D3, and the redundant data in P1).
[0222] After obtaining the reconstructed data, the RAID card can store the reconstructed data in the hot spare storage block H1 in stripe 1. Specifically, (14) the RAID card can send a write command corresponding to stripe 1 to the fifth hard disk. The write command includes the reconstructed data and the LBA of the hot spare storage block (H1). (15) The fifth hard disk can store the reconstructed data in the hot spare storage block H1 in stripe 1 according to the write command. (16) After the writing is completed, the fifth hard disk can send a write completion command corresponding to stripe 1 to the RAID card.
[0223] For stripe 2:
[0224] (17) During the process that the fifth hard disk stores the reconstructed data in the hot spare storage block H1 in stripe 1 according to the write command, the RAID card can send a read command corresponding to stripe 2 to the second hard disk (the hard disk to which D5 belongs).
[0225] (18) The RAID card can send a read command corresponding to stripe 2 to the third hard disk (the hard disk to which P2 belongs).
[0226] In addition, it should be noted that since the RAID card has sent a read command corresponding to stripe 1 to the second hard disk, the third hard disk, and the fourth hard disk, and has sent a read command corresponding to stripe 2 to the fifth hard disk, at this time, the RAID card does not need to send a read command corresponding to stripe 2 to the fifth hard disk anymore. However, in one implementation, to improve the data reconstruction efficiency, at this time, the RAID card can send a read command corresponding to stripe 3 to the fifth hard disk ( Figure 5 not shown).
[0227] In addition, it should be noted that based on H2 in the fourth hard disk, it is the hot spare storage block for stripe 2. Therefore, for stripe 2, the RAID card does not need to send a read command to the fourth hard disk. However, in one implementation, to improve the data reconstruction efficiency, the RAID card can send a read command corresponding to stripe 3 to the fourth hard disk ( Figure 5 not shown).
[0228] (19) The second hard disk can read the redundant data in D5 according to the read command corresponding to stripe 2 (including the LBA of D5).
[0229] (20) The second hard disk can send the redundant data in D5 to the RAID card.
[0230] (21) The third hard disk can read the redundant data in P2 according to the read command corresponding to stripe 2 (including the LBA of P2).
[0231] (22) The third hard disk can send the redundant data in P2 to the RAID card.
[0232] (23)For stripe 2, the RAID card can calculate the reconstructed data corresponding to the first storage block D4 based on the redundant data in the second storage block (the redundant data in D5, the redundant data in P2, and the redundant data in D6).
[0233] After obtaining the reconstructed data, the RAID card can store the reconstructed data in the hot spare storage block H2 in stripe 2. Specifically, (24) the RAID card can send a write command corresponding to stripe 2 to the fourth hard disk. The write command includes the reconstructed data and the LBA of the hot spare storage block (H2). (25) The fourth hard disk can store the reconstructed data in the hot spare storage block H2 in stripe 2 according to the write command. (26) After the writing is completed, the fourth hard disk can send a write completion command corresponding to stripe 2 to the RAID card.
[0234] It should be noted that since the hot spare storage block H1 in stripe 1 belongs to the fifth hard disk and the hot spare storage block H2 in stripe 2 belongs to the fourth hard disk, during the process of the fifth hard disk storing the reconstructed data in the hot spare storage block H1 in stripe 1 according to the write command corresponding to stripe 1, the fourth hard disk stores the reconstructed data in the hot spare storage block H2 in stripe 2 according to the write command corresponding to stripe 2, and the two can be executed in parallel.
[0235] In addition, it should be noted that the processing procedures of stripe 3, stripe 4, and stripe 5 are similar to those of stripe 1 and stripe 2, and will not be elaborated here.
[0236] From the above example, it can be seen that by using the hot spare storage block as a storage block of the stripe and setting the hot spare storage blocks of different stripes in different hard disks, the writing processes of the reconstructed data of different stripes can be parallelized, improving the data reconstruction efficiency. In addition, while reading the redundant data in the second storage block of one stripe, the redundant data in a second storage block (the second storage block belonging to the same hard disk as the hot spare storage block of this stripe) of the next stripe can be read to improve the acquisition rate of the redundant data in the second storage block of the next stripe, thereby improving the reconstruction efficiency of the reconstructed data corresponding to the first storage block of the next stripe, and thus overall improving the data reconstruction rate of the failed hard disk.
[0237] In addition, below, in combination with Table 2, the read and write speeds of a mechanical hard disk (Hard Disk Drive, abbreviated as HDD), a SATA solid state drive (Solid State Disk or Solid State Drive, abbreviated as SSD), and a SAS SSD will be described.
[0238] Table 2 Read and Write Speeds of Hard Disks
[0239] Type HDD SATA SSD SAS SSD Model 10T SATA S4520 3.84T PM1653 3.84T Read speed 280MB / S 550MB / S 4200MB / S Write speed 280MB / S 510MB / S 3700MB / S
[0240] Based on the above example, it can be seen that the method of setting the hot standby storage blocks of different stripes to belong to different hard disks can make the bottleneck of the reconstruction performance no longer the write performance of the hard disk, but the read performance of the hard disk. Since the read performance of the hard disk is greater than or equal to the write performance of the hard disk, therefore, compared with the method in the related art, the method of the embodiment of the present application improves the reconstruction performance of the RAID group.
[0241] Figure 6 This is a schematic flowchart of the third embodiment of a data reconstruction method provided by the embodiment of the present application. Refer to Figure 6 , the method specifically includes the following steps:
[0242] S601: Determine the storage blocks at the same position in multiple hard disks as the multiple storage blocks included in one stripe.
[0243] In this embodiment, the RAID card can be electrically connected to multiple hard disks.
[0244] During the process of forming a RAID group from multiple hard disks, the RAID card can determine the multiple storage blocks at the same position in multiple hard disks as the multiple storage blocks included in one stripe.
[0245] S602: Use at least one of the multiple storage blocks as the hot standby storage block in the stripe, and the hot standby storage blocks in different stripes belong to different hard disks.
[0246] In this embodiment, the RAID card can use at least one of the multiple storage blocks as the hot standby storage block in the stripe.
[0247] It should be noted that the hot standby storage blocks in each stripe belong to different hard disks.
[0248] It should also be noted that the hot standby storage block refers to a storage block that can be used to store reconstructed data. When there is no failed first storage block in the stripe, the hot standby storage block does not store data; when there is a failed first storage block in the stripe, the hot standby storage block can be used to store the reconstructed data corresponding to the first storage block.
[0249] Next, the process of the RAID card using at least one of the multiple storage blocks as the hot standby storage block in the stripe will be described.
[0250] In one implementation:
[0251] In the case where the stripe is the first stripe, the RAID card can use the storage block with the position serial number M in the multiple storage blocks as the hot standby storage block in the stripe. Wherein, M is an integer greater than or equal to 1 and less than or equal to N. N is the total number of multiple hard disks. Exemplarily, M is 5 and N is 5.
[0252] It should be noted that the position serial number is used to indicate the position sorting of the storage blocks in all the storage blocks included in a stripe. Understandably, based on the different storage blocks in a stripe, they belong to different hard disks. Therefore, the position serial number can also be used to indicate the position sorting of the hard disk to which the storage block belongs among all the hard disks.
[0253] When the stripe is not the first stripe, the RAID card can obtain the first position serial number of the hot spare storage block in the previous stripe, and determine the hot spare storage block in the stripe according to the first position serial number.
[0254] In one implementation, the RAID card can determine the second position serial number of the hot spare storage block in the stripe according to the first position serial number and the first preset serial number difference. The RAID card can determine the hot spare storage block in the stripe from multiple storage blocks in the stripe according to the second position serial number. In one implementation, the first preset serial number difference can be an integer greater than or equal to 1 and less than N. It should be noted that when the first preset serial number difference is greater than 1, the first preset serial number difference is not a factor of N.
[0255] S603: Use at least one of the multiple storage blocks as the parity storage block in the stripe.
[0256] In this embodiment, the RAID card can use at least one of the multiple storage blocks as the parity storage block in the stripe. Among them, the multiple redundant storage blocks in a stripe include the parity storage block.
[0257] It should be noted that the parity storage block and the hot spare storage block are not the same storage block.
[0258] It should also be noted that the RAID card can first execute S602 and then execute S603; the RAID card can also first execute S603 and then execute S602; the RAID card can also execute S603 while executing S602.
[0259] Next, the process by which the RAID card determines the parity storage block in the stripe will be described.
[0260] In one implementation,
[0261] The RAID card can determine the third position serial number of the parity storage block according to the second position serial number of the hot spare storage block in the stripe and the second preset serial number difference. In one implementation, the second preset serial number difference can be an integer greater than or equal to 1 and less than N. In one implementation, when the second preset serial number difference is greater than 1, the second preset serial number difference is not a factor of N.
[0262] The RAID card can determine the parity storage block in the stripe according to the third position serial number.
[0263] In one implementation,
[0264] When the stripe is the first stripe, the storage block with the position serial number L among the multiple storage blocks is used as the parity storage block in the stripe; L is an integer greater than or equal to 1 and less than or equal to N; N is the total number of multiple hard disks.
[0265] When the stripe is not the first stripe, the RAID card can obtain the position serial number of the parity storage block in the previous stripe, and determine the parity storage block in this stripe according to the position serial number of the parity storage block in the previous stripe. In one implementation, the RAID card can determine the third position serial number of the parity storage block in this stripe according to the position serial number of the parity storage block in the previous stripe and the third preset serial number difference, and determine the parity storage block in the stripe from the multiple storage blocks in this stripe according to the third position serial number of the parity storage block in this stripe. Among them, the third preset serial number difference can be an integer greater than or equal to 1 and less than N. When the third preset serial number difference is greater than 1, the third preset serial number difference is not a factor of N.
[0266] S604: Use the storage blocks among the multiple storage blocks except the hot spare storage block and the parity storage block as the data storage blocks in the stripe.
[0267] In this embodiment, the RAID card can use the storage blocks among the multiple storage blocks except the hot spare storage block and the parity storage block as the data storage blocks in the stripe.
[0268] It should be noted that the multiple redundant storage blocks in a stripe include data storage blocks.
[0269] S605: For any stripe, determine the first storage block that fails in the stripe, and determine the other storage blocks among the multiple redundant storage blocks in the stripe except the first storage block as the second storage blocks.
[0270] In this embodiment, for any stripe, the RAID card can determine the first storage block that fails in the stripe, and determine the other storage blocks among the multiple redundant storage blocks in the stripe except the first storage block as the second storage blocks.
[0271] The specific implementation process is the same as that of S404 and will not be elaborated here.
[0272] S606: Calculate the reconstructed data corresponding to the first storage block according to the redundant data in the second storage block.
[0273] In this embodiment, the RAID card can calculate the reconstructed data corresponding to the first storage block according to the redundant data in the second storage block.
[0274] The specific implementation process is the same as that of S405 and will not be elaborated here.
[0275] S607: Store the reconstructed data in the hot spare storage block in the stripe.
[0276] In this embodiment, the RAID card can store the reconstructed data in the hot spare storage block in the stripe.
[0277] The specific implementation process is the same as that of S406 and will not be elaborated here.
[0278] Advantageous effects of this embodiment: In this embodiment, the RAID card can determine the storage blocks at the same position in multiple hard disks as the multiple storage blocks included in a stripe. The RAID card can use at least one of the multiple storage blocks as the hot spare storage block in the stripe. Among them, the hot spare storage blocks in different stripes belong to different hard disks. The RAID card can use at least one of the multiple storage blocks as the parity storage block in the stripe (the multiple redundant storage blocks in the stripe include this parity storage block). The hot spare storage block and the parity storage block are not the same storage block. The RAID card can use the storage blocks other than the hot spare storage block and the parity storage block among the multiple storage blocks as the data storage blocks in the stripe (the multiple redundant storage blocks in the stripe include this parity storage block). The method in the embodiment of the present application does not require setting a separate hot spare hard disk, but sets the hot spare storage blocks in different stripes to belong to different hard disks. By the above method of regularly distributing all the hot spare storage blocks in different hard disks, the writing processes of the reconstructed data of different stripes can be executed in parallel, improving the data reconstruction efficiency.
[0279] Figure 7a It is a schematic flowchart of the fourth embodiment of a data reconstruction method provided by an embodiment of the present application. Refer to Figure 7a and the method specifically includes the following steps:
[0280] S701: Determine the storage blocks at the same position in multiple hard disks as the multiple storage blocks included in a stripe.
[0281] In this embodiment, the RAID card can determine the storage blocks at the same position in multiple hard disks as the multiple storage blocks included in a stripe.
[0282] The specific implementation process is the same as that of S401 and will not be elaborated here.
[0283] S702: When the stripe is not the first stripe, obtain the first position number of the hot spare storage block in the previous stripe, and determine the hot spare storage block in the stripe according to the first position number.
[0284] In this embodiment, the RAID card can obtain the first position number of the hot spare storage block in the previous stripe when the stripe is not the first stripe.
[0285] The RAID card can determine the hot spare storage block in the stripe according to the first position number.
[0286] In one implementation, the RAID card can determine the second position number of the hot spare storage block in the stripe according to the first position number and the first preset number difference. The RAID card can determine the hot spare storage block in the stripe from multiple storage blocks in the stripe according to the second position number.
[0287] Next, the process of the RAID card determining the second position number of the hot spare storage block in the stripe according to the first position number and the first preset number difference will be described in detail.
[0288] In one implementation,
[0289] The RAID card can calculate the initial position number according to the first position number and the first preset number difference.
[0290] The RAID card can determine whether the initial position number is greater than or equal to 1 and less than or equal to N.
[0291] If so, the RAID card can determine the initial position number as the second position number.
[0292] If not, the RAID card can calculate the second position number according to the initial position number and N.
[0293] It should be noted that, in one implementation, the first preset number difference is an integer greater than or equal to 1 and less than N. It should be noted that when the first preset number difference is greater than 1, the first preset number difference is not a factor of N.
[0294] In one implementation, when it is necessary to set the hot spare storage block in a right-rotation manner:
[0295] The RAID card can determine the sum of the first position number and the first preset number difference as the initial position number. The RAID card can determine whether the initial position number is greater than or equal to 1 and less than or equal to N. If so, the RAID card can determine the initial position number as the second position number. If not, the RAID card can determine the difference between the initial position number and N as the second position number.
[0296] Exemplarily, Figure 7b FIG. is a schematic diagram of another RAID group provided by an embodiment of the present application.
[0297] As Figure 7b shown, taking the first preset serial number difference as 1 as an example, the process of determining the hot spare storage block in stripe 2 and the hot spare storage block in stripe 5 will be described.
[0298] For stripe 2, based on the first position serial number of the hot spare storage block (H1) in the previous stripe (stripe 1) being 2, the RAID card can determine the sum of the first position serial number (2) and the first preset serial number difference (1) as the initial position serial number. When the RAID card determines that the initial position serial number (3) is greater than or equal to 1 and less than or equal to N, the RAID card can determine the initial position serial number (3) as the second position serial number. The RAID card can determine the hot spare storage block (H2) in stripe 2 from multiple storage blocks in stripe 2 according to the second position serial number (3).
[0299] For stripe 5, based on the first position serial number of the hot spare storage block (H4) in the previous stripe (stripe 4) being 5, the RAID card can determine the sum of the first position serial number (5) and the first preset serial number difference (1) as the initial position serial number. When the RAID card determines that the initial position serial number (6) is greater than N (5), the RAID card can determine the difference between the initial position serial number (6) and N (5) as the second position serial number. The RAID card can determine the hot spare storage block (H5) in stripe 5 from multiple storage blocks in the stripe according to the second position serial number (1).
[0300] It should be noted that the process of the RAID card determining the hot spare storage blocks in stripe 3 and stripe 4 is similar to that in stripe 2 and stripe 5, and will not be elaborated here.
[0301] In one implementation, when it is necessary to set the hot spare storage block in a left - rotation manner:
[0302] The RAID card can determine the difference between the first position serial number and the first preset serial number difference as the initial position serial number. The RAID card can determine whether the initial position serial number is greater than or equal to 1 and less than or equal to N. If so, the RAID card can determine the initial position serial number as the second position serial number. If not, the RAID card can determine the sum of the initial position serial number and N as the second position serial number.
[0303] Exemplarily, Figure 7c FIG. is a schematic diagram of yet another RAID group provided by an embodiment of the present application.
[0304] As Figure 7cAs shown, taking the first preset serial number difference as 2 as an example, the process of determining the hot standby storage block in stripe 2 and the hot standby storage block in stripe 4 will be described.
[0305] For stripe 2, based on the first position serial number of the hot standby storage block (H1) in the previous stripe (stripe 1) being 5, the RAID card can determine the difference between the first position serial number (5) and the first preset serial number difference (2) as the initial position serial number. When the RAID card determines that the initial position serial number (3) is greater than or equal to 1 and less than or equal to N, it can determine the initial position serial number (3) as the second position serial number. The RAID card can determine the hot standby storage block (H2) in stripe 2 from multiple storage blocks in stripe 2 according to the second position serial number (3).
[0306] For stripe 4, based on the first position serial number of the hot standby storage block (H3) in the previous stripe (stripe 3) being 1, the RAID card can determine the difference between the first position serial number (1) and the first preset serial number difference (2) as the initial position serial number. When the RAID card determines that the initial position serial number (-1) is less than 1, it can determine the sum of the initial position serial number (-1) and N (5) as the second position serial number. The RAID card can determine the hot standby storage block (H4) in stripe 4 from multiple storage blocks in stripe 4 according to the second position serial number (4).
[0307] It should be noted that the process of the RAID card determining the hot standby storage blocks in stripe 3 and stripe 4 is similar to that in stripe 2 and stripe 5, and will not be elaborated here.
[0308] It should also be noted that the RAID card can execute S704 after executing S702.
[0309] S703: When the stripe is the first stripe, the storage block with the position serial number M in multiple storage blocks is used as the hot standby storage block in the stripe.
[0310] In this embodiment, when the stripe is the first stripe, the RAID card can use the storage block with the position serial number M in multiple storage blocks as the hot standby storage block in this stripe.
[0311] Among them, M is an integer greater than or equal to 1 and less than or equal to N. It should be noted that N is the total number of multiple hard disks.
[0312] For example, when M is 2: As Figure 7b shown, for stripe 1, based on stripe 1 being the first stripe, the RAID card can use the storage block with the position serial number 2 in multiple storage blocks as the hot standby storage block H1 in this stripe.
[0313] For another example, when M is 5: AsFigure 7c As shown, for stripe 1, since stripe 1 is the first stripe, the RAID card can use the storage block with the position serial number 5 among multiple storage blocks as the hot spare storage block H1 in this stripe.
[0314] It should be noted that the RAID card can execute S704 after executing S703.
[0315] S704: Determine the third position serial number of the parity storage block according to the second position serial number of the hot spare storage block in the stripe and the difference between the second preset serial numbers.
[0316] In this embodiment, the RAID card can determine the third position serial number of the parity storage block according to the second position serial number of the hot spare storage block in the stripe and the difference between the second preset serial numbers.
[0317] Next, the process of the RAID card determining the third position serial number of the parity storage block according to the second position serial number and the difference between the second preset serial numbers will be described.
[0318] In one implementation,
[0319] The RAID card can calculate the candidate position serial number according to the second position serial number and the difference between the second preset serial numbers.
[0320] The RAID card can determine whether the candidate position serial number is greater than or equal to 1 and less than or equal to N. Here, N is the total number of multiple hard disks.
[0321] If so, the RAID card can determine the candidate position serial number as the third position serial number.
[0322] If not, the RAID card can calculate the third position serial number according to the candidate position serial number and N.
[0323] It should be noted that in one implementation, the difference between the second preset serial numbers is an integer greater than or equal to 1 and less than N.
[0324] It should be noted that in one implementation, when the difference between the second preset serial numbers is greater than 1, the difference between the second preset serial numbers is not a factor of N.
[0325] In one implementation, when arranging in a right - hand rotation manner between the hot spare storage block and the parity storage block:
[0326] The RAID card can determine the candidate position number by summing the difference between the second position number and the second preset number. The RAID card can determine whether the candidate position number is greater than or equal to 1 and less than or equal to N. If so, the RAID card can determine the candidate position number as the third position number. If not, the RAID card can determine the difference between the candidate position number and N as the third position number.
[0327] In one implementation, when arranging in a left-rotating manner between the hot spare storage block and the parity storage block:
[0328] The RAID card can determine the candidate position number as the difference between the difference of the second position number and the second preset number. The RAID card can determine whether the candidate position number is greater than or equal to 1 and less than or equal to N. If so, the RAID card can determine the candidate position number as the third position number. If not, the RAID card can determine the sum of the candidate position number and N as the third position number.
[0329] As Figure 7b shown, taking the difference of the second preset number as 1 as an example, the process of determining the parity storage block in stripe 2 and the parity storage block in stripe 5 is described.
[0330] For stripe 2, the RAID card can determine the candidate position number (2) as the difference between the second position number (3) and the difference of the second preset number (1). The RAID card can, when determining that the candidate position number is greater than or equal to 1 and less than or equal to N, determine the candidate position number as the third position number (2).
[0331] For stripe 5, the RAID card can determine the candidate position number (0) as the difference between the second position number (1) and the difference of the second preset number (1). The RAID card can, when determining that the candidate position number is less than 1, determine the sum of the candidate position number (0) and N (5) as the third position number (5).
[0332] S705: Determine the parity storage block in the stripe according to the third position number.
[0333] In this embodiment, the RAID card can determine the parity storage block in the stripe according to the third position number.
[0334] Among them, the parity storage block is a redundant storage block for storing parity data.
[0335] S706: Use the storage blocks in the multiple storage blocks, except for the hot spare storage block and the parity storage block, as the data storage blocks in the stripe.
[0336] In this embodiment, the RAID card can determine, as data storage blocks in a stripe, the storage blocks among multiple storage blocks excluding the hot spare storage block and the parity storage block.
[0337] Multiple redundant storage blocks in a stripe include the data storage blocks.
[0338] Among them, the data storage blocks are redundant storage blocks for storing written data.
[0339] S707: For any stripe, determine the first storage block that fails in the stripe, and determine, as second storage blocks, the other storage blocks among the multiple redundant storage blocks in the stripe excluding the first storage block.
[0340] In this embodiment, for any stripe, the RAID card can determine the first storage block that fails in the stripe, and determine, as second storage blocks, the other storage blocks among the multiple redundant storage blocks in the stripe excluding the first storage block.
[0341] The specific implementation process is the same as that of S404 and will not be elaborated here.
[0342] S708: Calculate the reconstruction data corresponding to the first storage block according to the redundant data in the second storage blocks.
[0343] In this embodiment, the RAID card can calculate the reconstruction data corresponding to the first storage block according to the redundant data in the second storage blocks.
[0344] The specific implementation process is the same as that of S405 and will not be elaborated here.
[0345] S709: Store the reconstruction data into the hot spare storage block in the stripe.
[0346] In this embodiment, the RAID card can store the reconstruction data into the hot spare storage block in the stripe.
[0347] The specific implementation process is the same as that of S406 and will not be elaborated here.
[0348] Beneficial effects of this embodiment: In this embodiment, during the construction of the RAID group, the RAID card can obtain the first position serial number of the hot standby storage block in the previous stripe when the stripe is not the first stripe, and determine the hot standby storage block in the stripe according to the first position serial number. When the stripe is the first stripe, the RAID card can use the storage block with the position serial number M among multiple storage blocks as the hot standby storage block in the stripe. After determining the hot standby storage block in the stripe, the RAID card can determine the parity storage block in the stripe according to the second position serial number of the hot standby storage block in the stripe and the second preset serial number difference e, and according to the third position serial number. The RAID card can determine the data storage blocks in the stripe as the storage blocks among multiple storage blocks except the hot standby storage block and the parity storage block. By the above method, on the one hand, there is no need to construct a mapping table with a large amount of data, and the hot standby storage block, parity storage block, and data storage block in each stripe can be quickly determined, improving the construction efficiency of the RAID group. On the other hand, compared with the related art, it is necessary to use a mapping table with a large amount of data to record the attributes of each storage block and the hard disk to which it belongs, resulting in a large memory occupation, and frequent access to the mapping table is required during the processing process (business read / write process and reconstruction process), resulting in low processing efficiency. In the embodiment of the present application, there is no need to maintain a mapping table with a large amount of data, and only based on the sequential relationship of multiple hard disks connected to the RAID card and simple rules, the attributes of each storage block in each hard disk can be quickly determined, improving the processing efficiency and reducing the requirements for the processing capabilities of the processor (such as CPU) and memory.
[0349] Figure 8 FIG. 4 is a schematic structural diagram of another server provided by an embodiment of the present application. As Figure 8 shown, the server 10 may include a processor 101, a RAID card 102, and multiple hard disks. Exemplarily, Figure 8 five hard disks are shown, which are the first hard disk 103, the second hard disk 104, the third hard disk 105, the fourth hard disk 106, and the fifth hard disk 107 respectively.
[0350] The RAID card 102 includes a front-end PCIe port 1021, a PCI function module 1022, a front-end processing module 1023, a cache module 1024, a configuration management module 1025, a RAID algorithm module 1026, a back-end processing module 1027, and a back-end SAS / SATA / PCIe port 1028.
[0351] Next, the functions of each module will be introduced.
[0352] Front - end PCIe port 1021: It is used to communicate with a processor (such as a CPU), for example, to obtain reconstruction commands or read - write commands sent by the processor. Additionally, it can also obtain any other necessary management - type commands and configuration - type commands, such as commands for creating a RAID group, obtaining logs, and obtaining RAID card / RAID group / hard - disk information.
[0353] PCI function module 1022: It includes the PCI functions that each PCIe device should implement. Among them, each PCI function is used to describe the configuration information of the corresponding PCIe device. The configuration information includes the identity identification information, basic attribute information, and address information, etc., of the PCIe device. Among them, the PCIe device is, for example, a RAID card and / or an NVMe logical hard disk. Each PCI function includes the PCI functions implemented by the corresponding PCIe device. The PCIe device is configured with a set of PCIe registers and related logic processing modules to implement PCI functions that comply with the PCIe specification.
[0354] Front - end processing module 1023: It is used to receive the read - write commands and configuration management commands sent by the processor 101 and distribute them to the cache module 1024 and the configuration management module 1025.
[0355] Cache module 1024: It is used for cache management and cache algorithm operations. Among them, this module is an optional module in the RAID card 102. The RAID card 102 can determine whether a cache module is needed based on whether it supports double - data rate (DDR) cache. If the RAID card 102 supports DDR cache, then this module is required; if the RAID card 102 does not support DDR cache, then this module is not required.
[0356] Configuration management module 1025: It is used to handle transactions such as RAID group creation, deletion, reconstruction, and hard - disk management. It should be noted that when the processor 101 sends a reconstruction command to the RAID card 102, the configuration management module 1025 is responsible for controlling the RAID algorithm module 1026 to perform reconstruction processing based on the reconstruction command.
[0357] RAID algorithm module 1026: Responsible for processing read and write commands for the RAID group, splitting them into read and write commands for specific hard disks according to the RAID algorithm, and distributing them to the backend processing module. Additionally, the RAID algorithm module 1026 can also be responsible for processing the reconstruction tasks (reconstruction commands) for the degraded RAID group. For each stripe, the RAID algorithm module 1026 can send a read command to the backend processing module to read the redundant data stored in the second storage block (other storage blocks in the multiple redundant storage blocks in the stripe except the failed first storage block), calculate the reconstruction data corresponding to the first storage block (the failed storage block in the stripe) according to the parity rules, and then send a write command to the backend processing module to write the calculated reconstruction data into the hot spare storage block in the stripe.
[0358] Backend processing module 1027: Receives commands from the RAID algorithm module and / or the configuration management module, assembles corresponding protocol instructions (such as SAS, SATA, NVME) according to the type of the hard disk, and interacts with each hard disk. It should be noted that the backend processing module 1027 can include a SAS protocol processing sub-module 10271, a SATA protocol processing sub-module 10272, and an NVME protocol processing sub-module 10273.
[0359] Backend SAS / SATA / PCIe port 1028: The port for the RAID card 102 to communicate with the hard disks (SAS hard disks, SATA hard disks, or NVMe hard disks) that make up the RAID group. Among them, the SAS port is used for the RAID card 102 to communicate with SAS hard disks; the SATA port is used for the RAID card 102 to communicate with SATA hard disks; the PCIe port is used for the RAID card 102 to communicate with NVMe hard disks.
[0360] Beneficial effects of this embodiment: For each stripe, the RAID algorithm module can send a read command to the backend processing module to read the redundant data stored in the second storage block (other storage blocks in the multiple redundant storage blocks in the stripe except the failed first storage block), calculate the reconstruction data corresponding to the first storage block according to the parity rules, and then send a write command to the backend processing module to write the calculated reconstruction data into the hot spare storage block in the stripe, improving the reconstruction rate.
[0361] The following is the device embodiment of the present application, which can be used to execute the method embodiment of the present application. For details not disclosed in the device embodiment of the present application, please refer to the method embodiment of the present application.
[0362] The embodiment of the present application provides a RAID card, which is electrically connected to multiple hard disks; the RAID card is used for:
[0363] Determine the storage blocks at the same position in multiple hard disks as the multiple storage blocks included in one stripe;
[0364] Use at least one of the multiple storage blocks as the hot spare storage block in the stripe, and the hot spare storage blocks in different stripes belong to different hard disks;
[0365] Use the storage blocks among the multiple storage blocks except the hot spare storage block as the redundant storage blocks in the stripe;
[0366] For any stripe, determine the first storage block that fails in the stripe, and determine the other storage blocks among the multiple redundant storage blocks in the stripe except the first storage block as the second storage blocks;
[0367] Calculate the reconstructed data corresponding to the first storage block according to the redundant data in the second storage blocks;
[0368] Store the reconstructed data in the hot spare storage block in the stripe.
[0369] In one implementation, the RAID card is specifically used for:
[0370] Determine whether the first storage block is a hot spare storage block;
[0371] If not, read the redundant data in the second storage blocks;
[0372] Calculate the reconstructed data according to the redundant data.
[0373] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, which will not be elaborated here.
[0374] In one implementation, the RAID card is specifically used for:
[0375] Use at least one of the multiple storage blocks as the parity storage block in the stripe; the multiple redundant storage blocks in one stripe include the parity storage block;
[0376] Use the storage blocks among the multiple storage blocks except the hot spare storage block and the parity storage block as the data storage blocks in the stripe; the multiple redundant storage blocks in one stripe include the data storage blocks.
[0377] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, which will not be elaborated here.
[0378] In one implementation, the RAID card is specifically used for:
[0379] When the stripe is not the first stripe, obtain the first position serial number of the hot standby storage block in the previous stripe, and determine the hot standby storage block in the stripe according to the first position serial number; or,
[0380] When the stripe is the first stripe, use the storage block with the position serial number M in the multiple storage blocks as the hot standby storage block in the stripe; M is an integer greater than or equal to 1 and less than or equal to N; N is the total number of multiple hard disks.
[0381] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, which will not be elaborated here.
[0382] In one implementation, the RAID card is specifically used for:
[0383] Determine the second position serial number of the hot standby storage block in the stripe according to the first position serial number and the first preset serial number difference;
[0384] Determine the hot standby storage block in the stripe from the multiple storage blocks in the stripe according to the second position serial number.
[0385] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, which will not be elaborated here.
[0386] In one implementation, the RAID card is specifically used for:
[0387] Calculate the initial position serial number according to the first position serial number and the first preset serial number difference;
[0388] Determine whether the initial position serial number is greater than or equal to 1 and less than or equal to N;
[0389] If so, determine the initial position serial number as the second position serial number;
[0390] If not, calculate the second position serial number according to the initial position serial number and N.
[0391] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, which will not be elaborated here.
[0392] In one implementation, the first preset serial number difference is an integer greater than or equal to 1 and less than N; when the first preset serial number difference is greater than 1, the first preset serial number difference is not a factor of N.
[0393] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and its implementation principle and beneficial effects are similar, which will not be elaborated here.
[0394] In one implementation, the RAID card is specifically configured to:
[0395] Determine the third position serial number of the parity storage block according to the second position serial number of the hot spare storage block in the stripe and the difference between the second preset serial numbers;
[0396] Determine the parity storage block in the stripe according to the third position serial number.
[0397] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be elaborated here.
[0398] In one implementation, the RAID card is specifically configured to:
[0399] Calculate the candidate position serial number according to the second position serial number and the difference between the second preset serial numbers;
[0400] Determine whether the candidate position serial number is greater than or equal to 1 and less than or equal to N; N is the total number of multiple hard disks;
[0401] If so, determine the candidate position serial number as the third position serial number;
[0402] If not, calculate the third position serial number according to the candidate position serial number and N.
[0403] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be elaborated here.
[0404] In one implementation, the difference between the second preset serial numbers is an integer greater than or equal to 1 and less than N.
[0405] The RAID card provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be elaborated here.
[0406] The embodiments of the present application provide a server, including:
[0407] A RAID card and multiple hard disks electrically connected to the RAID card;
[0408] The RAID card is used to execute the above method embodiments.
[0409] The RAID card in the server provided by this embodiment can execute the technical solutions shown in the above method embodiments, and the beneficial effects are similar, which will not be elaborated here.
[0410] The embodiments of the present application also provide a computer-readable storage medium. Computer-executable instructions are stored in the computer-readable storage medium. When the computer-executable instructions are executed by a processor, they are used to implement the technical solutions shown in the above method embodiments, and the beneficial effects are similar, so they will not be elaborated here.
[0411] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium includes: various media such as ROM, RAM, magnetic disk, or optical disk that can store program codes.
[0412] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A data reconstruction method, characterized in that, Applied to a RAID card, the RAID card is electrically connected to multiple hard disks, and the method includes: Determine the storage blocks at the same position in the multiple hard disks as the multiple storage blocks included in one stripe; Use at least one of the multiple storage blocks as the hot spare storage block in the stripe, and the hot spare storage blocks in different stripes belong to different hard disks; Use the storage blocks other than the hot spare storage block among the multiple storage blocks as the redundant storage blocks in the stripe; For any stripe, determine the first storage block that fails in the stripe, and determine the other storage blocks other than the first storage block among the multiple redundant storage blocks in the stripe as the second storage blocks; Calculate the reconstructed data corresponding to the first storage block according to the redundant data in the second storage blocks; Store the reconstructed data into the hot spare storage block in the stripe.
2. The method according to claim 1, wherein The calculating the reconstructed data corresponding to the first storage block according to the redundant data in the second storage blocks includes: Determine whether the first storage block is a hot spare storage block; If not, read the redundant data in the second storage blocks; Calculate the reconstructed data according to the redundant data.
3. The method according to claim 1 or 2, characterized in that, The using the storage blocks other than the hot spare storage block among the multiple storage blocks as the redundant storage blocks in the stripe includes: Use at least one of the multiple storage blocks as the parity storage block in the stripe; the multiple redundant storage blocks in one stripe include the parity storage block; Use the storage blocks other than the hot spare storage block and the parity storage block among the multiple storage blocks as the data storage blocks in the stripe; the multiple redundant storage blocks in one stripe include the data storage blocks.
4. The method according to claim 3, characterized in that, The using at least one of the multiple storage blocks as the hot spare storage block in the stripe includes: When the stripe is not the first stripe, obtain the first position serial number of the hot spare storage block in the previous stripe, and determine the hot spare storage block in the stripe according to the first position serial number; or, When the stripe is the first stripe, use the storage block with the position serial number M among the multiple storage blocks as the hot spare storage block in the stripe; M is an integer greater than or equal to 1 and less than or equal to N; N is the total number of multiple hard disks.
5. The method according to claim 4, wherein The determining the hot spare storage block in the stripe according to the first position serial number includes: Determine the second position serial number of the hot spare storage block in the stripe according to the first position serial number and the first preset serial number difference; Determine the hot spare storage block in the stripe from the multiple storage blocks in the stripe according to the second position serial number.
6. The method according to claim 5, characterized in that, The determining the second position serial number of the hot spare storage block in the stripe according to the first position serial number and the first preset serial number difference includes: Calculate the initial position serial number according to the first position serial number and the first preset serial number difference; Determine whether the initial position serial number is greater than or equal to 1 and less than or equal to N; If so, determine the initial position serial number as the second position serial number; If not, calculate the second position serial number according to the initial position serial number and the N.
7. The method according to claim 5 or 6, characterized in that, The first preset serial number difference is an integer greater than or equal to 1 and less than N; when the first preset serial number difference is greater than 1, the first preset serial number difference is not a factor of N.
8. The method according to any one of claims 3-7, characterized in that, The step of taking at least one of the multiple storage blocks as the parity storage block in the stripe includes: Determine the third position serial number of the parity storage block according to the second position serial number of the hot spare storage block in the stripe and the second preset serial number difference; Determine the parity storage block in the stripe according to the third position serial number.
9. The method according to claim 8, characterized in that The step of determining the third position serial number of the parity storage block according to the second position serial number of the hot spare storage block in the stripe and the second preset serial number difference includes: Calculate the candidate position serial number according to the second position serial number and the second preset serial number difference; Determine whether the candidate position serial number is greater than or equal to 1 and less than or equal to N; the N is the total number of multiple hard disks; If so, determine the candidate position serial number as the third position serial number; If not, calculate the third position serial number according to the candidate position serial number and the N.
10. The method according to claim 8 or 9, characterized in that The second preset serial number difference is an integer greater than or equal to 1 and less than N.
11. A RAID card, characterized in that, The RAID card is electrically connected to multiple hard disks; the RAID card is used for: Determine the storage blocks at the same position in multiple hard disks as the multiple storage blocks included in one stripe; Take at least one of the multiple storage blocks as the hot spare storage block in the stripe, and the hot spare storage blocks in different stripes belong to different hard disks; Take the storage blocks other than the hot spare storage block among the multiple storage blocks as the redundant storage blocks in the stripe; For any stripe, determine the first storage block that fails in the stripe, and determine the other storage blocks except the first storage block among the multiple redundant storage blocks in the stripe as the second storage blocks; Calculate the reconstructed data corresponding to the first storage block according to the redundant data in the second storage blocks; Store the reconstructed data into the hot spare storage block in the stripe.