Memory block replacement method and device based on solid state disk, equipment and medium

By detecting faulty memory blocks in the solid-state drive and determining the reserved area based on the failure rate, and using the reserved area to replace the faulty memory block, the problem of reduced reserved space capacity caused by bad blocks in the solid-state drive is solved, and the performance and data of the hard drive are improved. Security.

CN118585128APending Publication Date: 2024-09-03BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202410650403.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

When bad blocks occur in the NAND flash memory in the solid-state drive, the reserved space capacity is reduced and random write performance is affected.

Method used

By detecting faulty memory blocks in the SSD, determining the size of the reserved area of ​​the memory block based on the new failure rate, and obtaining free memory blocks from the reserved area to replace the faulty memory blocks, ensuring the normal operation and performance of the SSD.

Benefits of technology

It effectively solves the problem of reduced reserved space capacity caused by bad blocks, improves the reliability and performance of solid-state drives, avoids data damage caused by faulty memory blocks, and enhances data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118585128A
    Figure CN118585128A
Patent Text Reader

Abstract

The invention relates to a memory block replacement method and device based on a solid state disk, equipment and a medium. Comprising the steps of detecting whether a fault memory block exists in a memory block allocation process of the solid state disk; if the fault memory block exists, a memory block reserved area in the current solid state disk is obtained, and the size of the memory block reserved area is determined according to the newly added fault rate of the memory block in the solid state disk; and obtaining a first free memory block matched with the fault memory block from the memory block reserved area, and replacing the fault memory block with the first free memory block. According to the embodiment of the invention, the size of the memory block reserved area is determined according to the newly added failure rate of the memory block in the solid state disk, so that the reserved area is more flexible and effective to use, and the problem that the OP space capacity is reduced due to generation of bad blocks can be solved. And the residents disturb to utilize the reserved free memory block to replace the fault memory block, so that the normal operation and performance of the solid state disk are ensured. Damage of the fault memory block to the data is avoided, and the security of the data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of hard disks, and in particular to a memory block replacement method, device, equipment and medium based on a solid state disk. Background Art

[0002] SSDs usually use NAND flash memory as storage media, and their operating mechanism requires garbage collection. This is due to the characteristics of NAND flash memory, which cannot directly overwrite written data. When new data needs to be written, the SSD will first mark the old data as invalid and write the new data to other areas. The specific process of garbage collection includes finding a victimblock, copying all valid pages of the block to another block, and then erasing the original victimblock. This operation is necessary because if the same logical address is used, the FTL layer will not directly overwrite the source address, but will write sequentially, and then implement it by marking the original location as illegal. In addition, garbage collection is also responsible for wear leveling, which evenly erases blocks so that the number of times each block is erased is balanced.

[0003] Currently, in the use of solid-state drives, since the space of solid-state drives is usually divided into two parts: user space and over-provisioning (OP) space, when bad blocks are generated in the NAND flash memory, the capacity of the OP space will be reduced, thereby affecting the random write performance. Summary of the invention

[0004] In view of this, the embodiments of the present disclosure provide a memory block replacement method, apparatus, device and medium based on a solid state drive to solve the problem that when a bad block is generated in a NAND flash memory, the OP space capacity is reduced, affecting the random write performance.

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

[0006] Detect whether there is a faulty memory block in the process of allocating memory blocks on the solid state drive;

[0007] If there is a faulty memory block, a memory block reserved area in the current solid-state hard disk is obtained, wherein the memory block reserved area includes a plurality of free memory blocks, and the size of the memory block reserved area is determined according to a new failure rate of the memory blocks in the solid-state hard disk;

[0008] A first free memory block matching the faulty memory block is obtained from the memory block reserved area, and the faulty memory block is replaced by the first free memory block.

[0009] The disclosed embodiment determines the size of the reserved area of ​​the memory block according to the newly added failure rate of the memory block in the solid-state hard disk, so that the use of the reserved area is more flexible and effective, and can solve the problem of the reduction of the OP space capacity due to the generation of bad blocks. The reserved free memory blocks are used to replace the faulty memory blocks, ensuring the normal operation and performance of the solid-state hard disk. The damage to the data caused by the faulty memory blocks is avoided, and the security of the data is improved.

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

[0011] A detection module, used to detect whether there is a faulty memory block in the process of allocating memory blocks in the solid state drive;

[0012] an acquisition module, configured to acquire a memory block reserved area in the current solid-state drive if there is a faulty memory block, wherein the memory block reserved area includes a plurality of free memory blocks, and a size of the memory block reserved area is determined according to a new failure rate of the memory blocks in the solid-state drive;

[0013] The processing module is used to obtain a first free memory block matching the faulty memory block from the reserved area of ​​the memory block, and replace the faulty memory block with the first free memory block.

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

[0015] 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 implementation manner thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. 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.

[0017] Figure 1 is a flowchart of a memory block replacement method based on a solid state drive according to some embodiments of the present disclosure;

[0018] Figure 2is a flowchart of a memory block replacement method based on a solid state drive according to some embodiments of the present disclosure;

[0019] Figure 3 is a schematic diagram of a memory block reserved area according to some embodiments of the present disclosure;

[0020] Figure 4 is a flowchart of a memory block replacement method based on a solid state drive according to some embodiments of the present disclosure;

[0021] Figure 5 is a structural block diagram of a memory block replacement device based on a solid state drive according to an embodiment of the present disclosure;

[0022] Figure 6 It is a schematic diagram of the hardware structure of the computer device of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution 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, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0024] At present, solid-state drives generally use NAND as the storage medium. Due to the characteristics of flash memory chips, data cannot be directly overwritten. Instead, the original data must be marked as invalid before the new data is written to other places. Therefore, garbage collection is required for the operation of solid-state drives. Garbage collection refers to the process of moving valid data in physical blocks and erasing the flash memory blocks occupied by the original data to reclaim available space when the SSD is running.

[0025] Since the operation of SSDs requires additional space for garbage collection, the space of SSDs can be divided into two parts, one of which is the user data space and the other is the reserved space (Over-Provisioning, OP). The random write performance of the SSD is closely related to the size of the OP area of ​​the SSD. During the use of the SSD, the NAND medium will generate bad blocks. The generation of bad blocks will cause the OP space capacity to decrease, which in turn affects the random write performance. A bad block refers to a part of the flash memory unit that cannot store data normally. When the SSD controller tries to write data to a bad block, it may encounter errors or data integrity issues. In order to ensure the reliability of the data, the SSD controller usually takes some measures to manage bad blocks.

[0026] The common method currently is to use additional reserved OP space. When a block becomes a bad block, the controller can migrate the data to a free block in the OP space and mark the bad block as no longer in use. This ensures data integrity and avoids data loss due to bad blocks. However, as the number of bad blocks increases, the capacity of the OP space will gradually decrease. This means that the available space for replacing bad blocks and performing wear leveling is reduced.

[0027] When OP space is insufficient, the SSD may face some performance issues, especially in random write operations. In random write situations, the SSD needs to frequently find available free blocks to store data. If the OP space decreases, the number of available free blocks will also decrease, which may lead to increased latency in write operations. In addition, due to insufficient OP space, the SSD may require more garbage collection operations to clean up used blocks, which will also affect random write performance.

[0028] Based on this, the embodiments of the present disclosure provide a memory block replacement method, apparatus, device and medium based on a solid state drive. 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 the 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.

[0029] In this embodiment, a memory block replacement method based on a solid state drive is provided. Figure 1 is a flow chart of a memory block replacement method based on a solid state drive according to an embodiment of the present disclosure, such as Figure 1 As shown, the process includes the following steps:

[0030] Step S101, detecting whether there is a faulty memory block in the process of allocating memory blocks in the solid state drive.

[0031] Since the random write performance of the solid-state drive is closely related to the reserved space. During operation, due to the generation of bad blocks, the capacity of the OP space will be reduced, resulting in fluctuations in the random write performance and QoS (Quality of Service) of the solid-state drive. To solve this problem, this solution proposes to reserve a part of the area in the OP space as a memory block reserved area based on the new bad block rate of NAND (non-volatile storage technology). After setting the memory block reserved area, when a bad block appears in the solid-state drive during operation, a block will be taken out from the memory block reserved area to replace the bad block.

[0032] Specifically, ECC (Error Correction Code) is used to check the data integrity of the memory block. If an error is found during the verification process, it means that the memory block may be faulty. Alternatively, Bad Block detection is performed regularly to determine whether the memory block is faulty by detecting whether the read and write operations of the memory block are successful. If the read or write fails, it means that the memory block may be faulty.

[0033] Step S102, if there is a faulty memory block, obtain a memory block reserved area in the current solid state drive, wherein the memory block reserved area includes multiple free memory blocks, and the size of the memory block reserved area is determined according to the new failure rate of the memory block in the solid state drive.

[0034] Specifically, if there are faulty memory blocks, the purpose of obtaining the reserved memory block area in the current solid-state drive is to replace these faulty memory blocks. The reserved memory block area can be understood as a portion of pre-reserved free memory blocks for replacing faulty memory blocks. Among them, the size of the reserved memory block area is determined based on the new failure rate of the memory blocks in the solid-state drive. The new failure rate refers to the probability or speed at which a memory block of the solid-state drive fails. Based on the new failure rate, the number of faulty memory blocks in the future and the number of free memory blocks that need to be reserved in the solid-state drive can be predicted. By determining the new failure rate, the number of free memory blocks required for the reserved area can be calculated. The size of this reserved area should be large enough to accommodate the faulty memory blocks that may appear in the future to ensure that the solid-state drive can replace the faulty memory blocks in a timely manner and maintain reliability.

[0035] It can be understood that the free memory blocks in the reserved area are reserved for fault handling, and they can be used by replacing the faulty memory blocks. If a faulty memory block is found in the SSD, a matching free memory block can be obtained from the reserved area for replacement. Based on this, the size of the reserved area is determined according to the new failure rate of the memory blocks in the SSD, and a certain number of free memory blocks are reserved in the reserved area to replace the faulty memory blocks. This ensures that the SSD can replace the faulty memory blocks in a timely manner when encountering them, thereby improving the reliability and stability of the SSD.

[0036] Step S103: acquiring a first free memory block matching the faulty memory block from the reserved memory block area, and replacing the faulty memory block with the first free memory block.

[0037] Specifically, first, determine the faulty memory block in the solid-state drive. Traverse the reserved area of ​​the memory block to find the first free memory block that matches the faulty memory block. When traversing the reserved area, check the matching condition between each free memory block and the faulty memory block. The matching condition can be determined according to specific needs, such as the size and type of the memory block. Once the first free memory block that matches the faulty memory block is found, the free memory block can be used to replace the faulty memory block. The replacement process may involve copying the data in the faulty memory block to the new free memory block.

[0038] Based on this, the first free memory block matching the faulty memory block is obtained from the reserved area of ​​the memory block, and the faulty memory block is replaced with the first free memory block, which requires the detection of the faulty block, the traversal of the reserved area, the judgment of the matching condition, and then the replacement operation. The faulty memory blocks in the solid-state drive can be effectively processed, and the reliability and performance of the solid-state drive can be improved.

[0039] This embodiment determines the size of the reserved area of ​​the memory block according to the newly added failure rate of the memory block in the solid-state hard disk, so that the use of the reserved area is more flexible and effective, and can solve the problem of the reduction of the OP space capacity due to the generation of bad blocks. The reserved free memory blocks are used to replace the faulty memory blocks, ensuring the normal operation and performance of the solid-state hard disk. The damage to the data caused by the faulty memory blocks is avoided, and the security of the data is improved.

[0040] Figure 2 is a flow chart of a memory block replacement method based on a solid state drive according to an embodiment of the present disclosure, such as Figure 2 As shown, the process includes the following steps:

[0041] Step S201, detecting whether there is a faulty memory block in the process of allocating memory blocks in the solid state drive.

[0042] In one embodiment of the present disclosure, before detecting whether there is a faulty memory block in the process of allocating memory blocks in the solid-state hard disk, the method also includes: monitoring the first power-on event of the solid-state hard disk; obtaining a preset faulty block ratio of the solid-state hard disk based on the first power-on event; obtaining corresponding free memory blocks from logical units in the solid-state hard disk using the preset faulty block ratio; constructing a sub-reserved area of ​​the logical unit based on each free memory block in the logical unit; and constructing an original reserved area based on the sub-reserved area of ​​each logical unit.

[0043] Specifically, by monitoring the power state of the solid-state drive, the first power-on event of the solid-state drive can be monitored. According to the first power-on event of the solid-state drive, the fault block ratio preset in the manufacturer or the hard disk firmware can be obtained. The preset fault block ratio refers to the ratio of fault blocks preset by the manufacturer or firmware, that is, the ratio of memory blocks that are expected to fail in the solid-state drive.

[0044] Then, according to the preset fault block ratio, a corresponding ratio of free memory blocks is obtained from the logical unit of the solid-state drive. A logical unit is a division unit in the solid-state drive, which usually contains multiple memory blocks. For the free memory blocks in each logical unit, a sub-reserved area of ​​the logical unit can be constructed. The sub-reserved area is a part of the free memory blocks in the logical unit reserved for replacing the faulty memory blocks. Finally, based on the sub-reserved area of ​​each logical unit, the sub-reserved areas of all logical units are merged to construct the original reserved area of ​​the entire solid-state drive.

[0045] Based on this, by obtaining the preset fault block ratio in the first power-on event of the solid-state drive, and obtaining the corresponding free memory blocks from the logical unit according to the ratio, and then constructing the sub-reserved area of ​​the logical unit based on the free memory blocks of the logical unit, and finally constructing the original reserved area of ​​the entire solid-state drive, a certain number of free memory blocks can be prepared in advance to replace the faulty memory blocks, thereby increasing the reliability and life of the solid-state drive.

[0046] Step S202, if there is a faulty memory block, obtain a memory block reserved area in the current solid state drive, wherein the memory block reserved area includes multiple free memory blocks, and the size of the memory block reserved area is determined according to the new failure rate of the memory block in the solid state drive.

[0047] In the embodiment of the present disclosure, obtaining the reserved area of ​​the memory block in the current solid state drive includes the following steps a1-a3:

[0048] Step a1, obtaining the newly added failure rate of the logical unit in the process of allocating memory blocks of the solid state drive.

[0049] Among them, obtaining the new failure rate of the logical unit in the process of allocating memory blocks of the solid-state hard disk includes: detecting the actual load conditions of each logical unit in the process of allocating memory blocks of the solid-state hard disk; obtaining the calculation strategy corresponding to the actual load conditions, and calculating the new failure rate of the logical unit based on the calculation strategy.

[0050] Specifically, by monitoring the number, frequency, duration and other indicators of read and write operations of each logical unit in the solid-state hard disk, the actual load of each logical unit can be understood. This can be achieved through interfaces, sensors and the like provided by the hard disk controller or disk driver. According to the actual load of the logical unit, a suitable calculation strategy can be selected. The calculation strategy can use different calculation models, algorithms or parameters to calculate the new failure rate according to different load conditions. For example, the calculation method of the new failure rate can be dynamically adjusted according to the changing trend of the load condition. Based on the selected calculation strategy, the new failure rate in each logical unit is calculated. The new failure rate refers to the speed or probability of failure of the memory block in the logical unit.

[0051] Based on this, by detecting the actual load of each logical unit in the process of allocating memory blocks in the solid-state drive, a calculation strategy is selected according to the load, and the new failure rate in the logical unit is calculated based on the calculation strategy. In this way, the calculation method of the new failure rate can be adjusted according to the actual load situation, the failure of the memory block in the logical unit can be predicted more accurately, and the reliability and performance of the solid-state drive can be improved.

[0052] Step a2: adjusting the sub-reserved area corresponding to the logical unit using the newly added failure rate to obtain an adjusted sub-reserved area.

[0053] Among them, the sub-reserved area corresponding to the logical unit is adjusted by using the newly added failure rate to obtain the adjusted sub-reserved area, including: obtaining a mapping relationship between a preset new failure rate and a memory block size; based on the mapping relationship, determining a target memory size corresponding to the new failure rate from the free memory blocks corresponding to the logical unit; and constructing the adjusted sub-reserved area using free memory blocks that match the target memory size.

[0054] Specifically, collect preset new failure rate data of solid-state drives with different memory block sizes. This can be obtained through technical documents, firmware information or experimental data provided by the manufacturer. Use the collected data to establish a relationship model between the new failure rate and the memory block size. This can be achieved through curve fitting or other statistical methods. The relationship model can be in linear, exponential, logarithmic and other forms, and the specific form should be selected based on the actual data. Based on the established relationship model, the target memory block size corresponding to the preset new failure rate can be directly calculated, or the mapping relationship between the new failure rate and the memory block size can be obtained through interpolation, table lookup and other methods.

[0055] Based on the mapping relationship, determining the target memory size corresponding to the newly added failure rate from the free memory blocks corresponding to the logical unit includes the following steps: determining the logical unit to be mapped with the newly added failure rate. Obtaining the corresponding free memory block information according to the identification of the logical unit or in other ways. Determining the corresponding target memory block size according to the target newly added failure rate using the mapping relationship. Selecting a free memory block that matches the target memory block size from the free memory blocks of the logical unit. Constructing the adjusted sub-reserved area of ​​the logical unit based on the selected matching free memory blocks.

[0056] It is understandable that the size of the memory block reserved area is determined based on the design of the solid state drive and the new failure rate. By reasonably estimating and predicting the number of new bad blocks, a sufficiently large memory block reserved area can be set to ensure that a sufficient amount of bad block data can be accommodated to maintain the performance and data reliability of the solid state drive.

[0057] Step a3: construct a memory block reserved area based on the adjusted sub-reserved area.

[0058] Specifically, first, determine the sub-reserved area that needs to be adjusted. The sub-reserved area refers to a portion of memory space reserved for a specific purpose. Determine the size and location of the sub-reserved area that needs to be adjusted based on requirements and system design. Release the corresponding memory space on the solid-state drive based on the size and location of the adjusted sub-reserved area. Use the released memory space to build a memory block reserved area. The memory block reserved area is an area for storing unallocated memory blocks. Determine the size and location of the memory block reserved area based on the design and requirements of the solid-state drive.

[0059] Step S203: Acquire a first free memory block that matches the faulty memory block from the reserved memory block area, and use the first free memory block to replace the faulty memory block.

[0060] Specifically, Figure 3 As shown, the memory block reserved area is a data storage unit specifically used to store bad blocks. When a bad block appears in the solid-state drive, the bad block data therein will be migrated to a new block in the memory block reserved area to achieve data replacement and repair. Secondly, during the life cycle of the solid-state drive, as time goes by and the number of bad blocks increases, the usage of the memory block reserved area will also increase. By maintaining a memory block reserved area of ​​sufficient size, it can be ensured that bad blocks can be replaced when they appear, thereby maintaining the consistency of the operating performance of the solid-state drive. In addition, the existence of the memory block reserved area can maintain the consistency of the random write performance of the solid-state drive. When a faulty memory block appears, the solid-state drive will use the memory block reserved area to replace the data to avoid the impact of bad blocks on random write performance.

[0061] In an embodiment of the present disclosure, after replacing the faulty memory block with the first free memory block, the method also includes: detecting whether the memory failure rate of the logical unit exceeds a preset threshold; if the memory failure rate exceeds the preset threshold, determining the remaining area in the original reserved area excluding the adjusted sub-reserved area; obtaining candidate memory blocks in a healthy state from the remaining area, and adding the candidate memory blocks to the memory block reserved area.

[0062] Specifically, if it is found that the memory failure rate exceeds the preset threshold, the remaining area in the original reserved area except for the adjusted sub-reserved area can be determined. These remaining areas may contain candidate memory blocks in a healthy state. Through related operations, such as erasing, rewriting, etc., available data can be obtained from these candidate memory blocks and added to the reserved area of ​​the memory block. In this process, tools such as DiskGenius can be used to detect and repair bad sectors to ensure data integrity and security.

[0063] Figure 4 is a flow chart of a memory block replacement method based on a solid state drive according to an embodiment of the present disclosure, such as Figure 4 As shown, the process includes the following steps:

[0064] Step S301, obtaining historical fault information of multiple faulty memory blocks in a solid state drive.

[0065] Specifically, the faulty memory blocks in the solid-state drive are identified through a monitoring system or other fault detection mechanism. This can be detected by reading / writing erroneous data transmission, error check codes, etc. After the faulty memory block is found, it is marked and the fault information is recorded. The fault information may include the location of the faulty memory block, timestamp, number of read / write errors, error type, etc. The recorded fault information is stored in a persistent medium, such as a hard disk, a database, or a log file. Ensure that the fault information can be stored for a long time for subsequent analysis and processing. When it is necessary to obtain historical fault information of a specific faulty memory block, the corresponding record is retrieved by querying the stored fault information. Filtering and searching can be performed based on the location, time, error type, etc. of the faulty memory block to obtain accurate historical fault information.

[0066] Step S302, analyzing historical fault information of the faulty memory block to obtain historical position distribution of the faulty memory block and historical time intervals of the faults.

[0067] Specifically, the collected location information of the faulty memory blocks is analyzed. The number of memory blocks that have failed at each location can be calculated, and a chart or heat map of the location distribution can be drawn to visualize the spatial distribution characteristics of the memory block failure. According to the failure time information of the faulty memory blocks, the historical time intervals between the faulty memory blocks are calculated. The time interval can be the time difference of the failure, or the duration between the failures. You can consider using statistical analysis methods such as the mean, median, and percentile to understand the distribution of the failure time intervals. Analyze the historical time intervals to understand the time pattern of the occurrence of the faulty memory blocks. You can draw a histogram or density map of the time interval, or use a time series analysis method to explore the trend or periodicity of the failure. Based on the historical location distribution and time interval analysis results of the faulty memory blocks, explain the distribution characteristics and failure patterns of the faulty memory blocks. The analysis results can help understand the causes, laws, and trends of the failures, and provide references for system maintenance, fault prediction, and other aspects.

[0068] Through the above steps, the historical fault information of the faulty memory block can be analyzed to obtain the historical location distribution of the faulty memory block and the historical time interval of the fault. This can help understand the spatial and temporal characteristics of the memory block fault and provide guidance and decision-making basis for fault prediction, memory allocation optimization, etc.

[0069] Step S303: predicting a target memory block that will fail at the next moment based on the historical position distribution and the historical time interval.

[0070] Specifically, the historical location data is analyzed to understand the distribution of faulty memory blocks in the SSD. Statistical methods and data visualization techniques can be used to draw location distribution charts to observe the spatial distribution characteristics of memory block failures. Historical time interval data is analyzed to explore the time pattern of the occurrence of faulty memory blocks. Time series analysis methods, such as moving average, exponential smoothing, and autoregressive models, can be used to identify the trend of fault occurrence. Based on the historical location distribution and time interval analysis results, a prediction model is constructed to predict the target memory block that may fail at the next moment. Machine learning algorithms, such as regression analysis, time series prediction algorithms, or deep learning models can be used to train the model and predict the target memory block. According to the constructed prediction model, the current location distribution and time interval data are input to predict the target memory block that may fail at the next moment. Based on the output of the model, the memory blocks that need to be monitored and concerned are determined for timely maintenance and processing.

[0071] Step S304: Acquire a second free memory block that matches the target memory block from the multiple free memory blocks, and replace the target memory block with the second free memory block.

[0072] Specifically, first, confirm the target memory block that needs to be replaced. The target memory block may be a faulty memory block, or a memory block that needs maintenance or optimization. Check the free memory blocks in the reserved area to determine all available free memory blocks. Match the target memory block and the free memory blocks by comparing their features or attributes. The features may include size, type, location, etc. Find a second free memory block that matches the target memory block. Copy the data in the second free memory block to the target memory block to achieve replacement. Ensure that the replacement operation does not cause data loss or inconsistency. Update the status of the target memory block and the second free memory block. Mark the target memory block as free and mark the second free memory block as used.

[0073] The disclosed embodiment can predict target memory blocks that may fail in the future by analyzing historical failure information of failed memory blocks, and take measures to replace them in advance, thereby avoiding hard disk failures at critical moments and ensuring the reliability and stability of the hard disk. When a memory block in a solid-state drive fails, it may cause system performance to degrade. By predicting and replacing the target memory block, this situation can be avoided, thereby improving system performance and improving the utilization of hard disk space.

[0074] In this embodiment, a memory block replacement device based on a solid state drive is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0075] This embodiment provides a memory block replacement device based on a solid state drive, such as Figure 5 As shown, including:

[0076] A detection module 51 is used to detect whether there is a faulty memory block in the process of allocating memory blocks in the solid state drive;

[0077] An acquisition module 52 is used to acquire a memory block reserved area in the current solid-state hard disk if there is a faulty memory block, wherein the memory block reserved area includes a plurality of free memory blocks, and the size of the memory block reserved area is determined according to the newly added fault rate of the memory block in the solid-state hard disk;

[0078] The processing module 53 is used to obtain a first free memory block matching the faulty memory block from the reserved memory block area, and replace the faulty memory block with the first free memory block.

[0079] In an embodiment of the present disclosure, the device also includes: a construction module for monitoring the first power-on event of the solid-state hard disk; obtaining a preset fault block ratio of the solid-state hard disk based on the first power-on event; obtaining corresponding free memory blocks from a logical unit in the solid-state hard disk using the preset fault block ratio; constructing a sub-reserved area of ​​the logical unit based on each free memory block in the logical unit; and constructing an original reserved area based on the sub-reserved area of ​​each logical unit.

[0080] In the embodiment of the present disclosure, the acquisition module 52 includes:

[0081] An acquisition unit, used to acquire a newly added failure rate of a logic unit of the solid state drive during the process of allocating memory blocks;

[0082] An adjustment unit, used to adjust the sub-reserved area corresponding to the logical unit by using the newly added failure rate to obtain an adjusted sub-reserved area;

[0083] A construction unit is used to construct a memory block reserved area based on the adjusted sub-reserved area.

[0084] In the disclosed embodiment, the acquisition unit is used to detect the actual load conditions of each logical unit in the solid state drive during the process of allocating memory blocks; obtain the calculation strategy corresponding to the actual load conditions, and calculate the new failure rate of the logical unit based on the calculation strategy.

[0085] In the embodiment of the present disclosure, the adjustment unit is used to obtain a mapping relationship between a preset new failure rate and a memory block size; based on the mapping relationship, determine a target memory size corresponding to the new failure rate from the free memory blocks corresponding to the logical units; and construct an adjusted sub-reserved area using free memory blocks matching the target memory size.

[0086] In an embodiment of the present disclosure, the device also includes: an adjustment module for detecting whether the memory failure rate of the logical unit exceeds a preset threshold; if the memory failure rate exceeds the preset threshold, determining the remaining area in the original reserved area except for the adjusted sub-reserved area; obtaining candidate memory blocks in a healthy state from the remaining area, and adding the candidate memory blocks to the memory block reserved area.

[0087] In the disclosed embodiment, the device also includes: a prediction module, which is used to obtain historical fault information of multiple faulty memory blocks in the solid-state hard disk; analyze the historical fault information of the faulty memory blocks to obtain the historical position distribution of the faulty memory blocks and the historical time intervals for the occurrence of the faults; predict the target memory block that will fail at the next moment based on the historical position distribution and the historical time interval; obtain a second free memory block that matches the target memory block from multiple free memory blocks, and replace the target memory block with the second free memory block.

[0088] See also Figure 6 , Figure 6 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present disclosure, such as Figure 6 As shown, 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. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the 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 some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system).

[0089] 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 a dedicated 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.

[0090] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0091] 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 by the use of a computer device based on the presentation of 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 arranged 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 combinations thereof.

[0092] 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.

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

[0094] 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 can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, 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.

[0095] Although the embodiments of the present disclosure have been described in conjunction with 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 memory block replacement method based on a solid state drive, characterized in that: The method comprises: Detect whether there is a faulty memory block in the process of allocating memory blocks on the solid state drive; If there is a faulty memory block, a memory block reserved area in the current solid-state hard disk is obtained, wherein the memory block reserved area includes a plurality of free memory blocks, and the size of the memory block reserved area is determined according to a new failure rate of the memory blocks in the solid-state hard disk; A first free memory block matching the faulty memory block is obtained from the memory block reserved area, and the faulty memory block is replaced by the first free memory block.

2. The method according to claim 1, characterized in that Before detecting whether there is a faulty memory block in the process of allocating memory blocks in the solid state drive, the method further includes: Monitoring the first power-on event of the solid state drive; Acquire a preset fault block ratio of the solid state drive based on the first power-on event; Obtaining corresponding free memory blocks from logic units in the solid state drive using the preset fault block ratio; constructing a sub-reserved area of ​​the logical unit based on each free memory block in the logical unit; An original reserved area is constructed based on the sub-reserved areas of each of the logical units.

3. The method according to claim 2, characterized in that The step of obtaining the memory block reserved area in the current solid state drive includes: Obtaining a new failure rate of the logic unit in a process of allocating memory blocks of the solid state drive; Using the newly added failure rate, adjusting the sub-reserved area corresponding to the logic unit to obtain an adjusted sub-reserved area; The memory block reserved area is constructed based on the adjusted sub-reserved area.

4. The method according to claim 3, characterized in that The obtaining of the newly added failure rate of the logic unit in the process of allocating memory blocks of the solid state drive includes: Detecting the actual load of each logical unit of the solid state drive during the process of allocating memory blocks; A calculation strategy corresponding to the actual load condition is obtained, and a new failure rate of the logic unit is calculated based on the calculation strategy.

5. The method according to claim 3, characterized in that: The step of adjusting the sub-reserved area corresponding to the logic unit by using the newly added failure rate to obtain the adjusted sub-reserved area includes: Obtaining a mapping relationship between a preset new failure rate and a memory block size; Based on the mapping relationship, determining a target memory size corresponding to the newly added failure rate from the free memory blocks corresponding to the logical units; The adjusted sub-reserved area is constructed using free memory blocks that match the target memory size.

6. The method according to claim 5, characterized in that After replacing the faulty memory block with the first free memory block, the method further includes: Detecting whether a memory failure rate of the logic unit exceeds a preset threshold; If the memory failure rate exceeds the preset threshold, determining a remaining area in the original reserved area except the adjusted sub-reserved area; A candidate memory block in a healthy state is obtained from the remaining area, and the candidate memory block is added to the memory block reserved area.

7. The method according to claim 1, characterized in that The method further comprises: Obtaining historical fault information of multiple faulty memory blocks in the solid state drive; Analyze the historical fault information of the faulty memory block to obtain the historical position distribution of the faulty memory block and the historical time interval of the fault; Predicting a target memory block that will fail at the next moment based on the historical location distribution and the historical time interval; A second free memory block matching the target memory block is obtained from the multiple free memory blocks, and the target memory block is replaced by the second free memory block.

8. A memory block replacement device based on a solid state drive, characterized in that: The device comprises: A detection module, used to detect whether there is a faulty memory block in the process of allocating memory blocks in the solid state drive; an acquisition module, configured to acquire a memory block reserved area in the current solid-state drive if there is a faulty memory block, wherein the memory block reserved area includes a plurality of free memory blocks, and a size of the memory block reserved area is determined according to a new failure rate of the memory blocks in the solid-state drive; The processing module is used to obtain a first free memory block matching the faulty memory block from the reserved area of ​​the memory block, and replace the faulty memory block with the first free memory block.

9. An electronic device, characterized in that include: 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, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Storage device and electronic system

    CN119376642A

  • Data block management method, electronic equipment, storage medium and product

    CN119917029A

  • A method for managing data blocks, an electronic device, a storage medium, and a product

    CN119917029B

  • Storage equipment repairing method and device, equipment and storage medium

    CN120407268A

  • Data block replacement method and device, electronic equipment, storage medium and program product

    CN121541836A