A loss leveling method and system for solid-state storage
By dividing logical intervals in solid-state storage devices to calculate thermal entropy values, building a hot and cold intensity matrix and distributing cross-channel memory blocks, the wear unbalanced problem of solid-state storage devices is solved, and a longer service life and higher reliability are achieved.
Patent Information
- Application Number
- CN202510814864.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-06-18
AI Technical Summary
The loss balance strategy of existing solid-state storage devices has problems such as excessive use of local area resources and uneven wear across channels, resulting in shortening of device reliability and service life.
By dividing the logical intervals, compute the thermal entropy value, construct a hot and cold intensity matrix and map it into a memory block allocation sequence, combining the gradient pointer mechanism and channel state mask, cross-channel memory block allocation and migration are performed, and storage resource allocation is optimized.
Reduce data migration frequency and storage fragmentation, extend equipment service life, improve storage media stability and reliability, and optimize global wear balance.
Smart Images

Figure CN120353404B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer storage technology, and in particular to a loss leveling method and system for solid-state storage. Background Art
[0002] Solid-state storage is a data storage solution based on semiconductor technology. Solid-state drives (SSDs), with their high-speed data read and write capabilities, low energy consumption, and vibration resistance, are gradually replacing traditional mechanical hard drives and becoming the mainstream storage device. Currently, most solid-state storage devices use NAND flash memory as the primary storage medium. However, due to the physical characteristics of NAND flash memory, each storage cell has a limited number of erase and write cycles. As storage technology evolves towards higher-density architectures (such as QLC and PLC), the durability of each storage cell further decreases, making solid-state storage devices more susceptible to wear and failure during use. Therefore, designing efficient wear-leveling algorithms to extend device life while maintaining performance has become a key challenge facing solid-state storage technology.
[0003] Currently, wear-leveling strategies in solid-state storage devices are typically based on counter methods. This involves counting the number of erase and write cycles per storage block or channel in real time, prioritizing data writes to storage cells with fewer erase and write cycles. However, this type of counter-driven allocation strategy has certain limitations: in situations where local areas are frequently accessed or write-intensive, it can easily lead to overuse of some storage blocks or channels, exacerbating local wear. Furthermore, the lack of global awareness and control of dynamic cross-channel load changes can lead to significant differences in wear rates between channels, causing some channels to reach their erase and write limits prematurely. This ultimately impacts the overall reliability of the device, shortens its lifespan, and reduces the performance stability of the storage system.
[0004] Currently, no effective solutions have been proposed for the problems in related technologies. Summary of the Invention
[0005] In response to the problems in the related art, the present invention proposes a wear leveling method and system for solid-state storage to overcome the above-mentioned technical problems existing in the existing related art.
[0006] To this end, the specific technical solutions adopted in the present invention are as follows:
[0007] According to one aspect of the present invention, a wear leveling method for solid-state storage is provided, comprising:
[0008] S1. Divide the solid-state storage device into several logical intervals according to the timing characteristics of data access, and calculate the corresponding thermal entropy value based on the data access behavior of each logical interval;
[0009] S2. Construct a hot / cold intensity matrix based on the thermal entropy value of each logical interval, and map the hot / cold intensity matrix to a corresponding storage block allocation sequence based on a binary search tree.
[0010] S3. Based on the memory block allocation sequence, a free memory block resource pool is constructed. The gradient pointer mechanism is used to cover the preset erase interval. The channel state mask and the probabilistic selection algorithm are combined to perform cross-channel memory block allocation.
[0011] S4. According to the storage block allocation result, the storage blocks in each channel are sorted in descending order according to the thermal entropy value, and a cross-channel migration operation is performed according to the sorting result.
[0012] Optionally, constructing a hot and cold intensity matrix based on the thermal entropy value of each logical interval and mapping the hot and cold intensity matrix to a corresponding storage block allocation sequence based on a binary search tree includes:
[0013] S21. Normalize the thermal entropy value of each logical interval to generate a standardized heat score;
[0014] S22. Based on the numbering order of the logical intervals, fill the standardized heat scores into corresponding positions in the matrix according to the preset priority rules to construct a hot and cold intensity matrix;
[0015] S23. Perform cluster analysis on the hot and cold intensity matrix based on the hierarchical clustering algorithm, combining the heat scores of the logical intervals with the spatial topological relationship, and divide the logical intervals into several hot and cold intervals based on the analysis results.
[0016] S24. Based on the division result of hot and cold intervals, a binary search tree is constructed with the heat score of the logical interval as the key value, and the binary search tree is traversed in order to generate a mapping table from logical blocks to storage blocks, and a storage block allocation sequence is obtained.
[0017] Optionally, a hierarchical clustering algorithm is used to perform cluster analysis on the hot and cold intensity matrix in combination with the heat scores and spatial topological relationships of the logical intervals. Based on the analysis results, the logical intervals are divided into several hot and cold intervals, including:
[0018] S231. Based on the constructed hot and cold intensity matrix, extract the heat score and spatial topological relationship of each logical interval and construct a multidimensional feature matrix;
[0019] S232. Calculate and integrate the heat similarity and spatial proximity between the logical intervals based on the multidimensional feature matrix to construct an amplification formula;
[0020] S233, combining the hierarchical clustering algorithm with the amplification formula to cluster the logical intervals into clusters and generate a hierarchical tree structure;
[0021] S234. Based on the generated tree structure, combined with heat distribution and spatial association, set a partitioning standard, and divide the logical interval into several hot and cold intervals, which include hot areas, cold areas, and transition areas.
[0022] Optionally, the amplification formula is expressed as:
[0023] ;
[0024] Where, T ( i , j ) represents a logical interval i and j Enhanced distance; i Represents the index value; j Represents the index value; D ( S i , S j ) represents the heat score sequence S i and S j similarity; S i Represents a logical interval i The heat score sequence of S j Represents a logical interval j The heat score sequence of γ represents the spatial coupling coefficient; D ( i , j ) represents a logical interval i and j spatial proximity distance; D max represents the maximum spatial proximity distance; λ ( t ) represents the dynamic attenuation factor; η represents the gradient penalty coefficient; Represents the thermal gradient.
[0025] Optionally, combining a hierarchical clustering algorithm with an amplification formula to cluster logical intervals into clusters and generate a hierarchical tree structure includes:
[0026] S2331. Taking each logical interval as an initial class, a global covariance matrix is constructed based on the heat similarity and spatial proximity of all logical intervals.
[0027] S2332, initializing the covariance matrix of each initial class to half the size of the corresponding global covariance matrix, and using the amplification formula to calculate the similarity between any two classes to generate a similarity matrix;
[0028] S2333. Select the two classes with the highest similarity from the similarity matrix and merge them, calculate the covariance matrix of the merged new class, and use the amplification formula to calculate the similarity between the new class and all classes, and update the similarity matrix;
[0029] S2334, continue to iterate and update the similarity matrix, and detect whether the preset termination condition is met. If so, generate a hierarchical tree structure. Otherwise, return to step S2332 to continue iterating until the preset termination condition is met.
[0030] Optionally, based on the generated tree structure, combined with heat distribution and spatial association, set partitioning standards and divide the logical interval into several hot and cold intervals, including:
[0031] S2341, traversing each level node in the tree structure, calculating the joint entropy value of each level node based on heat similarity and spatial proximity, and screening candidate cutting layers according to a preset entropy value threshold to construct a candidate cutting layer set;
[0032] S2342. Based on each candidate cutting layer, the score of each candidate cutting layer is evaluated by combining heat distribution and spatial correlation through weighted scoring, and the candidate cutting layer with the highest score is selected as the partitioning standard for logical interval division;
[0033] S2343. According to the selected demarcation standard, each logical interval is classified to obtain a number of hot and cold intervals, which include hot areas, cold areas and transition areas.
[0034] Optionally, based on the hot and cold interval division result, a binary search tree is constructed using the heat score of the logical interval as a key value, and the binary search tree is traversed in order to generate a mapping table from logical blocks to storage blocks. Obtaining the storage block allocation sequence includes:
[0035] S241. Based on the hot and cold interval division results, the logic blocks are sorted using the heat score of each logic block as a key value to generate an ordered sequence arranged in ascending order of heat score.
[0036] S242. Select an intermediate element from the ordered sequence as the root node of the binary search tree, and use the intermediate element to divide the ordered sequence into two parts, and recursively construct a left subtree and a right subtree based on the division results;
[0037] S243, repeat step S242 until all logic blocks are inserted to construct a binary search tree;
[0038] S244. Perform an in-order traversal on the constructed binary search tree to generate a sequence of logic blocks arranged in descending order according to the heat scores, and establish a mapping relationship table from logic blocks to storage blocks according to the traversal order to obtain a storage block allocation sequence.
[0039] Optionally, according to the storage block allocation result, the storage blocks in each channel are sorted in descending order according to the thermal entropy value, and the cross-channel migration operation is performed according to the sorting result, including:
[0040] S41. Based on the storage block allocation result, the weight parameters in the thermal entropy value calculation are dynamically adjusted using an adaptive algorithm, and the storage blocks are sorted in descending order based on the updated thermal entropy values in each channel to generate a migration priority queue for each channel.
[0041] S42: Calculate the wear difference between channels, combine the preset migration trigger threshold and the migration priority queue, filter out the storage blocks to be migrated, and establish a set to be migrated;
[0042] S43, performing hash processing on the storage blocks in the to-be-migrated set, and evenly distributing the processed storage blocks to the target wear channels;
[0043] S44: Calculate the wear leveling degree of each channel and the thermal retention rate of the storage block after the migration, evaluate the calculation results, and adjust the migration amount based on the evaluation results.
[0044] Optionally, performing hash processing on the storage blocks in the to-be-migrated set and evenly distributing the processed storage blocks to the target wear channels includes:
[0045] S431, calculating a compensation factor for each storage block based on the thermal entropy value of each storage block and the load balancing status of each channel during the migration operation;
[0046] S432. Calculate the migration priority of each storage block using a weighted formula based on the thermal entropy value of the storage block and the corresponding compensation factor.
[0047] S433: Arrange all storage blocks in the set to be migrated in descending order according to the migration priority, and process the sorted storage blocks using a hash algorithm to generate a hash mapping value to determine the target wear channel corresponding to each storage block;
[0048] S434. Allocate the processed storage blocks to the corresponding target wear channels in sequence according to a preset polling mechanism to ensure that the storage blocks are evenly distributed among different channels.
[0049] S435: Repeat step S434 until all storage blocks to be migrated are allocated.
[0050] According to another aspect of the present invention, a wear leveling system for solid-state storage is provided, comprising:
[0051] A thermal entropy value calculation module is used to divide the solid-state storage device into several logical intervals according to the timing characteristics of data access, and calculate the corresponding thermal entropy value based on the data access behavior of each logical interval;
[0052] The allocation sequence mapping module is used to construct a hot and cold intensity matrix based on the thermal entropy value of each logical interval, and map the hot and cold intensity matrix to the corresponding storage block allocation sequence based on a binary search tree;
[0053] The cross-channel allocation module is used to build a free storage block resource pool based on the storage block allocation sequence, use the gradient pointer mechanism to cover the preset erase interval, and combine the channel status mask with the probabilistic selection algorithm to perform cross-channel storage block allocation;
[0054] The migration operation module is used to sort the storage blocks in each channel in descending order according to the thermal entropy value based on the storage block allocation result, and perform cross-channel migration operations based on the sorting result.
[0055] The beneficial effects of the present invention are:
[0056] 1. The present invention divides logical intervals by analyzing timing characteristics and optimizes storage resource allocation. At the same time, it adopts a hot-cold intensity matrix mapping mechanism based on a binary search tree to achieve efficient layout of storage blocks, thereby reducing data migration frequency and storage fragmentation, lowering the write amplification effect, and effectively extending the service life of solid-state storage devices.
[0057] 2. The present invention dynamically manages the erase interval by introducing a gradient pointer mechanism, and combines the channel status perception algorithm to give priority to the use of low-wear storage blocks, thereby reducing the erase and write pressure of a single channel; through the probabilistic selection strategy and channel masking technology, the cross-channel resource allocation weight is adaptively adjusted to balance the wear degree of each channel and prevent premature aging of local areas, thereby improving the stability and reliability of the storage medium.
[0058] 3. The present invention realizes intelligent redistribution of cross-channel storage blocks through a migration strategy based on thermal entropy descending order, combined with a dynamic priority queue and hash mapping algorithm; through a continuous monitoring and feedback mechanism, it optimizes global wear leveling, reduces the impact of migration operations on system performance, ensures storage response efficiency in high-concurrency scenarios, and provides continuous wear leveling support for solid-state storage devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0060] Figure 1 is a flow chart of a loss leveling method for solid-state storage according to an embodiment of the present invention;
[0061] Figure 2 This is a principle block diagram of a solid-state storage wear leveling system according to an embodiment of the present invention;
[0062] Figure 3 1 is a schematic diagram of a tree structure generation method for solid-state storage loss leveling according to an embodiment of the present invention.
[0063] In the picture:
[0064] 1. Thermal entropy value calculation module; 2. Allocation sequence mapping module; 3. Cross-channel allocation module; 4. Migration operation module. DETAILED DESCRIPTION
[0065] To further illustrate each embodiment, the present invention provides drawings, which are part of the disclosure of the present invention. They are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. By referring to these contents, ordinary technicians in this field should be able to understand other possible implementation methods and the advantages of the present invention.
[0066] According to an embodiment of the present invention, a wear leveling method and system for solid-state storage are provided.
[0067] The present invention will now be further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, the loss leveling method for solid-state storage according to an embodiment of the present invention includes:
[0068] S1. Divide the solid-state storage device into several logical intervals according to the timing characteristics of data access, and calculate the corresponding thermal entropy value based on the data access behavior of each logical interval.
[0069] It should be noted that based on the sequential access characteristics of solid-state storage devices (such as data write / read frequency and timestamp distribution), the storage space is divided into multiple logical intervals (e.g., by time windows or address segments). A thermodynamic entropy calculation formula (such as ΔS = Q / T or the Boltzmann entropy formula S = k·ln·W) is applied to the data access pattern (e.g., number of accesses, update frequency) of each logical interval to quantify its degree of disorder and characterize its hot and cold characteristics. Low-entropy intervals represent hot data areas with frequent, orderly access, high-entropy intervals correspond to cold data areas with low, disordered access, and medium-entropy intervals serve as transition zones for the dynamic migration of hot and cold data. This step converts sequential access characteristics into measurable thermodynamic indicators through entropy calculation, providing a basis for subsequent tiered management of hot and cold data.
[0070] S2. Construct a hot and cold intensity matrix based on the thermal entropy value of each logical interval, and map the hot and cold intensity matrix to a corresponding storage block allocation sequence based on a binary search tree.
[0071] Preferably, constructing a hot and cold intensity matrix based on the thermal entropy value of each logical interval, and mapping the hot and cold intensity matrix to a corresponding storage block allocation sequence based on a binary search tree further includes:
[0072] S21. Normalize the thermal entropy value of each logical interval to generate a standardized heat score.
[0073] S22. Based on the numbering order of the logical intervals, fill the standardized heat scores into the corresponding positions of the matrix according to the preset priority rules to construct a hot and cold intensity matrix.
[0074] It should be noted that, based on the numbering order of the logical intervals, the standardized heat scores are filled into the corresponding positions of the matrix according to the preset priority rules. The specific embodiment of constructing the hot and cold intensity matrix is as follows:
[0075] First, the logical address space is divided into three levels: hot, transition, and cold. Normalized heat scores (normalized to 0-1) are sorted by spatial proximity (e.g., Haversine distance <10km) and access frequency (e.g., top 20%). A priority filling rule is employed, with high-heat data preferentially occupying the center of the matrix and low-heat data distributed toward the edges. A regional compensation factor (α = 0.8-1.2) is introduced to adjust the weights of sparse and dense regions. Finally, a hot-cold intensity matrix is generated, with rows representing logical interval numbers, columns corresponding to physical block erase counts, and matrix values representing weighted hot-cold intensity values (e.g., 0.9 for hot regions and 0.2 for cold regions). This matrix intuitively reflects the hot-cold distribution of the storage space, thereby improving global wear leveling and resource addressing efficiency.
[0076] S23. Based on the hierarchical clustering algorithm, combined with the heat scores and spatial topological relationships of the logical intervals, a cluster analysis is performed on the hot and cold intensity matrix, and the logical intervals are divided into several hot and cold intervals based on the analysis results.
[0077] Preferably, a hierarchical clustering algorithm is used to perform cluster analysis on the hot and cold intensity matrix in combination with the heat scores and spatial topological relationships of the logical intervals. Based on the analysis results, the logical intervals are divided into several hot and cold intervals, including:
[0078] S231. Based on the constructed hot and cold intensity matrix, the heat score and spatial topological relationship of each logical interval are extracted to construct a multidimensional feature matrix.
[0079] It should be noted that, based on the constructed hot and cold intensity matrix, the heat score of each logical interval and the spatial topological relationship are extracted to construct a multi-dimensional feature matrix. The specific embodiment is as follows:
[0080] First, the standardized heat scores (normalized to a range of 0-1, such as 0.9 for hot zones and 0.2 for cold zones) and spatial topological relationships (using an adjacency matrix or spatial autocorrelation index) of the logical intervals are extracted from the hot / cold intensity matrix. This is combined with directional encoding (such as north / south / east / west binary vectors) and distance weighting (proximity is calculated using the Haversine formula). The heat scores, topological adjacency (e.g., adjacent logical intervals are marked as 1), spatial direction vectors, and a compensation factor (α = 0.8-1.2) are then combined into a four-dimensional feature vector. Principal component analysis is used to reduce the dimensionality to a two-dimensional principal component space, forming a multidimensional feature matrix (rows correspond to logical intervals, columns represent principal component scores). This matrix quantifies the heat distribution and spatial correlation of storage areas. Combined with clustering algorithms (such as K-means++), it dynamically partitions hot and cold intervals, thereby improving global wear leveling and data migration efficiency in the storage system.
[0081] S232. Based on the multidimensional feature matrix, calculate and integrate the heat similarity and spatial proximity between each logical interval to construct an amplification formula.
[0082] Preferably, the expression of the amplification formula is:
[0083] ;
[0084] Where, T ( i , j ) represents a logical interval i and j Enhanced distance; i Represents the index value; j Represents the index value; D ( S i , S j ) represents the heat score sequence S i and S j similarity; S i Represents a logical interval i The heat score sequence of S j Represents a logical interval j The heat score sequence of γ represents the spatial coupling coefficient; D ( i , j ) represents a logical intervali and j spatial proximity distance; D max represents the maximum spatial proximity distance; λ ( t ) represents the dynamic attenuation factor; η represents the gradient penalty coefficient; Represents the thermal gradient.
[0085] S233. Combining the hierarchical clustering algorithm with the amplification formula, the logical intervals are clustered into clusters to generate a hierarchical tree structure.
[0086] Preferably, combining a hierarchical clustering algorithm with an amplification formula to cluster logical intervals into clusters and generate a hierarchical tree structure includes:
[0087] S2331. Taking each logical interval as an initial class, a global covariance matrix is constructed based on the heat similarity and spatial proximity of all logical intervals.
[0088] S2332, initializing the covariance matrix of each initial class to half the size of the corresponding global covariance matrix, and using the amplification formula to calculate the similarity between any two classes to generate a similarity matrix;
[0089] S2333. Select the two classes with the highest similarity from the similarity matrix and merge them, calculate the covariance matrix of the merged new class, and use the amplification formula to calculate the similarity between the new class and all classes, and update the similarity matrix;
[0090] S2334, continue to iterate and update the similarity matrix, and detect whether the preset termination condition is met. If so, generate a hierarchical tree structure. Otherwise, return to step S2332 to continue iterating until the preset termination condition is met.
[0091] It is necessary to add that, if Figure 3 As shown in the figure, by constructing a global covariance matrix (integrating the thermal similarity and spatial proximity of logical intervals) and adopting an incremental covariance merging strategy (the initial covariance matrix is 50% of the global scale, and the increment formula introduces the thermal weight α=0.6 and the spatial attenuation factor β=1.2), the two categories with the highest similarity (such as similarity > 0.85) are iteratively merged to generate a tree structure, thereby improving the global wear leveling of the storage system and reducing the write amplification factor. At the same time, through the dynamic update of the covariance matrix, the computational complexity is effectively reduced (compared with traditional hierarchical clustering, a certain amount of memory usage is reduced), which makes it suitable for the hierarchical management of hot and cold data in high-dimensional storage space.
[0092] S234. Based on the generated tree structure, combined with heat distribution and spatial association, set a partitioning standard, and divide the logical interval into several hot and cold intervals, which include hot areas, cold areas, and transition areas.
[0093] Preferably, based on the generated tree structure, combined with the heat distribution and spatial association, a partitioning standard is set, and the logical interval is divided into several hot and cold intervals including:
[0094] S2341, traversing each level node in the tree structure, calculating the joint entropy value of each level node based on heat similarity and spatial proximity, and screening candidate cutting layers according to a preset entropy value threshold to construct a candidate cutting layer set;
[0095] S2342. Based on each candidate cutting layer, the score of each candidate cutting layer is evaluated by combining heat distribution and spatial correlation through weighted scoring, and the candidate cutting layer with the highest score is selected as the partitioning standard for logical interval division;
[0096] S2343. According to the selected demarcation standard, each logical interval is classified to obtain a number of hot and cold intervals, which include hot areas, cold areas and transition areas.
[0097] It should be noted that the candidate cutting layers (such as an entropy threshold of 1.2 bits) are screened by calculating the joint entropy value of the nodes (integrating heat similarity and spatial proximity), and the optimal demarcation standard is determined by combining the weighted score (heat weight 60%, spatial correlation 40%). Finally, the logical interval is divided into hot zones (entropy <0.5, access frequency top 20%), cold zones (entropy >1.5, low-frequency access) and transition zones (dynamic adjustment), thereby improving the global wear leveling of the storage system, reducing the write amplification factor and false positive rate, and thus being suitable for real-time resource optimization in high-concurrency scenarios.
[0098] S24. Based on the division result of hot and cold intervals, a binary search tree is constructed with the heat score of the logical interval as the key value, and the binary search tree is traversed in order to generate a mapping table from logical blocks to storage blocks, and a storage block allocation sequence is obtained.
[0099] Preferably, based on the hot and cold interval division result, a binary search tree is constructed with the heat score of the logical interval as the key value, and a mapping table from the logical block to the storage block is generated by traversing the binary search tree in order. Obtaining the storage block allocation sequence includes:
[0100] S241. Based on the hot and cold interval division results, the logic blocks are sorted using the heat score of each logic block as a key value to generate an ordered sequence arranged in ascending order of heat score.
[0101] S242. Select an intermediate element from the ordered sequence as the root node of the binary search tree, and use the intermediate element to divide the ordered sequence into two parts, and recursively construct a left subtree and a right subtree based on the division results;
[0102] S243, repeat step S242 until all logic blocks are inserted to construct a binary search tree;
[0103] S244. Perform an in-order traversal on the constructed binary search tree to generate a sequence of logic blocks arranged in descending order according to the heat scores, and establish a mapping relationship table from logic blocks to storage blocks according to the traversal order to obtain a storage block allocation sequence.
[0104] It should be noted that, based on the hot and cold interval division results, a binary search tree is constructed using the heat scores of the logical intervals as key values, and the binary search tree is traversed in order to generate a mapping table from logical blocks to storage blocks. The specific embodiment of obtaining the storage block allocation sequence is as follows:
[0105] The logical blocks are sorted in ascending order by their popularity scores, and the middle element is taken as the root node (for example, block 50 out of 100 logical blocks, with a popularity of 0.65) to recursively construct a balanced binary search tree. A descending sequence is generated through in-order traversal (the top 20% logical blocks in the hot zone are preferentially mapped to high-performance storage blocks). A storage mapping table is established in combination with a spatial proximity compensation factor (the mapping interval between adjacent logical blocks is ≤ 5 physical blocks). This effectively reduces the write amplification factor of the storage system and improves the access hit rate of the hot zone. The balanced tree structure also stabilizes the search complexity at O(logn), thereby reducing the latency of the linked list structure.
[0106] S3. Based on the storage block allocation sequence, a free storage block resource pool is constructed, and the gradient pointer mechanism is used to cover the preset erase interval. The channel state mask and the probabilistic selection algorithm are combined to perform cross-channel storage block allocation.
[0107] It should be noted that based on the memory block allocation sequence, a free memory block resource pool is constructed, a gradient pointer mechanism is used to cover the preset erase interval, and a channel state mask and a probabilistic selection algorithm are combined to perform a specific embodiment of cross-channel memory block allocation as follows:
[0108] First, a resource pool is constructed by partitioning free memory blocks by channel (e.g., NAND flash channels 0-3). A gradient pointer mechanism (with an initial offset of Δ=10% and a step-by-step decay factor of β=0.9) is used to dynamically overwrite the erase range (e.g., blocks with 1000 to 5000 erase cycles). A channel status mask (e.g., a binary code [0x1, 0x2, 0x4, 0x8]) is used to mark the load status of each channel (e.g., a mask value of 0x3 indicates that channels 0 and 1 are busy). A probabilistic selection algorithm (with a weight of α=0.3 for high-load channels and α=0.7 for low-load channels) is then used to perform cross-channel allocation. This reduces memory block fragmentation and improves erase / write balance. Dynamic mask updates also stabilize cross-channel allocation latency to within 5μs. For example, when an allocation request arrives, channels with low mask values (e.g., channel 3 with a mask of 0x8) are prioritized. The gradient pointer is then used to locate available blocks within the erase range (e.g., blocks with 2500 erase cycles). Load balancing is achieved by combining probabilistic weighting.
[0109] S4. According to the storage block allocation result, the storage blocks in each channel are sorted in descending order according to the thermal entropy value, and a cross-channel migration operation is performed according to the sorting result.
[0110] Preferably, according to the storage block allocation result, the storage blocks in each channel are sorted in descending order according to the thermal entropy value, and the cross-channel migration operation is performed according to the sorting result, including:
[0111] S41. According to the storage block allocation result, the weight parameters in the thermal entropy value calculation are dynamically adjusted using an adaptive algorithm, and the storage blocks are sorted in descending order based on the updated thermal entropy value in each channel to generate a migration priority queue for each channel.
[0112] S42: Calculate the wear difference between channels, combine the preset migration trigger threshold and the migration priority queue, filter out the storage blocks to be migrated, and establish a set to be migrated.
[0113] It should be noted that the specific embodiment of calculating the wear difference between channels, combining the preset migration trigger threshold and the migration priority queue, screening the storage blocks to be migrated, and establishing the set to be migrated is as follows:
[0114] First, the wear difference index of each channel is calculated (for example, if channel A has 2500 erase / write cycles and channel B has 1800 erase / write cycles, the difference ratio is (2500-1800) / 1800 = 38.9%). This is combined with a migration trigger threshold (preset Δ=30%) to filter out channels that exceed the threshold. A migration priority queue is then constructed (based on a weighted score of storage block wear, spatial proximity, and access popularity, with weights α=0.6 / 0.3 / 0.1). For example, the score of storage block X in the queue is 0.6 (erase / write cycle / maximum erase / write cycle) + 0.3 (neighboring channel idleness) + 0.1 (most recent access frequency). A probabilistic selection algorithm (with a weight of 0.7 for high priority and 0.3 for low priority) is used to select blocks for migration from the queue. For example, blocks with more than 4000 erase / write cycles are prioritized in the queue. This improves cross-channel wear leveling, reduces the number of migration triggers, and lowers the write amplification factor. For example, in a NAND flash memory system, when the wear difference index of channel 3 reaches 45%, the migration mechanism is triggered to migrate the top 10% of storage blocks in the priority queue (such as blocks with 4300 erase / write cycles) to the low-load channel (such as channel 1 with a wear rate of 22%). The erase interval is then overwritten using a gradient pointer mechanism (offset Δ=15%) to ensure that the wear rate difference between each channel is ≤15% after migration.
[0115] S43: Perform hash processing on the storage blocks in the to-be-migrated set, and evenly distribute the processed storage blocks to the target wear channels.
[0116] Preferably, performing hash processing on the storage blocks in the to-be-migrated set and evenly distributing the processed storage blocks to the target wear channels includes:
[0117] S431, calculating a compensation factor for each storage block based on the thermal entropy value of each storage block and the load balancing status of each channel during the migration operation;
[0118] S432. Calculate the migration priority of each storage block using a weighted formula based on the thermal entropy value of the storage block and the corresponding compensation factor.
[0119] S433: Arrange all storage blocks in the set to be migrated in descending order according to the migration priority, and process the sorted storage blocks using a hash algorithm to generate a hash mapping value to determine the target wear channel corresponding to each storage block;
[0120] S434. Allocate the processed storage blocks to the corresponding target wear channels in sequence according to a preset polling mechanism to ensure that the storage blocks are evenly distributed among different channels.
[0121] S435: Repeat step S434 until all storage blocks to be migrated are allocated.
[0122] It should be noted that the specific embodiment of performing hash processing on the storage blocks in the to-be-migrated set and evenly distributing the processed storage blocks to the target wear channels is as follows:
[0123] The thermal entropy of the storage block is calculated (reflecting the hot and cold data distribution, such as a hot zone entropy of 0.3 and a cold zone entropy of 1.8). This is combined with the channel load balance (e.g., a wear rate of 28% for channel A and 45% for channel B) to generate compensation factors (hot zone compensation factor α = 0.6, cold zone compensation factor β = 0.2). The migration priority is calculated using a weighted formula (priority score = entropy value × compensation factor + channel load weight × 0.4). For example, a storage block with an entropy value of 1.2 in a channel with a load weight of 0.7 has a score of 1.2 × 0.6 + 0.7 × 0.4 = 1.0. The sorted storage blocks are mapped to the target channel using a hash algorithm (such as BKDRHash modulo the channel number). For example, hash value 0x3A5 is mapped to channel 3. Migration tasks are assigned using a round-robin mechanism (based on channel weights, with the allocation interval for high-load channels extended by 50%), thereby improving cross-channel wear variance and reducing write amplification and migration latency. For example, in a NAND flash memory system, when the wear rate of channel 2 exceeds the threshold of 30%, the top 10% of storage blocks with the highest migration priority (such as hot data blocks with an entropy value of 0.5) are mapped to low-load channels (such as channel 4 with a wear rate of 18%) through hash mapping. The polling interval is dynamically adjusted to allocate a high-load channel once every five operations to achieve global balance.
[0124] S44: Calculate the wear leveling degree of each channel and the thermal retention rate of the storage block after the migration, evaluate the calculation results, and adjust the migration amount based on the evaluation results.
[0125] It should be noted that the wear leveling degree of each channel and the thermal retention rate of the memory block after migration are calculated, the calculation results are evaluated, and the specific embodiment of adjusting the migration amount based on the evaluation results is as follows:
[0126] Taking a NAND flash memory system as an example, the wear leveling degree of each channel after migration is first calculated (formula: δ = Σ|erase count - global average| / number of channels × 100%. For example, if the erase counts of channels A / B / C are 2800 / 3200 / 3000, the wear leveling degree δ = (200 + 200 + 0) / 3 = 13.3%). This is combined with the thermal retention rate (data retention time is predicted based on the bit error rate extrapolated. For example, if the storage block is maintained at 85°C for ≥7 days after migration, the thermal retention rate = measured retention time / predicted time × 100% = 92%). If the evaluation result does not meet the requirements (for example, δ > 15% or the thermal retention rate < 90%), the migration amount is adjusted through dynamic migration threshold adjustment (initial threshold Δ = 30%, lowered by 3% for every 5% increase in wear level deviation) and priority queue weight adjustment (for every 5% decrease in thermal retention rate, the cold data migration weight α is increased by 0.2). For example, when δ=18%, secondary migration is triggered to screen storage blocks with a difference in erase counts greater than 250 times (such as blocks with an erase count greater than 3450 times in channel B). An additional 20% migration amount is added through a probabilistic allocation algorithm (the migration probability of high-wear channels is increased to 70%), thereby improving channel balance and thermal retention. At the same time, the number of migration operations is reduced (for example, from 120 times per day to 78 times), thereby reducing the overall write amplification factor.
[0127] like Figure 2 According to another embodiment of the present invention, a wear leveling system for solid-state storage is provided, including:
[0128] Thermodynamic entropy value calculation module 1 is used to divide the solid-state storage device into several logical intervals according to the timing characteristics of data access, and calculate the corresponding thermal entropy value based on the data access behavior of each logical interval;
[0129] Allocation sequence mapping module 2 is used to construct a hot and cold intensity matrix based on the thermal entropy value of each logical interval, and map the hot and cold intensity matrix to a corresponding storage block allocation sequence based on a binary search tree;
[0130] Cross-channel allocation module 3 is used to build a free storage block resource pool based on the storage block allocation sequence, use the gradient pointer mechanism to cover the preset erase interval, and combine the channel status mask with the probabilistic selection algorithm to perform cross-channel storage block allocation;
[0131] The migration operation module 4 is used to sort the storage blocks in each channel in descending order according to the thermal entropy value based on the storage block allocation result, and perform cross-channel migration operation according to the sorting result.
[0132] In summary, the above-mentioned technical solutions of the present invention optimize storage resource allocation by analyzing timing characteristics to divide logical intervals. Simultaneously, a hot-cold intensity matrix mapping mechanism based on a binary search tree is employed to achieve efficient storage block layout, thereby reducing data migration frequency and storage fragmentation, lowering the write amplification effect, and effectively extending the service life of solid-state storage devices. A gradient pointer mechanism is introduced to dynamically manage erase intervals, and a channel state-aware algorithm is combined to prioritize the use of low-wear storage blocks, alleviating the erase and write pressure on a single channel. A probabilistic selection strategy and channel masking technology are used to adaptively adjust cross-channel resource allocation weights, balancing the degree of wear across channels and preventing premature aging of local areas, thereby improving the stability and reliability of the storage medium. A migration strategy based on decreasing thermal entropy, combined with a dynamic priority queue and hash mapping algorithm, achieves intelligent redistribution of storage blocks across channels. A continuous monitoring and feedback mechanism optimizes global wear leveling, reduces the impact of migration operations on system performance, ensures storage response efficiency in high-concurrency scenarios, and provides continuous wear leveling support for solid-state storage devices.
[0133] 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, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A loss leveling method for solid-state storage, characterized in that: include: S1. Divide the solid-state storage device into several logical intervals according to the timing characteristics of data access, and calculate the corresponding thermal entropy value based on the data access behavior of each logical interval; S2. Construct a hot / cold intensity matrix based on the thermal entropy value of each logical interval, and map the hot / cold intensity matrix to a corresponding storage block allocation sequence based on a binary search tree. S3. Based on the memory block allocation sequence, a free memory block resource pool is constructed. The gradient pointer mechanism is used to cover the preset erase interval. The channel state mask and the probabilistic selection algorithm are combined to perform cross-channel memory block allocation. S4. Based on the storage block allocation result, the storage blocks in each channel are sorted in descending order according to the thermal entropy value, and a cross-channel migration operation is performed based on the sorting result; Wherein, the S2 includes: S23. Perform cluster analysis on the hot and cold intensity matrix based on the hierarchical clustering algorithm, combining the heat scores of the logical intervals with the spatial topological relationship, and divide the logical intervals into several hot and cold intervals based on the analysis results. The S23 includes: S231. Based on the constructed hot and cold intensity matrix, extract the heat score and spatial topological relationship of each logical interval and construct a multidimensional feature matrix; S232. Calculate and integrate the heat similarity and spatial proximity between the logical intervals based on the multidimensional feature matrix to construct an amplification formula; S233, combining the hierarchical clustering algorithm with the amplification formula to cluster the logical intervals into clusters and generate a hierarchical tree structure; S234. Based on the generated tree structure, combined with the heat distribution and spatial association, set a partitioning standard and divide the logical interval into a number of hot and cold intervals, wherein the hot and cold intervals include a hot zone, a cold zone, and a transition zone; The expression of the amplification formula is: ; Where, T ( i , j ) represents a logical interval i and j Enhanced distance; i Represents the index value; j Represents the index value; D ( S i , S j ) represents the heat score sequence S i and S j similarity; S i Represents a logical interval i The heat score sequence of S j Represents a logical interval j The heat score sequence of γ represents the spatial coupling coefficient; D ( i , j ) represents a logical interval i and j spatial proximity distance; D max represents the maximum spatial proximity distance; λ ( t ) represents the dynamic attenuation factor; η represents the gradient penalty coefficient; Represents the thermal gradient.
2. A solid-state storage loss leveling method according to claim 1, characterized in that: The process of constructing a hot and cold intensity matrix according to the thermal entropy value of each logical interval and mapping the hot and cold intensity matrix to a corresponding storage block allocation sequence based on a binary search tree includes: S21. Normalize the thermal entropy value of each logical interval to generate a standardized heat score; S22. Based on the numbering order of the logical intervals, fill the standardized heat scores into corresponding positions in the matrix according to the preset priority rules to construct a hot and cold intensity matrix; The process of constructing a hot and cold intensity matrix based on the thermal entropy value of each logical interval and mapping the hot and cold intensity matrix to a corresponding storage block allocation sequence based on a binary search tree includes: S24. Based on the division result of hot and cold intervals, a binary search tree is constructed with the heat score of the logical interval as the key value, and the binary search tree is traversed in order to generate a mapping table from logical blocks to storage blocks, and a storage block allocation sequence is obtained.
3. A solid-state storage loss leveling method according to claim 2, characterized in that: The method of combining the hierarchical clustering algorithm with the amplification formula to cluster the logical intervals into clusters and generate a hierarchical tree structure includes: S2331. Taking each logical interval as an initial class, a global covariance matrix is constructed based on the heat similarity and spatial proximity of all logical intervals. S2332, initializing the covariance matrix of each initial class to half the size of the corresponding global covariance matrix, and using the amplification formula to calculate the similarity between any two classes to generate a similarity matrix; S2333. Select the two classes with the highest similarity from the similarity matrix and merge them, calculate the covariance matrix of the merged new class, and use the amplification formula to calculate the similarity between the new class and all classes, and update the similarity matrix; S2334, continue to iterate and update the similarity matrix, and detect whether the preset termination condition is met. If so, generate a hierarchical tree structure. Otherwise, return to step S2332 to continue iterating until the preset termination condition is met.
4. A solid-state storage loss leveling method according to claim 3, characterized in that: Based on the generated tree structure, combined with heat distribution and spatial association, the partitioning standard is set, and the logical interval is divided into several hot and cold intervals including: S2341, traversing each level node in the tree structure, calculating the joint entropy value of each level node based on heat similarity and spatial proximity, and screening candidate cutting layers according to a preset entropy value threshold to construct a candidate cutting layer set; S2342. Based on each candidate cutting layer, the score of each candidate cutting layer is evaluated by combining heat distribution and spatial correlation through weighted scoring, and the candidate cutting layer with the highest score is selected as the partitioning standard for logical interval division; S2343. Classify each logical interval according to the selected demarcation standard to obtain a number of hot and cold intervals, wherein the hot and cold intervals include a hot zone, a cold zone, and a transition zone.
5. The wear leveling method for solid-state storage according to claim 4, characterized in that: According to the hot and cold interval division result, a binary search tree is constructed with the heat score of the logical interval as a key value, and a mapping table from the logical block to the storage block is generated by in-order traversal of the binary search tree. Obtaining the storage block allocation sequence includes: S241. Based on the hot and cold interval division results, the logic blocks are sorted using the heat score of each logic block as a key value to generate an ordered sequence arranged in ascending order of heat score. S242. Select an intermediate element from the ordered sequence as the root node of the binary search tree, and use the intermediate element to divide the ordered sequence into two parts, and recursively construct a left subtree and a right subtree based on the division results; S243, repeat step S242 until all logic blocks are inserted to construct a binary search tree; S244. Perform an in-order traversal on the constructed binary search tree to generate a sequence of logic blocks arranged in descending order according to the heat scores, and establish a mapping relationship table from logic blocks to storage blocks according to the traversal order to obtain a storage block allocation sequence.
6. The wear leveling method for solid-state storage according to claim 1, wherein: The step of arranging the storage blocks in each channel in descending order according to the thermal entropy value according to the storage block allocation result and performing the cross-channel migration operation according to the sorting result includes: S41. Based on the storage block allocation result, the weight parameters in the thermal entropy value calculation are dynamically adjusted using an adaptive algorithm, and the storage blocks are sorted in descending order based on the updated thermal entropy values in each channel to generate a migration priority queue for each channel. S42: Calculate the wear difference between channels, combine the preset migration trigger threshold and the migration priority queue, filter out the storage blocks to be migrated, and establish a set to be migrated; S43, performing hash processing on the storage blocks in the to-be-migrated set, and evenly distributing the processed storage blocks to the target wear channels; S44: Calculate the wear leveling degree of each channel and the thermal retention rate of the storage block after the migration, evaluate the calculation results, and adjust the migration amount based on the evaluation results.
7. The wear leveling method for solid-state storage according to claim 6, characterized in that: The performing hash processing on the storage blocks in the to-be-migrated set and evenly distributing the processed storage blocks to the target wear channels includes: S431, calculating a compensation factor for each storage block based on the thermal entropy value of each storage block and the load balancing status of each channel during the migration operation; S432. Calculate the migration priority of each storage block using a weighted formula based on the thermal entropy value of the storage block and the corresponding compensation factor. S433: Arrange all storage blocks in the set to be migrated in descending order according to the migration priority, and process the sorted storage blocks using a hash algorithm to generate a hash mapping value to determine the target wear channel corresponding to each storage block; S434. Allocate the processed storage blocks to the corresponding target wear channels in sequence according to a preset polling mechanism to ensure that the storage blocks are evenly distributed among different channels. S435: Repeat step S434 until all storage blocks to be migrated are allocated.
8. A solid-state storage loss leveling system, used to implement the solid-state storage loss leveling method according to any one of claims 1 to 7, characterized in that: include: A thermal entropy value calculation module is used to divide the solid-state storage device into several logical intervals according to the timing characteristics of data access, and calculate the corresponding thermal entropy value based on the data access behavior of each logical interval; The allocation sequence mapping module is used to construct a hot and cold intensity matrix based on the thermal entropy value of each logical interval, and map the hot and cold intensity matrix to the corresponding storage block allocation sequence based on a binary search tree; The cross-channel allocation module is used to build a free storage block resource pool based on the storage block allocation sequence, use the gradient pointer mechanism to cover the preset erase interval, and combine the channel status mask with the probabilistic selection algorithm to perform cross-channel storage block allocation; The migration operation module is used to sort the storage blocks in each channel in descending order according to the thermal entropy value based on the storage block allocation result, and perform cross-channel migration operations based on the sorting result.
Citation Information
Patent Citations
Memory management method, memory control circuit unit and memory storage device
CN105988950A
Fuel cell air compressor heat dissipation method, device and equipment
CN119878497A