Solid state disk garbage collection method and device, electronic equipment and storage medium

By evaluating the data distribution uniformity of logical units and physical blocks in solid-state drives and dynamically selecting data migration and resource recycling strategies, the problem of write amplification in garbage collection is solved, and the garbage collection efficiency and storage system performance are improved.

CN120353724AActive Publication Date: 2025-07-22INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202510828526.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-07-22
Estimated Expiration
2045-06-19

AI Technical Summary

Technical Problem

In the prior art, the write amplification problem caused by forced migration of super blocks during solid-state drive garbage collection, resulting in the read performance advantages that cannot be released, the system burden is increased, and the garbage collection efficiency is limited.

Method used

By obtaining the first effective data parameters of multiple logical units in the storage system and the second effective data parameters of the physical block, evaluating the data distribution uniformity, filtering the target logical units, and dynamically selecting the data migration method and resource recycling strategy based on the distribution uniformity evaluation results, avoiding redundant operations, and optimizing the utilization of storage resources.

Benefits of technology

It improves the screening accuracy and efficiency of garbage collection, reduces write amplification phenomenon, optimizes the life of NAND flash memory, and improves the performance and resource utilization of the storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120353724A_ABST
    Figure CN120353724A_ABST
Patent Text Reader

Abstract

The invention provides a solid state disk garbage collection method and device, electronic equipment and a storage medium. The method comprises the steps that first effective data parameters of a plurality of logic units in a storage system and second effective data parameters of physical blocks contained in the logic units are obtained; based on the first effective data parameter and the second effective data parameter, evaluating the distribution uniformity of the effective data in the plurality of logic units, and based on a distribution uniformity evaluation result, screening at least one target logic unit needing garbage collection; based on the second valid data parameter, determining a data migration mode of valid data stored in the target physical block in each target logic unit, and performing data migration; and after the effective data is migrated, judging whether the target physical block needs resource recovery or not according to a data migration mode of the effective data stored in the target physical block, and carrying out resource recovery on the target physical block needing resource recovery. Compared with the prior art, the screening precision can be improved, and the garbage recycling efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of storage technologies, and in particular, to a method and apparatus for garbage collection of a solid state drive, an electronic device, and a storage medium. Background Art

[0002] With the wide application of enterprise solid state drives (SSDs) in data centers and high-performance computing fields, the optimization of their performance and lifespan has become a key technical challenge. Currently, SSD garbage collection generally uses the number of valid data frames (VDFC) at the superblock level as the screening and evaluation criterion. Garbage collection (GC) is a mechanism in a computer system to automatically reclaim the space occupied by invalid data, and its core goal is to release storage resources for reuse. With the development of NAND flash technology, the capacity of a single physical block has increased significantly, resulting in a significant increase in the total capacity of superblocks. It is difficult to break through the selection accuracy of VDFC, which directly limits the further improvement of garbage collection efficiency. The recycling mechanism based on the entire superblock forces the migration of all valid data, which causes excessive write amplification when the proportion of valid data in some physical blocks is extremely high; the read performance of the NAND backend is much higher than the write performance, but the traditional solution forces the read operation amount of garbage collection to strictly correspond to the write operation amount, resulting in the inability to release the read performance advantage, and the user-written data and the garbage collection operation form a fixed proportion of write amplification, further exacerbating the system burden. Summary of the Invention

[0003] The present disclosure provides a method and apparatus for garbage collection of a solid state drive, an electronic device, and a storage medium. Its main purpose is to solve the problem of write amplification caused by the coarse-grained operation of forced migration of superblocks during garbage collection in related technologies. According to a first aspect of the present disclosure, there is provided a method for garbage collection of a solid state drive, including: obtaining first valid data parameters of a plurality of logical units in a storage system and second valid data parameters of physical blocks included in each logical unit; evaluating the distribution uniformity of valid data among the plurality of logical units based on the first valid data parameters and the second valid data parameters, and screening at least one target logical unit that needs to perform garbage collection based on the evaluation result of the distribution uniformity; determining a data migration method for the valid data stored in the target physical blocks in each target logical unit based on the second valid data parameters, and performing data migration; After the effective data migration, determine whether the target physical block needs resource recovery according to the data migration method of the effective data stored in the target physical block, and perform resource recovery on the target physical block that needs resource recovery.

[0004] Optionally, based on multi-level evaluation parameters, evaluate the distribution uniformity of the effective data in multiple logical units, including: Calculate the data distribution deviation degree of each physical block based on the second effective data parameter and the corresponding first effective data parameter of each physical block; Aggregate the data distribution deviation degrees of the physical blocks in multiple logical units to generate a deviation characteristic parameter representing the distribution uniformity of the effective data in the logical unit.

[0005] Optionally, based on the distribution uniformity evaluation result, screen at least one target logical unit that needs to perform garbage collection, including: Calculate the recovery priority levels of multiple logical units respectively according to the deviation characteristic parameter; Based on the recovery priority levels, screen at least one target logical unit that needs to perform garbage collection.

[0006] Optionally, before determining the data migration method of the effective data stored in the target physical block in each target logical unit based on the second effective data parameter and performing data migration, the method for solid-state drive garbage collection further includes: Calculate the migration threshold for the effective data to perform data migration based on the first effective data parameters of multiple logical units.

[0007] Optionally, calculating the migration threshold for the effective data to perform data migration based on the first effective data parameters of multiple logical units includes: Calculate the global average effective data parameter by using the first effective data parameters of multiple logical units; Calculate and generate the migration threshold according to the global average effective data parameter, the number of physical blocks in the target logical unit, and the first constant.

[0008] Optionally, the data migration methods include: mapping migration, physical migration.

[0009] Optionally, based on the second effective data parameter, determine the data migration method of the effective data stored in the target physical block in each target logical unit and perform data migration, including: Compare the second effective data parameter with the migration threshold to determine the data migration method of the effective data stored in the migration target physical block; Migrate the effective data stored in the target physical block to the first logical unit or the second logical unit according to the data migration method.

[0010] Optionally, comparing the second valid data parameter with the migration threshold to determine a data migration method for valid data stored in the migration target physical block includes: If the second valid data parameter of the target physical block exceeds the migration threshold, determining that the data migration mode of the valid data stored in the target physical block is mapping migration; If the second valid data parameter of the target physical block is less than or equal to the migration threshold, it is determined that the data migration mode of the valid data stored in the target physical block is physical migration.

[0011] Optionally, migrating valid data stored in the target physical block to the first logical unit or the second logical unit according to the data migration method includes: If the data migration mode is mapping migration, the mapping relationship between the target physical block and the target logical unit is released, and the target physical block is mapped to the first logical unit; If the data migration mode is physical migration, the valid data stored in the target physical block is read, and the valid data is written into the physical block of the second logical unit.

[0012] Optionally, before determining the data migration mode of valid data stored in the target physical block in each target logical unit based on the second valid data parameter and performing data migration, the solid state drive garbage collection method further includes: Based on the free logical unit and the empty physical block, a first logical unit and a second logical unit are created.

[0013] Optionally, creating the first logical unit and the second logical unit based on the free logical unit and the empty physical block includes: Selecting an idle logical unit from an idle resource pool and selecting an idle physical block from an idle physical block pool to generate a first logical unit; An idle logical unit is selected from the idle resource pool and a plurality of idle physical blocks are selected from the idle physical block pool to generate a second logical unit.

[0014] Optionally, selecting an idle logical unit from an idle resource pool and selecting an idle physical block from an idle physical block pool to generate a first logical unit includes: Configure a selected idle logical unit as a check block; A mapping relationship between the check block and the idle logical unit is established to generate a first logical unit.

[0015] Optionally, selecting an idle logical unit from an idle resource pool and selecting multiple idle physical blocks from an idle physical block pool to generate a second logical unit includes: Select one of the plurality of idle physical blocks and configure it as a check block, wherein the plurality of idle physical blocks come from different wafer dies; Establish a mapping relationship between the verification block and the remaining free physical blocks with free logical units to generate a second logical unit.

[0016] Optionally, before performing resource recovery on a target physical block that needs resource recovery, the method for solid-state drive garbage collection further includes: Release the mapping relationship between at least one target logical unit and each target physical block; Recycle the target logical unit with the mapping relationship released into the free resource pool as a free logical unit.

[0017] Optionally, determining whether the target physical block needs resource recovery according to the data migration method of the valid data stored in the target physical block includes: If the data migration method is mapping migration, determine that the target physical block does not need to perform resource recovery; If the data migration method is physical migration, determine that the target physical block needs to perform resource recovery.

[0018] Optionally, performing resource recovery on a target physical block that needs resource recovery includes: Erase the data of the target physical block that needs resource recovery; Recycle the physical block after data erasure processing into the free physical block pool as a free physical block.

[0019] According to a second aspect of the present disclosure, there is provided an apparatus for solid-state drive garbage collection, including: An acquisition unit, configured to acquire first valid data parameters of multiple logical units in a storage system and second valid data parameters of physical blocks included in each logical unit; A screening unit, configured to evaluate the distribution uniformity of valid data among multiple logical units based on the first valid data parameters and the second valid data parameters, and screen at least one target logical unit that needs to perform garbage collection based on the distribution uniformity evaluation result; A determination unit, configured to determine the data migration method of the valid data stored in the target physical block in each target logical unit based on the second valid data parameters and perform data migration; A recovery unit, configured to, after the valid data is migrated, determine whether the target physical block needs resource recovery according to the data migration method of the valid data stored in the target physical block, and perform resource recovery on the target physical block that needs resource recovery.

[0020] Optionally, the screening unit includes: A first calculation module, configured to calculate the data distribution deviation degree of each physical block based on the second valid data parameters of each physical block and the corresponding first valid data parameters; A first generation module for aggregating the data distribution deviation of physical blocks in multiple logical units to generate a deviation characteristic parameter representing the uniformity of the effective data distribution of the logical unit.

[0021] Optionally, the screening unit includes: A second calculation module for calculating the recycling priorities of multiple logical units respectively according to the deviation characteristic parameter; A screening module for screening at least one target logical unit that needs to perform garbage collection based on the recycling priority.

[0022] Optionally, the solid state drive garbage collection device further includes: A calculation unit for calculating a migration threshold for the data migration of the effective data before determining the data migration method of the effective data stored in the target physical block in each target logical unit and performing data migration based on the first effective data parameter of multiple logical units.

[0023] Optionally, the calculation unit includes: A third calculation module for calculating a global average effective data parameter by using the first effective data parameter of multiple logical units; A fourth calculation module for calculating and generating a migration threshold according to the global average effective data parameter, the number of physical blocks in the target logical unit, and a first constant.

[0024] Optionally, the data migration method includes: mapping migration, physical migration.

[0025] Optionally, the determination unit includes: A first determination module for comparing the second effective data parameter with the migration threshold to determine the data migration method of the effective data stored in the migration target physical block; A migration module for migrating the effective data stored in the target physical block to a first logical unit or a second logical unit according to the data migration method.

[0026] Optionally, the first determination module is further configured to: If the second effective data parameter of the target physical block exceeds the migration threshold, determine that the data migration method of the effective data stored in the target physical block is mapping migration; If the second effective data parameter of the target physical block is less than or equal to the migration threshold, determine that the data migration method of the effective data stored in the target physical block is physical migration.

[0027] Optionally, the migration module is further configured to: If the data migration method is mapping migration, release the mapping relationship between the target physical block and the target logical unit, and map the target physical block to the first logical unit; If the data migration method is physical migration, read the valid data stored in the target physical block and write the valid data into the physical block of the second logical unit.

[0028] Optionally, the solid-state drive garbage collection device further includes: A creation unit, configured to create a first logical unit and a second logical unit based on free logical units and empty physical blocks before determining the data migration method of the valid data stored in the target physical block in each target logical unit based on the second valid data parameter and performing data migration.

[0029] Optionally, the creation unit includes: A second generation module, configured to select an idle logical unit from the free resource pool and an idle physical block from the free physical block pool to generate a first logical unit; A third generation module, configured to select an idle logical unit from the free resource pool and multiple idle physical blocks from the free physical block pool to generate a second logical unit.

[0030] Optionally, the second generation module is further configured to: Configure the selected idle logical unit as a parity block; Establish a mapping relationship between the parity block and the idle logical unit to generate a first logical unit.

[0031] Optionally, the third generation module is further configured to: Select one physical block from the multiple idle physical blocks to be configured as a parity block, and the multiple idle physical blocks come from different die; Establish a mapping relationship between the parity block and the remaining idle physical blocks with the idle logical unit to generate a second logical unit.

[0032] Optionally, the solid-state drive garbage collection device further includes: A de-mapping unit, configured to de-map at least one target logical unit from each target physical block before performing resource recovery on the target physical block that needs resource recovery; and recycle the de-mapped target logical unit as an idle logical unit to the free resource pool.

[0033] Optionally, the recovery unit further includes: A second determination module, configured to determine that the target physical block does not need resource recovery if the data migration method is mapping migration; A third determination module, configured to determine that the target physical block needs resource recovery if the data migration method is physical migration.

[0034] Optionally, the recovery unit further includes: An erasure module, configured to erase data from the target physical block that needs resource recovery; A recycling module, configured to recycle physical blocks that have undergone data erasure processing as free physical blocks into a free physical block pool.

[0035] According to a third aspect of the present disclosure, there is provided an electronic device, including: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for solid-state drive garbage collection described in the foregoing first aspect.

[0036] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method for solid-state drive garbage collection described in the foregoing first aspect.

[0037] According to a fifth aspect of the present disclosure, there is provided a computer program product, including a computer program, which when executed by a processor implements the method for solid-state drive garbage collection described in the foregoing first aspect.

[0038] The present disclosure provides a method and apparatus for solid-state drive garbage collection, an electronic device, and a storage medium, relating to the field of storage technology. Compared with the related art, through refined evaluation of physical block-level parameters, the present disclosure can accurately locate logical units and physical blocks with uneven distribution of valid data. It can preferentially trigger units with more urgent recycling requirements, avoiding the efficiency bottleneck caused by "one-size-fits-all" recycling. By screening target logical units based on the evaluation result of distribution uniformity, the screening accuracy can be improved, and the garbage collection efficiency can be enhanced. By identifying logical units where "valid data is concentrated in some physical blocks", it is possible to avoid ineffective recycling of units with a large amount of valid data but significant differences in internal physical blocks, reducing redundant operations. It reduces the NAND write volume of high-valid-data blocks, avoiding write amplification caused by "writing all valid data into a new block". It reduces unnecessary erasure operations, giving priority to the NAND lifespan for user writes rather than redundant writes generated by garbage collection. In combination with dynamic mapping, recycled logical units can be reallocated as free blocks, improving the utilization rate of storage resources.

[0039] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them: Figure 1Schematic flowchart of a method for solid-state drive garbage collection provided by an embodiment of the present disclosure; Figure 2 Schematic flowchart of another method for solid-state drive garbage collection provided by an embodiment of the present disclosure; Figure 3 Schematic flowchart of a data migration process provided by an embodiment of the present disclosure; Figure 4 Schematic structural diagram of a device for solid-state drive garbage collection provided by an embodiment of the present disclosure; Figure 5 Schematic structural diagram of another device for solid-state drive garbage collection provided by an embodiment of the present disclosure. Detailed implementation manners

[0041] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to assist understanding and should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, descriptions of well-known functions and structures are omitted below for clarity and conciseness.

[0042] The following describes a method and device for solid-state drive garbage collection, an electronic device, and a storage medium according to embodiments of the present disclosure with reference to the drawings.

[0043] Figure 1 Schematic flowchart of a method for solid-state drive garbage collection provided by an embodiment of the present disclosure.

[0044] As Figure 1 shown, the method includes the following steps: Step 101, obtain first valid data parameters of multiple logical units in the storage system and second valid data parameters of physical blocks included in each logical unit.

[0045] In an embodiment of the present disclosure, in a storage system based on NAND flash memory, data storage and management follow a hierarchical structure of physical blocks and physical pages: A physical block is the smallest unit for data erasure, while a physical page is the smallest unit for data writing and reading, and data cannot be directly deleted at the physical page level. Instead, the space is released by erasing the entire physical block. A logical unit, as an upper-level unit for data organization (such as a superblock in an SSD), consists of multiple physical blocks that form a RAID stripe (such as RAID 5) to achieve data protection. In the storage system, a logical unit, as the basic unit for data organization and management (such as a superblock in an SSD), contains several physical blocks (such as blocks in NAND flash). Through the main control chip or firmware layer of the storage system, a hierarchical association mapping relationship between the logical unit and the physical block is established. When performing garbage collection, it is also necessary to ensure the normal storage of valid data. Therefore, when performing garbage collection, the following two types of parameters need to be collected: The first valid data parameter: A statistical parameter representing the overall amount of valid data in the logical unit (such as VDFC at the superblock level, i.e., the total number of valid data). It is generated by traversing the address mapping tables of all physical blocks within the logical unit and counting the number of data frames marked as "valid". The second valid data parameter: A breakdown parameter representing the amount of valid data in each physical block within the logical unit. It is generated by parsing the RAID stripe structure (such as RAID 5) of the logical unit and independently counting the number of valid data frames for each physical block. The first valid data parameter and the second valid data parameter can be the amount of valid data or other metrics such as the data density of valid data. The present disclosure does not limit the specific parameter form.

[0046] In the related art, only the logical unit-level valid data parameter (superblock VDFC) is collected, and the coarsening of the evaluation granularity results in the inability to identify the differences in the distribution of valid data among the physical blocks within the logical unit. The embodiment of the present disclosure expands the evaluation dimension from the logical unit level to the physical block level through a hierarchical parameter collection mechanism, solving the problem of "overall evaluation masking local differences" in the related art and providing a data basis for a refined garbage collection strategy. By introducing the physical block-level parameter (the second valid data parameter), the degree of dispersion of valid data within the logical unit can be quantified, avoiding the situation where the high proportion of invalid data in local physical blocks is ignored due to the balance of the overall amount of valid data in the logical unit.

[0047] Step 102: Based on the first valid data parameter and the second valid data parameter, evaluate the distribution uniformity of the valid data among multiple logical units, and based on the evaluation result of the distribution uniformity, screen at least one target logical unit that needs to perform garbage collection.

[0048] In an embodiment of the present disclosure, the distribution uniformity of the valid data of a logical unit is quantitatively characterized by the degree of dispersion of the physical block-level valid data parameters it contains. Based on the multi-level evaluation parameters (i.e., the first valid data parameter at the logical unit level and the second valid data parameter at the physical block level), this module uses statistical analysis methods (such as variance calculation, extreme value comparison) to evaluate the distribution balance of the valid data within each logical unit among physical blocks. The specific process is as follows: The distribution characteristics of the valid data of a logical unit are directly related to the space utilization efficiency of the internal physical blocks. Based on the underlying mechanism of NAND flash memory of "physical block erasure, physical page writing", by analyzing the multi-level evaluation parameters (i.e., the first valid data parameter at the logical unit level and the second valid data parameter at the physical block level), the distribution state of the valid data within the logical unit in the physical block dimension is quantitatively evaluated, specifically including: for each logical unit, traversing the set of physical blocks it contains, and based on the second valid data parameter (such as the number of valid data frames at the physical block level VDFC_B), extracting information such as the amount of valid data, the proportion, and the address mapping of each physical block. By establishing a two-dimensional distribution model of "valid data - physical address" of the physical blocks, the spatial dispersion degree of data storage within the logical unit is characterized.

[0049] When performing quantitative analysis of distribution uniformity, it is possible to use but not limited to statistical quantities such as standard deviation and coefficient of variation to quantify the difference degree of the amount of valid data among physical blocks; by setting a threshold for the amount of valid data (such as a percentage of the global average amount of valid data), dividing the "high proportion blocks of valid data" and the "low proportion blocks of valid data", and calculating the quantity proportion or space proportion of the two types of physical blocks in the logical unit. Finally, a distribution uniformity index of the logical unit is generated, and this index is negatively correlated with the difference in the amount of valid data among physical blocks, that is, the greater the difference, the worse the uniformity.

[0050] Combining the first valid data parameter at the logical unit level (such as the overall amount of valid data of the logical unit VDFC) and the distribution uniformity index, a composite screening condition is constructed according to the distribution uniformity index. The logical units that meet the conditions are included in the target set and enter the subsequent garbage collection process. For the selected target logical units, a processing method of priority rating can be carried out to achieve an orderly processing of the target logical units and optimize the resource scheduling efficiency of garbage collection.

[0051] Through the analysis of the distribution of valid data at the physical block level, accurately identify the set of physical blocks with "low proportion of valid data" in the logical unit, avoid redundant erasures on high valid data blocks, and reduce the consumption of the number of PEs of NAND flash memory. Based on the distribution uniformity evaluation results, differential processing is implemented for the logical units. Compared with the "one-size-fits-all" overall recycling of logical units in the related technology, the amount of valid data migration can be reduced.

[0052] Step 103: Based on the second valid data parameter, determine the data migration method for the valid data stored in the target physical block in each target logical unit and perform data migration.

[0053] In the embodiments of the present disclosure, according to its own storage situation, the storage system needs to clean up the invalid data stored to recycle the storage resources. Therefore, a garbage collection instruction will be generated to the selected target logical unit for garbage collection. For the target physical block in the target logical unit, based on the second valid data parameter at the physical block level (such as the number of valid data frames), combined with the physical characteristics of the NAND flash memory (such as the write / erase cycle limit and read / write performance difference), a data migration strategy is dynamically selected. Analyzing the second valid data parameter of each physical block in the target logical unit, the following data characteristics can be used for data migration, for example, the proportion of valid data, the data volume of the valid data frame, etc. Based on the above characteristics, the target physical blocks are divided into two categories and the migration methods are matched: High valid data blocks (such as the proportion of valid data is higher than the threshold T): Adopt the data remapping strategy. By updating the mapping relationship between the logical unit and the physical block (such as dynamic RAID stripe reorganization), map the logical address of the physical block to a new storage location, and only perform the update and write of the RAID check data to avoid full-scale data migration. Low valid data blocks (such as the proportion of valid data is lower than the threshold T): Adopt the traditional garbage collection strategy, read the valid data in the physical block and write it to a new physical block, and erase the original physical block after the data migration is completed. The remapping strategy reduces the write / erase times (PE times) of high valid data blocks, and preferentially allocates the limited NAND lifetime resources to the user data writing rather than the redundant operations generated by garbage collection. The remapping strategy utilizes the characteristic that the "read speed of the NAND flash memory is higher than the write speed", simplifies the "read + full-scale write" of the traditional scheme to "read + check write", and significantly reduces the single-block migration time; the two strategies are executed in parallel, supporting the storage system to dynamically schedule migration tasks according to the load and improving the concurrent processing ability of garbage collection.

[0054] Step 104: After the valid data migration, determine whether the target physical block needs resource recovery according to the data migration method of the valid data stored in the target physical block, and perform resource recovery on the target physical block that needs resource recovery.

[0055] In an embodiment of the present disclosure, after completing the migration operation of the valid data within the target logic unit, the module performs differential resource recycling at the logic unit level and the physical block level to release the invalid storage space and maintain the availability of the storage system. Based on the first valid data parameter at the logic unit level after migration (such as the overall amount of valid data), combined with the change in the mapping relationship of the internal physical blocks, it is determined whether the logic unit enters the recyclable state. Typical conditions for the recyclable state include, but are not limited to: all physical blocks within the target logic unit have completed data migration or remapping; the RAID stripe corresponding to the target logic unit has achieved data protection switching through parity data reconstruction. Based on the second valid data parameter at the physical block level during the data migration stage, the target physical blocks that need to perform resource recycling are screened out; for the physical blocks migrated using the traditional garbage collection strategy, if the amount of valid data after migration is zero, they are marked as "erasable"; for the original physical blocks involved in the remapping strategy, if the logical address decoupling has been achieved through parity data update, no data erasure is performed.

[0056] The present disclosure provides a method for solid-state drive garbage collection. Compared with the related art, through refined evaluation of physical block-level parameters, the present disclosure can accurately locate the logic units and physical blocks with uneven distribution of valid data. It can preferentially trigger the units with more urgent recycling needs, avoiding the efficiency bottleneck caused by the "one-size-fits-all" type of recycling. Screening the target logic units based on the evaluation result of distribution uniformity can improve the screening accuracy and the garbage collection efficiency. By identifying the logic units with "valid data concentrated in some physical blocks", it is possible to avoid ineffective recycling of the units with a large amount of valid data but significant differences in internal physical blocks, reducing redundant operations. Reducing the NAND write volume of high-valid-data blocks, avoiding the write amplification caused by "writing all valid data into new blocks". Reducing unnecessary erasure operations, and preferentially using the NAND lifespan for user writes rather than the redundant writes generated by garbage collection. Combining dynamic mapping, the recycled logic units can be reallocated as free blocks, improving the storage resource utilization rate.

[0057] To clearly illustrate the embodiments of the present disclosure, this embodiment provides a flowchart of another method for solid-state drive garbage collection.

[0058] As Figure 2 shown, the method includes the following steps: Step 201, obtain the first valid data parameters of multiple logic units in the storage system and the second valid data parameters of the physical blocks included in each logic unit.

[0059] Specifically, in step 201, in a storage system based on NAND flash memory, the logical unit is the basic unit of data organization, and the effective data distribution of its internal physical blocks directly affects the garbage collection efficiency and NAND life. The first effective data parameter (logical unit level) represents the effective data frame quantity of the entire logical unit, superblock level VDFC. The second effective data parameter (physical block level) represents the effective data distribution of each physical block in the logical unit, physical block level VDFC_B (single block effective data quantity). Based on the RAID stripe structure of the logical unit (superblock is dynamically composed of blocks of each die), the number of effective data frames is independently counted by physical block (such as VDFC8_B2 represents the number of effective data frames of the second physical block in superblock 8). The parameters are updated in real time during user IO operations (such as data writing and updating): when data is written to a new physical block, the corresponding VDFC_B is increased by 1, and the old physical block VDFC_B is decreased by 1; when garbage collection migrates data, the source physical block VDFC_B is decreased by 1, and the target physical block VDFC_B is increased by 1.

[0060] The mapping relationship between logical units and physical blocks is no longer fixed, but is updated through garbage collection. For example, when a physical block is determined to be "low VDFC_B" and needs to be recycled, it is unmapped from the original logical unit and reallocated to the free block pool; in the remapping scenario, the high VDFC_B physical block is dynamically bound by adding a new logical unit (such as superblock B) to update the RAID parity mapping.

[0061] Step 202: Calculate the data distribution deviation of each physical block based on the second valid data parameter of each physical block and the corresponding first valid data parameter.

[0062] Specifically, in step 202, the data distribution deviation of the physical block is used to quantify the difference between the number of valid data frames of each physical block in the logical unit and the number of valid data frames of the entire logical unit. The calculation is based on the linkage analysis of the logical unit level VDFC (first valid data parameter) and the physical block level VDFC_B (second valid data parameter). When calculating the data distribution deviation, assuming that there are N physical blocks contained in the logical unit n, the data distribution deviation D(n,i) of the i-th physical block is defined as: D(n,i)=VDFC(n)_B(i)⋅N / VDFC(n)−1 Among them, VDFC(n) is the total number of valid data frames of logical unit n (the first valid data parameter); VDFC(n)_B(i) is the number of valid data frames of the i-th physical block in logical unit n (the second valid data parameter); N is the total number of physical blocks included in logical unit n. This formula reflects the degree of deviation of the number of valid data frames of a single physical block from the number of valid data frames of physical blocks within the logical unit. When VDFC(n)_B(i) is equal to the number of valid data frames, D(n,i)=0; the greater the deviation, the higher the value of D(n,i).

[0063] Step 203: Aggregate the data distribution deviation degrees of physical blocks in multiple logical units to generate a deviation characteristic parameter representing the uniformity of the valid data distribution of the logical unit.

[0064] Specifically in Step 203, after summing and squaring the data distribution deviation degrees, we get ; Aggregating the data distribution deviation degrees can amplify the degree of data deviation. And in order to make the parameter obtained by aggregation better represent the uniformity of the valid data distribution, through data operations on the parameter obtained by aggregation, a deviation characteristic parameter representing the uniformity of the valid data distribution of the logical unit is obtained: .

[0065] Step 204: Calculate the recycling priorities of multiple logical units respectively according to the deviation characteristic parameter.

[0066] Specifically in Step 204, the recycling priority of the logical unit is generated through the coupled calculation of its deviation characteristic parameter and the logical unit-level valid data parameter. The recycling priority calculation formula is:

[0067] Among them, N represents N physical blocks in superblock n, a constant ; VDFC(n) is the total number of valid data frames of logical unit n (the first valid data parameter); VDFC(n)_B(i) is the number of valid data frames of the i-th physical block in logical unit n (the second valid data parameter). The above recycling priority formula is such that the selected superblock is based on VDFC(n), and there are multiple physical blocks with smaller VDFC(n)_B(i) in the selected source blocks. (a) When VDFC(n)_B(i) is very average, then is relatively close to the distribution of the existing solution; (b) When VDFC(n)_B(i) has a large difference, then will be larger than that in (a), and the priority is higher.

[0068] Step 205: Based on the recycling priority, screen at least one target logical unit that needs to perform garbage collection.

[0069] Specifically in step 205, after the recycling priority calculation of the logical unit is generated, the priority value is used to dynamically screen the target logical unit, and the superblock (logical unit) priority sorting and recycling trigger are performed. For example, by setting a global priority threshold, the logical units greater than the global priority threshold enter the target candidate set; there are significant "low valid data blocks" inside such units, and the invalid space can be efficiently released through recycling. For the logical units in the candidate set, a priority queue is formed in descending order, and the following strategies are combined to perform screening: when the number of free physical blocks is detected to be lower than the water level line, the logical units are sequentially selected from the head of the queue until the space recycling requirement is met; the number of target logical units processed at the same time is limited to avoid a sudden drop in storage performance due to large-scale recycling.

[0070] Step 206: Calculate the migration threshold for data migration of the valid data based on the first valid data parameters of multiple logical units.

[0071] As a specific implementation manner of this embodiment, "calculating the migration threshold for data migration of the valid data based on the first valid data parameters of multiple logical units" can be implemented in but not limited to the following ways: calculating the global average valid data parameter using the first valid data parameters of multiple logical units; calculating and generating the migration threshold according to the global average valid data parameter, the number of physical blocks in the target logical unit, and the first constant.

[0072] Specifically in step 206, the global average valid data parameter (gloabl_avgVDFC) is the arithmetic mean of the first valid data parameters (VDFC) of all logical units in the storage system. The firmware layer of the storage system periodically scans all logical units on the disk (such as once every 10 ms) to update gloabl_avgVDFC in real time; when the status of a logical unit changes (such as creation, deletion, recycling), an incremental update of avgVDFC is triggered to ensure that the statistical results reflect the current system load. Based on the global average valid data parameter gloabl_avgVDFC, the number of physical blocks N of the target logical unit, and the first constant T, the migration threshold is generated: (gloabl_avgVDFC / N) * T.

[0073] Step 207: Create the first logical unit and the second logical unit based on the free logical unit and the empty physical block.

[0074] As a specific implementation manner of this embodiment, "creating a first logical unit and a second logical unit based on idle logical units and empty physical blocks" can be implemented in but not limited to the following ways: Select an idle logical unit from the idle resource pool and select an idle physical block from the idle physical block pool to generate the first logical unit; Select an idle logical unit from the idle resource pool and select multiple idle physical blocks from the idle physical block pool to generate the second logical unit.

[0075] As a more specific implementation manner, "selecting an idle logical unit from the idle resource pool and selecting an idle physical block from the idle physical block pool to generate the first logical unit" can be implemented in but not limited to the following ways: Configure the selected idle logical unit as a parity block; Establish a mapping relationship between the parity block and the idle logical unit to generate the first logical unit.

[0076] As a more specific implementation manner, "selecting an idle logical unit from the idle resource pool and selecting multiple idle physical blocks from the idle physical block pool to generate the second logical unit" can be implemented in but not limited to the following ways: Select one physical block from the multiple idle physical blocks and configure it as a parity block, where the multiple idle physical blocks come from different die; Establish a mapping relationship between the parity block and the remaining idle physical blocks with the idle logical unit to generate the second logical unit.

[0077] Specifically in step 207, the first logical unit (remapped superblock) is used to carry out the remapping operation of high-valid data blocks, and only a single parity block is required to support the RAID parity update. Select an unallocated logical unit (with the status flag "idle") from the idle logical unit pool; Select a physical block from the idle physical block pool (the block released after erasure) as the RAID parity block (Parity Block). Configure the selected physical block as a parity block and initialize its RAID parity function (such as the exclusive OR calculation logic of RAID5); Establish a one-to-one mapping relationship between the logical unit and the parity block to form the first logical unit (i.e., the remapped superblock). At this time, this logical unit only contains the parity block and has not been associated with data blocks yet.

[0078] The second logical unit (traditional recovery superblock) is used to carry out traditional recovery operations of low-valid data blocks, and a complete RAID stripe is required to support data migration. Select an unallocated logical unit from the free logical unit pool; select N physical blocks (N≥2, corresponding to the number of data blocks of RAID 5) from the free physical block pool, and these physical blocks come from different NAND dies (different blocks on each die) to utilize the inter-die command concurrency feature (different dies can perform operations at the same time). Select one from the N physical blocks as a check block, and the remaining N-1 as data blocks, and establish a stripe according to the RAID 5 structure (N-1 data blocks + 1 check block mode); establish a mapping relationship between the logical unit and the N physical blocks to form the second logical unit (i.e., the traditional recovery target unit), and all physical blocks are initialized to an empty state.

[0079] Step 208: Compare the second valid data parameter with the migration threshold to determine a data migration method for valid data stored in the migration target physical block.

[0080] Step 209: Migrate the valid data stored in the target physical block to the first logical unit or the second logical unit according to the data migration method.

[0081] Specifically, in steps 208 to 209, Figure 3 As shown, based on the migration threshold calculated in step 206, the data migration method of the valid data stored in the target physical block is determined by comparison. If the number of valid data frames of the target physical block is greater than the migration threshold, the target physical block is determined to be a high-valid data block (high proportion of valid data) and the remapping migration method is triggered. The data migration method shown in the left part of the corresponding figure. If the number of valid data frames of the target physical block is less than or equal to the migration threshold, the target physical block is determined to be a high-low valid data block (low proportion of valid data) and the physical migration method is triggered. The data migration method shown in the right part of the corresponding figure.

[0082] Step 210: after the effective data is migrated, it is determined whether the target physical block needs resource recycling according to the data migration mode of the effective data stored in the target physical block, and resource recycling is performed on the target physical block that needs resource recycling.

[0083] As a specific implementation method of this embodiment, before reclaiming resources for the target physical blocks that require resource recovery, in order to better realize resource recovery and utilization, resource recovery processing can be performed on the target logical units, which can be implemented in but not limited to the following ways: releasing the mapping relationship between at least one target logical unit and each target physical block; and recycling the target logical units whose mapping relationship is released as idle logical units into the idle resource pool.

[0084] As a specific implementation method of this embodiment, "resource recovery for target physical blocks that require resource recovery" can be implemented in but not limited to the following ways: erasing data on target physical blocks that require resource recovery; and recovering the physical blocks that have been subjected to data erasure as free physical blocks into a free physical block pool.

[0085] As a specific implementation method of this embodiment, "determining whether the target physical block needs resource recovery based on the data migration method of the valid data stored in the target physical block" includes: if the data migration method is mapping migration, then determining that the target physical block does not need resource recovery; if the data migration method is physical migration, then determining that the target physical block needs resource recovery.

[0086] Specifically, in step 210, after completing the migration of valid data, the storage system performs layered reclamation on the target logical unit and physical block.

[0087] The target logical unit recycling includes: unmapping relationship. For the target logical unit (such as superblock A) that has completed data migration, traverse its logical address to physical address mapping table, delete all physical block mapping entries, and cut off the RAID strip association between the logical unit and the physical block (remove the mapping relationship of all blocks). If the logical unit adopts the RAID5 structure, the XOR relationship between the check block and the data block is cleared synchronously. Free resource pool recycling, mark the unmapped logical unit status as "free" and put it into the free logical unit pool (put superblock A into the free superblock pool) for subsequent remapping or traditional recycling task reuse.

[0088] The target physical block recycling includes: recycling demand determination, based on the data migration method, the following rules are used to determine whether the physical block needs to be recycled. Mapping migration (remapping): If the physical block is migrated by remapping (i.e. VDFC_B> migration threshold), its valid data is still stored in the original physical block, and only the logical address is mapped to the new logical unit (such as superblock B). At this time, the original physical block is marked as "retained" and does not need to be erased.

[0089] Physical Migration (Traditional Recycling): If the physical block is migrated using the traditional recycling method (i.e., VDFC_B ≤ migration threshold), its valid data has been migrated to the new physical block (such as superblock C), and the original physical block becomes a "block with zero valid data" and is marked as "erasable" (corresponding to step 7 in the document "Erase the original block after writing the valid data to superblock C"). For erasure and resource pool recycling, for the physical block determined to be "erasable", send a block erase instruction (BlockErase) to the NAND controller to clear the stored charge and reset the status register, restoring it to the factory writable state (the minimum erasure unit of NAND is a block). The physical block that has been erased is marked as "idle" and is included in the idle physical block pool (put into the idle physical block pool) for subsequent data writing or RAID stripe construction calls.

[0090] It should be noted that multiple steps may be included in the embodiments of the present disclosure. For the convenience of description, these steps are numbered, but these numbers do not limit the execution time slots and execution orders between the steps; these steps can be implemented in any order, and the embodiments of the present disclosure do not make any limitations in this regard.

[0091] Corresponding to the above method for solid-state drive garbage collection, the present disclosure also proposes a device for solid-state drive garbage collection. Since the device embodiments of the present disclosure correspond to the above method embodiments, details not disclosed in the device embodiments can be referred to the above method embodiments, and will not be elaborated in the present disclosure.

[0092] Figure 4 The structural schematic diagram of a device for solid-state drive garbage collection provided by the embodiments of the present disclosure is as Figure 4 shown, including: An acquisition unit 31, configured to acquire the first valid data parameters of multiple logical units in the storage system and the second valid data parameters of the physical blocks included in each logical unit; A screening unit 32, configured to evaluate the distribution uniformity of the valid data among the multiple logical units based on the first valid data parameters and the second valid data parameters, and screen at least one target logical unit that needs to perform garbage collection based on the distribution uniformity evaluation result; A determination unit 33, configured to determine the data migration method of the valid data stored in the target physical block in each target logical unit based on the second valid data parameters and perform data migration; A recycling unit 34, configured to, after the valid data is migrated, determine whether the target physical block needs resource recycling according to the data migration method of the valid data stored in the target physical block, and perform resource recycling on the target physical block that needs resource recycling.

[0093] The present disclosure provides a solid-state drive garbage collection device. Compared with the related art, through refined evaluation of physical block-level parameters, the present disclosure can accurately locate logical units and physical blocks with uneven distribution of valid data. It can preferentially trigger units with more urgent recycling requirements, avoiding the efficiency bottleneck caused by "one-size-fits-all" recycling. By screening target logical units based on the evaluation result of distribution uniformity, the screening accuracy can be improved, and the garbage collection efficiency can be enhanced. By identifying logical units with "valid data concentrated in some physical blocks", it is possible to avoid ineffective recycling of units with a large amount of valid data but significant differences in internal physical blocks, reducing redundant operations. The NAND write volume of high-valid-data blocks is reduced, avoiding write amplification caused by "writing all valid data into new blocks". Unnecessary erasure operations are reduced, and the NAND lifespan is preferentially used for user writes rather than redundant writes generated by garbage collection. Combined with dynamic mapping, the recycled logical units can be reallocated as free blocks, improving the utilization rate of storage resources.

[0094] Further, in a possible implementation manner of this embodiment, as Figure 5 shown, the screening unit 32 includes: A first calculation module 321, configured to calculate the data distribution deviation degree of each physical block based on the second valid data parameter and the corresponding first valid data parameter of each physical block; A first generation module 322, configured to aggregate the data distribution deviation degrees of the physical blocks in multiple logical units to generate a deviation characteristic parameter representing the uniformity of the valid data distribution of the logical unit.

[0095] Further, in a possible implementation manner of this embodiment, as Figure 5 shown, the screening unit 32 includes: A second calculation module 323, configured to calculate the recycling priorities of multiple logical units respectively according to the deviation characteristic parameter; A screening module 324, configured to screen at least one target logical unit that needs to perform garbage collection based on the recycling priorities.

[0096] Further, in a possible implementation manner of this embodiment, as Figure 5 shown, the solid-state drive garbage collection device further includes: A calculation unit 35, configured to calculate a migration threshold for data migration of valid data based on the first valid data parameters of multiple logical units before determining the data migration method of the valid data stored in the target physical block in each target logical unit and performing data migration.

[0097] Further, in a possible implementation manner of this embodiment, as Figure 5 shown, the calculation unit 35 includes: The third calculation module 351 is configured to calculate the global average valid data parameter by using the first valid data parameters of multiple logical units; The fourth calculation module 352 is configured to calculate and generate a migration threshold according to the global average valid data parameter, the number of physical blocks in the target logical unit, and the first constant.

[0098] Furthermore, in a possible implementation manner of this embodiment, the data migration method includes: mapping migration and physical migration.

[0099] Furthermore, in a possible implementation manner of this embodiment, as Figure 5 shown, the determination unit 33 includes: The first determination module 331 is configured to compare the second valid data parameter with the migration threshold to determine the data migration method of the valid data stored in the migration target physical block; The migration module 332 is configured to migrate the valid data stored in the target physical block to the first logical unit or the second logical unit according to the data migration method.

[0100] Furthermore, in a possible implementation manner of this embodiment, the first determination module 331 is further configured to: If the second valid data parameter of the target physical block exceeds the migration threshold, determine that the data migration method of the valid data stored in the target physical block is mapping migration; If the second valid data parameter of the target physical block is less than or equal to the migration threshold, determine that the data migration method of the valid data stored in the target physical block is physical migration.

[0101] Furthermore, in a possible implementation manner of this embodiment, the migration module 332 is further configured to: If the data migration method is mapping migration, release the mapping relationship between the target physical block and the target logical unit, and map the target physical block to the first logical unit; If the data migration method is physical migration, read the valid data stored in the target physical block, and write the valid data into the physical block of the second logical unit.

[0102] Furthermore, in a possible implementation manner of this embodiment, as Figure 5 shown, the solid-state drive garbage collection device further includes: The creation unit 36 is configured to create the first logical unit and the second logical unit based on the idle logical unit and the empty physical block before determining the data migration method of the valid data stored in the target physical block in each target logical unit based on the second valid data parameter and performing data migration.

[0103] Furthermore, in a possible implementation manner of this embodiment, as Figure 5As shown, the creation unit 36 includes: A second generation module 361, configured to select an idle logical unit from the idle resource pool and select an idle physical block from the idle physical block pool, and generate a first logical unit; A third generation module 362, configured to select an idle logical unit from the idle resource pool and select multiple idle physical blocks from the idle physical block pool, and generate a second logical unit.

[0104] Further, in a possible implementation manner of this embodiment, the second generation module 361 is further configured to: Configure the selected idle logical unit as a parity block; Establish a mapping relationship between the parity block and the idle logical unit, and generate a first logical unit.

[0105] Further, in a possible implementation manner of this embodiment, the third generation module 362 is further configured to: Select one physical block from the multiple idle physical blocks to be configured as a parity block, where the multiple idle physical blocks come from different die; Establish a mapping relationship between the parity block and the remaining idle physical blocks and the idle logical unit, and generate a second logical unit.

[0106] Further, in a possible implementation manner of this embodiment, as Figure 5 shown, the solid state drive garbage collection device further includes: A release unit 37, configured to release the mapping relationship between at least one target logical unit and each target physical block before resource recovery is performed on the target physical block that needs resource recovery; and recycle the target logical unit with the mapping relationship released into the idle resource pool as an idle logical unit.

[0107] Further, in a possible implementation manner of this embodiment, as Figure 5 shown, the recovery unit 34 further includes: A second determination module 341, configured to determine that the target physical block does not need resource recovery if the data migration method is mapping migration; A third determination module 342, configured to determine that the target physical block needs resource recovery if the data migration method is physical migration.

[0108] Further, in a possible implementation manner of this embodiment, as Figure 5 shown, the recovery unit 34 further includes: An erasure module 343, configured to perform data erasure on the target physical block that needs resource recovery; A recovery module 344, configured to recycle the physical block subjected to data erasure processing into the idle physical block pool as an idle physical block.

[0109] It should be noted that the foregoing explanations of the method embodiments also apply to the apparatus of this embodiment. The principle is the same, and no further limitations are provided in this embodiment.

[0110] For the descriptions of the features in the corresponding embodiments of the solid-state drive garbage collection apparatus, reference can be made to the relevant descriptions in the corresponding embodiments of the solid-state drive garbage collection method, which will not be elaborated herein one by one.

[0111] An embodiment of the present application further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the foregoing method embodiments of solid-state drive garbage collection.

[0112] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any of the foregoing method embodiments of solid-state drive garbage collection when running.

[0113] In an exemplary embodiment, the foregoing computer-readable storage medium may include, but is not limited to: USB flash drives, read-only memories (ROM for short), random access memories (RAM for short), mobile hard disks, magnetic disks, or optical discs and other various media that can store computer programs.

[0114] An embodiment of the present application further provides a computer program product. The foregoing computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any of the foregoing method embodiments of solid-state drive garbage collection.

[0115] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any of the foregoing method embodiments of solid-state drive garbage collection.

[0116] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the foregoing description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0117] The above has introduced in detail a method and apparatus for solid-state drive garbage collection, an electronic device, and a storage medium provided by this application. Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can still be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A method for garbage collection of a solid state drive, characterized in that, Including: Obtaining first valid data parameters of multiple logical units in a storage system and second valid data parameters of physical blocks included in each logical unit; Based on the first valid data parameters and the second valid data parameters, evaluating the distribution uniformity of valid data among the multiple logical units, and based on the evaluation result of the distribution uniformity, screening at least one target logical unit that needs to perform garbage collection; Based on the second valid data parameters, determining a data migration method for the valid data stored in the target physical block in each target logical unit and performing data migration; After the valid data is migrated, according to the data migration method of the valid data stored in the target physical block, determining whether the target physical block needs resource recovery, and performing resource recovery on the target physical block that needs resource recovery.

2. The method for solid state drive garbage collection according to claim 1, characterized in that, The evaluating the distribution uniformity of valid data among the multiple logical units based on the multi-level evaluation parameters includes: Calculating the data distribution deviation degree of each physical block based on the second valid data parameter of each physical block and the corresponding first valid data parameter; Aggregating the data distribution deviation degrees of the physical blocks in the multiple logical units to generate a deviation characteristic parameter representing the distribution uniformity of the valid data of the logical unit.

3. The method for garbage collection of a solid-state drive according to claim 2, wherein The screening at least one target logical unit that needs to perform garbage collection based on the evaluation result of the distribution uniformity includes: Calculating the recovery priorities of the multiple logical units respectively according to the deviation characteristic parameter; Based on the recovery priorities, screening the at least one target logical unit that needs to perform garbage collection.

4. The method for garbage collection of a solid state drive according to claim 1, wherein Before determining the data migration method for the valid data stored in the target physical block in each target logical unit and performing data migration based on the second valid data parameters, the method further includes: Calculating a migration threshold for the valid data to be migrated based on the first valid data parameters of the multiple logical units.

5. The method for solid state drive garbage collection according to claim 4, wherein The calculating a migration threshold for the valid data to be migrated based on the first valid data parameters of the multiple logical units includes: Calculating a global average valid data parameter by using the first valid data parameters of the multiple logical units; Calculating and generating the migration threshold according to the global average valid data parameter, the number of physical blocks in the target logical unit, and a first constant.

6. The method for solid-state drive garbage collection according to claim 1, wherein The data migration methods include: mapping migration, physical migration.

7. The method for solid state drive garbage collection according to claim 6, wherein The determining the data migration method for the valid data stored in the target physical block in each target logical unit and performing data migration based on the second valid data parameters includes: Comparing the second valid data parameter with the migration threshold to determine the data migration method for migrating the valid data stored in the target physical block; According to the data migration method, migrating the valid data stored in the target physical block to a first logical unit or a second logical unit.

8. The method according to claim 7, characterized in that, The comparing the second valid data parameter with the migration threshold to determine the data migration method for migrating the valid data stored in the target physical block includes: If the second valid data parameter of the target physical block exceeds the migration threshold, determining that the data migration method for the valid data stored in the target physical block is mapping migration; If the second valid data parameter of the target physical block is less than or equal to the migration threshold, determine that the data migration method for the valid data stored in the target physical block is physical migration.

9. The method for solid-state drive garbage collection according to claim 8, wherein According to the data migration method, migrating the valid data stored in the target physical block to the first logical unit or the second logical unit includes: If the data migration method is mapping migration, release the mapping relationship between the target physical block and the target logical unit, and map the target physical block to the first logical unit; If the data migration method is physical migration, read the valid data stored in the target physical block, and write the valid data into the physical block of the second logical unit.

10. The method for garbage collection of a solid-state drive according to claim 1, wherein, Before determining the data migration method for the valid data stored in the target physical block in each target logical unit based on the second valid data parameter and performing data migration, the method further includes: Create a first logical unit and a second logical unit based on free logical units and empty physical blocks.

11. The method for solid state drive garbage collection according to claim 10, wherein The creating a first logical unit and a second logical unit based on free logical units and empty physical blocks includes: Select a free logical unit from the free resource pool and select an empty physical block from the free physical block pool to generate the first logical unit; Select a free logical unit from the free resource pool and select multiple empty physical blocks from the free physical block pool to generate the second logical unit.

12. The method for solid state drive garbage collection according to claim 11, wherein The selecting a free logical unit from the free resource pool and selecting an empty physical block from the free physical block pool to generate the first logical unit includes: Configure the selected one free logical unit as a parity block; Establish a mapping relationship between the parity block and the free logical unit to generate the first logical unit.

13. The method for solid state drive garbage collection according to claim 11, wherein The selecting a free logical unit from the free resource pool and selecting multiple empty physical blocks from the free physical block pool to generate the second logical unit includes: Select one physical block from the multiple empty physical blocks to be configured as a parity block, and the multiple empty physical blocks come from different die; Establish a mapping relationship between the parity block and the remaining empty physical blocks and the free logical unit to generate the second logical unit.

14. The method for solid-state drive garbage collection according to claim 1, wherein Before performing resource recovery on a target physical block that requires resource recovery, the method further includes: Release the mapping relationship between the at least one target logical unit and each target physical block; Recover the target logical unit with the mapping relationship released as a free logical unit to the free resource pool.

15. The method for solid-state drive garbage collection according to claim 1, wherein Judging whether the target physical block needs resource recovery according to the data migration method of the valid data stored in the target physical block includes: If the data migration method is mapping migration, determine that the target physical block does not need to perform resource recovery; If the data migration method is physical migration, determine that the target physical block needs to perform resource recovery.

16. The method for solid state drive garbage collection according to claim 15, wherein Performing resource recovery on a target physical block that needs resource recovery includes: Performing data erasure on the target physical block that needs resource recovery; Recover the physical block processed by data erasure as an empty physical block to the free physical block pool.

17. An apparatus for solid-state drive garbage collection, characterized in that, Includes: An acquisition unit, configured to acquire first valid data parameters of multiple logical units in a storage system and second valid data parameters of physical blocks included in each logical unit; A screening unit, configured to evaluate the distribution uniformity of valid data among the multiple logical units based on the first valid data parameters and the second valid data parameters, and screen at least one target logical unit that needs to perform garbage collection based on the distribution uniformity evaluation result; A determination unit, configured to determine a data migration method for the valid data stored in the target physical block in each target logical unit based on the second valid data parameters and perform data migration; A recycling unit, configured to, after the valid data is migrated, determine whether the target physical block needs resource recycling according to the data migration method of the valid data stored in the target physical block, and perform resource recycling on the target physical blocks that need resource recycling.

18. An electronic device, characterized in that, Comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for solid-state drive garbage collection according to any one of claims 1-16.

19. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to execute the method for solid-state drive garbage collection according to any one of claims 1-16.

20. A computer program product, characterized in that, Comprising a computer program which, when executed by a processor, implements the method for solid-state drive garbage collection according to any one of claims 1-16.

Citation Information

Patent Citations

  • Dynamic compensation receiver and dynamic compensation receiving method

    CN103744615A

  • Method and device for selecting garbage collection block

    CN106339324A

  • Garbage recycling method, device and equipment for solid state disk and readable storage medium

    CN111090398A

  • Intelligent garbage collection method and device compatible with NVMe solid state disk

    CN112463057A

  • Distributed storage system and garbage collection method used in distributed storage system

    CN113302597A

Cited By

  • Garbage collection method and device of block storage system, electronic equipment and storage medium

    CN121478201A