A data recycling method, device, equipment and readable storage medium

By identifying the target superblock with the least amount of data in the solid-state drive and mapping it using an LMA length greater than 32 bits, the garbage collection problem that existing technologies cannot be applied to large-capacity SSDs is solved, achieving more efficient data recycling.

CN119668485BActive Publication Date: 2026-01-09DAPUSTOR CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311214906.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-19
Publication Date
2026-01-09
Estimated Expiration
2043-09-19

AI Technical Summary

Technical Problem

Existing garbage collection mechanisms are not applicable to SSDs with capacities of 32TB and above, and the mapping table cannot map more physical addresses.

Method used

By identifying the target superblock with the least amount of data in the solid-state drive (SSD), querying the LMA information set of the target superblock, and when the LMA information set does not exceed the range of the SSD, the target data has not undergone a Trim operation, and the LMA information set is consistent with the target data storage location, data is read from the target superblock according to the target PMA information set and stored in the destination superblock, using an LMA length greater than 32 bits for mapping.

Benefits of technology

It implements a garbage collection mechanism applicable to large-capacity SSDs of 32T and above, improving the effectiveness and efficiency of data recycling and enabling the mapping of more physical addresses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668485B_ABST
    Figure CN119668485B_ABST
Patent Text Reader

Abstract

The application discloses a data recycling method and device in the computer technical field, and a readable storage medium. The application is suitable for a 32T and above large-capacity SSD. A single LMA provided by the application is greater than 32 bits, and more physical addresses can be mapped. In addition, the application also judges the validity of the LMA information set in the P2L table, and can improve the validity and efficiency of data recycling. In the case that the LMA information set does not exceed the LMA range of the solid state disk, the target data is not subjected to a Trim operation, the target PMA information set corresponding to the LMA information set found in the L2P table is consistent with the storage position of the target data in the target super block, the target data is read from the target super block according to the target PMA information set, and the target data is stored into a target super block, so as to complete a garbage recycling operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data recycling method, apparatus, device, and readable storage medium. Background Technology

[0002] As the speed and volume of user data increase, the amount of data that needs to be stored also increases dramatically. Large-capacity storage hard drives of 16TB (terabytes) and 32TB have emerged. However, the mapping table used by the current garbage collection mechanism cannot map more physical addresses and is not suitable for SSDs with a capacity of 32T and above.

[0003] Therefore, how to make the garbage collection mechanism applicable to SSDs with a capacity of 32T and above is a problem that needs to be solved by those skilled in the art. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a data recycling method, apparatus, device, and readable storage medium, so that the garbage collection mechanism is applicable to SSDs with capacities of 32TB and above. The specific solution is as follows:

[0005] Firstly, this application provides a data recovery method, including:

[0006] If a data reclamation command is received, the target superblock with the least amount of data is identified in the solid-state drive;

[0007] Query the LMA information set corresponding to the target data stored in the target superblock in the P2L table corresponding to the target superblock; a single LMA has a target length greater than 32 bits;

[0008] If the LMA information set does not exceed the LMA range of the solid-state drive, and the target data has not undergone a Trim operation, and the target PMA information set corresponding to the LMA information set found in the L2P table is consistent with the storage location of the target data in the target superblock, then the target data is read from the target superblock according to the target PMA information set, and the target data is stored in the destination superblock.

[0009] Optionally, querying the P2L table corresponding to the target superblock for the LMA information set corresponding to the target data stored in the target superblock includes:

[0010] Determine the individual media units occupied by the target data in the target superblock;

[0011] Look up the LMA corresponding to each medium unit in the P2L table;

[0012] The LMA information set is obtained by summing up the LMAs corresponding to all media units.

[0013] Optionally, querying the LMA corresponding to each medium unit in the P2L table includes:

[0014] If the characters of the target length are arranged in the order of the P2L table, then the LMA corresponding to the target length of each medium unit is read from the P2L table in the order of each medium unit;

[0015] or

[0016] If the 32-bit characters in the P2L table are arranged in order, and the remaining D-bit characters are arranged in order, then when the LMA corresponding to each medium unit is found in the P2L table, the first 32 bits of the current LMA are read first, and then the last D bits of the current LMA are read. The first 32 bits and the last D bits are concatenated to obtain the LMA of the target length of the current medium unit; D is equal to the target length minus 32.

[0017] Optionally, the value of D is calculated according to the target formula, wherein the target formula is: R / S≤2 X Where R is the total capacity of the solid-state drive, S = 4K, and X is the target length, rounded up.

[0018] Optionally, the LMA information set does not exceed the LMA range of the solid-state drive, including: any LMA in the LMA information set is not greater than the LMA range.

[0019] Optionally, storing the target data in the destination superblock includes:

[0020] The superblock with the fewest erase / write cycles among the free superblocks in the solid-state drive is selected as the target superblock;

[0021] Determine the destination PMA information set corresponding to the LMA information set in the destination superblock;

[0022] The target data is stored in the target superblock according to the target PMA information set.

[0023] Optionally, after storing the target data in the destination superblock, the process further includes:

[0024] The mapping relationship between the target PMA information set and the LMA information set is recorded in the P2L table corresponding to the target superblock.

[0025] Change the target PMA information set corresponding to the LMA information set in the L2P table to the destination PMA information set.

[0026] Optionally, determining the target superblock with the least amount of data in the solid-state drive includes:

[0027] The effective data volume stored in each superblock of the solid-state drive is determined by traversal.

[0028] The superblock with the least amount of valid data is selected as the target superblock.

[0029] Secondly, this application provides a data recovery device, comprising:

[0030] The determination module is used to identify the target superblock with the least amount of data in the solid-state drive if a data reclamation instruction is received;

[0031] The query module is used to query the LMA information set corresponding to the target data stored in the target superblock in the P2L table corresponding to the target superblock; a single LMA has a target length greater than 32 bits;

[0032] The recycling module is configured to read the target data from the target superblock according to the target PMA information set if the LMA information set does not exceed the LMA range of the solid-state drive, the target data has not been subjected to a Trim operation, and the target PMA information set corresponding to the LMA information set found in the L2P table is consistent with the storage location of the target data in the target superblock, and store the target data in the destination superblock.

[0033] Thirdly, this application provides an electronic device, comprising:

[0034] Memory, used to store computer programs;

[0035] A processor for executing the computer program to implement the aforementioned disclosed data recycling method.

[0036] Fourthly, this application provides a readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned disclosed data reclamation method.

[0037] As can be seen from the above scheme, this application provides a data recycling method, including: if a data recycling instruction is received, determining the target superblock with the least amount of data in the solid-state drive; querying the LMA information set corresponding to the target data stored in the target superblock in the P2L table corresponding to the target superblock; a single LMA is a target length greater than 32 bits; if the LMA information set does not exceed the LMA range of the solid-state drive, and the target data has not undergone a Trim operation, and the target PMA information set corresponding to the LMA information set found in the L2P table is consistent with the storage location of the target data in the target superblock, then reading the target data from the target superblock according to the target PMA information set, and storing the target data in the destination superblock.

[0038] As can be seen, the data recycling method provided in this application is applicable to SSDs with capacities of 32TB and above, because the single LMA provided in this application has a target length greater than 32 bits, which can map more physical addresses. Furthermore, this application also performs validity checks on the LMA information set in the P2L table, which can improve the effectiveness and efficiency of data recycling. When the LMA information set does not exceed the LMA range of the solid-state drive, the target data has not undergone a Trim operation, and the target PMA information set corresponding to the LMA information set found in the L2P table matches the storage location of the target data in the target superblock, the target data is read from the target superblock according to the target PMA information set and stored in the destination superblock to complete the garbage collection operation.

[0039] Correspondingly, the data recycling device, equipment, and readable storage medium provided in this application also have the above-mentioned technical effects. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0041] Figure 1 This is a flowchart of a data recovery method disclosed in this application;

[0042] Figure 2 This is a schematic diagram of an LMA layout disclosed in this application;

[0043] Figure 3 This is a schematic diagram of a data recovery device disclosed in this application;

[0044] Figure 4This is a schematic diagram of an electronic device disclosed in this application;

[0045] Figure 5 This is a schematic diagram of a P2L entry structure disclosed in this application;

[0046] Figure 6 This is a schematic diagram of another P2L entry structure disclosed in this application;

[0047] Figure 7 This is a schematic diagram of a waste recycling process disclosed in this application;

[0048] Figure 8 This is a schematic diagram of an offset index disclosed in this application. Detailed Implementation

[0049] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0050] Currently, with the increasing speed and volume of user data generation, the amount of data requiring storage has also surged. Large-capacity SSDs of 16TB (terabytes) and 32TB have emerged as a result. However, the mapping tables used by current garbage collection mechanisms cannot map more physical addresses and are not suitable for SSDs with capacities of 32TB and above. Therefore, this application provides a data recycling scheme that enables garbage collection mechanisms to be applied to SSDs with capacities of 32TB and above, improving the effectiveness and efficiency of data recycling.

[0051] See Figure 1 As shown in the figure, this application discloses a data recycling method, including:

[0052] S101. If a data reclamation command is received, determine the target superblock with the least amount of data in the solid-state drive.

[0053] In this embodiment, determining the target superblock with the least amount of data in the solid-state drive includes: determining the amount of effective data stored in each superblock in the solid-state drive by traversal; and selecting the superblock with the least amount of effective data as the target superblock, which is the block whose space is to be reclaimed.

[0054] S102. Query the LMA information set corresponding to the target data stored in the target superblock in the P2L table corresponding to the target superblock; a single LMA (Logic Mapping Address) is a target length greater than 32 bits.

[0055] The P2L (Physical address to Logical address) table is indexed by the physical NAND address and stores the logical address (LMA). The L2P (Logical address to Physical address) table is indexed by the logical address (LMA) and stores the physical address. The L2P table is used in user data writing, reading, trimming, and GC (Garbage Collection) processes; the P2L table is used in GC, power-on recovery of the L2P table, and can also be used to determine the validity of data by comparing the LMA data in the table.

[0056] In one implementation, the LMA information set corresponding to the target data stored in the target superblock is queried in the P2L table corresponding to the target superblock. This includes: determining each medium cell (i.e., Au, the smallest read unit of the medium) occupied by the target data in the target superblock; querying the LMA corresponding to each medium cell in the P2L table; and summarizing the LMAs corresponding to all medium cells to obtain the LMA information set. That is, the LMA information set includes multiple LMAs, each LMA being the target length, and the target length being greater than 32 bits.

[0057] It should be noted that LMAs with multiple target lengths can be laid out in the following two ways, such as... Figure 2 As shown, Method 1 involves sequentially arranging multiple LMAs of the target length; Method 2 involves first sequentially arranging multiple 32-bit characters (the lower 32 bits of each LMA), and then laying out the higher D bits of each LMA. The target length minus 32 equals D. When reading LMAs using Method 1, multiple LMAs of the target length can be read sequentially. When reading LMAs using Method 1, the lower 32 bits of each LMA need to be read first, then the higher D bits of each LMA need to be read, and then the lower 32 bits and higher D bits of each LMA need to be concatenated to obtain the complete multiple LMAs of the target length.

[0058] In one implementation, querying the LMA corresponding to each medium cell in the P2L table includes: if the characters of the target length are arranged in order in the P2L table, then the LMA corresponding to the target length of each medium cell is read from the P2L table in the order of each medium cell; or if the characters of 32 bits are arranged in order in the P2L table, and the remaining D bits are arranged in order, then when the LMA corresponding to each medium cell is found in the P2L table, the first 32 bits of the current LMA are read, then the last D bits of the current LMA are read, and the first 32 bits and the last D bits are concatenated to obtain the LMA of the target length of the current medium cell; D is equal to the target length minus 32.

[0059] In one implementation, the value of D is calculated according to the target formula: R / S≤2X Where R is the total capacity of the solid-state drive, S = 4K, and X is the target length, rounded up. It can be seen that, with a fixed value for S, the larger the total capacity of the solid-state drive, the larger the length of a single LMA can be set.

[0060] S103. If the LMA information set does not exceed the LMA range of the solid-state drive, the target data has not been subjected to Trim operation, and the target PMA information set corresponding to the LMA information set found in the L2P table is consistent with the storage location of the target data in the target superblock, then the target data is read from the target superblock according to the target PMA information set and the target data is stored in the destination superblock.

[0061] In one implementation, the LMA information set does not exceed the LMA range of the solid-state drive (SSD), meaning that any LMA in the LMA information set is not greater than the LMA range. The LMA range of the SSD is calculated based on the total capacity of the SSD.

[0062] In one implementation, storing target data into a destination superblock includes: selecting the superblock with the fewest write / erase cycles from the free superblocks included in the solid-state drive as the destination superblock; determining the destination PMA information set corresponding to the LMA information set in the destination superblock; and storing the target data into the destination superblock according to the destination PMA information set.

[0063] In one implementation, after storing the target data in the target superblock, the method further includes: recording the mapping relationship between the target PMA information set and the LMA information set in the P2L table corresponding to the target superblock to complete the update of the P2L table; and changing the target PMA information set corresponding to the LMA information set in the L2P table to the target PMA information set to complete the update of the L2P table.

[0064] As can be seen, the data recycling method provided in this embodiment is applicable to SSDs with capacities of 32TB and above, because the single LMA provided in this application has a target length greater than 32 bits, which can map more physical addresses. Furthermore, this application also performs validity checks on the LMA information set in the P2L table, which can improve the effectiveness and efficiency of data recycling. When the LMA information set does not exceed the LMA range of the solid-state drive, the target data has not undergone a Trim operation, and the target PMA information set corresponding to the LMA information set found in the L2P table is consistent with the storage location of the target data in the target superblock, the target data is read from the target superblock according to the target PMA information set, and the target data is stored in the destination superblock to complete the garbage collection operation.

[0065] The following describes a data recycling device provided in an embodiment of this application. The data recycling device described below can be referred to in conjunction with other embodiments described herein.

[0066] See Figure 3 As shown in the figure, this application discloses a data recycling device, including:

[0067] The determination module 301 is used to determine the target superblock with the least amount of data in the solid-state drive if a data reclamation instruction is received;

[0068] The query module 302 is used to query the LMA information set corresponding to the target data stored in the target superblock in the P2L table corresponding to the target superblock; a single LMA has a target length greater than 32 bits;

[0069] The recycling module 303 is used to read the target data from the target superblock according to the target PMA information set if the LMA information set does not exceed the LMA range of the solid-state drive, the target data has not been subjected to Trim operation, and the target PMA information set corresponding to the LMA information set found in the L2P table is consistent with the storage location of the target data in the target superblock, and then store the target data in the destination superblock.

[0070] In one implementation, the query module is specifically used for:

[0071] Determine the individual media units occupied by the target data within the target superblock;

[0072] Look up the LMA corresponding to each media unit in the P2L table;

[0073] The LMAs corresponding to all media units are summarized to obtain the LMA information set.

[0074] In one implementation, the query module is specifically used for:

[0075] If the target length characters are arranged in order in the P2L table, then the LMA corresponding to the target length of each medium unit is read from the P2L table in the order of each medium unit.

[0076] or

[0077] If the 32-bit characters in the P2L table are arranged in order, and the remaining D-bit characters are arranged in order, then when the LMA corresponding to each medium unit is found in the P2L table, the first 32 bits of the current LMA are read first, and then the last D bits of the current LMA are read. The first 32 bits and the last D bits are concatenated to obtain the LMA of the target length of the current medium unit; D is equal to the target length minus 32.

[0078] In one implementation, the value of D is calculated according to the target formula: R / S≤2 X Where R is the total capacity of the solid-state drive, S = 4K, and X is the target length, rounded up.

[0079] In one implementation, the LMA information set does not exceed the LMA range of the solid-state drive, including: any LMA in the LMA information set is not greater than the LMA range.

[0080] In one implementation, the recycling module is specifically used for:

[0081] Select the superblock with the fewest erase / write cycles from the free superblocks included in the solid-state drive as the target superblock;

[0082] Determine the destination PMA information set corresponding to the LMA information set in the destination superblock;

[0083] Store the target data in the target superblock according to the target PMA information set.

[0084] In one implementation, it further includes:

[0085] The table update module is used to store the target data in the target superblock, record the mapping relationship between the target PMA information set and the LMA information set in the P2L table corresponding to the target superblock, and change the target PMA information set corresponding to the LMA information set in the L2P table to the target PMA information set.

[0086] In one implementation, the determining module is specifically used for:

[0087] The effective data volume stored in each superblock of the solid-state drive is determined by traversal.

[0088] Select the superblock with the least amount of valid data as the target superblock.

[0089] For more detailed information on the working process of each module and unit in this embodiment, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0090] As can be seen, this embodiment provides a data recycling device suitable for large-capacity SSDs of 32T and above. Because the single LMA provided in this application has a target length of more than 32 bits, it can map more physical addresses and can also determine the validity of the LMA information set in the P2L table.

[0091] The following describes an electronic device provided by an embodiment of this application. The electronic device described below can be referred to in conjunction with other embodiments described herein.

[0092] See Figure 4 As shown in the figure, an embodiment of this application discloses an electronic device, including:

[0093] Memory 401 is used to store computer programs;

[0094] Processor 402 is configured to execute the computer program to implement the method disclosed in any of the above embodiments.

[0095] The following describes a readable storage medium provided in an embodiment of this application. The readable storage medium described below can be referred to in conjunction with other embodiments described herein.

[0096] A readable storage medium is provided for storing a computer program, wherein the computer program, when executed by a processor, implements the data reclamation method disclosed in the foregoing embodiments. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.

[0097] The following section uses a 34-bit LMA as an example to further illustrate this application. First, the LMA in the P2L table is changed to 34 bits, and the layout of the P2L table is modified to meet the read and write requirements of the LMA in the table. This makes the P2L table compatible with large-capacity non-volatile memory, enabling non-volatile memory products with capacities of 32T and above.

[0098] In one example, starting from the head of the P2L table, the lower 32 bits of each LMA are arranged sequentially, and starting from the tail of the P2L table, the higher 2 bits of each LMA are arranged sequentially. When updating and accessing the P2L table, the lower 32 bits of any LMA are combined with its higher 2 bits to form a complete 34-bit data. In another example, starting from the head of the P2L table, each 34-bit LMA is arranged sequentially. When updating and retrieving an LMA, the complete 34-bit LMA is found directly using its index number. Both designs can satisfy the design requirements of large-capacity P2L tables, thus minimizing the space occupied by the P2L table while achieving functionality.

[0099] Please see Figure 5 The P2L table entry structure mainly consists of three parts: LMA, timestamp, and validity bitmap. The LMA is the main data of the mapping table, recording the specific logical address corresponding to the physical address; the timestamp (TS) mainly records the time when user data is written to the NAND flash memory, used for power-on recovery of the L2P table. By comparing the timestamps in the P2L table and the L2P table, the latest valid entry can be obtained; the validity bitmap describes whether the currently recorded LMA is user data. Figure 5 The table structure shown can be modified as follows: Figure 6 This is to enable the P2L table to record a 34-bit LMA.

[0100] Update the P2L table entries when user data is written to NAND. If updated... Figure 6For table entry structure 1 in the P2L table, the LMA needs to be split into two parts: the lower-order LMA0_0 and the higher-order LMA0_1. The lower-order LMA is 32 bits, and the data is written to the lower-order LMA position in the P2L table. The higher-order LMA is 2 bits, and the data is written to the higher-order LMA position in the P2L table. If updating... Figure 6 In table structure 2, the 34-bit data of the LMA is directly filled into the P2L table entry. The LMA to be updated is determined as follows: the current LMA is equal to P2L[Slma], where Slma is the starting bit position of the currently updated LMA in the P2L table, and the starting bit position of the currently updated LMA in the P2L table is equal to its index number (corresponding physical address) multiplied by 34.

[0101] It's important to note that garbage collection frees up space for user data writing. The specific process involves moving valid data to a new NAND location. This requires loading the P2L table, identifying valid data based on the LMAs (Levels of Validity) within it, and then reading and writing the valid data to the new NAND location. Therefore, GC data migration consists of three steps: ① scanning the P2L table to determine data validity, ② reading valid data, and ③ writing the data to the new superblock address. The first step utilizes the LMA data from the P2L table. Therefore, the LMA is indexed into the table using the physical address, and then the physical address is retrieved again using the L2P table. Comparing the two physical addresses pairwise determines data validity; if the physical addresses are equal, the data is valid.

[0102] Please see Figure 7 The LMA concatenation and reading process for P2L table entries is mainly reflected in the GC function. After garbage collection selects the superblock with the smallest amount of valid user data, it moves the data on the superblock. For each superblock, a parameter for the number of valid user data items is maintained. This parameter is compared during GC source selection, and the superblock with the smallest valid user data item is selected for migration. Before migrating data, the entire P2L table of the superblock needs to be loaded, then the P2L table is parsed and read, and the LMA data is concatenated. After the LMA verification is passed, the valid data is read and written to a new NAND location. A specific task can be used to concatenate and obtain the complete LMA, and then its validity is determined. The validity determination includes: whether the LMA is within the user data range max_lma_cnt (the LMA range of the SSD, obtained by dividing the SSD by 4K); and using the current LMA to index the PMA in the L2P table to determine if it is equal to the currently scanned physical location.

[0103] Please see Figure 8Based on the physical address, the 32-bit data of the lower LMA and the 2-bit data of the higher LMA can be indexed in the P2L table. This is because the P2L table indexes the logical address with the physical address, and its index unit is the Au offset in the superblock. That is, based on the offset of each Au in the superblock, the high and low LMA data can be obtained by looking up the P2L table. Then, the two data are concatenated to obtain a complete LMA data.

[0104] As can be seen, this embodiment changes the size of the LMA stored in the P2L table to 34 bits and modifies the layout of the P2L table. Option ① places the lower 32 bits of all LMA data in the P2L table into one set at the beginning and the higher 2 bits into another set at the end; Option ② directly arranges the LMAs in the P2L table in a compact 34-bit arrangement. The resulting P2L table can meet the needs of SSD systems with capacities of 32TB and above, while maximizing the saving of data storage space and significantly conserving DRAM and NAND resources.

[0105] The terms “first,” “second,” “third,” “fourth,” etc., used in this application (if applicable) are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, or apparatus that includes a series of steps or units is not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, or apparatus.

[0106] It should be noted that the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of those features. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.

[0107] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0108] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of readable storage medium known in the art.

[0109] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A data retrieval method, characterized in that, include: If a data reclamation command is received, the target superblock with the least amount of valid data is identified in the solid-state drive; Query the LMA information set corresponding to the target data stored in the target superblock in the P2L table corresponding to the target superblock; a single LMA has a target length greater than 32 bits; If the LMA information set does not exceed the LMA range of the solid-state drive, and the target data has not undergone a Trim operation, and the target PMA information set corresponding to the LMA information set found in the L2P table is consistent with the storage location of the target data in the target superblock, then the target data is read from the target superblock according to the target PMA information set, and the target data is stored in the destination superblock; wherein, the LMA range is calculated based on the total capacity of the solid-state drive; The step of querying the LMA information set corresponding to the target data stored in the P2L table corresponding to the target superblock includes: Determine the individual media units occupied by the target data in the target superblock; Look up the LMA corresponding to each medium unit in the P2L table; The LMA information set is obtained by summing up the LMAs corresponding to all media units; The step of storing the target data in the destination superblock includes: The superblock with the fewest erase / write cycles among the free superblocks in the solid-state drive is selected as the target superblock; Determine the destination PMA information set corresponding to the LMA information set in the destination superblock; The target data is stored in the target superblock according to the target PMA information set.

2. The method according to claim 1, characterized in that, The step of querying the LMA corresponding to each medium unit in the P2L table includes: If the characters of the target length are arranged in the order of the P2L table, then the LMA corresponding to the target length of each medium unit is read from the P2L table in the order of each medium unit; or If the 32-bit characters in the P2L table are arranged in order, and the remaining D-bit characters are arranged in order, then when the LMA corresponding to each medium unit is found in the P2L table, the first 32 bits of the current LMA are read first, and then the last D bits of the current LMA are read. The first 32 bits and the last D bits are concatenated to obtain the LMA of the target length of the current medium unit; D is equal to the target length minus 32.

3. The method according to claim 2, characterized in that, The value of D is calculated according to the target formula, which is: R / S≤2 X Where R is the total capacity of the solid-state drive, S=4K, and X is the target length, rounded up.

4. The method according to claim 1, characterized in that, The LMA information set does not exceed the LMA range of the solid-state drive, including: any LMA in the LMA information set is not greater than the LMA range.

5. The method according to any one of claims 1 to 4, characterized in that, After storing the target data in the destination superblock, the process further includes: The mapping relationship between the target PMA information set and the LMA information set is recorded in the P2L table corresponding to the target superblock. Change the target PMA information set corresponding to the LMA information set in the L2P table to the destination PMA information set.

6. A data retrieval device, characterized in that, include: The determination module is used to identify the target superblock with the least amount of valid data in the solid-state drive if a data reclamation instruction is received. The query module is used to query the LMA information set corresponding to the target data stored in the target superblock in the P2L table corresponding to the target superblock; a single LMA has a target length greater than 32 bits; The recycling module is configured to, if the LMA information set does not exceed the LMA range of the solid-state drive, the target data has not undergone a Trim operation, and the target PMA information set corresponding to the LMA information set found in the L2P table is consistent with the storage location of the target data in the target superblock, then read the target data from the target superblock according to the target PMA information set and store the target data in the destination superblock; wherein, the LMA range is calculated based on the total capacity of the solid-state drive; Specifically, the query module is used for: Determine the individual media units occupied by the target data in the target superblock; Look up the LMA corresponding to each medium unit in the P2L table; The LMA information set is obtained by summing up the LMAs corresponding to all media units; Specifically, the recycling module is used for: The superblock with the fewest erase / write cycles among the free superblocks in the solid-state drive is selected as the target superblock; Determine the destination PMA information set corresponding to the LMA information set in the destination superblock; The target data is stored in the target superblock according to the target PMA information set.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the method as described in any one of claims 1 to 5.

8. A readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

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

    CN114489489A

  • Data writing protection method and storage device

    CN115639959A