Data storage method, computer program product, device and computer medium
By determining the number of data blocks and verification blocks in an independent disk redundant array, generating disk position values, and storing the verification blocks to different target disks, solving the excessive IO load caused by verification block storage in RAID Problem, improving data storage performance.
Patent Information
- Application Number
- CN202411149259.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-21
AI Technical Summary
In independent disk redundant arrays (RAIDs), the same type of verification blocks of different stripes are stored on the same disk, resulting in excessive IO load, affecting data storage performance.
By determining the number of data blocks and verification blocks, generating position offset values and product values, and calculating disk position values, the verification blocks are stored in different target disks, ensuring that the verification blocks of adjacent strips are stored in Avoid storing the same disk in adjacent disks.
It effectively avoids excessive IO load on the disk where the verification block is located, improves data storage performance, ensures that the verification blocks of adjacent stripes are stored in different disks, and reduces the load on a single disk.
Smart Images

Figure CN118656039B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and more specifically, to a data storage method, a computer program product, a device and a computer medium. Background Art
[0002] Redundant Array of Independent Disks (RAID) is a virtualization technology that combines multiple independent physical disks into a virtual disk group in different ways, thereby solving the shortcomings of small capacity, low performance, and poor reliability of a single disk. However, in the process of using redundant arrays of independent disks to store data, the same type of parity blocks of different stripes may be stored on the same disk, making the IO (Input / Output) load of the disk too high, affecting data storage performance.
[0003] In summary, how to avoid excessive IO load on the disk where the check block is located is a problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0004] The purpose of the present invention is to provide a data storage method, which can solve the technical problem of how to avoid excessive IO load of the disk where the check block is located to a certain extent. The present invention also provides a computer program product, an electronic device and a computer readable storage medium.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] In a first aspect, a data storage method is provided, comprising:
[0007] Determining a first quantity value of data blocks and a second quantity value of check blocks in a single stripe according to a redundant array of independent disks;
[0008] Determine the position offset value of the target stripe in the stripe group;
[0009] generating a product value of the position offset value and the second quantity value;
[0010] generating a difference between the first quantity value and the product value as a disk position value;
[0011] Set the disk corresponding to the disk position value as the target disk;
[0012] The check block of the target stripe is stored in the target disk.
[0013] On the other hand, determining the position offset value of the target stripe in the stripe group includes:
[0014] Determine a target stripe number of the target stripe;
[0015] Determine the sum of the first quantity value and the second quantity value as the total number of disks;
[0016] Taking the remainder value of the target stripe number and the total number of disks as the position offset value;
[0017] The stripe number of the stripe starts from 0 and increases by 1; the number of stripes in the stripe group is equal to the total number of disks.
[0018] On the other hand, the disk corresponding to the disk position value is used as the target disk, including:
[0019] Determine the number of each disk. The disk number starts from 0 and increases by 1.
[0020] Check if the disk position value is less than 0;
[0021] In response to the disk position value being greater than or equal to 0, the disk with the same number as the disk position value is used as the starting disk for storing the first check block in the target stripe, and the starting disk and the third number of disks thereafter are determined as the target disks, and the third number is 1 less than the second number.
[0022] On the other hand, after checking whether the disk position value is less than 0, it also includes:
[0023] In response to the disk position value being less than 0, the disk position value is updated by applying the total number of disks, and the process returns to the step of detecting whether the disk position value is less than 0.
[0024] On the other hand, applying the total number of disks to update the disk position value includes:
[0025] generating a first sum of the disk position value and the total number of disks;
[0026] The remainder value of the first sum value and the total number of disks is updated as the disk position value.
[0027] On the other hand, storing the check block of the target stripe into the target disk includes:
[0028] In response to the second quantity value being greater than 1, the check block of the target stripe is stored in the target disk according to a storage rule of two adjacent check codes of different types stored in the target disk in the same stripe group.
[0029] On the other hand, according to a storage rule of two adjacent check codes of different types stored in the target disk in the same stripe group, storing the check block of the target stripe in the target disk includes:
[0030] In response to the redundant array of independent disks being a disk structure of two types of stored parity codes, detecting whether the total number of disks is an even number;
[0031] In response to the total number of disks being an even number, counting the number of times the first sum of the disk position value and the total number of disks is generated;
[0032] Rotate the check block P and the check block Q for the specified number of times to obtain a rotation result;
[0033] The first check block in the rotation result is stored in the starting disk, and the second check block in the rotation result is stored in the first disk after the starting disk.
[0034] On the other hand, after detecting whether the total number of disks is an even number, the method further includes:
[0035] In response to the total number of disks being an odd number, the check block P of the target stripe is stored in the starting disk, and the check block Q of the target stripe is stored in the first disk after the starting disk.
[0036] On the other hand, according to a storage rule of two adjacent check codes of different types stored in the target disk in the same stripe group, storing the check block of the target stripe in the target disk includes:
[0037] In response to the redundant array of independent disks being a triple-check redundant array of independent disks, detecting whether the total number of disks is an odd number;
[0038] In response to the total number of disks being an odd number, counting the number of times the first sum of the disk position value and the total number of disks is generated;
[0039] Rotate the check block P, the check block Q and the check block R for the specified number of times to obtain a rotation result;
[0040] The first check block in the rotation result is stored in the starting disk, the second check block in the rotation result is stored in the first disk after the starting disk, and the third check block in the rotation result is stored in the second disk after the starting disk.
[0041] On the other hand, after detecting whether the total number of disks is an odd number, the method further includes:
[0042] In response to the total number of disks being an even number, the check block P of the target stripe is stored in the starting disk, the check block Q of the target stripe is stored in the first disk after the starting disk, and the check block R of the target stripe is stored in the second disk after the starting disk.
[0043] On the other hand, it also includes:
[0044] Set the disk after the highest numbered disk to the lowest numbered disk.
[0045] On the other hand, storing the check block of the target stripe into the target disk includes:
[0046] In response to the second quantity value being 1, the check block of the target stripe is stored in the target disk.
[0047] In a second aspect, a computer program product is provided, comprising a computer program / instruction, which, when executed by a processor, implements the steps of any of the data storage methods described above.
[0048] According to a third aspect, an electronic device is provided, including:
[0049] Memory for storing computer programs;
[0050] A processor is used to implement the steps of any of the above data storage methods when executing the computer program.
[0051] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any of the above data storage methods are implemented.
[0052] The invention provides a data storage method, which determines the first quantity value of data blocks and the second quantity value of check blocks in a single stripe according to an independent disk redundant array; determines the position offset value of the target stripe in the stripe group; generates the product value of the position offset value and the second quantity value; generates the difference between the first quantity value and the product value as the disk position value; uses the disk corresponding to the disk position value as the target disk; and stores the check block of the target stripe in the target disk. The invention has the beneficial effects of: determining the target disk according to the position offset value of the target stripe in the stripe group, the second quantity value of the check block and the first quantity value of the data block, and using the target disk to store the check block of the target stripe. Since all target stripes determine the target disk according to this operation, and the position offset values of two adjacent target stripes in the same stripe group differ by 1, the target disks of the two adjacent target stripes differ by the second quantity value. In this way, the check blocks of the two adjacent stripes will be stored in adjacent disks instead of in the same disk. That is, the invention can quickly and accurately store the check blocks of adjacent stripes in different disks, and can avoid the IO load of the disk where the check blocks are located being too high. A computer program product, electronic device and computer-readable storage medium provided by the present invention also solve corresponding technical problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0054] Figure 1 A flowchart of a data storage method provided by an embodiment of the present invention;
[0055] Figure 2 This is a schematic diagram of the relationship between stripes and disks;
[0056] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;
[0057] Figure 4 Another structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0059] See also Figure 1 , Figure 1 A flowchart of a data storage method provided by an embodiment of the present invention.
[0060] A data storage method provided by an embodiment of the present invention may include the following steps:
[0061] Step S101: determining a first quantity value of data blocks and a second quantity value of check blocks in a single stripe according to a redundant array of independent disks.
[0062] In actual applications, affected by the type of independent disk redundant array, the number of data blocks and check blocks in a single stripe is different, resulting in different subsequent data storage methods. Therefore, it is necessary to determine the first number value of data blocks and the second number value of check blocks in a single stripe according to the independent disk redundant array.
[0063] It should be noted that the total number of data blocks and check blocks is equal to the total number of disks, and the number of check blocks required by various types of independent disk redundant arrays is clear. For example, RAID5 requires 1 check block, RAID6 requires 2 check blocks, RAID-TP requires 3 check blocks, etc. Therefore, the second number value of the check blocks can be determined based on the independent disk redundant array. The first number value of the data blocks is the result of subtracting the second number value of the check blocks from the total number of disks.
[0064] It should also be noted that the stripe in the present invention is the result of disk striping. Striping is to divide host IO of any size into stripes of fixed length. The read and write of a host IO can be split into the read and write operations of one or more stripes. The relationship between stripes and disks can be as follows: Figure 2 As shown in the figure, each disk is divided into fixed-size strips. A strip is selected from each member disk of the array to form a stripe. The blocks in the stripe may be data blocks or check blocks. All stripes constitute the entire RAID array. When the host IO is sent to the RAID layer, the written stripe can be identified according to the LBA and Count of the host IO, and then the corresponding block is calculated according to the size of the block, LBA range and other information, and written to the disk. On this basis, since the number of stripes in the stripe group is equal to the number of disks, the relationship between stripes and stripe groups can be shown in Table 1, which only takes 5 disks as an example for explanation. The relationship between stripe groups and stripes under the remaining number of disks can be adjusted accordingly.
[0065] Table 1 Schematic diagram of stripes and stripe groups
[0066]
[0067] Step S102: Determine the position offset value of the target stripe in the stripe group.
[0068] Step S103: Generate a product value of the position offset value and the second quantity value.
[0069] Step S104: Generate a difference between the first quantity value and the product value as a disk position value.
[0070] Step S105: The disk corresponding to the disk position value is used as the target disk.
[0071] Step S106: storing the check block of the target stripe into the target disk.
[0072] In practical applications, after determining the first quantity value and the second quantity value, the target disk for storing the check blocks in the target stripe can be determined based on the first quantity value and the second quantity value according to the distribution rule of the check blocks of adjacent stripes in the same stripe group on different disks. In this process, since the positions of the stripes in the stripe group are different, the disk for storing the check blocks of the stripe can be determined according to the position of the stripe in the stripe group, that is, the position offset value of the target stripe in the stripe group can be determined, the product value of the position offset value and the second quantity value can be generated, the difference between the first quantity value and the product value can be generated as the disk position value, the disk corresponding to the disk position value can be used as the target disk, and finally the check blocks of the target stripe can be stored in the determined target disk.
[0073] It should be noted that, since the position offset values of adjacent stripes differ by 1, and the position offset value is used to multiply the second quantity value, the corresponding target disks of adjacent stripes differ by the second quantity value, which is exactly the quantity value of the check blocks. In this way, the target disks of adjacent stripes are just staggered, and the disk position is updated in the stripe according to the quantity value of the check blocks; and as the position offset value increases, the smaller the difference, the closer the target disk corresponding to the disk position value is to the front, that is, the target disks of adjacent stripes will move forward in sequence according to the quantity value of the check blocks. Taking RAID5 composed of 16 disks as an example, the storage result of the check blocks in a single stripe group is shown in Table 2. Taking RAID6 composed of 16 disks as an example, the storage result of the check blocks in a single stripe group is shown in Table 3.
[0074] Table 2 RAID5 storage diagram composed of 16 disks
[0075]
[0076] Table 3 RAID6 storage diagram composed of 16 disks
[0077]
[0078] In practical applications, in the process of determining the position offset value of the target stripe in the stripe group, the target stripe number of the target stripe can be determined; the sum of the first quantity value and the second quantity value is determined as the total number of disks; the remainder value of the target stripe number and the total number of disks is used as the position offset value; wherein the stripe number of the stripe starts from 0 and increases by 1; the number of stripes in the stripe group is equal to the total number of disks. In this way, only the stripes need to be numbered, and the remainder value of the stripe number and the number of stripes in the stripe group can be used as the position offset value, which can improve the efficiency of determining the position offset value. For ease of understanding, assuming that CompCnt represents the total number of disks, Rotation represents the disk position value, ParityCnt represents the second quantity value, and StrideNum represents the stripe number, then Rotation=(CompCnt-ParityCnt)-(PackOffset* ParityCnt), PackOffset represents the position offset value, and PackOffset=StrideNum%CompCnt.
[0079] In a specific application scenario, in the process of using the disk corresponding to the disk position value as the target disk, the disk position value can be used as the position difference between the first disk storing the check block and the first disk, and the target disk can be determined accordingly, that is, the number of each disk can be determined, and the disk number starts from 0 and increases by 1; since the disk number cannot be less than 0, it is necessary to detect whether the disk position value is less than 0; in response to the disk position value being greater than or equal to 0, the disk with the same number as the disk position value is used as the starting disk for storing the first check block in the target stripe, and the starting disk and the third number of disks thereafter are determined as the target disks, and the third number is 1 less than the second number. Correspondingly, in response to the disk position value being less than 0, the disk position value is updated by the total number of disks, and the step of detecting whether the disk position value is less than 0 is returned.
[0080] In a specific application scenario, when the total number of disks is used to update the disk position value, the first sum of the disk position value and the total number of disks can be generated; the remainder of the first sum and the total number of disks is updated as the disk position value. That is, Rotation = (Rotation + CompCnt) % CompCnt.
[0081] In actual applications, in the process of storing the check block of the target stripe into the target disk, in response to the second quantity value being greater than 1, the check block of the target stripe can be stored into the target disk according to the storage rule that the types of two adjacent check codes stored into the target disk in the same stripe group are different. In this way, on the basis that the check codes of two adjacent stripes are stored in different disks, it can also be ensured that the types of two consecutive check blocks written into the same disk are different. For example, if the disk stores the check block P of the previous stripe, it can only store the check block Q of the current stripe, and then it can only store the check block P of the next stripe, etc. In this way, when it is necessary to query the same type of check blocks of adjacent stripes, it can only be queried from different disks, which can avoid querying only a single disk, and then it can avoid the increase of the IO load of a single disk.
[0082] In a specific application scenario, in the process of storing the check blocks of the target stripe into the target disk according to the storage rule that the types of two adjacent check codes stored in the target disk in the same stripe group are different, the basic storage order of the check blocks can be set first, and then the number of times the first sum of the disk position value and the total number of disks is generated is counted; the basic storage order is rotated the number of times to obtain the rotation result; and the check blocks of the target stripe are stored into the target disk according to the rotation result. The basic storage order is rotated so that the types of two adjacent check codes stored in the target disk in the same stripe group are different.
[0083] In the process of rotating the basic storage order, the total number of disks and the number of check blocks will affect the rotation result, so the check blocks need to be stored comprehensively according to the total number of disks and the number of check blocks. For ease of understanding, assuming that the independent disk redundant array is a disk structure of two types of stored parity check codes, and the basic storage order is to store the check block P first and then store the check block Q, then it can be detected whether the total number of disks is an even number; in response to the total number of disks being an even number, the number of times the first sum of the disk position value and the total number of disks is generated is counted and executed; the check block P and the check block Q are rotated for the number of times to obtain the rotation result. Assuming that the number of times is 1, the rotation result is the check block Q and the check block P, and assuming that the number of times is 2, the rotation result is the check block P and the check block Q; the first check block in the rotation result is stored in the starting disk, and the second check block in the rotation result is stored in the first disk after the starting disk. Correspondingly, in response to the total number of disks being an odd number, the check block P of the target stripe can be stored in the starting disk, and the check block Q of the target stripe can be stored in the first disk after the starting disk.
[0084] Similarly, assuming that the independent disk redundant array is a three-check independent redundant disk array, and the basic storage order is check block P, check block Q and check block R, it can be detected whether the total number of disks is an odd number; in response to the total number of disks being an odd number, the number of times the disk position value and the first sum of the total number of disks are generated is statistically executed; the check block P, check block Q and check block R are rotated the number of times, and the rotation direction can be positive or reverse order to obtain a rotation result. Assuming that the number of times is 1, the rotation result can be check block R, check block P and check block Q; assuming that the number of times is 2, the rotation result can be check block Q, check block R and check block P; assuming that the number of times is 3, the rotation result can be check block P, check block Q and check block R; the first check block in the rotation result is stored in the starting disk, the second check block in the rotation result is stored in the first disk after the starting disk, and the third check block in the rotation result is stored in the second disk after the starting disk. Correspondingly, in response to the total number of disks being an even number, the check block P of the target stripe can be stored in the starting disk, the check block Q of the target stripe can be stored in the first disk after the starting disk, and the check block R of the target stripe can be stored in the second disk after the starting disk.
[0085] It should be noted that, when the independent disk redundant array is a three-check independent redundant disk array, the basic storage order is check block P, check block Q and check block R, and the total number of disks is an odd number, the number of times the first sum of the disk position value and the total number of disks is generated can also be counted; the first ratio of the number to 3 and the first remainder value are calculated; the first ratio is rounded down to obtain a first value, and it is detected whether the first value is an even number; if the first value is an odd number, the check block P, the check block Q and the check block R are rotated in positive order for the first remainder value times to obtain a rotation result; if the first value is an even number, the check block P, the check block Q and the check block R are rotated in reverse order for the first remainder value times to obtain a rotation result; the first check block in the rotation result is stored in the starting disk, the second check block in the rotation result is stored in the first disk after the starting disk, and the third check block in the rotation result is stored in the second disk after the starting disk.
[0086] From this implementation process, it can be seen that the present invention considers that the rotation result after three rotations is the same as the basic storage order and no rotation is required, so the first ratio and the first remainder value of the number of times and 3 are first calculated; and the first ratio is rounded down to obtain the first value. When the first value is an odd number, the check block P, the check block Q and the check block R are rotated in positive order for the first remainder value times. When the first value is an even number, the check block P, the check block Q and the check block R are rotated in reverse order for the first remainder value times. In this way, when the check blocks of different stripes are written to the same disk, the stripe check block will be processed by first rotating the stripe check block 3 times in reverse order and then rotating the stripe check block 3 times in reverse order. Finally, the check blocks stored in the same disk will be sorted in the order of P, R, Q, P, Q, R, which can further improve the randomness of storing adjacent stripe check blocks in the disk and further avoid the increase of IO load of a single disk.
[0087] In a specific application scenario, when the starting disk is close to the last disk, there may be no more disks after the starting disk. To avoid this situation, the disk after the highest numbered disk can be set as the lowest numbered disk to store the check blocks in a disk loop.
[0088] In a specific application scenario, in response to the second quantity value being 1, that is, when there is only one check block, the check block of the target stripe may be directly stored in the target disk.
[0089] The invention provides a data storage method, which determines the first quantity value of data blocks and the second quantity value of check blocks in a single stripe according to an independent disk redundant array; determines the position offset value of the target stripe in the stripe group; generates the product value of the position offset value and the second quantity value; generates the difference between the first quantity value and the product value; uses the disk corresponding to the disk position value as the target disk; and stores the check block of the target stripe in the target disk. The invention has the beneficial effects of: determining the target disk according to the position offset value of the target stripe in the stripe group, the second quantity value of the check block and the first quantity value of the data block, and using the target disk to store the check block of the target stripe. Since all target stripes determine the target disk according to this operation, and the position offset values of two adjacent target stripes in the same stripe group differ by 1, the target disks of the two adjacent target stripes differ by the second quantity value. In this way, the check blocks of the two adjacent stripes will be stored in adjacent disks instead of in the same disk. That is, the invention can quickly and accurately store the check blocks of adjacent stripes in different disks, and can avoid the IO load of the disk where the check blocks are located being too high.
[0090] Based on the above embodiments, the present invention further provides a data storage system, which may include:
[0091] A first determination module, configured to determine a first quantity value of data blocks and a second quantity value of check blocks in a single stripe according to a redundant array of independent disks;
[0092] A second determination module is used to determine a position offset value of a target stripe in the stripe group in which it is located;
[0093] A first generating module, used for generating a product value of a position offset value and a second quantity value;
[0094] A second generating module, used for generating a difference between the first quantity value and the product value as a disk position value;
[0095] A third determination module is used to use the disk corresponding to the disk position value as a target disk;
[0096] The first storage module is used to store the check block of the target stripe into the target disk.
[0097] For the description of the corresponding modules in the data storage system provided by the present invention, please refer to the above embodiments, which will not be repeated here.
[0098] The present invention also provides an electronic device and a computer-readable storage medium, both of which have the corresponding effects of the data storage method provided in the embodiment of the present invention. Figure 3 , Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0099] An electronic device provided by an embodiment of the present invention includes a memory 201 and a processor 202. The memory 201 stores a computer program. When the processor 202 executes the computer program, the steps of the data storage method described in any of the above embodiments are implemented.
[0100] See also Figure 4Another electronic device provided in an embodiment of the present invention may also include: an input port 203 connected to the processor 202, used to transmit commands input from the outside to the processor 202; a display unit 204 connected to the processor 202, used to display the processing results of the processor 202 to the outside; a communication module 205 connected to the processor 202, used to realize communication between the electronic device and the outside. The display unit 204 can be a display panel, a laser scanning display, etc.; the communication method adopted by the communication module 205 includes but is not limited to mobile high-definition link technology (Mobile High-Definition Link, MHL), Universal Serial Bus (Universal Serial Bus, USB), High-Definition Multimedia Interface (High-Definition Multimedia Interface, HDMI), wireless connection: wireless fidelity technology (WIreless Fidelity, WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, and communication technology based on IEEE802.11s.
[0101] An embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the data storage method described in any of the above embodiments are implemented.
[0102] The computer-readable storage medium involved in the present invention includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM (Compact Disc Read-Only Memory), or any other form of storage medium known in the technical field.
[0103] A computer program product provided by an embodiment of the present invention includes a computer program / instruction. When the computer program / instruction is executed by a processor, the following steps are implemented:
[0104] Determining a first quantity value of data blocks and a second quantity value of check blocks in a single stripe according to a redundant array of independent disks;
[0105] Determine the position offset value of the target stripe in the stripe group;
[0106] Generate a product value of the position offset value and the second quantity value;
[0107] generating a difference between the first quantity value and the product value as a disk position value;
[0108] Set the disk corresponding to the disk position value as the target disk;
[0109] Store the parity block of the target stripe on the target disk.
[0110] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, which implements the following steps when executed by a processor: determining a target stripe number of a target stripe; determining the sum of a first quantity value and a second quantity value as the total number of disks; using the remainder value of the target stripe number and the total number of disks as a position offset value; wherein the stripe number of the stripe starts from 0 and increases by 1; and the number value of stripes in a stripe group is equal to the total number of disks.
[0111] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, which implements the following steps when executed by a processor: determining the number of each disk, where the disk number starts from 0 and increases by 1; detecting whether the disk position value is less than 0; in response to the disk position value being greater than or equal to 0, using the disk with the same number as the disk position value as the starting disk for storing the first check block in the target stripe, and determining the starting disk and a third number of disks thereafter as target disks, where the third number is 1 less than the second number.
[0112] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, which implements the following steps when executed by a processor: after detecting whether the disk position value is less than 0, in response to the disk position value being less than 0, the disk position value is updated by applying the total number of disks, and the step of detecting whether the disk position value is less than 0 is returned.
[0113] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, which implements the following steps when executed by a processor: generating a first sum value of a disk position value and a total number of disks; and updating a remainder value of the first sum value and the total number of disks to a disk position value.
[0114] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, which implements the following steps when executed by a processor: in response to a second quantity value being greater than 1, storing the check block of the target stripe into the target disk according to the storage rule of two adjacent check code types of different types stored in the target disk in the same stripe group.
[0115] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, which implements the following steps when executed by a processor: in response to a disk structure in which an independent disk redundant array is two types of stored parity check codes, detecting whether the total number of disks is an even number; in response to the total number of disks being an even number, statistically executing a number of times to generate a first sum of a disk position value and the total number of disks; rotating a check block P and a check block Q a number of times to obtain a rotation result; storing a first check block in the rotation result in a starting disk, and storing a second check block in the rotation result in a first disk after the starting disk.
[0116] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, which implements the following steps when executed by a processor: after detecting whether the total number of disks is an even number, in response to the total number of disks being an odd number, storing the check block P of the target stripe into the starting disk, and storing the check block Q of the target stripe into the first disk after the starting disk.
[0117] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, which implements the following steps when executed by a processor: in response to an independent disk redundant array being a three-check independent redundant disk array, detecting whether the total number of disks is an odd number; in response to the total number of disks being an odd number, statistically executing a number of times to generate a first sum of a disk position value and the total number of disks; rotating a check block P, a check block Q, and a check block R a number of times to obtain a rotation result; storing a first check block in the rotation result into a starting disk, storing a second check block in the rotation result into a first disk after the starting disk, and storing a third check block in the rotation result into a second disk after the starting disk.
[0118] A computer program product provided by an embodiment of the present invention includes a computer program / instruction, which implements the following steps when executed by a processor: after detecting whether the total number of disks is an odd number, in response to the total number of disks being an even number, storing the check block P of the target stripe into a starting disk, storing the check block Q of the target stripe into a first disk after the starting disk, and storing the check block R of the target stripe into a second disk after the starting disk.
[0119] A computer program product provided by an embodiment of the present invention includes a computer program / instruction. When the computer program / instruction is executed by a processor, the following steps are implemented: setting the disk located after the largest numbered disk as the smallest numbered disk.
[0120] A computer program product provided by an embodiment of the present invention includes a computer program / instruction. When the computer program / instruction is executed by a processor, the following steps are implemented: in response to the second quantity value being 1, a check block of a target stripe is stored in a target disk.
[0121] For the description of the relevant parts of a data storage system, an electronic device, a computer-readable storage medium, and a computer program product provided by an embodiment of the present invention, please refer to the detailed description of the corresponding parts in a data storage method provided by an embodiment of the present invention, which will not be repeated here. In addition, the parts of the above technical solutions provided by the embodiments of the present invention that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.
[0122] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0123] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data storage method, It is characterized in that include: Determining a first quantity value of data blocks and a second quantity value of check blocks in a single stripe according to a redundant array of independent disks; Determine the position offset value of the target stripe in the stripe group; generating a product value of the position offset value and the second quantity value; generating a difference between the first quantity value and the product value as a disk position value; Set the disk corresponding to the disk position value as the target disk; storing the check block of the target stripe into the target disk; The position offset value includes a remainder value of the target stripe number of the target stripe and the total number of disks; The disk corresponding to the disk position value is used as the target disk, including: Determine the number of each disk. The disk number starts from 0 and increases by 1. Check if the disk position value is less than 0; In response to the disk position value being greater than or equal to 0, the disk with the same number as the disk position value is used as the starting disk for storing the first check block in the target stripe, and the starting disk and the third number of disks thereafter are determined as the target disks, and the third number is 1 less than the second number.
2. The data storage method according to claim 1, It is characterized in that Determine the position offset value of the target stripe in the stripe group, including: Determine a target stripe number of the target stripe; Determine the sum of the first quantity value and the second quantity value as the total number of disks; Taking the remainder value of the target stripe number and the total number of disks as the position offset value; The stripe number of the stripe starts from 0 and increases by 1; the number of stripes in the stripe group is equal to the total number of disks.
3. The data storage method according to claim 2, It is characterized in that After checking whether the disk position value is less than 0, it also includes: In response to the disk position value being less than 0, the disk position value is updated by applying the total number of disks, and the process returns to the step of detecting whether the disk position value is less than 0.
4. The data storage method according to claim 3, It is characterized in that Applying the total number of disks to update the disk location value includes: generating a first sum of the disk position value and the total number of disks; The remainder value of the first sum value and the total number of disks is updated as the disk position value.
5. The data storage method according to claim 4, It is characterized in that Storing the check block of the target stripe into the target disk includes: In response to the second quantity value being greater than 1, the check block of the target stripe is stored in the target disk according to a storage rule of two adjacent check codes of different types stored in the target disk in the same stripe group.
6. The data storage method according to claim 5, It is characterized in that According to a storage rule of two adjacent check codes of different types stored in the target disk in the same stripe group, storing the check block of the target stripe in the target disk comprises: In response to the redundant array of independent disks being a disk structure of two types of stored parity codes, detecting whether the total number of disks is an even number; In response to the total number of disks being an even number, counting the number of times the first sum of the disk position value and the total number of disks is generated; Rotate the check block P and the check block Q for the specified number of times to obtain a rotation result; The first check block in the rotation result is stored in the starting disk, and the second check block in the rotation result is stored in the first disk after the starting disk.
7. The data storage method according to claim 6, It is characterized in that After detecting whether the total number of disks is an even number, the method further includes: In response to the total number of disks being an odd number, the check block P of the target stripe is stored in the starting disk, and the check block Q of the target stripe is stored in the first disk after the starting disk.
8. The data storage method according to claim 5, It is characterized in that According to a storage rule of two adjacent check codes of different types stored in the target disk in the same stripe group, storing the check block of the target stripe in the target disk comprises: In response to the redundant array of independent disks being a triple-check redundant array of independent disks, detecting whether the total number of disks is an odd number; In response to the total number of disks being an odd number, counting the number of times the first sum of the disk position value and the total number of disks is generated; Rotate the check block P, the check block Q and the check block R for the specified number of times to obtain a rotation result; The first check block in the rotation result is stored in the starting disk, the second check block in the rotation result is stored in the first disk after the starting disk, and the third check block in the rotation result is stored in the second disk after the starting disk.
9. The data storage method according to claim 8, It is characterized in that After detecting whether the total number of disks is an odd number, the method further includes: In response to the total number of disks being an even number, the check block P of the target stripe is stored in the starting disk, the check block Q of the target stripe is stored in the first disk after the starting disk, and the check block R of the target stripe is stored in the second disk after the starting disk.
10. The data storage method according to any one of claims 6 to 9, It is characterized in that Also includes: Set the disk after the highest numbered disk to the lowest numbered disk.
11. The data storage method according to claim 4, It is characterized in that Storing the check block of the target stripe into the target disk includes: In response to the second quantity value being 1, the check block of the target stripe is stored in the target disk.
12. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the data storage method according to any one of claims 1 to 11 are implemented.
13. An electronic device, It is characterized in that include: Memory for storing computer programs; A processor, configured to implement the steps of the data storage method according to any one of claims 1 to 11 when executing the computer program.
14. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data storage method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Data updating method and device
CN110874181A
Data writing method and device capable of reducing pre-reading and storage medium
CN114217736A
Method and device for creating redundant array of independent disks, equipment and medium
CN116339644A
Method for degrading RAID6 (redundant array of independent disks 6) into RAID5 (redundant array of independent disks 5)
CN116450048A
Data processing method and device, electronic equipment and storage medium
CN117632856A
