A wear leveling method for data stripe reconstruction in RAID5
By designing reasonable strip selection strategies and calculation methods in RAID5, reconstructing data strips and adjusting the check block position, the problems of wear imbalance and performance impact in RAID5 are solved, and better wear equalization and array performance optimization are achieved.
Patent Information
- Application Number
- CN202210345167.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2042-03-31
AI Technical Summary
When the wear balance technology in the existing RAID5 is unbalanced when the wear of each hard disk in the balancing array, it may cause the verification block to be stored in the same hard disk as the data block of the same strip. If the hard disk is damaged, the data cannot be recovered, and it will have a serious impact on the array performance.
Reconstruct the data strips by designing a reasonable strip selection strategy, adjust the position of the check block, adopt the band write heat calculation method based on the heat weight attenuation over time, and add the hard disk life and load compensation coefficient to calculate the reconstruction value of each strip, and select and reconstruct the data strips to achieve the goal of wear equalization.
It realizes the optimization of the life consumption process of each hard disk in an all-flash hard disk array, while reducing the impact on array performance and improving the stability and reliability of the RAID array.
Smart Images

Figure CN114924691B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer data processing and relates to a wear leveling method for data stripe reconstruction in RAID5. Background Art
[0002] According to the characteristics of stored data, the wear leveling technology of dynamically allocating check blocks takes advantage of the fact that check blocks in RAID are updated more frequently to move check blocks between different hard disks, thereby adjusting the degree of wear of each solid-state drive in the array. The execution strategy uses the degree of wear of the solid-state drive as a reference, and uses the number of erases and writes of each hard disk in the array as the degree of wear of the hard disk, and allocates the proportion of check blocks stored on each hard disk in the array according to the inverse proportion of the degree of wear. The method of using the number of updates of the check block as a reference is to check the historical update times of the block when the check block is updated. If the number exceeds the set threshold, a data migration operation is performed to exchange positions with the check block with the least number of updates in the array, so as to balance the uneven wear caused by the different update frequencies of the check blocks stored in each hard disk in the array, and extend the service life of the solid-state drives in the array.
[0003] Regarding the wear leveling technology based on dynamic allocation of check blocks, the method that only focuses on the update frequency of the check blocks can balance the uneven wear caused by the different update frequencies of the check blocks stored in each SSD in the array, but this data exchange strategy will cause the migrated check blocks and the data blocks of the same stripe to be stored in the same hard disk. If the hard disk is damaged, the data content of the data blocks and check blocks of the same stripe will be lost at the same time, resulting in the data being unrecoverable. The method of dynamically adjusting the check blocks according to the degree of wear of the SSD can better balance the life of the SSDs in the array compared to the strategy that only focuses on the update frequency of the check blocks, but it will cause the check blocks to be unevenly distributed in each hard disk. Although the purpose of wear leveling is achieved, it will have a serious impact on the performance of the array. Summary of the invention
[0004] To solve the above problems, the present invention reconstructs the data stripes by designing a reasonable stripe selection strategy and adjusts the position of the check block to achieve the goal of wear leveling.
[0005] The technical solution is a wear leveling method for data stripe reconstruction in RAID5, comprising the following steps:
[0006] S10, monitoring the wear rate of array hard disks;
[0007] S20, determining whether the array needs wear leveling;
[0008] If yes, then S30, calculate the reconstruction value of each strip; if no, then end;
[0009] S40, selecting and reconstructing a data stripe, and continuing to execute S20 after a certain delay;
[0010] Among them, S30 uses a stripe write heat calculation method based on the decay of heat weight over time to evaluate it and calculate the basic reconstruction value of the stripe:
[0011]
[0012] Among them, e is the natural base, △t is the writing time interval, wt i is the number of write requests, μ is the time interval weight, and the value needs to consider the size of △t. Different μ values are selected for different time interval scales.
[0013] Preferably, in S30, for a frequently written data stripe, μ is -1; for a relatively infrequent data stripe, μ is -2; for an extremely infrequent data stripe, μ is -3, wherein the frequent, relatively infrequent and extremely infrequent data stripes are determined by a preset write frequency; the heat score value of the stripe in a certain period is determined by the number of write requests wt in the period. i The total heat score of the strip is obtained by multiplying the weight of the period by the heat score values of these historical periods.
[0014] Preferably, the hard disk life is further added as an influence coefficient in S30, and the hard disk life influence coefficient q is calculated as follows:
[0015]
[0016] Among them, w p is the wear rate of the hard disk where the check block in the current stripe is located, w di is the wear rate of the hard disk where each data block in the current stripe is located. The life impact coefficient q is the ratio of the wear rate of the hard disk where the check block is located to the cumulative wear of the hard disk of the business data block. The higher the wear rate of the hard disk where the check block is located in the stripe, the greater the value of migrating this check block, the greater the hard disk life impact coefficient, and finally the greater the reconstruction value of the stripe.
[0017] Preferably, in S30, the number of read and write requests of the check block and the number of read and write requests of the data block to be exchanged are used as the load compensation coefficient β, and added to the reconstruction value calculation formula. This value represents the magnitude of the impact on the hard disk read and write request load after exchanging the data block, and its calculation formula is as follows:
[0018]
[0019] Among them, W P is the total number of write requests for the parity block of the stripe, R P is the total number of read requests for the parity blocks in the stripe, W D With R DIt is the total number of write requests and read requests corresponding to the data block that is exchanged with the check block.
[0020] Preferably, after adding the load compensation coefficient β and the life influence coefficient q in S30, the calculation formula of the final reconstruction value is:
[0021]
[0022] The reconstruction value score calculated by the above formula is the basis score for the final selection of the target stripe for wear leveling. When stripe reconstruction is required to complete wear leveling, the reconstruction value score of each stripe is calculated separately and the stripe is selected for reconstruction according to the reconstruction value.
[0023] Preferably, the S40 comprises the following steps:
[0024] S41, adding a synchronization flag to the stripe, and at the same time copying the data block to be exchanged to the check block, but the bitmap structure of the data block and check block in the stripe remains unchanged;
[0025] S42, modifying the data structure information in the bitmap. At this time, there is no check block data in the stripe, and there are two duplicate data blocks. The logical positions of the data block and the check block in the bitmap are swapped, that is, the pointers of the two data structures are swapped, and the stripe synchronization bit flag is confirmed again as requiring synchronization;
[0026] S43, regenerates the check block data information, and no additional operation is required. Since the synchronization flag of the stripe indicates that synchronization is required, the array driver automatically adds the stripe to the operation queue and performs synchronization operations, generates new check block information and saves it to the new check block position. At this time, the stripe data reconstruction operation is completed.
[0027] The beneficial effects of the present invention include at least: reconstructing the data stripes in the array by designing a reasonable stripe selection strategy, adjusting the position of the check data block, optimizing the life consumption process of each hard disk in the all-flash hard disk array, achieving the purpose of wear leveling while reducing the impact on the array performance. The idea of variable stripe structure in the elastic stripe method can be used to reorganize the data blocks in the RAID and change the position of the check block in the stripe. According to the read and write characteristics of the check block and the ordinary data block in RAID5, a reasonable stripe selection strategy is designed to reconstruct the data stripes in RAID5, migrate the position of the check block, adjust the read and write access frequency of each hard disk, and optimize the overall solid-state hard disk life consumption rate in the RAID array, thereby improving the stability and reliability of the RAID array, while reducing the impact on the array performance caused by the imbalanced load of each hard disk caused by the reconstruction of the stripe.
[0028] Specifically:
[0029] 1. Compared with the crude migration of check blocks, the wear leveling effect is better through the data stripe reconstruction method;
[0030] 2. When selecting data stripes for reconstruction, the write heat value of the current data stripe is referenced, and the life coefficient of the hard disk is also considered, which is more reasonable;
[0031] 3. To address the load imbalance problem caused by data stripe reorganization, a load compensation strategy is proposed. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A flowchart of the steps of the wear leveling method for data stripe reconstruction in RAID5 of the present invention;
[0033] Figure 2 A schematic diagram of strip reconstruction of the prior art;
[0034] Figure 3 It is a schematic diagram of stripe reconstruction in the wear leveling method of data stripe reconstruction in RAID5 of the present invention. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0036] On the contrary, the present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention as defined by the claims. Further, in order to make the public have a better understanding of the present invention, some specific details are described in detail in the detailed description of the present invention below. Those skilled in the art can fully understand the present invention without the description of these details.
[0037] See also Figure 1-3 , which is a schematic diagram of a wear leveling method for data stripe reconstruction in RAID5 according to an embodiment of the present invention, and a wear leveling method for data stripe reconstruction in RAID5, comprising the following steps:
[0038] S10, monitoring the wear rate of array hard disks;
[0039] S20, determining whether the array needs wear leveling;
[0040] If yes, then S30, calculate the reconstruction value of each strip; if no, then end;
[0041] S40, selecting and reconstructing a data stripe, and continuing to execute S20 after a certain delay;
[0042] Among them, the check blocks in RAID5 are stored in each member hard disk in a dispersed manner, and the positions of the check blocks in different stripes are different. It is unrealistic to adjust the check blocks of each stripe in the array. If all check blocks are migrated to the hard disk with the longest remaining life, the read and write rate of the hard disk will become the performance bottleneck of the entire array, and a large amount of computing resources and hard disk life will be wasted. Therefore, it is necessary to select appropriate check blocks for migration. In order to make the reconstruction of a single stripe adjust the hard disk write load as much as possible, and at the same time reduce the system resources consumed by the stripe reconstruction, the number of write requests actually generated by these stripes and the temporal correlation of the stripe load must be considered first when selecting. Therefore, a stripe write heat calculation method based on the decay of heat weight over time is used to evaluate it. Therefore, in S30, a stripe write heat calculation method based on the decay of heat weight over time is used to evaluate it and calculate the basic reconstruction value of the stripe:
[0043]
[0044] Among them, e is the natural base, △t is the writing time interval, wt i is the number of write requests, μ is the time interval weight, and the value needs to consider the size of △t. Different μ values are selected for different time interval scales. For frequently written data stripes, μ is -1; for relatively infrequent data stripes, μ is -2; for extremely infrequent data stripes, μ is -3. The frequent, relatively infrequent and extremely infrequent data stripes are determined by the preset write frequency; the heat score value of the stripe in a certain period of time is determined by the number of write requests in that period, wt i The total heat score of the strip is obtained by multiplying the weight of the period by the heat score values of these historical periods.
[0045] When performing stripe reconstruction, the check block's migration-in block should belong to the hard disk with the longest remaining life in the array, but there are multiple possibilities for the check block's migration-out block. Except for the hard disk with the longest remaining life, the check blocks on other hard disks may become the hard disk where the migration-out block is located. As long as the check block P in the stripe does not belong to the hard disk with the longest remaining life, the stripe block may become the target stripe for reconstruction. The goal of wear leveling is not only to increase the life consumption rate of the hard disk with the least wear rate, but also to reduce the life consumption rate of the hard disk with the highest wear rate. In order to consider this strategy when selecting the target stripe, the hard disk life is added as an influence coefficient in the stripe heat algorithm. The hard disk life influence coefficient q is calculated as follows:
[0046]
[0047] Among them, w p is the wear rate of the hard disk where the check block P in the current stripe is located, w diis the wear rate of the hard disk where each data block in the current stripe is located. The life impact coefficient q is the ratio of the wear rate of the hard disk where the check block is located to the cumulative wear of the hard disk of the business data block. The higher the wear rate of the hard disk where the check block is located in the stripe, the greater the value of migrating this check block, the greater the hard disk life impact coefficient, and finally the greater the reconstruction value of the stripe.
[0048] The advantage of RAID5 over RAID4 is that it evenly distributes the parity blocks P on multiple hard disks in the array, avoiding the performance bottleneck caused by the concentration of parity blocks P on a certain hard disk. However, the uniform distribution structure of the parity blocks is broken by reconstructing the stripe, and more parity blocks P are distributed on hard disks with lower wear rates, which makes it easier for these hard disks to reach the read and write performance bottleneck, and thus become the performance bottleneck of the entire hard disk array. Figure 2 , Stripe reconstruction will cause uneven distribution of write requests.
[0049] In order to solve the problem of load imbalance and ensure that the total read and write load of each hard disk remains roughly unchanged, the changed write request load must be compensated. Since the life consumption rate of the solid-state hard disk is mainly affected by the write request, the read request in the array can be used as compensation for the changed write request load. Therefore, in S30, the number of read and write requests of the check block and the number of read and write requests of the data block to be exchanged are used as the load compensation coefficient β and added to the reconstruction value calculation formula. This value represents the impact of the exchange of data blocks on the hard disk read and write request load. The calculation formula is as follows:
[0050]
[0051] Among them, W P is the total number of write requests for the parity block of the stripe, R P is the total number of read requests for the parity blocks in the stripe, W D With R D It is the total number of write requests and read requests corresponding to the data block that is exchanged with the check block.
[0052] After adding the load compensation coefficient β and the life influence coefficient q to S30, the calculation formula for the final reconstruction value is:
[0053]
[0054] The reconstruction value score calculated by the above formula is the basis score for the final selection of the target stripe for wear leveling. When stripe reconstruction is required to complete wear leveling, the reconstruction value score of each stripe is calculated separately and the stripe is selected for reconstruction according to the reconstruction value.
[0055] For the selection of the check block, the present invention adopts a stripe write heat calculation method based on the decay of heat weight over time to calculate the basic reconstruction value. In order to increase the life consumption rate of the hard disk with the lowest wear rate while reducing the life consumption rate of the hard disk with the highest wear rate, the hard disk life impact coefficient is added when calculating the reconstruction value. In order to prevent the reconstruction of the stripe from causing an unbalanced load on each hard disk and causing an impact on the array performance, a load compensation coefficient is added when calculating the reconstruction value to achieve the effect of compensating and optimizing the load of the changed write request.
[0056] In order to record the information of each stripe in the array, each hard disk array has a bitmap file to record the location information of the data blocks in the array. Each bit corresponds to a block in the array. The bit flag is changed before data is written and cleared after writing. The main flags in the bitmap structure are the resync needed bit, which indicates whether the stripe needs to be synchronized, and the resync active bit, which indicates whether the stripe is being synchronized. When migrating data, the bitmap information must be changed at the same time to maintain the consistency of the data, and the migration can only be performed when the stripe is not in the write state. For the reconstruction process, see Figure 3 , S40 comprises the following steps:
[0057] S41, adding a synchronization flag to the stripe, and at the same time copying the data block to be exchanged to the check block, but the bitmap structure of the data block and check block in the stripe remains unchanged;
[0058] S42, modifying the data structure information in the bitmap. At this time, there is no check block data in the stripe, and there are two duplicate data blocks. The logical positions of the data block and the check block in the bitmap are swapped, that is, the pointers of the two data structures are swapped, and the stripe synchronization bit flag is confirmed again as requiring synchronization;
[0059] S43, regenerates the check block data information, and no additional operation is required. Since the synchronization flag of the stripe indicates that synchronization is required, the array driver automatically adds the stripe to the operation queue and performs synchronization operations, generates new check block information and saves it to the new check block position. At this time, the stripe data reconstruction operation is completed.
[0060] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A wear leveling method for data stripe reconstruction in RAID5, characterized in that: The following steps are involved: S10, monitoring the wear rate of array hard disks; S20, determining whether the array needs wear leveling; If yes, then S30, calculate the reconstruction value of each strip; If not, then end; S40, selecting and reconstructing a data stripe, and continuing to execute S20 after a certain delay; Among them, S30 uses a stripe write heat calculation method based on the decay of heat weight over time to evaluate it and calculate the basic reconstruction value of the stripe: Among them, e is the natural base, △t is the writing time interval, wt i is the number of write requests, μ is the time interval weight, and the value needs to consider the size of △t. Different μ values are selected for different time interval scales to distinguish them; In S30, for a frequently written data stripe, μ is -1; for a relatively infrequent data stripe, μ is -2; for an extremely infrequent data stripe, μ is -3, where frequent, relatively infrequent, and extremely infrequent are determined by a preset write frequency; the heat score value of a stripe in a certain period is determined by the number of write requests in that period, wt i The total heat score of the strip is obtained by multiplying the weight of the period by the heat score of these historical periods. In the step S30, the hard disk life is further added as an influence coefficient. The hard disk life influence coefficient q is calculated as follows: Among them, w p is the wear rate of the hard disk where the check block in the current stripe is located, w di is the wear rate of the hard disk where each data block in the current stripe is located. The life impact coefficient q is the ratio of the wear rate of the hard disk where the check block is located to the accumulated wear of the hard disk where the business data block is located. The higher the wear rate of the hard disk where the check block is located in the stripe, the greater the value of migrating this check block, the greater the hard disk life impact coefficient, and the greater the reconstruction value of the stripe in the end; In S30, the number of read and write requests of the check block and the number of read and write requests of the data block to be exchanged are used as the load compensation coefficient β, and added into the reconstruction value calculation formula. β represents the magnitude of the impact on the hard disk read and write request load after exchanging the data block. The calculation formula is as follows: Among them, W P is the total number of write requests for the parity block in the stripe, R P is the total number of read requests for the parity blocks in the stripe, W D With R D It is the total number of write requests and read requests corresponding to the data block that is exchanged with the check block; After adding the load compensation coefficient β and the life influence coefficient q in S30, the calculation formula of the final reconstruction value is: The reconstruction value score calculated by the above formula is the basis score for the final selection of the target stripe for wear leveling. When stripe reconstruction is required to complete wear leveling, the reconstruction value score of each stripe is calculated separately and the stripe is selected for reconstruction according to the reconstruction value.
2. A wear leveling method for data stripe reconstruction in RAID5 according to claim 1, characterized in that: The S40 comprises the following steps: S41, adding a synchronization flag to the stripe, and at the same time copying the data block to be exchanged to the check block, but the bitmap structure of the data block and check block in the stripe remains unchanged; S42, modifying the data structure information in the bitmap. At this time, there is no check block data in the stripe, and there are two duplicate data blocks. The logical positions of the data block and the check block in the bitmap are swapped, that is, the pointers of the two data structures are swapped, and the stripe synchronization bit flag is confirmed again as requiring synchronization; S43, regenerates the check block data information, and no additional operation is required. Since the synchronization flag of the stripe indicates that synchronization is required, the array driver automatically adds the stripe to the operation queue and performs synchronization operations, generates new check block information and saves it to the new check block position. At this time, the stripe data reconstruction operation is completed.
Citation Information
Patent Citations
Physical hard disk wear leveling method, device and system
CN108205423A