Data storage method and device, storage medium and electronic equipment

By setting the number of data packets in a RAID6 disk array based on the stripe width and the number of disks, and determining the disk corresponding to each data packet, the problem of low storage performance caused by uneven data segmentation is solved, achieving more efficient storage utilization.

CN120045127BActive Publication Date: 2026-07-03INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2024-12-31
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In existing technologies, the data blocks in RAID6 disk arrays are unevenly distributed across the disks, resulting in low storage performance.

Method used

By setting the number of data blocks in a data packet based on the product of the stripe width and the number of disks, and determining the disk corresponding to each data block, a pre-distribution result of the data packet is generated, ensuring that the data volume is evenly distributed across multiple disks.

Benefits of technology

It achieves uniform distribution of data packets across multiple disks, improves disk storage performance, avoids storage bottlenecks caused by insufficient space on a single disk, and maximizes storage utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045127B_ABST
    Figure CN120045127B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data storage method and device, a storage medium and an electronic device, and relate to the technical field of storage. The method comprises: setting the number of data blocks of a data packet according to the product of the strip width and the number of disks, the data blocks of the data packet being from different disks; determining the disk corresponding to each data block of the data blocks in a plurality of strips, and generating a pre-distribution result of the data blocks of the data packet according to each data block and the disk corresponding to each data block, wherein the total number of data blocks of the plurality of strips is equal to the number of data blocks of the data packet; and storing each data block into the disk corresponding to each data block according to the pre-distribution result, so as to uniformly distribute the data amount of the data packet among the plurality of disks. The problem of how to improve the disk storage performance in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, and more specifically, to a data storage method, apparatus, storage medium, and electronic device. Background Technology

[0002] RAID 6 (RAID 6 - Independent Disk Array with Dual Parity) typically consists of 4-16 disks. A stripe contains a parity block (p), a check block (q), and several data blocks, with the parity block (q) usually larger than the other blocks. Therefore, the data blocks within a stripe are not evenly distributed across the disks. This leads to the concept of packets, each consisting of the number of disks multiplied by the stripe width (number of blocks). Within each packet, the data blocks are evenly distributed across the disks, and the spatial distribution within each packet is consistent. Because the q block is larger than the other blocks, and spatial alignment is required within each packet, the spatial distribution algorithm is complex. This, in turn, increases the complexity of the process and the time-consuming address translation for spatial distribution, significantly impacting disk storage performance.

[0003] Therefore, in related technologies, there is the issue of how to improve disk storage performance.

[0004] No effective solution has yet been proposed for improving disk storage performance in related technologies. Summary of the Invention

[0005] This application provides a data storage method, apparatus, storage medium, and electronic device to at least address the problem of how to improve disk storage performance in related technologies.

[0006] According to one embodiment of this application, a data storage method is provided, applied to a dual parity check independent disk array. The independent disk array includes multiple disks for storing striped data blocks. The stripe width is set based on the number of disks in the independent disk array. The striped data blocks are stored on different disks. Each striped data block includes a first parity block, a second parity block, and multiple data blocks. The data size of the first parity block is greater than the data size of the second parity block, and the data size of the second parity block is the same as the data size of each data block. The method includes: setting the number of data blocks for a data packet based on the product of the stripe width and the number of disks, wherein the data blocks for the data packet come from different disks; determining the disk corresponding to each data block in the multiple stripes; generating a pre-distribution result of the data blocks for the data packet based on each data block and the disk corresponding to each data block, wherein the total number of data blocks in the multiple stripes is equal to the number of data blocks for the data packet; and storing each data block in the disk corresponding to each data block according to the pre-distribution result, so that the data size of the data packet is evenly distributed across the multiple disks.

[0007] In one exemplary embodiment, determining the disk corresponding to each data block in a plurality of stripes, and generating a pre-distribution result of the data blocks of the data packet based on each data block and the disk corresponding to each data block, includes: obtaining the stripe number of the target stripe in the plurality of stripes, wherein the initial value of the stripe number is 0 and the increment is 1; determining the correspondence between the data blocks of the target stripe and the disks based on the stripe number of the target stripe and the number of disks; and determining the pre-distribution result based on the correspondence between the data blocks of the plurality of stripes and the disks.

[0008] In an exemplary embodiment, determining the correspondence between data blocks and disks of the target stripe based on the stripe number of the target stripe and the number of disks includes: obtaining the disk number of the target disk among the plurality of disks, wherein the initial value of the disk number is 0 and the increment is 1; performing a modulo operation on the number of disks based on the stripe number of the target stripe to obtain a first target value; calculating the difference between the disk number and the first target value to obtain a second target value; if the second target value is determined to be non-negative, determining the second target value as a third target value; or, if the second target value is determined to be negative, determining the sum of the second target value and the number of disks as the third target value; if the third target value is determined to be 0, determining the target disk as the disk corresponding to the first parity block in the target stripe; or, if the third target value is determined to be 1, determining the target disk as the disk corresponding to the second parity block in the target stripe; or, if the third target value is determined to be greater than 1, determining the target disk as the disk corresponding to the data block in the target stripe.

[0009] In an exemplary embodiment, determining the correspondence between data blocks and disks of the target stripe based on the stripe number of the target stripe and the number of disks further includes: determining a fourth target value based on the sum of the products of a first preset value and a target value, wherein the target product represents the product of a second preset value and the stripe number; if the fifth target value is determined to be non-negative, determining the disk with the disk number of the fifth target value among the plurality of disks as the disk corresponding to the first parity block in the target stripe, wherein the fifth target value represents the difference between the number of disks and the fourth target value; and determining the disk with the disk number of the sixth target value among the plurality of disks as the disk corresponding to the second parity block in the target stripe, wherein the sixth target value represents the difference between the fifth target value and the first preset value; and determining the disk with the disk number of neither the fifth target value nor the sixth target value among the plurality of disks as the disk corresponding to the data block in the target stripe.

[0010] In an exemplary embodiment, the method further includes: determining the parity of the number of disks when the fifth target value is determined to be negative; and determining the correspondence between the data blocks of the target stripe and the disks based on the fifth target value and the parity of the number of disks.

[0011] In one exemplary embodiment, determining the correspondence between data blocks and disks in the target stripe based on the parity of the fifth target value and the number of disks includes: when the number of disks is determined to be odd, determining the disk with the disk number of the seventh target value among the plurality of disks as the disk corresponding to the first parity block in the target stripe, wherein the seventh target value represents the sum of the number of disks and the fifth target value; and determining the disk with the disk number of the eighth target value among the plurality of disks as the disk corresponding to the second parity block in the target stripe, wherein the eighth target value represents the difference between the seventh target value and the first preset value; and determining the disk with the disk number that is not the seventh target value or the eighth target value among the plurality of disks as the disk corresponding to the data block in the target stripe.

[0012] In one exemplary embodiment, determining the correspondence between data blocks and disks in the target stripe based on the parity of the fifth target value and the number of disks further includes: when the number of disks is determined to be even, identifying the disk with the disk number of the ninth target value among the plurality of disks as the disk corresponding to the second parity block in the target stripe, wherein the ninth target value represents the sum of the number of disks and the fifth target value; and identifying the disk with the disk number of the tenth target value among the plurality of disks as the disk corresponding to the first parity block in the target stripe, wherein the tenth target value represents the difference between the ninth target value and the first preset value; and identifying the disk with the disk number that is not the ninth target value or the tenth target value among the plurality of disks as the disk corresponding to the data block in the target stripe.

[0013] According to another embodiment of this application, a data storage device is provided for use with a dual parity check independent disk array. The independent disk array includes multiple disks for storing striped data blocks. The stripe width is set based on the number of disks in the independent disk array. The stripe data blocks are stored on different disks. Each stripe data block includes a first parity block, a second parity block, and multiple data blocks. The data size of the first parity block is greater than the data size of the second parity block, and the data size of the second parity block is the same as the data size of each data block. The device includes a setting module for setting the stripe width according to the stripe width... The product of the degree and the number of disks sets the number of data blocks in the data packet, and the data blocks in the data packet come from different disks; the generation module is used to determine the disk corresponding to each data block in the data blocks of the multiple stripes, and generate a pre-distribution result of the data blocks of the data packet according to each data block and the disk corresponding to each data block, wherein the total number of data blocks in the multiple stripes is equal to the number of data blocks in the data packet; the storage module is used to store each data block into the disk corresponding to each data block according to the pre-distribution result, so that the data volume of the data packet is evenly distributed among the multiple disks.

[0014] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.

[0015] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0016] According to yet another embodiment of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0017] This application allows for setting the number of data blocks in a data packet based on the product of the stripe width and the number of disks. It then determines the disk corresponding to each data block in the data packet to generate a pre-distribution result of the data blocks. Finally, each data block is stored on its corresponding disk based on the pre-distribution result, ensuring that the data volume of the data packet is evenly distributed across multiple disks. This addresses the problem of improving disk storage performance in related technologies. Attached Figure Description

[0018] Figure 1This is a hardware structure block diagram of a server device for a data storage method according to an embodiment of this application;

[0019] Figure 2 This is a flowchart of a data storage method according to an embodiment of this application;

[0020] Figure 3 This is a schematic flowchart of a data storage method according to an embodiment of this application;

[0021] Figure 4 This is a structural block diagram of a data storage device according to an embodiment of this application. Detailed Implementation

[0022] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0024] The methods and embodiments provided in this application can be executed on a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure block diagram of a server device for a data storage method according to an embodiment of this application. For example... Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The server device may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the server equipment described above. For example, the server equipment may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0025] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the data storage method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the aforementioned data storage method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to server devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0026] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the server device. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0027] This embodiment provides a data storage method applied to a dual parity check independent disk array. The independent disk array includes multiple disks for storing striped data blocks. The stripe width is set based on the number of disks in the independent disk array. The striped data blocks are stored on different disks. Each striped data block includes a first parity block, a second parity block, and multiple data blocks. The data size of the first parity block is greater than that of the second parity block, and the data size of the second parity block is the same as that of each data block. Figure 2 This is a flowchart of a data storage method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:

[0028] Step S202: Set the number of data blocks for the data packet according to the product of the stripe width and the number of disks, wherein the data blocks of the data packet come from different disks;

[0029] Step S204: Determine the disk corresponding to each data block in the data blocks of the multiple stripes, and generate a pre-distribution result of the data blocks of the data packet based on each data block and the disk corresponding to each data block, wherein the total number of data blocks in the multiple stripes is equal to the number of data blocks of the data packet;

[0030] Step S206: Based on the pre-distribution result, each data block is stored in the disk corresponding to each data block, so that the data volume of the data packet is evenly distributed among the multiple disks.

[0031] In an optional embodiment, assuming a RAID6 independent disk array has 6 disks, the stripe width is also 6, meaning one stripe contains 6 data blocks, specifically including a parity block q (equivalent to the first parity block), a parity block p (equivalent to the second parity block), and 4 data blocks, distributed across the 6 disks. A single data packet contains a total of 36 data blocks. Because the parity block q is larger than the other data blocks, the data volume of a stripe is not evenly distributed across the 6 disks. However, within a single data packet, by appropriately distributing the data blocks, it is possible to ensure that each disk stores the same amount of data.

[0032] By following the steps described above, the number of data blocks in a data packet can be set based on the product of the stripe width and the number of disks. Then, the disk corresponding to each data block in the data packet is determined to generate a pre-distribution result of the data blocks. Finally, each data block is stored on its corresponding disk according to the pre-distribution result, ensuring that the data volume of the data packet is evenly distributed across multiple disks. This addresses the problem of improving disk storage performance in related technologies.

[0033] In one exemplary embodiment, determining the disk corresponding to each data block in a plurality of stripes, and generating a pre-distribution result of the data blocks of the data packet based on each data block and the disk corresponding to each data block, includes: obtaining the stripe number of the target stripe in the plurality of stripes, wherein the initial value of the stripe number is 0 and the increment is 1; determining the correspondence between the data blocks of the target stripe and the disks based on the stripe number of the target stripe and the number of disks; and determining the pre-distribution result based on the correspondence between the data blocks of the plurality of stripes and the disks.

[0034] Optionally, in the above embodiment, assuming that there are 6 disks in a RAID6 independent disk array, the stripe width is also 6. There are 36 data packets in a data packet, which corresponds to 6 stripes. The disk numbers are disk 0, disk 1... disk 5, and the stripe numbers are stripe 0, stripe 1... stripe 5.

[0035] In an exemplary embodiment, determining the correspondence between data blocks and disks of the target stripe based on the stripe number of the target stripe and the number of disks includes: obtaining the disk number of the target disk among the plurality of disks, wherein the initial value of the disk number is 0 and the increment is 1; performing a modulo operation on the number of disks based on the stripe number of the target stripe to obtain a first target value; calculating the difference between the disk number and the first target value to obtain a second target value; if the second target value is determined to be non-negative, determining the second target value as a third target value; or, if the second target value is determined to be negative, determining the sum of the second target value and the number of disks as the third target value; if the third target value is determined to be 0, determining the target disk as the disk corresponding to the first parity block in the target stripe; or, if the third target value is determined to be 1, determining the target disk as the disk corresponding to the second parity block in the target stripe; or, if the third target value is determined to be greater than 1, determining the target disk as the disk corresponding to the data block in the target stripe.

[0036] Optionally, in the above embodiments, when it is determined that the third target value is greater than 1, determining the target disk as the disk corresponding to the data block in the target stripe includes: when it is determined that the difference between the third target value and 1 is N, determining the target disk as the disk corresponding to the Nth data block in the target stripe, where N is a positive integer.

[0037] In an optional embodiment, such as Figure 3 As shown, the specific steps include:

[0038] Step S301: Enter the stripe number strideNumber, the disk number ComponentIndex, and the total number of disks ComponentCount;

[0039] Step S302: Calculate Rotation (equivalent to the first target value) = strideNumber % ComponentCount; Step S303: Calculate StripNum (equivalent to the second target value) = ComponentIndex - Rotation; Step S304: Determine the sign of StripNum. If it is negative, proceed to step S305; otherwise, proceed to step S306; Step S305: StripNum (equivalent to the third target value) = StripNum + Componentcount;

[0040] Step S306: Return the result StripNum.

[0041] Optionally, assume a RAID6 independent disk array has 6 disks, a stripe width of 6, and a data packet has 36 data blocks, i.e., 6 stripes. Each stripe includes a parity block q, a parity block p, data block 2, data block 3, data block 4, and data block 5. Different return results correspond to different data blocks: a return result of 0 corresponds to parity block p, a return result of 1 corresponds to parity block q, a return result of 2 corresponds to data block 2, a return result of 3 corresponds to data block 3, a return result of 4 corresponds to data block 4, and a return result of 5 corresponds to data block 5. If the input stripe number is 3 and the disk number is 2, and the calculated return result is 5, it means that stripe 3 stores data block 5 on disk 2. After calculating all data blocks of the 6 stripes in the data packet, the distribution results are shown in Table 1:

[0042] Table 1

[0043] Disk 0 Disk 1 Disk 2 Disk 3 Disk 4 Disk 5 Strip 0 p q 2 3 4 5 Strip 1 5 p q 2 3 4 Strip 2 4 5 p q 2 3 Strip 3 3 4 5 p q 2 Strip 4 2 3 4 5 p q Strip 5 q 2 3 4 5 p

[0044] Optionally, assume a RAID6 independent disk array has 5 disks, a stripe width of 5, and a data packet has 25 data blocks, i.e., 5 stripes. Each stripe includes a parity block q, a parity block p, data block 2, data block 3, and data block 4. Different return results correspond to different data blocks: a return result of 0 corresponds to parity block p, a return result of 1 corresponds to parity block q, a return result of 2 corresponds to data block 2, a return result of 3 corresponds to data block 3, and a return result of 4 corresponds to data block 4. If the input stripe number is 1 and the disk number is 2, and the calculated return result is 0, it means that stripe 1 stores parity block q on disk 2. After calculating all data blocks of the 5 stripes in the data packet, the distribution results are shown in Table 2:

[0045] Table 2

[0046] Disk 0 Disk 1 Disk 2 Disk 3 Disk 4 Strip 0 p q 2 3 4 Strip 1 4 p q 2 3 Strip 2 3 4 p q 2 Strip 3 2 3 4 p q Strip 4 q 2 3 4 p

[0047] Through the above embodiments, the distribution of data blocks in the data packet can be calculated efficiently, and then the data blocks can be stored according to the distribution results. This ensures that only one parity block q is distributed on each disk in a packet, achieving the effect of uniform storage. It avoids the bottleneck of the entire storage array due to insufficient storage space on one disk, thus maximizing storage utilization efficiency.

[0048] In an exemplary embodiment, determining the correspondence between data blocks and disks of the target stripe based on the stripe number of the target stripe and the number of disks further includes: determining a fourth target value based on the sum of the products of a first preset value and a target value, wherein the target product represents the product of a second preset value and the stripe number; if the fifth target value is determined to be non-negative, determining the disk with the disk number of the fifth target value among the plurality of disks as the disk corresponding to the first parity block in the target stripe, wherein the fifth target value represents the difference between the number of disks and the fourth target value; and determining the disk with the disk number of the sixth target value among the plurality of disks as the disk corresponding to the second parity block in the target stripe, wherein the sixth target value represents the difference between the fifth target value and the first preset value; and determining the disk with the disk number of neither the fifth target value nor the sixth target value among the plurality of disks as the disk corresponding to the data block in the target stripe.

[0049] In an optional embodiment, another method for calculating the correspondence between data blocks and disks in a target stripe is provided. In the above embodiment, for example, the first preset value is 1, and the second preset value is 2. Assume that there are 6 disks in a RAID6 independent disk array, and the stripe width is also 6. If the input stripe number is 1, the fifth target value is calculated as: disk number 6 * (first preset value 1 + stripe number 1 * second preset value 2) = 3. Then, disk 3 is identified as the disk corresponding to the first parity block q in stripe 1. Then, the sixth target value is calculated as: fifth target value 3 * first preset value 1 = 2. Disk 3 is identified as the disk corresponding to the second parity block p in stripe 1, and the other disks are identified as the disks corresponding to data blocks. Through the above steps, the data block distribution result of stripe 0*2 can be calculated. The distribution result is shown in Table 3.

[0050] Table 3

[0051] Disk 0 Disk 1 Disk 2 Disk 3 Disk 4 Disk 5 Strip 0 2 3 4 5 p q Strip 1 4 5 p q 2 3 Strip 2 p q 2 3 4 5 Strip 3 / / / / / / Strip 4 / / / / / / Strip 5 / / / / / /

[0052] Optionally, in the above embodiments, for example, the first preset value is 1, the second preset value is 2, and assuming that there are 5 disks in a RAID6 independent disk array, the stripe width is also 5. If the input stripe number is 1, the fifth target value is calculated as: disk number 65 * (first preset value 1 + stripe number 1 * second preset value 2) = 32. Then, disk 32 is determined as the disk corresponding to the first parity block q in stripe 1. Then, the sixth target value is calculated as: fifth target value 32 - first preset value 1 = 21. Disk 31 is determined as the disk corresponding to the second parity block p in stripe 1, and the other disks are determined as the disks corresponding to the data blocks.

[0053] It should be noted that there is a special case in the above calculation process: when the total number of stripes is odd and the input stripe number is the middle number of the total number of stripes. For example, if there are stripes 0-4 and the input stripe number is 2, the calculated fifth target value is 0. In this case, disk 0 is identified as the disk corresponding to the first parity block q in stripe 2. The calculated sixth target value is -1. It is necessary to calculate the sum of the number of disks and the sixth target value, i.e., 5 + (-1) = 4. Disk 4 is then identified as the disk corresponding to the second parity block p in stripe 2. Through the above steps, the data block distribution result of stripe 0-2 can be calculated. The distribution result is shown in Table 4.

[0054] Table 4

[0055] Disk 0 Disk 1 Disk 2 Disk 3 Disk 4 Strip 0 2 3 4 p q Strip 1 4 p q 2 3 Strip 2 q 2 3 4 p Strip 3 / / / / / Strip 4 / / / / /

[0056] In an exemplary embodiment, the method further includes: determining the parity of the number of disks when the fifth target value is determined to be negative; and determining the correspondence between the data blocks of the target stripe and the disks based on the fifth target value and the parity of the number of disks.

[0057] In one exemplary embodiment, determining the correspondence between data blocks and disks in the target stripe based on the parity of the fifth target value and the number of disks includes: when the number of disks is determined to be odd, determining the disk with the disk number of the seventh target value among the plurality of disks as the disk corresponding to the first parity block in the target stripe, wherein the seventh target value represents the sum of the number of disks and the fifth target value; and determining the disk with the disk number of the eighth target value among the plurality of disks as the disk corresponding to the second parity block in the target stripe, wherein the eighth target value represents the difference between the seventh target value and the first preset value; and determining the disk with the disk number that is not the seventh target value or the eighth target value among the plurality of disks as the disk corresponding to the data block in the target stripe.

[0058] Optionally, in the above embodiments, for example, the first preset value is 1, the second preset value is 2, assuming a RAID6 independent disk array has 5 disks and the stripe width is also 5. If the input stripe number is 3, the fifth target value is calculated as: disk number 5 - (first preset value 1 + stripe number 3 * second preset value 2) = -2, and the seventh target value is calculated as: disk number 5 + fifth target value (*2) = 3. Then, disk 3 is determined as the disk corresponding to the first parity block q in stripe 1. Then, the eighth target value is calculated as: seventh target value 3 * first preset value 1 = 2, and disk 2 is determined as the disk corresponding to the second parity block p in stripe 1. The other disks are determined as the disks corresponding to the data blocks. Through the above steps, the data block distribution result of stripe 3-4 can be calculated. Combining the calculation results in Table 4 of the above embodiments, the distribution result is shown in Table 5:

[0059] Table 5

[0060] Disk 0 Disk 1 Disk 2 Disk 3 Disk 4 Strip 0 2 3 4 p q Strip 1 4 p q 2 3 Strip 2 q 2 3 4 p Strip 3 3 4 p q 2 Strip 4 p q 2 3 4

[0061] In one exemplary embodiment, determining the correspondence between data blocks and disks in the target stripe based on the parity of the fifth target value and the number of disks further includes: when the number of disks is determined to be even, identifying the disk with the disk number of the ninth target value among the plurality of disks as the disk corresponding to the second parity block in the target stripe, wherein the ninth target value represents the sum of the number of disks and the fifth target value; and identifying the disk with the disk number of the tenth target value among the plurality of disks as the disk corresponding to the first parity block in the target stripe, wherein the tenth target value represents the difference between the ninth target value and the first preset value; and identifying the disk with the disk number that is not the ninth target value or the tenth target value among the plurality of disks as the disk corresponding to the data block in the target stripe.

[0062] Optionally, in the above embodiments, for example, the first preset value is 1, the second preset value is 2, assuming a RAID6 independent disk array has 6 disks and the stripe width is also 6. If the input stripe number is 5, the fifth target value is calculated as: disk number 6 - (first preset value 1 + stripe number 5 * second preset value 2) = *5, and the ninth target value is calculated as: disk number 6 + fifth target value (*5) = 1. Then, disk 2 is determined as the disk corresponding to the second parity block p in stripe 5. Then, the tenth target value is calculated as: ninth target value 1 * first preset value 1 = 0, and disk 0 is determined as the disk corresponding to the first parity block q in stripe 5. The other disks are determined as the disks corresponding to the data blocks. Through the above steps, the data block distribution results of stripes 3-5 can be calculated. Combining the calculation results in Table 3 of the above embodiments, the distribution results are shown in Table 6:

[0063] Table 6

[0064] Disk 0 Disk 1 Disk 2 Disk 3 Disk 4 Disk 5 Strip 0 2 3 4 5 p q Strip 1 4 5 p q 2 3 Strip 2 p q 2 3 4 5 Strip 3 2 3 4 5 q p Strip 4 4 5 q p 2 3 Strip 5 q p 2 3 4 5

[0065] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0066] This embodiment also provides a data storage device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the systems described in the following embodiments are preferably implemented in software, hardware implementations, or a combination of software and hardware, are also possible and contemplated.

[0067] Figure 4 This is a structural block diagram of a data storage device according to an embodiment of this application, such as... Figure 4 As shown, the device includes:

[0068] Setting module 42 is used to set the number of data blocks of a data packet according to the product of the stripe width and the number of disks, wherein the data blocks of the data packet come from different disks;

[0069] The generation module 44 is used to determine the disk corresponding to each data block in the data blocks of multiple stripes, and generate a pre-distribution result of the data blocks of the data packet based on each data block and the disk corresponding to each data block, wherein the total number of data blocks in the multiple stripes is equal to the number of data blocks of the data packet;

[0070] Storage module 46 is used to store each data block into the disk corresponding to each data block according to the pre-distribution result, so that the data volume of the data packet is evenly distributed among the multiple disks.

[0071] The aforementioned device allows for setting the number of data blocks in a data packet based on the product of the stripe width and the number of disks. It then determines the disk corresponding to each data block in the data packet to generate a pre-distribution result of the data packet's data blocks. Finally, each data block is stored on its corresponding disk according to the pre-distribution result, ensuring that the data volume of the data packet is evenly distributed across multiple disks. This addresses the problem of improving disk storage performance in related technologies.

[0072] In an exemplary embodiment, the generation module 44 is further configured to obtain the stripe number of the target stripe among the plurality of stripes, wherein the initial value of the stripe number is 0 and the increment is 1; determine the correspondence between the data blocks of the target stripe and the disks according to the stripe number of the target stripe and the number of disks; and determine the pre-distribution result according to the correspondence between the data blocks of the plurality of stripes and the disks.

[0073] In an exemplary embodiment, the generation module 44 is further configured to obtain the disk number of the target disk among the plurality of disks, wherein the initial value of the disk number is 0 and the increment is 1; perform a modulo operation on the number of disks according to the stripe number of the target stripe to obtain a first target value; calculate the difference between the disk number and the first target value to obtain a second target value; if the second target value is determined to be non-negative, determine the second target value as a third target value; or, if the second target value is determined to be negative, determine the sum of the second target value and the number of disks as the third target value; if the third target value is determined to be 0, determine the target disk as the disk corresponding to the first parity block in the target stripe; or, if the third target value is determined to be 1, determine the target disk as the disk corresponding to the second parity block in the target stripe; or, if the third target value is determined to be greater than 1, determine the target disk as the disk corresponding to the data block in the target stripe.

[0074] In an exemplary embodiment, the generation module 44 is further configured to: determine a fourth target value based on the sum of the products of a first preset value and a target value, wherein the target product represents the product of a second preset value and the stripe number; if the fifth target value is determined to be non-negative, determine the disk with the disk number of the fifth target value among the plurality of disks as the disk corresponding to the first check block in the target stripe, wherein the fifth target value represents the difference between the number of disks and the fourth target value; and determine the disk with the disk number of the sixth target value among the plurality of disks as the disk corresponding to the second check block in the target stripe, wherein the sixth target value represents the difference between the fifth target value and the first preset value; and determine the disk with the disk number of neither the fifth target value nor the sixth target value among the plurality of disks as the disk corresponding to the data block in the target stripe.

[0075] In an exemplary embodiment, the generation module 44 is further configured to determine the parity of the number of disks when the fifth target value is determined to be negative; and to determine the correspondence between the data blocks of the target stripe and the disks based on the fifth target value and the parity of the number of disks.

[0076] In one exemplary embodiment, the generation module 44 is further configured to, when determining that the number of disks is odd, identify the disk with a disk number of a seventh target value among the plurality of disks as the disk corresponding to the first check block in the target stripe, wherein the seventh target value represents the sum of the number of disks and the fifth target value; and to identify the disk with a disk number of an eighth target value among the plurality of disks as the disk corresponding to the second check block in the target stripe, wherein the eighth target value represents the difference between the seventh target value and the first preset value; and to identify the disk with a disk number that is not the seventh target value or the eighth target value among the plurality of disks as the disk corresponding to the data block in the target stripe.

[0077] In an exemplary embodiment, the generation module 44 is further configured to, when determining that the number of disks is even, identify the disk with the disk number of the ninth target value among the plurality of disks as the disk corresponding to the second check block in the target stripe, wherein the ninth target value represents the sum of the number of disks and the fifth target value; and to identify the disk with the disk number of the tenth target value among the plurality of disks as the disk corresponding to the first check block in the target stripe, wherein the tenth target value represents the difference between the ninth target value and the first preset value; and to identify the disk with the disk number that is not the ninth target value or the tenth target value among the plurality of disks as the disk corresponding to the data block in the target stripe.

[0078] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0079] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.

[0080] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:

[0081] S1, The number of data blocks in a data packet is set according to the product of the stripe width and the number of disks, wherein the data blocks in the data packet come from different disks;

[0082] S2, determine the disk corresponding to each data block in the data blocks of multiple stripes, and generate a pre-distribution result of the data blocks of the data packet based on each data block and the disk corresponding to each data block, wherein the total number of data blocks in the multiple stripes is equal to the number of data blocks of the data packet;

[0083] S3, based on the pre-distribution result, each data block is stored in the disk corresponding to each data block, so that the data volume of the data packet is evenly distributed among the multiple disks.

[0084] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0085] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0086] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0087] S1, The number of data blocks in a data packet is set according to the product of the stripe width and the number of disks, wherein the data blocks in the data packet come from different disks;

[0088] S2, determine the disk corresponding to each data block in the data blocks of multiple stripes, and generate a pre-distribution result of the data blocks of the data packet based on each data block and the disk corresponding to each data block, wherein the total number of data blocks in the multiple stripes is equal to the number of data blocks of the data packet;

[0089] S3, based on the pre-distribution result, each data block is stored in the disk corresponding to each data block, so that the data volume of the data packet is evenly distributed among the multiple disks.

[0090] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.

[0091] Optionally, in this embodiment, the computer program described above can be configured to perform the following steps:

[0092] S1, The number of data blocks in a data packet is set according to the product of the stripe width and the number of disks, wherein the data blocks in the data packet come from different disks;

[0093] S2, determine the disk corresponding to each data block in the data blocks of multiple stripes, and generate a pre-distribution result of the data blocks of the data packet based on each data block and the disk corresponding to each data block, wherein the total number of data blocks in the multiple stripes is equal to the number of data blocks of the data packet;

[0094] S3, based on the pre-distribution result, each data block is stored in the disk corresponding to each data block, so that the data volume of the data packet is evenly distributed among the multiple disks.

[0095] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0096] It is obvious to those skilled in the art that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be integrated on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0097] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A data storage method, characterized in that, An independent disk array for dual parity checking, the independent disk array comprising multiple disks for storing striped data blocks, the stripe width being set based on the number of disks in the independent disk array, the striped data blocks being stored on different disks, each striped data block comprising a first parity block, a second parity block, and multiple data blocks, wherein the data size of the first parity block is greater than the data size of the second parity block, and the data size of the second parity block is the same as the data size of each data block, the method comprising: The number of data blocks in a data packet is set according to the product of the stripe width and the number of disks, wherein the data blocks in the data packet come from different disks; The disk corresponding to each data block in multiple stripes is determined, and a pre-distribution result of the data blocks of the data packet is generated based on each data block and the disk corresponding to each data block, wherein the total number of data blocks in the multiple stripes is equal to the number of data blocks of the data packet; Based on the pre-distribution results, each data block is stored in the disk corresponding to each data block, so that the data volume of the data packet is evenly distributed across the multiple disks; The process of determining the disk corresponding to each data block in a plurality of stripes, and generating a pre-distribution result of the data blocks of the data packet based on each data block and the disk corresponding to each data block, includes: obtaining the stripe number of the target stripe in the plurality of stripes, wherein the initial value of the stripe number is 0 and the increment is 1; determining the correspondence between the data blocks of the target stripe and the disks based on the stripe number of the target stripe and the number of disks; and determining the pre-distribution result based on the correspondence between the data blocks of the plurality of stripes and the disks. The method of determining the correspondence between data blocks and disks in the target stripe based on the stripe number and the number of disks includes: obtaining the disk number of the target disk among the plurality of disks, wherein the initial value of the disk number is 0 and the increment is 1; performing a modulo operation on the number of disks based on the stripe number of the target stripe to obtain a first target value; calculating the difference between the disk number and the first target value to obtain a second target value; if the second target value is determined to be non-negative, determining the second target value as a third target value; or, if the second target value is determined to be negative, determining the sum of the second target value and the number of disks as the third target value; if the third target value is determined to be 0, determining the target disk as the disk corresponding to the first parity block in the target stripe; or, if the third target value is determined to be 1, determining the target disk as the disk corresponding to the second parity block in the target stripe; or, if the third target value is determined to be greater than 1, determining the target disk as the disk corresponding to the data block in the target stripe. Specifically, when the third target value is determined to be greater than 1, the target disk is determined to be the disk corresponding to the data block in the target stripe, which includes: when the difference between the third target value and 1 is determined to be N, the target disk is determined to be the disk corresponding to the Nth data block in the target stripe, where N is a positive integer.

2. The method according to claim 1, characterized in that, Determining the correspondence between data blocks of the target stripe and disks based on the stripe number of the target stripe and the number of disks also includes: The fourth target value is determined based on the sum of the product of the first preset value and the target value, wherein the target product represents the product of the second preset value and the strip number; If the fifth target value is determined to be non-negative, the disk with the disk number of the fifth target value among the plurality of disks is determined as the disk corresponding to the first parity block in the target stripe, wherein the fifth target value represents the difference between the number of disks and the fourth target value; And, the disk with the disk number of the sixth target value among the plurality of disks is determined as the disk corresponding to the second check block in the target stripe, wherein the sixth target value represents the difference between the fifth target value and the first preset value; And, the disks whose disk numbers are not the fifth target value and the sixth target value among the plurality of disks are determined as the disks corresponding to the data blocks in the target stripe.

3. The method according to claim 2, characterized in that, The method further includes: If the fifth target value is determined to be negative, the parity of the number of disks is determined. The correspondence between the data blocks of the target stripe and the disks is determined based on the parity of the fifth target value and the number of disks.

4. The method according to claim 3, characterized in that, Determining the correspondence between data blocks and disks of the target stripe based on the parity of the fifth target value and the number of disks includes: If the number of disks is determined to be odd, the disk with the disk number of the seventh target value among the plurality of disks is determined as the disk corresponding to the first parity block in the target stripe, wherein the seventh target value represents the sum of the number of disks and the fifth target value; And, the disk with the disk number of the eighth target value among the plurality of disks is determined as the disk corresponding to the second check block in the target stripe, wherein the eighth target value represents the difference between the seventh target value and the first preset value; And, the disks whose disk numbers are not the seventh target value and the eighth target value among the plurality of disks are determined as the disks corresponding to the data blocks in the target stripe.

5. The method according to claim 3, characterized in that, Determining the correspondence between data blocks and disks of the target stripe based on the parity of the fifth target value and the number of disks further includes: If the number of disks is determined to be even, the disk with the disk number of the ninth target value among the plurality of disks is determined as the disk corresponding to the second parity block in the target stripe, wherein the ninth target value represents the sum of the number of disks and the fifth target value; And, the disk with the disk number of the tenth target value among the plurality of disks is determined as the disk corresponding to the first check block in the target stripe, wherein the tenth target value represents the difference between the ninth target value and the first preset value; And, the disks whose disk numbers are not the ninth target value and the tenth target value among the plurality of disks are determined as the disks corresponding to the data blocks in the target stripe.

6. A data storage device, characterized in that, An independent disk array for dual parity checking, the independent disk array comprising multiple disks for storing striped data blocks, the stripe width being set based on the number of disks in the independent disk array, the striped data blocks being stored on different disks, each striped data block comprising a first parity block, a second parity block, and multiple data blocks, wherein the data size of the first parity block is greater than the data size of the second parity block, and the data size of the second parity block is the same as the data size of each data block, the apparatus comprising: The setting module is used to set the number of data blocks in a data packet according to the product of the stripe width and the number of disks, wherein the data blocks in the data packet come from different disks; The generation module is used to determine the disk corresponding to each data block in the data blocks of multiple stripes, and generate a pre-distribution result of the data blocks of the data packet based on each data block and the disk corresponding to each data block, wherein the total number of data blocks in the multiple stripes is equal to the number of data blocks of the data packet; The storage module is used to store each data block into the disk corresponding to each data block according to the pre-distribution result, so that the data volume of the data packet is evenly distributed among the multiple disks; The generation module is further configured to: obtain the stripe number of the target stripe among the plurality of stripes, wherein the initial value of the stripe number is 0 and the increment is 1; determine the correspondence between the data blocks of the target stripe and the disks according to the stripe number of the target stripe and the number of disks; and determine the pre-distribution result according to the correspondence between the data blocks of the plurality of stripes and the disks. The generation module is further configured to: obtain the disk number of the target disk among the plurality of disks, wherein the initial value of the disk number is 0 and the increment is 1; perform a modulo operation on the number of disks according to the stripe number of the target stripe to obtain a first target value; calculate the difference between the disk number and the first target value to obtain a second target value; if the second target value is determined to be non-negative, determine the second target value as a third target value; or, if the second target value is determined to be negative, determine the sum of the second target value and the number of disks as the third target value; if the third target value is determined to be 0, determine the target disk as the disk corresponding to the first parity block in the target stripe; or, if the third target value is determined to be 1, determine the target disk as the disk corresponding to the second parity block in the target stripe; or, if the third target value is determined to be greater than 1, determine the target disk as the disk corresponding to the data block in the target stripe. The generation module is further configured to: determine the target disk as the disk corresponding to the Nth data block in the target stripe when the difference between the third target value and 1 is N, where N is a positive integer.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 5.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 5.