Solid state drive bad block wear leveling method and system, medium, and program product

By dividing the solid-state drive into sub-regions and establishing a data block rotation link, and dynamically managing local and global spare blocks, the problem of uneven wear caused by the spatial correlation of bad blocks in the solid-state drive is solved, thereby improving the utilization efficiency of spare blocks and the lifespan of the hard drive.

WO2026157006A1PCT designated stage Publication Date: 2026-07-30SHENZHEN QINGFEN TINGXIU INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
SHENZHEN QINGFEN TINGXIU INFORMATION TECHNOLOGY CO LTD
Filing Date
2025-03-24
Publication Date
2026-07-30

AI Technical Summary

Technical Problem

Bad blocks in solid-state drives (SSDs) exhibit spatial correlation, leading to low utilization efficiency of spare blocks and shortening the lifespan of the drive.

Method used

The storage area of ​​the solid-state drive is divided into sub-regions, and a sub-region distribution table is generated. A data block rotation link is established. Through periodic rotation operations and data migration, combined with the dynamic management of local and global spare blocks, the access order and migration path of data blocks are optimized to achieve wear leveling.

Benefits of technology

It improves the utilization efficiency of spare blocks, reduces the risk of bad block propagation, extends the lifespan of solid-state drives, and optimizes data access performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025084346_30072026_PF_FP_ABST
    Figure CN2025084346_30072026_PF_FP_ABST
Patent Text Reader

Abstract

A solid state drive bad block wear leveling method and system, a medium, and a program product, relating to the field of electric digital data processing. The method comprises: dividing a storage region of a solid state drive into a plurality of sub-regions, and generating a sub-region distribution table (S101); establishing a data block round-robin link in each sub-region on the basis of the sub-region distribution table and recording same as a round-robin sequence table (S102); executing a data block round-robin operation according to a predefined cycle, and recording a wear state of each sub-region (S103); upon detecting that a new bad block has been added, marking a sub-region comprising the bad block in the sub-region distribution table as a source region to be migrated (S104); according to a bad block count and the wear states recorded in the sub-region distribution table, selecting as a target region a sub-region having the smallest cumulative wear value from among the sub-regions other than the sub-region comprising the bad block, and establishing a mapping relationship between the source region to be migrated and the target region (S105); and on the basis of the mapping relationship and the round-robin sequence table, migrating data in a sub-region to be migrated to the target region according to a sequence in the round-robin sequence table (S106).
Need to check novelty before this filing date? Find Prior Art

Description

A method, system, media, and program product for wear leveling of bad blocks in a solid-state drive. Technical Field

[0001] This application belongs to the field of electronic digital data processing, and in particular relates to a method, system, medium and program product for wear leveling of bad blocks in a solid-state drive. Background Technology

[0002] Solid-state drives (SSDs), as a new generation of storage devices, offer faster read and write speeds and higher reliability compared to traditional hard disk drives (HDDs). However, due to the limited number of write cycles of NAND flash memory cells, frequent data writing to the same area can lead to excessive wear and tear on that area, thus reducing the lifespan of the SSD. When bad blocks appear in certain storage areas, without a suitable wear leveling strategy, the burden on other normal areas will be exacerbated, further shortening the lifespan of the SSD.

[0003] In related technologies, spare block areas are typically set up in solid-state drives (SSDs). When a storage block is detected as bad, it is mapped to a good block in the spare block area. Simultaneously, wear leveling is achieved by dynamically distributing write operations across different physical blocks. By replacing spare blocks and dynamically allocating writes, the problem of excessive wear in localized areas is mitigated to some extent.

[0004] However, as solid-state drives (SSDs) are used for longer periods, the generation of bad blocks often exhibits a certain spatial correlation. That is, once a storage block becomes a bad block, its surrounding areas may also become bad blocks in the subsequent process due to similar usage pressure. This reduces the utilization efficiency of spare blocks and shortens the lifespan of the SSD. Summary of the Invention

[0005] This application provides a method, system, media, and program product for wear leveling of bad blocks in a solid-state drive (SSD), which improves the utilization efficiency of spare blocks and thus extends the lifespan of the SSD.

[0006] Firstly, this application provides a method for wear leveling of bad blocks in a solid-state drive (SSD). The SSD's storage area is divided into several sub-regions, and a sub-region distribution table is generated. Each sub-region contains a preset number of storage blocks and corresponding local spare blocks. Based on the sub-region distribution table, a data block rotation link is established within each sub-region and recorded as a rotation sequence table. Data block rotation operations are performed according to a preset period, and the wear status of each sub-region is recorded. When a new bad block is detected, the sub-region containing the bad block is marked as a source region to be migrated in the sub-region distribution table. Based on the number of bad blocks and wear status recorded in the sub-region distribution table, the sub-region with the smallest cumulative wear value is selected as the target region from the other sub-regions excluding the sub-region containing the bad block, and a mapping relationship is established between the source region to be migrated and the target region. Based on the mapping relationship and the rotation sequence table, the data in the source region to be migrated is migrated to the target region in the order specified in the rotation sequence table.

[0007] In conjunction with some embodiments of the first aspect, in some embodiments, the storage area of ​​the solid-state drive (SSD) is divided into several sub-regions, and a sub-region distribution table is generated. Specifically, this includes: dividing the SSD storage area into several pre-divided sub-regions based on the physical distribution characteristics of the storage blocks; performing cluster analysis on the pre-divided sub-regions to calculate the access frequency and data update rate of the storage blocks in each pre-divided sub-region; reorganizing the pre-divided sub-regions according to the access frequency and data update rate, merging pre-divided sub-regions with the same access pattern into target sub-regions; allocating local spare blocks to each target sub-region, wherein the number of local spare blocks is positively correlated with the data update rate of the target sub-region; and generating a sub-region distribution table based on the boundary information of the target sub-regions and the allocation results of the local spare blocks.

[0008] In conjunction with some embodiments of the first aspect, in some embodiments, a data block round-robin link is established in each sub-region based on the sub-region distribution table and recorded as a round-robin sequence table. Specifically, this includes: counting the number of accesses and the most recent access time of storage blocks in each sub-region within a preset time window; dividing the storage blocks in each sub-region into high-frequency access blocks, medium-frequency access blocks, and low-frequency access blocks according to the number of accesses and the most recent access time; constructing a data block round-robin link in each sub-region, with high-frequency access blocks, medium-frequency access blocks, and low-frequency access blocks forming independent ring sub-links in the data block round-robin link; setting up data block exchange paths between ring sub-links; when the access characteristics of a storage block change, migrating the storage block to the corresponding level of ring sub-link through the data block exchange path; calculating the round-robin interval time for each ring sub-link, where the round-robin interval time is inversely proportional to the average number of accesses of the storage blocks in the ring sub-link; and recording the structure information of the data block round-robin link, the data block exchange path, and the round-robin interval time in the round-robin sequence table.

[0009] In conjunction with some embodiments of the first aspect, in some embodiments, after migrating data from the source region to the target region according to the order in the round-robin sequence list based on the mapping relationship and the round-robin sequence list, the method further includes: merging and numbering the original data blocks in the target region with the migrated data blocks, regenerating the round-robin link of the target region, and updating the round-robin sequence list of the target region; marking the remaining normal storage blocks in the source region to be migrated as global spare blocks, and recording the physical location information and wear value of the global spare blocks; statistically analyzing the historical migration records of each sub-region in the sub-region distribution table; marking sub-regions with continuous migration relationships in the historical migration records as migration association groups, and obtaining sub-region grouping information. The process involves: calculating the average wear value of storage blocks in each sub-region and determining the wear leveling coefficient of each sub-region by combining the migration association group marker in the sub-region grouping information table; generating a rotation rate adjustment factor for each sub-region based on the wear leveling coefficient, with the adjustment factor being inversely proportional to the wear leveling coefficient; updating the rotation interval time in the rotation sequence table of each sub-region based on the adjustment factor; calculating the current storage capacity and average wear value of each sub-region when the number of global spare blocks reaches a preset number; allocating global spare blocks according to the reverse leveling principle based on the capacity utilization and wear leveling requirements of each sub-region; regenerating the sub-region distribution table based on the spare block allocation results and adjusting the rotation sequence table of each sub-region.

[0010] In conjunction with some embodiments of the first aspect, in some embodiments, the rotation rate adjustment factor for each sub-region is generated based on the wear leveling coefficient. Specifically, this includes: calculating the standard deviation of the wear values ​​of storage blocks in each sub-region; weighting and correcting the wear leveling coefficient according to the standard deviation to obtain a correction coefficient; calculating an initial adjustment factor for the rotation rate based on the correction coefficient, wherein the initial adjustment factor is inversely proportional to the correction coefficient; statistically analyzing the bad block growth rate of each sub-region within a preset time period and using the bad block growth rate as a risk factor; and multiplying the initial adjustment factor by the risk factor to obtain the rotation rate adjustment factor.

[0011] In conjunction with some embodiments of the first aspect, in some embodiments, before allocating global spare blocks according to the reverse balancing principle based on the capacity utilization and wear leveling requirements of each sub-region, the method further includes: calculating the effective data density of each sub-region, where the effective data density is the proportion of non-idle storage blocks in the sub-region; calculating the data update frequency of each sub-region; calculating the spare block demand of each sub-region based on the effective data density and data update frequency; dividing the global spare blocks into several wear levels according to the wear value corresponding to the global spare blocks and a preset wear value range; and determining the quota of global spare blocks of different wear levels that can be obtained by each sub-region according to the spare block demand.

[0012] In conjunction with some embodiments of the first aspect, in some embodiments, the global spare block quantity quota for each sub-region at different wear levels is determined based on the spare block demand. Specifically, this includes: counting the global spare block quantity for each wear level and calculating the proportion of spare blocks for each wear level; calculating an initial allocation weight based on the spare block demand of each sub-region, wherein the initial allocation weight is proportional to the spare block demand; correcting the initial allocation weight based on the current average wear value of each sub-region to obtain a corrected allocation weight; and calculating the global spare block quantity quota for each sub-region at each wear level based on the corrected allocation weight and the proportion of spare blocks for each wear level.

[0013] Secondly, embodiments of this application provide a solid-state drive (SSD) bad block wear leveling system, which includes: one or more processors and a memory; the memory is coupled to one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and one or more processors call the computer instructions to cause the system to perform the method described in the first aspect and any possible implementation thereof.

[0014] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a system, cause the system to perform the method described in the first aspect and any possible implementation thereof.

[0015] Fourthly, embodiments of this application provide a computer program product, characterized in that, when the computer program product is run on a system, it causes the system to execute the method described in any possible implementation of the first aspect. Attached Figure Description

[0016] Figure 1 is a flowchart illustrating a solid-state drive bad block wear leveling method according to an embodiment of this application.

[0017] Figure 2 is another flowchart illustrating a solid-state drive bad block wear leveling method according to an embodiment of this application.

[0018] Figure 3 is a schematic diagram of the physical device structure of a solid-state drive bad block wear leveling system provided in an embodiment of this application. Detailed Implementation

[0019] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to any or all possible combinations including one or more of the listed items.

[0020] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0021] The following describes a solid-state drive bad block wear leveling method according to an embodiment of this application, in conjunction with Figure 1:

[0022] Please refer to Figure 1, which is a flowchart illustrating a solid-state drive bad block wear leveling method according to an embodiment of this application.

[0023] S101. Divide the storage area of ​​the solid-state drive into several sub-regions and generate a sub-region distribution table;

[0024] The system divides the solid-state drive's storage area into several sub-regions and generates a sub-region distribution table. Each sub-region contains a preset number of storage blocks and corresponding local spare blocks. Specifically: the solid-state drive's storage area is divided into several pre-divided sub-regions based on the physical distribution characteristics of the storage blocks;

[0025] Cluster analysis is performed on the pre-divided sub-regions to calculate the access frequency and data update rate of storage blocks within each pre-divided sub-region;

[0026] The pre-divided sub-regions are reorganized based on access frequency and data update rate, and pre-divided sub-regions with the same access pattern are merged into the target sub-region.

[0027] Local spare blocks are allocated to each target sub-region, and the number of local spare blocks is positively correlated with the data update rate of the target sub-region.

[0028] A sub-region distribution table is generated based on the boundary information of the target sub-region and the allocation results of local spare blocks.

[0029] This step involves partitioning and managing the storage areas of the solid-state drive (SSD). First, the system divides the SSD's storage area into multiple pre-partitioned sub-regions based on the physical distribution characteristics of the storage blocks. Then, the system performs cluster analysis on these pre-partitioned sub-regions, calculating the access frequency and data update rate of the storage blocks within each sub-region. Next, the system reorganizes the pre-partitioned sub-regions according to the access frequency and data update rate, merging pre-partitioned sub-regions with similar access patterns into target sub-regions. This ensures that storage blocks with the same access pattern are grouped into the same sub-region. Finally, the system allocates local spare blocks to each target sub-region. The number of local spare blocks is proportional to the data update rate of the target sub-region, achieving on-demand allocation of spare resources. A sub-region distribution table is generated based on the boundary information of the target sub-regions and the local spare block allocation results.

[0030] When partitioning sub-regions, the system can employ various specific methods. For example, it can partition based on features such as the physical address range, capacity, and data type of storage blocks. During cluster analysis, the system can use machine learning methods such as K-means clustering and hierarchical clustering to cluster pre-partitioned sub-regions based on access frequency and data update rate, grouping sub-regions with similar access patterns into one category. When allocating local spare blocks, the system can set a threshold; when the data update rate of a target sub-region exceeds this threshold, the system allocates more local spare blocks to that sub-region to handle frequent data update operations.

[0031] During the generation of the sub-region distribution table, the system may encounter insufficient storage capacity. To address this issue, the system can dynamically adjust the size and number of sub-regions. When the system detects that a sub-region's storage capacity is insufficient, it can merge that sub-region with adjacent sub-regions or borrow storage space from other sub-regions. Simultaneously, the system can also dynamically adjust the granularity of sub-region partitioning based on SSD usage. During periods of frequent data access, the system can divide the storage area into more sub-regions to improve data access concurrency; while during periods of less frequent data access, the system can merge sub-regions to reduce management overhead.

[0032] This region partitioning method based on access characteristics allows storage blocks with similar access patterns to be centrally managed, reducing the probability of cross-regional data access and migration. The positive correlation between the number of local spare blocks and the data update rate ensures that frequently updated regions receive more spare resources, reducing local wear caused by frequent updates, improving storage resource utilization efficiency, and extending the lifespan of solid-state drives.

[0033] S102. Based on the sub-regional distribution table, establish data block rotation links in each sub-region and record them as a rotation sequence table;

[0034] The system establishes data block rotation links within each sub-region based on the sub-region distribution table and records them as a rotation sequence table, specifically including:

[0035] Count the number of accesses and the most recent access time of storage blocks in each sub-region within a preset time window;

[0036] Based on the number of accesses and the most recent access time, the storage blocks in each sub-region are divided into high-frequency access blocks, medium-frequency access blocks, and low-frequency access blocks;

[0037] In each sub-region, a data block rotation link is constructed, with high-frequency access blocks, medium-frequency access blocks, and low-frequency access blocks forming independent ring sub-links in the data block rotation link;

[0038] Configure data block exchange paths between ring sub-links;

[0039] When the access characteristics of a storage block (including the number of accesses and the time of the most recent access) change, the storage block is migrated to the corresponding level of the ring sub-link through the data block exchange path;

[0040] Calculate the round-robin interval for each ring sub-link. The round-robin interval is inversely proportional to the average number of accesses to the storage blocks in the ring sub-link.

[0041] Record the structure information of the data block round-robin link, the data block exchange path, and the round-robin interval in the round-robin sequence table.

[0042] This step establishes a data block round-robin link within each sub-region to manage and optimize the access order of data blocks. The system first counts the number of accesses and the most recent access time of storage blocks within each sub-region within a preset time window. Then, based on the number of accesses and the most recent access time, the system categorizes the storage blocks within each sub-region into high-frequency access blocks, mid-frequency access blocks, and low-frequency access blocks. Next, the system constructs a data block round-robin link within each sub-region, with high-frequency, mid-frequency, and low-frequency access blocks forming independent ring sub-links within the data block round-robin link. The system also sets up data block exchange paths between ring sub-links. When the access characteristics of a storage block change, it can be migrated to the corresponding ring sub-link level through these data block exchange paths. The data block exchange paths between ring sub-links allow storage blocks to dynamically adjust their frequency level based on changes in access characteristics. By dynamically adjusting the frequency level of storage blocks, the system can adapt to changes in data access patterns, achieving wear leveling while maintaining access performance. Finally, the system calculates the round-robin interval for each ring sub-link. The round-robin interval is inversely proportional to the average number of accesses to the storage blocks in the ring sub-link. The system also records the structural information of the data block round-robin link, the data block exchange path, and the round-robin interval in the round-robin sequence table. This design, where the round-robin interval is inversely proportional to the average number of accesses, allows frequently accessed storage blocks to receive more frequent round-robin opportunities, achieving fine-grained load balancing and reducing wear on high-frequency accessed storage blocks.

[0043] When establishing data block rotation links, the system can employ various specific techniques. For example, the system can use data structures such as linked lists and circular queues to implement circular sub-links. When setting up data block exchange paths, the system can use pointers, indexes, and other methods to establish associations between different circular sub-links. When calculating the rotation interval, the system can use algorithms such as weighted averaging and exponential smoothing to dynamically adjust the rotation interval based on the historical access patterns of storage blocks, adapting to changes in data access patterns.

[0044] During the establishment of data block rotation links, the system may encounter link breakage issues. To address this, the system can introduce a redundancy mechanism, setting up multiple backup links for each ring sub-link. When a ring sub-link breaks, the system can automatically switch to a backup link, ensuring the integrity of the data block rotation links. Simultaneously, the system can periodically check and repair the data block rotation links, promptly identifying and resolving any anomalies.

[0045] S103. Perform data block rotation operation according to the preset cycle and record the wear status of each sub-region;

[0046] Based on information in the rotation sequence list, the system performs rotation operations on data blocks in each sub-region at preset intervals. Regular data block rotation balances the access frequency and wear level of each storage block, extending the lifespan of the solid-state drive. While performing the rotation operation, the system monitors and records the wear status of each sub-region in real time, including metrics such as write / erase cycles and the number of bad blocks.

[0047] S104. When a new bad block is detected, the sub-region containing the bad block is marked as a source region to be migrated in the sub-region distribution table.

[0048] When the system detects a new bad block in the solid-state drive (SSD), it locates the sub-region containing the bad block in the sub-region distribution table and marks it as a source region to be migrated. This marking indicates that the data in that sub-region needs to be migrated to other sub-regions to avoid the impact of the bad block on data reliability.

[0049] S105. Based on the number of bad blocks and wear status recorded in the sub-region distribution table, select the sub-region with the smallest cumulative wear value from the sub-regions other than those containing bad blocks as the target region, and establish a mapping relationship between the source region to be migrated and the target region.

[0050] After identifying the source region to be migrated, the system selects the sub-region with the lowest wear level from the remaining sub-regions as the target region for data migration. Specifically, the system first excludes sub-regions containing bad blocks, then compares the cumulative wear values ​​of the remaining sub-regions, selecting the sub-region with the lowest wear value as the target region. Next, the system establishes a mapping relationship between the source region and the target region to prepare for subsequent data migration.

[0051] When selecting target areas, the system can comprehensively consider multiple factors, such as the space utilization rate and I / O load of sub-regions. For example, the system can prioritize sub-regions with lower space utilization and lighter I / O load as target areas to balance the resource usage of each sub-region. In addition, the system can set a threshold; when the cumulative wear value of a sub-region exceeds the threshold, it is marked as a high-risk area, and data migration to high-risk areas should be avoided as much as possible.

[0052] S106. Based on the mapping relationship and the round-robin sequence list, migrate the data in the source region to be migrated to the target region in the order in the round-robin sequence list.

[0053] After establishing the mapping relationship between the source and target regions, the system begins the data migration operation. The system copies data from the source region to the target region sequentially, according to the order recorded in the round-robin sequence list. By migrating according to the order of the round-robin sequence list, data locality can be maintained to the maximum extent, minimizing the impact of data migration on system performance.

[0054] During data migration, the system can employ various optimization strategies. For example, based on data block access frequency, the system can prioritize migrating frequently accessed "hot" data and delay migrating less frequently accessed "cold" data. This allows for faster migration of hot data and improves system response speed. Additionally, the system can utilize idle time for data migration, such as performing migration operations when system I / O load is low, to minimize impact on normal business operations. Furthermore, the system can employ incremental migration, migrating only incremental data from the source region instead of copying the entire dataset, thereby shortening migration time and reducing system overhead.

[0055] In the above embodiments, dividing the solid-state drive (SSD) storage area into sub-regions and establishing a sub-region distribution table enables partitioned management of storage blocks, ensuring that each sub-region has independent local spare block resources. Establishing a data block rotation link within the sub-regions and performing periodic rotation operations helps to balance the usage load of the storage blocks. When a new bad block is detected, the optimal target region is selected for data migration based on the number of bad blocks and their wear status recorded in the sub-region distribution table, avoiding migration of data to regions with high wear levels. By establishing a mapping relationship between the source region to be migrated and the target region, and performing data migration according to the rotation sequence list, the continuity of access patterns during data migration is improved, the impact of data migration on system performance is reduced, the risk of bad block propagation is lowered, the utilization efficiency of spare blocks is improved, and thus the lifespan of the SSD is extended.

[0056] The above embodiments have implemented basic bad block wear leveling functionality. However, to further improve the wear leveling effect and overall system performance, this application also provides another optimized solid-state drive (SSD) bad block wear leveling method. This method, after data migration is complete, achieves more refined wear leveling control by establishing migration association groups, dynamically adjusting data block rotation rates, and rationally allocating global spare blocks. The following description, with reference to Figure 2, illustrates another SSD bad block wear leveling method in this application:

[0057] Please refer to Figure 2, which is another flowchart of a solid-state drive bad block wear leveling method in an embodiment of this application.

[0058] S201. Merge and number the existing data blocks in the target area with the migrated data blocks, regenerate the round-robin links in the target area, and update the round-robin sequence table in the target area;

[0059] After data migration is complete, the system needs to reorganize and manage the target area. First, the system merges and numbers the existing data blocks in the target area with the data blocks migrated from the source area. This merging allows for unified management of the two sets of data blocks, avoiding management difficulties caused by discontinuous numbering. Next, the system regenerates the rotation links for the target area based on the merged data blocks. Since new data blocks have been introduced, the original rotation links may not meet the data access requirements; therefore, the rotation links need to be reconstructed to optimize the access order of the data blocks. Finally, the system updates the rotation sequence table for the target area based on the newly generated rotation links, ensuring that subsequent data block rotation operations are executed in the latest order.

[0060] When merging numbering, the system can employ various methods, such as following the physical address order or logical address order of data blocks. Simultaneously, the system can consider data block attribute information, such as access frequency and data type, grouping data blocks with similar attributes together to improve data access efficiency. When regenerating the round-robin link, the system can use heuristic algorithms, machine learning algorithms, and other methods to find the optimal data block access order based on historical access patterns and current wear status. For example, the system can organize data blocks with similar access frequencies into the same round-robin link, reducing the number of switching operations between data blocks.

[0061] S202. Mark the remaining normal storage blocks in the source area to be migrated as global spare blocks, and record the physical location information and wear value of the global spare blocks;

[0062] After data migration is complete, some normal storage blocks may still exist in the source region to be migrated. To make full use of these storage resources, the system marks these remaining normal storage blocks as global spare blocks. Global spare blocks can be used in any sub-region to replace bad blocks or expand storage space. While marking global spare blocks, the system also records the physical location information and current wear value of each global spare block. The physical location information includes the physical address range where the global spare block is located, and the wear value indicates the current degree of wear of the global spare block.

[0063] When marking global spare blocks, the system can use data structures such as bitmaps and linked lists to manage them. For example, the system can use a bitmap to identify the state of each storage block, setting the corresponding bit in the source region to be migrated to 1 to indicate that it is a global spare block. When recording physical location information, the system can use physical address ranges, physical block numbers, etc., to represent the location of global spare blocks. When recording wear values, the system can use metrics such as erase / write cycles and bit error rate to measure the wear degree of global spare blocks.

[0064] When replacing bad blocks with global spare blocks, the system may encounter a shortage of spare blocks. To address this issue, the system can set a minimum threshold for global spare blocks. When the number of global spare blocks falls below this threshold, the system can select a subset of storage blocks from sub-regions with less wear and mark them as global spare blocks to ensure sufficient global spare blocks. Simultaneously, the system can dynamically adjust the allocation strategy of global spare blocks based on the distribution of bad blocks. For example, for sub-regions with frequent bad blocks, the system can prioritize allocating replacement blocks from global spare blocks; while for sub-regions with fewer bad blocks, the system can reduce the allocation of global spare blocks to improve storage space utilization.

[0065] S203, Historical migration records of each sub-region in the statistical sub-region distribution table;

[0066] To better understand the data migration between sub-regions, the system needs to compile historical migration records from the sub-region distribution table. These records include information such as the source region, target region, and migration time for each data migration. By analyzing these historical records, the system can discover migration patterns and relationships between sub-regions, providing a basis for subsequent wear leveling control.

[0067] S204. Mark the sub-regions with continuous migration relationships in the historical migration records as migration association groups to obtain the sub-region grouping information table;

[0068] Based on statistical results from historical migration records, the system can identify frequent data migration behaviors between certain sub-regions. If the number of data migrations between two sub-regions exceeds a preset threshold, and the migration direction is continuous (i.e., data in region A always migrates to region B), then the system will mark these two sub-regions as a migration association group. A migration association group indicates that these sub-regions have a close relationship during the data migration process and require unified wear leveling control.

[0069] When labeling migration association groups, the system can use graph theory algorithms, treating sub-regions as nodes in a graph and consecutive migration relationships as directed edges. By analyzing the connectivity and strongly connected components of the graph, migration association groups can be identified. For example, the system can use the Kosaraju algorithm or the Tarjan algorithm to find the strongly connected components in the graph; each strongly connected component represents a migration association group. After obtaining the migration association groups, the system generates a sub-region grouping information table, recording the sub-region numbers contained in each migration association group.

[0070] S205. Calculate the average wear value of storage blocks in each sub-region, and determine the wear leveling coefficient of each sub-region by combining the migration association group marker in the sub-region grouping information table.

[0071] After obtaining the sub-region grouping information table, the system needs to evaluate the wear leveling of each sub-region in order to perform targeted wear leveling control. First, the system calculates the average wear value of the storage blocks within each sub-region as an indicator of the overall wear level of the sub-region. The higher the average wear value, the more severe the wear within the sub-region.

[0072] Next, the system uses the migration association group markers in the sub-region grouping information table to determine the wear leveling coefficient for each sub-region. The wear leveling coefficient indicates the priority and control intensity of the sub-region during the wear leveling process. Specifically, if a sub-region belongs to a migration association group and its average wear value is higher than other sub-regions within that group, the system will assign it a higher wear leveling coefficient, indicating that the sub-region requires priority wear leveling control and increased wear leveling intensity. Conversely, if a sub-region's average wear value is lower than other sub-regions in the same group, or if the sub-region does not belong to any migration association group, the system will assign it a lower wear leveling coefficient, indicating that the wear leveling priority for that sub-region is lower.

[0073] When determining the wear leveling coefficient, the system can employ various calculation methods, such as the weighted average method and the proportional scaling method. For example, the system can compare the average wear value of a sub-region with the average wear value of other sub-regions within the migration association group to calculate the wear difference; then, based on the magnitude of the wear difference, it can linearly scale to obtain the wear leveling coefficient. Furthermore, the system can introduce other influencing factors, such as the size of the sub-region and the data type of the sub-region, to obtain a more reasonable wear leveling coefficient by comprehensively considering multiple factors.

[0074] S206. Generate the rotational speed adjustment factor for each sub-region based on the wear equalization coefficient;

[0075] The system generates a rotational speed adjustment factor for each sub-region based on the wear leveling coefficient. The adjustment factor is inversely proportional to the wear leveling coefficient and includes:

[0076] Calculate the standard deviation of the wear values ​​of storage blocks in each sub-region;

[0077] The wear equilibrium coefficient is weighted and corrected based on the standard deviation to obtain the correction coefficient.

[0078] The initial adjustment factor for the rotational speed is calculated based on the correction coefficient, and the initial adjustment factor is inversely proportional to the correction coefficient.

[0079] The rate of bad block growth in each sub-region is statistically analyzed within a preset time period, and the rate of bad block growth is used as a risk factor.

[0080] Multiply the initial adjustment factor by the risk factor to obtain the rotation rate adjustment factor.

[0081] The system generates a rotation rate adjustment factor for each sub-region based on the wear leveling coefficient. The rotation rate adjustment factor represents the frequency and priority of data block rotation operations in the sub-region. The adjustment factor is inversely proportional to the wear leveling coefficient; that is, the higher the wear leveling coefficient of a sub-region, the lower its rotation rate adjustment factor, indicating that the frequency of data block rotation operations in that sub-region should be reduced to slow down the wear rate.

[0082] When generating the rotation rate adjustment factor, the system first calculates the standard deviation of the wear values ​​of storage blocks within each sub-region. The standard deviation represents the dispersion of wear levels within a sub-region. A larger standard deviation indicates greater wear differences within the sub-region, requiring more frequent data block rotation operations to balance wear within the sub-region. Next, the system weights and corrects the wear leveling coefficient based on the wear leveling coefficient and the standard deviation, obtaining a corrected wear leveling coefficient. Using the standard deviation to weight and correct the wear leveling coefficient ensures that the corrected coefficient simultaneously considers both the overall wear level of the region and the internal wear distribution. Therefore, the corrected wear leveling coefficient comprehensively considers both the wear differences within and between sub-regions.

[0083] Then, the system calculates the initial adjustment factor for the rotation rate based on the corrected wear leveling coefficient. The initial adjustment factor is inversely proportional to the corrected wear leveling coefficient; that is, the higher the corrected wear leveling coefficient, the lower the initial adjustment factor for the rotation rate. Finally, the system dynamically adjusts the initial adjustment factor for the rotation rate based on the real-time wear status of the sub-regions. The system calculates the bad block growth rate of each sub-region within a preset time period, uses the bad block growth rate as a risk factor, and multiplies it by the initial adjustment factor for the rotation rate to obtain the final adjustment factor for the rotation rate. The higher the risk factor, the greater the wear risk of the sub-region, requiring a further reduction in the rotation rate. When the wear distribution within a region is uneven and the bad block growth is rapid, increasing the data block rotation rate with a larger adjustment factor can accelerate the wear leveling process and reduce the risk of new bad blocks. Conversely, when the wear distribution within a region is uniform and the bad block growth is slow, using a smaller adjustment factor to maintain a lower rotation rate can maintain the wear leveling state while reducing unnecessary data migration overhead, thus improving the efficiency and accuracy of wear leveling.

[0084] S207. Update the rotation interval time in the rotation sequence table of each sub-region according to the adjustment factor;

[0085] After obtaining the rotation rate adjustment factor for each sub-region, the system updates the rotation interval in the rotation sequence table according to the adjustment factor. The rotation interval represents the time interval between two data block rotation operations. The smaller the rotation rate adjustment factor, the lower the frequency of data block rotation operations in the sub-region, and the larger the corresponding rotation interval should be.

[0086] S208. When the number of global spare blocks reaches the preset number, calculate the current storage capacity and average wear value of each sub-region.

[0087] As bad blocks continue to appear, the number of global spare blocks will gradually decrease. When the number of global spare blocks reaches a preset lower limit, the system needs to assess the storage capacity and wear status of each sub-region in order to allocate global spare blocks reasonably.

[0088] The system first calculates the current storage capacity of each sub-region, including used and remaining storage space. Then, it calculates the average wear value for each sub-region as an indicator of its wear level. A higher average wear value indicates more severe wear in the sub-region, requiring more spare blocks to maintain data reliability.

[0089] S209. Based on the capacity utilization rate and wear leveling requirements of each sub-region, allocate the global spare blocks according to the reverse leveling principle.

[0090] After obtaining the storage capacity and average wear value of each sub-region, the system allocates global spare blocks to each sub-region based on these two metrics. The allocation of global spare blocks follows a reverse balancing principle, meaning that sub-regions with higher storage capacity utilization and lower average wear values ​​should be allocated more global spare blocks. This allocation strategy can balance the wear differences between sub-regions, preventing some sub-regions from wearing out too quickly, while also meeting the storage capacity requirements of the sub-regions.

[0091] Specifically, the system first calculates the capacity utilization rate and wear leveling requirement for each sub-region. A higher capacity utilization rate indicates less remaining storage space in the sub-region, requiring more spare blocks to expand storage capacity. The wear leveling requirement takes into account the average wear value and wear leveling coefficient of the sub-region. A lower wear leveling requirement indicates more severe wear in the sub-region, requiring more spare blocks to level the wear.

[0092] Then, the system calculates the number of global spare blocks that should be allocated to each sub-region based on the capacity utilization rate and wear leveling requirement. The calculation formula can be a weighted average of the capacity utilization rate and the wear leveling requirement, and the weighting coefficients can be adjusted according to actual needs. Finally, the system allocates the global spare blocks to each sub-region according to the calculated number and updates the global spare block allocation record.

[0093] S210. Regenerate the sub-region distribution table based on the spare block allocation results, and adjust the rotation sequence table of each sub-region.

[0094] After completing the allocation of global spare blocks, the system needs to update the sub-region distribution table and the rotation sequence table to reflect the changes brought about by the allocation of spare blocks.

[0095] First, the system regenerates the sub-region distribution table based on the allocation results of the spare blocks. The sub-region distribution table records information such as the start address, end address, capacity, and number of spare blocks for each sub-region. Due to the addition of global spare blocks, the storage capacity and number of spare blocks in each sub-region will change, therefore the relevant fields in the sub-region distribution table need to be updated. The updated sub-region distribution table accurately reflects the storage space status of each sub-region, providing a basis for subsequent data storage and wear leveling control.

[0096] Next, the system adjusts the rotation sequence table for each sub-region based on the updated sub-region distribution table. The rotation sequence list records the rotation order and time interval of data blocks within each sub-region. Due to the addition of spare blocks, the number and distribution of data blocks in the sub-regions will change, and the original rotation sequence may no longer be applicable. Therefore, the system needs to recalculate the rotation sequence for each sub-region and update the rotation sequence table.

[0097] When adjusting the rotation sequence list, the system needs to consider the location and wear status of newly added spare blocks. Generally, newly added spare blocks have lower wear levels and should be prioritized for replacing severely worn data blocks. Therefore, the system can insert spare blocks at the beginning of the rotation sequence, allowing them to participate in data block rotation operations first. Simultaneously, the system also needs to adjust the rotation interval to adapt to the new data block distribution. If the number of data blocks in a sub-region increases, the rotation interval can be extended accordingly; if the wear status of a sub-region improves, the rotation interval can be appropriately shortened.

[0098] In the above embodiments, the original data blocks in the target area are merged and reorganized with the migrated data blocks to form a rotation link, and the remaining normal storage blocks in the source area to be migrated are marked as global spare blocks, thus realizing dynamic adjustment of storage resources. Based on historical migration records, regions with continuous migration relationships are identified, and a wear leveling coefficient is calculated using the average wear value to generate a rotation rate adjustment factor to optimize the rotation interval. When a sufficient number of global spare blocks are accumulated, the system performs reverse balance allocation based on the capacity utilization and wear leveling requirements of each region, enabling the system to achieve wear leveling over a wider range at the region level. By dynamically adjusting rotation parameters and spare resource allocation, the system's responsiveness and correction effect to wear imbalances are improved.

[0099] In another embodiment, before step S209, the system calculates the effective data density of each sub-region, where the effective data density is the proportion of non-free storage blocks in the sub-region;

[0100] Calculate the data update frequency for each sub-region;

[0101] The spare block demand of each sub-region is calculated based on effective data density and data update frequency.

[0102] Based on the wear value corresponding to the global spare block and the preset wear value range, the global spare block is divided into several wear levels;

[0103] The number of global spare blocks available to each sub-region at different wear levels is determined based on the spare block demand.

[0104] The allocation of global spare blocks of different wear levels available to each sub-region is determined based on the spare block demand, specifically including:

[0105] Count the number of global spare blocks for each wear level and calculate the percentage of spare blocks for each wear level;

[0106] The initial allocation weight is calculated based on the reserve block demand of each sub-region, and the initial allocation weight is proportional to the reserve block demand.

[0107] The initial allocation weights are adjusted by combining the current average wear values ​​of each sub-region, resulting in the adjusted allocation weights;

[0108] Based on the adjusted allocation weights and the proportion of spare blocks at each wear level, calculate the global spare block quota for each sub-region at each wear level.

[0109] Before allocating global spare blocks, the system first performs a fine-grained assessment and calculation of the spare block requirements of each sub-region. Combined with the wear level of the global spare blocks, it determines the quota of global spare blocks available to each sub-region at different wear levels. This spare block allocation method is more refined and comprehensive than the original allocation strategy, better meeting the actual needs of each sub-region and improving the rationality and effectiveness of spare block allocation.

[0110] The system calculates the effective data density of each sub-region, which is the proportion of non-free storage blocks in the sub-region to the total number of storage blocks. The higher the effective data density, the higher the storage space utilization of the sub-region, the fewer available free storage blocks, and the greater the demand for spare blocks.

[0111] The system tracks the data update frequency of each sub-region. The data update frequency reflects the degree of dynamic change in the data within that sub-region. A higher data update frequency indicates more frequent data modification and write operations within the sub-region, and a greater demand for spare blocks. This is because frequent data updates accelerate storage block wear, requiring more spare blocks to replace worn-out or failed storage blocks.

[0112] The system calculates the spare block demand for each sub-region based on effective data density and data update frequency. The spare block demand comprehensively considers the storage space utilization and data update characteristics of the sub-region, thus more accurately reflecting the actual demand for spare blocks in the sub-region. The spare block demand can be calculated using a weighted average of effective data density and data update frequency; the weighting coefficients can be adjusted according to actual circumstances.

[0113] The system classifies global spare blocks into several wear levels based on their wear values ​​and preset wear value ranges. Each wear level indicates the degree of wear on the spare block, with different levels corresponding to different wear value ranges. A higher wear level indicates more severe wear and a shorter usable lifespan for the spare block. By classifying global spare blocks into wear levels, the system can manage and utilize them more precisely, selecting and allocating spare blocks of appropriate wear levels based on the wear status of sub-regions and their spare block requirements.

[0114] The system determines the quota of global spare blocks available to each sub-region at different wear levels based on the demand for spare blocks. This step refines the spare block allocation process and fully considers the actual needs of the sub-regions and the wear status of the global spare blocks.

[0115] In practice, the system counts the number of global spare blocks for each wear level and calculates the proportion of spare blocks for each wear level. Based on the spare block demand of each sub-region, an initial allocation weight is calculated. The initial allocation weight is proportional to the spare block demand; that is, a sub-region with a higher spare block demand has a larger initial allocation weight and should be allocated more spare blocks. The system then adjusts the initial allocation weight based on the current average wear value of each sub-region. If a sub-region has a high current average wear value, it indicates severe wear in that sub-region, and its allocation weight should be appropriately reduced to balance the wear differences between sub-regions. The initial allocation weight, calculated based on the spare block demand and adjusted in conjunction with the region's average wear value, ensures that the allocation weight reflects the actual demand intensity and current wear status of the region for spare blocks. The adjusted weight is called the corrected allocation weight. Based on the corrected allocation weight and the proportion of spare blocks for each wear level, the system calculates the global spare block quota for each sub-region at each wear level, ensuring that the spare block allocation conforms to both resource supply and demand-side characteristics. When a region has a high demand for spare blocks and a low average wear level, that region will receive more spare block quotas with high wear levels; conversely, when a region has a low demand for spare blocks and a high average wear level, that region will receive more spare block quotas with low wear levels. This achieves a reasonable allocation of spare resources, meeting the spare space needs of each region while promoting overall wear balance through differentiated allocation of spare blocks with different wear levels, thereby improving the reliability and lifespan of the storage system.

[0116] In the above embodiments, the spare block demand is calculated by combining effective data density and data update frequency. This allows spare block allocation to simultaneously consider the storage pressure and data update load of a region, accurately reflecting the actual demand intensity of each region for spare space. Global spare blocks are categorized according to wear value ranges, fully utilizing spare resources at different wear levels. The number of spare blocks allocated to each region at different wear levels is determined based on the spare block demand. This ensures that the allocation of spare resources not only meets the quantity requirements of high-demand regions but also promotes wear leveling between regions through a reasonable combination of spare blocks at different wear levels. It optimizes the spare space allocation strategy based on the actual storage characteristics and operating status of each region, improving the utilization efficiency of spare block resources, and assists in achieving more refined wear leveling control through differentiated allocation based on wear levels.

[0117] The system in the embodiments of this application is described below from the perspective of hardware processing. Please refer to Figure 3, which is a schematic diagram of the physical device structure of a solid-state drive bad block wear leveling system provided in the embodiments of this application.

[0118] It should be noted that the system structure shown in Figure 3 is only an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0119] As shown in Figure 3, the system includes a Central Processing Unit (CPU) 301, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 302 or programs loaded from storage section 308 into Random Access Memory (RAM) 303, such as executing the methods described in the above embodiments. The RAM 303 also stores various programs and data required for system operation. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An Input / Output (I / O) interface 305 is also connected to the bus 304.

[0120] The following components are connected to I / O interface 305: input section 306 including a camera, infrared sensor, etc.; output section 307 including a liquid crystal display (LCD) and speakers, etc.; storage section 308 including a hard disk, etc.; and communication section 309 including a network interface card such as a LAN (Local Area Network) card and a modem, etc. Communication section 309 performs communication processing via a network such as the Internet. Drive 310 is also connected to I / O interface 305 as needed. Removable media 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 310 as needed so that computer programs read from them can be installed into storage section 308 as needed.

[0121] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs the various functions defined in the present invention.

[0122] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. The transmitted data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof.

[0123] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0124] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the system described in the above embodiments; or it may exist independently and not assembled into the system. The storage medium carries one or more computer programs that, when executed by a processor of a system, cause the system to implement the methods provided in the above embodiments.

[0125] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

[0126] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as meaning "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".

[0127] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.

[0128] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A method for wear leveling of bad blocks in a solid-state drive, characterized in that, include: The storage area of ​​the solid-state drive is divided into several sub-regions, and a sub-region distribution table is generated. Each sub-region contains a preset number of storage blocks and corresponding local spare blocks. Based on the sub-region distribution table, a data block rotation link is established in each sub-region and recorded as a rotation sequence table; Data block rotation is performed according to a preset cycle, and the wear status of each sub-region is recorded; When a new bad block is detected, the sub-region containing the bad block is marked as a source region to be migrated in the sub-region distribution table; Based on the number of bad blocks and wear status recorded in the sub-region distribution table, select the sub-region with the smallest cumulative wear value from the sub-regions other than the sub-region containing the bad blocks as the target region, and establish a mapping relationship between the source region to be migrated and the target region; Based on the mapping relationship and the rotation sequence list, the data in the source region to be migrated is migrated to the target region in the order of the rotation sequence list.

2. The method according to claim 1, characterized in that, The process of dividing the storage area of ​​the solid-state drive into several sub-regions and generating a sub-region distribution table includes: Based on the physical distribution characteristics of the storage blocks, the storage area of ​​the solid-state drive is divided into several pre-divided sub-regions; Cluster analysis is performed on the pre-divided sub-regions to calculate the access frequency and data update rate of the storage blocks in each pre-divided sub-region; The pre-divided sub-regions are reorganized according to the access frequency and the data update rate, and the pre-divided sub-regions with the same access pattern are merged into the target sub-region. Local spare blocks are allocated to each target sub-region, and the number of local spare blocks is positively correlated with the data update rate of the target sub-region. A sub-region distribution table is generated based on the boundary information of the target sub-region and the allocation result of the local spare block.

3. The method according to claim 1, characterized in that, The step of establishing a data block round-robin link within each of the sub-regions based on the sub-region distribution table and recording it as a round-robin sequence table includes: Count the number of accesses and the most recent access time of the storage blocks in each sub-region within a preset time window; Based on the number of accesses and the most recent access time, the storage blocks in each of the sub-regions are divided into high-frequency access blocks, medium-frequency access blocks, and low-frequency access blocks; A data block round-robin link is constructed in each of the sub-regions, and the high-frequency access block, the medium-frequency access block, and the low-frequency access block each form an independent ring sub-link in the data block round-robin link; Configure the data block exchange path between the ring sub-links; When the access characteristics of the storage block change, the storage block is migrated to the corresponding level of the ring sub-link through the data block exchange path; Calculate the round-robin interval time for each of the ring sub-links, wherein the round-robin interval time is inversely proportional to the average number of accesses to the storage blocks in the ring sub-link; The structure information of the data block rotation link, the data block exchange path, and the rotation interval time are recorded in the rotation sequence table.

4. The method according to claim 1, characterized in that, After migrating the data from the source region to the target region according to the order in the rotation sequence table based on the mapping relationship and the rotation sequence table, the method further includes: The original data blocks in the target area and the migrated data blocks are merged and numbered, the round-robin links in the target area are regenerated, and the round-robin sequence table of the target area is updated. The remaining normal storage blocks in the source area to be migrated are marked as global spare blocks, and the physical location information and wear value of the global spare blocks are recorded. Statistically analyze the historical migration records of each sub-region in the sub-region distribution table; Sub-regions with continuous migration relationships in the historical migration records are marked as migration association groups to obtain a sub-region grouping information table; Calculate the average wear value of the storage blocks in each sub-region, and determine the wear leveling coefficient of each sub-region by combining the migration association group marker in the sub-region grouping information table; Based on the wear equalization coefficient, a rotational speed adjustment factor is generated for each of the sub-regions, and the adjustment factor is inversely proportional to the wear equalization coefficient. Update the rotation interval time in the rotation sequence table of each sub-region according to the adjustment factor; When the number of global spare blocks reaches a preset number, calculate the current storage capacity and average wear value of each sub-region; Based on the capacity utilization and wear leveling requirements of each sub-region, the global spare blocks are allocated according to the reverse leveling principle. The sub-region distribution table is regenerated based on the spare block allocation results, and the rotation sequence table of each sub-region is adjusted.

5. The method according to claim 4, characterized in that, The step of generating the rotational speed adjustment factor for each sub-region based on the wear leveling coefficient includes: Calculate the standard deviation of the wear values ​​of the storage blocks in each of the sub-regions; The wear equalization coefficient is weighted and corrected based on the standard deviation to obtain the correction coefficient. The initial adjustment factor for the rotation speed is calculated based on the correction coefficient, and the initial adjustment factor is inversely proportional to the correction coefficient. The bad block growth rate of each sub-region is statistically analyzed within a preset time period, and the bad block growth rate is used as a risk factor. Multiply the initial adjustment factor by the risk factor to obtain the rotation rate adjustment factor.

6. The method according to claim 4, characterized in that, Before allocating the global spare blocks according to the reverse balancing principle based on the capacity utilization and wear leveling requirements of each sub-region, the method further includes: Calculate the effective data density of each sub-region, where the effective data density is the proportion of non-free storage blocks in the sub-region; Statistical analysis of the data update frequency of each sub-region; The spare block demand of each sub-region is calculated based on the effective data density and the data update frequency. Based on the wear value corresponding to the global spare block and the preset wear value range, the global spare block is divided into several wear levels; The number of global spare blocks available for each sub-region at different wear levels is determined based on the spare block demand.

7. The method according to claim 6, characterized in that, The determination of the global spare block quantity quota for each sub-region with different wear levels based on the spare block demand includes: The number of global spare blocks for each wear level is counted, and the percentage of spare blocks for each wear level is calculated. An initial allocation weight is calculated based on the spare block demand of each sub-region, and the initial allocation weight is proportional to the spare block demand. The initial allocation weights are corrected by combining the current average wear values ​​of each sub-region to obtain the corrected allocation weights; Based on the corrected allocation weight and the proportion of spare blocks for each wear level, calculate the global spare block quota for each sub-region at each wear level.

8. A solid-state drive bad block wear leveling system, characterized in that, The system includes: One or more processors and a memory; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the system to perform the method as described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on the system, the system performs the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, When the computer program product is run on the system, the system performs the method as described in any one of claims 1-7.