Method for garbage collection with local clean-up operations, related controller and storage system

CN115237820BActive Publication Date: 2026-08-07SILICON MOTION INC
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SILICON MOTION INC
Filing Date
2022-01-05
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

如此一来,本发明避免了主机写入操作因搜寻有效页而被延宕,导致系统性能下降的问题

Benefits of technology

[0005]In view of this, one of the objectives of the present invention is to provide a method and apparatus for performing garbage collection operations. Embodiments of the present invention divide the garbage collection operation into multiple partial cleanup operations, which are performed interleaved with host write operations. During a single partial cleanup operation, only the page validity of a portion of the source block is checked, and the found valid page data is read. If the number of found valid pages is lower than expected, the partial cleanup operation will terminate prematurely, preventing the memory controller from getting stuck in the garbage collection process and allowing it to switch to performing host write operations. In this way, the present invention avoids the problem of host write operations being delayed due to searching for valid pages, leading to a decrease in system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115237820B_ABST
    Figure CN115237820B_ABST
Patent Text Reader

Abstract

The present invention relates to a method of garbage collection with local clean operations and related controller and storage system. One method of performing a garbage collection operation on a source block includes performing a plurality of local clean operations during a series of host write operations. Each local clean operation includes performing a validity check procedure on a search range of a partition of the source block to obtain valid page information, and performing a page clean procedure to read one or more valid pages indicated by the valid page information based on the valid page information and a target clean page number.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to flash memory, and more particularly to a method for performing garbage collection operations in flash memory, as well as related controllers and storage systems. Background Technology

[0002] Recently, NAND flash memory-based storage devices have been widely used in various fields. Compared with traditional hard drives, NAND flash memory has advantages including superior read and write performance, shock resistance, no noise, and lower power consumption.

[0003] Due to the nature of flash memory, it does not support overwrite operations. When new data needs to replace old data already stored in flash memory, the new data is written to a new location, and the data at the old location becomes invalid. Therefore, with repeated overwriting, the amount of invalid data increases. To ensure sufficient storage area for data storage, invalid data in flash memory needs to be erased. Generally, flash memory relies on garbage collection to free up space occupied by invalid data.

[0004] During garbage collection, valid pages (i.e., pages with valid data) from the source block are copied (their data is read and written) to a blank destination block, and then the source block is erased for reuse. Typically, garbage collection requires consulting the address translation table to determine which pages on the source block are valid and which data needs to be copied to the destination block, which is quite time-consuming. Additionally, to maintain sufficient storage space in flash memory, garbage collection also needs to free up some storage space to accommodate data the host attempts to write. Because valid pages are not contiguously and uniformly distributed across the source block, garbage collection may get stuck searching for valid pages and freeing up the necessary storage space, potentially causing significant system latency. In the worst case, this can also prevent host commands from executing smoothly before the deadline, severely degrading average system performance. Summary of the Invention

[0005] In view of this, one of the objectives of the present invention is to provide a method and apparatus for performing garbage collection operations. Embodiments of the present invention divide the garbage collection operation into multiple partial cleanup operations, which are performed interleaved with host write operations. During a single partial cleanup operation, only the page validity of a portion of the source block is checked, and the found valid page data is read. If the number of found valid pages is lower than expected, the partial cleanup operation will terminate prematurely, preventing the memory controller from getting stuck in the garbage collection process and allowing it to switch to performing host write operations. In this way, the present invention avoids the problem of host write operations being delayed due to searching for valid pages, leading to a decrease in system performance.

[0006] Embodiments of the present invention provide a method for performing a garbage collection operation on a source block, the method comprising: performing multiple partial cleanup operations during a series of host write operations. Each partial cleanup operation comprises: performing a validity check procedure within a partition search range of the source block to obtain valid page information; and performing a page cleanup procedure based on the valid page information and a target number of cleanup pages to read one or more valid pages indicated by the valid page information.

[0007] Embodiments of the present invention provide a controller for controlling a flash memory and performing a garbage collection operation on a source block on the flash memory. The controller includes a storage unit and a processing unit. The storage unit stores information. The processing unit executes program code and, referring to the information stored in the flash memory or the storage unit, performs the following operations: performing multiple partial cleanup operations during a series of host write operations. Each partial cleanup operation includes: performing a validity check procedure within a partition search range of the source block to obtain valid page information; and performing a page cleanup procedure based on the valid page information and a target number of cleanup pages to read one or more valid pages indicated by the valid page information.

[0008] Embodiments of the present invention provide a storage system comprising a flash memory and a controller. The controller controls the flash memory and performs a garbage collection operation on a source block on the flash memory. The controller performs multiple partial cleanup operations during a series of host write operations. Each partial cleanup operation includes: performing a validity check procedure within a partition search range of the source block to obtain valid page information; and performing a page cleanup procedure based on the valid page information and a target number of pages to be cleaned, to read one or more valid pages indicated by the valid page information. Attached Figure Description

[0009] Figure 1 A schematic diagram illustrating the architecture of a storage system according to an embodiment of the present invention is shown.

[0010] Figure 2 This illustration shows how a waste recycling operation is performed in an embodiment of the present invention.

[0011] Figure 3 A flowchart illustrating a single partial page cleanup operation in an embodiment of the present invention is shown.

[0012] Figures 4-6 The diagram illustrates the relationship between the validity checker and the page cleanup process under different valid page distributions.

[0013] Figure 7 The hardware architecture for implementing the validity check procedure in an embodiment of the present invention is illustrated.

[0014] Figure 8 A flowchart illustrating a single partial page cleanup operation in another embodiment of the present invention is shown.

[0015] [Symbol Explanation]

[0016] 10 Electronic devices

[0017] 50 Main control device

[0018] 52 processor

[0019] 54 Random Access Memory

[0020] 100 storage system

[0021] 120 NV memory

[0022] 122_1~122_N NV memory elements

[0023] 110 Memory Controller

[0024] 112 microprocessor

[0025] 112M Read-Only Memory

[0026] 112C program code

[0027] 114 Control Logic Circuit

[0028] 116 Random Access Memory

[0029] 118 Transmission Interface Circuit

[0030] 170 Validation Bit Mapping Hardware Engine

[0031] Steps 201, 205, 210-250 Detailed Implementation

[0032] Numerous specific details are described below to provide the reader with a thorough understanding of embodiments of the invention. However, those skilled in the art will appreciate how the invention can be implemented in the absence of one or more specific details, or by utilizing other methods, elements, or materials. In other instances, well-known structures, materials, or operations are not shown or described in detail to avoid obscuring the core concepts of the invention.

[0033] The phrase "in one embodiment" in this specification means that a particular feature, structure, or characteristic described in that embodiment may be included in at least one embodiment of the invention. Therefore, the phrase "in one embodiment" appearing throughout this specification does not necessarily mean the same embodiment. Furthermore, the aforementioned particular features, structures, or characteristics may be combined in any suitable form in one or more embodiments.

[0034] Figure 1 This is a schematic diagram of the architecture of an electronic device 10 according to an embodiment of the present invention. As shown, the electronic device 10 includes a host device 50 and a storage system 100. The host device 50 may include a random access memory (RAM) 54 and at least one processor 52, used to control the operation of the host device 50. In different embodiments, the host device 50 may be (but is not limited to): a smartphone, tablet computer, wearable device, personal computer, laptop computer, digital camera, digital video recorder, game console, car navigation system, printer, scanner, or server. In addition, in different embodiments, the storage system 100 may be (but is not limited to): a portable storage device (such as a memory card conforming to SD / MMC, CF, MS, XD, or UFS standards), a solid state drive (SSD), and various embedded storage devices (such as embedded storage devices conforming to UFS or eMMC specifications).

[0035] In various embodiments of the present invention, the storage system 100 may include a controller such as a memory controller 110, and may also include non-volatile (NV) memory 120. NV memory 120 is used to store information. NV memory 120 may include one or more NV memory elements, for example, a plurality of NV memory elements 122_1 to 122_N. Furthermore, NV memory 120 may be flash memory, and NV memory elements 122_1 to 122_N may be a plurality of flash memory wafers or a plurality of flash memory dies, but the present invention is not limited thereto. Additionally, NV memory 120 may include memory cells with a two-dimensional structure, or it may include memory cells with a three-dimensional structure.

[0036] like Figure 1 As shown, the memory controller 110 may include processing circuitry such as a microprocessor 112, storage elements such as a read-only memory (ROM) 112M, control logic circuitry 114, volatile memory 116, transmission interface circuitry 118, and a selective validity bitmap engine 170. At least some (e.g., some or all) of these elements may be interconnected via a bus. The volatile memory 116 is implemented using random-access memory (RAM). For example, the volatile memory 116 may be static RAM (SRAM). The volatile memory 116 may be used to provide internal storage space to the memory controller 110, for example, to temporarily store information. Additionally, in this embodiment, the ROM 112M is used to store program code 112C, and the microprocessor 112 is used to execute program code 112C to control access to the NV memory 120. In another embodiment, program code 112C may be stored in the NV memory 120.

[0037] The memory controller 110 controls the reading, writing, and erasing of the NV memory 120 via control logic circuitry 114. Furthermore, the memory controller 110 can simultaneously execute the writing of user data based on host commands from the host device 50, and collect valid data from the NV memory 120 through garbage collection or wear-leveling operations, and execute the writing of valid data. Control logic circuitry 114 can be further used to control the NV memory 120, and includes error correction code (ECC) circuitry (not shown) to perform data protection and / or correction, but the invention is not limited thereto. The transmission interface circuit 118 conforms to specific data transmission specifications (e.g., Serial Advanced Technology Attachment (SATA) specification, Universal Serial Bus (USB) specification, Peripheral Component Interconnect Express (PCIE) specification, Embedded Multimedia Card (eMMC) specification, or Universal Flash Storage (UFS) specification), and can communicate with the host device 50 according to specific communication specifications.

[0038] Generally, the host device 50 can indirectly access the storage system 100 by sending host commands and corresponding logical addresses to the memory controller 110. The memory controller 110 receives the host commands and logical addresses, converts the host commands into memory operation commands, and further uses the memory operation commands to control the NV memory 120, thereby performing read, write, or erase operations on memory cells or pages with specific physical addresses within the NV memory 120, where the physical address corresponds to the logical address. When the memory controller 110 performs an erase operation on any NV memory element 122_k among NV memory elements 122_1 to 122_N, at least one block in the NV memory element 122_k can be erased. Furthermore, each block of the NV memory element 122_k can include multiple pages, and access operations (e.g., read or write) can be performed on one or more pages.

[0039] In this invention, garbage collection (GC) operations can be implemented through multiple partial clean operations driven by the memory controller 110, and these partial clean operations can be distributed across different time slots. Partial clean operations can be interleaved with a series of read or write operations caused by host commands sent by the master controller 50. During a single partial clean operation, the memory controller 110 can identify valid pages of a portion of a source block and read the data on the identified valid pages. After performing several partial clean operations and copying the data from all valid pages in the source block to a new destination block, the source block can be erased and reused. At this point, the GC operation is complete.

[0040] Figure 2This diagram illustrates how a GC operation is performed according to an embodiment of the present invention. As shown, each local cleanup operation includes two sub-processes: a validity check procedure and a page cleanup procedure. In the validity check procedure, the validity of each page is checked within a partition search range ScanP of the source block, thereby establishing information about valid pages within the partition search range ScanP, indicating which pages are valid. In the validity check procedure, the memory controller 110 queries the host-to-flash (H2F) address translation table and the flash-to-host (F2H) address translation table to determine which page is valid. Specifically, the memory controller 110 first loads a portion of the F2H address translation table associated with the partition search range ScanP into the memory 54 of the host device 50 or the memory 116 of the memory controller 110 itself. Based on the loaded portion of the F2H address translation table, the memory controller 110 can determine which logical address the page to be checked is mapped to. Accordingly, the memory controller 110 then queries the H2F address translation table to translate the logical address of the page to be checked into a physical address. If the physical address belongs to the page to be checked, the page to be checked is confirmed to be valid. If not, it means that the logical address of the page to be checked is also mapped to another page, and therefore the page to be checked is invalid.

[0041] Valid page information obtained through the validity check procedure can be recorded in a validity bitmap stored in the memory 54 of the main control device 50 or the memory 116 of the memory controller 110, where one bit indicates the validity of a page. Alternatively, valid page information can be recorded in a first-in-first-out (FIFO) buffer additionally configured in the memory 54 or memory 116, where the entry of the FIFO buffer records the address of the valid page. The validity of all pages in a source block can be determined by performing a validity check procedure across multiple consecutive partition search ranges (ScanP) of the source block. For example, assuming a source block consists of 10,000 pages, each partition search range (ScanP) divides the source block into 400 consecutive pages. Therefore, after 25 validity checks, the validity of all pages in the source block can be confirmed.

[0042] Once the validity check procedure is completed (i.e., the validity of all pages within the partition search range ScanP has been checked), the page cleanup procedure begins. During the page cleanup procedure, data on the valid pages indicated by the valid page information is read. The memory controller 110 reads the valid pages that have been found and confirmed in the validity check procedure. According to different embodiments of the present invention, the page cleanup procedure may end after the data of the valid pages has been read. Alternatively, the page cleanup procedure may end only when the data of the valid pages has been written to a page in a new destination block.

[0043] The memory controller 110 uses the `SearchPtr` indicator to track the progress of validity checks. The `SearchPtr` indicator points to the address of the page being validated. Once the validity check process ends, the `SearchPtr` indicator stores the address of the last page that has been validated. Later, the page pointed to by the `SearchPtr` indicator will be used as the first page checked by a new validity check process. Additionally, the memory controller 110 uses the `CleanPtr` indicator to track the progress of page cleanup. The `CleanPtr` indicator points to the address of the valid page whose data is being read. Once the page cleanup process ends, the `CleanPtr` indicator stores the address of the last valid page whose data has been read. Later, the page pointed to by the `CleanPtr` indicator will be used as the first page read by a new page cleanup process.

[0044] To initialize the GC operation, the memory controller 110 first needs to determine the host write ratio for the GC operation. The host write ratio for the GC operation represents the ratio of the amount of user data written based on host commands sent by the host control device 50 to the amount of valid data written based on the GC operation within a specific time period. The host write ratio for the GC operation reflects how much valid data needs to be moved (i.e., how much storage space in the NV memory 120 needs to be freed) to balance the writes triggered by host commands (which will occupy storage space in the NV memory 120), thereby maintaining a certain number of free blocks in the NV memory 120. Based on the host write ratio for the GC operation, the memory controller 110 can determine a target cleanup page number C, which represents how many valid pages need to be read or copied in each page cleanup procedure to meet the host write ratio for the GC operation. Assuming the total number of valid pages in a source block is SrcVP and the total number of pages in the source block is BlkP, the number of partial cleanup operations required to read all valid pages in the source block is: (SrcVP / C). Furthermore, the partition search range ScanP of the validity check procedure in each partial cleanup operation will be: BlkP / (ScrVP / C), where the partition search range ScanP represents the number of pages in the source block that need to be checked in a validity check procedure.

[0045] Because valid pages are not distributed contiguously and uniformly across the source block, the memory controller 110 may not find as many valid pages as the target cleanup page count C required in a single validity check. For example, the number of valid pages within the current partition search range ScanP may be lower than expected, resulting in the page cleanup program reading no valid pages or reading very few valid pages. Thus, the actual cleanup page count CleanVP, representing how many pages are actually read in each page cleanup program, will vary significantly. Based on the distribution of valid pages across the source block, the actual cleanup page count CleanVP ​​may be less than the target cleanup page count C. In this case, the page cleanup program will end once the indicator CleanPtr equals the indicator SearchPtr. This is because all the discovered and confirmed valid pages have been read by the page cleanup program. Therefore, it can only be expected that subsequent page cleanup programs will read more valid pages. In view of this, the number of valid pages that the next page cleanup program needs to read will become (RemainVP + C), where "RemainVP" is the remaining cleanup page count, representing how many pages out of the target cleanup page count have not yet been read. If the actual number of pages cleaned (CleanVP) remains lower than the target number of pages cleaned (C), the remaining number of pages cleaned (RemainVP) will be accumulated. For example, if the target number of pages cleaned (C) indicates that each page cleanup procedure needs to clean up 30 pages, and in the validity check procedure of a first partial cleanup operation, only 14 valid pages are found and confirmed within its corresponding partition search range (ScanP), then this means that the page cleanup procedure of the first partial cleanup operation can only read 14 valid pages. Therefore, after the first partial cleanup operation ends, the remaining number of pages cleaned (RemainVP) is 16 pages (i.e., 30 - 14 = 16). In view of this, the page cleanup procedure in a second partial cleanup operation needs to read 46 valid pages (i.e., RemainVP(16) + C(30) = 46). However, if the validity check procedure of the second partial cleanup operation finds and confirms only 13 valid pages within its corresponding partition search range (ScanP), then this means that the page cleanup procedure in the second partial cleanup operation can only read 13 valid pages. Therefore, after the second partial cleanup operation, the remaining cleanup pages RemainVP is 63 pages (i.e., RemainVP(46) + C(30) - CleanVP(13) = 63). In view of this, the page cleanup procedure in the third partial cleanup operation needs to read 93 valid pages (i.e., 63 + 30 = 93). As described above, after the partial cleanup operation is completed, the remaining cleanup pages RemainVP will be updated through the calculation of (RemainVP + C) - CleanVP.On the other hand, if the valid pages are concentrated within the current partition search range ScanP, the memory controller 110 may be able to find as many valid pages as the sum of the target cleanup page count C and the remaining cleanup page count RemainVP. In this case, the page cleanup procedure will end once the memory controller 110 has read the number of valid pages: (RemainVP + C).

[0046] Please refer to Figure 3 The figure illustrates a flowchart of performing a single local cleanup operation according to an embodiment of the present invention. As shown, the process includes the following steps:

[0047] Step 210: Based on the SearchPtr metric, perform a validity check procedure within a partition search range of a source block to obtain valid page information;

[0048] Step 220: Based on the CleanPtr indicator, perform a page cleanup procedure according to the valid page information, thereby reading the valid page indicated by the valid page information.

[0049] Step 230: Determine whether the actual number of cleaned pages CleanVP ​​is lower than the sum of the target number of cleaned pages C and the remaining number of cleaned pages RemainVP.

[0050] Step 240: Set the remaining cleanup page count RemainVP to: C + RemainVP - CleanVP.

[0051] Step 250: Set the remaining cleanup page count RemainVP to 0.

[0052] In step 210, a validity check procedure is performed within a partition search range ScanP of a source block to obtain valid page information. As mentioned above, the partition search range ScanP of the source block is determined based on the target cleanup page count C, the total number of valid pages SrcVP, and the total number of pages BlkP of the source block. In step 220, a page cleanup procedure is performed based on the valid page information obtained from the validity check procedure. If the number of valid pages read by the memory controller 110 is the same as the sum of the remaining cleanup page count RemainVP and the target cleanup page count C (i.e., C + RemainVP), the page cleanup procedure ends. Alternatively, the page cleanup procedure also ends when the indicator CleanPtr catches up with the indicator SearchPtr, which means that the number of confirmed valid pages may be insufficient. After completing the page cleanup procedure, the process proceeds to step 230. In step 230, it is checked whether the actual cleanup page count CleanVP ​​(i.e., the number of valid pages actually read by the memory controller 110) is less than (C + RemainVP) pages. If so, this means that the number of confirmed valid pages is insufficient, and the memory controller 110 will attempt to read more valid pages in the subsequent page cleanup procedure. Then, the process proceeds to step 240, where the remaining cleanup page count is set to C + RemainVP - CleanVP. If the check result of step 230 is negative, it indicates that the valid pages confirmed in the validity check procedure are sufficient for the memory controller 110 to read and meet the host's write ratio for GC operations. Accordingly, the process proceeds to step 250, where the remaining cleanup page count RemainVP is set to 0.

[0053] Figures 4-6 This diagram illustrates the relationship between the validity check procedure and the page cleanup procedure under different valid page distributions. Figure 4 In the first scenario shown, the valid pages are mainly located at the end of the source block (or a super source block). Therefore, at the beginning of the operation, the page cleanup process in each partial cleanup operation cannot read enough valid pages (i.e., the actual number of cleaned pages, CleanVP, is consistently lower than the target number of cleaned pages, C). Consequently, in most cases, the metrics CleanPtr and SearchPtr are very close. Therefore, the remaining number of cleaned pages, RemainVP, will continuously increase.

[0054] exist Figure 5In the second scenario shown, valid pages are primarily located at the beginning of the source block. Therefore, the page cleanup process in each partial cleanup operation will not be able to fully read all valid pages found and confirmed within the partition search range ScanP (i.e., the number of valid pages found within the partition search range ScanP is significantly higher than RemainVP+C). Consequently, the CleanPtr metric will initially lag behind the SearchPtr metric. However, as the page cleanup process moves towards a range of source blocks that contain no valid pages or only a few valid pages, the CleanPtr metric will gradually catch up with the SearchPtr metric. Once the CleanPtr metric catches up with the SearchPtr metric, the remaining cleanup page count RemainVP begins to increase.

[0055] exist Figure 6 In the third scenario shown, valid pages are evenly distributed across the source block. Therefore, the metric CleanPtr may lag behind or catch up with the metric SearchPtr. When CleanPtr lags behind SearchPtr, the number of remaining cleaned pages, RemainVP, gradually increases. When CleanPtr catches up with SearchPtr, the number of remaining cleaned pages, RemainVP, gradually decreases to zero.

[0056] Figure 7 The illustration depicts the hardware implementation architecture of the validity check procedure in an embodiment of the present invention. In one embodiment, the microprocessor 112 can be implemented on a multi-core processor 112 with multiple processor cores. Each processor core may include data memory for storing global or local variables, instruction memory for storing program code, and processing units. During operation, the microprocessor 112 may allocate one or more processor cores to run flash translation layer (FTL) related threads to perform operations such as address mapping, garbage collection, and wear leveling. For example, the aforementioned local cleanup operations may be performed on one or more processor cores. Alternatively, a validity check procedure thread may run on one processor core, while a page cleanup procedure thread runs on another processor core. In some embodiments, the memory controller 110 may also include dedicated hardware, namely a validity bit mapping hardware engine 170, to execute the validity check procedure. The validity bit mapping hardware engine 170 may check the page validity within the partition search range by querying the F2H and H2F address translation tables and store the valid page information in a buffer as described above.

[0057] Figure 8The flowchart illustrating a partial cleanup operation in another embodiment of the present invention is shown. As shown, an FTL thread operating on the processor core of microprocessor 112 can initiate a partial cleanup operation. In step 201, the FTL thread can assign the task of the validity check program to another processor core within microprocessor 112 or to the validity bit mapping hardware engine 170, thereby performing validity checks page by page.

[0058] In the above embodiments, the partial cleanup operation and the corresponding validity check procedure and page cleanup procedure are described as being applied to the pages and blocks of the NV memory 120. However, according to various embodiments of the present invention, the present invention can also perform partial cleanup operations, as well as corresponding validity check procedures and page cleanup procedures, on the superpages and superblocks of the NV memory 120. A superpage may consist of several pages on different NV memory elements 122_1 to 122_N, and a superblock may consist of several blocks on different NV memory elements 122_1 to 122_N. Furthermore, the memory controller 110 can simultaneously perform multiple partial cleanup operations on different NV memory elements 122_1 to 122_N. Therefore, the validity check procedure and page cleanup procedure on different NV memory elements 122_1 to 122_N can have different progress.

[0059] In summary, this invention provides a method for performing garbage collection operations. Embodiments of this invention implement garbage collection operations through multiple partial cleanup operations. These partial cleanup operations are interleaved with host write operations. In each partial cleanup operation, a validity checker is executed to check the validity of some pages in the source block, and a page cleanuper is executed to read the data of valid pages found and confirmed in the validity checker. Furthermore, this invention also allows the progress of the page cleanuper to differ from that of the validity checker. And, when the number of found and confirmed valid pages is lower than expected (i.e., the number of valid pages is lower than (RemainVP+C)), the partial cleanup operation ends, preventing the memory controller from getting stuck on garbage collection operations and allowing host write operations to proceed. It is anticipated that the validity checker will find more valid pages in the next partition search range, thereby compensating for the lack of valid pages. Therefore, this invention avoids the problem of system performance degradation caused by delays in host write operations due to the search for valid pages.

[0060] Embodiments of the present invention can be implemented using hardware, software, firmware, and combinations thereof. Embodiments of the present invention can be implemented using software or firmware stored in a memory, employing a suitable instruction execution system. In terms of hardware, any of the following technologies or combinations thereof can be used: individual operational logic having logic gates capable of performing logical functions based on data signals; an application-specific integrated circuit (ASIC) having suitable combinational logic gates; a programmable gate array (PGA); or a field-programmable gate array (FPGA), etc.

[0061] The flowcharts and blocks in the specification illustrate the architecture, functionality, and operation achievable by systems, methods, and computer software products based on various embodiments of the present invention. In this regard, each block in the flowchart or function block diagram may represent a module, segment, or portion of program code, comprising one or more executable instructions for implementing a specified logical function. Furthermore, each block in the function block diagram and / or flowchart, and combinations of blocks, can be substantially implemented by a dedicated hardware system that performs the specified function or action, or a combination of dedicated hardware and computer program instructions. These computer program instructions may also be stored in a computer-readable medium that enables a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable medium implement the function / action specified by the blocks in the flowchart and / or function block diagram.

[0062] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be included in the scope of the present invention.

Claims

1. A method for performing a garbage collection operation on a source block in multiple stages, comprising: During a series of host write operations, multiple partial cleanup operations are performed, each corresponding to a different stage. Each partial cleanup operation includes: A validity check procedure is performed within a partition search range of the source block to check the validity of all pages within the partition search range and generate a valid page information accordingly. The complete address range of the pages in the source block is divided into multiple partition search ranges, and each partition search range is defined within a predetermined range of consecutive pages that need to be checked in the corresponding stage. as well as Based on the valid page information and a target value, a page cleanup procedure is performed to read one or more valid pages indicated by the valid page information, wherein the target value represents the number of valid pages expected to be read in the current partial cleanup operation, and the target value includes a compensation amount to compensate for the number of valid pages not read in previous partial cleanup operations; wherein, Each local cleaning operation also includes: If the number of valid pages read in the page cleanup process is less than the target value, and all valid pages within the search range of this partition have been read, then the page cleanup process ends. as well as After the page cleanup process is completed, the target value for subsequent partial cleanup operations is determined based on the target value and the number of valid pages read in the completed page cleanup process.

2. The method as described in claim 1, characterized in that, Also includes: Determine the write ratio of a host to a garbage collection operation, which represents the ratio between the amount of user data written based on host commands and the amount of valid data written based on the garbage collection operation. The target number of pages to be cleaned is determined based on the proportion of writes made by the host to garbage collection operations. as well as The search scope of a partition is determined by the number of pages to be cleaned for the target, the total number of pages in a source block, and the total number of valid pages in a source block.

3. The method as described in claim 1, characterized in that, The steps for performing this validity check procedure include: The validity of each page within the search range of this partition is recorded in a validity bitmap.

4. The method as described in claim 1, characterized in that, The steps for performing this validity check procedure include: The address of each valid page within the search range of this partition is recorded in a first-in-first-out (FIFO) buffer.

5. The method as described in claim 1, characterized in that, The steps to perform this page cleanup procedure include: If the number of valid pages read in the page cleanup procedure is the same as the sum of the target cleanup page number and the remaining cleanup page number, then the page cleanup procedure ends.

6. The method as described in claim 5, characterized in that, Also includes: After the page cleanup process is complete, update the number of remaining cleanup pages to zero.

7. The method as described in claim 1, characterized in that, The steps for performing this page cleanup procedure include: If the number of valid pages read in the page cleanup process is less than the sum of the target cleanup page number and the remaining cleanup page number, and all valid pages within the search range of the partition have been read, then the page cleanup process ends.

8. The method as described in claim 7, characterized in that, Also includes: After the page cleanup process is completed, the remaining cleanup page count is updated based on the remaining cleanup page count, the target cleanup page count, and the number of valid pages read in the completed page cleanup process.

9. A controller for controlling a flash memory and performing a garbage collection operation on a source block on the flash memory in multiple stages, comprising: A storage unit for storing information; and A processing unit is configured to execute program code and, with reference to information stored in the flash memory or the storage unit, perform the following operations: During a series of host write operations, multiple partial cleanup operations are performed, each corresponding to a different stage. Each partial cleanup operation includes: A validity check procedure is performed within a partition search range of the source block to check the validity of all pages within the partition search range and generate a valid page information accordingly. The complete address range of the pages in the source block is divided into multiple partition search ranges, and each partition search range is defined within a predetermined range of consecutive pages that need to be checked in the corresponding stage. as well as Based on the valid page information and a target value, a page cleanup procedure is performed to read one or more valid pages indicated by the valid page information, wherein the target value represents the number of valid pages expected to be read in the current partial cleanup operation, and the target value includes a compensation amount to compensate for the number of valid pages not read in previous partial cleanup operations; wherein, Each local cleaning operation also includes: If the number of valid pages read in the page cleanup process is less than the target value, and all valid pages within the search range of this partition have been read, then the page cleanup process ends. as well as After the page cleanup process is completed, the target value for subsequent partial cleanup operations is determined based on the target value and the number of valid pages read in the completed page cleanup process.

10. The controller as claimed in claim 9, characterized in that, The processing unit executes the program code to perform the following operations: Determine the write ratio of a host to a garbage collection operation, which represents the ratio between the amount of user data written based on host commands and the amount of valid data written based on the garbage collection operation. The target number of pages to be cleaned is determined based on the proportion of writes made by the host to garbage collection operations. as well as The search scope of a partition is determined by the number of pages to be cleaned for the target, the total number of pages in a source block, and the total number of valid pages in a source block.

11. The controller as claimed in claim 9, characterized in that, The processing unit executes the program code to perform the following operations: The validity of each page within the search range of this partition is recorded in a validity bitmap.

12. The controller as claimed in claim 9, characterized in that, The processing unit executes the program code to perform the following operations: The address of each valid page within the search range of this partition is recorded in a first-in-first-out (FIFO) buffer.

13. The controller as claimed in claim 9, characterized in that, The processing unit executes the program code to perform the following operations: If the number of valid pages read in the page cleanup procedure is the same as the sum of the target cleanup page number and the remaining cleanup page number, then the page cleanup procedure ends.

14. The controller as claimed in claim 13, characterized in that, The processing unit executes the program code to perform the following operations: After the page cleanup process is complete, update the number of remaining cleanup pages to zero.

15. The controller as claimed in claim 9, characterized in that, The processing unit executes the program code to perform the following operations: If the number of valid pages read in the page cleanup process is less than the sum of the target cleanup page number and the remaining cleanup page number, and all valid pages within the search range of the partition have been read, then the page cleanup process ends.

16. The controller as claimed in claim 15, characterized in that, The processing unit executes the program code to perform the following operations: After the page cleanup process is completed, the remaining cleanup page count is updated based on the remaining cleanup page count, the target cleanup page count, and the number of valid pages read in the completed page cleanup process.

17. A storage system comprising: A flash memory; and A controller for controlling the flash memory and performing a garbage collection operation on a source block on the flash memory in multiple stages, the controller being used to: During a series of host write operations, multiple partial cleanup operations are performed, each corresponding to a different stage. Each partial cleanup operation includes: A validity check procedure is performed within a partition search range of the source block to check the validity of all pages within the partition search range and generate a valid page information accordingly. The complete address range of the pages in the source block is divided into multiple partition search ranges, and each partition search range is defined within a predetermined range of consecutive pages that need to be checked in the corresponding stage. as well as Based on the valid page information and a target value, a page cleanup procedure is performed to read one or more valid pages indicated by the valid page information, wherein the target value represents the number of valid pages expected to be read in the current partial cleanup operation, and the target value includes a compensation amount to compensate for the number of valid pages not read in previous partial cleanup operations; wherein, Each local cleaning operation also includes: If the number of valid pages read in the page cleanup process is less than the target value, and all valid pages within the search range of this partition have been read, then the page cleanup process ends. as well as After the page cleanup process is completed, the target value for subsequent partial cleanup operations is determined based on the target value and the number of valid pages read in the completed page cleanup process.

Citation Information

Patent Citations

  • Storage device performing garbage collection and garbage collection method of storage device

    US20190196966A1

  • Controller and operation method thereof

    US20200379861A1

  • System and method for managing execution of internal commands and host commands in a solid-state memory

    US8782327B1