Storage block replacement method and apparatus based on solid state drive

By determining the number of erases of the failed storage block in the solid-state drive and selecting the appropriate candidate storage block to replace it, the problem of early failure of the candidate storage block is solved, and the overall performance and resource utilization efficiency of the storage block are improved.

WO2025180322A1PCT designated stage Publication Date: 2025-09-04BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/078784
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-02-29
Filing Date
2025-02-24
Publication Date
2025-09-04

AI Technical Summary

Technical Problem

In the prior art, after the randomly selected candidate memory block is replaced in the solid state hard disk, although it is operating normally in the early stage, it causes early failure due to the gap between the number of erases and other super blocks, affecting the performance of the hard disk.

Method used

By obtaining the number of erases of the failed memory block, determining the erases range, and selecting candidate memory blocks that meet the range from the preset replacement pool for replacement, balancing resource utilization and avoiding premature failure of the candidate memory block.

Benefits of technology

It improves the overall performance and efficiency of storage blocks, extends the service life of storage resources, reduces the risk of data loss, and optimizes the balance of resource usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025078784_04092025_PF_FP_ABST
    Figure CN2025078784_04092025_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of hard disks. Disclosed are a storage block replacement method and apparatus based on a solid state drive. The method comprises: acquiring a faulty storage block from a super block in a solid state drive, and determining a target plane where the faulty storage block is located and a first erasure count corresponding to the faulty storage block; determining an erasure count range by using the first erasure count; determining a target plane to which a target storage block belongs, and determining, from a preset replacement pool, candidate storage blocks located on the target plane; and searching the candidate storage blocks for the target storage block that satisfies the erasure count range, and replacing the faulty storage block with the target storage block.
Need to check novelty before this filing date? Find Prior Art

Description

A method and device for replacing storage blocks based on solid-state hard disk

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to Chinese patent application No. 202410231975.9, filed on February 29, 2024, entitled “A method and device for replacing storage blocks based on solid-state hard drives”. The entire contents of that application are incorporated herein by reference. Technical Field

[0003] The present disclosure relates to the technical field of hard disks, and in particular to a method and device for replacing a storage block based on a solid-state hard disk. Background Art

[0004] Currently, for super blocks that fail in solid-state drives, the main method is to replace them with super blocks in the same location. When a super block fails, there are two candidate storage blocks in the replacement pool in the same storage unit (die) and the same plane (plane). Any one of the two candidate storage blocks is selected to replace the failed super block. Summary of the Invention

[0005] The embodiments of the present disclosure provide a method and apparatus for replacing a storage block based on a solid-state drive.

[0006] In a first aspect, an embodiment of the present disclosure provides a method for replacing a storage block based on a solid-state drive, the method comprising:

[0007] Obtaining a faulty storage block in a super block of a solid-state drive, and determining a target plane where the faulty storage block is located and a first erase count corresponding to the faulty storage block, wherein the solid-state drive includes a plurality of storage units, each storage unit includes a plurality of planes, each plane includes a plurality of storage blocks, and the super block includes a first storage block in each plane;

[0008] An erasure number range determined by using the first erasure number;

[0009] Determining a target plane to which the target storage block belongs, and determining a candidate storage block located in the target plane from a preset replacement pool, wherein the preset replacement pool includes a second storage block in each plane, and the second storage block is a storage block in the plane other than the first storage block;

[0010] A target storage block that meets the erasure count range is searched from the candidate storage blocks, and the faulty storage block is replaced by the target storage block.

[0011] The disclosed embodiment can identify storage blocks that may have problems by obtaining faulty storage blocks in a superblock and determining their corresponding first erase counts. Then, by determining the first erase count and the erase count range, the erase count range is used to balance resource utilization and effectively prevent candidate storage blocks from prematurely failing after a certain period of operation. Furthermore, the target plane to which the target storage block belongs is determined, candidate storage blocks for the target plane are identified from a preset replacement pool, and storage blocks that meet the erase count range are selected for replacement. This allows for more rational utilization of available storage resources, balances the use of various storage blocks, and improves the overall performance and efficiency of the storage blocks.

[0012] In a second aspect, an embodiment of the present disclosure provides a storage block replacement device based on a solid-state drive, the device comprising:

[0013] an acquisition module, configured to acquire a faulty storage block in a super block in a solid-state drive, and determine a target plane where the faulty storage block is located and a first erase count corresponding to the faulty storage block, wherein the solid-state drive includes a plurality of storage units, each storage unit includes a plurality of planes, each plane includes a plurality of storage blocks, and the super block includes the first storage block in each plane;

[0014] a determination module, configured to determine a range of erasure times using the first erasure times;

[0015] a search module, configured to determine a target plane to which the target storage block belongs, and determine a candidate storage block located in the target plane from a preset replacement pool, wherein the preset replacement pool includes a second storage block in each plane, and the second storage block is a storage block in the plane other than the first storage block;

[0016] A replacement module is configured to search for a target storage block that meets the erasure count range from the candidate storage blocks, and replace the faulty storage block with the target storage block.

[0017] In a third aspect, an embodiment of the present disclosure provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, computer instructions stored in the memory, and the processor executing the method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0018] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] FIG1 is a schematic structural diagram of a storage unit according to some embodiments of the present disclosure;

[0021] FIG2 is a schematic diagram of a super block according to some embodiments of the present disclosure;

[0022] FIG3 is a schematic diagram of bad block replacement according to some embodiments of the present disclosure;

[0023] FIG4 is a flow chart of a method for replacing a storage block based on a solid-state drive according to some embodiments of the present disclosure;

[0024] FIG5 is a schematic diagram of a replacement pool according to some embodiments of the present disclosure;

[0025] FIG6 is a flow chart of a method for replacing a storage block based on a solid-state drive according to some embodiments of the present disclosure;

[0026] FIG7 is a schematic diagram of searching a target storage block according to some embodiments of the present disclosure;

[0027] FIG8 is a schematic diagram of searching a target storage block according to some embodiments of the present disclosure;

[0028] FIG9 is a structural block diagram of a storage block replacement device based on a solid state drive according to an embodiment of the present disclosure;

[0029] FIG10 is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0031] To make the purpose, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present disclosure.

[0032] Currently, when a superblock fails in a solid-state drive, it is replaced with a superblock at the same location. When a superblock fails, there are two candidate storage blocks in the replacement pool on the same storage unit (die) and the same plane (plane). One of the two candidate storage blocks is selected to replace the failed superblock. However, if the erase count of the selected candidate storage block is much greater than the erase count of the failed superblock, although the randomly selected candidate storage block can operate normally in the early stages, after a certain operating time, the discrepancy between its corresponding erase count and the erase count of other superblocks will cause the candidate storage block to fail earlier, ultimately affecting the performance of the solid-state drive.

[0033] In view of this, the embodiments of the present disclosure provide a storage block replacement method and device based on a solid-state hard drive to solve the problem that a randomly selected candidate storage block can operate normally in the early stage, but after reaching a certain operating time, the candidate storage block will fail earlier due to the gap between its corresponding number of erase times and the number of erase times of other super blocks.

[0034] According to an embodiment of the present disclosure, a method and apparatus for replacing a storage block based on a solid-state drive are provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0035] The internal storage particles of a solid-state drive (SSD) are composed of memory cells (dies), each of which contains multiple blocks. To improve NAND concurrency, a memory cell has multiple planes, allowing parallel read and write operations on different planes. As shown in Figure 1, two blocks belonging to plane 0 and plane 1 can be written to simultaneously. However, if two blocks both belong to plane 0, they cannot be written to simultaneously.

[0036] To improve I / O concurrency, the SSD organizes each plane block of multiple storage cells (dies) into a logical superblock. As shown in Figure 2, a superblock is composed of eight blocks from four storage cells. However, NAND blocks have a certain failure rate, and some superblocks may fail during use. Depending on the design, some require replacement as soon as a single bad block fails, while others can tolerate more bad blocks before triggering a bad block replacement. Therefore, a replacement pool is provided for failed superblocks. The replacement pool consists of multiple blocks pre-reserved by the SSD.

[0037] As shown in Figure 3, if the number of erase times is not taken into account and a good block with a significantly higher EC=500 is used to replace the super block, although the super block can operate normally at the beginning, it will fail earlier in its life cycle because there is a significant gap between the candidate storage block and other storage blocks, thus affecting the use of the entire super block.

[0038] In this embodiment, a method for replacing a storage block based on a solid-state drive is provided, which can be used in the above-mentioned mobile terminal. FIG4 is a flow chart of a method for replacing a storage block based on a solid-state drive according to an embodiment of the present disclosure. As shown in FIG4 , the flow includes the following steps:

[0039] Step S101, obtain a faulty storage block in a super block in a solid-state drive, and determine a target plane where the faulty storage block is located and a first erase count corresponding to the faulty storage block, wherein the solid-state drive includes multiple storage units, each storage unit includes multiple planes, a plane includes multiple storage blocks, and the super block includes the first storage block in each plane.

[0040] In one embodiment of the present disclosure, the first storage block in each plane included in the super block is determined, and in each plane, the performance index of each first storage block is checked, and based on the index parameters of the performance index, it is determined whether the storage block has failed. The performance index includes:

[0041] Bad Block Marking: When a storage block fails, the system or firmware usually marks it as a bad block. By checking the marking status of a storage block, you can determine whether the storage block is identified as a bad block.

[0042] Read / Write Error Rate: A high read / write error rate may indicate a faulty storage block.

[0043] Data Integrity: Checks whether the data stored in a storage block is complete and correct. If the data in the storage block is incorrect or damaged, it indicates that the storage block may be faulty.

[0044] Performance Degradation: When a storage block fails, its performance typically degrades. By monitoring the read, write, or erase speed of a storage block, you can determine whether the block is faulty.

[0045] When a faulty memory block is found, the target plane where the faulty memory block is located is determined, and the first erasure count corresponding to the faulty memory block is determined.

[0046] Step S102: Determine an erasure number range using the first erasure number.

[0047] In one embodiment of the present disclosure, the erasure number range determined by using the first erasure number includes the following steps a1-a3:

[0048] Step a1: Obtain the preset erasure times.

[0049] In one embodiment of the present disclosure, obtaining a preset number of erasures includes: obtaining a priority corresponding to a faulty storage block, wherein the priority is determined based on the number of historical failures corresponding to the faulty storage block; and determining a preset number of erasures corresponding to a target priority based on a correspondence between the preset priority and the number of erasures.

[0050] Specifically, the faulty storage block's historical failure records are queried. The number of historical failures for the faulty storage block is counted from these historical failure records. This number of failures is then used to determine the target priority of the faulty storage block. Specifically, a storage block with a higher number of failures has a higher priority. A target priority is set for each storage block. This can be achieved by assigning a weight or rank to each storage block, for example, assigning a higher priority to storage blocks with a higher number of failures. High-priority storage blocks should be repaired or replaced before lower-priority storage blocks to ensure system stability and reliability. Then, based on the correspondence between preset priorities and erase counts, the preset erase count corresponding to the target priority is found.

[0051] Step a2: Calculate the sum of the first erasure times and the preset erasure times to obtain a target erasure times.

[0052] In one embodiment of the present disclosure, in order to obtain a suitable candidate storage block, it is necessary to calculate the first erasure count (denoted as EC sb ) and the preset erase count (recorded as EC above ) and the value between them (EC sb +EC above ), and use this as the target erasure count. For example, if the erasure count of the faulty storage block is 100, the target erasure count is 120.

[0053] Step a3: constructing an erasure number range based on a preset value and a target erasure number, wherein the preset value is a lower limit of the erasure number range, and the target erasure number is an upper limit of the erasure number range.

[0054] In one embodiment of the present disclosure, the preset value may be 0, and the erasure times range is [0, EC sb +EC above ].

[0055] It should be noted that setting a larger range can provide a certain degree of flexibility, so that there are more options when replacing blocks. sb , that is, only considering the replacement blocks that are the same as the current faulty storage block, there may be a situation where the replacement blocks are insufficient or it is difficult to find a suitable replacement block. By increasing EC above The value range will be wider, and replacement blocks with slightly higher erase counts than the current bad blocks can be considered, which improves the flexibility and feasibility of replacement.

[0056] In addition, if the replacement is limited to EC sb , which may result in frequent replacement of bad blocks, especially in EC sb When the value is small or fluctuates significantly, expanding the replacement range (by increasing the ECabove value) can reduce the frequency of bad block replacements, thereby alleviating pressure on storage resources. This also ensures a more even distribution of replacement blocks, avoiding imbalanced resource utilization.

[0057] Step S103, determine the target plane to which the target storage block belongs, and determine the candidate storage block located in the target plane from a preset replacement pool, wherein the preset replacement pool includes the second storage block in each plane, and the second storage block is the storage block in the plane except the first storage block.

[0058] In one embodiment of the present disclosure, the target storage block's storage unit is first determined based on the SSD's spatial structure. Then, based on the target storage unit's location and structure, the target plane to which it belongs is determined. Because the preset replacement pool stores the second storage block in each plane, the second storage block is the storage block in that plane other than the first storage block, i.e., the memory block that does not belong to the super block. Therefore, the second storage block included in the target plane is selected from the preset replacement pool as a candidate storage block.

[0059] Step S104 , searching for a target storage block that meets the erasure count range from the candidate storage blocks, and using the target storage block to replace the faulty storage block.

[0060] In one embodiment of the present disclosure, the number of erase times (EC value) of a candidate storage block is obtained and checked to see if it is within a target range. If the number of erase times is within the range, the candidate storage block meets the conditions. For target storage blocks that meet the conditions, further evaluation is performed. The evaluation indicators may include the reliability, performance, capacity, etc. of the storage block, and are compared with the faulty storage block. Based on the evaluation results, the best target storage block is selected as the replacement object. The target storage block can be determined according to a preset replacement strategy or algorithm, such as a priority based on the number of erase times, or based on a trade-off of other indicators. Ultimately, the selected target storage block is used as the replacement block, and the faulty storage block is replaced with the target storage block.

[0061] The disclosed embodiment can identify storage blocks that may have problems by obtaining faulty storage blocks in a superblock and determining their corresponding first erase counts. Then, by determining the first erase count and the erase count range, the erase count range is used to balance resource utilization and effectively prevent candidate storage blocks from prematurely failing after a certain period of operation. Furthermore, the target plane to which the target storage block belongs is determined, candidate storage blocks for the target plane are identified from a preset replacement pool, and storage blocks that meet the erase count range are selected for replacement. This allows for more rational utilization of available storage resources, balances the use of various storage blocks, and improves the overall performance and efficiency of the storage blocks.

[0062] FIG6 is a flow chart of a method for replacing a storage block based on a solid-state drive according to an embodiment of the present disclosure. As shown in FIG6 , the process includes the following steps:

[0063] Step S201: Obtain a faulty storage block in a superblock of the solid-state drive, and determine the target plane where the faulty storage block is located and the first erase count corresponding to the faulty storage block. The solid-state drive includes multiple storage units, each storage unit includes multiple planes, each plane includes multiple storage blocks, and the superblock includes the first storage block in each plane. For details, refer to step S101 in the above embodiment and will not be repeated here.

[0064] Step S202: Determine the erasure number range using the first erasure number. Detailed information is provided in step S102 of the above embodiment, which will not be described in detail here.

[0065] In one embodiment of the present disclosure, the method also includes: detecting the solid-state hard drive to obtain the current operating parameters of each disk of the solid-state hard drive; obtaining the weight values ​​corresponding to the disk operating parameters; performing weighted calculation based on each disk operating parameter and the weight values ​​corresponding to the disk operating parameters to obtain a calculation result; and using the calculation result to update the range of erase times.

[0066] Specifically, use the appropriate SSD testing tool or API to obtain the SSD's current operating parameters, such as the number of erase cycles, remaining lifespan, and read error rate. These parameters provide information about the SSD's operating status. To perform a weighted calculation for different operating parameters, assign a corresponding weight to each parameter. The weight reflects the importance of each parameter to the number of erase cycles. You can set the weight based on actual needs and experience.

[0067] Then, a weighted calculation is performed on each disk operating parameter of the solid-state drive and the corresponding weight value to obtain a comprehensive calculation result. The weighted calculation method can adopt a simple linear weighted summation, or use other more complex weighted calculation algorithms. The appropriate method is selected according to actual needs. Finally, the range of the number of erasures of the solid-state drive is adjusted according to the result of the weighted calculation. The specific update method can adjust the threshold of the number of erasures based on the calculation results, such as increasing or decreasing the threshold that triggers the number of erasures to reflect the current disk operating status of the solid-state drive. For example:

[0068] Assume that the current erase count threshold is T. If the calculated result is high, it indicates that the SSD is in good health and the erase count is low. Consider raising the threshold to extend the lifespan of the storage block. Example: If T = 100 and the calculated result is 90, you can raise the threshold to 110. If the calculated result is low, it indicates that the SSD is in poor health and the erase count is high, requiring more frequent erase operations. In this case, consider lowering the threshold to replace faulty storage blocks in a timely manner. Example: If T = 100 and the calculated result is 120, you can lower the threshold to 90.

[0069] Step S203 determines the target plane to which the target storage block belongs, and determines candidate storage blocks located in the target plane from a preset replacement pool, wherein the preset replacement pool includes the second storage blocks in each plane, and the second storage blocks are storage blocks in the plane other than the first storage blocks. For details, see step S103 in the above embodiment, and will not be repeated here.

[0070] Step S204 , searching for a target storage block that meets the erasure count range from the candidate storage blocks, and using the target storage block to replace the faulty storage block.

[0071] In one embodiment of the present disclosure, searching for a target storage block that meets an erase count range from candidate storage blocks includes the following steps b1-b3:

[0072] Step b1: constructing a first storage block set from candidate storage blocks whose erase times fall within an erase times range.

[0073] Specifically, the erase count (EC value) of the candidate storage block is obtained and checked to see if it is within the target range [0, EC sb +EC above If the erase count is in the range [0, EC sb +EC above ], then the storage block is added to the first storage block set.

[0074] Step b2: Obtain a second erasure count corresponding to each storage block in the first storage block set.

[0075] Step b3: taking the storage block in the first storage block set with the smallest difference between the second erasure count and the first erasure count as the target storage block.

[0076] Specifically, the difference between the second erase count of the storage block in the first storage block set and the first erase count of the bad block is calculated, that is, the absolute value (|second erase count - first erase count|). The current difference is compared with the recorded minimum difference. If the current difference is smaller, the minimum difference is updated and the corresponding storage block is recorded as the new target storage block. After traversing all storage blocks in the first storage block set, the storage block with the smallest difference is obtained as the target storage block.

[0077] For example, as shown in FIG7 , the first erase count of the failed storage block that needs to be replaced in the super block is EC sb =100, the preset erase times is EC above =20. There are now four candidate memory blocks on the same plane as the faulty memory block, with erase counts (EC values) of 10, 70, 110, and 500, respectively. Select the candidate memory blocks that fall within the allowable range of [0, 100 + 20]: memory block 1 (EC value = 10), memory block 2 (EC value = 70), and memory block 3 (EC value = 110). Calculate the difference between these values ​​and EC = 100, and select the candidate memory block with the smallest absolute value of the difference as the target memory block. The target memory block is memory block 3 (EC value = 110).

[0078] It's important to note that selecting candidate blocks with the smallest EC difference for replacement minimizes the amount of data migration. Selecting blocks with similar EC differences indicates a high degree of data similarity between these blocks and the failed storage block, requiring less data migration and reducing the time and cost of data copying and migration. Furthermore, blocks with similar EC differences typically have similar lifespans and reliability characteristics, so replacing them with these blocks can reduce the risk of data corruption. Because data in similar blocks is stored for similar periods of time and used in similar circumstances, indicating similar reliability and durability, selecting these blocks as replacements can reduce the risk of data loss or corruption.

[0079] Additionally, selecting blocks with close EC difference differences for replacement can increase data availability. Selecting blocks with large EC difference differences as replacement blocks can lead to an imbalance between blocks, making some blocks susceptible to failure and resulting in data loss. However, using an algorithm that prioritizes close EC difference differences can balance the load between blocks and improve overall data reliability and availability.

[0080] In one embodiment of the present disclosure, searching for a target storage block that meets an erase count range from candidate storage blocks includes the following steps c1-c3:

[0081] Step c1: Detect whether there is a candidate storage block with an erasure count less than a first erasure count among multiple candidate storage blocks.

[0082] Specifically, the erasure count of the candidate storage block is obtained, and the erasure count of the candidate storage block is compared with the first erasure count. If the erasure count of the candidate storage block is less than the first erasure count, it indicates that there is a candidate storage block whose erasure count is less than the first erasure count.

[0083] Step c2: If so, generate a second storage block set using candidate storage blocks whose erasure times are less than or equal to the first erasure times.

[0084] Specifically, candidate storage blocks with an erasure count less than or equal to the first erasure count are added to the second storage block set, and all candidate storage blocks with an erasure count less than or equal to the first erasure count are traversed to obtain the second storage block set.

[0085] Step c3: taking the storage block with the largest number of erasures in the second storage block set as the target storage block.

[0086] Specifically, the erasure counts of the storage blocks in the second storage block set are compared, and the storage block with the largest erasure count is selected as the target storage block.

[0087] For example, as shown in FIG8 , the first erase count of the failed storage block that needs to be replaced in the super block is EC sb =100, the preset erase times is EC above =20. There are now four candidate memory blocks on the same plane as the faulty memory block: memory block 1 (EC value = 10), memory block 2 (EC value = 70), memory block 3 (EC value = 110), and memory block 4 (EC value = 500). Then, the candidate blocks with an EC value less than 100 are selected: memory block 1 (EC value = 10) and memory block 2 (EC value = 70). Finally, memory block 1 (EC value = 10) and memory block 2 (EC value = 70) are sorted, and the memory block with the largest number of erases is selected as the target memory block, that is, the target memory block is memory block 2 (EC value = 70).

[0088] It should be noted that by prioritizing candidate storage blocks with fewer than the first erase count, the reuse of already-used storage blocks can be reduced, thereby balancing storage block usage and extending the life of the entire system. Selecting candidate storage blocks with fewer than the first erase count also means that these candidate blocks have fewer erase counts and are likely to be in better physical condition. Therefore, selecting these blocks as replacement targets can reduce the risk of failure and improve storage block reliability.

[0089] In one embodiment of the present disclosure, the method further includes: if it does not exist, generating a third storage block set using candidate storage blocks with a number of erasures greater than the first erasure number; and using the storage block with the smallest number of erasures in the second storage block set as the target storage block.

[0090] It should be noted that selecting the storage block with the lowest erase count in the second storage block set as the target storage block means selecting a storage block with a relatively low erase count as the replacement target. These storage blocks are likely to be in good physical condition and have not undergone excessive erase operations. Therefore, selecting these blocks as target storage blocks can reduce the risk of failure and improve the reliability of the storage blocks. It can also reduce the risk of data loss. Because these blocks have a low erase count, they may still retain a large amount of original data and are less frequently overwritten. This helps protect the integrity and reliability of stored data. It also avoids overuse of storage blocks that have been erased frequently. This can balance the use of storage blocks, extend the lifespan of the relevant storage blocks, and improve the sustainability of the overall system.

[0091] This embodiment also provides a storage block replacement device based on a solid-state drive. This device is used to implement the above-mentioned embodiments and preferred implementations. Details that have already been described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0092] This embodiment provides a storage block replacement device based on a solid-state drive, as shown in FIG9 , including:

[0093] an acquisition module 901 configured to acquire a faulty storage block in a superblock of a solid-state drive and determine a target plane where the faulty storage block is located and a first erase count corresponding to the faulty storage block, wherein the solid-state drive includes multiple storage units, each storage unit includes multiple planes, each plane includes multiple storage blocks, and the superblock includes the first storage block in each plane;

[0094] A determination module 902 is configured to determine an erasure number range using a first erasure number;

[0095] A search module 903 is configured to determine a target plane to which the target storage block belongs, and to determine a candidate storage block located in the target plane from a preset replacement pool, wherein the preset replacement pool includes a second storage block in each plane, and the second storage block is a storage block in the plane other than the first storage block;

[0096] The replacement module 904 is configured to search for a target storage block that meets an erasure count range from the candidate storage blocks, and use the target storage block to replace the faulty storage block.

[0097] In one embodiment of the present application, the determination module 902 includes:

[0098] The acquiring unit is used to acquire the preset erasure times.

[0099] The calculation unit is used to calculate the sum of the first erasure number and the preset erasure number to obtain a target erasure number.

[0100] The construction unit is used to construct an erasure number range based on a preset value and a target erasure number, wherein the preset value is a lower limit value of the erasure number range, and the target erasure number is an upper limit value of the erasure number range.

[0101] In one embodiment of the present application, an acquisition unit is used to obtain the priority corresponding to the faulty storage block, wherein the priority is determined according to the number of historical failures corresponding to the faulty storage block; based on the correspondence between the preset priority and the number of erasures, the preset number of erasures corresponding to the target priority is determined.

[0102] In one embodiment of the present application, the device also includes: an update unit, which is used to detect the solid-state hard disk and obtain the current operating parameters of each disk of the solid-state hard disk; obtain the weight value corresponding to the disk operating parameter; perform weighted calculation based on each disk operating parameter and the weight value corresponding to the disk operating parameter to obtain a calculation result; and use the calculation result to update the erasure number range.

[0103] In one embodiment of the present application, the replacement module 904 is used to construct a first storage block set from candidate storage blocks whose erase counts fall within an erase count range; obtain a second erase count corresponding to each storage block in the first storage block set; and select the storage block in the first storage block set with the smallest difference between the second erase count and the first erase count as the target storage block.

[0104] In one embodiment of the present application, the replacement module 904 is used to detect whether there is a candidate storage block with an erasure count less than the first erasure count among the candidate storage blocks; if so, a second storage block set is generated using the candidate storage blocks with an erasure count less than or equal to the first erasure count; and the storage block with the largest erasure count in the second storage block set is used as the target storage block.

[0105] In one embodiment of the present application, the replacement module 904 is used to generate a third storage block set using candidate storage blocks with a number of erasures greater than the first number of erasures if the target storage block does not exist; and use the storage block with the smallest number of erasures in the second storage block set as the target storage block.

[0106] Please refer to Figure 10, which is a structural diagram of a computer device provided by an optional embodiment of the present disclosure. As shown in Figure 10, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system).

[0107] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.

[0108] The memory 20 stores instructions that can be executed by at least one processor 10, so as to enable at least one processor 10 to execute the method shown in the above embodiment.

[0109] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created based on the use of a computer device for displaying a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0110] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0111] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0112] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0113] Although the embodiments of the present disclosure have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for replacing a storage block based on a solid-state drive, comprising: Obtaining a faulty storage block in a super block of a solid-state drive, and determining a target plane where the faulty storage block is located and a first erase count corresponding to the faulty storage block, wherein the solid-state drive includes a plurality of storage units, each storage unit includes a plurality of planes, each plane includes a plurality of storage blocks, and the super block includes a first storage block in each plane; An erasure number range determined by using the first erasure number; Determining a target plane to which the target storage block belongs, and determining a candidate storage block located in the target plane from a preset replacement pool, wherein the preset replacement pool includes a second storage block in each plane, and the second storage block is a storage block in the plane other than the first storage block; A target storage block that meets the erasure count range is searched from the candidate storage blocks, and the faulty storage block is replaced by the target storage block.

2. The method according to claim 1, wherein the erasure number range determined by using the first erasure number comprises: Get the preset number of erasures; Calculating the sum of the first erasure number and the preset erasure number to obtain a target erasure number; The erasure number range is constructed based on a preset value and the target erasure number, wherein the preset value is a lower limit value of the erasure number range, and the target erasure number is an upper limit value of the erasure number range.

3. The method according to claim 2, wherein obtaining the preset number of erasures comprises: Obtaining a priority corresponding to the fault storage block, wherein the priority is determined according to a number of historical faults corresponding to the fault storage block; Based on the corresponding relationship between the preset priority and the erasure times, the preset erasure times corresponding to the target priority are determined.

4. The method according to claim 2, further comprising: Detecting the solid-state hard disk to obtain current operating parameters of each disk of the solid-state hard disk; Obtaining a weight value corresponding to the disk operating parameter; Performing weighted calculation based on each of the disk operating parameters and the weight values ​​corresponding to the disk operating parameters to obtain a calculation result; The erasure count range is updated using the calculation result.

5. The method according to claim 1, wherein searching for a target storage block that meets the erase count range from the candidate storage blocks comprises: Constructing a first storage block set from candidate storage blocks whose erase times fall within the erase times range; Obtaining a second erasure count corresponding to each storage block in the first storage block set; The storage block in the first storage block set with the smallest difference between the second erasure count and the first erasure count is used as the target storage block.

6. The method according to claim 1, wherein searching for a target storage block that meets the erase count range from the candidate storage blocks comprises: Detecting whether there is a candidate storage block with an erasure count less than the first erasure count among the candidate storage blocks; If so, generating a second storage block set using candidate storage blocks whose erase times are less than or equal to the first erase times; The storage block with the largest number of erasures in the second storage block set is used as the target storage block.

7. The method according to claim 6, further comprising: If not, generating a third storage block set using candidate storage blocks whose erasure times are greater than the first erasure times; The storage block with the smallest number of erasures in the second storage block set is used as the target storage block.

8. A storage block replacement device based on a solid state drive, comprising: an acquisition module, configured to acquire a faulty storage block in a super block in a solid-state drive, and determine a target plane where the faulty storage block is located and a first erase count corresponding to the faulty storage block, wherein the solid-state drive includes a plurality of storage units, each storage unit includes a plurality of planes, each plane includes a plurality of storage blocks, and the super block includes the first storage block in each plane; a determination module, configured to determine a range of erasure times using the first erasure times; a search module, configured to determine a target plane to which the target storage block belongs, and determine a candidate storage block located in the target plane from a preset replacement pool, wherein the preset replacement pool includes a second storage block in each plane, and the second storage block is a storage block in the plane other than the first storage block; A replacement module is configured to search for a target storage block that meets the erasure count range from the candidate storage blocks, and replace the faulty storage block with the target storage block.

9. A computer device comprising: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 7 by executing the computer instructions. 10 . A computer-readable storage medium having computer instructions stored thereon, wherein the computer instructions are configured to cause a computer to execute the method according to claim 1 .

Citation Information

Patent Citations

  • Method and device for controlling solid state disk

    CN114691433A

  • Storage block replacement method and device based on solid state disk

    CN118098320A

  • Semiconductor memory device and method of operating the semiconductor memory device

    US20210327532A1