Garbage collection method and solid state drive

CN116610593BActive Publication Date: 2026-09-25MAXIO TECHNOLOGY (HANGZHOU) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210117299.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-08
Publication Date
2026-09-25
Estimated Expiration
2042-02-08

AI Technical Summary

Technical Problem

[0004]以NAND flash为主要的存储介质的SSD,当在数据写入的过程中发生异常断电时,数据未被完全保存,此时L2P映射表未完全刷新,极易出现编程错误导致SSD当前正在写的物理页(Page)的不稳定性,SSD重新上电后,此部分的数据由于发生错误而不会更新到L2P映射中,实际上是无效数据

Benefits of technology

[0030]本申请提供的垃圾回收方法及固态硬盘,在固态硬盘异常断电再上电重启后,先获取其在异常断电时闪存存储器的当前物理块正在接收的写数据,然后依次读取当前物理块的每个物理页中的写数据,将其中发生错误的(错误数据)且无法进行纠错处理的写数据存储至错误数据记录表中,在垃圾回收过程中,将存储至错误数据记录表中的错误数据标记为无效数据,这些数据不再进行纠错处理而直接被作为无效数据,也不在垃圾回收过程中被搬移,从而不必在垃圾回收时对所有的错误数据都进行纠错处理,仅对可以进行纠错处理的错误数据进行纠错处理,节约时间,减轻固态硬盘的压力,加快了异常数据的处理进程和垃圾回收操作的进程,减少了垃圾回收处理的时间,提高了在经历多次上下电后固态硬盘的性能,也维持了数据的稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116610593B_ABST
    Figure CN116610593B_ABST
Patent Text Reader

Abstract

A garbage collection method and a solid state disk are disclosed. The garbage collection method comprises: obtaining write data being received by a current physical block of a flash memory of the solid state disk at the time of abnormal power-off after power-on; sequentially reading each write data, and storing write data that has occurred error and cannot be processed by error correction in an error data record table; performing a garbage collection operation, querying whether error data is located in the error data record table, the error data being write data that has occurred error; marking error data located in the error data record table as invalid data, and continuing to perform the garbage collection operation. The garbage collection method of the disclosure stores data that cannot be processed by error correction in error data at the time of abnormal power-off and restart of the solid state disk in the error data record table, and marks the data as invalid data in the garbage collection process, so that error correction processing does not have to be performed on all error data during garbage collection, and the process of abnormal data processing and garbage collection operation is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data storage technology, and in particular to a waste recycling method and a solid-state drive. Background Technology

[0002] Solid-state drives (SSDs) are hard drives made with solid-state electronic storage chips, mainly composed of a controller, storage media, and cache chips. Currently, the most common SSDs use flash memory as the storage medium, such as non-volatile memory like NAND flash.

[0003] When using SSDs to store data, an FTL (Flash Translation Layer) mapping table, also called an L2P (Logical To Physical) mapping table, is needed to record the mapping relationship between the host logical space address and the Flash memory physical address. The L2P mapping table is a sequential table indexed by LBAs and containing PBAs.

[0004] SSDs that primarily use NAND flash memory are susceptible to data loss during write operations. When an unexpected power outage occurs, the data is not fully saved, and the L2P mapping table is not completely refreshed. This can easily lead to programming errors and instability in the physical pages currently being written. Upon power-up, this erroneous data is not updated in the L2P mapping and is essentially invalid. When garbage collection (GC) is initiated, it performs error correction on these unstable physical pages, impacting GC efficiency. With repeated power outages, the number of stored physical pages increases, requiring more error correction during GC, consuming significant time and slowing down the garbage collection process, thus affecting SSD performance. Therefore, current SSD power-on garbage collection mechanisms are inefficient due to the time-consuming and erratic nature of error correction. Summary of the Invention

[0005] In view of the above problems, the purpose of this invention is to provide a waste recycling method and a solid-state drive to solve the problems existing in the prior art.

[0006] According to one aspect of the present invention, a garbage collection method is provided, applied to a solid-state drive (SSD), the SSD including a flash memory, the flash memory including a plurality of physical blocks, each physical block including a plurality of physical pages, the garbage collection method comprising:

[0007] After power-on, obtain the write data that the current physical block of the flash memory is receiving during the abnormal power failure;

[0008] The write data in each physical page of the current physical block is read sequentially, and the write data that has an error and cannot be corrected is stored in the error data record table.

[0009] When performing a garbage collection operation, if erroneous data is read from the physical page, the system queries whether the erroneous data is located in the erroneous data record table; the erroneous data is the write data that caused the error.

[0010] The erroneous data in the error data record table is marked as invalid data, and the garbage collection operation continues.

[0011] Optionally, after the step of querying whether the error data is located in the error data record table when reading error data in the physical page during garbage collection, the method further includes:

[0012] The error data that is not stored in the error data record table will be corrected.

[0013] Optionally, after the step of obtaining the write data that the current physical block of the flash memory is receiving during the abnormal power failure after power-on, the method further includes:

[0014] An L2P mapping table is established based on the mapping relationship between the physical address and logical address of the written data.

[0015] Optionally, establishing an L2P mapping table based on the mapping relationship between the physical address and logical address of the written data includes:

[0016] An L2P mapping table is established based on the mapping relationship between the physical and logical addresses of the write data other than the erroneous data in the write data.

[0017] Optionally, after the step of correcting the error data not stored in the error data record table, the method further includes:

[0018] The L2P mapping table is updated based on the mapping relationship between the physical address and logical address of the error data undergoing error correction processing.

[0019] Optionally, the error data record table stores the logical address corresponding to the written data.

[0020] Optionally, the error data logging table is located in the cache chip of the solid-state drive.

[0021] Optionally, the error data includes the write data whose read results are not completely consistent, and the write data that cannot be corrected by error handling and checking tools is stored in the error data record table.

[0022] Optionally, all written data following the first erroneous data that cannot be corrected using the error handling checking tool, along with that erroneous data, are recorded together in the error data record table.

[0023] According to another aspect of the present invention, a solid-state drive is provided, comprising:

[0024] The controller, connected to the host, is used to exchange write data with the host and to perform garbage collection operations;

[0025] A flash memory, connected to the controller, stores write data from the host; and

[0026] A cache chip, connected to the controller and the flash memory, stores an L2P mapping table.

[0027] The flash memory includes multiple physical blocks, and each physical block includes multiple physical pages. The controller stores the write data that is currently being received by the solid-state drive during an abnormal power outage, and the write data that is erroneous and cannot be corrected, in an error data record table. The write data stored in the error data record table is marked as invalid data during garbage collection.

[0028] Optionally, the error data log table is stored in the cache chip, which includes SRAM and DRAM.

[0029] Optionally, when performing garbage collection, the controller performs error correction processing on erroneous data that is not stored in the error data record table, wherein the erroneous data is the write data that caused the error.

[0030] The garbage collection method and solid-state drive (SSD) provided in this application, after an abnormal power outage and subsequent power-on restart of the SSD, first acquire the write data currently being received by the physical block of the flash memory at the time of the abnormal power outage. Then, it sequentially reads the write data in each physical page of the current physical block, storing the erroneous (error data) write data that cannot be corrected into an error data record table. During garbage collection, the erroneous data stored in the error data record table is marked as invalid data. This data is no longer subject to error correction and is directly treated as invalid data, nor is it moved during garbage collection. Therefore, it is not necessary to perform error correction on all erroneous data during garbage collection; only erroneous data that can be corrected is corrected. This saves time, reduces the pressure on the SSD, speeds up the processing of abnormal data and the garbage collection operation, reduces garbage collection time, improves the performance of the SSD after multiple power-on and power-off cycles, and maintains data stability. Attached Figure Description

[0031] The above and other objects, features and advantages of the present invention will become more apparent from the following description of embodiments of the invention with reference to the accompanying drawings, in which:

[0032] Figure 1 A flowchart of a waste recycling method according to an embodiment of the present invention is shown;

[0033] Figure 2 This diagram illustrates the distribution of write data within the current physical block of the flash memory in a solid-state drive after power-on recovery, according to an embodiment of the present invention.

[0034] Figure 3 A schematic diagram of the operation flow of a waste recycling method according to an embodiment of the present invention is shown;

[0035] Figure 4 A schematic block diagram of a solid-state drive according to an embodiment of the present invention is shown. Detailed Implementation

[0036] The invention will now be described in more detail with reference to the accompanying drawings. In the various drawings, the same elements are indicated by similar reference numerals. For clarity, the various parts in the drawings are not drawn to scale. Furthermore, some well-known parts may not be shown.

[0037] The present invention is described below based on embodiments, but the invention is not limited to these embodiments. In the detailed description of the invention below, certain specific details are described in detail. Those skilled in the art will fully understand the invention even without these details. To avoid obscuring the essence of the invention, well-known methods, processes, flows, elements, and circuits are not described in detail.

[0038] Unless the context explicitly requires it, the terms "comprising," "including," and similar terms throughout the specification and claims should be interpreted as encompassing rather than exclusive or exhaustive; that is, meaning "including but not limited to." In the description of this invention, it should be understood that terms such as "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means two or more.

[0039] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples.

[0040] Figure 1 A flowchart of a waste recycling method according to an embodiment of the present invention is shown.

[0041] The garbage collection method in this embodiment is mainly applied to solid-state drives (SSDs). SSDs are storage hard drives made of solid-state electronic storage chips, and for example include a controller and a flash memory. The flash memory includes multiple physical blocks, and each physical block includes multiple physical pages. The flash memory is used to store write data, while the controller executes the garbage collection method. The garbage collection method in this embodiment includes the following process:

[0042] In step S101, after power-on, the write data that the current physical block of the flash memory is receiving during the abnormal power failure is obtained.

[0043] When a solid-state drive (SSD) experiences an abnormal power outage, the write data being received by the flash memory will be interrupted, and the corresponding mapping relationship of this write data will not be stored. Therefore, after the SSD is powered on again, the mapping relationship of this part of the write data written during the power outage needs to be restored first. At this time, it is necessary to first obtain the write data that the current physical block (head block) of the flash memory was receiving at the time of the power outage.

[0044] In step S102, an L2P mapping table is established based on the mapping relationship between the physical address and logical address of the data being written.

[0045] In this step, after obtaining the write data that the current physical block is receiving at the time of power failure, an L2P mapping table corresponding to the write data can be established using the mapping relationship between the physical addresses and logical addresses corresponding to this write data. Further, this step includes: establishing an L2P mapping table based on the mapping relationship between the physical addresses and logical addresses of the write data other than erroneous data within the write data.

[0046] When the flash memory experiences an abnormal power outage, the data being written to it is not fully saved. This incomplete mapping leads to inconsistent results from multiple data reads (e.g., the first read is correct, the second is incorrect). This results in inconsistent data pointed to by pointers, causing errors in the system's judgment table and leading to abnormal situations. Therefore, data in a solid-state drive (SSD) is unstable when power is lost. Erroneous write data is called erroneous data. The mapping relationship corresponding to this erroneous data has changed, and the L2P mapping table recovered using this data will also be incorrect. Therefore, when building the L2P mapping table, it is necessary to exclude this erroneous data and only use other write data to recover the L2P mapping table. Erroneous data includes write data with inconsistent results from multiple reads. These reads are not user-initiated operations, but rather operations performed by the SSD to determine the correctness of the written data. Therefore, multiple read checks are required to ensure the accuracy of the data results. During multiple reads, if any read result is inconsistent with the data received before the power outage, that data is considered erroneous. For example, if a page of data returns the correct result on the first read, but shows an incorrect result on the second read, and still returns the correct result on the third or even Nth read, such data will also be considered erroneous data. This ensures that the data the pointer points to each time in the retained data, making the data recovery more accurate.

[0047] In step S103, write data in each physical page of the current physical block is read sequentially, and write data that has errors and cannot be corrected is stored in the error data record table.

[0048] In this step, the write data in each physical page of the current physical block needs to be read sequentially to establish an L2P mapping table. Simultaneously, it's determined whether the write data is erroneous. If the read write data is erroneous and cannot be corrected, the write data is stored in the PHFR (previous head fail record) error data table. The PHFR stores the logical address corresponding to the write data; this table is, for example, located in the cache chip of the solid-state drive. Write data within the erroneous data that can be corrected is temporarily left unprocessed.

[0049] Generally, error handling and checking tools such as errhandle are used to correct written data. Written data that cannot be corrected using these tools is stored in an error data record table. Furthermore, to ensure data consistency, all written data following the first piece of errhandle that cannot be corrected, along with that errhandle itself, is recorded in the error data record table. This will be discussed later. Figure 2This will be introduced later.

[0050] After establishing the L2P mapping table based on the read write data, the normal read / write process begins. When the process reaches a certain point, the SSD will also perform garbage collection (GC).

[0051] In step S104, a garbage collection operation is performed. When error data is read from a physical page, the system queries whether the error data is located in the error data record table. The error data is the write data that caused the error.

[0052] In this step, during garbage collection, valid write data is moved to a new physical block, while invalid data is left unprocessed. After all write data on the entire physical block has been processed, the physical block is erased. In this embodiment, due to the presence of erroneous data, during garbage collection, when erroneous data is read, the system first checks whether the erroneous data is recorded in the erroneous data record table PHFR. If the erroneous data is in the erroneous data record table, step S105 is executed; otherwise, step S106 is executed.

[0053] In step S105, the erroneous data in the error data record table is marked as invalid data, and the garbage collection operation continues.

[0054] In this step, during garbage collection, if erroneous data is found in the error data record table, it is marked as invalid data. Therefore, this erroneous data does not need to be moved or corrected during garbage collection. By pre-screening invalid data in step S103, the processing time for garbage collection in this step is reduced, improving the efficiency of garbage collection.

[0055] In step S106, error correction processing is performed on the erroneous data in the data to be processed to obtain corrected data.

[0056] In this step, when erroneous data is read and a query reveals that this erroneous data is not recorded in the error data log table, it indicates that the data can be corrected. Therefore, error correction needs to be performed on this unstable erroneous data. Error correction should be performed on a page-by-page basis, for example, using error handling and checking tools such as err handle, to recover as much data as possible. Using pre-stored error correction tools within the SSD to correct the erroneous data ensures timely and rapid repair, improving repair speed and capability.

[0057] In step S107, the L2P mapping table is updated according to the mapping relationship between the physical address and logical address of the error data undergoing error correction processing.

[0058] In this step, error correction is performed on recoverable write data during garbage collection, and then the mapping relationship is restored. The L2P mapping table is updated using the mapping relationship between the physical address and logical address corresponding to these data, so that the L2P mapping table can reflect the mapping relationship corresponding to the write data more timely.

[0059] The garbage collection method provided in this embodiment, after a solid-state drive (SSD) experiences an abnormal power outage and subsequent power-on restart, first acquires the write data currently being received by the flash memory's physical block during the abnormal power outage. Then, it sequentially reads the write data from each physical page of the current physical block, establishes an L2P mapping table, and simultaneously stores the erroneous (error data) write data that cannot be corrected into an error data record table. During garbage collection, these erroneous data stored in the error data record table are marked as invalid data. These data are no longer subject to error correction and are directly treated as invalid data, and are not moved during garbage collection. Only error data that can be corrected is corrected, thus avoiding the need to correct all error data during garbage collection. This reduces garbage collection time, alleviates the pressure on the SSD, accelerates the processing of abnormal data and the garbage collection process, and improves the performance of the SSD after multiple power-on and power-off cycles.

[0060] Figure 2 A schematic diagram of the write data distribution within the current physical block of the flash memory after the solid-state drive is restored to power-on state according to an embodiment of the present invention is shown.

[0061] Typically, a flash memory contains several dies (die is the basic unit for receiving and executing flash commands), each die contains several planes (usually two, plane0 and plane1), each plane contains several physical blocks, each block contains multiple pages, and each physical page can store write data.

[0062] like Figure 2 As shown, each plane of each die corresponding to the current physical block (head block) includes, for example, pages 0-85. Each page of each plane (pln0 or pln1) in each die stores one piece of write data. Error correction is performed on a page-by-page basis. V (valued) indicates that the data is correct, E (empty) indicates that no data has been written to this space, and F (fail) indicates that the data is erroneous. Figure 1When the SSD loses power, for example, if only the write operation reaches the position of die1-plnl-page82, restarting the SSD retrieves the written data stored in the current physical block and checks each piece of data for errors. For example, if the write data is read from die0-pln0-page80 onwards, and errors are found during the read operation... Figure 2 The written data circled in the middle (diel-pln0-page81) is the first erroneous data that cannot be corrected using errhandle. To ensure data consistency, all subsequent data must be discarded. Therefore, all subsequent data, including this first erroneous data, will be recorded in the error data record table. During subsequent garbage collection, the data in this error data record table is considered invalid and does not require data migration. However, erroneous data not stored in the error data record table needs to be corrected.

[0063] Furthermore, if the SSD only wrote to the location die1-plnl-page82 when it lost power, after restarting the SSD, it needs to retrieve the written data stored in the current physical block and check each piece of data for errors. For example, if it reads the written data starting from die0-pln0-page80 and proceeds, it might find... Figure 2 The first erroneous data (diel-plnl-page81, circled in the middle) is the first data to be written and cannot be corrected. To ensure data consistency, all subsequent data must be discarded. Therefore, all subsequent data, including this first erroneous data, is recorded in the error data record table. During subsequent garbage collection, the data in this error data record table is considered invalid and does not require data migration. However, the erroneous data preceding this first erroneous data (diel-pln0-page81, circled in the middle) is, for example, data that can be corrected. Therefore, this erroneous data will not be recorded in the error data record table, and such erroneous data needs to be corrected during garbage collection.

[0064] By utilizing the relationship between the physical address and logical address of the obtained write data, an L2P mapping table corresponding to the write data can also be established. When establishing the L2P mapping table, the write data circled in the box is, for example, write data that was not stored in time when the power was off. In this case, the L2P mapping table needs to be restored. Each piece of write data is read in turn, and the L2P mapping table is established using the other write data besides the erroneous data.

[0065] In this embodiment, after power-on, the write data is read and the first erroneous data that cannot be corrected by the error handling tool err handle is found. All data after this erroneous data is recorded in the error data record table as invalid data, thereby discarding these unstable data and establishing an L2P mapping table only with stable data. This ensures the accuracy of the mapping relationship in the L2P mapping table, forms stable data protection, and maintains data consistency and stability.

[0066] Figure 3 A schematic diagram illustrating the operation flow of a waste recycling method according to an embodiment of the present invention is shown.

[0067] Figure 3 and Figure 1 The disclosed embodiments are basically the same. For example... Figure 3 As shown, the operation process includes steps S201-S212. Specifically:

[0068] Combination Figures 1-3 In step S201, the SSD experiences an abnormal power outage and is then powered on again.

[0069] In step S202, the L2P mapping table is restored.

[0070] After the solid-state drive is powered on again, it first obtains the write data received by the current physical block when the power was off, and restores the L2P mapping table accordingly.

[0071] In step S203, write data is read from each physical page of the current physical block.

[0072] By reading the write data in each physical page of the current physical block, the logical address corresponding to the write data is obtained to establish an L2P mapping table. At the same time, it is determined whether the write data is erroneous data that has caused an error.

[0073] In step S204, it is determined that there is an error in the written data and that it cannot be corrected. If there is an error in the written data and it cannot be corrected, step S205 is executed; otherwise, step S206 is executed.

[0074] In step S205, error data is recorded in the Error Data Recording Table (PHFR).

[0075] Error data that occurs during data writing and cannot be corrected is recorded in an error data record table. This step is a preliminary screening of error data. Further, using... Figure 2 As described in the implementation example, in order to ensure data consistency and stability, all written data after the first erroneous data that cannot be corrected by the error handling tool (err handle) and that erroneous data are recorded together in the error data record table.

[0076] In step S206, the disk is recognized.

[0077] The solid-state drive is recognized, the L2P mapping table is established, and normal read and write operations are performed.

[0078] In step S207, waste collection begins.

[0079] When the write data storage reaches a certain threshold, a garbage collection operation is performed, which moves the valid write data in the physical block to a new physical block, and then erases the physical block after the move is completed.

[0080] In step S208, erroneous data is read.

[0081] During garbage collection, the write data in each physical page is read sequentially to check if it is erroneous data. If erroneous data is read, step S209 needs to be executed to determine if it exists in PHFR.

[0082] In step S209, it is determined whether the erroneous data is in the PHFR record. If yes, proceed to step S210; otherwise, proceed to step S211.

[0083] In step S210, the erroneous data is marked as invalid data.

[0084] If erroneous data is found in PHFR, mark it as invalid data. No need to move it or perform error correction. This saves time spent on error correction for each piece of data and speeds up the garbage collection process.

[0085] In step S211, error correction processing is performed on the erroneous data.

[0086] If the erroneous data is not in the PHFR, it means that the erroneous data can be corrected. The error correction process must be performed first before the garbage collection operation, and the valid data will be moved to a new physical block.

[0087] In step S212, the waste collection process ends.

[0088] At this point, the garbage collection process is complete, and the data writing process is finished. The garbage collection method in this embodiment can pre-screen invalid data, reduce the time and resources spent on garbage collection, accelerate the processing of abnormal data, and improve the performance of the solid-state drive in processing data after multiple power cycles.

[0089] Figure 4 A schematic block diagram of a solid-state drive according to an embodiment of the present invention is shown.

[0090] like Figure 4As shown, the computer system 100 includes a host 110 and a solid-state drive (SSD). The SSD includes a controller 120 and a flash memory 130. The controller 120 is connected to the host 110 and is used to exchange write data with the host 110. The flash memory 130 is, for example, a NAND flash memory chip array. The controller 120 connects the host 110 and the flash memory 130, and stores the write data from the host 110 into the flash memory 130. The controller 120 is used to perform the above-described... Figures 1-3 Waste recycling methods.

[0091] The controller 120 includes a host interface 121, a processor 123, a cache chip (e.g., SRAM or DRAM, with multiple internal cache areas for storing error data log tables) 124, and a memory controller 128. The host interface 121 of the control system 120 is connected to the host 110 to transmit write data and read / write commands. The processor 123 is connected to the host interface 121, the cache chip 124, and the memory controller 128. The processor 123, for example, executes the aforementioned garbage collection method. The cache chip 124, for example, stores the error data log table. The memory controller 128 controls the transmission and storage of write data. The processor 123 also implements the core software layer for memory control, namely the FTL (Flash Translation Layer), enabling the operating system and file system to access the memory like a hard drive. This FTL also features, for example, support for bad block management, wear leveling, garbage collection, power-off recovery, and write balancing techniques. Furthermore, the cache chip 124, for example, includes SRAM or DRAM, with cache areas used to store L2P mapping tables and error data log tables.

[0092] Flash memory 130 includes an array of flash memory chips. To improve data read / write performance, memory controller 128 of controller 120 can read and write to the flash memory chips of flash memory 130 via multiple channels (e.g., CH0 and CH2). Each channel connects to a group of flash memory chips. Each flash memory chip includes multiple physical blocks, and each physical block includes multiple physical pages.

[0093] The controller 120 acquires the write data currently being received by the physical blocks of the solid-state drive (SSD) during an abnormal power outage, establishes an L2P mapping table, and simultaneously stores write data that contains errors and cannot be corrected in the error data record table of the cache chip 124. This write data stored in the error data record table is marked as invalid data during garbage collection. During garbage collection, the controller 120 also performs error correction on erroneous data not stored in the error data record table; these erroneous data are the write data that has encountered errors. Therefore, because erroneous data that cannot be corrected is recorded in the error data record table during the L2P mapping table establishment process, this data can be directly treated as invalid data during garbage collection, without data migration or error correction. Only erroneous data that can be corrected is corrected before continuing garbage collection. By pre-filtering out invalid data, garbage collection time is reduced, improving the data processing performance of the SSD.

[0094] In summary, the garbage collection method and solid-state drive (SSD) provided in this application, after an abnormal power outage and subsequent power-on restart of the SSD, first acquire the write data currently being received by the physical block of the flash memory at the time of the abnormal power outage. Then, it sequentially reads the write data in each physical page of the current physical block, storing the erroneous (error data) write data that cannot be corrected into an error data record table. During garbage collection, the erroneous data stored in the error data record table is marked as invalid data. This data is no longer subject to error correction and is directly treated as invalid data, nor is it moved during garbage collection. Therefore, it is not necessary to correct all erroneous data during garbage collection; only erroneous data that can be corrected is corrected. This saves time, reduces the pressure on the SSD, speeds up the processing of abnormal data and the garbage collection operation, reduces garbage collection time, improves the performance of the SSD after multiple power outages, and maintains data stability.

[0095] As described above, these embodiments of the present invention do not exhaustively cover all details, nor do they limit the invention to the specific embodiments described. Clearly, many modifications and variations can be made based on the above description. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to effectively utilize the invention and its modifications. The invention is limited only by the claims and their full scope and equivalents.

Claims

1. A garbage collection method applied to a solid-state drive (SSD), the SSD including a flash memory, the flash memory including multiple physical blocks, each physical block including multiple physical pages, the garbage collection method comprising: After power-on, obtain the write data that the current physical block of the flash memory is receiving during the abnormal power failure; The write data in each physical page of the current physical block is read sequentially to obtain error data. The error data is the write data in which the solid-state drive determines whether the write data is correct, but the results of multiple reads are not completely consistent. The write data that is error data and cannot be corrected is stored in the error data record table. The error data record table stores the logical address corresponding to the write data. An L2P mapping table is established based on the mapping relationship between the physical and logical addresses of the write data other than the erroneous data in the write data. When performing a garbage collection operation, if error data is read from the physical page, check whether the error data is located in the error data record table. as well as The erroneous data in the error data record table is marked as invalid data, and the garbage collection operation continues.

2. The waste recycling method according to claim 1, wherein, After the step of querying whether the error data is located in the error data record table when reading error data in the physical page during garbage collection, the process further includes: The error data that is not stored in the error data record table will be corrected.

3. The waste recycling method according to claim 2, wherein, After the step of correcting the error data not stored in the error data record table, the method further includes: The L2P mapping table is updated based on the mapping relationship between the physical address and logical address of the error data undergoing error correction processing.

4. The waste recycling method according to claim 1, wherein, The error data log table is located in the cache chip of the solid-state drive.

5. The waste recycling method according to claim 1, wherein, The write data that cannot be corrected using error handling and checking tools is stored in the error data record table.

6. The waste recycling method according to claim 5, wherein, All written data following the first erroneous data that cannot be corrected using the error handling checking tool, along with that erroneous data, are recorded together in the error data record table.

7. A solid-state drive, comprising: The controller, connected to the host, is used to exchange write data with the host and to perform garbage collection operations; A flash memory, connected to the controller, stores the write data of the host. as well as A cache chip, connected to the controller and the flash memory, stores an L2P mapping table. The flash memory includes multiple physical blocks, and each physical block includes multiple physical pages. After the solid-state drive (SSD) is powered on, the controller acquires the write data being received by the current physical block of the flash memory during an abnormal power outage; it sequentially reads the write data in each physical page of the current physical block to obtain erroneous data in the write data, wherein the erroneous data is the write data for which the SSD's multiple reads do not yield completely consistent results in determining whether the write data is correct; it stores the write data that is erroneous and cannot be corrected in an error data record table, which stores the logical address corresponding to the write data; it establishes an L2P mapping table based on the mapping relationship between the physical addresses and logical addresses of the other write data besides the erroneous data; and during garbage collection, the erroneous data found in the error data record table is marked as invalid data.

8. The solid-state drive according to claim 7, wherein, The error data log table is stored in the cache chip, which includes SRAM and DRAM.

9. The solid-state drive according to claim 7, wherein, When performing garbage collection operations, the controller corrects erroneous data that is not stored in the error data record table.

Citation Information

Patent Citations

  • Read command processing method and device, storage medium and electronic device

    CN113791930A

  • Data protection method of solid state disk, and solid state disk

    CN113849426A