Waste recycling methods, devices, electronic equipment and storage media

By merging garbage collection and read recycling operations, the number of reads and duration of storage blocks are dynamically determined, thus solving the read interference problem of flash memory and improving the performance and lifespan of flash memory.

CN123115000APending Publication Date: 2026-11-17INSPUR (SHANDONG) COMPUTER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611600712.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-16
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing technologies, flash memory suffers from severe read interference. Read recycling mechanisms can block I/O service requests, affecting performance, and frequent garbage collection and read recycling operations shorten the lifespan of flash memory.

Method used

By dynamically determining whether to merge garbage collection and read reclamation operations based on the maximum number of reads, the current number of reads, and the read duration of the target storage block, garbage collection is prioritized for storage blocks that are close to read reclamation, reducing the number of independent read reclamation operations, merging data migration operations, and reducing erase overhead.

Benefits of technology

It reduces the number of read/recycle cycles, optimizes flash memory performance and lifespan, improves I/O performance, and extends the lifespan of flash memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123115000A_ABST
    Figure CN123115000A_ABST
Patent Text Reader

Abstract

This disclosure provides a garbage collection method, apparatus, electronic device, and storage medium, relating to the field of flash memory performance technology. The method includes: determining the read recycling duration corresponding to the target storage block based on the maximum number of reads corresponding to the target storage block, the current number of reads, and a first read duration; if the read recycling duration corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block. In this way, garbage collection and read recycling mechanisms can be combined, reducing the number of read recycling operations and optimizing the performance and lifespan of flash memory chips.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of flash memory performance technology, and in particular to a waste recycling method, apparatus, electronic device, and storage medium. Background Technology

[0002] As flash memory has evolved from Single-Level Cell (SLC) to Quad-Level Cell (QLC), flash memory density has been continuously increasing, but read interference problems have become more prominent. Existing technologies mainly rely on Read Reclaim (RR) mechanisms to solve the read interference problem.

[0003] The execution of the Recall (RR) mechanism preempts hardware scheduling resources, blocking user input / output (I / O) service requests and significantly reducing the read / write response speed of front-end services. Simultaneously, flash memory chips have a physical limit to the number of erase cycles; frequent RR executions and the resulting block erase operations accelerate chip lifespan degradation. Furthermore, flash memory chips frequently trigger garbage collection mechanisms throughout their lifespan, and this, combined with the read / reclaim mechanism, affects the overall performance and lifespan of the flash memory. Summary of the Invention

[0004] This disclosure provides a waste recycling method, apparatus, electronic device, and storage medium to at least solve the above-mentioned technical problems existing in the prior art.

[0005] According to a first aspect of this disclosure, a waste recycling method is provided, the method comprising: Based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the duration of the first read, determine the read reclamation duration corresponding to the target storage block; If the read reclamation time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block; The target storage block includes a first storage block or a second storage block, wherein the data stored in the first storage block is read more frequently than the data stored in the second storage block; the read reclamation duration is used to characterize the predicted duration from the current moment when the number of reads reaches the maximum number of reads to trigger read reclamation; the first read duration includes the time required for the number of reads of the target storage block to increase from 0 to the maximum number of reads, or the time required for the number of reads of the target storage block to increase from 0 to the current number of reads.

[0006] In the above scheme, the first storage block corresponds to a write linked list, and the method further includes: In response to receiving a write data request, it is determined whether the first data page corresponding to the write data request is in the write list; In response to the existence of the first data page in the write list, the first data page is marked as a first type, and the entry corresponding to the first data page is moved to the first item of the write list; Alternatively, in response to the absence of the first data page in the write list, the first data page is marked as a first type, the entry corresponding to the first data page is stored as the first item in the write list, and the last item in the write list is deleted.

[0007] In the above scheme, the write linked list is stored in a cache, the first storage block is a flash memory chip, and the method further includes: In response to the fulfillment of the first target condition, the data pages stored in the write list are stored in the write area of ​​the first storage block.

[0008] In the above scheme, the first storage block corresponds to a read linked list, and the method further includes: In response to receiving a read data request, it is determined whether the second data page corresponding to the read data request is in the read list; In response to the existence of the second data page in the read list, the second data page is marked as the first type, the entry corresponding to the second data page is moved to the first item of the read list, and the second data page is sent. Alternatively, in response to the absence of the second data page in the read list, the second data page is retrieved from the first or second storage block.

[0009] In the above scheme, obtaining the second data page from the first storage block or the second storage block includes: Locate the second data page in the first storage block; In response to the existence of the second data page in the first storage block, the entry corresponding to the second data page is stored as the first item of the read list, and the last item of the read list is deleted. If the second data page is not present in the first storage block, the second data page is retrieved from the second storage block, and the number of reads of the second data page is recorded. If the number of reads of the second data page is greater than or equal to the read threshold, the entry corresponding to the second data page is stored as the first item in the read list, and the last item in the read list is deleted.

[0010] In the above scheme, after performing garbage collection on the target storage block, the method further includes: Write the valid data pages in the target storage block into the read list.

[0011] In the above scheme, the read list is stored in a cache, the first storage block is a flash memory chip, and the method further includes: In response to the fulfillment of the second objective condition, the data stored in the read list is stored in the read region of the first storage block.

[0012] In the above scheme, the first storage block includes a read area and a write area, and the method further includes: The first read-write ratio is determined based on the number of read commands and write commands received within the first time window; The second read / write ratio is determined based on the number of read and write commands received within the second time window; Based on the first read-write ratio, the second read-write ratio, and the preset weight, the ratio of the read area to the write area in the first storage block is determined; The first time window is before the second time window.

[0013] In the above scheme, if the first read duration represents the time required for the number of reads of the target storage block to increase from 0 to the maximum number of reads, then determining the read reclamation duration corresponding to the target storage block based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the first read duration includes: The read ratio is determined based on the ratio of the current read count to the maximum read count. The second read duration is determined based on the product of the read ratio and the first read duration; the second read duration includes the time required for the number of reads of the target storage block to increase from 0 to the current number of reads. Based on the difference between the first read duration and the second read duration, the read reclamation duration corresponding to the target storage block is determined; specifically, it is determined by the following formula:

[0014] in, Characterizes the read reclamation time of the target storage block. Represents the maximum number of reads. Characterizes the current number of reads of the target storage block. This represents the duration of the first read.

[0015] In the above scheme, if the first read duration represents the time required for the number of reads of the target storage block to increase from 0 to the current number of reads, then determining the read reclamation duration corresponding to the target storage block based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the first read duration includes: The read margin multiple is determined based on the ratio of the maximum read count to the current read count; the read margin multiple is used to characterize the number of repetitions required to reach the maximum read count in the current read count. The read recovery time is determined based on the product of the read margin multiplier minus 1 and the first read duration; specifically, it is determined by the following formula:

[0016] in, Characterizes the read reclamation time of the target storage block. Represents the maximum number of reads. The current number of reads of the target storage block is represented by an integer greater than 0; This represents the duration of the first read.

[0017] In the above scheme, the waiting time for the target storage block to undergo garbage collection is determined based on the target storage block's order in the garbage collection queue and the average time for performing one garbage collection.

[0018] In the above scheme, if the read reclamation time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block, which further includes: Determine the proportion of invalid data pages in the target storage block; If the proportion of invalid data pages in the target storage block is greater than the invalid threshold and the read reclamation time of the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block.

[0019] According to a second aspect of this disclosure, a waste recycling apparatus is provided, the apparatus comprising a processing unit and a recycling unit; The processing unit is used to determine the read reclamation time corresponding to the target storage block based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the first read duration; The processing unit is also used to determine whether the read recycling time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block; If the processing unit determines that the read reclamation time corresponding to the target storage block is less than the waiting time for garbage reclamation of the target storage block, then the reclamation unit performs garbage reclamation on the target storage block; The target storage block includes a first storage block or a second storage block, wherein the data stored in the first storage block is read more frequently than the data stored in the second storage block; the read reclamation duration is used to characterize the predicted duration from the current moment when the number of reads reaches the maximum number of reads to trigger read reclamation; the first read duration includes the time required for the number of reads of the target storage block to increase from 0 to the maximum number of reads, or the time required for the number of reads of the target storage block to increase from 0 to the current number of reads.

[0020] According to a third aspect of this disclosure, an electronic device is provided, comprising: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods of this disclosure.

[0021] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions for causing the computer to perform the methods described in this disclosure.

[0022] The garbage collection method disclosed herein determines the read recycling duration corresponding to the target storage block based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the first read duration. If the read recycling duration corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block. In this way, garbage collection and read recycling mechanisms can be combined, reducing the number of read recyclings and optimizing the performance and lifespan of flash memory chips.

[0023] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0024] The above and other objects, features, and advantages of this disclosure will become readily apparent from the following detailed description of exemplary embodiments, taken in conjunction with the accompanying drawings. Several embodiments of this disclosure are illustrated in the drawings by way of example and not limitation, in which: In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts.

[0025] Figure 1 A schematic diagram of NAND flash memory interference is shown; Figure 2 A schematic diagram of a first optional process of the waste recycling method provided in this embodiment of the present disclosure is shown; Figure 3 A schematic diagram of a second optional process for the waste recycling method provided in this embodiment of the present disclosure is shown; Figure 4 An optional schematic diagram is shown showing hot write data stored in a write linked list; Figure 5 A schematic diagram illustrating an optional method for storing hot-read data in a read list is shown. Figure 6 A schematic diagram of a third optional process for the waste recycling method provided in this disclosure embodiment is shown; Figure 7 A schematic diagram of a fourth optional process for the waste recycling method provided in this disclosure embodiment is shown; Figure 8 A schematic diagram of a fifth optional process for the waste recycling method provided in this disclosure is shown; Figure 9 A schematic diagram of an optional structure of the waste recycling apparatus provided in an embodiment of this disclosure is shown; Figure 10 A schematic diagram of the composition structure of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation

[0026] To make the objectives, features, and advantages of this disclosure more apparent and understandable, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.

[0027] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0028] In the following description, the terms "first" and "second" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first" and "second" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this disclosure described herein can be implemented in an order other than that illustrated or described herein.

[0029] Unless otherwise defined, all technical and scientific terms used in this disclosure have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. The terminology used in this disclosure is for the purpose of describing embodiments of this disclosure only and is not intended to be limiting of this disclosure.

[0030] It should be understood that in the various embodiments of this disclosure, the sequence number of each implementation process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure.

[0031] Before providing a further detailed description of the embodiments of this disclosure, the nouns and terms involved in the embodiments of this disclosure will be explained, and the nouns and terms involved in the embodiments of this disclosure shall be interpreted as follows.

[0032] 1) Flash memory.

[0033] Flash memory is a type of non-volatile semiconductor memory that retains data even when power is off. It is mainly divided into two major architectures: NOR flash memory and NAND flash memory. NOR flash memory has a superior random read speed and is often used for device firmware and program code storage; NAND flash memory has a higher degree of integration of stacked storage cells and is the core carrier of high-capacity storage products such as solid-state drives, portable flash drives, and mobile phone built-in storage.

[0034] Based on the number of bits that can be stored in a single storage cell, NAND flash memory has undergone multiple generations of iterations, gradually evolving from single-level storage cells to four-level storage cells.

[0035] 2) Flash memory density Flash memory density refers to the total amount of data that can be stored per unit wafer area, and its density continues to increase with each iteration. However, high-density designs bring negative impacts: the voltage range inside the storage cell is compressed, and read interference continues to worsen; coupled with the garbage collection operation necessary for storage operation, this continuously negatively impacts flash memory read / write performance and erase lifespan.

[0036] 3) Storage blocks Also known as a flash block, it is the smallest physical unit for performing erase operations on NAND flash memory. It consists of several data pages connected in series, and a data page is the smallest unit for reading and writing flash memory.

[0037] A storage block contains a large number of storage cells. As NAND has evolved from single-level storage cells to four-level storage cells, flash memory density has continued to increase, and the number of data pages that a single block can hold has continued to increase.

[0038] Among them, the storage cell is the most basic physical device that stores charge and actually stores bit data; multiple storage cells are physically arranged and combined to form a data page.

[0039] 4) Reading interference Flash memory has evolved from single-level to four-level storage cells, with the number of bits that each cell can store increasing from 1 bit to 4 bits, and the corresponding charge states increasing from 2 to 16. The voltage gaps between states have become narrower, making it easier for the same amount of charge leakage to cause bit flipping.

[0040] Figure 1 A schematic diagram of NAND flash memory interference is shown.

[0041] like Figure 1 As shown, the intersection of the word line (WL) and the bit line (BL) is the memory cell. The word line is responsible for selecting the memory cell, and the bit line is responsible for reading and writing data. When reading a data page on the target word line, a read voltage exists on the target word line ( ), between the voltage intervals of the storage cells. In this case, a larger voltage needs to be applied ( This involves forcibly turning on other word lines to ensure the target word line can be properly turned on or off. However, this behavior can also cause minor writes to the data pages of other word lines. As flash memory density increases, the voltage intervals between different states within a storage cell become smaller. With the accumulation of read cycles, these minor writes intensify, eventually causing changes in the threshold voltage state of some storage cells, leading to data errors. This situation is known as read interference.

[0042] 5) Read and recycle Currently, the most common solution to read interference problems is read reclamation (also known as read recycling). When the cumulative read count of a storage block reaches the manufacturer's claimed value (the maximum number of reads a storage block can supposedly be read by), a read reclamation operation is triggered. This migrates all valid data pages within the storage block to a new free storage block to reset the read interference, and then the original storage block is erased. However, read reclamation blocks user input / output (I / O) requests, affecting flash memory performance; furthermore, the number of erase cycles for a storage block is limited, and read reclamation also impacts the lifespan of the flash memory.

[0043] 6) Waste recycling Because flash memory cannot be overwritten, when a user wants to write new data, they can only find a free data page to write the new data and point the logical address to the new data page. This causes the data in the original data page to expire, and the original data page becomes an invalid page, or "garbage." As more and more expired data pages accumulate and fill up the storage block space, garbage collection is required if you want to continue writing. Garbage collection involves reading the valid data pages from a storage block, rewriting them to other storage blocks, and then erasing the data in the old storage block, resulting in a new, empty storage block.

[0044] Based on the above description, it can be concluded that both read reclamation and garbage collection involve migrating valid data pages and erasing storage blocks. Garbage collection strategies only focus on space reclamation efficiency, ignoring blocks with severe read interference that are about to trigger read reclamation. In other words, in related technologies, garbage collection and read reclamation are independent and do not affect each other. Therefore, merging garbage collection and read reclamation to reduce the number of read reclamation operations can optimize flash memory performance and lifespan.

[0045] In view of the deficiencies existing in the related technologies, this disclosure provides a waste recycling method to at least solve some or all of the above-mentioned technical problems.

[0046] Figure 2 A schematic diagram of a first alternative process for a waste recycling method provided in an embodiment of this disclosure is shown, and the steps will be described accordingly.

[0047] Step S201: Determine the read reclamation duration corresponding to the target storage block based on the maximum number of reads, the current number of reads, and the first read duration.

[0048] In some embodiments, the target storage block can be any storage block in the flash memory. The maximum number of reads corresponding to the target storage block includes the maximum number of read operations that the storage block can perform, as claimed by the flash memory manufacturer. That is, when the number of reads on the storage block equals the maximum number of reads, a read recycling operation is triggered, the valid data pages in the storage block are migrated to other storage blocks, and all data in the storage block is erased.

[0049] In some embodiments, the current read count includes the number of times the target storage block has been read from the read count starting from 0 to the current time. The first read duration includes the time required for the read count of the target storage block to rise from 0 to the maximum read count, or the time required for the read count of the target storage block to rise from 0 to the current read count; the read reclamation duration includes the time from the current time to the predicted time when the storage block will be reclaimed.

[0050] In some embodiments, the target storage block may include two types of storage blocks: a first storage block and a second storage block. The first storage block is used to store hot-read data and hot-write data, while the second storage block is used to store non-hot-read data and / or non-hot-write data.

[0051] Correspondingly, the data stored in the first storage block is read more frequently than the data stored in the second storage block, which also indicates that when the two are read the same number of times, the first storage block takes less time. It can be further deduced that if the first read time is the time required for the target storage block to go from 0 to the maximum read time, then the first read time corresponding to the first storage block is less than the first read time corresponding to the second storage block.

[0052] In this context, "reading data" is a concept at the upper-layer business logic level, corresponding to read data requests issued by the host, representing the logical data that the business needs to read. "Reading data pages" is a concept at the flash memory hardware execution level. Since a NAND flash memory data page is the smallest physical unit for reading and writing, hardware can only perform read operations at the granularity of a complete data page. Therefore, reading a data page is the hardware read action performed on a physical data page. After being mapped by the flash memory translation layer, the read data request will locate the corresponding physical data page. The upper-layer read data request is the business objective, and the read data page is the hardware means to achieve that objective. The relationship between write data and write data pages is similar and will not be repeated here.

[0053] The carrier can be a computer program, electronic circuit, database, mobile application, electronic device, cloud computing platform, distributed system, artificial intelligence framework, mathematical model, automation tool, flash memory controller and microcontroller, etc., which are software or hardware capable of implementing algorithms and methods.

[0054] Step S202: If the read recycling time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block.

[0055] In some embodiments, if the predicted time for triggering read reclamation when the number of reads to the target storage block reaches the maximum read count from the current moment is less than the waiting time for garbage collection of the target storage block, it means that read reclamation is performed on the target storage block first. The read reclamation operation can be merged with the subsequent garbage collection operation, and garbage collection can be performed directly on the target storage block. This avoids the target storage block from performing two operations of migrating valid pages and erasing data in the storage block in a short period of time, thus extending the lifespan of the target storage block.

[0056] Optionally, the carrier can perform garbage collection on the target storage block if the read collection time is less than a preset threshold and the read collection time is less than the waiting time for garbage collection of the target storage block. The preset threshold can be set according to actual needs or experimental results; the preset threshold is set here to avoid the target storage block being prematurely garbage collected based solely on the condition that "the read collection time of the target storage block is less than the waiting time for garbage collection of the target storage block" when the current number of reads of the target storage block is much less than the maximum number of reads.

[0057] Thus, the garbage collection method provided in this disclosure predicts the time to trigger read collection based on the maximum number of reads, the current number of reads, and the read duration of the storage block, and dynamically determines whether to prioritize garbage collection, without needing a fixed threshold to adapt to business fluctuations. Storage blocks nearing read collection are included in the garbage collection candidate in advance, and data migration during garbage collection (GC) resets read interference, reducing the number of independent read collection triggers, lowering erase wear, and extending flash memory lifespan. Simultaneously, data migration operations are merged, reducing I / O blocking and improving the read / write performance of solid-state drives (SSDs).

[0058] Figure 3 A second alternative process diagram of the waste recycling method provided in this disclosure embodiment is shown, and will be described according to each step.

[0059] This disclosure also provides a method for storing cold / hot data separately using different storage blocks. Hot-write / hot-read data is stored centrally, and its frequent updates quickly generate a large number of invalid pages, causing the storage blocks to trigger read reclamation or garbage collection earlier. During the migration of hot-read data, accumulated read interference is simultaneously cleared, reducing individual read reclamation or garbage collection operations, lowering erase wear, and extending flash memory lifespan. Furthermore, by partitioning and isolating cold and hot data and centrally managing hot-read pages, read interference is concentrated in dedicated blocks, reducing read pressure on ordinary blocks (i.e., non-dedicated blocks) and reducing data bit flips and read retries. Finally, differentiated storage of cold and hot data improves block space utilization, avoids frequent GC and low reclamation efficiency caused by mixed cold and hot data, and optimizes overall I / O performance.

[0060] To implement the method of storing cold / hot data separately using different storage blocks as described in this disclosure, the storage blocks are divided into a first storage block and a second storage block. The first storage block stores hot-read data / hot-write data, and the second storage block stores other data besides hot-read data and hot-write data. If the first storage block stores hot-read data and hot-write data, a read list and a write list are configured for the first storage block. If the first storage block stores hot-read data, a read list is configured for the first storage block. If the first storage block stores hot-write data, a write list is configured for the first storage block.

[0061] The process of reading or writing to the linked list is stored in memory, such as the main controller's static random access memory (SRAM). Access Memory (SRAM) and Dynamic Random Access Memory (DRAM) Access Memory (DRAM) cache, characterized by easy data loss upon power failure but extremely fast read / write speeds, serves as a temporary high-speed buffer in this embodiment. The first or second storage block is a NAND flash memory chip capable of permanently storing data, i.e., retaining data even when power is lost but with slow erase / write speeds, and is the final persistent storage location.

[0062] In this embodiment, the linked list serves as a temporary cold / hot sorting cache, and the storage block is a long-term data aggregation repository for users. The specific method includes: Step S301: In response to receiving a write data request, the first data page corresponding to the write data request is stored in the write list.

[0063] In some embodiments, if the first storage block includes space for storing hot-write data, then the first storage block corresponds to a write list, the write list having a certain length, and each entry in the list storing a data page. When a write data request is received, the carrier determines whether the first data page corresponding to the write data request is in the write list.

[0064] In specific implementation, the carrier can perform a search and matching in the write linked list based on the unique identifiers such as the hash value, keyword, and identifier of the first data page corresponding to the write data request. If a match is successful, it is determined that the first data page is included in the write linked list, the first data page is marked as the first type, and the entry corresponding to the first data page is moved to the first item of the write linked list. The first type is a hot data type, and the second type is a cold data type; hot data types are read / written more frequently than cold data types.

[0065] Alternatively, if a match fails, meaning the first data page does not exist in the write list, then the first data page is marked as the first type, the entry corresponding to the first data page is stored as the first item in the write list, and the last item in the write list is deleted.

[0066] Figure 4 An optional schematic diagram is shown for hot write data storage to a write list.

[0067] like Figure 4 As shown, if the first data page corresponding to the write data request exists in the write list, then the first data page in the write list is moved to the head of the write list (the first entry in the write list is the first data page), and it is marked as type 1. If the first data page corresponding to the write data request does not exist in the write list, then the first data page is placed at the head of the write list, and the tail data page is deleted.

[0068] In some alternative embodiments, the method further includes: in response to satisfying a first target condition, storing the data pages stored in the write list to the write area of ​​the first storage block.

[0069] The first target condition may include at least one of the following: reaching a write cycle, reaching a first target time, or the number of data pages that have changed in the write list exceeding a first preset threshold. The first target time can be set according to actual needs; the first preset threshold can also be set according to actual needs.

[0070] The term "reaching a write cycle" refers to the carrier periodically storing data pages from the write list to the write area of ​​the first storage block based on the write cycle. The number of data pages in the write list that have changed exceeds a first preset threshold, which can include changes in the number of data pages in the write list exceeding the first preset threshold compared to the previous time data pages in the write list were written to the write area of ​​the first storage block. These changes can include changes in the order of the data pages and / or changes in the content of the data pages.

[0071] In step S302, in response to receiving a read data request, the second data page corresponding to the read data request is stored in the read list.

[0072] In some embodiments, in response to receiving a read data request, the carrier searches and matches the read list based on a unique identifier such as the hash value, keyword, or identifier corresponding to the read data request. If a match is successful, it is determined that the read list includes a second data page. The second data page is marked as a first type, the entry corresponding to the second data page is moved to the first item in the read list, and the second data page is sent. Alternatively, if a match fails, it is determined that the second data page does not exist in the read list, and the second data page is retrieved from the first storage block or the second storage block.

[0073] Figure 5 An optional schematic diagram is shown, illustrating the storage of hot-read data into a read list.

[0074] like Figure 5 As shown, if the second data page corresponding to the read data request exists in the read list, then the second data page in the read list is moved to the head of the read list (the first entry in the read list is the second data page), and it is marked as type 1. If the second data page corresponding to the read data request does not exist in the read list, then the second data page is searched for in the first storage block or the second storage block.

[0075] In specific implementation, the carrier searches for the second data page in the first storage block; if the second data page exists in the first storage block, the entry corresponding to the second data page is stored as the first item in the read list, and the last item in the read list is deleted; and the second data page is returned based on the read data request. Alternatively, if the second data page does not exist in the first storage block, the second data page is retrieved from the second storage block, and the second data page is returned based on the read data request, and the number of times the second data page is read is recorded.

[0076] In some embodiments, in response to the second data page being read more than or equal to a read threshold in the second storage block, indicating that the second data page is being converted from a second type to a first type, the entry corresponding to the second data page is stored as the first item in the read list, and the last item in the read list is deleted.

[0077] In some embodiments, in response to the satisfaction of a second target condition, the carrier stores data stored in the read list into the read region of the first storage block.

[0078] The second target condition may include reaching a read cycle, reaching a second target time, or the number of data pages that have changed in the read list exceeding a second preset threshold, at least one of these conditions. The second target time can be set according to actual needs; the second preset threshold can also be set according to actual needs.

[0079] The term "reaching the read cycle" refers to the carrier periodically storing data pages from the read list to the read area of ​​the first storage block based on the read cycle. The number of data pages in the read list that have changed exceeds a second preset threshold, which can include changes in the number of data pages in the read list exceeding the second preset threshold compared to the previous time data pages in the read list were written to the read area of ​​the first storage block. These changes can include changes in the order of the data pages and / or changes in the content of the data pages.

[0080] In some alternative embodiments, such as Figure 5 As shown, the data in the read list can be valid data pages from the first storage block, i.e., data pages moved to a blank storage block during garbage collection or read reclamation operations. Specifically, after the carrier performs read reclamation or garbage collection on the first storage block, it writes the valid data pages from the first storage block into the read list.

[0081] In some alternative embodiments, the carrier may maintain read and write lists based on a Flash Translation Layer (FTL).

[0082] In this way, hot-write data and hot-read data are dynamically identified and cached in the corresponding write or read lists through independent read and write lists. High-frequency read / write data is centrally stored in the first storage block. This storage block has a high read / write frequency and a faster read count increase, making it easier for the read reclamation trend calculation logic to determine that it is close to read reclamation and prioritize garbage collection. Valid hot-read pages migrated out of garbage collection are directly inserted into the read list for continuous centralized management. During reclamation, the accumulated read interference is reset synchronously, eliminating the need for separate read reclamation operations. Hot-read data and hot-write data are written to dedicated blocks in batches by region, reducing the overhead of scattered writes, balancing flash I / O performance, reducing additional erase losses, and extending the lifespan of flash memory. All write data (including user data and write data generated by garbage collection and read reclamation of valid data pages) are placed in different physical locations based on the heat label (hot read or hot write). Data pages marked as hot read or hot write are written to the first storage block, and other ordinary data pages are written to the second storage block. When hot-write and hot-read data pages are concentrated, the hot-write data pages are frequently updated and quickly become invalid, resulting in a large accumulation of invalid data pages within the first storage block, which triggers garbage collection first. When garbage collection processes the first storage block, the valid data pages within it are mainly hot-read data pages, and migrating them normally resets the accumulated read interference. A single garbage collection achieves both space reclamation and read interference reset, eliminating the need for a separate read reclamation operation.

[0083] It should be noted that steps S301 and S302 do not have a specific order and can be executed independently.

[0084] Figure 6A schematic diagram of a third alternative process for the waste recycling method provided in this disclosure is shown, and the steps will be described accordingly.

[0085] In some embodiments, a first storage block storing hot-read data / hot-write data is divided into a read region and a write region, wherein the read region stores hot-read data pages and the write region stores hot-write data pages. Different services have different read / write ratios; therefore, to improve the space utilization of the first storage block, a method for adaptively adjusting the ratio of the read region and write region in the first storage block is provided, specifically including: Step S401: Determine the first read-write ratio based on the number of read commands and write commands received within the first time window.

[0086] In some embodiments, the first time window is a historical time window, which can be the previous round of I / O statistics window; the carrier counts the number of read instructions and the number of write instructions within the first time window respectively, and determines the first read-write ratio based on the ratio between the number of read instructions and the number of write instructions.

[0087] The first read / write ratio characterizes the long-term distribution characteristics of hot read and hot write data under historical loads. It serves as a historical benchmark parameter for the exponential smoothing model, used to balance instantaneous load fluctuations and avoid drastic short-term oscillations in the partition ratio.

[0088] Step S402: Determine the second read / write ratio based on the number of read commands and write commands received within the second time window.

[0089] In some embodiments, the second time window is the current time window, i.e. the current round of I / O statistics window. The carrier counts the number of read instructions and the number of write instructions within the second time window, and determines the second read-write ratio based on the ratio between the number of read instructions and the number of write instructions.

[0090] The second read / write ratio can accurately reflect the current real-time heat distribution of customer business, capture sudden changes in read / write traffic, provide real-time observation data for partition adjustment, and allow adaptive adjustment to fit the current business load.

[0091] Step S403: Based on the first read / write ratio, the second read / write ratio, and the preset weight, determine the ratio of the read area to the write area in the first storage block.

[0092] In some embodiments, the ratio of the read area to the write area in the first storage block is (1 - preset weight) × first read-write ratio + preset weight × second read-write ratio.

[0093] In some embodiments, when the service or system is just starting up, a preset weight can be set to a fixed value (e.g., 0.5). As the service or system runs, the weight can be adjusted based on the difference between the first read / write ratio and the second read / write ratio. Specifically, if the difference is too large (e.g., greater than the preset value), it indicates that the read / write ratio of the service is shifting from the first read / write ratio to the second read / write ratio. In this case, the preset weight is increased to make the ratio of the read and write areas in the first storage block shift towards the read / write ratio trend required by the service. The preset value can be set according to actual needs or experimental results.

[0094] In this way, by dynamically adjusting the read / write partition ratio in the first storage block based on historical and current read / write ratios, and abandoning the fixed partitioning scheme, the system can smoothly adapt to the dynamically changing hot and cold data loads of business operations, significantly improving the space utilization of the first storage block and avoiding idle or insufficient partition space. By pre-setting weights to balance historical and real-time loads, the system prevents drastic fluctuations in partition ratios and ensures stable storage scheduling.

[0095] Figure 7 A schematic diagram of a fourth optional process for the waste recycling method provided in this disclosure is shown, and the steps will be described accordingly.

[0096] Step S501: Determine the read ratio based on the ratio of the current read count to the maximum read count.

[0097] In this embodiment, the first read duration represents the time required for the number of reads of the target storage block to increase from 0 to the maximum number of reads.

[0098] In some embodiments, the carrier is based on the current number of reads. and maximum number of reads The ratio is used to determine the proportion of data already read.

[0099] Step S502: Determine the second reading duration based on the product of the read ratio and the first reading duration.

[0100] In some embodiments, the second read duration includes the time required for the number of reads of the target storage block to increase from 0 to the current number of reads. Specifically, the carrier can start timing from the first read after the target storage block has undergone the previous round of garbage collection or read collection, and calculate the duration up to the current moment.

[0101] Step S503: Determine the read reclamation time corresponding to the target storage block based on the difference between the first read duration and the second read duration.

[0102] In some embodiments, the carrier determines the predicted duration for read reclamation to be triggered when the number of reads to the target storage block reaches its maximum read count, starting from the current moment, using the following formula:

[0103] in, Characterizes the read reclamation time of the target storage block. Represents the maximum number of reads. Characterizes the current number of reads of the target storage block. This represents the duration of the first read.

[0104] Step S504: If the read recycling time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block.

[0105] In some embodiments, the waiting time for garbage collection of a target storage block can be determined by the average time T_gc of performing one garbage collection and the rank_i of the target storage block in the garbage collection queue. Specifically, it includes: T_gc × rank_i. The garbage collection queue can be a queue of storage blocks waiting for garbage collection, including the sequence number of each storage block for garbage collection.

[0106] In some embodiments, if the predicted time for triggering read reclamation when the number of reads reaches the maximum read count is less than the waiting time for garbage collection of the target storage block, it means that read reclamation is performed on the target storage block first. The read reclamation operation can be merged with the subsequent garbage collection operation, and garbage collection can be performed directly on the target storage block. This avoids the target storage block from performing two operations of migrating valid pages and erasing data in the storage block in a short period of time, thus extending the lifespan of the target storage block.

[0107] In some optional embodiments, the carrier may also determine whether to perform garbage collection on the target storage block based on the proportion of invalid data pages in the target storage block to all data pages in the target storage block. Specifically, if the proportion of invalid data pages in the target storage block is greater than the invalid threshold and the read collection time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block.

[0108] Alternatively, the carrier can sort the proportion of invalid data pages in all storage blocks to the total data pages of the target storage block in descending order, and perform garbage collection operations on the top 2% of the storage blocks whose read collection time is less than the waiting time for garbage collection of the target storage block.

[0109] In some optional embodiments, if the proportion of invalid data pages in the target storage block is less than an invalid threshold, it indicates that there are still many valid data pages in the target storage block and garbage collection does not need to be performed immediately. Garbage collection may be performed according to the sorting and waiting in the garbage collection queue, or read reclamation may be performed when the proportion of invalid data pages in the target storage block is greater than the invalid threshold. The invalid threshold may be set according to actual requirements or experimental results.

[0110] For example, the number of garbage collection times before read reclamation is A, and the processing sequence number of the conventional garbage collection policy is B. To balance the space reclamation efficiency, during each garbage collection, the top 2% of blocks with the largest number of invalid pages are traversed to find a storage block that satisfies both A<B and the minimum A as the garbage collection object. If no such storage block is found, the conventional policy (sorting by the number of invalid pages from largest to smallest) is resumed to perform garbage collection. This ensures that each garbage collection achieves the dual purposes of space reclamation and read disturb reset as much as possible.

[0111] In this way, according to the garbage collection method provided in the embodiments of the present disclosure, the time for triggering read reclamation is predicted based on the maximum read count, the current read count, and the read duration of the storage block, so as to dynamically determine whether to preferentially perform garbage collection, without adapting to service fluctuations through a fixed threshold. Storage blocks approaching read reclamation are included in garbage collection candidates in advance, and read disturb is reset by means of GC data migration, so that the number of independent read reclamation triggers is reduced, erasure loss is reduced, and the service life of a flash memory is prolonged; meanwhile, data migration operations are combined, I / O blocking is reduced, and the read and write performance of an SSD is improved.

[0112] Figure 8 shows a schematic diagram of a fifth optional process of the garbage collection method provided in the embodiments of the present disclosure, and description will be made according to each step.

[0113] Step S601: Determine a read margin multiple based on a ratio of a maximum read count to a current read count.

[0114] In this embodiment, the first read duration represents a duration required for the read count of the target storage block to increase from 0 to the current read count.

[0115] In some embodiments, the carrier is based on the maximum read count and the current read count to determine the read margin multiple according to the ratio thereof.

[0116] Step S602: Determine a read reclamation duration based on a product of a value obtained by subtracting 1 from the read margin multiple and the first read duration.

[0117] In some embodiments, the read reclamation duration is determined based on the product of the value obtained by subtracting 1 from the read margin multiple and the first read duration; specifically, the read reclamation duration is determined based on the following formula:

[0118] in, Characterizes the read reclamation time of the target storage block. Represents the maximum number of reads. The current number of reads of the target storage block is represented by an integer greater than 0; This represents the duration of the first read. The read margin multiplier minus 1 is used to subtract the time already completed, i.e., the duration of the first read.

[0119] Step S603: If the read recycling time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block.

[0120] The specific steps of step S603 are the same as those of step S504, and will not be repeated here.

[0121] Thus, the garbage collection method provided in this disclosure predicts the time when read collection will be triggered based on the maximum number of reads of the storage block, the current number of reads, and the read duration, and dynamically determines whether to prioritize garbage collection without needing a fixed threshold to adapt to business fluctuations. Storage blocks nearing read collection are included in the garbage collection candidate in advance, and GC migration data resets read interference, reducing the number of independent read collection triggers, reducing erase wear, and extending flash memory lifespan; simultaneously, data migration operations are merged to reduce I / O blocking and improve SSD read / write performance.

[0122] Figure 9 A schematic diagram of an optional structure of a waste recycling apparatus provided in an embodiment of this disclosure is shown, and the steps will be described accordingly.

[0123] In some embodiments, the waste recycling apparatus includes a processing unit and a recycling unit.

[0124] The processing unit is used to determine the read reclamation time corresponding to the target storage block based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the first read duration; The processing unit is also used to determine whether the read recycling time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block; If the processing unit determines that the read reclamation time corresponding to the target storage block is less than the waiting time for garbage reclamation of the target storage block, then the reclamation unit performs garbage reclamation on the target storage block; The target storage block includes a first storage block or a second storage block, wherein the data stored in the first storage block is read more frequently than the data stored in the second storage block; the read reclamation duration is used to characterize the predicted duration from the current moment when the number of reads reaches the maximum number of reads to trigger read reclamation; the first read duration includes the time required for the number of reads of the target storage block to increase from 0 to the maximum number of reads, or the time required for the number of reads of the target storage block to increase from 0 to the current number of reads.

[0125] In some alternative embodiments, the waste recycling device may also include a storage unit.

[0126] The storage unit is specifically used to: in response to receiving a write data request, determine whether the first data page corresponding to the write data request is in the write list; In response to the existence of the first data page in the write list, the first data page is marked as a first type, and the entry corresponding to the first data page is moved to the first item of the write list; Alternatively, in response to the absence of the first data page in the write list, the first data page is marked as a first type, the entry corresponding to the first data page is stored as the first item in the write list, and the last item in the write list is deleted.

[0127] The storage unit is specifically used to: in response to satisfying the first target condition, store the data pages stored in the write list into the write area of ​​the first storage block.

[0128] The storage unit is specifically used to: in response to receiving a read data request, determine whether the second data page corresponding to the read data request is in the read list; In response to the existence of the second data page in the read list, the second data page is marked as the first type, the entry corresponding to the second data page is moved to the first item of the read list, and the second data page is sent. Alternatively, in response to the absence of the second data page in the read list, the second data page is retrieved from the first or second storage block.

[0129] The storage unit is specifically used for: searching for the second data page in the first storage block; In response to the existence of the second data page in the first storage block, the entry corresponding to the second data page is stored as the first item of the read list, and the last item of the read list is deleted. If the second data page is not present in the first storage block, the second data page is retrieved from the second storage block, and the number of reads of the second data page is recorded. If the number of reads of the second data page is greater than or equal to the read threshold, the entry corresponding to the second data page is stored as the first item in the read list, and the last item in the read list is deleted.

[0130] The storage unit is specifically used to write valid data pages from the first storage block into the read list.

[0131] The storage unit is specifically used to: in response to satisfying the second target condition, store the data stored in the read list into the read area of ​​the first storage block.

[0132] In some embodiments, the processing unit is further configured to determine a first read-write ratio based on the number of read instructions and the number of write instructions received within a first time window; The second read / write ratio is determined based on the number of read and write commands received within the second time window; Based on the first read-write ratio, the second read-write ratio, and the preset weight, the ratio of the read area to the write area in the first storage block is determined; The first time window is before the second time window.

[0133] In some embodiments, if the first read duration represents the time required for the number of reads of the target storage block to increase from 0 to the maximum number of reads, then the processing unit is specifically used for: The read ratio is determined based on the ratio of the current read count to the maximum read count. The second read duration is determined based on the product of the read ratio and the first read duration; the second read duration includes the time required for the number of reads of the target storage block to increase from 0 to the current number of reads. Based on the difference between the first read duration and the second read duration, the read reclamation duration corresponding to the target storage block is determined; specifically, it is determined based on the following formula:

[0134] in, Characterizes the read reclamation time of the target storage block. Represents the maximum number of reads. Characterizes the current number of reads of the target storage block. This represents the duration of the first read.

[0135] In some embodiments, if the first read duration represents the time required for the number of reads of the target storage block to increase from 0 to the current number of reads, then the processing unit is specifically used to: determine the read margin multiple based on the ratio of the maximum read count to the current read count; the read margin multiple is used to represent the number of repetitions required for the current read count to reach the maximum read count. The read recovery time is determined based on the product of the read margin multiplier minus 1 and the first read duration; specifically, it is determined based on the following formula:

[0136] in, Characterizes the read reclamation time of the target storage block. Represents the maximum number of reads. The current number of reads of the target storage block, which is an integer greater than 0. This represents the duration of the first read.

[0137] In some embodiments, the waiting time for the target storage block to undergo garbage collection is determined based on the target storage block's order in the garbage collection queue and the average time required to perform one garbage collection.

[0138] The processing unit is specifically used to determine the proportion of invalid data pages in the target storage block; If the proportion of invalid data pages in the target storage block is greater than the invalid threshold and the read reclamation time of the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block.

[0139] According to embodiments of this disclosure, this disclosure also provides an electronic device and a readable storage medium.

[0140] Figure 10 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown in this disclosure, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure as described and / or claimed herein.

[0141] like Figure 10 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0142] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of displays, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0143] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as garbage collection methods. For example, in some embodiments, the garbage collection method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the garbage collection method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform garbage collection methods by any other suitable means (e.g., by means of firmware).

[0144] Various embodiments of the systems and techniques described above in this disclosure can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0145] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0146] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0147] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0148] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0149] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0150] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this disclosure can be achieved, and this disclosure does not impose any limitations herein.

[0151] The above description is merely a specific embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.

Claims

1. A garbage collection method characterized by, The method includes: Based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the duration of the first read, determine the read reclamation duration corresponding to the target storage block; If the read reclamation time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block; The target storage block includes a first storage block or a second storage block, wherein the data stored in the first storage block is read more frequently than the data stored in the second storage block; the read reclamation duration is used to characterize the predicted duration from the current moment when the number of reads reaches the maximum number of reads to trigger read reclamation; the first read duration includes the time required for the number of reads of the target storage block to increase from 0 to the maximum number of reads, or the time required for the number of reads of the target storage block to increase from 0 to the current number of reads.

2. The method of claim 1, wherein, The first storage block corresponds to a write linked list, and the method further includes: In response to receiving a write data request, it is determined whether the first data page corresponding to the write data request is in the write list; In response to the existence of the first data page in the write list, the first data page is marked as a first type, and the entry corresponding to the first data page is moved to the first item of the write list; Alternatively, in response to the absence of the first data page in the write list, the first data page is marked as a first type, the entry corresponding to the first data page is stored as the first item in the write list, and the last item in the write list is deleted.

3. The method of claim 2, wherein, The write-linked list is stored in a cache, the first storage block is a flash memory chip, and the method further includes: In response to the fulfillment of the first target condition, the data pages stored in the write list are stored in the write area of ​​the first storage block.

4. The method of claim 1, wherein, The first storage block corresponds to a read linked list, and the method further includes: In response to receiving a read data request, it is determined whether the second data page corresponding to the read data request is in the read list; In response to the existence of the second data page in the read list, the second data page is marked as the first type, the entry corresponding to the second data page is moved to the first item of the read list, and the second data page is sent. Alternatively, in response to the absence of the second data page in the read list, the second data page is retrieved from the first or second storage block.

5. The method of claim 4, wherein, The step of retrieving the second data page from the first storage block or the second storage block includes: Locate the second data page in the first storage block; In response to the existence of the second data page in the first storage block, the entry corresponding to the second data page is stored as the first item of the read list, and the last item of the read list is deleted. If the second data page is not present in the first storage block, the second data page is retrieved from the second storage block, and the number of reads of the second data page is recorded. If the number of reads of the second data page is greater than or equal to the read threshold, the entry corresponding to the second data page is stored as the first item in the read list, and the last item in the read list is deleted.

6. The method of claim 1, wherein, After performing garbage collection on the target storage block, the method further includes: Write the valid data pages in the target storage block into the read list.

7. The method according to any one of claims 4 to 6, characterized in that, The read list is stored in a cache, the first storage block is a flash memory chip, and the method further includes: In response to the fulfillment of the second objective condition, the data stored in the read list is stored in the read region of the first storage block.

8. The method of claim 1, wherein, The first storage block includes a read area and a write area, and the method further includes: The first read-write ratio is determined based on the number of read commands and write commands received within the first time window; The second read / write ratio is determined based on the number of read and write commands received within the second time window; Based on the first read-write ratio, the second read-write ratio, and the preset weight, the ratio of the read area to the write area in the first storage block is determined; The first time window is before the second time window.

9. The method of claim 1, wherein, If the first read duration represents the time required for the number of reads of the target storage block to increase from 0 to the maximum number of reads, then determining the read reclamation duration corresponding to the target storage block based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the first read duration includes: The read ratio is determined based on the ratio of the current read count to the maximum read count. The second read duration is determined based on the product of the read ratio and the first read duration; the second read duration includes the time required for the number of reads of the target storage block to increase from 0 to the current number of reads. Based on the difference between the first read duration and the second read duration, the read reclamation duration corresponding to the target storage block is determined; specifically, it is determined by the following formula: in, Characterizes the read reclamation time of the target storage block. Represents the maximum number of reads. Characterizes the current number of reads of the target storage block. This represents the duration of the first read.

10. The method according to claim 1, characterized in that, If the first read duration represents the time required for the number of reads of the target storage block to increase from 0 to the current number of reads, then determining the read reclamation duration corresponding to the target storage block based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the first read duration includes: The read margin multiple is determined based on the ratio of the maximum read count to the current read count; the read margin multiple is used to characterize the number of repetitions required to reach the maximum read count in the current read count. The read recovery time is determined based on the product of the read margin multiplier minus 1 and the first read duration; specifically, it is determined by the following formula: in, Characterizes the read reclamation time of the target storage block. Represents the maximum number of reads. The current number of reads of the target storage block is represented by an integer greater than 0; This represents the duration of the first read.

11. The method according to claim 1, characterized in that, The waiting time for the target storage block to undergo garbage collection is determined based on the target storage block's order in the garbage collection queue and the average time for performing one garbage collection.

12. The method according to claim 1, characterized in that, If the read reclamation time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block, which also includes: Determine the proportion of invalid data pages in the target storage block; If the proportion of invalid data pages in the target storage block is greater than the invalid threshold and the read reclamation time of the target storage block is less than the waiting time for garbage collection of the target storage block, then garbage collection is performed on the target storage block.

13. A waste recycling device, characterized in that, The device includes a processing unit and a recycling unit; The processing unit is used to determine the read reclamation duration corresponding to the target storage block based on the maximum number of reads corresponding to the target storage block, the current number of reads, and the first read duration; The processing unit is also used to determine whether the read recycling time corresponding to the target storage block is less than the waiting time for garbage collection of the target storage block; If the processing unit determines that the read reclamation time corresponding to the target storage block is less than the waiting time for garbage reclamation of the target storage block, then the reclamation unit performs garbage reclamation on the target storage block; The target storage block includes a first storage block or a second storage block, wherein the data stored in the first storage block is read more frequently than the data stored in the second storage block; the read reclamation duration is used to characterize the predicted duration from the current moment when the number of reads reaches the maximum number of reads to trigger read reclamation; the first read duration includes the time required for the number of reads of the target storage block to increase from 0 to the maximum number of reads, or the time required for the number of reads of the target storage block to increase from 0 to the current number of reads.

14. An electronic device, characterized in that, include: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-12.

15. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-12.