Solid state disk garbage collection write error processing method and device, equipment and medium
By detecting and classifying write errors during solid-state drive (SSD) garbage collection, and adopting differentiated processing strategies for different types of errors, including data migration and dynamic resource adjustment, the problem of poor data recovery reliability during SSD garbage collection is solved, thereby achieving reliable data recovery and extending hard drive lifespan.
Patent Information
- Application Number
- CN202511052672.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2025-11-14
AI Technical Summary
In existing technologies, the reliability of recovering data from write errors during solid-state drive (SSD) garbage collection is poor, affecting data reliability, performance, and lifespan.
By detecting write errors in solid-state drive (SSD) garbage collection and classifying error types, temporary errors are handled by resending or rewriting the write operation, while permanent errors are handled by data migration and bad block marking. Furthermore, by dynamically adjusting resources, including data block spare pools and redundant space, dynamic adjustment of SSD resources can be achieved.
It improves the reliability of data recovery from write errors during garbage collection, extends the lifespan of solid-state drives, and ensures data storage integrity and system stability.
Smart Images

Figure CN120950286A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer storage technology, and in particular to a method, apparatus, device, and medium for handling write errors in solid-state drive (SSD) garbage collection. Background Technology
[0002] With the emergence and widespread use of NAND (Non-volatile memory device) flash memory chips, solid-state drives (SSDs) based on NAND flash memory chips have become a hot topic in the storage field due to their higher reliability, better performance, and lower power consumption.
[0003] In solid-state drives (SSDs), garbage collection (GC) is one of the key technologies for maintaining their performance and lifespan. The garbage collection process can lead to write errors, causing data migration errors and impacting SSDs on multiple levels, including data reliability, performance, lifespan, and resource efficiency. Traditional methods often rely on RAID (Redundant Array of Independent Disks) recovery for data restoration, but this results in poor data reliability, increased write amplification, and ultimately, a shortened lifespan for the SSD. Summary of the Invention
[0004] This application provides a method, apparatus, device, and medium for handling write errors during solid-state drive garbage collection, in order to at least solve the problem of poor reliability in recovering write error data during garbage collection in related technologies.
[0005] This application provides a method for handling write errors during garbage collection in solid-state drives, including:
[0006] Detect write errors in solid-state drive garbage collection and identify the error type of the write error;
[0007] If the error type is temporary, the write operation command is resent and the write operation is rewritten; if the error type is permanent, the write error data is moved and the corresponding erroneous data block is marked as bad.
[0008] Dynamically adjust SSD resources based on marked bad blocks.
[0009] This application also provides a solid-state drive garbage collection write error handling device, including:
[0010] The garbage collection write error detection and classification module is used to detect garbage collection write errors on solid-state drives and identify the error type.
[0011] The garbage collection write error data processing module is used to resend the write operation command and rewrite the operation if the error type is temporary; and to move the write error data and mark the corresponding erroneous data block as bad if the error type is permanent.
[0012] The dynamic resource reallocation module is used to dynamically adjust solid-state drive resources based on marked bad blocks.
[0013] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the above-described solid-state drive garbage collection write error handling methods when executing the computer program.
[0014] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of any of the above-described solid-state drive garbage collection write error handling methods.
[0015] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described solid-state drive garbage collection write error handling methods.
[0016] This application addresses the problem of poor reliability in recovering write errors during garbage collection by classifying them through voltage detection and performing differentiated operations based on the error type. When a write error is permanent, it migrates the data that was written incorrectly during garbage collection and marks it in the bad block table. Through dynamic resource reallocation, it dynamically adjusts the spare pool space and redundant space of data blocks in the solid-state drive. Therefore, it solves the technical problem of poor reliability in recovering write error data during garbage collection in related technologies, and achieves the technical effect of significantly improving the reliability of recovering write error data during garbage collection and extending the life of the solid-state drive. Attached Figure Description
[0017] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart illustrating a solid-state drive garbage collection write error handling method provided in this application embodiment;
[0019] Figure 2 A flowchart illustrating another solid-state drive garbage collection write error handling method provided in this application embodiment;
[0020] Figure 3A flowchart illustrating another solid-state drive garbage collection write error handling method provided in this application embodiment;
[0021] Figure 4 A flowchart illustrating another solid-state drive garbage collection write error handling method provided in this application embodiment;
[0022] Figure 5 This is a schematic diagram of a solid-state drive garbage collection write error handling device provided in an embodiment of this application;
[0023] Figure 6 A structural block diagram of another solid-state drive garbage collection write error handling device provided in the embodiments of this application;
[0024] Figure 7 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0026] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0027] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] The specific application environment architecture or specific hardware architecture on which the solid-state drive garbage collection write error handling method depends is described here.
[0029] Solid State Drives (SSDs) consist of storage units made of NAND flash memory, which has the characteristic that it must be filled with data before it can be erased. This means that whenever an SSD performs a write operation, some valid old data may need to be migrated and erased to free up space; this process is called garbage collection.
[0030] Solid-state drives (SSDs) also include an interaction backend and a flash translation layer (FTL). The interaction backend is a hardware or firmware module that directly interacts with the NAND flash memory, primarily handling low-level operations such as data writing, reading, and erasing. After completing a garbage collection (GC) write operation, it sends a write completion message to the FTL. The operation of adding the actual write voltage and the number of write attempts (retry_cnt) to the message structure is performed by this backend module that directly interacts with the NAND flash memory. The flash translation layer (FTL) translates the logical address (LBA) sent by the host into the physical block address (pba) of the NAND flash memory, while also managing low-level operations such as garbage collection and bad block handling, thus coordinating the data interaction between the host and the NAND flash memory.
[0031] Solid-state drives (SSDs) also include a dynamic buffer (DRAM buffer) and a static buffer (SRAM buffer). The dynamic buffer, implemented using DRAM chips, has a large storage capacity and can temporarily store large amounts of data. During garbage collection (GC) write operations, when the data resource corresponding to an erroneous write message is stored here, the system will first perform a suspension operation to protect the erroneous data from corruption and avoid data loss. The static buffer is composed of SRAM chips, characterized by fast access speed but relatively small storage capacity. Due to the limited storage resources of the SRAM buffer, when a GC write operation fails and the corresponding data resource is stored here, to avoid prolonged occupation and blocking of resources that could affect SSD performance, the source PBA (Physical Block Address) is recorded, the write message is suspended, and the relevant resources are released. The PBA is used to identify the address of the physical block location in the NAND flash memory.
[0032] The embodiments of this application provide a method for handling write errors in solid-state drive (SSD) garbage collection. The method is described in detail below, taking into account the execution flow of the SSD garbage collection write error handling method.
[0033] This embodiment provides a method for handling write errors during garbage collection in a solid-state drive (SSD), which can be used in the aforementioned SSD. The SSD also includes functional modules, such as... Figure 5 As shown, these are the GC write error type detection unit, GC write error handling type classification unit, GC write error handling data migration unit, and dynamic resource reallocation unit, respectively. Figure 1 This is a flowchart of a solid-state drive garbage collection write error handling method according to an embodiment of this application, such as... Figure 1 As shown, the process includes the following steps:
[0034] Step S101: Detect write errors in solid-state drive garbage collection and identify the error type of the write error.
[0035] Specifically, a garbage collection write error, or GC write error, refers to an error that occurs during data write operations in the process of garbage collection on an SSD.
[0036] This embodiment uses a GC write error type detection unit to detect solid-state drive (SSD) write errors via SSD voltage detection, and a GC write error handling type classification unit to classify and identify the error type. Error types include write failures caused by short-term, non-persistent factors, which are recoverable (i.e., temporary errors); and write failures caused by long-term, persistent factors, which are not recoverable (i.e., permanent errors).
[0037] In step S102, if the error type is a temporary error, the write operation instruction is resent and the write operation is rewritten; if the error type is a permanent error, the write error data is moved and the corresponding erroneous data block is marked as a bad block.
[0038] Specifically, based on the content recorded in step S101 above, when the error type is a temporary error, a retry is performed to rewrite. Here, retry refers to the process of resending the write operation instruction to rewrite when a GC write error is detected as a temporary error.
[0039] When the error type is permanent and not recoverable, the GC write error handling data migration unit performs write error data migration and marks the corresponding erroneous data block as a bad block. Data migration refers to the process of transferring valid data from the erroneous data block to a new data block when a GC write error is determined to be permanent; this is a critical operation for ensuring data security.
[0040] Step S103: Dynamically adjust the solid-state drive resources based on the marked bad blocks.
[0041] Specifically, in order to address the negative impact of bad blocks on the performance, reliability, and lifespan of the storage system, resources are flexibly allocated to maintain the stable and efficient operation of SSDs.
[0042] Solid-state drive resources include data block spare pool space and redundant space (over-provisioning, or OP for short).
[0043] The dynamic resource reallocation unit dynamically adjusts the data block spare pool space and redundancy space based on the marked bad blocks.
[0044] From a reliability perspective, the appearance of bad blocks means that the corresponding data block can no longer complete the data writing or storage normally. If resources are not adjusted in time, the risk of data write failure will increase. By dynamically adjusting the size of the data block spare pool, it can be ensured that there are enough spare data blocks to replace bad blocks, avoiding the inability to migrate data due to insufficient spare blocks, and thus preventing data loss.
[0045] From a performance optimization perspective, bad blocks affect the read and write efficiency and write amplification effect of SSDs. The dynamic adjustment of OP (Opportunity Utility) is related to the target write amplification value. When the number of bad blocks increases, adjusting OP can balance write amplification and reduce the performance loss caused by frequent garbage collection and data migration.
[0046] As SSDs are used for longer periods, the number of bad blocks will gradually increase (affected by factors such as the number of programming / erase cycles and the number of erase cycles). Dynamically adjusting resources allows the SSD's storage management strategy to adapt dynamically to the bad block status, extending its overall lifespan.
[0047] The solid-state drive (SSD) garbage collection write error handling method provided in this embodiment accurately detects garbage collection write errors and identifies the error type. Differentiated handling strategies are adopted for different error types, such as resending write operation commands and rewriting operations, or performing data migration and bad block marking. This avoids data loss in faulty blocks, fundamentally reducing the risk of data corruption or loss, ensuring data storage integrity, and improving the reliability of data recovery. Dynamic resource adjustment based on marked bad blocks allows for flexible allocation of storage resources according to the number and distribution of bad blocks, reducing reliance on aging or damaged data blocks, effectively slowing down the performance degradation rate of NAND flash memory, extending the overall lifespan of the SSD, and solving the problem of poor reliability in data recovery from write errors during garbage collection in related technologies.
[0048] This embodiment provides a method for handling write errors during garbage collection in a solid-state drive (SSD), which can be used in the aforementioned SSD. Figure 2This is a flowchart of a solid-state drive garbage collection write error handling method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0049] Step S201: Detect solid-state drive garbage collection write errors and identify the error type of the write error.
[0050] Specifically, the actual write voltage V is increased within the message structure. actual The write attempt count (retry_cnt) is used to calculate and distinguish between temporary and permanent write errors based on relevant formulas.
[0051] Solid-state drives include an interactive backend and a flash memory conversion layer; step S201 above includes:
[0052] Step S2011: When the interactive backend completes the garbage collection write operation, it returns the write operation completion message to the flash conversion layer to obtain the message structure.
[0053] Specifically, a message structure is a standardized data structure used when transmitting information between modules within an SSD (such as the interactive backend storage module and the FTL). It is used to encapsulate various key information related to write operations. For example, a message structure is obtained when the interactive backend completes a GC write operation and returns a write completion message to the flash translation layer (FTL).
[0054] Step S2012: Add the actual write voltage and the number of write attempts to the message structure, and calculate the fluctuation voltage value based on the actual write voltage, the standard voltage value, and the preset amplification factor.
[0055] Specifically, the message structure at this time includes the following key fields:
[0056] Basic status identifiers include the operation type (clearly a GC write operation), a unique identifier ID for the write operation (used for FTL matching the corresponding GC task), and the operation completion status (success / failure). If the status is failed, a preliminary error code will be attached (such as voltage anomaly, block state error, etc.) to provide basic information for subsequent error classification.
[0057] Physical address information: This includes the target physical block address (pba) corresponding to the data being written, as well as the source physical block address from which the data originated (if data migration is involved). This address information ensures that the FTL can accurately track the storage location of the data in the NAND flash memory, providing a basis for subsequent address mapping updates, data relocation, and other operations.
[0058] Voltage-related parameters include actual write voltage, standard voltage value, and fluctuating voltage value.
[0059] Write process parameters include the write attempt count `retry_cnt`, which records the number of times the backend retried the write operation due to temporary errors (such as instantaneous voltage fluctuations). A value of 0 indicates a successful write operation, while a value greater than 0 reflects the stability of the write process.
[0060] In one alternative implementation, the fluctuation voltage of the write operation is calculated using the following formula:
[0061]
[0062] Where ΔV represents the fluctuating voltage value, V actual This represents the actual write voltage, V. standard This indicates the standard voltage value for data writing (provided by the NAND flash memory manufacturer). This is the preset magnification factor; the formula for calculating the preset magnification factor is as follows:
[0063]
[0064] Among them, C pe Indicates the number of times a data block is erased, C wear This represents the guaranteed number of erase cycles for a data block; a higher PE count indicates a more aged data block. The larger the value, the larger the calculated voltage fluctuation value ΔV.
[0065] Step S2013: Detect write errors based on fluctuating voltage values, number of write attempts, and preset dynamic voltage thresholds, and identify the error type of the write error.
[0066] Specifically, when the fluctuating voltage value is less than the preset dynamic voltage threshold and the number of write attempts is less than the preset maximum number of retries, a write error is determined to have occurred, and the write error is marked as a temporary error; write errors other than temporary errors are marked as permanent errors.
[0067] After calculating the fluctuating voltage value, errors are classified according to the following formula:
[0068]
[0069] Among them, E type Indicates the error type, E temp Indicates a temporary error, E perm Indicates a permanent error, R max V represents the maximum number of retries (value 3 or 4). th This represents the dynamic voltage threshold, which increases with the number of PE cycles. Accelerated aging tests are conducted when C... pe =C wear The actual write voltage V was measured at this time. actualThe dynamic voltage threshold V is calculated using formula (1). th Here, PE count refers to the Program / Erase Cycle. The dynamic voltage threshold derivation logic is as follows:
[0070] The dynamic voltage threshold is the critical value for judging the error type, i.e., formula (3), and its dynamic nature is linked to the PE count through formula (1):
[0071] When the data block is brand new (low PE count), A smaller value results in a smaller ΔV and a lower dynamic voltage threshold (making it more sensitive to voltage fluctuations). When data blocks age (high PE cycles), A larger value results in a larger ΔV, and the dynamic voltage threshold increases accordingly (allowing for greater voltage fluctuations).
[0072] In SSDs, the PE count of each data block is first recorded in real time; when a GC write operation occurs, the PE count of the current block is read and substituted into formula (2) to calculate k; and standard voltage value V standard ΔV is calculated using formula (1) and used as the dynamic voltage threshold. The actual write voltage is compared with this threshold, and the error type (temporary error or permanent error) is determined by formula (3) in combination with the number of write attempts.
[0073] That is, the dynamic voltage threshold is not a fixed value, but is converted into a voltage tolerance index by formula (1) to transform the PE number (reflecting the aging degree of the block), thus realizing the dynamic adjustment logic that the older the data block, the greater the voltage fluctuation allowed.
[0074] In step S202, if the error type is a temporary error, the write operation instruction is resent and the write operation is rewritten; if the error type is a permanent error, the write error data is moved and the corresponding erroneous data block is marked as a bad block.
[0075] Specifically, the solid-state drive also includes a dynamic buffer (short for Dynamic Random Access Memory buffer, abbreviated as DRAM buffer) and a static buffer (short for Static Random Access Memory buffer, abbreviated as SRAM buffer). The specific locations of the buffers for write error storage will be described separately. Step S202 above includes:
[0076] Step S2021, when the error type is a permanent error and the data resource corresponding to the write error data is stored in the dynamic buffer, perform the write error data relocation and corresponding bad block marking operation, including:
[0077] Step a1 involves suspending the write error data and its corresponding dynamic buffer data resources, stopping the write operation of the current data block containing the write error data, and filling the current data block with invalid data.
[0078] Specifically, the write error data and the corresponding dynamic buffer data resources are suspended to protect the write error data from being corrupted.
[0079] Write operations to the current data block containing the erroneous data are disabled, and a dummy operation (filling with invalid data) is performed on the current data block. This involves writing pre-defined invalid data (such as all zeros or a specific identifier sequence) to unused free pages in the block and updating the block's metadata, marking these pages as occupied. The purpose of this operation is to prevent subsequent accidental operations (such as accidental erasure or accidental write) from corrupting the data already stored in the block, thus protecting the data already written to the current data block.
[0080] Step a2: Mark the current data block containing the erroneous data as a bad block and update the preset bad block table.
[0081] Specifically, the bad block table is a key data structure in an SSD that records the physical addresses (PBAs) of all bad blocks. It is typically stored in a fixed flash memory area and loaded into memory at boot time. During an update, the PBA of the currently erroneous data block is added to the bad block table, and its failure reason is marked (e.g., a GC write error is a permanent error). Subsequent block allocation, GC, and other operations will automatically skip the addresses in the bad block table.
[0082] Step a3: Obtain the new write operation data block, replace the source physical block address of the bad block with the physical block address on the new write operation data block, and send the write data operation to the physical block address on the new write operation data block.
[0083] Specifically, a data block in a normal state (not marked as a bad block, with a low PE count) is selected from the SSD's data block spare pool, and its physical block address (new PBA) is obtained. The data block spare pool is a resource reserved for bad block replacement, ensuring that a replacement block can be found quickly when a bad block occurs.
[0084] Modify the target address field in the original write message, replacing the PBA of the original erroneous data block with the new PBA, while keeping other fields such as data identifier and verification information unchanged. Add the modified write message back to the FTL message queue and send it to the backend storage controller according to the normal process, triggering the write operation on the new data block.
[0085] Step a4: If the write operation is successful, the data migration due to the write error is completed; if the write operation fails, the process of obtaining the new write operation data block and rewriting the data is repeated until the write operation is successful, and all data on the bad block is reclaimed.
[0086] Specifically, if the write operation of the new data block returns successfully (the data is confirmed to be completely written through the verification mechanism), the previously suspended DRAM buffer resources are released (unlocked and marked as available), and the mapping relationship between the logical block address (LBA) and the new pba is updated to complete the migration of data from the bad block to the new block. If writing the new block still fails (the new block may also have hidden problems), steps a3 and a4 are repeated: the next new data block is retrieved from the data block spare pool, the pba is replaced again, and the write message is resent. The number of retries is usually capped (e.g., consistent with the maximum number of retries in formula (3)) to avoid infinitely consuming resources.
[0087] For data blocks marked as bad, the backend controller reads the valid data already stored in them (excluding areas where dummy operations have been performed) and verifies data integrity through mechanisms such as error check codes.
[0088] The verified valid data is migrated to other normal data blocks, and the corresponding LBA mapping is updated. After the data migration is complete, the original bad blocks are erased (even if they become blank bad blocks) to prevent residual data from being misread or interfering with subsequent block management. Ultimately, this ensures that all valid data has been transferred, avoiding data loss due to bad block failure.
[0089] Through steps a1 to a4 above, we can maximize the protection of erroneous data, efficiently complete bad block replacement and data migration, and maintain the stability and data reliability of the SSD storage system.
[0090] Step S2022, when the error type is a permanent error and the data resource corresponding to the write error data is stored in the static buffer, perform the write error data relocation and corresponding bad block marking operation, including:
[0091] Step b1 involves recording the address of the source physical block in the current data block containing the erroneous data, performing a suspend operation, and releasing the written data and static buffer data resources.
[0092] Specifically, when a GC write error is detected and determined to be a permanent error, the source physical block address (source PBA) contained in the error write message is first extracted. This address points to the original physical location where the data was stored. The source PBA is temporarily stored in the FTL's dedicated cache or log as a key index for subsequent data rereads.
[0093] The write message is suspended, but unlike the DRAM buffer scenario, since the SRAM buffer capacity is usually much smaller than the DRAM buffer, long-term occupation will block the flow of SRAM buffer resources and affect the garbage collection performance of the SSD. The SRAM buffer space occupied by the write message needs to be released immediately by clearing the data in the buffer and marking the memory area as free, allowing other high-priority operations to reuse resources and avoiding the entire GC process from being stopped due to SRAM buffer blocking.
[0094] Step b2: Disable write operations on the current data block and perform an operation to fill the current data block with invalid data.
[0095] Specifically, this step is consistent with the same part of step a1 above, namely, disabling write operations on the current data block containing the erroneous data, and performing a dummy data filling operation on the current data block. This involves writing preset invalid data (such as all zeros or a specific identifier sequence) to unused free pages in the data block, updating the block's metadata, and marking these pages as occupied. The purpose of this operation is to prevent subsequent erroneous operations (such as accidental erasure or accidental writing) from corrupting the data already stored normally in the block, thus protecting the data already written to the current data block.
[0096] Step b3: Mark the current data block containing the erroneous data as a bad block and update the preset bad block table.
[0097] Specifically, the bad block table is a key data structure in an SSD that records the physical addresses (PBAs) of all bad blocks. It is typically stored in a fixed flash memory area and loaded into memory at boot time. During an update, the PBA of the currently erroneous data block is added to the bad block table, and its failure reason is marked (e.g., a GC write error is a permanent error). Subsequent block allocation, GC, and other operations will automatically skip the addresses in the bad block table.
[0098] Step b4: Obtain the new write operation data block, perform a write error reread operation based on the source physical block address of the bad block, configure the physical block address on the new write operation data block for the reread write error data, and send the write data operation to the physical block address on the new write operation data block.
[0099] Specifically, a data block in a normal state (not marked as a bad block, with a low PE count) is selected from the SSD's data block spare pool, and its physical block address (new PBA) is obtained. The data block spare pool is a resource reserved for bad block replacement, ensuring that a replacement block can be found quickly when a bad block occurs.
[0100] Modify the target address field in the original write message, replacing the PBA of the original erroneous data block with the new PBA, while keeping other fields such as data identifier and verification information unchanged. Add the modified write message back to the FTL message queue and send it to the backend storage controller according to the normal process, triggering the write operation for the new data block.
[0101] Step b5: If the write operation is successful, the data migration due to the write error is completed; if the write operation fails, the process of obtaining the new write operation data block and rewriting the data is repeated until the write operation is successful, and all data on the bad block is reclaimed.
[0102] Specifically, if the new data block is successfully written (data consistency is confirmed through verification), the mapping relationship between the logical address (LBA) and the new PBA is updated, the temporary information of the source PBA recorded in step b1 is deleted, and the data migration is completed. If writing the new data block still fails, the next candidate data block is immediately reallocated from the data block spare pool, and the reread and write process of steps b4 and b5 is repeated. The number of retries is limited by the spare block pool capacity and the system-set threshold (usually consistent with the maximum number of retries) to avoid resource waste.
[0103] For data blocks marked as bad, the backend controller reads the valid data already stored in them (excluding areas where dummy operations have been performed) and verifies data integrity through mechanisms such as error check codes.
[0104] The verified valid data is migrated to other normal data blocks, and the corresponding LBA mapping is updated. After the data migration is complete, the original bad blocks are erased (even if they become blank bad blocks) to prevent residual data from being misread or interfering with subsequent block management. Ultimately, this ensures that all valid data has been transferred, avoiding data loss due to bad block failure.
[0105] Given the limited nature of SRAM resources, a strategy of rapid release and subsequent reread balances resource efficiency and data reliability, making it particularly suitable for SSD garbage collection operations under high load scenarios.
[0106] Step S203: Dynamically adjust the solid-state drive resources based on the marked bad blocks. For details, please refer to [link to relevant documentation]. Figure 1 Step S103 of the illustrated embodiment will not be described again here.
[0107] The solid-state drive garbage collection write error handling method provided in this embodiment specifically addresses the core contradiction between dynamic and static buffers (dynamic: sufficient resources but need to protect data; static: scarce resources but need to efficiently process data). While ensuring zero data loss, it optimizes resource utilization and system response speed, ultimately achieving high reliability, high fault tolerance, and high performance maintenance capability of SSDs when facing permanent write errors.
[0108] This embodiment provides a method for handling write errors during garbage collection in a solid-state drive (SSD), which can be used in the aforementioned SSD. Figure 3 This is a flowchart of a solid-state drive garbage collection write error handling method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps:
[0109] Step S301: Detect write errors during solid-state drive garbage collection and identify the error type. For details, please refer to [link to relevant documentation]. Figure 2 Step S201 of the illustrated embodiment will not be described again here.
[0110] Step S302: If the error type is temporary, resend the write operation command and rewrite the data; if the error type is permanent, move the written error data and mark the corresponding corrupted data block as bad. For details, please refer to [link to relevant documentation]. Figure 2 Step S202 of the illustrated embodiment will not be described again here.
[0111] Step S303: Dynamically adjust the solid-state drive resources based on the marked bad blocks.
[0112] Specifically, solid-state drive resources include a data block spare pool and over-provisioning (OP). After bad blocks occur, the size of the data block spare pool and OP are dynamically adjusted to ensure SSD performance. Step S303 includes:
[0113] Step S3031: Obtain the capacity of bad blocks, and dynamically adjust the size of the data block spare pool based on the capacity of bad blocks, the weight of the preset capacity loss penalty item, the weight of the bad block shortage risk item, and the current size of the data block spare pool.
[0114] Specifically, the formula for dynamically adjusting the size of the data block spare pool is as follows:
[0115] S′=α*(SS min ) 2 +β*(SS bad ) 2 (4);
[0116] Where S′ represents the adjusted size of the data block spare pool, S represents the current size of the data block spare pool, and S min S represents the minimum capacity of the data block spare pool, determined by the lower limit of the redundancy space. bad Let α represent the capacity of bad blocks, β represent the weight of the capacity loss penalty term, and β represent the weight of the bad block shortage risk term. The weights of the capacity loss penalty term and the bad block shortage risk term are dynamically adjusted according to the application scenario, satisfying α + β = 1. The adjustment rules include:
[0117] (1) High write load scenario: It is necessary to prioritize reducing the risk of bad block shortage and increase the weight α of the capacity loss penalty term.
[0118] (2) Low write load scenario: Focus on maximizing user capacity and increase the weight β of bad block shortage risk item.
[0119] (3) Mixed load scenario: dynamically adjust according to the write rate. For example, when the write rate exceeds the threshold (e.g., 200MB / s), gradually increase the weight β of the bad block shortage risk item.
[0120] Step S3032: Obtain the redundancy space variables generated by bad blocks, and dynamically adjust the size of the redundancy space based on the redundancy space variables, the basic redundancy space, and the minimum redundancy space.
[0121] Specifically, the formula for dynamically adjusting the size of the redundant space is as follows:
[0122] OP′=max (OP base +△OP,OP min (5);
[0123] Where OP′ represents the dynamically adjusted redundancy space, OP base OP represents the basic redundancy space, △OP represents the redundancy space variable caused by bad blocks, and OP min Represents the minimum redundancy space OP. WA represents the target magnification value, where △OP is calculated using the following formula:
[0124]
[0125] Among them, S bad S represents the capacity of the bad block, and S represents the current data block spare pool size. user Indicates user capacity.
[0126] The solid-state drive garbage collection write error handling method provided in this embodiment solves the problem of insufficient or wasted resources when the number of bad blocks increases due to the design of quantifying the impact of bad blocks, dynamic weight adjustment, and scenario adaptation. It also finds a dynamic balance between performance, capacity, and lifespan, and ultimately achieves efficient, stable, and reliable operation of SSD throughout its entire life cycle.
[0127] Since each flash memory data block has a limited number of erase cycles, wear leveling algorithms can be used to adjust for the rapid damage of a few blocks due to frequent erases. These algorithms can be divided into dynamic and static types. Dynamic wear leveling prioritizes blocks with lower erase cycles during erase / write operations; static wear leveling moves data from blocks with lower erase cycles to blocks with higher erase cycles. Wear leveling ensures more even erase / write operations on flash memory blocks, reducing the likelihood of bad blocks due to excessive wear on individual blocks, which could lead to garbage collection errors.
[0128] 1. Dynamic Wear Leveling: During each write or erase operation, prioritize idle data blocks with low write / erase cycles (PE value) to avoid frequent use of the same batch of data blocks, which can lead to rapid aging.
[0129] 1. Block status tracking and priority sorting: Real-time PE count storage: Maintain a PE counter (record the number of erase / write operations) for each flash block, stored in the block's metadata area or a dedicated block management table, and automatically increment by 1 after each erase operation.
[0130] Free Block Priority Queue: The system maintains a queue of free blocks sorted in ascending order of PE value, with the block with the lowest PE value at the head of the queue (highest priority). When a block needs to be allocated for writing, it is directly retrieved from the head of the queue, ensuring that younger blocks (i.e., those with low PE values) are used first.
[0131] 2. Dynamic scheduling strategy:
[0132] Block selection during write operations: When writing user data or migrating GC data, if the target block is in an idle state, the block with the lowest PE value is selected directly from the priority queue; if the target block has been used (it needs to be erased first), the block with the lowest PE value is selected first to perform the erase-write process.
[0133] Hotspot data distribution: For frequently updated hotspot data (such as logs and temporary files), logical address mapping is used to dynamically allocate it to different physical blocks, avoiding concentrated writing to the same batch of blocks. For example, the target physical block is automatically switched after every N updates, distributing the PE value growth across multiple blocks.
[0134] 3. Threshold-triggered forced balancing: When a block's PE value is detected to exceed the system's set warning threshold (e.g., 70% of PE max), even if the block is still usable, it is moved from the active block pool to the restricted usage pool and used as a backup only when there are insufficient free blocks, thus forcibly reducing its usage frequency.
[0135] 2. Static Wear Leveling: For low PE data blocks containing static data (such as archived files) that have not been updated for a long time, actively migrate the data to high PE data blocks, release the low PE data blocks for new data to use, and avoid uneven distribution of overall PE data due to long-term idleness.
[0136] 1. Static data identification and monitoring:
[0137] Data activity marker: The last write time of each physical block is recorded through the FTL mapping table. Data that has not been updated for more than a preset threshold (such as 30 days) is marked as static data.
[0138] PE difference threshold trigger: When the system detects that the PE difference between low PE data blocks (static data) and high PE data blocks (idle or dynamic data) exceeds a threshold (e.g., 200 times), the static equalization process is triggered.
[0139] 2. Data migration execution:
[0140] Migration target selection: Prioritize the static data block with the lowest PE value as the source block, and the free block with the highest PE value as the target block (it needs to be erased first to further increase its PE value and narrow the overall gap).
[0141] Low-interference migration strategy: To avoid affecting normal I / O performance, static data migration is performed when the system load is below the threshold, migrating 1-2 data blocks at a time, and data verification is enabled during the migration process to ensure integrity.
[0142] Mapping table synchronization update: After the migration is completed, the mapping relationship from LBA to new PBA is updated immediately, and the original low PE data blocks are marked as free and added to the dynamic balancing priority queue for new data to be written.
[0143] The wear leveling algorithm described above optimizes the aging speed of flash memory data blocks from the source, providing a more stable physical basis for handling write errors during garbage collection, and indirectly improving the overall reliability of SSDs.
[0144] As one or more specific application embodiments of this application, combined with Figure 4 and Figure 5 This application provides a further detailed description of the solid-state drive garbage collection write error handling method provided, such as... Figure 4 As shown, the specific process is as follows:
[0145] Step S401, GC write error detection and classification, GC write error type classification is achieved through voltage detection.
[0146] Specifically, when the backend completes the GC write operation and returns a write completion message to the FTL, the actual write voltage V is increased within the message structure.actual The formula for calculating the voltage fluctuation of this write operation, along with the number of write attempts (retry_cnt), is as follows:
[0147]
[0148] Where ΔV represents the fluctuating voltage value, V actual This represents the actual write voltage, V. standard This indicates the standard voltage value for data writing (provided by the NAND flash memory manufacturer). This is the preset magnification factor; the formula for calculating the preset magnification factor is as follows:
[0149]
[0150] Among them, C pe Indicates the number of times a data block is erased, C wear This represents the guaranteed number of erase cycles for a data block; a higher PE count indicates a more aged data block. The larger the value, the larger the calculated voltage fluctuation value ΔV.
[0151] After calculating the fluctuating voltage value, errors are classified according to the following formula:
[0152]
[0153] Among them, E type Indicates the error type, E temp Indicates a temporary error, E perm Indicates a permanent error, R max V represents the maximum number of retries (value 3 or 4). th This represents the dynamic voltage threshold, which increases with the number of PE cycles. Accelerated aging tests are conducted when C... pe =C wear The actual write voltage V was measured at this time. actual The dynamic voltage threshold V is calculated using formula (1). th The PE count refers to the Program / Erase Cycle.
[0154] Step S402, GC write error handling, realizes the migration of GC write error data and bad block table marking.
[0155] Specifically, after the backend completes the GC write operation and returns a write completion message to the FTL displaying an error message, the error type is determined according to step S401, such as... Figure 5 As shown, if it is a temporary error, a retry will be performed to rewrite; if it is a permanent error, the following write error handling process will be initiated to perform the data migration process.
[0156] If the data resource corresponding to the erroneous write message is stored in the DRAM buffer, the data transfer process includes:
[0157] 1) Suspend the erroneous write message and its corresponding buffer data resources to protect the erroneous data from being corrupted.
[0158] 2) Disable writing to the current data block and perform a dummy operation on the data block to protect the data already written to the data block.
[0159] 3) Mark the erroneous data blocks as bad blocks and update the bad block table.
[0160] 4) Obtain the new write data block, replace the write pba in the write failure message with the pba on the new data block, and send the write message.
[0161] 5) If the write operation is successful, the data transfer is complete; if the write operation fails, repeat steps 4) and 5).
[0162] 6) Perform recycling on all data in the erroneous data block to prevent data loss.
[0163] If the data resource corresponding to the erroneous write message is stored in the SRAM buffer, the data migration process includes:
[0164] 1> Record the source PBA in the error write message and then perform a suspension operation to release the write message and buffer resources. Because SRAM buffer resources are limited, long-term occupation will block the flow of SRAM buffer resources and affect the garbage collection performance of SSD.
[0165] 2> Stop writing to the current data block and perform a dummy operation on the data block to protect the data that has been written to the data block;
[0166] 3> Mark erroneous data blocks as bad blocks and update the bad block table;
[0167] 4> Obtain the new write data block, perform a reread based on the source PBA in the error message, configure the PBA on the new data block for the reread data, and send a new write message;
[0168] 5> If the write operation is successful, the data transfer is complete; if the write operation fails, repeat steps 4> and 5>.
[0169] 6> Perform recycling on all data in the erroneous data block to prevent data loss.
[0170] Step S403: Dynamic resource reallocation, realizing dynamic adjustment of data block spare pool space and OP.
[0171] Specifically, the formula for dynamically adjusting the size of the data block spare pool is as follows:
[0172] S′=α*(SS min ) 2 +β*(SS bad ) 2 (4);
[0173] Where S′ represents the adjusted size of the data block spare pool, S represents the current size of the data block spare pool, and S min S represents the minimum capacity of the data block spare pool, determined by the lower limit of the redundancy space. bad Let α represent the capacity of bad blocks, β represent the weight of the capacity loss penalty term, and β represent the weight of the bad block shortage risk term. The weights of the capacity loss penalty term and the bad block shortage risk term are dynamically adjusted according to the application scenario, satisfying α + β = 1. The adjustment rules include:
[0174] (1) High write load scenario: It is necessary to prioritize reducing the risk of bad block shortage and increase the weight α of the capacity loss penalty term.
[0175] (2) Low write load scenario: Focus on maximizing user capacity and increase the weight β of bad block shortage risk item.
[0176] (3) Mixed load scenario: dynamically adjust according to the write rate. For example, when the write rate exceeds the threshold (e.g., 200MB / s), gradually increase the weight β of the bad block shortage risk item.
[0177] The formula for dynamically adjusting the size of the redundant space is as follows:
[0178] OP′=max (OP base + △OP,OP min (5);
[0179] Where OP′ represents the dynamically adjusted redundancy space, OP base OP represents the basic redundancy space, △OP represents the redundancy space variable caused by bad blocks, and OP min Represents the minimum redundancy space OP. WA represents the target magnification value, where △OP is calculated using the following formula:
[0180]
[0181] Among them, S bad S represents the capacity of the bad block, and S represents the current data block spare pool size. user Indicates user capacity.
[0182] The solid-state drive (SSD) garbage collection write error handling method provided in this application classifies garbage collection write errors by voltage detection and performs differentiated operations according to the error type. When the write error is a permanent error, it migrates the garbage collection write error data and marks the bad block table. Through dynamic resource reallocation, it dynamically adjusts the spare pool space and redundant space of data blocks in the SSD, which can significantly improve data reliability and extend the life of SSD. It is suitable for high-load scenarios such as enterprise-level storage and data centers.
[0183] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0184] Embodiments of this application also provide a solid-state drive garbage collection write error handling device, such as... Figure 6 As shown, the device includes:
[0185] The garbage collection write error detection and classification module 601 is used to detect garbage collection write errors on solid-state drives and identify the error type; including... Figure 5 The GC write error type detection unit and GC write error handling type classification unit are included.
[0186] The garbage collection write error data processing module 602 is used to resend the write operation command and rewrite the data if the error type is temporary; and to move the write error data and mark the corresponding bad block if the error type is permanent. Figure 5 The garbage collection write error handling and data migration unit in the middle.
[0187] Dynamic resource reallocation module 603 is used to dynamically adjust solid-state drive resources based on marked bad blocks; including Figure 5 The dynamic resource reallocation unit in the system.
[0188] In one optional implementation, the solid-state drive includes an interactive backend and a flash conversion layer; the garbage collection write error detection and classification module 601 includes:
[0189] The GC write error type detection unit is used to return a write operation completion message to the flash conversion layer when the interactive backend completes the garbage collection write operation, and obtain a message structure. The actual write voltage and the number of write attempts are added to the message structure, and the fluctuation voltage value is calculated based on the actual write voltage, the standard voltage value and the preset amplification factor. Write errors are detected based on the fluctuation voltage value, the number of write attempts and the preset dynamic voltage threshold.
[0190] The GC write error handling type classification unit identifies the type of write error.
[0191] In one alternative implementation, the formula for calculating the fluctuation voltage value is as follows:
[0192]
[0193] Where ΔV represents the fluctuating voltage value, V actual This represents the actual write voltage, V. standard This indicates the standard voltage value for data writing. This is the preset magnification factor; the formula for calculating the preset magnification factor is as follows:
[0194]
[0195] Among them, C pe Indicates the number of times a data block is erased, C wear This represents the guaranteed number of erase cycles for a data block.
[0196] In one alternative implementation, the GC write error handling type classification unit includes:
[0197] The GC write error handling type classification subunit is used to determine that a write error has occurred when the fluctuating voltage value is less than the preset dynamic voltage threshold and the number of write attempts is less than the preset maximum error, and to mark the write error as a temporary error; write errors other than temporary errors are marked as permanent errors.
[0198] In one alternative implementation, the solid-state drive further includes a dynamic buffer and a static buffer; the garbage collection write error data processing module 602 includes:
[0199] The first GC write error handling data migration unit is used to perform write error data migration and corresponding bad block marking operations when the error type is a permanent error and the data resource corresponding to the write error data is stored in a dynamic buffer. This includes: suspending the write error data and the corresponding dynamic buffer data resource, stopping the write operation on the current data block where the write error data is located, and filling the current data block with invalid data; marking the current data block where the write error data is located as a bad block and updating the preset bad block table; obtaining a new write operation data block, replacing the source physical block address of the bad block with the physical block address on the new write operation data block, and sending a write data operation to the physical block address on the new write operation data block; if the write is successful, the write error data migration is completed; if the write fails, the process of obtaining a new write operation data block and rewriting the data is repeated until the write is successful, and all data on the bad block is reclaimed.
[0200] The second GC write error handling data migration unit is used to perform write error data migration and corresponding bad block marking operations when the error type is permanent and the data resources corresponding to the write error data are stored in the static buffer. This includes: recording the source physical block address in the current data block containing the write error data, performing a suspension operation, and releasing the written data and static buffer data resources; disabling the write operation of the current data block and performing an invalid data filling operation on the current data block; marking the current data block containing the write error data as a bad block and updating the preset bad block table; obtaining a new write operation data block, performing a write error reread operation based on the source physical block address of the bad block, configuring the physical block address on the new write operation data block for the reread write error data, and sending the write data operation to the physical block address on the new write operation data block; if the write is successful, the write error data migration is completed; if the write fails, the process of obtaining a new write operation data block and rewriting the data is repeated until the write is successful, and all data on the bad block is reclaimed.
[0201] In one alternative implementation, the dynamic resource reallocation module 603 includes:
[0202] The first dynamic resource reallocation unit is used to obtain the capacity of bad blocks and dynamically adjust the size of the data block spare pool based on the capacity of bad blocks, the weight of the preset capacity loss penalty item, the weight of the bad block shortage risk item, and the current size of the data block spare pool.
[0203] The second dynamic resource reallocation unit is used to obtain the redundancy space variables generated by bad blocks, and dynamically adjust the size of the redundancy space based on the redundancy space variables, the basic redundancy space, and the minimum redundancy space.
[0204] In one alternative implementation, the formula for dynamically adjusting the size of the data block spare pool is as follows:
[0205] S′=α*(SS min ) 2 +β*(SS bad ) 2 ;
[0206] Where S′ represents the adjusted size of the data block spare pool, S represents the current size of the data block spare pool, and S min S represents the minimum capacity of the data block spare pool, determined by the lower limit of the redundancy space. badThe capacity of bad blocks is represented by α, the weight of the capacity loss penalty term is represented by β, and the weight of the bad block shortage risk term is represented by β. The weights of the capacity loss penalty term and the bad block shortage risk term are dynamically adjusted according to the application scenario, and α+β=1 is satisfied. The adjustment rules include: increasing the weight of the bad block shortage risk term in high write load scenarios; increasing the weight of the capacity loss penalty term in low write load scenarios; and dynamically adjusting according to the write rate in mixed write load scenarios of high and low write.
[0207] In one alternative implementation, the formula for dynamically adjusting the size of the redundant space is as follows:
[0208] OP′=max(OP base +△OP,OP min );
[0209] Where OP′ represents the dynamically adjusted redundancy space, OP base OP represents the basic redundancy space, △OP represents the redundancy space variable caused by bad blocks, and OP min Represents the minimum redundancy space. WA represents the target magnification value, where △OP is calculated using the following formula:
[0210]
[0211] Among them, S user Indicates user capacity.
[0212] For a description of the features in the embodiment of the solid-state drive garbage collection write error handling device, please refer to the relevant description of the embodiment of the solid-state drive garbage collection write error handling method, which will not be repeated here.
[0213] Embodiments of this application also provide an electronic device, such as... Figure 7 As shown, the device includes a memory 10 and a processor 20. The memory 10 stores a computer program, and the processor 20 is configured to run the computer program to perform the steps in any of the above embodiments of the solid-state drive garbage collection write error handling method. The electronic device also includes a communication interface 30 for communicating with other devices or communication networks.
[0214] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above embodiments of the solid-state drive garbage collection write error handling method.
[0215] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0216] The embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the solid-state drive garbage collection write error handling method.
[0217] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above embodiments of the solid-state drive garbage collection write error handling method.
[0218] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0219] The foregoing has provided a detailed description of a solid-state drive (SSD) garbage collection write error handling method, apparatus, device, and medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A method for handling write errors during garbage collection in a solid-state drive, characterized in that, include: Detect write errors in solid-state drive garbage collection and identify the error type of the write error; If the error type is temporary, the write operation command is resent and the write operation is rewritten; if the error type is permanent, the write error data is moved and the corresponding erroneous data block is marked as bad. Dynamically adjust SSD resources based on marked bad blocks.
2. The solid-state drive garbage collection write error handling method according to claim 1, characterized in that, The solid-state drive includes an interactive backend and a flash conversion layer; The detection of solid-state drive garbage collection write errors and the identification of the error type of the write error include: When the interactive backend completes the garbage collection write operation, it returns a write operation completion message to the flash conversion layer to obtain a message structure; The actual write voltage and the number of write attempts are added to the message structure, and the fluctuation voltage value is calculated based on the actual write voltage, the standard voltage value, and the preset amplification factor. Write errors are detected based on the fluctuating voltage value, the number of write attempts, and the preset dynamic voltage threshold, and the error type of the write error is identified.
3. The solid-state drive garbage collection write error handling method according to claim 2, characterized in that, The formula for calculating the fluctuating voltage value is as follows: Where ΔV represents the fluctuating voltage value, V actual This represents the actual write voltage, V. standard This indicates the standard voltage value for data writing. This is the preset magnification factor; the formula for calculating the preset magnification factor is as follows: Among them, C pe Indicates the number of times a data block is erased, C wear This represents the guaranteed number of erase cycles for a data block.
4. The solid-state drive garbage collection write error handling method according to claim 2, characterized in that, The method of detecting write errors based on the fluctuating voltage value, the number of write attempts, and a preset dynamic voltage threshold, and identifying the error type of the write error, includes: When the fluctuating voltage value is less than the preset dynamic voltage threshold and the number of write attempts is less than the preset maximum error, a write error is determined to have occurred, and the write error is marked as a temporary error. Mark write errors other than temporary errors as permanent errors.
5. The solid-state drive garbage collection write error handling method according to claim 1, characterized in that, The solid-state drive also includes a dynamic buffer and a static buffer; When the error type is a permanent error and the data resource corresponding to the write error data is stored in the dynamic buffer, the step of performing write error data relocation and corresponding bad block marking operation includes: After suspending the write error data and the corresponding dynamic buffer data resources, the write operation of the current data block containing the write error data is stopped, and invalid data is filled into the current data block. Mark the current data block containing the data with the write error as a bad block and update the preset bad block table; Obtain the new write operation data block, replace the source physical block address of the bad block with the physical block address on the new write operation data block, and send the write data operation to the physical block address on the new write operation data block; If the write operation is successful, the data migration for write errors is completed; if the write operation fails, the process of obtaining the new write operation data block and rewriting the data is repeated until the write operation is successful, and all data on the bad blocks is reclaimed. When the error type is a permanent error and the data resource corresponding to the write error data is stored in the static buffer, the step of performing write error data relocation and corresponding bad block marking operation includes: After recording the address of the source physical block in the current data block where the erroneous data was written, a suspension operation is performed, and the written data and static buffer data resources are released. Disable write operations on the current data block and perform an operation to fill the current data block with invalid data; Mark the current data block containing the data with the write error as a bad block and update the preset bad block table; Obtain the new write operation data block, perform a write error reread operation based on the source physical block address of the bad block, configure the physical block address on the new write operation data block for the reread write error data, and send the write data operation to the physical block address on the new write operation data block; If the write operation is successful, the data migration for write errors is completed; if the write operation fails, the process of obtaining the new write operation data block and rewriting the data is repeated until the write operation is successful, and all data on the bad blocks is reclaimed.
6. The solid-state drive garbage collection write error handling method according to claim 1, characterized in that, The solid-state drive resources include a data block spare pool and redundant space; The dynamic adjustment of solid-state drive resources based on the marker-based bad block identification includes: Obtain the capacity of bad blocks, and dynamically adjust the size of the data block spare pool based on the capacity of bad blocks, the weight of the preset capacity loss penalty item, the weight of the bad block shortage risk item, and the current size of the data block spare pool; Obtain the redundancy space variables generated by bad blocks, and dynamically adjust the size of the redundancy space based on the redundancy space variables, the basic redundancy space, and the minimum redundancy space.
7. The solid-state drive garbage collection write error handling method according to claim 6, characterized in that, The formula for dynamically adjusting the size of the data block spare pool is as follows: S′=α*(SS min ) 2 +β*(SS bad ) 2 ; Where S′ represents the adjusted size of the data block spare pool, S represents the current size of the data block spare pool, and S min S represents the minimum capacity of the data block spare pool, determined by the lower limit of the redundancy space. bad The capacity of bad blocks is represented by α, the weight of the capacity loss penalty term is represented by β, and the weight of the bad block shortage risk term is represented by β. The weights of the capacity loss penalty term and the bad block shortage risk term are dynamically adjusted according to the application scenario, and α+β=1 is satisfied. The adjustment rules include: increasing the weight of the bad block shortage risk term in high write load scenarios; increasing the weight of the capacity loss penalty term in low write load scenarios; and dynamically adjusting according to the write rate in mixed write load scenarios of high and low write.
8. The solid-state drive garbage collection write error handling method according to claim 6, characterized in that, The formula for dynamically adjusting the size of the redundant space is as follows: OP′=max(OP base +△OP,OP min ); Where OP′ represents the dynamically adjusted redundancy space, OP base OP represents the basic redundancy space, △OP represents the redundancy space variable caused by bad blocks, and OP min Represents the minimum redundancy space. WA represents the target magnification value, where △OP is calculated using the following formula: Among them, S user Indicates user capacity.
9. A solid-state drive garbage collection write error handling device, characterized in that, include: The garbage collection write error detection and classification module is used to detect garbage collection write errors on solid-state drives and identify the error type of the write error; The garbage collection write error data processing module is used to resend the write operation command and rewrite the operation if the error type is temporary; and to move the write error data and mark the corresponding erroneous data block as bad if the error type is permanent. The dynamic resource reallocation module is used to dynamically adjust solid-state drive resources based on marked bad blocks.
10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the solid-state drive garbage collection write error handling method as described in any one of claims 1 to 8 when executing the computer program.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the steps of the solid-state drive garbage collection write error handling method as described in any one of claims 1 to 8.