Garbage collection processing method, storage device, and storage medium

By obtaining valid cluster bitmaps and target mapping tables, and combining them with a hardware search mechanism, the problem of reading the logical-to-physical mapping table affecting host write speed in traditional garbage collection methods is solved. This achieves a balance between garbage collection and host write speed, thereby improving the performance of storage devices.

CN122240520APending Publication Date: 2026-06-19CHANGSHA ZHICUN TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHANGSHA ZHICUN TECH CO LTD
Filing Date
2026-02-10
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Traditional garbage collection methods frequently read the logical-to-physical mapping table in storage devices, which affects host write speed and makes it difficult to balance garbage collection speed and host write speed.

Method used

By obtaining the valid cluster bitmap of the data block to be reclaimed, determining and loading the target mapping table, generating a data relocation list, moving the physical data in the data block to be reclaimed to the target data block, and using a hardware search mechanism to scan to reduce repeated read operations.

Benefits of technology

It reduces the resource consumption of the storage system during garbage collection, achieves a balance between garbage collection speed and host write speed, and improves the overall performance of the storage device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122240520A_ABST
    Figure CN122240520A_ABST
Patent Text Reader

Abstract

This application discloses a garbage collection method, storage device, and storage medium, relating to the field of storage technology. The method includes: in response to a garbage collection request, obtaining a data block to be collected and its corresponding valid cluster bitmap; determining and logically adding a target mapping table to a physical mapping table based on each bit in the valid cluster bitmap; generating a data migration list based on the target mapping record determined by the target mapping table; and migrating the physical data associated with the target mapping record in the data block to be collected to the target data block according to the data migration list. This application embodiment can quickly locate and load the target mapping table based on the VCB corresponding to the data block to be collected during the GC process, avoiding repeated read operations and corresponding bandwidth consumption from scanning the L2P mapping table one by one, thereby reducing the resource consumption of the storage system during the GC process and achieving a balance between garbage collection speed and host write speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Garbage collection (GC) is a critical operation in the storage management process of storage devices, and its execution efficiency directly determines the read and write performance and reliability of the storage devices. Traditional GC methods require frequent reading of the logical-to-physical (L2P) mapping table during the collection process, which will seriously affect the host write speed and make it difficult to balance garbage collection speed and host write speed. Summary of the Invention

[0003] In view of this, one of the objectives of this application is to provide a garbage collection method, storage device and storage medium that can reduce the system resource consumption of the GC process, so as to balance the garbage collection speed and the host write speed.

[0004] To achieve the above objectives, the technical solution of this application is implemented as follows: In a first aspect, embodiments of this application provide a waste recycling method applicable to storage devices, the method comprising: In response to a garbage collection request, the system obtains the data blocks to be collected and their corresponding valid cluster bitmaps. Each valid cluster bitmap corresponds one-to-one with a data block to be collected. The valid cluster bitmap includes multiple bits, which are used to indicate whether there is a mapping record for the data blocks to be collected in the logical-to-physical mapping table. The logical-to-physical mapping table is associated with the storage device. Based on each bit in the effective cluster bitmap, determine and load the target mapping table; the logical-to-physical mapping table includes the target mapping table, and the target mapping table includes mapping records; A data migration list is generated based on the target mapping record; the target mapping record is determined based on the target mapping table. According to the data migration list, move the physical data associated with the target mapping record in the data block to be recycled to the target data block.

[0005] In one possible implementation, before generating the data relocation list based on the target mapping record, the method further includes: The target mapping table is scanned using a hardware search mechanism to obtain multiple candidate mapping records; From multiple candidate mapping records, the candidate mapping records whose physical addresses fall within the target physical address range are determined as the target mapping records; the target physical address range is associated with the data block to be reclaimed. Based on the target mapping record, generate a data migration list, including: Associate the physical address in the target mapping record with its corresponding logical address to generate a data relocation list.

[0006] In one possible implementation, the bit includes a first state and a second state; When the bit is in the first state, the first state is used to indicate that there is a mapping record in the logical-to-physical mapping table for data blocks to be reclaimed; When the bit is in the second state, the second state is used to indicate that there is no mapping record for the data block to be reclaimed in the logical-to-physical mapping table.

[0007] In one possible implementation, after moving the physical data associated with the target mapping record in the data block to be reclaimed to the target data block, the method further includes: Determine the target physical address of the physical data within the target data block; Update the target mapping table based on the target physical address.

[0008] In one possible implementation, updating the target mapping table based on the target physical address includes: Based on the target physical address, a physical-to-logical mapping table corresponding to the target data block is generated in memory; the physical-to-logical mapping table is used to record the target logical address of each target physical address in the target data block; Update the logical-to-physical mapping sub-table based on the physical-to-logical mapping table.

[0009] In one possible implementation, after updating the logical-to-physical mapping sub-table according to the physical-to-logical mapping table, the method further includes: Save snapshot information containing the update status of the logical-to-physical mapping table; In the event of an abnormal power outage and subsequent power restoration, the logical-to-physical mapping table is reconstructed based on the snapshot information corresponding to the last table flush operation before power restoration and the valid cluster bitmap of the data block corresponding to the data write request.

[0010] In one possible implementation, the method further includes: In response to a data write request corresponding to the data to be written, update the logical-to-physical mapping table corresponding to the logical address of the data to be written; Under the condition that the preset table flushing conditions are met, the effective cluster bitmap of the data block corresponding to the data write request is updated according to the updated logical-to-physical mapping table.

[0011] In one possible implementation, the preset flushing conditions include any of the following: The amount of data already written in the data block corresponding to the data write request is greater than the preset data volume threshold; the preset data volume threshold is associated with the data block corresponding to the data write request. The number of bits to be updated in the valid cluster bitmap stored in the memory cache is greater than a preset bit count threshold; the preset bit count threshold is associated with the data block corresponding to the data write request. The storage device was found to have not received a data write request from the host within a preset time period.

[0012] Secondly, embodiments of this application provide a waste recycling and processing system applicable to storage devices, the system comprising: The acquisition module is used to respond to garbage collection requests and acquire the data blocks to be reclaimed and their corresponding valid cluster bitmaps. The valid cluster bitmaps correspond one-to-one with the data blocks to be reclaimed. The valid cluster bitmaps include multiple bits, which are used to indicate whether there is a mapping record for the data blocks to be reclaimed in the logical-to-physical mapping table. The logical-to-physical mapping table is associated with the storage device. The determination module is used to determine and load the target mapping table based on each bit in the valid cluster bitmap; the logical-to-physical mapping table includes the target mapping table, and the target mapping table includes mapping records; The generation module is used to generate a data migration list based on the target mapping record; the target mapping record is determined based on the target mapping table. The migration module is used to migrate the physical data associated with the target mapping record in the data block to be recycled to the target data block according to the data migration list.

[0013] Thirdly, embodiments of this application provide a storage device, which includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, it implements the method provided in the first aspect.

[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by one or more processors, implements the method provided in the first aspect.

[0015] The garbage collection method provided in this application, in response to a garbage collection request, obtains the data block to be collected and its corresponding valid cluster bitmap. The valid cluster bitmap corresponds one-to-one with the data block to be collected and includes multiple bits indicating whether a mapping record for the data block to be collected exists in the logical-to-physical mapping table. Then, based on each bit in the valid cluster bitmap, a target mapping table is determined and logically added to the physical mapping table. Based on the target mapping record determined in the target mapping table, a data migration list is generated. Finally, according to the data migration list, the physical data associated with the target mapping record in the data block to be collected is moved to the target data block. This application embodiment can quickly locate and load the target mapping table during the GC process based on the valid cluster bitmap (VCB) corresponding to the data block to be collected, avoiding repeated read operations and corresponding bandwidth consumption from scanning the L2P mapping table one by one. This reduces the resource consumption of the storage system during the GC process, achieving a balance between garbage collection speed and host write speed. Attached Figure Description

[0016] 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. It should be understood that the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] The attached diagram is described below: Figure 1 A schematic flowchart of a waste recycling method provided in this application embodiment; Figure 2 This is a schematic diagram of the processing logic corresponding to a waste recycling method provided in an embodiment of this application; Figure 3 This application provides a schematic diagram of host write fluctuations in a waste recycling method. Figure 4 This application provides a schematic diagram of the functional modules of a waste recycling and processing system. Figure 5 This is a schematic diagram of the hardware structure of a storage device provided in an embodiment of this application.

[0018] Explanation of reference numerals in the attached figures: 400. Waste recycling and processing system; 410. Acquisition Module; 420. Determine the module; 430. Generation Module; 440. Transfer module; 501. Processor; 502. Memory; 503. Communication interface; 510. Bus. Detailed Implementation

[0019] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0020] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0021] Garbage collection (GC) is a critical operation in the storage management process of storage devices, and its execution efficiency directly determines the read and write performance and reliability of the storage devices. Traditional GC methods require frequent reading of the logical-to-physical (L2P) mapping table during the collection process, which will seriously affect the host write speed and make it difficult to balance garbage collection speed and host write speed.

[0022] For example, under a continuous 4K random write load, the write speed may drop sharply from 80MB / s to 20MB / s when GC is triggered, which seriously interferes with the user experience.

[0023] Related technologies can also reduce the system resource consumption of GC by maintaining bits for each 4K data block, but this requires a large amount of additional memory allocation, for example, one bit is needed for each 4K, resulting in excessive memory consumption, and the problem of repeated table reads still exists. None of the above solutions can effectively balance GC speed and host write speed.

[0024] Based on this, embodiments of this application provide a garbage collection method, a storage device, and a computer-readable storage medium. Taking the garbage collection method as an example, the method, in response to a garbage collection request, obtains the data block to be collected and its corresponding valid cluster bitmap. The valid cluster bitmap corresponds one-to-one with the data block to be collected and includes multiple bits used to indicate whether a mapping record for the data block to be collected exists in the logical-to-physical mapping table. Then, based on each bit in the valid cluster bitmap, a target mapping table is determined and logically added to the physical mapping table. Based on the target mapping record determined in the target mapping table, a data migration list is generated. Finally, according to the data migration list, the physical data associated with the target mapping record in the data block to be collected is moved to the target data block. Embodiments of this application can quickly locate and load the target mapping table based on the VCB corresponding to the data block to be collected during the GC process, avoiding repeated read operations and corresponding bandwidth consumption from scanning the L2P mapping table one by one. This reduces the resource consumption of the storage system during the GC process, thus balancing garbage collection speed and host write speed.

[0025] In addition, the garbage collection method provided in this application embodiment does not require excessive memory usage and can achieve a low-cost balance between garbage collection speed and host write speed.

[0026] The waste recycling and processing method provided in the embodiments of this application will be introduced first below.

[0027] Please see Figure 1 , Figure 1 This is a schematic flowchart of a waste recycling method provided in an embodiment of this application, as shown below. Figure 1 The method shown can be applied to the waste recycling system or storage device described in the following embodiments. The following description will focus on its application to storage devices. Figure 1 The method shown specifically includes steps 110 to 140.

[0028] Step 110: In response to the garbage collection request, obtain the data block to be collected and its corresponding valid cluster bitmap; the valid cluster bitmap corresponds one-to-one with the data block to be collected, and the valid cluster bitmap includes multiple bits, which are used to indicate whether there is a mapping record of the data block to be collected in the logical-to-physical mapping table, which is associated with the storage device.

[0029] A garbage collection request, or GC request for short, refers to an instruction or signal issued by the main control chip of a storage device, which can be used to instruct the initiation of the GC process.

[0030] In some embodiments, a garbage collection request may be generated when the storage device detects that the number of its free data blocks is less than a preset data block threshold. This embodiment does not specifically limit the preset data block threshold; it can be selected according to actual needs.

[0031] In some embodiments, a garbage collection request may be generated when the storage device detects that the duration of high host write load exceeds a preset duration. This embodiment does not specifically limit the preset duration; it can be selected according to actual needs.

[0032] In some embodiments, a garbage collection request may be generated when the storage device receives a garbage collection instruction from the host.

[0033] The data blocks to be reclaimed are those identified during the GC process, which contain invalid data, i.e., data that has been marked for deletion or overwritten.

[0034] The effective cluster bitmap (VCB) can be used to record the distribution of data in the logical-to-physical mapping table (L2P) of the data blocks to be reclaimed. The VCB corresponds one-to-one with the data blocks to be reclaimed.

[0035] A bit is the smallest unit of data in a VCB and can be used to indicate whether there is a mapping record for a data block to be reclaimed in the logical-to-physical mapping table.

[0036] The L2P mapping table records the correspondence between the logical address issued by the host and the physical address where the corresponding data is actually stored.

[0037] In some embodiments, a data block to be reclaimed may be assigned a corresponding data block identifier, which is associated with a Virtual Code Block (VCB), and there is a one-to-one correspondence between the data block identifier and the VCB. When a storage device determines a data block to be reclaimed, it quickly determines and reads the corresponding VCB based on the data block identifier corresponding to the data block to be reclaimed.

[0038] In one possible implementation, the bit includes a first state and a second state; when the bit is in the first state, the first state is used to indicate that there is a mapping record for a data block to be reclaimed in the logical-to-physical mapping table; when the bit is in the second state, the second state is used to indicate that there is no mapping record for a data block to be reclaimed in the logical-to-physical mapping table.

[0039] For example, a bit may include a first state to indicate that the bit is 1, which indicates that it is valid; a bit may include a second state to indicate that the bit is 0, which indicates that it is invalid.

[0040] It should be noted that in the embodiments of this application, the number of data blocks to be recycled obtained in response to the garbage collection request can be one or more. When multiple data blocks to be recycled are obtained, each data block to be recycled can be processed synchronously, and the process of synchronous processing is the same.

[0041] In the specific implementation of step 110, the VCB corresponding to the data block to be reclaimed can be obtained and loaded. In this way, the storage device does not need to load a large L2P mapping table, which can significantly reduce the occupation of storage system resources during GC and help to achieve a balance between GC speed and host write speed. It also does not require maintaining independent bits for each 4K data block, which can reduce memory overhead and thus achieve a balance between GC speed and host write speed at a low cost.

[0042] Step 120: Determine and load the target mapping table based on each bit in the valid cluster bitmap; the logical-to-physical mapping table includes the target mapping table, and the target mapping table includes mapping records.

[0043] The target mapping table can refer to the mapping table selected from the L2P mapping table. It is not a physical table independent of the L2P mapping table. The target mapping table can be regarded as a logical sub-table of the L2P mapping table.

[0044] In some embodiments, the target mapping table is a sub-table in the L2P mapping table corresponding to the bits in the VCB that are in the first state.

[0045] In the specific implementation of step 120, the storage device can use the controller to read each bit in the VCB, and when a bit is detected to include a first state (such as 0), the segment corresponding to that bit in the L2P can be identified as the target mapping table and read and loaded. There is no need to load the entire L2P table, which can greatly save the internal bandwidth of the storage system.

[0046] Step 130: Generate a data migration list based on the target mapping record; the target mapping record is determined based on the target mapping table.

[0047] Target mapping records refer to those specific mapping records that, after filtering the target mapping table, are confirmed to have physical addresses that are indeed located within the data block to be reclaimed. They are the actual objects of GC. The target mapping table may contain multiple mapping records, but only the data corresponding to the target mapping record is valid and needs to be moved in GC.

[0048] A data migration table can refer to a list of instructions or address sequences generated by the controller of a storage device based on a target mapping record.

[0049] In some embodiments, each entry in the data migration table includes information such as the source physical address, the destination physical address, and the data length.

[0050] As mentioned earlier, when multiple data blocks to be reclaimed are obtained, each data block can be processed synchronously, and the synchronization process is the same. During the synchronous processing of multiple data blocks to be reclaimed, a data migration table can be generated.

[0051] In the specific implementation of step 130, the valid data that must be moved can be accurately locked through the target mapping record, avoiding the waste of resources caused by moving invalid data.

[0052] Step 140: According to the data migration list, move the physical data associated with the target mapping record in the data block to be recycled to the target data block.

[0053] The target data block can refer to a free data block in the storage device, or it can be a specific data block reserved for data writing.

[0054] In some embodiments, step 140 includes parsing read and write commands one by one in a preset order in the data migration list to migrate the physical data associated with the target mapping record in the data block to be reclaimed to the target data block.

[0055] In the specific implementation of step 140, by moving the physical data associated with the target mapping record to the target data block, the "valid data" in the data block to be reclaimed can be moved to a safe new location, which can prevent these "valid data" from being erased during the GC process. After the "valid data" is moved, the remaining data in the data block to be reclaimed are all "invalid data" and can be erased.

[0056] The garbage collection method provided in this application, in response to a garbage collection request, obtains the data block to be collected and its corresponding valid cluster bitmap. The valid cluster bitmap corresponds one-to-one with the data block to be collected and includes multiple bits indicating whether a mapping record for the data block to be collected exists in the logical-to-physical mapping table. Then, based on each bit in the valid cluster bitmap, a target mapping table is determined and logically added to the physical mapping table. Based on the target mapping record determined in the target mapping table, a data migration list is generated. Finally, according to the data migration list, the physical data associated with the target mapping record in the data block to be collected is moved to the target data block. This application embodiment can quickly locate and load the target mapping table based on the valid cluster bitmap (VCB) corresponding to the data block to be collected during the GC process, avoiding repeated read operations and corresponding bandwidth consumption from scanning the L2P mapping table one by one. This reduces the resource consumption of the storage system during the GC process, thus balancing garbage collection speed and host write speed.

[0057] In one possible implementation, before generating the data relocation list based on the target mapping record, the method further includes: The target mapping table is scanned using a hardware search mechanism to obtain multiple candidate mapping records; From multiple candidate mapping records, the candidate mapping records whose physical addresses fall within the target physical address range are determined as the target mapping records; the target physical address range is associated with the data block to be reclaimed. Based on the target mapping record, generate a data migration list, including: Associate the physical address in the target mapping record with its corresponding logical address to generate a data relocation list.

[0058] Compared to the traditional method of relying on software to traverse the L2P table line by line and make judgments, which is inefficient and time-consuming, this application embodiment utilizes a hardware search mechanism to perform parallel or high-speed serial scanning of the target mapping table, which can greatly shorten the time to find "valid data" and thus speed up the entire GC process. Furthermore, this application embodiment offloads the complex address matching and filtering tasks to hardware execution, freeing up the main control CPU resources. The CPU has more capacity to handle read and write requests from the host, thereby avoiding stuttering or latency caused by the large amount of GC computation, achieving a balance between GC speed and host write speed (or host read speed).

[0059] In some embodiments, scanning the target mapping table using a hardware search mechanism includes scanning the target mapping table using a pre-configured hardware module.

[0060] In some embodiments, the pre-configured hardware module may be an embedded microprocessor.

[0061] Not every candidate mapping record is the target mapping record. The storage device can extract the physical address in each candidate mapping record based on the hardware search mechanism and compare it with the target physical address range. The candidate mapping record that corresponds to the physical address in the target physical address range is determined as the target mapping record.

[0062] The association of the target physical address range with the data block to be reclaimed means that the target physical address range is the physical address interval of the data block to be reclaimed. For example, if the starting address of the data block A to be reclaimed is 0x1000 and its size is 100 pages, then the physical address interval (and target physical address range) of the data block A to be reclaimed is 0x1000 to 0x1063.

[0063] Associating the physical address and its corresponding logical address in the target mapping record establishes a one-to-one correspondence between them. For example, logical address 0x500 corresponds to physical address 0x1005, and the two can be associated to generate an item in the data relocation list.

[0064] In one possible implementation, after moving the physical data associated with the target mapping record in the data block to be reclaimed to the target data block, the method further includes: Determine the target physical address of the physical data within the target data block; Update the target mapping table based on the target physical address.

[0065] In this embodiment, by updating the target mapping table, when the host needs to read the moved data later, it can query and read the data that has been moved to the target data block from the updated target mapping table, ensuring data consistency and integrity. Furthermore, the storage device can only safely perform the erase operation after the target mapping table has been completely updated and it has been confirmed that there are no "valid data" mappings in the data block to be reclaimed.

[0066] Specifically, the target mapping table is updated based on the target physical address, that is, the physical address of the data block to be reclaimed in the target mapping table is replaced with the target physical address.

[0067] In one possible implementation, updating the target mapping table based on the target physical address includes: Based on the target physical address, a physical-to-logical mapping table corresponding to the target data block is generated in memory; the physical-to-logical mapping table is used to record the target logical address of each target physical address in the target data block; Update the logical-to-physical mapping sub-table based on the physical-to-logical mapping table.

[0068] Considering that when the GC process moves data to the target data block, immediately searching and randomly updating the L2P mapping table (global) could result in a large number of random accesses, leading to low efficiency. This embodiment first generates a Physical-to-Logical (P2L) mapping table in memory (note: this P2L mapping table is local and only used to record mapping relationships within the target data block), and uses the P2L mapping table as an intermediate buffer to associate the physical addresses of consecutive writes to the target data block with their corresponding logical addresses. This allows the storage system to centrally process mapping updates instead of distributing them, thereby improving the memory management efficiency of the storage device and facilitating a balance between GC speed and host write speed (or host read speed).

[0069] For example, if physical data is moved to page 0 of the target data block and the corresponding target physical address is 0x2000, and the logical address of the physical data in the data block to be reclaimed is 0x100, then a new entry can be added to the P2L mapping table: 0x2000->0x100.

[0070] For example, the L2P mapping table is very large. Based on the logical address 0x100, we can calculate which part of the L2P mapping table (or which sub-table) this logical address belongs to. We read the entry in the L2P mapping table (0x2000->0x100), extract the logical address 0x100, find the corresponding position in the L2P mapping table, and finally modify the physical address thereto to 0x2000. In this way, we can ensure that the L2P mapping table is consistent with the actual physical data of the target data block.

[0071] In one possible implementation, after updating the logical-to-physical mapping sub-table according to the physical-to-logical mapping table, the method further includes: Save snapshot information containing the update status of the logical-to-physical mapping table; In the event of an abnormal power outage and subsequent power restoration, the logical-to-physical mapping table is reconstructed based on the snapshot information corresponding to the last table flush operation before power restoration and the valid cluster bitmap of the data block corresponding to the data write request.

[0072] Considering that the L2P mapping table of a storage device typically resides in volatile memory (RAM), if an abnormal power loss occurs, the data in RAM will be instantly lost, and the system will be unable to find the physical location of the written data. This embodiment of the application saves snapshot information containing the updated state, essentially creating an "archive" for the L2P table. Combined with VCB (which can be used to indicate which data blocks have unrecorded new data), the storage device can restore the L2P table to its latest state before the power loss after power is restored, thus preventing the loss of written data.

[0073] In some embodiments, snapshot information may include the L2P table's version number, verification information, and metadata summary, which can be used to indicate the status of the L2P table.

[0074] For example, the storage device can first read the snapshot information from the last table flush and restore the L2P mapping table to the time the snapshot information was recorded. At this point, all data written before the snapshot exists. The target data block corresponding to the "data write request" that was in progress before the power failure was written after the snapshot, and the VCB of the corresponding data block records the state of these data blocks. According to the guidance of the VCB, the storage device can directly read the physical data of these data blocks, extract the logical addresses from the data, and then use these latest physical addresses and logical addresses to fill and update the L2P table restored after charging and power-on.

[0075] In one possible implementation, the method further includes: In response to a data write request corresponding to the data to be written, update the logical-to-physical mapping table corresponding to the logical address of the data to be written; Under the condition that the preset table flushing conditions are met, the effective cluster bitmap of the data block corresponding to the data write request is updated according to the updated logical-to-physical mapping table.

[0076] Considering that the most critical task during data writing is establishing the L2P mapping table to ensure data addressability, updating the VCB (which involves complex bitmap management operations) for every data write would significantly prolong write response time. In this embodiment, the L2P table can be updated quickly to ensure successful data writing, while VCB updates are postponed until preset conditions are met. This eliminates the impact of VCB updates on write performance, resulting in faster and smoother host write speeds. Furthermore, compared to updating the VCB every time data is written, postponing VCB updates until preset conditions are met allows for batch VCB updates, reducing the number of operations, lowering the computational resources and storage bandwidth consumed by the controller in the storage device, improving the overall data management efficiency of the storage device, and also facilitating a balance between GC speed and host write speed (or host read speed).

[0077] In one possible implementation, the preset flushing conditions include any of the following: The amount of data already written in the data block corresponding to the data write request is greater than the preset data volume threshold; the preset data volume threshold is associated with the data block corresponding to the data write request. The number of bits to be updated in the valid cluster bitmap stored in the memory cache is greater than a preset bit count threshold; the preset bit count threshold is associated with the data block corresponding to the data write request. The storage device was found to have not received a data write request from the host within a preset time period.

[0078] This application does not impose specific limitations on the preset data volume threshold, preset bit number threshold, and preset duration; all can be selected according to actual needs.

[0079] It should be noted that the various embodiments described in this application can be combined with each other or implemented individually without conflict, and this application does not limit this.

[0080] Please see Figure 2 , Figure 2 This is a schematic diagram illustrating the processing logic of a waste recycling method provided in an embodiment of this application. Figure 2 middle: “Gc src a”, “Gc src b”, and “Gc src c” can represent data blocks to be reclaimed (corresponding to step 110 in the above embodiments). The content corresponding to “Load VCB” can be used to determine and load the VCB corresponding to each data block to be recycled (corresponding to step 110 in the above embodiment). “Load valid I2p cluster # n ~ n+k (limited by buf size)” corresponds to step 120 in the above embodiments; “Hw search & generate Move list (Multi-list table)” corresponds to step 130 in the above embodiment; “Copy (move) data According to the list” corresponds to step 140 in the above embodiment.

[0081] Furthermore, the method described in this application embodiment is used for actual testing, and the test conditions include: Test disk: YS9203 DRAMLESS 1TB; Flash: YMTC X2 8 * 2; Testing software: iometer, full disk 4K random write for 12 hours; Temperature: Room temperature.

[0082] Please see Figure 3 , Figure 3 The schematic diagram of host write fluctuations in a garbage collection method provided in this application embodiment shows that, compared with the method provided in this application embodiment, the host write fluctuations during GC processing are significantly reduced and the host write performance is stable after adopting the method provided in this application embodiment.

[0083] Corresponding to the above method embodiments, this application also provides a waste recycling and processing system. Please refer to [link to relevant documentation]. Figure 4 , Figure 4 A waste recycling system provided in this application embodiment can be applied to storage devices. The waste recycling system 400 may include: The acquisition module 410 is used to acquire the data block to be reclaimed and its corresponding valid cluster bitmap in response to the garbage collection request. The valid cluster bitmap corresponds one-to-one with the data block to be reclaimed. The valid cluster bitmap includes multiple bits, which are used to indicate whether there is a mapping record of the data block to be reclaimed in the logical-to-physical mapping table. The logical-to-physical mapping table is associated with the storage device. The determination module 420 is used to determine and load the target mapping table based on each bit in the valid cluster bitmap; the logical-to-physical mapping table includes the target mapping table, and the target mapping table includes mapping records; The generation module 430 is used to generate a data transfer list based on the target mapping record; the target mapping record is determined based on the target mapping table. The moving module 440 is used to move the physical data associated with the target mapping record in the data block to be recycled to the target data block according to the data moving list.

[0084] The waste recycling and processing system provided in this application embodiment can achieve the following: Figure 1 The various processes implemented in the Chinese method embodiments can achieve similar or the same technical effects, and will not be described again here to avoid repetition.

[0085] In addition to the methods and systems provided in the above embodiments, this application also provides a storage device. Please see [link to previous document]. Figure 5 , Figure 5 This is a schematic diagram of the hardware structure of a storage device provided in an embodiment of this application.

[0086] like Figure 5 The storage device shown may include a processor 501 and a memory 502 storing computer program instructions.

[0087] Specifically, the processor 501 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0088] Memory 502 may include mass storage for data or instructions. For example, and not limitingly, memory 502 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 502 may include removable or non-removable (or fixed) media. Where appropriate, memory 502 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 502 is non-volatile solid-state memory.

[0089] In some embodiments, memory 502 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described in the methods provided according to embodiments of this application.

[0090] The processor 501 implements the method provided in the above embodiments by reading and executing computer program instructions stored in the memory 502.

[0091] In one example, the storage device may also include a communication interface 503 and a bus 510. The processor 501, memory 502, and communication interface 503 are connected via the bus 510 and communicate with each other.

[0092] The communication interface 503 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0093] Bus 510 includes hardware, software, or both, that couples components of a storage device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 510 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.

[0094] Furthermore, in conjunction with the methods provided in the above embodiments, this application embodiment can be implemented using a computer-readable storage medium. This computer-readable storage medium stores computer program instructions; when executed by a processor, these computer program instructions implement any of the methods in the above embodiments.

[0095] Furthermore, in conjunction with the methods provided in the above embodiments, this application embodiment can provide a computer program product to implement the methods. This program product is stored in a storage medium and executed by at least one processor to implement the various processes of the embodiments of the methods provided in the above embodiments, achieving similar or identical technical effects. To avoid repetition, further details are omitted here.

[0096] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0097] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0098] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0099] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirection to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments acquired.

[0100] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0101] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A waste recycling and processing method, characterized in that, Applied to a storage device, the method includes: In response to a garbage collection request, the system obtains the data block to be collected and its corresponding valid cluster bitmap; the valid cluster bitmap corresponds one-to-one with the data block to be collected, and the valid cluster bitmap includes multiple bits, which are used to indicate whether there is a mapping record for the data block to be collected in the logical-to-physical mapping table, and the logical-to-physical mapping table is associated with the storage device; Based on each bit in the effective cluster bitmap, the target mapping table is determined and loaded; the logical-to-physical mapping table includes the target mapping table, and the target mapping table includes the mapping records; A data migration list is generated based on the target mapping record; the target mapping record is determined according to the target mapping table. According to the data migration list, the physical data associated with the target mapping record in the data block to be recycled is moved to the target data block.

2. The method as described in claim 1, characterized in that, Before generating the data migration list based on the target mapping record, the method further includes: The target mapping table is scanned using a hardware search mechanism to obtain multiple candidate mapping records; From the plurality of candidate mapping records, the candidate mapping record whose physical address is located within the target physical address range is determined as the target mapping record; the target physical address range is associated with the data block to be reclaimed; The step of generating a data migration list based on the target mapping record includes: The physical address and its corresponding logical address in the target mapping record are associated to generate the data migration list.

3. The method as described in claim 1, characterized in that, The bit includes a first state and a second state; When the bit is in the first state, the first state is used to indicate that there is a mapping record for the data block to be reclaimed in the logical-to-physical mapping table; When the bit is in the second state, the second state is used to indicate that there is no mapping record for the data block to be reclaimed in the logical-to-physical mapping table.

4. The method as described in claim 1, characterized in that, After moving the physical data associated with the target mapping record in the data block to be reclaimed to the target data block, the method further includes: Determine the target physical address of the physical data within the target data block; Update the target mapping table based on the target physical address.

5. The method as described in claim 1, characterized in that, The step of updating the target mapping table based on the target physical address includes: Based on the target physical address, a physical-to-logical mapping table corresponding to the target data block is generated in memory; the physical-to-logical mapping table is used to record the target logical address of each target physical address in the target data block; Update the logical-to-physical mapping sub-table based on the physical-to-logical mapping table.

6. The method as described in claim 5, characterized in that, After updating the logical-to-physical mapping sub-table according to the physical-to-logical mapping table, the method further includes: Save the snapshot information containing the update status of the logical-to-physical mapping table; In the event of an abnormal power outage and subsequent power restoration, the logical-to-physical mapping table is reconstructed based on the snapshot information corresponding to the last table flush operation before power restoration and the valid cluster bitmap of the data block corresponding to the data write request.

7. The method as described in claim 1, characterized in that, The method further includes: In response to a data write request corresponding to the data to be written, update the logical-to-physical mapping table corresponding to the logical address of the data to be written; If the preset table refresh conditions are met, the effective cluster bitmap of the data block corresponding to the data write request is updated according to the updated logical-to-physical mapping table.

8. The method as described in claim 7, characterized in that, The preset refresh conditions include any one of the following: The amount of data already written in the data block corresponding to the data write request is greater than a preset data volume threshold; the preset data volume threshold is associated with the data block corresponding to the data write request. The number of bits to be updated in the valid cluster bitmap stored in the memory cache is greater than a preset bit count threshold; the preset bit count threshold is associated with the data block corresponding to the data write request. The storage device was found to have not received a data write request from the host within a preset time period.

9. A storage device, characterized in that, The storage device includes a memory and a processor, wherein the memory stores a computer program that, when executed by the processor, implements the method of any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by one or more processors, implements the method of any one of claims 1 to 8.