Disk array data migration method, device, product, equipment and storage medium
Through the RAID level migration process, determine and process the data blocks to be read and write in the RAID level, reducing the number of times of reading and writing, and solving the problem of low reading and writing performance during the RAID level migration process in existing technologies. Improve the overall performance.
Patent Information
- Application Number
- CN202411273369.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-09-12
AI Technical Summary
During the RAID level migration process, the prior art requires reading the data of all disks in the RAID to the control card memory, resulting in low read and write performance.
By obtaining the stripe information of the disk array to be migrated and the target disk array, the data blocks to be read and written are determined, and the data is processed in the preset storage area to reduce the number of disk reads and disk writes.
Reduce the number of readings and dumeums during the data migration process, alleviate the read and write pressure of the disk array, and improve the read and write performance in the data migration process.
Smart Images

Figure CN118778911B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, product, equipment and storage medium for data migration of a disk array. Background Art
[0002] Redundant Array of Independent Disks (RAID) is a data storage virtualization technology that combines multiple disks to provide a single usable larger capacity logical disk that can provide concurrent input and output (I / O) read and write capabilities and data redundancy capabilities. Currently, commonly used RAID levels include RAID0, RAID1, RAID2, RAID3, RAID4, RAID5, and RAID6.
[0003] Different levels of RAID can be migrated. During the migration process, the layout of disk data will change, and the disks in the RAID need to be read and written to ensure the correctness and reliability of the data in the RAID after the migration. Currently, during the RAID level migration process, it is usually necessary to read all the data in the RAID by stripe, and rewrite all the data and the check disk data to the new RAID disk.
[0004] However, during the level migration process, generally only a small amount of data in the RAID changes. The current data migration method requires reading the data of all disks in the RAID into the controller card memory, and then writing the data of all disks in the RAID to the disk after the level migration after processing. The disk read and write speed is often the performance bottleneck of the RAID controller card, resulting in the current data migration method having the problem of low read and write performance. Summary of the invention
[0005] In order to overcome the problems existing in the related art, the present invention provides a data migration method, device, product, equipment and storage medium for a disk array.
[0006] In a first aspect, the present invention provides a method for data migration of a disk array, the method comprising:
[0007] Obtain a first disk number of a disk where a data block in a first target stripe of a disk array to be migrated is located, a first number of data blocks in the first target stripe, and a second number of check blocks in the first target stripe;
[0008] Acquire a third number of check disks in a second target stripe of a target disk array; the stripe numbers of the first target stripe and the second target stripe are the same;
[0009] Determine a data block to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and read the data block to be read into a preset storage area;
[0010] According to the first number, the second number, the third number and the first disk number, a data block to be written is determined from the data blocks in the preset storage area, and the data block to be written is written into the second target stripe.
[0011] Optionally, determining the to-be-read data blocks from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and reading the to-be-read data blocks into a preset storage area includes:
[0012] Determine, from the data blocks of the first target stripe, the data blocks to be read and the number of the data blocks to be read according to the first number, the second number, the third number and the first disk number;
[0013] Determine, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated, and a second disk number of the disk where the first data block to be read is located;
[0014] The data blocks to be read in the first target stripe are read into a preset storage area according to the number of the data blocks to be read, the first data block number and the second disk number.
[0015] Optionally, determining the to-be-read data blocks and the number of the to-be-read data blocks from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number includes:
[0016] In a case where the third number is greater than 0, all data blocks in the first target stripe are determined as data blocks to be read, and the first number is determined as the number of data blocks to be read;
[0017] When the third number is equal to 0 and the second number is greater than 0, obtaining the minimum value of the third disk number of the disk where the check block in the first target stripe is located;
[0018] Determine a data block in the first target stripe whose first disk number is greater than the minimum value of the third disk number as a data block to be read;
[0019] The difference between the first number and the minimum value of the third disk number is determined as the number of the data blocks to be read.
[0020] Optionally, determining, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated, and a second disk number of a disk where the first data block to be read is located, comprises:
[0021] When the second number is greater than 0 and the third number is equal to 0, obtaining a minimum value of the third disk numbers of the disks where the check blocks in the first target stripe are located, and determining the minimum value of the third disk numbers as the second disk number;
[0022] Obtaining a first length of a data block in the first target stripe;
[0023] calculating a first product between the minimum value of the third disk number and the first length;
[0024] Obtaining a second data block number of a first data block in the first target stripe in the disk array to be migrated;
[0025] A first sum of the first product and the second data block number is calculated, and the first sum is determined as a first data block number.
[0026] Optionally, determining, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated, and a second disk number of a disk where the first data block to be read is located, comprises:
[0027] When the third number is greater than 0, the second disk number is determined to be 0;
[0028] The second data block number of the first data block in the first target stripe in the disk array to be migrated is obtained, and the second data block number is determined as the first data block number.
[0029] Optionally, reading the to-be-read data blocks in the first target stripe into a preset storage area according to the number of the to-be-read data blocks, the first data block number, and the second disk number includes:
[0030] Reading a first to-be-read data block corresponding to the first data block number from an area corresponding to the first target stripe in the disk corresponding to the second disk number, and storing the first to-be-read data block in a preset storage area;
[0031] The second disk number is incremented by 1, and the number of reads is incremented by 1; wherein the starting value of the number of reads is 0;
[0032] When the number of reads is less than the number of data blocks to be read, obtaining a first length of the data blocks in the first target stripe;
[0033] Calculate a read offset according to the first data block number, the number of reads and the first length;
[0034] Reading the to-be-read data block indicated by the read offset from the area corresponding to the first target stripe in the disk corresponding to the second disk number, and storing the to-be-read data block indicated by the read offset in a preset storage area;
[0035] The second disk number is incremented by 1, and the number of reads is incremented by 1 until the number of reads is equal to the number of data blocks to be read, and the read operation is terminated.
[0036] Optionally, determining the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, and writing the data blocks to be written into the second target stripe includes:
[0037] Determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number;
[0038] Determine, according to the second number and the third number, a third data block number of the first data block to be written in the second target stripe in the target disk array, and a fourth disk number of the disk where the first data block to be written is located;
[0039] The data blocks to be written in the preset storage area are written into the second target stripe according to the number of the data blocks to be written, the third data block number and the fourth disk number.
[0040] Optionally, determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes:
[0041] When the second number is equal to 0 and the third number is greater than 0, obtaining a minimum value of the fifth disk number of the disk where the check block in the second target stripe is located;
[0042] Determine the data blocks in the preset storage area whose first disk number is greater than the minimum value of the fifth disk number as the data blocks to be written;
[0043] The difference between the first number and the minimum value of the fifth disk number is determined as the number of the data blocks to be written.
[0044] Optionally, determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes:
[0045] When the second number is greater than 0 and the third number is equal to 0, obtaining a minimum value of the third disk number of the disk where the check block in the first target stripe is located;
[0046] Determine the data blocks in the preset storage area whose first disk number is greater than the minimum value of the third disk number as the data blocks to be written;
[0047] The difference between the first number and the minimum value of the third disk number is determined as the number of the data blocks to be written.
[0048] Optionally, determining, according to the second number and the third number, a third data block number of a first data block to be written in the second target stripe in the target disk array and a fourth disk number of a disk where the first data block to be written is located includes:
[0049] When either the second number or the third number is equal to 0, obtaining a fourth data block number of a first data block in the second target stripe in the target disk array;
[0050] Obtaining a minimum value of the fifth disk number of the disk where the check block in the second target stripe is located, or a minimum value of the third disk number of the disk where the check block in the first target stripe is located;
[0051] Determine the minimum value of the fifth disk number or the minimum value of the third disk number as the fourth disk number of the disk where the first data block to be written is located;
[0052] Obtaining a first length of a data block in the first target stripe;
[0053] Calculate a second product between the minimum value of the fifth disk number or the minimum value of the third disk number and the first length;
[0054] A second sum value of the fourth data block number and the second product is calculated, and the second sum value is determined as the third data block number.
[0055] Optionally, determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes:
[0056] When the second number is equal to 1 and the third number is equal to 2, obtaining the third disk number of the disk where the first check block in the first target stripe is located;
[0057] Obtain the sixth disk number of the disk where the second check block in the second target stripe is located and the seventh disk number of the disk where the third check block is located;
[0058] In the case where the seventh disk number is 0, a data block in the preset storage area whose first disk number is smaller than the third disk number is determined as a data block to be written;
[0059] Determine the third disk number as the number of the data blocks to be written;
[0060] When the seventh disk number is not 0, determining the minimum value between the third disk number and the sixth disk number;
[0061] Determine the data blocks in the preset storage area whose first disk numbers are greater than the minimum value as the data blocks to be written;
[0062] The difference between the first number and the minimum value is determined as the number of the data blocks to be written.
[0063] Optionally, determining, according to the second number and the third number, a third data block number of a first data block to be written in the second target stripe in the target disk array and a fourth disk number of a disk where the first data block to be written is located includes:
[0064] Obtaining a fourth data block number of the first data block in the second target stripe in the target disk array;
[0065] When the seventh disk number is 0, the fourth disk number is determined to be 0, and the fourth data block number is determined to be the third data block number;
[0066] When the seventh disk number is not 0, the minimum value between the third disk number and the sixth disk number is determined as the fourth disk number;
[0067] Obtaining a first length of a data block in the first target stripe;
[0068] calculating a third product between the minimum value and the first length;
[0069] A third sum of the fourth data block number and the third product is calculated, and the third sum is determined as the third data block number.
[0070] Optionally, after writing the to-be-written data block into the second target stripe, the method further includes:
[0071] When the third number is greater than 0, a check block in the second target stripe is calculated according to the data blocks in the preset storage area and the third number, and the check block is written into the second target stripe.
[0072] In a second aspect, the present invention provides a data migration device for a disk array, the device comprising:
[0073] A first acquisition module, used to acquire a first disk number of a disk where a data block in a first target stripe of a disk array to be migrated is located, a first number of data blocks in the first target stripe, and a second number of check blocks in the first target stripe;
[0074] A second acquisition module is used to acquire a third number of check disks in a second target stripe of a target disk array; the stripe numbers of the first target stripe and the second target stripe are the same;
[0075] a reading module, configured to determine a data block to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and read the data block to be read into a preset storage area;
[0076] The first writing module is used to determine the data block to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, and write the data block to be written into the second target stripe.
[0077] In a third aspect, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the disk array data migration method described in any one of the first aspects above.
[0078] In a fourth aspect, the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the disk array data migration method described in any one of the first aspects above.
[0079] In a fifth aspect, the present invention provides a readable storage medium, which, when the instructions in the readable storage medium are executed by a processor of an electronic device, enables the electronic device to execute the steps in the data migration method of a disk array in any one of the embodiments of the first aspect above.
[0080] The method for data migration of a disk array provided by an embodiment of the present invention first obtains, during the process of data migration of the disk array, a first disk number of a disk where a data block in a first target stripe of the disk array to be migrated, a first number of data blocks in the first target stripe, a second number of check blocks in the first target stripe, and a third number of check disks in a second target stripe of the target disk array; then, based on the first number, the second number, the third number, and the first disk number, a data block to be read is determined from the data blocks of the first target stripe, and the data block to be read is read into a preset storage area; and, without affecting the accuracy of the stripe content written into the second target stripe, the data block that needs to be read in the first target stripe is determined as the data block to be read according to a specific application scenario, thereby reducing data migration. The number of disk reads during the process; accordingly, in the process of writing the disk, the data blocks to be written are determined from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number depending on the specific application scenario, and the data blocks in the preset storage area that need to be written to the second target stripe are determined as the data blocks to be written and written to the second target stripe, thereby reducing the number of disk writes during the data migration process; the embodiment of the present invention determines the data blocks to be read and the data blocks to be written according to the specific application scenario, and there is no need to read all the data in the first target stripe of the disk array to be migrated and write it to the second target stripe of the target disk array, thereby reducing the number of disk reads and writes during the data migration process, alleviating the read and write pressure of the disk array, and improving the read and write performance of the disk array during the data migration process. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] Figure 1 It is a flowchart of the steps of a method for data migration of a disk array provided by an embodiment of the present invention;
[0082] Figure 2 A disk array level migration diagram provided by an embodiment of the present invention Figure 1 ;
[0083] Figure 3 A disk array level migration diagram provided by an embodiment of the present invention Figure 2 ;
[0084] Figure 4 A disk array level migration diagram provided by an embodiment of the present invention Figure 3 ;
[0085] Figure 5 A disk array level migration diagram provided by an embodiment of the present invention Figure 4 ;
[0086] Figure 6 A disk array level migration diagram provided by an embodiment of the present invention Figure 5 ;
[0087] Figure 7 is a flowchart of the steps of another disk array data migration method provided by an embodiment of the present invention;
[0088] Figure 8 It is a logic block diagram of a data migration device for a disk array provided by an embodiment of the present invention;
[0089] Fig. 9 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0090] 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 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.
[0091] Method Embodiment
[0092] Reference Figure 1 , shows a flowchart of the steps of a method for data migration of a disk array provided by an embodiment of the present invention, the method may include:
[0093] Step S101: Obtain a first disk number of a disk where a data block in a first target stripe of a disk array to be migrated is located, a first number of data blocks in the first target stripe, and a second number of check blocks in the first target stripe.
[0094] Step S102: Obtain a third number of check disks in a second target stripe of a target disk array; the first target stripe and the second target stripe have the same stripe number.
[0095] Step S103: Determine the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and read the data blocks to be read into a preset storage area.
[0096] Step S104: Determine the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, and write the data blocks to be written into the second target stripe.
[0097] The disk array data migration method provided in the embodiment of the present invention can be applied to a disk array controller, a disk array management tool, a disk array management software, etc. The embodiment of the present invention is mainly described by taking the disk array controller as an example.
[0098] It should be noted that the application scenario of the disk array data migration method provided by the embodiment of the present invention is a scenario where the disk array needs to be migrated at a certain level.
[0099] Among them, the disk array to be migrated and the target disk array are both independent disk redundant arrays, and the level of the disk array to be migrated and the level of the target disk array are different; illustratively, the level of the disk array to be migrated is RAID0, and the level of the target disk array is RAID5; the level of the disk array to be migrated is RAID6, and the level of the target disk array is RAID0.
[0100] It can be understood that the process of level migration in a disk array is as follows: first, based on the existing disks in the disk array to be migrated, necessary disks are added or deleted as needed to obtain a disk group corresponding to the target disk array, and then the data blocks in the disk array to be migrated are laid out according to the layout of the data blocks in the target disk array, and in the case where the target disk array includes check blocks, the check blocks are written into the disk group according to the layout of the check blocks in the target disk array to obtain the target disk array. In other words, the target disk array is a disk array obtained by adding or deleting necessary disks based on the existing disks in the disk array to be migrated, and re-laying out the data blocks and check blocks.
[0101] However, in the related art, during the level migration process, it is usually necessary to read all the data in the RAID by stripe, and rewrite all the data and the check disk data to the new RAID disk; however, in actual application scenarios, generally only a small amount of data changes during the level migration process. The current data migration method needs to read the data of all the disks in the RAID, and then write the data of all the disks in the RAID to the disk after the level migration after processing. The disk read and write speed is often the performance bottleneck of the RAID controller, resulting in the current data migration method having the problem of low read and write performance.
[0102] To solve the above problems, the embodiment of the present invention implements data migration during disk-level migration through steps S101 to S105 on the principle of minimizing the number of disk reads and writes without affecting the accuracy of the stripe content written into the second target stripe.
[0103] In an embodiment of the present invention, when data migration is required, the disk array controller first obtains the first disk number of the disk where the data block in the first target stripe of the disk array to be migrated, the first number of data blocks in the first target stripe, and the second number of check blocks in the first target stripe through step S101, and obtains the third number of check disks in the second target stripe of the target disk array through step S102.
[0104] Among them, the stripe numbers of the first target stripe in the disk array to be migrated and the second target stripe in the target disk array are the same, that is, the data blocks in the first target stripe are the same as the data blocks in the second target stripe, but the numbers of the disks where the data blocks in the first target stripe are located and the numbers of the disks where the data blocks in the second target stripe are located may be different.
[0105] The first disk number is the disk number of the disk where the data block in the first target stripe is located, and the number of first disk numbers obtained by the disk array controller through step S101 is the same as the first number of data blocks in the first target stripe; the first number of data blocks in the first target stripe is the total number of data blocks in the first target stripe, and the first number is an integer greater than or equal to 1.
[0106] The second number of check blocks in the first target stripe is the total number of check blocks in the first target stripe, and the second number is an integer greater than or equal to 0; specifically, when the first target stripe does not include check blocks, the second number is 0; when the first target stripe includes check blocks, the second number is an integer greater than 0.
[0107] Exemplarily, when the level of the disk array to be migrated is RAID0, the second number is 0; when the level of the disk array to be migrated is RAID5, the second number is 1; when the level of the disk array to be migrated is RAID6, the second number is 2.
[0108] Correspondingly, the third number is the total number of check disks in the second target stripe, and the third number is an integer greater than or equal to 0; specifically, when the second target stripe does not include a check block, the third number is 0; when the second target stripe includes a check block, the third number is an integer greater than 0.
[0109] Exemplarily, when the level of the target disk array is RAID0, the third number is 0; when the level of the target disk array is RAID5, the third number is 1; when the level of the target disk array is RAID6, the third number is 2.
[0110] It should be noted that the first target stripe is any stripe in the disk array to be migrated, and the second target stripe is a stripe in the target disk array having the same stripe number as the first target stripe.
[0111] In the embodiment of the present invention, the disk array controller may first determine the level of the disk array to be migrated and the disks included in the array to be migrated during the process of executing step S101; and then determine the first disk number of the disk where the data block in the first target stripe is located, the first number of the data blocks in the first target stripe, and the second number of the check blocks in the first target stripe according to the level of the disk array to be migrated and the disks included in the array to be migrated.
[0112] In the embodiment of the present invention, the disk array controller may first determine the level of the target disk array during the process of executing step S102; and then determine the third number of check blocks in the second target stripe according to the level of the target disk array. It is understandable that, when the disk array controller determines the first target stripe through step S101, it may determine the second target stripe number that is the same as the stripe number of the first target stripe from the target disk array according to the stripe number of the first target stripe.
[0113] As an example, see Figure 2 , showing a disk array level migration schematic diagram provided by an embodiment of the present invention Figure 1 ;like Figure 2 As shown, Dx represents a data block in a disk array, and x is any integer from 1 to 20; P represents a P check block. The level of the disk array to be migrated is RAID0, the level of the target disk array is RAID5, and the disks in the disk array to be migrated include disk 0, disk 1, disk 2, and disk 3. The target disk array adds disk 4 on the basis of the disk array to be migrated. When the stripe number of the first target stripe is 1, the disk array controller can determine through step S101 that the data blocks in the first target stripe are D5, D6, D7, and D8, respectively, and the first disk numbers of the disks where the data blocks in the first target stripe are located are disk 0, disk 1, disk 2, and disk 3, respectively; the first number of data blocks in the first target stripe is 4, and the second number of check blocks in the first target stripe is 0. When the stripe number of the first target stripe is 1, the stripe number of the second target stripe is also 1, and the disk array controller can determine through step S102 that the second target stripe includes a P check block, and the third number of check blocks is 1.
[0114] In the embodiment of the present invention, when the disk array controller obtains the first disk number of the disk where the data blocks in the first target stripe are located, the first number of data blocks in the first target stripe, and the second number of check blocks in the first target stripe through step S101, and obtains the third number of check blocks in the second target stripe through step S102, it can determine the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number through step S103, and read the data blocks to be read into a preset storage area.
[0115] It can be understood that the data blocks to be read are part of the data blocks or all of the data blocks in the first target stripe.
[0116] Specifically, in a process where the disk array controller determines the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and reads the data blocks to be read into a preset storage area:
[0117] First, the disk array controller determines whether there is a check block in the second target stripe according to the third number; specifically, when the third number is equal to 0, it is determined that there is no check block in the second target stripe; when the third number is greater than 0, it is determined that there is a check block in the second target stripe.
[0118] Then, if there is a check block in the second target stripe, it indicates that the check block in the second target stripe needs to be calculated based on all the data blocks in the first target stripe, and the disk array controller needs to read all the data blocks in the first target stripe in order to calculate the check block in the second target stripe. In this scenario, the disk array controller determines all the data blocks in the first target stripe as the data blocks to be read. Figure 2 When the level of the disk array to be migrated is RAID0 and the level of the target disk array is RAID5, since the second target stripe includes a P check block, the disk array controller needs to determine all data blocks in the first target stripe in the disk array to be migrated as data blocks to be read.
[0119] When there is no check block in the second target stripe, it indicates that there is no need to calculate the check block in the second target stripe. In this scenario, in order to reduce the number of disk reads, the disk array controller can determine which data blocks in the first target stripe will change on the disk where they are located after the data migration based on the first number, the second number and the first disk number, and determine the data blocks in the first target stripe whose disks will change after the data migration as the data blocks to be read, so that the disk array controller reads the data blocks to be read into the preset storage area and then writes the data blocks in the preset storage area to the corresponding positions in the second target stripe.
[0120] The process in which the disk array controller determines which data blocks in the first target stripe will change the storage disk after migrating to the second target stripe based on the first number, the second number and the first disk number is specifically as follows: first, when the second number is greater than 0, further obtain the third disk number of the disk where the check block in the first target stripe is located; then, based on the third disk number and the first disk number, determine which data blocks in the first target stripe will change the disk where they are located after data migration.
[0121] As an example, see Figure 3 , showing a disk array level migration schematic diagram provided by an embodiment of the present invention Figure 2 ; The level of the disk array to be migrated is RAID5, and the level of the target disk array is RAID0. When the stripe number of the first target stripe and the second target stripe is 2, the first disk numbers obtained by the disk array controller through step S101 are disk 0, disk 1, disk 3 and disk 4, the first quantity is 4, and the second quantity is 1; the third quantity obtained by the disk array controller through step S102 is 0. In the process of executing step S103, the disk array controller can determine that there is no check block in the second target stripe according to the third quantity, and the second quantity is greater than 0, then the third disk number of the disk (disk 2) where the check block in the first target stripe is located is obtained as "2"; in the process of determining which data blocks in the first target stripe will change their disks after data migration according to the third disk number and the first disk number, such as Figure 3 As shown, the data blocks whose first disk numbers are greater than the third disk numbers in the first target stripe will change their disk locations after being migrated to the second target stripe. Therefore, the disk array controller can determine the data blocks (D11 and D12) whose first disk numbers are greater than the third disk numbers in the first target stripe as the data blocks to be read.
[0122] It should be noted that, when the third number is equal to 0 and the second number is equal to 0, it indicates that neither the disk array to be migrated nor the target disk array includes a check block. In this scenario, the disk array controller can read the data blocks in the first target stripe to a preset storage area in a data block reading method known to those skilled in the art, and this embodiment of the present invention will not be elaborated on this.
[0123] Finally, when the data blocks to be read are determined from the data blocks of the first target stripe, the disk array controller can obtain the disk number of the disk where each data block to be read in the first target stripe is located, and according to the disk number of the disk where the data block to be read is located, the data blocks to be read in the first target stripe are read in sequence in ascending order of the disk numbers and stored in a preset storage area; wherein, in the preset storage area, each data block is arranged in sequence in a reading order, so that the disk array controller can write the data blocks to be written into the second target stripe in sequence in the reading order in step S104.
[0124] As an optional implementation, in the process of reading the data blocks to be read into the preset storage area, the disk array controller can also use concurrent reading or out-of-order reading to read the data blocks to be read in the first target stripe into the preset storage area according to the disk number of the disk where the data blocks to be read are located, and arrange the read data blocks in the preset storage area in ascending order according to the disk number.
[0125] The preset storage area may be an on-chip cache of a disk array controller.
[0126] In an embodiment of the present invention, after the disk array controller reads the data blocks to be read into the preset storage area through step S103, it can continue to determine the data blocks to be written from the data blocks in the preset storage area according to the first quantity, the second quantity, the third quantity and the first disk number through step S104, and write the data blocks to be written into the second target stripe, thereby realizing the migration of the data blocks from the first target stripe to the second target stripe.
[0127] It can be understood that the data blocks in the preset storage area are the data blocks to be read from the first target stripe; the data blocks to be written are part of the data blocks or all of the data blocks in the preset storage area.
[0128] Specifically, in the process that the disk array controller determines the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, and writes the data blocks to be written into the second target stripe:
[0129] First, the disk array controller determines whether there is a check block in the second target stripe according to the third number.
[0130] Then, when there is a check block in the second target stripe, it indicates that the data blocks in the preset storage area are all the data blocks in the first target stripe. In order to reduce the number of disk writes, the disk array controller can determine which data blocks in the first target stripe will change on the disk where they are located after data migration, and determine the data blocks in the preset storage area that will change on the disk where they are located after data migration as the data blocks to be written.
[0131] Among them, the disk array controller determines which data blocks in the first target stripe will change the disk where they are located after the data migration, specifically: the disk array to be migrated and the target disk array are compared, and by comparing the layout of the data blocks in the disk array to be migrated and the layout of the data blocks in the target disk array, the disk array controller can determine which data blocks in the first target stripe will change the disk where they are located after the data migration.
[0132] When there is no check block in the target stripe, it indicates that the data blocks in the preset storage area are data blocks in the first target stripe that will change on the disk where they are located after data migration. In this scenario, the disk array controller can directly determine all data blocks in the preset storage area as data blocks to be written.
[0133] Finally, when the data blocks to be written are determined from the data blocks in the preset storage area, the disk array controller can first obtain the disk numbers corresponding to the data blocks to be written in the second target stripe, and write the data blocks to be written in the preset storage area to the second target stripe in sequence according to the disk numbers corresponding to the data blocks to be written in the second target stripe.
[0134] In the embodiment of the present invention, Figure 2 It can be seen that in the disk array level migration scenario, after the data blocks of the disk array to be migrated are migrated to the target disk array, only the disks where some data blocks are located have changed, and the disks where the remaining data blocks are located have not changed; among them, the data blocks that have changed are: D8, D11, D12, D14, D15, D16, D17, D18, D19, D20; the data blocks that have not changed are: D1, D2, D3, D4, D5, D6, D7, D9, D10, D13; but due to the target disk array, the disks where the target disk array is located have not changed. There is a P check block in the target disk array, and the P check block needs to be calculated based on all the data blocks in the first target stripe. Therefore, in the process of reading the disk, all the data blocks in the first target stripe need to be read into the preset storage area; in the process of writing the disk, after the data blocks of the disk array to be migrated are migrated to the target disk array, only the disks where some of the data blocks are located have changed, so the unchanged data blocks D1, D2, D3, D4, D5, D6, D7, D9, D10, and D13 do not need to repeat the disk writing operation. The data migration method of the disk array provided by the embodiment of the present invention determines the data blocks to be read and the data blocks to be written according to the specific application scenario, and does not need to read all the data in the first target stripe of the disk array to be migrated and write it to the second target stripe of the target disk array, which reduces the number of disk reading and writing in the data migration process, alleviates the read and write pressure of the disk array, and improves the read and write performance of the disk array in the data migration process.
[0135] Optionally, the step S103 of determining the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and reading the data blocks to be read into a preset storage area includes:
[0136] Step S1031 : Determine the data blocks to be read and the number of the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number.
[0137] Step S1032: Determine, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated, and a second disk number of the disk where the first data block to be read is located.
[0138] Step S1033: Read the data blocks to be read in the first target stripe into a preset storage area according to the number of the data blocks to be read, the first data block number and the second disk number.
[0139] In the embodiment of the present invention, in the process of determining the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and reading the data blocks to be read into the preset storage area, the disk array controller can first determine the data blocks to be read and the number of the data blocks to be read through step S1031, and determine the first data block number of the first data block to be read in the first target stripe in the disk array to be migrated and the second disk number of the disk where the first data block to be read in the disk array to be migrated through step S1032; then read the data blocks to be read in the first target stripe into the preset storage area according to the number of data blocks to be read, the first data block number and the second disk number. It can be understood that step S1031 and step S1032 can be executed in parallel or in sequence, and the embodiment of the present invention does not limit this.
[0140] Among them, the method of determining the data blocks to be read from the data blocks of the first target stripe according to the first quantity, the second quantity, the third quantity and the first disk number in step S1031 can be the same as the method described in the above step S103. When the data blocks to be read are determined from the first target stripe, the disk array controller can determine the number of data blocks to be read based on the data blocks to be read.
[0141] It can be understood that the data blocks in the first target stripe are the same as the data blocks in the second target stripe, and the arrangement order between the data blocks in the first target stripe is also the same as the arrangement order between the data blocks in the second target stripe. Figure 2, when the stripe with stripe number 2 is the first target stripe and the second target stripe, the data blocks in the first target stripe include D9, D10, D11 and D12, and the data blocks in the second target stripe also include D9, D10, D11 and D12, and in the first target stripe and the second target stripe, the data blocks are stored in different disks in the order of D9, D10, D11 and D12.
[0142] In the preset storage area, the data blocks to be written are stored in the order of the disk numbers of the data blocks to be written in the first target stripe; therefore, in the embodiment of the present invention, the disk array controller can determine the position information of the first data block to be read in the first target stripe in the disk array to be migrated through step S1032, and then determine the position of the first data block to be read in the first target stripe from the disk array to be migrated based on the position information of the first data block to be read in the first target stripe in the disk array to be migrated through step S1033, and start from the position of the first data block to be read, read the data blocks to be read in the first target stripe in sequence until the number of data blocks to be read that have been read is equal to the number of data blocks to be read determined in step S1031, indicating that all the data blocks to be read in the first target stripe have been read to the preset storage area, and the disk array controller can end the reading operation.
[0143] The position information of the first data block to be read in the first target stripe in the disk array to be migrated includes: the first data block number of the first data block to be read in the first target stripe in the disk array to be migrated and the second disk number of the disk where the first data block to be read is located.
[0144] It should be noted that the first data block number is the data block number of the first data block to be read in the entire disk array to be migrated; Figure 2 In the case where the stripe with stripe number 2 is the first target stripe and the second target stripe, since there is a check block in the target disk array, all data blocks in the first target stripe need to be determined as data blocks to be read. Therefore, the first data block of the first data block to be read (D9) is numbered "9".
[0145] The second disk number is the disk number of the disk where the first data block to be read is located in the disk array to be migrated; Figure 2 In the case where the stripe with stripe number 2 is the first target stripe and the second target stripe, since there is a check block in the target disk array, all data blocks in the first target stripe need to be determined as data blocks to be read. Therefore, the second disk number of the disk (disk 0) where the first data block to be read (D9) is located in the disk array to be migrated is disk "0".
[0146] It can be understood that the first data block number and the second disk number of the first data block to be read are related to the layout structure of the disk array to be migrated. When the layout structure of the disk array to be migrated is determined, the first data block number and the second disk number of the first data block to be read are also determined.
[0147] In an embodiment of the present invention, the disk array controller reads the data blocks to be read in the first target stripe into a preset storage area according to the number of data blocks to be read, the first data block number and the second disk number, specifically: first, according to the second disk number, determine the disk where the first data block to be read is located; then, according to the first data block number, find the first data block to be read from the disk corresponding to the second disk number, and read the first data block to be read into the preset storage area; then, increase the second disk number by 1, increase the first data block number by 1, and read the data block to be read corresponding to the first data block number increased by 1 from the disk corresponding to the second disk number increased by 1 into the preset storage area; when the number of the read data blocks to be read is equal to the number of the data blocks to be read determined in step S1031, it indicates that all the data blocks to be read in the first target stripe have been read into the preset storage area, and the disk array controller can end the reading operation.
[0148] It should be noted that, in the case where there is a check block in the first target stripe, when the disk array controller reads the data blocks to be read in the first target stripe into the preset storage area starting from the first data block to be read, if the disk corresponding to the second disk number increased by 1 is the disk storing the check block in the first target stripe, the disk array controller automatically skips the disk and increases the second disk number by 1 again until the disk corresponding to the second disk number increased by 1 is the disk storing the data block to be read corresponding to the first data block number increased by 1, and continues to perform the above reading operation.
[0149] According to the data migration method of a disk array provided by an embodiment of the present invention, in the process of reading the to-be-read data blocks in the first target stripe into the preset storage area, the disk array controller can quickly determine the position of the first to-be-read data block in the disk array to be migrated according to the first data block number of the first to-be-read data block and the second disk number of the first to-be-read data block, and based on the sequence between the data blocks in the first target stripe and the second target stripe and the number of the to-be-read data blocks, the to-be-read data blocks in the first target stripe are read sequentially into the preset storage area starting from the first to-be-read data block, thereby ensuring that the disk array controller accurately reads the to-be-read data blocks in the first target stripe into the preset storage area and also improving the efficiency of reading the to-be-read data blocks into the preset storage area.
[0150] Optionally, the step S1031 of determining the data blocks to be read and the number of the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number includes:
[0151] Step A11: when the third number is greater than 0, all data blocks in the first target stripe are determined as data blocks to be read, and the first number is determined as the number of data blocks to be read.
[0152] Step A12: When the third number is equal to 0 and the second number is greater than 0, obtain the minimum value of the third disk number of the disk where the check block in the first target stripe is located.
[0153] Step A13: Determine the data blocks in the first target stripe whose first disk number is greater than the minimum value of the third disk number as the data blocks to be read.
[0154] Step A14: determine the difference between the first number and the minimum value of the third disk number as the number of the data blocks to be read.
[0155] In the embodiment of the present invention, in the process of determining the data blocks to be read and the number of the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, the disk array controller:
[0156] When the third number is greater than 0, it indicates that there are check blocks in the second target stripe, and the check blocks in the second target stripe need to be calculated based on all the data blocks in the first target stripe. The disk array controller needs to read all the data blocks in the first target stripe in order to calculate the check blocks in the second target stripe. In this scenario, the disk array controller can determine all the data blocks in the first target stripe as data blocks to be read through step A11, and determine the first number as the number of data blocks to be read.
[0157] Specifically, when the third number is greater than 0, the disk array controller may determine the number of data blocks to be read by the following formula:
[0158] range_1=data_disk_num(1)
[0159] Among them, range_1 represents the number of data blocks to be read; data_disk_num represents the first number.
[0160] When the third number is equal to 0 and the second number is greater than 0, it indicates that there is no check block in the second target stripe, and there is no need to calculate the check block in the second target stripe. In this scenario, in order to reduce the number of disk reads, the disk array controller can determine the data blocks that will change on the disk where the data is located after the data migration in the first target stripe as the data blocks to be read through steps A12 to A14.
[0161] Specifically, when the third number is equal to 0 and the second number is greater than 0, the disk array controller first obtains the minimum value of the third disk number of the disk where the check block is located in the first target stripe; then determines the data block whose first disk number is greater than the minimum value of the third disk number in the first target stripe as the data block to be read, and determines the difference between the first number and the minimum value of the third disk number as the number of data blocks to be read.
[0162] Specifically, when the third number is equal to 0 and the second number is greater than 0, the disk array controller may determine the number of data blocks to be read by the following formula:
[0163] range_1=data_disk_num-min(pd_index_1)(2)
[0164] Among them, min(pd_index_1) represents the minimum value of the third disk number.
[0165] For example, refer to Figure 3 , when the level of the disk array to be migrated is RAID5, the level of the target disk array is RAID0, and the stripe number of the first target stripe and the second target stripe is 2, the disk array controller can determine that the third number of check blocks in the second target stripe is equal to 0, and the second number of check blocks in the first target stripe is 1, and it is necessary to perform steps A12 to A14 to determine the data blocks to be read and the number of data blocks to be read. Specifically, the third disk number of the disk (disk 2) where the check block in the first target stripe is located obtained by the disk array controller through step A12 is "2", and because there is only one check block in the first target stripe, the disk array controller defaults to "2" as the minimum value of the third disk number; the disk array controller can determine the data blocks (D11 and D12) in the first target stripe whose first disk number is greater than the minimum value "2" of the third disk number as the data blocks to be read through step A13, and the number of data blocks to be read is equal to the difference (2) between the first number (4) of data blocks in the first target stripe and the minimum value (2) of the third disk number.
[0166] Reference Figure 4 , showing a disk array level migration schematic diagram provided by an embodiment of the present invention Figure 3 ;like Figure 4As shown, the level of the disk array to be migrated is RAID6, the level of the target disk array is RAID0, and when the stripe numbers of the first target stripe and the second target stripe are 3, the disk array controller can determine that the third number of check blocks in the second target stripe is equal to 0, and the second number of check blocks in the first target stripe is 2 (P check blocks and Q check blocks, respectively), and steps A12 to A14 need to be executed to determine the data blocks to be read and the number of data blocks to be read. Specifically, the disk array controller obtains through step A12 that the third disk number of the disk where the P check block is located in the first target stripe is "2", and the third disk number of the disk where the Q check block is located is "3", so the disk array controller determines "2" as the minimum value of the third disk number; through step A13, the disk array controller can determine the data blocks (D14 and D15) in the first target stripe whose first disk number is greater than the minimum value "2" of the third disk number as the data blocks to be read, and the number of the data blocks to be read is equal to the difference (2) between the first number (4) of the data blocks in the first target stripe and the minimum value (2) of the third disk number as the number of the data blocks to be read.
[0167] In the data migration method for a disk array provided by an embodiment of the present invention, a disk array controller determines the data blocks to be read and the number of the data blocks to be read from the data blocks of the first target stripe according to the values of the second number and the third number and the first disk number, and under the premise of not affecting the accuracy of the stripe content written into the second target stripe, the data blocks that need to be read in the first target stripe are determined as the data blocks to be read according to the specific application scenario, thereby reducing the number of disk reads during the data migration process, alleviating the disk read pressure of the disk array, and improving the read performance of the disk array during the data migration process.
[0168] Optionally, the step S1032 of determining, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated and a second disk number of a disk where the first data block to be read is located includes:
[0169] Step A21: When the second number is greater than 0 and the third number is equal to 0, obtain the minimum value of the third disk number of the disk where the check block in the first target stripe is located, and determine the minimum value of the third disk number as the second disk number.
[0170] Step A22: Obtain a first length of a data block in the first target stripe.
[0171] Step A23, calculate the first product between the minimum value of the third disk number and the first length.
[0172] Step A24: Obtain the second data block number of the first data block in the first target stripe in the disk array to be migrated.
[0173] Step A25, calculate a first sum of the first product and the second data block number, and determine the first sum as the first data block number.
[0174] In an embodiment of the present invention, when the disk array controller determines the first data block number of the first data block to be read in the first target stripe in the disk array to be migrated and the second disk number of the disk where the first data block to be read is located based on the second number and the third number, if the second number is greater than 0 and the third number is equal to 0, it indicates that there is a check block in the first target stripe and there is no check block in the second target stripe. In this scenario, the disk array controller can determine the second disk number of the disk where the first data block to be read is located through step A21, and determine the first data block number of the first data block to be read in the disk array to be migrated through steps A22 to A25.
[0175] It should be noted that the scenarios where the second number is greater than 0 and the third number is equal to 0 may include: the level of the disk array to be migrated is RAID5, and the level of the target migration array is RAID0; the level of the disk array to be migrated is RAID6, and the level of the target migration array is RAID0.
[0176] Among them, the first length is the length of a single data block in the first target stripe. In other words, the first length is the total number of sub-data blocks stored in a single disk in the first target stripe, and the sub-data blocks stored in a single disk constitute the data blocks stored in the disk; for example, the first length can be 1, 16, 36, 64, etc.
[0177] In the embodiment of the present invention, when the second number is greater than 0 and the third number is equal to 0, the disk array controller can determine the second disk number and the first data block number by the following formula:
[0178] dd_index_1=min(pd_index_1)(3)
[0179] slba_1=raid_slba_1+min(pd_index_1) ×chunk_size(4)
[0180] Among them, dd_index_1 represents the second disk number; slba_1 represents the first data block number; raid_slba_1 represents the second data block number; chunk_size represents the first length.
[0181] As an example, see Figure 3, when the level of the disk array to be migrated is RAID5, the level of the target disk array is RAID0, and the stripe number of the first target stripe and the second target stripe is 2, the disk array controller can determine that the second number of check blocks in the first target stripe is 1 and the third number of check blocks in the second target stripe is equal to 0, and steps A21 to A25 need to be executed to determine the first data block number and the second disk number of the first data block to be read. Specifically, the third disk number of the disk where the check block in the first target stripe is located obtained by the disk array controller through step A21 is "2", and because there is only one check block in the first target stripe, the disk array controller determines "2" as the minimum value of the third disk number by default, and determines the second disk number of the disk where the first data block to be read is located as "2"; the first length obtained by the disk array controller through step A22 is 1, and the first product calculated by the disk array controller through step A23 is 2×1=2; the second data block number of the first data block (D9) in the first target stripe obtained by the disk array controller through step A24 in the disk array to be migrated is "9", and the first sum value calculated by the disk array controller through step A25 is 2+9=11; in summary, the disk array controller can determine the second disk number as "2" and the first data block number as "11", that is, the first data block to be read is "D11", and the disk where the first data block to be read is located is "disk 2". It can be understood that, in the case where the check block is stored in the disk corresponding to the second disk number, the disk array controller will automatically skip the disk "disk 2" corresponding to the second disk number and read the first data block "D11" to be read from the disk "disk 3" corresponding to the second disk number + 1 when reading the data blocks to be read in the first target stripe to the preset storage area according to the number of data blocks to be read, the first data block number and the second disk number.
[0182] As another example, refer to Figure 4, when the level of the disk array to be migrated is RAID6, the level of the target disk array is RAID0, and the stripe numbers of the first target stripe and the second target stripe are 3, the disk array controller can determine that the second number of check blocks in the first target stripe is 2 and the third number of check blocks in the second target stripe is equal to 0, and steps A21 to A25 need to be executed to determine the first data block number and the second disk number of the first data block to be read. Specifically, the disk array controller obtains through step A21 that the third disk number of the disk where the P check block is located in the first target stripe is "2", and the third disk number of the disk where the Q check block is located is "3", so the disk array controller determines "2" as the minimum value of the third disk number, and determines the second disk number of the disk where the first data block to be read is located as "2"; the first length obtained by the disk array controller through step A22 is 1, and the first product calculated by the disk array controller through step A23 is 2×1=2; the disk array controller obtains through step A24 that the second data block number of the first data block (D12) in the first target stripe in the disk array to be migrated is "12", and the first sum value calculated by the disk array controller through step A25 is 2+12=14; in summary, the disk array controller can determine the second disk number as "2", and determine the first data block number as "14", that is, the first data block to be read is "D14", and the disk where the first data block to be read is located is "disk 2". It can be understood that, in the case where the disk corresponding to the second disk number stores the check blocks, the disk array controller will automatically skip the disk "Disk 2" corresponding to the second disk number and the check blocks corresponding to "Disk 3" when reading the data blocks to be read in the first target stripe to the preset storage area according to the number of data blocks to be read, the first data block number and the second disk number, and read the first data block "D14" to be read from the disk "Disk 4" corresponding to the second disk number + 2.
[0183] Optionally, the step S1032 of determining, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated and a second disk number of a disk where the first data block to be read is located includes:
[0184] Step A31: when the third number is greater than 0, the second disk number is determined to be 0.
[0185] Step A32: Obtain a second data block number of the first data block in the first target stripe in the disk array to be migrated, and determine the second data block number as the first data block number.
[0186] In an embodiment of the present invention, when the disk array controller determines the first data block number of the first data block to be read in the first target stripe in the disk array to be migrated and the second disk number of the disk where the first data block to be read is located according to the second number and the third number, if the third number is greater than 0, it indicates that there is a check block in the second target stripe. In this scenario, it is necessary to calculate the check block in the second target stripe based on all the data blocks in the first target stripe. The disk array controller needs to read all the data blocks in the first target stripe in order to calculate the check block in the second target stripe. The data blocks in the first target stripe are all data blocks to be read. Therefore, in step A31, the disk array controller can determine the second disk number as 0, and determine the second data block number of the first data block in the first target stripe in the disk array to be migrated as the first data block number, so that the disk array controller can determine to start reading from the first data block in the first target stripe according to the second disk number and the first data block number during the execution of S1033.
[0187] Among them, the scenarios in which the third number is greater than 0 may include: the level of the disk array to be migrated is RAID0, and the level of the target migration array is RAID5; the level of the disk array to be migrated is RAID0, and the level of the target migration array is RAID6; the level of the disk array to be migrated is RAID6, and the level of the target migration array is RAID5; the level of the disk array to be migrated is RAID5, and the level of the target migration array is RAID6.
[0188] Specifically, when the third number is greater than 0, the disk array controller may determine the second disk number and the first data block number by using the following formula:
[0189] dd_index_1 = 0 (5)
[0190] slba_1 = raid_slba_1 (6)
[0191] As an example, see Figure 2, when the level of the disk array to be migrated is RAID0, the level of the target disk array is RAID5, and the stripe number of the first target stripe and the second target stripe is 2, the disk array controller can determine that the second number of check blocks in the first target stripe is 0 and the third number of check blocks in the second target stripe is equal to 1, and it is necessary to perform steps A31 to A32 to determine the first data block number and the second disk number of the first data block to be read. Specifically, the disk array controller determines the second disk number as "0" through step A31; the disk array controller obtains the second data block (D9) in the first target stripe through step A32, and the second data block number in the disk array to be migrated is "9", then the disk array controller can determine the second data block number "9" as the first data block number; in summary, the disk array controller can determine the second disk number as "0", and the first data block number as "9", that is, the first data block to be read is "D9", and the disk where the first data block to be read is located is "disk 0". It can be understood that, in the case where the check block is stored in the disk corresponding to the second disk number, the disk array controller will read the first data block "D9" to be read from the disk "disk 0" corresponding to the second disk number when reading the data blocks to be read in the first target stripe to the preset storage area based on the number of data blocks to be read, the first data block number and the second disk number.
[0192] As another example, refer to Figure 5 , showing a disk array level migration schematic diagram provided by an embodiment of the present invention Figure 4 ;like Figure 5As shown, the level of the disk array to be migrated is RAID5, and the level of the target disk array is RAID6. When the stripe number of the first target stripe and the second target stripe is 3, the disk array controller can determine that the second number of check blocks in the first target stripe is 1 and the third number of check blocks in the second target stripe is equal to 2, and it is necessary to perform steps A31 to A32 to determine the first data block number and the second disk number of the first data block to be read. Specifically, the disk array controller determines the second disk number as "0" through step A31; the disk array controller obtains the second data block number of the first data block (D12) in the first target stripe through step A32, and the second data block number in the disk array to be migrated is "12", then the disk array controller can determine the second data block number "12" as the first data block number; in summary, the disk array controller can determine the second disk number as "0", and the first data block number as "12", that is, the first data block to be read is "D12", and the disk where the first data block to be read is located is "disk 0". It can be understood that, in the case where the check block is stored in the disk corresponding to the second disk number, the disk array controller will read the first data block "D12" to be read from the disk "disk 0" corresponding to the second disk number when reading the data blocks to be read in the first target stripe to the preset storage area based on the number of data blocks to be read, the first data block number and the second disk number.
[0193] The data migration method of the disk array provided in the embodiment of the present invention provides different methods of determining the first data block number and the second disk number of the first target stripe for the scenario where the second number is greater than 0 and the third number is equal to 0 and the scenario where the third number is greater than 0, respectively, covering a variety of application scenarios and improving the feasibility of the embodiment of the present invention.
[0194] Optionally, the step S1033 of reading the to-be-read data blocks in the first target stripe into a preset storage area according to the number of the to-be-read data blocks, the first data block number, and the second disk number includes:
[0195] Step A41: read the first to-be-read data block corresponding to the first data block number from the area corresponding to the first target stripe in the disk corresponding to the second disk number, and store the first to-be-read data block in a preset storage area.
[0196] Step A42, increase the second disk number by 1, and increase the number of reads by 1; wherein the starting value of the number of reads is 0.
[0197] Step A43: When the number of read times is less than the number of data blocks to be read, obtain a first length of the data blocks in the first target stripe.
[0198] Step A44, calculating a read offset according to the first data block number, the number of reads and the first length.
[0199] Step A45: read the data block to be read indicated by the read offset from the area corresponding to the first target stripe in the disk corresponding to the second disk number, and store the data block to be read indicated by the read offset in a preset storage area.
[0200] Step A46, increase the second disk number by 1, and increase the number of reads by 1, until the number of reads is equal to the number of data blocks to be read, and then end the reading operation.
[0201] In an embodiment of the present invention, in the process of reading the data blocks to be read in the first target stripe into the preset storage area according to the number of data blocks to be read, the first data block number and the second disk number, if the disk corresponding to the second disk number stores data blocks, the disk array controller reads the first data block to be read corresponding to the first data block number from the area corresponding to the first target stripe in the disk corresponding to the second disk number, and stores the first data block to be read into the preset storage area; then, the disk array controller adds 1 to the second disk number and adds 1 to the number of reads. It can be understood that, when the starting value of the number of reads is 0, after the disk array controller stores the first data block to be read into the preset storage area through step A41, it adds 1 to the starting value 0 to obtain the current number of reads as 1; then, before executing step A43, the disk array controller can first determine whether the current number of reads is equal to the number of data blocks to be read, and when the number of reads is less than the number of data blocks to be read, execute steps A43 to A45; when the number of reads is equal to the number of data blocks to be read, execute step A46.
[0202] It should be noted that in step A43, the number of reads is the updated number of reads obtained by adding 1 to the number of reads by the disk array controller in step A42.
[0203] In step A44, the number of reads is the updated number of reads obtained by adding 1 to the number of reads in step A42. The disk array controller calculates the read offset according to the first data block number, the number of reads, and the first length, specifically: first, calculate the fourth product between the number of reads and the first length; then, calculate the sum of the first data block number and the fourth product; finally, determine the sum of the first data block number and the fourth product as the read offset.
[0204] In step A45, the second disk number is the updated second disk number obtained after the disk array controller adds 1 to the second disk number in step A42. Specifically, in step A45, the disk array controller may read the data block to be read indicated by the offset from the area corresponding to the first target stripe in the disk corresponding to the second disk number, and store the data block to be read indicated by the read offset in a preset storage area.
[0205] After storing the data blocks to be read indicated by the read offset into the preset storage area through step A45, the disk array controller can again increase the second disk number by 1 and increase the number of reads by 1 until the number of reads is equal to the number of data blocks to be read, indicating that the number of data blocks to be read that have been read is equal to the total number of data blocks to be read. At this time, the disk array controller can end the reading operation.
[0206] In the data migration method of a disk array provided by an embodiment of the present invention, a disk array controller reads the data blocks to be read in a first target stripe into a preset storage area according to the number of data blocks to be read, a first data block number and a second disk number. While ensuring that the disk array controller accurately reads the data blocks to be read in the first target stripe into the preset storage area, the efficiency of reading the data blocks to be read into the preset storage area is also improved.
[0207] Optionally, after determining, according to the second number and the third number, the first data block number of the first data block to be read in the first target stripe in the disk array to be migrated and the second disk number of the disk where the first data block to be read is located in step S1032, the method further includes:
[0208] Step B11: When the second number is greater than 0 and the third number is equal to 0, obtain the minimum value of the third disk number of the disk where the check block in the first target stripe is located, and the first length of the data block in the first target stripe.
[0209] Step B12, calculating a first difference between the first number and the minimum value of the third disk number.
[0210] Step B13: Calculate the fifth product between the first difference and the first length, and determine the fifth product as the total length of the data blocks to be read in the first target stripe.
[0211] Step B14: When the third number is greater than 0, obtain the first length of the data block in the first target stripe.
[0212] Step B15: Calculate the sixth product between the first number and the first length, and determine the sixth product as the total length of the data blocks to be read in the first target stripe.
[0213] Step B16: Read the data blocks to be read in the first target stripe into a preset storage area according to the total length of the data blocks to be read in the first target stripe, the first data block number and the second disk number.
[0214] In the embodiment of the present invention, after the disk array controller determines the data blocks to be read and the number of data blocks to be read through step S1031, and determines the first data block number and the second disk number of the first data block to be read through step S1032, it can also determine the total length of the data blocks to be read in the first target stripe through steps B11 to B13 when the second number is greater than 0 and the third number is equal to 0, or determine the total length of the data blocks to be read in the first target stripe through steps B14 to B15 when the third number is greater than 0, and then read the data blocks to be read in the first target stripe into a preset storage area according to the total length of the data blocks to be read in the first target stripe, the first data block number, and the second disk number.
[0215] The total length of the data blocks to be read in the first target stripe is the sum of the data block lengths of the data blocks to be read in the first target stripe. Figure 3 , when the stripe numbers of the first target stripe and the second target stripe are 2, the total length of the data blocks to be read in the first target stripe is the sum of the data block length of D11 and the data block length of D12.
[0216] Specifically, when the second number is greater than 0 and the third number is equal to 0, the disk array controller may determine the total length of the data blocks to be read in the first target stripe by using the following formula:
[0217] nlb_1=[data_disk_num- min(pd_index_1)]×chunk_size (7)
[0218] Wherein, nlb_1 represents the total length of the data blocks to be read in the first target stripe.
[0219] When the third number is greater than 0, the disk array controller may determine the total length of the data blocks to be read in the first target stripe by using the following formula:
[0220] nlb_1=data_disk_num×chunk_size(8)
[0221] In the embodiment of the present invention, after obtaining the total length of the data blocks to be read in the first target stripe, the disk array controller reads the data blocks to be read in the first target stripe into a preset storage area according to the total length of the data blocks to be read in the first target stripe, the first data block number, and the second disk number, specifically:
[0222] First, the disk array controller reads the first to-be-read data block corresponding to the first data block number from the area corresponding to the first target stripe in the disk corresponding to the second disk number, and stores the first to-be-read data block in a preset storage area.
[0223] Then, the disk array controller increases the second disk number by 1, and increases the number of reads by 1; wherein the starting value of the number of reads is 0.
[0224] Then, the disk array controller calculates the product of the number of reads and the first length of the data block in the first target stripe, and determines the product of the number of reads and the first length of the data block in the first target stripe as the length of the read data block.
[0225] Then, when the length of the read data block is less than the total length of the data blocks to be read, the disk array controller calculates the read offset according to the first data block number, the number of reads and the first length of the data blocks in the first target stripe.
[0226] Then, the disk array controller reads the to-be-read data block indicated by the read offset from the area corresponding to the first target stripe in the disk corresponding to the second disk number, and stores the to-be-read data block indicated by the read offset in a preset storage area.
[0227] Then, the disk array controller increases the second disk number by 1 and increases the number of reads by 1.
[0228] Finally, the disk array controller calculates the product of the number of reads and the first length of the data block in the first target stripe, and determines the product of the number of reads and the first length of the data block in the first target stripe as the length of the read data block, until the number of reads is equal to the total length of the data block to be read, and ends the reading operation.
[0229] In the data migration method for a disk array provided by an embodiment of the present invention, the disk array controller can also read the data blocks to be read in the first target stripe to a preset storage area according to the total length of the data blocks to be read in the first target stripe, the first data block number and the second disk number, thereby improving the flexibility of the implementation method of the data migration method for the disk array and expanding the application scope of the embodiment of the present invention.
[0230] Optionally, the step S104 of determining the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, and writing the data blocks to be written into the second target stripe includes:
[0231] Step S1041: Determine the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number.
[0232] Step S1042: Determine, according to the second number and the third number, a third data block number of the first data block to be written in the second target stripe in the target disk array, and a fourth disk number of the disk where the first data block to be written is located.
[0233] Step S1043: write the data blocks to be written in the preset storage area into the second target stripe according to the number of the data blocks to be written, the third data block number and the fourth disk number.
[0234] In the embodiment of the present invention, in the process of determining the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, and writing the data blocks to be written into the second target stripe, the disk array controller can first determine the data blocks to be written and the number of the data blocks to be written through step S1041, and determine the third data block number of the first data block to be written in the second target stripe in the target disk array and the fourth disk number of the disk where the first data block to be written in the target disk array is located through step S1042; finally, according to the number of data blocks to be written, the third data block number and the fourth disk number, the data blocks to be written in the preset storage area are written into the second target stripe through step S1043. It can be understood that step S1041 and step S1042 can be executed in parallel or in sequence, and the embodiment of the present invention does not limit this.
[0235] Among them, step S1041 determines the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, which can be the same as the method described in the above step S104. When determining the data blocks to be written from the data blocks in the preset storage area, the disk array controller can determine the number of data blocks to be written based on the data blocks to be written.
[0236] It can be understood that the data blocks in the first target stripe are the same as the data blocks in the second target stripe, and the arrangement order between the data blocks in the first target stripe is also the same as the arrangement order between the data blocks in the second target stripe. Figure 2, when the stripe with stripe number 2 is the first target stripe and the second target stripe, the data blocks in the first target stripe include D9, D10, D11 and D12, and the data blocks in the second target stripe also include D9, D10, D11 and D12, and in the first target stripe and the second target stripe, the data blocks are stored in different disks in the order of D9, D10, D11 and D12.
[0237] In the preset storage area, the data blocks to be written are stored in the order of the disk numbers of the data blocks to be written in the first target stripe, and the order is the same as the storage order of the data blocks to be written in the second target stripe; therefore, in the embodiment of the present invention, the disk array controller can determine the position information of the first data block to be written in the second target stripe in the target disk array through step S1042, and then determine the position of the first data block to be written in the second target stripe from the target disk array based on the position information of the first data block to be written in the second target stripe in the target disk array through step S1043, and starting from the position of the first data block to be written, write the data blocks to be written in the preset storage area to the second target stripe in sequence according to the storage order of the data blocks to be written in the preset storage area, until the number of data blocks to be written that have been written is equal to the number of data blocks to be written determined in step S1041, indicating that all the data blocks to be written in the preset storage area have been written to the second target stripe, and the disk array controller can end the write operation.
[0238] The location information of the first data block to be written in the second target stripe in the target disk array includes: the third data block number of the first data block to be written in the second target stripe in the target disk array and the fourth disk number of the disk where the first data block to be written is located in the target disk array.
[0239] It should be noted that the third data block number is the data block number of the first data block to be written in the entire target disk array; Figure 2 In the case where the stripe with stripe number 2 is the first target stripe and the second target stripe, since there is a check block in the target disk array, it indicates that the data blocks in the preset storage area are all the data blocks (D9, D10, D11 and D12) in the first target stripe. In order to reduce the number of disk writes, the disk array controller can determine which data blocks in the first target stripe will change the disk where they are located after data migration according to the first number, the second number, the third number and the first disk number, and determine the data blocks (D11 and D12) in the preset storage area where they are located will change after data migration as the data blocks to be written. The third data block number of the first data block to be written (D11) in the second target stripe in the target disk array is "11".
[0240] The fourth disk number is the disk number of the disk where the first data block to be written is located in the target disk array; refer to Figure 2 , when the stripe with stripe number 2 is the first target stripe and the second target stripe, since there is a check block in the target disk array, it indicates that the data blocks in the preset storage area are all the data blocks (D9, D10, D11 and D12) in the first target stripe. In order to reduce the number of disk writes, the disk array controller can determine which data blocks in the first target stripe will change the disk where they are located after data migration according to the first number, the second number, the third number and the first disk number, and determine the data blocks (D11 and D12) in the preset storage area where they are located after data migration as the data blocks to be written. The fourth disk number of the disk (disk 3) where the first data block to be written (D11) in the second target stripe is located in the target disk array is "3".
[0241] It can be understood that the third data block number and the fourth disk number of the first data block to be written are related to the layout structure of the target disk array. When the layout structure of the target disk array is determined, the third data block number and the fourth disk number of the first data block to be written are also determined.
[0242] In an embodiment of the present invention, the disk array controller writes the data blocks to be written in the preset storage area into the second target stripe according to the number of data blocks to be written, the third data block number and the fourth disk number, specifically: first, according to the fourth disk number, determine the disk where the first data block to be written is located; then, according to the third data block number, find the position of the first data block to be written from the disk corresponding to the fourth disk number, and write the first data block to be written from the preset storage area to the position of the first data block to be written, overwriting the original data block in the position; then, add 1 to the fourth disk number, and add 1 to the third data block number. Add 1, and in the position of the data block to be written corresponding to the third data block number added by 1 in the disk corresponding to the fourth disk number after adding 1, write the next data block to be written that is arranged after the first data block to be written and adjacent to the first data block to be written in the preset storage area to the position of the data block to be written corresponding to the third data block number added by 1, overwriting the original data block in the position; when the number of written data blocks to be written is equal to the number of data blocks to be written determined in step S1041, it indicates that all the data blocks to be written in the preset storage area have been written to the preset storage area, and the disk array controller can end the write operation.
[0243] It should be noted that, when there is a check block in the second target stripe, when the disk array controller writes the data blocks to be written in the preset storage area to the second target stripe in sequence starting from the first data block to be written, if the disk corresponding to the fourth disk number increased by 1 is the disk storing the check block in the second target stripe, the disk array controller automatically skips the disk and increases the fourth disk number by 1 again until the disk corresponding to the fourth disk number increased by 1 is the disk storing the data block to be written corresponding to the third data block number increased by 1, and then continues to perform the above-mentioned write operation.
[0244] According to the data migration method of a disk array provided by an embodiment of the present invention, in the process of writing a data block to be written into a second target stripe, the disk array controller can quickly determine the position of the first data block to be written in the target disk array according to the third data block number of the first data block to be written and the fourth disk number of the first data block to be written, and based on the sequence between the data blocks in the first target stripe and the second target stripe and the number of the data blocks to be written, the data blocks to be read in the preset storage area are written to the second target stripe in sequence starting from the first data block to be written, so that while ensuring that the disk array controller accurately writes the data blocks to be written in the preset storage area to the second target stripe, the efficiency of writing the data blocks to be written to the second target stripe is also improved.
[0245] Optionally, the step S1041 of determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes:
[0246] Step C11: When the second number is equal to 0 and the third number is greater than 0, obtain the minimum value of the fifth disk number of the disk where the check block in the second target stripe is located.
[0247] Step C12, determining the data blocks in the preset storage area whose first disk number is greater than the minimum value of the fifth disk number as the data blocks to be written;
[0248] Step C13: determine the difference between the first number and the minimum value of the fifth disk number as the number of the data blocks to be written.
[0249] In the embodiment of the present invention, when the second number is equal to 0 and the third number is greater than 0, the disk array controller can determine the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area through steps C11 to C13.
[0250] Among them, when the second number is equal to 0 and the third number is greater than 0, it indicates that there are check blocks in the second target stripe, and the data blocks in the preset storage area are all the data blocks in the first target stripe. In order to reduce the number of disk writes, the disk array controller needs to determine the data blocks in the preset storage area that will change on the disk after data migration as the data blocks to be written.
[0251] The scenarios where the second number is equal to 0 and the third number is greater than 0 include: the level of the disk array to be migrated is RAID0, and the level of the target disk array is RAID5; the level of the disk array to be migrated is RAID0, and the level of the target disk array is RAID6.
[0252] Specifically, the disk array controller may first obtain the minimum value of the fifth disk number of the disk where the check block is located in the second target stripe, and then determine the data block whose first disk number in the preset storage area is greater than the minimum value of the fifth disk number as the data block to be written.
[0253] When the second number is equal to 0 and the third number is greater than 0, the disk array controller may determine the number of data blocks to be written by the following formula:
[0254] range_2=data_disk_num-min(pd_index_2)(9)
[0255] Among them, range_2 represents the number of data blocks to be written; min(pd_index_2) represents the minimum value of the fifth disk number.
[0256] As an example, see Figure 2 , when the level of the disk array to be migrated is RAID0, the level of the target disk array is RAID5, and the stripe number of the first target stripe and the second target stripe is 2, the disk array controller can determine that the second number of check blocks in the first target stripe is 0, and the third number of check blocks in the second target stripe is equal to 1, and it is necessary to perform steps C11 to C13 to determine the data blocks to be written and the number of data blocks to be written. Specifically, the disk array controller obtains the fifth disk number of the disk (disk 2) where the check block in the second target stripe is located as "2" through step C11, and because there is only one check block in the second target stripe, the disk array controller determines "2" as the minimum value of the fifth disk number by default; the disk array controller determines the data blocks (D11 and D12) in the preset storage area whose first disk number is greater than the minimum value "2" of the fifth disk number as the data blocks to be written through step C12, and the number of data blocks to be written is equal to the difference (2) between the first number (4) of data blocks in the first target stripe and the minimum value (2) of the fifth disk number.
[0257] Optionally, the step S1041 of determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes:
[0258] Step C21: When the second number is greater than 0 and the third number is equal to 0, obtain the minimum value of the third disk number of the disk where the check block in the first target stripe is located.
[0259] Step C22: determine the data blocks in the preset storage area whose first disk number is greater than the minimum value of the third disk number as the data blocks to be written.
[0260] Step C23: determine the difference between the first number and the minimum value of the third disk number as the number of the data blocks to be written.
[0261] In the embodiment of the present invention, when the second number is greater than 0 and the third number is equal to 0, the disk array controller can determine the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area through steps C21 to C23.
[0262] In this scenario, in order to reduce the number of disk writes, the disk array controller can first obtain the minimum value of the third disk number of the disk where the check block in the first target stripe is located, and then determine the data block in the preset storage area whose first disk number is greater than the minimum value of the third disk number as the data block to be written.
[0263] When the second number is greater than 0 and the third number is equal to 0, the disk array controller may determine the number of data blocks to be written by the following formula:
[0264] range_2=data_disk_num-min(pd_index_1)(10)
[0265] In the embodiment of the present invention, the scenarios where the second number is greater than 0 and the third number is equal to 0 include: the level of the disk array to be migrated is RAID5, and the level of the target disk array is RAID0; the level of the disk array to be migrated is RAID6, and the level of the target disk array is RAID0.
[0266] As an example, see Figure 3, when the level of the disk array to be migrated is RAID5, the level of the target disk array is RAID0, and the stripe number of the first target stripe and the second target stripe is 2, the disk array controller can determine that the second number of check blocks in the first target stripe is 1, and the third number of check blocks in the second target stripe is equal to 0, and it is necessary to perform steps C21 to C23 to determine the data blocks to be written and the number of data blocks to be written. Specifically, the disk array controller obtains the fifth disk number of the disk (disk 2) where the check block in the first target stripe is located as "2" through step C21, and because there is only one check block in the first target stripe, the disk array controller determines "2" as the minimum value of the third disk number by default; the disk array controller can determine the data blocks (D11 and D12) in the preset storage area whose first disk number is greater than the minimum value "2" of the third disk number as the data blocks to be written through step C22, and the number of data blocks to be written is equal to the difference (2) between the first number (4) of data blocks in the first target stripe and the minimum value (2) of the third disk number.
[0267] In the data migration method for a disk array provided by an embodiment of the present invention, a disk array controller determines the data blocks to be written and the number of data blocks to be written from the data blocks in a preset storage area according to the values of the second number and the third number, and under the premise of not affecting the accuracy of the stripe content written to the second target stripe, the data blocks in the preset storage area that are necessary to be written to the second stripe are determined as the data blocks to be written according to the specific application scenario, thereby reducing the number of disk writes during the data migration process, alleviating the disk write pressure of the disk array, and improving the write performance of the disk array during the data migration process.
[0268] Optionally, the step S1042 of determining, according to the second number and the third number, a third data block number of the first data block to be written in the second target stripe in the target disk array and a fourth disk number of the disk where the first data block to be written is located includes:
[0269] Step C31: When either the second number or the third number is equal to 0, obtain the fourth data block number of the first data block in the second target stripe in the target disk array.
[0270] Step C32: Obtain the minimum value of the fifth disk number of the disk where the check block in the second target stripe is located, or the minimum value of the third disk number of the disk where the check block in the first target stripe is located.
[0271] Step C33: determine the minimum value of the fifth disk number or the minimum value of the third disk number as the fourth disk number of the disk where the first data block to be written is located.
[0272] Step C34: Obtain a first length of a data block in the first target stripe.
[0273] Step C35, calculate the second product between the minimum value of the fifth disk number or the minimum value of the third disk number and the first length.
[0274] Step C36, calculate a second sum of the fourth data block number and the second product, and determine the second sum as the third data block number.
[0275] In an embodiment of the present invention, when the disk array controller determines the third data block number of the first data block to be written in the second target stripe and the fourth disk number of the disk where the first data block to be written is located based on the second number and the third number, if either the second number or the third number is equal to 0, it indicates that there is a check block in the first target stripe or the second target stripe. In this scenario, the disk array controller can determine the fourth disk number of the disk where the first data block to be written is located through steps C31 to C33, and determine the third data block number of the first data block to be written in the target disk array through steps C34 to C36.
[0276] Among them, the scenarios in which either the second quantity or the third quantity is equal to 0 may include: the level of the disk array to be migrated is RAID5, and the level of the target disk array is RAID0; the level of the disk array to be migrated is RAID6, and the level of the target disk array is RAID0; the level of the disk array to be migrated is RAID0, and the level of the target disk array is RAID5; the level of the disk array to be migrated is RAID0, and the level of the target disk array is RAID6.
[0277] It can be understood that since the data blocks in the first target stripe are the same as the data blocks in the second target stripe, and the arrangement order between the data blocks in the first target stripe is also the same as the arrangement order between the data blocks in the second target stripe, therefore, in this embodiment of the present invention, the value of the fourth data block number is the same as the value of the second data block number.
[0278] In an embodiment of the present invention, when the second number is equal to 0 and the third number is not equal to 0, the disk array controller can obtain the minimum value of the fifth disk number of the disk where the check block in the second target stripe is located through step C32; determine the minimum value of the fifth disk number as the fourth disk number of the disk where the first data block to be written is located through step C33; calculate the second product between the minimum value of the fifth disk number and the first length through step C35, and determine the second sum of the fourth data block number and the second product as the third data block number.
[0279] Specifically, when the second number is equal to 0 and the third number is not equal to 0, the disk array controller may determine the fourth disk number and the third data block number by the following formula:
[0280] dd_index_2= min(pd_index_2)(11)
[0281] slba_2=raid_slba_2+min(pd_index_2) ×chunk_size(12)
[0282] Among them, dd_index_2 represents the fourth disk number; slba_2 represents the third data block number; raid_slba_2 represents the fourth data block number.
[0283] As an example, see Figure 6 , showing a disk array level migration schematic diagram provided by an embodiment of the present invention Figure 5 ;like Figure 6As shown, the level of the disk array to be migrated is RAID0, the level of the target disk array is RAID6, and when the stripe numbers of the first target stripe and the second target stripe are 3, the disk array controller can determine that the second number of check blocks in the first target stripe is equal to 0 and the third number of check blocks in the second target stripe is not equal to 0, and steps C31 to C36 need to be executed to determine the third data block number and the fourth disk number of the first data block to be written in the second target stripe. Specifically, the disk array controller obtains the fourth data block number "12" in the target disk array of the first data block (D12) in the second target stripe through step C31; the disk array controller obtains the fifth disk number "2" of the disk (disk 2) where the P check block in the second target stripe is located through step C32, and the fifth disk number "3" of the disk (disk 3) where the Q check block in the second target stripe is located, then the minimum value of the fifth disk number is "2"; the disk array controller determines the minimum value "2" of the fifth disk number as the fourth disk number of the disk where the first data block to be written is located through step C33; the disk array controller obtains the first length 1 through step C34, then the disk array controller calculates the second product 2×1=2 through step C35; the disk array controller calculates the second sum 12+2=14 through step C36; in summary, the disk array controller can determine the fourth disk number as "2", and the third data block number as "14", that is, the first data block to be written is "D14", and the disk where the first data block to be written is located is "disk 2". It can be understood that, in the case where the disk corresponding to the fourth disk number stores a check block (P check block), the disk array controller will automatically skip the disk "disk 2" corresponding to the fourth disk number when writing the data blocks to be written in the preset storage area into the second target stripe according to the number of data blocks to be written, the third data block number and the fourth disk number, and because the disk "disk 3" corresponding to the fourth disk number +1 also stores a check block (Q check block) in the second target stripe, the disk array controller continues to increase the fourth disk number +1 and writes the first data block to be written (D14) in the preset storage area to the disk "disk 4" corresponding to the fourth disk number +2.
[0284] In an embodiment of the present invention, when the second number is not equal to 0 and the third number is equal to 0, the disk array controller can obtain the minimum value of the third disk number of the disk where the check block in the first target stripe is located through step C32; determine the minimum value of the third disk number as the fourth disk number of the disk where the first data block to be written is located through step C33; calculate the second product between the minimum value of the third disk number and the first length through step C35, and determine the second sum of the fourth data block number and the second product as the third data block number.
[0285] Specifically, when the second number is not equal to 0 and the third number is equal to 0, the disk array controller may determine the fourth disk number and the third data block number by the following formula:
[0286] dd_index_2= min(pd_index_1)(13)
[0287] slba_2=raid_slba_2+min(pd_index_1) ×chunk_size(14)
[0288] As an example, see Figure 3 , when the level of the disk array to be migrated is RAID5, the level of the target disk array is RAID0, and the stripe number of the first target stripe and the second target stripe is 2, the disk array controller can determine that the second number of check blocks in the first target stripe is 1 and the third number of check blocks in the second target stripe is equal to 0, and steps C31 to C36 need to be executed to determine the third data block number and the fourth disk number of the first data block to be written in the second target stripe. Specifically, the disk array controller obtains the fourth data block number "9" in the target disk array of the first data block (D9) in the second target stripe through step C31; the disk array controller obtains the third disk number "2" of the disk (disk 2) where the check block in the first target stripe is located through step C32, and because there is only one check block in the first target stripe, the disk array controller determines "2" as the minimum value of the third disk number by default; the disk array controller determines the minimum value "2" of the third disk number as the fourth disk number of the disk where the first data block to be written is located through step C33; the disk array controller obtains the first length "2" through step C34 as 1, and the disk array controller calculates the second product 2×1=2 through step C35; the disk array controller calculates the second sum 9+2=11 through step C36; in summary, the disk array controller can determine the fourth disk number as "2" and the third data block number as "11", that is, the first data block to be written is "D11", and the disk where the first data block to be written is located is "disk 2".
[0289] Optionally, the step S1041 of determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes:
[0290] Step C41: When the second number is equal to 1 and the third number is equal to 2, obtain the third disk number of the disk where the first check block in the first target stripe is located.
[0291] Step C42: Obtain the sixth disk number of the disk where the second check block in the second target stripe is located and the seventh disk number of the disk where the third check block is located.
[0292] Step C43: When the seventh disk number is 0, a data block in the preset storage area whose first disk number is smaller than the third disk number is determined as a data block to be written.
[0293] Step C44: determine the third disk number as the number of the data blocks to be written.
[0294] Step C45: When the seventh disk number is not 0, determine the minimum value of the third disk number and the sixth disk number.
[0295] Step C46: Determine the data blocks in the preset storage area whose first disk numbers are greater than the minimum value as the data blocks to be written.
[0296] Step C47: determine the difference between the first number and the minimum value as the number of the data blocks to be written.
[0297] In the embodiment of the present invention, when the second number is equal to 1 and the third number is equal to 2, it indicates that the level of the disk array to be migrated is RAID5, and the level of the target disk array is RAID6; in this scenario, the disk array controller can determine the data blocks to be written and the number of data blocks to be written from the data blocks in the preset storage area through steps C41 to C47.
[0298] Specifically, the disk array controller first obtains the third disk number of the disk where the first check block in the first target stripe is located through step C41, and obtains the sixth disk number of the disk where the first check block in the second target stripe is located and the seventh disk number of the disk where the second check block is located through step C42; then, according to whether the seventh disk number is 0, determines the data blocks to be written and the number of data blocks to be written through steps C43 to C44, or determines the data blocks to be written and the number of data blocks to be written through steps C45 to C47.
[0299] The first check block is specifically the P check block in the first target stripe, the second check block is the P check block in the second target stripe, and the third check block is the Q check block in the second target stripe. The third disk number is the disk number of the disk where the P check block in the first target stripe in the disk array to be migrated is located; the sixth disk number is the disk number of the disk where the P check block in the second target stripe in the target disk array is located; and the seventh disk number is the disk number of the disk where the Q check block in the second target stripe in the target disk array is located. It should be noted that the P check block in the first target stripe is different from the P check block in the second target stripe.
[0300] In the embodiment of the present invention, when the seventh disk number is 0, it indicates that the Q check block in the second target stripe is located at the first position of the second target stripe; in this scenario, the disk array controller can determine the data blocks whose first disk number is less than the third disk number in the preset storage area as the data blocks to be written, and calculate the number of data blocks to be written by the following formula:
[0301] range_2=pd_index_1(15)
[0302] In the embodiment of the present invention, when the seventh disk number is not 0, it indicates that the Q check block in the second target stripe is not at the first position of the second target stripe; in this scenario, the disk array controller can first determine the minimum value between the third disk number and the sixth disk number, and then determine the data blocks whose first disk numbers in the preset storage area are greater than the minimum value as the data blocks to be written; and calculate the number of data blocks to be written by the following formula:
[0303] range_2=data_disk_num-min(pd_index_1,pd_index_3)(16)
[0304] Among them, min(pd_index_1,pd_index_3) represents the minimum value of the third disk number and the sixth disk number.
[0305] As an example, see Figure 5 , the level of the disk array to be migrated is RAID5, and the level of the target disk array is RAID6.
[0306] In the case where the stripe number of the first target stripe and the second target stripe is 3, the disk array controller can determine that the second number of check blocks in the first target stripe is 1 and the third number of check blocks in the second target stripe is equal to 2, and it is necessary to perform steps A41 to A47 to determine the data blocks to be written and the number of data blocks to be written from the data blocks in the preset storage area. Among them, the disk array controller first obtains the third disk number of the disk where the first check block (P check block) in the first target stripe is located through step A41 as "1", the sixth disk number of the disk where the second check block (P check block) in the second target stripe is located through step A42 as "2", and the seventh disk number of the disk where the third check block (Q check block) is located is "3". Since the seventh disk number is "3", the disk array controller continues to perform steps A45 to A47 to determine the data blocks to be written and the number of data blocks to be written from the data blocks in the preset storage area. Specifically, the disk array controller determines through step A45 that the minimum value of the third disk number "1" and the sixth disk number "2" is "1". Through step A46, the disk array controller determines the data blocks (D13, D14 and D15) in the preset storage area whose first disk numbers are greater than the minimum value "1" as the data blocks to be written. Through step A47, the disk array controller determines the difference (3) between the first number (4) and the minimum value (1) as the number of data blocks to be written.
[0307] In the case where the stripe number of the first target stripe and the second target stripe is 0, the disk array controller first obtains the third disk number of the disk where the first check block (P check block) in the first target stripe is located as "4" through step A41, obtains the sixth disk number of the disk where the second check block (P check block) in the second target stripe is located as "5", and obtains the seventh disk number of the disk where the third check block (Q check block) is located as "0". Since the seventh disk number is "0", the disk array controller continues to perform steps A43 to A44 to determine the data blocks to be written and the number of data blocks to be written from the data blocks in the preset storage area. Specifically, the disk array controller determines the data blocks (D0, D1, D2 and D3) in the preset storage area whose first disk number is less than the third disk number "4" as the data blocks to be written through step A43; the disk array controller determines the third disk number "4" as the number of data blocks to be written through step A44.
[0308] As an optional implementation, refer to Figure 5, the level of the disk array to be migrated is RAID5, and the level of the target disk array is RAID6. When the second number is equal to 1 and the third number is equal to 2, the disk array controller can also traverse the first target stripe according to a preset algorithm in the process of determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area, determine which data blocks in the first target stripe will change the disk where they are located after the data migration, and determine the data blocks in the first target stripe where the disk where they are located will change after the data migration as the data blocks to be written.
[0309] Specifically, when the seventh disk number is 0, determine that the data block whose first disk number is less than the third disk number "pd_index_1" is the data block in the first target stripe whose disk will change after data migration; when the seventh disk number is not 0, determine that the data block whose first disk number is greater than the minimum value of the third disk number "pd_index_1", the sixth disk number "pd_index_3" and the seventh disk number "qd_index" is the data block in the first target stripe whose disk will change after data migration.
[0310] Among them, the preset algorithm is as follows:
[0311] uint8_t range=0;
[0312] for(uint8_t disk_index = 0;disk_index <data_disk_num; disk_index++)
[0313] {
[0314] if((disk_index>pd_index_1&&dd_index>pd_index_3&&dd_index>qd_index)
[0315] ||(qd_index == 0&&disk_index < pd_index_1))
[0316] {
[0317] continue;
[0318] }
[0319] range ++;
[0320] }
[0321] Optionally, the step S1042 of determining, according to the second number and the third number, a third data block number of the first data block to be written in the second target stripe in the target disk array and a fourth disk number of the disk where the first data block to be written is located includes:
[0322] Step C51: Obtain the fourth data block number of the first data block in the second target stripe in the target disk array.
[0323] Step C52: when the seventh disk number is 0, the fourth disk number is determined to be 0, and the fourth data block number is determined to be the third data block number.
[0324] Step C53: When the seventh disk number is not 0, the minimum value between the third disk number and the sixth disk number is determined as the fourth disk number.
[0325] Step C54: Obtain a first length of a data block in the first target stripe.
[0326] Step C55, calculate the third product between the minimum value and the first length.
[0327] Step C56, calculate a third sum of the fourth data block number and the third product, and determine the third sum as the third data block number.
[0328] In the embodiment of the present invention, when the second number is equal to 1 and the third number is equal to 2, it indicates that the level of the disk array to be migrated is RAID5, and the level of the target disk array is RAID6; in this scenario, the disk array controller can determine the third data block number of the first data block to be written in the second target stripe in the target disk array and the fourth disk number of the disk where the first data block to be written is located through steps C51 to C56.
[0329] Specifically, when the seventh disk number is 0, the disk array controller determines the fourth disk number and the third data block number by the following formula:
[0330] dd_index_2 = 0 (17)
[0331] slba_2 = raid_slba_2 (18)
[0332] When the seventh disk number is not 0, the disk array controller determines the fourth disk number and the third data block number by the following formula:
[0333] dd_index_2=min(pd_index_1,pd_index_3)(19)
[0334] slba_2=raid_slba_2+ min(pd_index_1,pd_index_3) ×chunk_size(20)
[0335] Optionally, the step S1041 of determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes:
[0336] Step C61: When the second number is equal to 2 and the third number is equal to 1, obtain the third disk number of the disk where the first check block in the second target stripe is located.
[0337] Step C62: Obtain the sixth disk number of the disk where the second check block in the first target stripe is located and the seventh disk number of the disk where the third check block is located.
[0338] Step C63: When the seventh disk number is 0, determine the data block in the preset storage area whose first disk number is smaller than the third disk number as the data block to be written.
[0339] Step C64: determine the third disk number as the number of the data blocks to be written.
[0340] Step C65: When the seventh disk number is not 0, determine the minimum value of the third disk number and the sixth disk number.
[0341] Step C66: Determine the data blocks in the preset storage area whose first disk numbers are greater than the minimum value as the data blocks to be written.
[0342] Step C67: determine the difference between the first number and the minimum value as the number of the data blocks to be written.
[0343] In the embodiment of the present invention, when the second number is equal to 2 and the third number is equal to 1, it indicates that the level of the disk array to be migrated is RAID6, and the level of the target disk array is RAID5; in this scenario, the disk array controller can determine the data blocks to be written and the number of data blocks to be written from the data blocks in the preset storage area through steps C61 to C67.
[0344] Optionally, the step S1042 of determining, according to the second number and the third number, a third data block number of the first data block to be written in the second target stripe in the target disk array and a fourth disk number of the disk where the first data block to be written is located includes:
[0345] Step C71: Obtain the fourth data block number of the first data block in the second target stripe in the target disk array.
[0346] Step C72: when the seventh disk number is 0, the fourth disk number is determined to be 0, and the fourth data block number is determined to be the third data block number.
[0347] Step C73: When the seventh disk number is not 0, the minimum value between the third disk number and the sixth disk number is determined as the fourth disk number.
[0348] Step C74: Obtain a first length of a data block in the first target stripe.
[0349] Step C75, calculate the third product between the minimum value and the first length.
[0350] Step C76, calculate a third sum of the fourth data block number and the third product, and determine the third sum as the third data block number.
[0351] In an embodiment of the present invention, when the second number is equal to 2 and the third number is equal to 1, it indicates that the level of the disk array to be migrated is RAID6, and the level of the target disk array is RAID5; in this scenario, the disk array controller can determine the third data block number of the first data block to be written in the second target stripe in the target disk array and the fourth disk number of the disk where the first data block to be written is located through steps C71 to C76.
[0352] The data migration method of the disk array provided in the embodiment of the present invention provides, for different application scenarios, a method for determining the data blocks to be written and the number of data blocks to be written corresponding to the application scenario, as well as a method for determining the third data block number and the fourth disk number of the first data block to be written, thereby covering a variety of application scenarios and improving the feasibility of the embodiment of the present invention.
[0353] Optionally, the step S1043 of writing the data blocks to be written in the preset storage area into the second target stripe according to the number of the data blocks to be written, the third data block number and the fourth disk number includes:
[0354] Step C81: write the first data block to be written in the preset storage area to the area corresponding to the second target stripe in the disk corresponding to the fourth disk number according to the third data block number.
[0355] Step C82, increase the fourth disk number by 1, and increase the number of writes by 1; wherein the starting value of the number of writes is 0.
[0356] Step C83: When the number of write times is less than the number of data blocks to be written, obtain the first length of the data block in the first target stripe.
[0357] Step C84: Calculate the write offset according to the third data block number, the number of writes and the first length.
[0358] Step C85: determine the next data block to be written from the preset storage area according to the write offset, and write the next data block to be written in the preset storage area to the area corresponding to the second target stripe in the disk corresponding to the fourth disk number.
[0359] Step C86, increase the fourth disk number by 1, and increase the number of writes by 1, until the number of writes is equal to the number of data blocks to be written, and then end the write operation.
[0360] According to the data migration method of the disk array provided by the embodiment of the present invention, the disk array controller writes the data blocks to be written in the preset storage area to the second target stripe according to the number of the data blocks to be written, the third data block number and the fourth disk number. While ensuring that the disk array controller accurately writes the data blocks to be written in the preset storage area to the second target stripe, the efficiency of writing the data blocks to be written to the second target stripe is also improved.
[0361] Optionally, after writing the to-be-written data block into the second target stripe in step S104, the method further includes:
[0362] Step S105: When the third number is greater than 0, calculate the check blocks in the second target stripe according to the data blocks in the preset storage area and the third number, and write the check blocks into the second target stripe.
[0363] It can be understood that when the third number is greater than 0, it indicates that there are check blocks in the second target stripe, and in disk arrays of different levels, the storage location of the check blocks in each stripe is fixed; therefore, in the embodiment of the present invention, after the disk array controller migrates the data blocks in the first target stripe to the second target stripe in step S104, it can calculate the third number of check blocks in the second target stripe according to the data blocks in the preset storage area, and write the check blocks into the area corresponding to the check blocks in the second target stripe. It should be noted that the process of the disk array controller calculating the check blocks and writing the check blocks into the second target stripe can be performed in a manner known to those skilled in the art, and the embodiment of the present invention will not be described in detail.
[0364] Optionally, when the second number is equal to 0 and the third number is greater than 0, after determining, in step S1042, the third data block number of the first data block to be written in the second target stripe in the target disk array and the fourth disk number of the disk where the first data block to be written is located according to the second number and the third number, the method further includes:
[0365] Step E11: Obtain the minimum value of the fifth disk number of the disk where the check block in the second target stripe is located, and the first length of the data block in the first target stripe.
[0366] Step E12, calculating a second difference between the first number and the minimum value of the fifth disk number.
[0367] Step E13: Calculate the sixth product between the second difference and the first length, and determine the sixth product as the total length of the data block to be written in the preset storage area.
[0368] Optionally, when the second number is greater than 0 and the third number is equal to 0, after determining, in step S1042, the third data block number of the first data block to be written in the second target stripe in the target disk array and the fourth disk number of the disk where the first data block to be written is located according to the second number and the third number, the method further includes:
[0369] Step E21, obtaining the minimum value of the third disk number of the disk where the check block in the first target stripe is located, and the first length of the data block in the first target stripe.
[0370] Step E22, calculating a second difference between the first number and the minimum value of the third disk number.
[0371] Step E23: Calculate the sixth product between the second difference and the first length, and determine the sixth product as the total length of the data block to be written in the preset storage area.
[0372] Optionally, when the second number is equal to 1 and the third number is equal to 2, after determining, according to the second number and the third number, the third data block number of the first data block to be written in the second target stripe in the target disk array and the fourth disk number of the disk where the first data block to be written is located in step S1042, the method further includes:
[0373] Step E31: Obtain the third disk number of the disk where the first check block in the first target stripe is located.
[0374] Step E32: Obtain the sixth disk number of the disk where the second check block in the second target stripe is located and the seventh disk number of the disk where the third check block is located.
[0375] Step E33: Obtain a first length of a data block in the first target stripe.
[0376] Step E34: When the seventh disk number is 0, the product of the third disk number and the first length is determined as the total length of the data block to be written in the preset storage area.
[0377] Step E35: When the seventh disk number is not 0, determine the minimum value between the third disk number and the sixth disk number.
[0378] Step E36: Calculate a third difference between the first number and the minimum value.
[0379] Step E37: Calculate the product of the third difference and the first length, and determine the product of the third difference and the first length as the total length of the data block to be written in the preset storage area.
[0380] Optionally, when the second number is equal to 2 and the third number is equal to 1, after determining, in step S1042, the third data block number of the first data block to be written in the second target stripe in the target disk array and the fourth disk number of the disk where the first data block to be written is located according to the second number and the third number, the method further includes:
[0381] Step E41: Obtain the third disk number of the disk where the first check block in the second target stripe is located.
[0382] Step E42: Obtain the sixth disk number of the disk where the second check block in the first target stripe is located and the seventh disk number of the disk where the third check block is located.
[0383] Step E43: Obtain a first length of a data block in the first target stripe.
[0384] Step E44: When the seventh disk number is 0, the product of the third disk number and the first length is determined as the total length of the data block to be written in the preset storage area.
[0385] Step E45: When the seventh disk number is not 0, determine the minimum value between the third disk number and the sixth disk number.
[0386] Step E46: Calculate a fourth difference between the first number and the minimum value.
[0387] Step E47: Calculate the product of the fourth difference and the first length, and determine the product of the fourth difference and the first length as the total length of the data block to be written in the preset storage area.
[0388] Optionally, the method further comprises:
[0389] Step E51: write the data blocks to be written in the preset storage area into the second target stripe according to the total length of the data blocks to be read in the first target stripe, the third data block number and the fourth disk number.
[0390] In the embodiment of the present invention, after the disk array controller determines the data blocks to be written and the number of data blocks to be written through step S1041, and determines the third data block number and the fourth disk number of the first data block to be written through step S1042, it can also determine the total length of the data blocks to be written in the preset storage area through steps E11 to E13 when the second number is equal to 0 and the third number is greater than 0; determine the total length of the data blocks to be written in the preset storage area through steps E21 to E23 when the second number is greater than 0 and the third number is equal to 0; determine the total length of the data blocks to be written in the preset storage area through steps E31 to E37 when the second number is equal to 1 and the third number is equal to 2; and determine the total length of the data blocks to be written in the preset storage area through steps E41 to E47 when the second number is equal to 2 and the third number is equal to 1.
[0391] After determining the total length of the data blocks to be written in the preset storage area, the data blocks to be written in the preset storage area are written into the second target stripe according to the total length of the data blocks to be read in the first target stripe, the third data block number and the fourth disk number through step E51.
[0392] The total length of the data blocks to be written in the preset storage area is the sum of the data block lengths of the data blocks to be written in the preset storage area.
[0393] Specifically, when the second number is equal to 0 and the third number is greater than 0, the disk array controller can determine the total length of the data blocks to be written in the preset storage area by using the following formula:
[0394] nlb_2=[data_disk_num- min(pd_index_2)]×chunk_size(21)
[0395] Among them, nlb_2 represents the total length of the data block to be written in the preset storage area.
[0396] When the second number is greater than 0 and the third number is equal to 0, the disk array controller can determine the total length of the data blocks to be written in the preset storage area by the following formula:
[0397] nlb_2=[data_disk_num- min(pd_index_1)]×chunk_size(22)
[0398] When the second number is equal to 1 and the third number is equal to 2, the disk array controller may determine the total length of the data blocks to be written in the preset storage area by using the following formula:
[0399] The seventh disk is numbered 0:
[0400] nlb_2=(data_disk_num- pd_index_1)×chunk_size(23)
[0401] The seventh disk number is not 0:
[0402] nlb_2=[data_disk_num- min(pd_index_1,pd_index_3)]×chunk_size(24)
[0403] When the second number is equal to 2 and the third number is equal to 1, the disk array controller determines the total length of the data blocks to be written in the preset storage area in a manner similar to the case where the second number is equal to 1 and the third number is equal to 2, and will not be repeated here to avoid repetition.
[0404] In the embodiment of the present invention, after obtaining the total length of the data blocks to be written in the preset storage area, the disk array controller writes the data blocks to be written in the preset storage area into the second target stripe according to the total length of the data blocks to be written in the preset storage area, the third data block number and the fourth disk number, specifically:
[0405] First, the disk array controller writes the first to-be-written data block in the preset storage area to the area corresponding to the second target stripe in the disk corresponding to the fourth disk number according to the third data block number.
[0406] Then, the disk array controller increases the fourth disk number by 1, and increases the number of writes by 1; wherein the starting value of the number of writes is 0.
[0407] Then, the disk array controller calculates the product between the number of write times and the first length of the data block in the first target stripe, and determines the product between the number of write times and the first length as the length of the written data block.
[0408] Then, when the length of the written data block is less than the total length of the data blocks to be written in the preset storage area, the disk array controller calculates the write offset according to the third data block number, the number of writes and the first length of the data blocks in the first target stripe.
[0409] Then, the disk array controller determines the next data block to be written from the preset storage area according to the write offset, and writes the next data block to be written in the preset storage area to the area corresponding to the second target stripe in the disk corresponding to the fourth disk number.
[0410] Then, the disk array controller increases the fourth disk number by 1, and increases the number of writes by 1.
[0411] Finally, the disk array controller calculates the product of the number of write times and the first length of the data block in the first target stripe, and determines the product of the number of write times and the first length as the length of the written data block, until the number of write times is equal to the total length of the data block to be written in the preset storage area, and ends the write operation.
[0412] In the data migration method for a disk array provided by an embodiment of the present invention, the disk array controller can also write the data blocks to be written in the preset storage area to the second target stripe according to the total length of the data blocks to be written in the preset storage area, the third data block number and the fourth disk number, thereby improving the flexibility of the implementation method of the data migration method for the disk array and expanding the application scope of the embodiment of the present invention.
[0413] Optionally, refer to Figure 7 , shows a flowchart of the steps of another method for data migration of a disk array provided by an embodiment of the present invention, the method may include:
[0414] Step S201: The disk array controller determines the number range_1 of data blocks to be read.
[0415] Specifically, first, the disk array controller obtains the first disk number of the disk where the data block in the first target stripe of the disk array to be migrated is located, the first number of data blocks in the first target stripe, and the second number of check blocks in the first target stripe; then, the disk array controller obtains the third number of check disks in the second target stripe of the target disk array; wherein the stripe numbers of the first target stripe and the second target stripe are the same; finally, the disk array controller determines the data blocks to be read and the number range_1 of the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number.
[0416] Step S202: The disk array controller determines dd_index_1 and slba_1 when reading the disk, and the reading number i=0.
[0417] Specifically, the disk array controller determines, based on the second quantity and the third quantity, the first data block number (slba_1) of the first data block to be read in the first target stripe in the disk array to be migrated, and the second disk number (dd_index_1) of the disk where the first data block to be read is located, and sets the starting value of the read count i to 0.
[0418] Step S203: The disk array controller reads the data in the disk to be migrated into the on-chip cache.
[0419] Specifically, the disk array controller reads the data blocks to be read in the first target stripe into the on-chip cache according to the number of the data blocks to be read, the first data block number and the second disk number.
[0420] Step S204: The disk array controller determines whether i satisfies i<range_1.
[0421] Specifically, when i satisfies i<range_1, the disk array controller executes step S205; when i does not satisfy i<range_1, that is, when i is greater than or equal to range_1, the disk array controller executes step S206.
[0422] Step S205: The disk array controller increases the disk position by 1, slba_1+chunk size, i=i+1.
[0423] Specifically, when the number of reads i is less than the number of data blocks to be read, range_1, the disk array controller obtains the first length of the data block in the first target stripe, and determines the sum of the first data block number and the fourth product of the number of reads and the first length as the read offset; in addition, when the number of reads i is less than the number of data blocks to be read, range_1, the disk array controller increases the position of the disk by 1, slba_1+chunk size, i=i+1; wherein, the disk array controller increases the position of the disk by 1 means that the disk array controller increases the second disk number by 1.
[0424] After step S205 , the disk array controller repeatedly executes operations corresponding to steps S203 to S204 until i does not satisfy i<range_1, and then executes step S206 .
[0425] Step S206: If there is a check block in the target disk array, the disk array controller calculates and stores the check block.
[0426] Specifically, when the number of reads i is greater than or equal to the number range_1 of data blocks to be read, the disk array controller calculates the check blocks in the second target stripe according to the data blocks in the on-chip cache and the third number, and stores the calculated check blocks in the on-chip cache.
[0427] Step S207: The disk array controller determines the number range_2 of data blocks to be written.
[0428] Specifically, the disk array controller determines the data blocks to be written and the number range_2 of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number.
[0429] Step S208: The disk array controller determines dd_index_2 and slba_2 when writing to the disk, and the number of write times j=0.
[0430] Specifically, the disk array controller determines, based on the second quantity and the third quantity, the third data block number (slba_2) of the first data block to be written in the second target stripe in the target disk array, and the fourth disk number (dd_index_2) of the disk where the first data block to be written is located, and sets the starting value of the number of write times j to 0.
[0431] Step S209: The disk array controller writes the data block from the on-chip cache to the target disk array.
[0432] Specifically, the disk array controller writes the data blocks to be written in the preset storage area into the second target stripe in the target disk array according to the number of the data blocks to be written, the third data block number and the fourth disk number.
[0433] Step S210: The disk array controller determines whether j satisfies j<range_2.
[0434] Specifically, when j satisfies j<range_2, the disk array controller executes step S211; when j does not satisfy j<range_2, that is, when j is greater than or equal to range_2, the disk array controller executes step S212.
[0435] Step S211, the disk array controller increases the disk position by 1, slba_2+chunk size, j=j+1.
[0436] Specifically, when the number of write times j is less than the number of data blocks to be written, range_2, the disk array controller obtains the first length of the data block in the first target stripe, and determines the sum of the third data block number and the seventh product of the number of read times and the first length as the write offset; in addition, when the number of write times j is less than the number of data blocks to be written, range_2, the disk array controller increases the position of the disk by +1, slba_2+chunk size, j=j+1; wherein, the disk array controller increases the position of the disk by +1 means that the disk array controller increases the fourth disk number by 1.
[0437] After step S211, the disk array controller repeatedly executes operations corresponding to steps S209 to S210 until j does not satisfy j<range_2, and then executes step S212.
[0438] Step S212: If the check block exists in the target disk array, the disk array controller writes the check block into the target disk array.
[0439] Specifically, when the number of write times j is greater than or equal to the number range_2 of data blocks to be written, if there is a check block in the target disk array, the disk array controller writes the check block into the target disk array from the on-chip cache.
[0440] As an example, when the level of the disk array to be migrated is RAID0 and the level of the target disk array is RAID5, it is assumed that the first number of data blocks in the first target stripe is m, where m is an integer greater than 1. During the disk reading process, since the check blocks need to be calculated, all data blocks in the first target stripe need to be read. In this scenario, the number of disks read in the embodiment of the present invention and the related art is m(m+1), and the disk reading performance remains unchanged. During the disk writing process, since the data disk and the check disk need to be written at the same time in the related art, the number of disks written is (m+1) 2 In the embodiment of the present invention, the number of disks for writing data is , the number of write check disks is m+1, then the total number of write disks is From the above discussion, it can be seen that when the level of the disk array to be migrated is RAID0 and the level of the target disk array is RAID5, compared with the related art, the number of disks written in the embodiment of the present invention is reduced by , disk writing performance has been improved Taking the example of 4 data blocks in the first target stripe, that is, m=4, the disk writing performance is improved by 40%, and the larger the m value, the greater the disk writing performance improvement, and the disk writing performance improvement approaches 50%.
[0441] In the case where the level of the disk array to be migrated is RAID5 and the level of the target disk array is RAID0, it is assumed that the first number of data blocks in the first target stripe is m, where m is an integer greater than 1. The number of read / write disks in the related art is m(m+1), and the number of read / write disks in the embodiment of the present invention is From the above discussion, it can be seen that when the level of the disk array to be migrated is RAID5 and the level of the target disk array is RAID0, compared with the related art, the number of read / write disks in the embodiment of the present invention is reduced by , read / write disk performance is improved .
[0442] When the level of the disk array to be migrated is RAID5, and the level of the target disk array is RAID6, it is assumed that the first number of data blocks in the first target stripe is m, where m is an integer greater than 1. During the disk reading process, since the check blocks need to be calculated, all data blocks in the first target stripe need to be read. In this scenario, the number of disks read in the embodiment of the present invention and the related technology is m(m+1), and the disk reading performance remains unchanged. During the disk writing process, in the related technology, since data disks and check disks need to be written at the same time, the number of data disks to be written is m(m+1), the number of check disks to be written is 2(m+1), and the total number of disks to be written is (m+1)(m+2); while in the embodiment of the present invention, the number of data disks to be written is , the number of write check disks is 2(m+1), and the total number of write disks is From the above discussion, it can be seen that when the level of the disk array to be migrated is RAID5 and the level of the target disk array is RAID6, compared with the related art, the number of disk writes in the embodiment of the present invention is reduced by , disk writing performance has been improved , taking the example that there are 4 data blocks in the first target stripe, that is, m=4, the disk write performance is improved by 20%.
[0443] When the level of the disk array to be migrated is RAID6 and the level of the target disk array is RAID5, it is assumed that the first number of data blocks in the first target stripe is m, where m is an integer greater than 1. During the disk reading process, since the check blocks need to be calculated, all data blocks in the first target stripe need to be read. In this scenario, the number of disks read in the embodiment of the present invention and the related technology is m(m+1), and the disk reading performance remains unchanged. During the disk writing process, in the related technology, since data disks and check disks need to be written at the same time, the number of data disks written is m(m+1), the number of check disks written is (m+1), and the total number of disks written is (m+1). 2 ; In the embodiment of the present invention, the number of disks for writing data is , the number of write check disks is (m+1), and the total number of write disks is From the above discussion, it can be seen that when the level of the disk array to be migrated is RAID6 and the level of the target disk array is RAID5, compared with the related art, the number of disks written in the embodiment of the present invention is reduced by , disk writing performance has been improved , taking the example that there are 4 data blocks in the first target stripe, that is, m=4, the disk write performance is improved by 20%.
[0444] In summary, the disk array data migration method provided by the embodiment of the present invention determines the data blocks to be read and the data blocks to be written according to the specific application scenario during the disk array data migration process, and there is no need to read all the data in the first target stripe of the disk array to be migrated and write them to the second target stripe of the target disk array, thereby reducing the number of disk reading and writing during the data migration process, alleviating the read and write pressure of the disk array, and improving the read and write performance of the disk array during the data migration process.
[0445] Device Embodiment
[0446] Reference Figure 8 , shows a logical block diagram of a data migration device for a disk array provided by an embodiment of the present invention, the device comprising:
[0447] The first acquisition module 801 is used to acquire a first disk number of a disk where a data block in a first target stripe of a disk array to be migrated is located, a first number of data blocks in the first target stripe, and a second number of check blocks in the first target stripe;
[0448] The second acquisition module 802 is used to acquire a third number of check disks in a second target stripe of the target disk array; the stripe numbers of the first target stripe and the second target stripe are the same;
[0449] A reading module 803 is used to determine a data block to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and read the data block to be read into a preset storage area;
[0450] The first writing module 804 is used to determine the data block to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, and write the data block to be written into the second target stripe.
[0451] Optionally, the reading module includes:
[0452] A first determining submodule, configured to determine the data blocks to be read and the number of the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number;
[0453] A second determination submodule is used to determine, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated, and a second disk number of the disk where the first data block to be read is located;
[0454] The first reading submodule is used to read the to-be-read data blocks in the first target stripe into a preset storage area according to the number of the to-be-read data blocks, the first data block number and the second disk number.
[0455] Optionally, the first determining submodule includes:
[0456] a first determining unit, configured to, when the third number is greater than 0, determine all data blocks in the first target stripe as data blocks to be read, and determine the first number as the number of data blocks to be read;
[0457] A first acquisition unit, configured to acquire a minimum value of a third disk number of the disk where the check block in the first target stripe is located when the third number is equal to 0 and the second number is greater than 0;
[0458] A second determining unit, configured to determine a data block in the first target stripe whose first disk number is greater than a minimum value of the third disk number as a data block to be read;
[0459] The third determining unit is used to determine the difference between the first number and the minimum value of the third disk number as the number of the data blocks to be read.
[0460] Optionally, the second determining submodule includes:
[0461] A second acquisition unit is used to acquire a minimum value of the third disk numbers of the disks where the check blocks in the first target stripe are located when the second number is greater than 0 and the third number is equal to 0, and determine the minimum value of the third disk numbers as the second disk number;
[0462] A third acquisition unit, configured to acquire a first length of a data block in the first target stripe;
[0463] a first calculation unit, configured to calculate a first product between the minimum value of the third disk number and the first length;
[0464] A fourth acquisition unit, configured to acquire a second data block number of a first data block in the first target stripe in the disk array to be migrated;
[0465] The second calculation unit is used to calculate a first sum of the first product and the second data block number, and determine the first sum as the first data block number.
[0466] Optionally, the second determining submodule includes:
[0467] A fourth determining unit, configured to determine the second disk number as 0 when the third number is greater than 0;
[0468] The fifth obtaining unit is used to obtain the second data block number of the first data block in the first target stripe in the disk array to be migrated, and determine the second data block number as the first data block number.
[0469] Optionally, the first reading submodule includes:
[0470] A first reading unit, configured to read a first to-be-read data block corresponding to the first data block number from an area corresponding to the first target stripe in the disk corresponding to the second disk number, and store the first to-be-read data block in a preset storage area;
[0471] A first counting unit, used for increasing the second disk number by 1 and increasing the number of reads by 1; wherein the starting value of the number of reads is 0;
[0472] A sixth acquisition unit, configured to acquire a first length of a data block in the first target stripe when the number of reads is less than the number of the data blocks to be read;
[0473] a third calculation unit, configured to calculate a read offset according to the first data block number, the number of reads and the first length;
[0474] A second reading unit, configured to read the data block to be read indicated by the read offset from the area corresponding to the first target stripe in the disk corresponding to the second disk number, and store the data block to be read indicated by the read offset into a preset storage area;
[0475] The second counting unit is used to increase the second disk number by 1 and increase the number of reads by 1 until the number of reads is equal to the number of data blocks to be read, thereby terminating the read operation.
[0476] Optionally, the first writing module includes:
[0477] A third determining submodule, configured to determine the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number;
[0478] a fourth determination submodule, configured to determine, according to the second number and the third number, a third data block number of the first data block to be written in the second target stripe in the target disk array, and a fourth disk number of the disk where the first data block to be written is located;
[0479] The first writing submodule is used to write the data blocks to be written in the preset storage area into the second target stripe according to the number of the data blocks to be written, the third data block number and the fourth disk number.
[0480] Optionally, the third determining submodule includes:
[0481] a seventh acquisition unit, configured to acquire a minimum value of fifth disk numbers of disks where check blocks in the second target stripe are located when the second number is equal to 0 and the third number is greater than 0;
[0482] A fifth determining unit, configured to determine a data block in the preset storage area whose first disk number is greater than a minimum value of the fifth disk number as a data block to be written;
[0483] The sixth determining unit is used to determine the difference between the first number and the minimum value of the fifth disk number as the number of the data blocks to be written.
[0484] Optionally, the third determining submodule includes:
[0485] an eighth acquisition unit, configured to acquire a minimum value of third disk numbers of disks where check blocks in the first target stripe are located when the second number is greater than 0 and the third number is equal to 0;
[0486] A seventh determining unit, configured to determine a data block in the preset storage area whose first disk number is greater than a minimum value of the third disk number as a data block to be written;
[0487] An eighth determining unit is used to determine the difference between the first number and the minimum value of the third disk number as the number of the data blocks to be written.
[0488] Optionally, the fourth determining submodule includes:
[0489] A ninth obtaining unit, configured to obtain, when either the second number or the third number is equal to 0, a fourth data block number of the first data block in the second target stripe in the target disk array;
[0490] a tenth obtaining unit, configured to obtain a minimum value of the fifth disk number of the disk where the check block in the second target stripe is located, or a minimum value of the third disk number of the disk where the check block in the first target stripe is located;
[0491] a ninth determining unit, configured to determine the minimum value of the fifth disk number or the minimum value of the third disk number as the fourth disk number of the disk where the first data block to be written is located;
[0492] an eleventh obtaining unit, configured to obtain a first length of a data block in the first target stripe;
[0493] a fourth calculation unit, configured to calculate a second product between the minimum value of the fifth disk number or the minimum value of the third disk number and the first length;
[0494] The fifth calculation unit is used to calculate a second sum of the fourth data block number and the second product, and determine the second sum as the third data block number.
[0495] Optionally, the third determining submodule includes:
[0496] A twelfth obtaining unit, configured to obtain, when the second number is equal to 1 and the third number is equal to 2, a third disk number of the disk where the first check block in the first target stripe is located;
[0497] A thirteenth obtaining unit, configured to obtain a sixth disk number of the disk where the second check block in the second target stripe is located and a seventh disk number of the disk where the third check block is located;
[0498] A tenth determining unit, configured to determine, when the seventh disk number is 0, a data block in the preset storage area whose first disk number is smaller than the third disk number as a data block to be written;
[0499] an eleventh determining unit, configured to determine the third disk number as the number of the data blocks to be written;
[0500] a twelfth determining unit, configured to determine a minimum value between the third disk number and the sixth disk number when the seventh disk number is not 0;
[0501] A thirteenth determining unit, configured to determine the data blocks in the preset storage area whose first disk numbers are greater than the minimum value as the data blocks to be written;
[0502] A fourteenth determining unit is configured to determine a difference between the first number and the minimum value as the number of the data blocks to be written.
[0503] Optionally, the fourth determining submodule includes:
[0504] A fourteenth obtaining unit, configured to obtain a fourth data block number of the first data block in the second target stripe in the target disk array;
[0505] a fifteenth determining unit, configured to, when the seventh disk number is 0, determine the fourth disk number to be 0, and determine the fourth data block number to be the third data block number;
[0506] a sixteenth determining unit, configured to determine, when the seventh disk number is not 0, a minimum value between the third disk number and the sixth disk number as a fourth disk number;
[0507] A fifteenth obtaining unit, configured to obtain a first length of a data block in the first target stripe;
[0508] a sixth calculation unit, configured to calculate a third product between the minimum value and the first length;
[0509] The seventh calculation unit is used to calculate a third sum of the fourth data block number and the third product, and determine the third sum as the third data block number.
[0510] Optionally, the device further comprises:
[0511] The second writing module is used to calculate the check block in the second target stripe according to the data blocks in the preset storage area and the third number when the third number is greater than 0, and write the check block into the second target stripe.
[0512] The present invention further provides a computer program product, including a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the disk array data migration method of the aforementioned embodiment.
[0513] The present invention also provides an electronic device, see Fig. 9 , including: a processor 901, a memory 902, and a computer program 9021 stored in the memory and executable on the processor, wherein when the processor executes the program, the disk array data migration method of the aforementioned embodiment is implemented.
[0514] The present invention also provides a readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the data migration method of the disk array of the aforementioned embodiment.
[0515] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0516] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the description of the above specific languages is for disclosing the best mode of the present invention.
Claims
1. A method for data migration of a disk array, characterized in that: The method comprises: Obtain a first disk number of a disk where a data block in a first target stripe of a disk array to be migrated is located, a first number of data blocks in the first target stripe, and a second number of check blocks in the first target stripe; Acquire a third number of check disks in a second target stripe of a target disk array; the stripe numbers of the first target stripe and the second target stripe are the same; Determine a data block to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and read the data block to be read into a preset storage area; Determine a data block to be written from data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, and write the data block to be written into the second target stripe; The step of determining the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and reading the data blocks to be read into a preset storage area includes: Determine, from the data blocks of the first target stripe, the data blocks to be read and the number of the data blocks to be read according to the first number, the second number, the third number and the first disk number; Determining the to-be-read data blocks and the number of the to-be-read data blocks from the data blocks of the first target stripe according to the first number, the second number, the third number, and the first disk number includes: In a case where the third number is greater than 0, all data blocks in the first target stripe are determined as data blocks to be read, and the first number is determined as the number of data blocks to be read; When the third number is equal to 0 and the second number is greater than 0, obtaining a minimum value of the third disk number of the disk where the check block in the first target stripe is located; Determine a data block in the first target stripe whose first disk number is greater than the minimum value of the third disk number as a data block to be read; The difference between the first number and the minimum value of the third disk number is determined as the number of the data blocks to be read.
2. The method according to claim 1, characterized in that Determine, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated, and a second disk number of the disk where the first data block to be read is located; The data blocks to be read in the first target stripe are read into a preset storage area according to the number of the data blocks to be read, the first data block number and the second disk number.
3. The method according to claim 2, characterized in that The step of determining, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated, and a second disk number of a disk where the first data block to be read is located, comprises: When the second number is greater than 0 and the third number is equal to 0, obtaining a minimum value of the third disk numbers of the disks where the check blocks in the first target stripe are located, and determining the minimum value of the third disk numbers as the second disk number; Obtaining a first length of a data block in the first target stripe; calculating a first product between the minimum value of the third disk number and the first length; Obtaining a second data block number of a first data block in the first target stripe in the disk array to be migrated; A first sum of the first product and the second data block number is calculated, and the first sum is determined as a first data block number.
4. The method according to claim 2, characterized in that: The step of determining, according to the second number and the third number, a first data block number of a first data block to be read in the first target stripe in the disk array to be migrated, and a second disk number of a disk where the first data block to be read is located, comprises: When the third number is greater than 0, the second disk number is determined to be 0; The second data block number of the first data block in the first target stripe in the disk array to be migrated is obtained, and the second data block number is determined as the first data block number.
5. The method according to claim 2, characterized in that: The step of reading the data blocks to be read in the first target stripe into a preset storage area according to the number of the data blocks to be read, the first data block number, and the second disk number includes: Reading a first to-be-read data block corresponding to the first data block number from an area corresponding to the first target stripe in the disk corresponding to the second disk number, and storing the first to-be-read data block in a preset storage area; The second disk number is incremented by 1, and the number of reads is incremented by 1; wherein the starting value of the number of reads is 0; When the number of reads is less than the number of data blocks to be read, obtaining a first length of the data blocks in the first target stripe; Calculate a read offset according to the first data block number, the number of reads and the first length; Reading the to-be-read data block indicated by the read offset from the area corresponding to the first target stripe in the disk corresponding to the second disk number, and storing the to-be-read data block indicated by the read offset in a preset storage area; The second disk number is incremented by 1, and the number of reads is incremented by 1 until the number of reads is equal to the number of data blocks to be read, and the read operation is terminated.
6. The method according to claim 1, characterized in that The step of determining the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number, and the first disk number, and writing the data blocks to be written into the second target stripe includes: Determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number; Determine, according to the second number and the third number, a third data block number of the first data block to be written in the second target stripe in the target disk array, and a fourth disk number of the disk where the first data block to be written is located; The data blocks to be written in the preset storage area are written into the second target stripe according to the number of the data blocks to be written, the third data block number and the fourth disk number.
7. The method according to claim 6, characterized in that The step of determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes: When the second number is equal to 0 and the third number is greater than 0, obtaining a minimum value of the fifth disk number of the disk where the check block in the second target stripe is located; Determine the data blocks in the preset storage area whose first disk number is greater than the minimum value of the fifth disk number as the data blocks to be written; The difference between the first number and the minimum value of the fifth disk number is determined as the number of the data blocks to be written.
8. The method according to claim 6, characterized in that The step of determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes: When the second number is greater than 0 and the third number is equal to 0, obtaining a minimum value of the third disk number of the disk where the check block in the first target stripe is located; Determine the data blocks in the preset storage area whose first disk number is greater than the minimum value of the third disk number as the data blocks to be written; The difference between the first number and the minimum value of the third disk number is determined as the number of the data blocks to be written.
9. The method according to claim 6, characterized in that The step of determining, according to the second number and the third number, a third data block number of the first data block to be written in the second target stripe in the target disk array and a fourth disk number of the disk where the first data block to be written is located comprises: When either the second number or the third number is equal to 0, obtaining a fourth data block number of a first data block in the second target stripe in the target disk array; Obtaining a minimum value of the fifth disk number of the disk where the check block in the second target stripe is located, or a minimum value of the third disk number of the disk where the check block in the first target stripe is located; Determine the minimum value of the fifth disk number or the minimum value of the third disk number as the fourth disk number of the disk where the first data block to be written is located; Obtaining a first length of a data block in the first target stripe; Calculate a second product between the minimum value of the fifth disk number or the minimum value of the third disk number and the first length; A second sum value of the fourth data block number and the second product is calculated, and the second sum value is determined as the third data block number.
10. The method according to claim 6, characterized in that The step of determining the data blocks to be written and the number of the data blocks to be written from the data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number includes: When the second number is equal to 1 and the third number is equal to 2, obtaining the third disk number of the disk where the first check block in the first target stripe is located; Obtain the sixth disk number of the disk where the second check block in the second target stripe is located and the seventh disk number of the disk where the third check block is located; In the case where the seventh disk number is 0, a data block in the preset storage area whose first disk number is smaller than the third disk number is determined as a data block to be written; Determine the third disk number as the number of the data blocks to be written; When the seventh disk number is not 0, determining the minimum value between the third disk number and the sixth disk number; Determine the data blocks in the preset storage area whose first disk numbers are greater than the minimum value as the data blocks to be written; The difference between the first number and the minimum value is determined as the number of the data blocks to be written.
11. The method according to claim 10, characterized in that The step of determining, according to the second number and the third number, a third data block number of the first data block to be written in the second target stripe in the target disk array and a fourth disk number of the disk where the first data block to be written is located comprises: Obtaining a fourth data block number of the first data block in the second target stripe in the target disk array; When the seventh disk number is 0, the fourth disk number is determined to be 0, and the fourth data block number is determined to be the third data block number; When the seventh disk number is not 0, the minimum value between the third disk number and the sixth disk number is determined as the fourth disk number; Obtaining a first length of a data block in the first target stripe; calculating a third product between the minimum value and the first length; A third sum of the fourth data block number and the third product is calculated, and the third sum is determined as the third data block number.
12. The method according to claim 1, characterized in that After writing the to-be-written data block into the second target stripe, the method further includes: When the third number is greater than 0, a check block in the second target stripe is calculated according to the data blocks in the preset storage area and the third number, and the check block is written into the second target stripe.
13. A data migration device for a disk array, characterized in that: The device comprises: A first acquisition module, used to acquire a first disk number of a disk where a data block in a first target stripe of a disk array to be migrated is located, a first number of data blocks in the first target stripe, and a second number of check blocks in the first target stripe; A second acquisition module is used to acquire a third number of check disks in a second target stripe of a target disk array; the stripe numbers of the first target stripe and the second target stripe are the same; a reading module, configured to determine a data block to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and read the data block to be read into a preset storage area; A first writing module, configured to determine a data block to be written from data blocks in the preset storage area according to the first number, the second number, the third number and the first disk number, and write the data block to be written into the second target stripe; The step of determining the data blocks to be read from the data blocks of the first target stripe according to the first number, the second number, the third number and the first disk number, and reading the data blocks to be read into a preset storage area includes: Determine, from the data blocks of the first target stripe, the data blocks to be read and the number of the data blocks to be read according to the first number, the second number, the third number and the first disk number; Determining the to-be-read data blocks and the number of the to-be-read data blocks from the data blocks of the first target stripe according to the first number, the second number, the third number, and the first disk number includes: In a case where the third number is greater than 0, all data blocks in the first target stripe are determined as data blocks to be read, and the first number is determined as the number of data blocks to be read; When the third number is equal to 0 and the second number is greater than 0, obtaining a minimum value of the third disk number of the disk where the check block in the first target stripe is located; Determine a data block in the first target stripe whose first disk number is greater than the minimum value of the third disk number as a data block to be read; The difference between the first number and the minimum value of the third disk number is determined as the number of the data blocks to be read.
14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the data migration method of the disk array according to any one of claims 1 to 12 is implemented.
15. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the data migration method for the disk array according to any one of claims 1 to 12.
16. A readable storage medium, characterized in that: When the instructions in the readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the disk array data migration method described in any one of claims 1 to 12.
Citation Information
Patent Citations
Disk array switching method and system, electronic equipment and storage medium
CN116501537A