Method and device for controlling storage wear balance of solid state disk

By filtering and integrating data blocks that have not been accessed for a long time in the solid state drive and migrating them to other data blocks with moderate access times, the problem of traditional technology being unable to cope with the dynamic changes in data access frequency is achieved, and better wear equalization and Longer hard drive life.

CN119396335AInactive Publication Date: 2025-02-07SHENZHEN G-BONG TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411379237.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-02-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional solid-state hard disk wear equalization technology cannot effectively deal with the dynamic changes in data access frequency, resulting in an imbalance between data blocks that have not been accessed for a long time and data blocks that are frequently used, affecting the service life of the hard disk.

Method used

By filtering out data blocks that have not been accessed within the preset time threshold, obtaining their access times. If they are less than the preset threshold, then integrating these data blocks will form new data blocks with fewer accesses and migrating them to the access times. Moderate in other data blocks to achieve wear equalization.

Benefits of technology

This method effectively reduces the problem of aggravated local wear due to differences in access frequency, extends the service life of the SSD, and improves storage efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396335A_ABST
    Figure CN119396335A_ABST
Patent Text Reader

Abstract

The invention discloses a solid state disk storage wear leveling control method and device, and relates to the field of solid state disk wear leveling control, and the method comprises the steps: screening out a plurality of first target blocks which are not accessed in a solid state disk within a preset time threshold value, and determining the corresponding access times; obtaining storage data and residual capacity of the first target block with the access times smaller than a first preset threshold value; integrating all the target blocks according to the storage data and the residual capacity to obtain a plurality of second target blocks; and migrating the data in the second target block to a third target block of which the access frequency is between the first preset threshold value and the second preset threshold value. By implementing the method, data storage can be dynamically adjusted according to the access frequency of the data block, cold data which is not accessed for a long time is integrated and migrated, the problem that local abrasion is aggravated due to the access frequency difference is solved, and the service life of the solid state disk is prolonged.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of wear leveling control of solid state drives, and in particular to a control method and device for wear leveling of solid state drives. Background Art

[0002] In modern computer systems, solid-state drives (SSDs) have become an important choice for data storage due to their fast read and write speeds, low power consumption, and strong shock resistance. As data processing needs increase, higher requirements are placed on the performance and life management of SSDs.

[0003] Traditional SSDs use static load balancing technology, which uses a fixed algorithm to periodically check the usage of data blocks and try to evenly distribute the number of writes to extend the service life of the hard drive. This method reduces the overuse of certain data blocks by monitoring and adjusting the activity of data blocks.

[0004] However, traditional static load balancing technology cannot effectively cope with the dynamic changes in data access frequency. When data blocks have not been accessed for a period of time, traditional methods often delay the migration and integration of these data blocks, resulting in an imbalance between long-unused data blocks and frequently used data blocks. Summary of the invention

[0005] The present application provides a control method and device for wear leveling of solid-state hard disk storage, which is used to solve the technical problem of how to more effectively manage data blocks that have not been accessed for a long time in a solid-state hard disk to achieve better wear leveling, thereby extending the service life of the hard disk.

[0006] In a first aspect, the present application provides a control method for wear leveling of a solid state drive storage, which is applied to a wear leveling device of a solid state drive, and the method comprises: Screening out a plurality of first target blocks in the solid state drive that have not been accessed within a preset time threshold; Obtaining the number of accesses to the first target block; If the number of accesses is less than a first preset threshold, obtaining storage data and remaining capacity of the first target block; Integrate all target blocks according to the storage data and the remaining capacity to obtain a plurality of second target blocks, wherein the number of the second target blocks is less than or equal to the number of the first target blocks; The data in the second target block is migrated to a third target block, where the number of accesses to the third target block is between a first preset threshold and a second preset threshold.

[0007] Through the above-mentioned embodiment, the wear leveling device of the solid-state hard disk screens out the first target blocks that have not been accessed within the preset time, and determines whether the number of accesses is less than the first preset threshold, and integrates the target blocks with fewer accesses, thereby reducing the number of first target blocks and forming second target blocks with fewer accesses. Then, the data of the second target block is migrated to the third target block with a moderate number of accesses, so that the cold data with a very low access frequency is integrated, thereby balancing the wear of the solid-state hard disk. This method dynamically adjusts data storage according to the access frequency of the block, integrates and migrates the cold data that has not been accessed for a long time, reduces the problem of aggravated local wear caused by differences in access frequency, and extends the service life of the solid-state hard disk.

[0008] In some embodiments, the step of integrating all target blocks according to the storage data and the remaining capacity to obtain a plurality of second target blocks specifically includes: Determine two first target blocks that match the storage data and the remaining capacity; The two first target blocks are integrated to obtain a second target block.

[0009] Through the above embodiment, the wear leveling device of the solid-state hard disk forms a second target block by finding two first target blocks that match the storage data and the remaining capacity. This integration method fully considers the storage characteristics of the data and the remaining capacity of each block, so that the storage utilization rate of the integrated second target block is higher and the capacity utilization is more compact. At the same time, by accurately matching the amount of stored data and the remaining capacity, unnecessary space waste is avoided, and the storage efficiency of the solid-state hard disk is further improved.

[0010] In some embodiments, the step of determining two first target blocks that match the storage data and the remaining capacity specifically includes: sorting the plurality of first target blocks in ascending order according to the storage data and the remaining capacity to obtain a first sequence and a second sequence; Selecting a first target block from the second sequence in sequence and setting it as a target block to be matched; Selecting one or more temporary target blocks that can be integrated with the target block to be matched from the first sequence; The temporary target block storing the largest data and the target block to be matched are determined as two matching first target blocks.

[0011] Through the above embodiments, the wear leveling device of the solid state drive optimizes the process of finding matching target blocks, introduces a link of sorting the first target block according to the amount of stored data and the size of the remaining capacity, and obtains two ordered sequences. Then, by finding the block combination with the most complementary storage data in the two sequences as the integration object, the matching search process is simplified. It is ensured that the two blocks with the most complementary storage data and remaining capacity are preferentially selected as the integration objects, which improves the matching accuracy and the quality of integration, so that the capacity utilization of the second target block after integration is optimized.

[0012] In some embodiments, before the step of migrating the data in the second target block to the third target block, the method further includes: Determine a blank data block whose access count is between a first preset threshold and a second preset threshold; Sort the blank data blocks by the number of accesses; The corresponding target blank data block is determined as the third target block according to the importance level of the data in the second target block, and the importance level is positively correlated with the number of accesses to the blank data block.

[0013] Through the above embodiments, the solid state drive wear leveling device selects the target blank data block as the migration target according to the importance of the data. The blank data blocks are sorted according to the access frequency, and the access frequency is positively correlated with the data importance level, so that important data can be stored in the block with moderate access frequency, reducing the risk of loss of important data due to storage block damage.

[0014] In some embodiments, before the step of migrating the data in the second target block to the third target block, the method further includes: Detect the current read and write frequency of the solid state drive; If the read and write frequency exceeds the preset frequency threshold, data migration is suspended.

[0015] Through the above embodiments, the wear leveling device for the solid-state drive introduces real-time detection of the read and write frequency of the solid-state drive, and when it is detected that the read and write frequency exceeds the preset threshold, the data migration operation is suspended in time. This dynamically controlled migration scheme effectively avoids the performance degradation problem caused by data migration in high-frequency read and write scenarios, and reduces the impact of data migration on the real-time read and write performance of the solid-state drive.

[0016] In some embodiments, after the step of detecting the current read and write frequency of the solid state drive, the method further includes: marking the third target block; No read or write operations are performed on marked data blocks.

[0017] Through the above embodiment, the wear leveling device of the solid state drive specially marks the third target block to be migrated and suspends the read and write operations on it, thereby avoiding unexpected changes in the data block status during the migration process from a mechanism perspective, and ensuring the atomicity and consistency of data migration.

[0018] In some embodiments, after the step of obtaining the number of accesses to the first target block, the method further includes: If the number of accesses is greater than or equal to the first preset threshold, data migration is not performed.

[0019] Through the above embodiment, the wear leveling device of the solid state drive may not migrate the data blocks whose access times have reached the first preset threshold value, thereby avoiding unnecessary migration operations on data blocks that have been accessed a certain number of times, reducing the number of migrations and the amount of data moved, reducing the consumption of the wear leveling mechanism itself on the life of the solid state drive, and making the implementation of wear leveling more efficient and accurate.

[0020] In a second aspect, the present application provides a wear leveling device for a solid state hard disk, the wear leveling device for a solid state hard disk comprising: one or more processors and a memory; The memory is coupled to the one or more processors, and the memory is used to store computer program code, which includes computer instructions. The one or more processors call the computer instructions so that the solid-state hard disk wear leveling device can implement a solid-state hard disk storage wear leveling control method provided in the above embodiment, which will not be repeated here.

[0021] In a third aspect, the present application provides a computer-readable storage medium, including instructions. When the instructions are executed on a solid-state hard disk wear leveling device, the solid-state hard disk wear leveling device can implement a control method for solid-state hard disk storage wear leveling provided in the above-mentioned embodiment, which will not be repeated here.

[0022] In a fourth aspect, the present application provides a computer program product. When the computer program product runs on a solid-state hard disk wear leveling device, the solid-state hard disk wear leveling device can implement a solid-state hard disk storage wear leveling control method provided in the above embodiment, which will not be repeated here.

[0023] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. By screening out data blocks that have not been accessed for a long time and integrating them according to their storage data volume and remaining capacity, a second target block with a lower access frequency is formed. Then the data in the second target block is migrated to the third target block with a moderate access frequency, realizing hierarchical storage of hot and cold data. This dynamic balancing solution effectively reduces the problem of increased local wear caused by differences in access frequency, prolongs the service life of the solid-state drive, and reduces the space cost of wear leveling by integrating data blocks, thereby improving storage efficiency.

[0024] 2. A positive correlation between data importance and target data block access frequency is established to ensure that important data is migrated to data blocks with moderate access frequency. This migration strategy takes into account both data security and real-time requirements. By matching data importance levels with target block access activity, it optimizes the storage distribution of key data, reduces the risk of key data access delays or loss, and improves the reliability and availability of key data.

[0025] 3. By real-time detection of the read and write frequency of the SSD, the data migration is automatically suspended when the read and write load exceeds the preset threshold, and the data blocks to be migrated are marked and protected for read and write until the load returns to normal. This adaptive control strategy minimizes the impact of the wear leveling process on the real-time performance of the SSD, ensuring priority response for key businesses. At the same time, by marking and protecting the migrated data blocks, the atomicity and consistency of the migration operation are improved, and the reliability of the wear leveling process is enhanced. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a flow chart of a control method for wear leveling of a solid state drive storage in an embodiment of the present application; Figure 2 is another flow chart of a method for controlling wear leveling of a solid state drive storage in an embodiment of the present application; Figure 3 It is a schematic diagram of a physical device structure of a solid state hard disk wear leveling device in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations comprising one or more listed items.

[0028] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0029] For ease of understanding, the following is a flow chart of the method provided by this embodiment. Figure 1 , which is a flow chart of a method for controlling wear leveling of a solid state drive storage in an embodiment of the present application.

[0030] S101. Filter out a plurality of first target blocks in a solid state drive that have not been accessed within a preset time threshold.

[0031] The technician can set a preset time threshold in the SSD wear leveling device, which is used to determine whether a data block has not been accessed for a long time. Usually, this time threshold can be set according to the usage scenario of the SSD and the data access characteristics, for example, it can be set to 30 days, 60 days or 90 days, etc., which is not limited here.

[0032] After determining the time threshold, the SSD wear leveling device traverses all data blocks in the SSD, and by analyzing the metadata information of each data block, such as the last access time, it selects the data blocks whose last access time exceeds the preset time threshold and marks them as the first target blocks. These first target blocks are cold data blocks that have not been accessed for a long time.

[0033] It should be noted that, in actual applications, the SSD wear leveling device can use the metadata management module in the SSD controller to obtain access information for each data block. The metadata management module generally records various attributes of the data block, including the physical address, logical address, number of erases and writes, and last access time of the data block. By reading the metadata, the data blocks with earlier last access time can be screened out.

[0034] S102: Obtain the number of accesses to the first target block.

[0035] After determining the first target block to be processed, the wear leveling device of the solid state drive further obtains the historical access status of these target blocks, mainly including parameter information such as the number of accesses.

[0036] It is understandable that current solid-state hard drives generally integrate a special counter module in the controller to count the number of read and write times of each data block. Whenever a data read or write request arrives, the counter will automatically count and accumulate the corresponding data block. Therefore, the solid-state hard drive wear leveling device can directly obtain the number of accesses to the target block through the counter module. Of course, in addition to using hardware counters, the solid-state hard drive wear leveling device can also count the number of accesses through software. For example, a log recording function can be added to the solid-state hard drive driver. Whenever a data block is accessed, the time and frequency of the access are recorded in the log, which is not limited here.

[0037] S103: If the number of accesses is less than a first preset threshold, obtaining storage data and remaining capacity of the first target block.

[0038] After obtaining the number of accesses to the first target block, the wear leveling device of the solid state drive further selects the data block with the lowest access frequency to prepare for subsequent data integration.

[0039] Specifically, the SSD wear leveling device compares the number of accesses to each first target block with the size of the first preset threshold. If the number of accesses to a target block is less than or equal to the first preset threshold, it means that the data block is extremely cold data in the cold data block, and the access frequency is extremely low, so data integration can be performed. Then, for the identified extremely cold data blocks, the SSD wear leveling device further obtains their storage data information and remaining capacity size. Among them, the storage data information includes the size and attributes of the data already stored in the data block, and the remaining capacity size indicates how much data can be written to the data block.

[0040] It should be noted that the setting of the first preset threshold needs to comprehensively consider factors such as the performance, capacity, and life of the SSD. For example, for a consumer-grade SSD with a capacity of 1TB, the first preset threshold can be set to 100 times; while for a data center-grade SSD with a capacity of 10TB, the first preset threshold can be set higher, such as 1000 times, which is not limited here.

[0041] In addition, the wear leveling device of the solid state drive can obtain the storage data size by reading the metadata information of the data block, and the remaining capacity size can be obtained by calculating the difference between the total capacity of the data block and the storage data size.

[0042] S104: Integrate all target blocks according to the storage data and the remaining capacity to obtain a plurality of second target blocks.

[0043] The wear leveling device of the solid-state drive sorts all the extremely cold data blocks (the first target blocks) from largest to smallest according to the remaining capacity, and selects the two data blocks with the largest free capacity as the integration objects; then, the storage data of these two data blocks is read out and spliced ​​into a new data block; then, the metadata information of the new data block is updated, including the logical address, physical address, number of erases and writes, etc.; finally, the original two data blocks are marked as invalid to release the physical space they occupy. The whole process is repeated until all the extremely cold data blocks are integrated.

[0044] It should be noted that when performing data integration, the wear leveling device of the solid-state drive will try to ensure that the capacity of the second target block after integration is close to the physical block size of the solid-state drive, that is, the size of the minimum erase unit. This can avoid internal fragmentation and improve storage efficiency. For example, for a solid-state drive with an erase unit of 128KB, try to control the size of the second target block after integration to around 128KB. After the integration is completed, the original multiple small, scattered and extremely cold data blocks are merged into a small number of large, continuous second target blocks.

[0045] S105: Migrate the data in the second target block to the third target block.

[0046] Specifically, the wear leveling device of the solid-state hard disk scans the physical units of the entire solid-state hard disk, identifies all free blocks whose erase and write times are between a first preset threshold and a second preset threshold as candidate third target blocks; then, selects free blocks that are closest in capacity and physical distance to each second target block from the candidate third target blocks as migration targets (third target blocks); then, reads the data in the second target blocks and writes them to the corresponding third target blocks; finally, updates the metadata information of the second target blocks and the third target blocks, and marks the second target block as invalid to release the physical space it occupies.

[0047] In addition, during the data migration process, in order to minimize the impact on the normal reading and writing of the SSD, the SSD wear leveling device generally chooses to operate when the SSD is idle or under low load. At the same time, since the data migration process itself will also produce a certain write amplification effect, increasing the wear of the SSD. Therefore, the SSD wear leveling device will dynamically monitor the current data migration volume. When the amount of migrated data exceeds a certain threshold, it will automatically suspend the migration until the SSD load is reduced to a safe level before continuing.

[0048] The following is a more detailed description of the process of the method provided by this embodiment. Figure 2 , which is another flow chart of a method for controlling wear leveling of solid state hard disk storage in an embodiment of the present application.

[0049] S201. Obtain the number of accesses to a first target block.

[0050] After determining the first target block to be processed, the SSD wear leveling device further obtains parameter information such as the number of accesses to these target blocks. The specific process has been introduced in step S102 and will not be repeated here.

[0051] S202: Whether the number of access times is less than a first preset threshold.

[0052] After obtaining the number of accesses to the first target block, the wear leveling device of the solid state drive needs to further determine whether the number of accesses is less than a preset first threshold. The first preset threshold represents a lower limit of the access frequency. Data blocks below this lower limit are considered cold data and need to be integrated and migrated, and subsequent steps such as S203 are executed. On the contrary, if the number of accesses is greater than or equal to the first preset threshold, step S210 is entered without data migration.

[0053] For example, the SSD wear leveling device can set the first threshold to 100 times. When it is found that the number of accesses to a first target block is only 50 times, it can be determined that the data block is cold data. By introducing the access count threshold, the SSD wear leveling device can flexibly divide hot and cold data and dynamically adjust the threshold value according to the actual usage scenario to meet different application requirements.

[0054] S203 , sort the multiple first target blocks in ascending order according to the storage data and the remaining capacity, to obtain a first sequence and a second sequence.

[0055] After determining the cold data blocks to be integrated, that is, the first target blocks with access times lower than the first threshold, the wear leveling device of the solid state drive integrates these target blocks into a second target block with a larger capacity.

[0056] Specifically, the wear leveling device of the solid state drive first sorts the first target blocks in ascending order according to two key attributes: the amount of stored data and the size of the remaining capacity. After sorting, two ordered sequences are formed: the first sequence is arranged from small to large according to the amount of data, and the second sequence is arranged from small to large according to the remaining capacity.

[0057] By constructing an ascending sequence of stored data volume and remaining capacity, the SSD wear leveling device can quickly lock in the best integration object with complementary data volume and matching remaining capacity, avoiding the inefficiency caused by one-by-one comparison. At the same time, this method of sorting first and then matching can also maximize the space utilization of the second target block after integration and reduce internal fragmentation and holes.

[0058] S204: Filter out temporary target blocks from the first sequence that can be integrated with the target blocks to be matched in the second sequence.

[0059] Specifically, the wear leveling device of the solid state drive selects one target block from the second sequence, i.e., the ascending sequence of the remaining capacity, as the block to be matched. Then, a number of temporary target blocks are selected from the first sequence, i.e., the ascending sequence of the stored data, and the storage data volume of these temporary target blocks plus the storage data volume of the block to be matched must be exactly less than or equal to the remaining capacity of the block to be matched.

[0060] S205: Determine the temporary target block storing the largest data and the target block to be matched as two matching first target blocks.

[0061] After screening out all temporary target blocks that can be integrated with the target block to be matched, the SSD wear leveling device needs to select the final integration object from them. Specifically, the SSD wear leveling device selects the temporary target block with the largest amount of stored data for integration, so as to merge as much data as possible and reduce the holes and fragments in the second target block after integration.

[0062] In addition, because temporary target blocks with large storage data volumes are given priority during each integration, when wear leveling is performed again in the future, only target blocks with smaller storage data volumes will be left, and it is easier for them to find integration objects with high compatibility with each other.

[0063] In the above embodiment, the wear leveling device of the solid state drive optimizes the process of finding matching target blocks, introduces a step of sorting the first target blocks according to the amount of stored data and the size of the remaining capacity, and obtains two ordered sequences. Then, by finding the block combination with the most complementary storage data in the two sequences as the integration object, the matching search process is simplified. It ensures that the two blocks with the most complementary storage data and remaining capacity are preferentially selected as the integration objects, improves the matching accuracy and the quality of integration, and makes the capacity utilization of the second target block after integration optimal.

[0064] S206: Integrate the two first target blocks to obtain a second target block.

[0065] Specifically, the wear leveling device of the solid state drive first reads the valid data in the two first target blocks, and then reorganizes and writes the data into a new physical block (the second target block) according to a certain data format and arrangement. During the integration process, the original two physical blocks will be marked as invalid, and the physical space they occupy can be recycled for other purposes.

[0066] For example, suppose the SSD wear leveling device finds two first target blocks, which are marked as A and B. Among them, 30% of the space of block A stores valid data, and 60% of the space of block B stores valid data. Through integration, the valid data in blocks A and B can be extracted, reorganized and stored in a new physical block C. Theoretically, the storage space utilization rate of block C can reach 90%. In this way, the originally scattered storage space is fully utilized and data storage is more compact.

[0067] In addition, the wear leveling device of the solid-state hard disk can further reduce the storage volume of data without affecting the integrity of the data by using some data compression algorithms such as RLE coding and Huffman coding, thereby saving more storage space, which is not limited here.

[0068] S207: Determine a blank data block whose access count is between a first preset threshold and a second preset threshold.

[0069] The SSD wear leveling device traverses all blank data blocks in the SSD, wherein the blank data blocks refer to physical blocks that currently do not store valid data. These physical blocks have been used before but have been cleared after garbage collection or data deletion.

[0070] Next, the SSD wear leveling device queries the access counter of each blank data block to obtain the historical access count of each blank data block. If the access count corresponding to a blank data block is between the first preset threshold and the second preset threshold, the blank data block is marked as the third target block.

[0071] For example, in one embodiment, assume that the first preset threshold is set to 100 times and the second preset threshold is set to 1000 times. When reading the access status of the blank data block, the wear leveling device of the solid-state hard disk detects that there are three blank blocks A, B, and C, and the access times are 50 times, 500 times, and 2000 times, respectively. According to the above-mentioned judgment rule of the third target block, only the access times of block B meet the conditions, which is between 100 times and 1000 times, so block B will be marked as the third target block. Block A will not be selected because the access times are too low, and block C will not be selected because the access times are too high.

[0072] It should be noted that the first preset threshold and the second preset threshold are actually two access frequency boundary values ​​pre-set by the SSD wear leveling device according to design requirements and application scenarios. The first preset threshold is relatively small, representing a lower access frequency, while the second preset threshold is relatively large, representing a higher access frequency.

[0073] S208: Determine the corresponding target blank data block as the third target block according to the importance level of the data in the second target block.

[0074] The user can classify the importance level of data when storing data, or directly classify the importance level of data in different storage areas of the solid state drive, which is not limited here.

[0075] After determining the importance level of the data, the wear leveling device of the solid state drive divides the data in the second target block into several importance levels according to the importance of the data in the second target block. Then, combined with the access frequency of the potential third target blocks screened in the previous step, one or more target blocks with relatively moderate access frequency are allocated to each level of data as the third target blocks in the order of importance from high to low.

[0076] For example, assume that the data in the second target block can be divided into three importance levels: high, medium, and low. At the same time, in the third target block screened out in the previous step, there are three blank blocks A, B, and C, whose access frequencies are 200 times, 500 times, and 800 times, respectively, which are between the first preset threshold and the second preset threshold. According to the principle of data importance matching, the wear leveling device of the solid-state drive will assign the block C with the lowest number of accesses to data of a high importance level, the block B with the second lowest access frequency to data of a medium importance level, and the block A with a relatively high access frequency to data of a low importance level.

[0077] In the above embodiment, the SSD wear leveling device selects the target blank data block as the migration target according to the importance of the data. The blank data blocks are sorted according to the access frequency, and the access frequency is positively correlated with the data importance level, so that important data can be stored in the block with moderate access frequency, reducing the risk of loss of important data due to storage block damage.

[0078] S209: If it is detected that the read and write frequency of the solid state drive exceeds a preset frequency threshold, data migration is suspended, and no read and write operations are performed on the third target block.

[0079] The user can set a preset frequency threshold, and the SSD wear leveling device will monitor the read and write operation frequency of the SSD in real time. Once it is found that the current read and write frequency exceeds the preset frequency threshold, it is determined that the SSD is in a relatively busy high-load state. Continuing data migration at this time may affect the read and write performance of normal business. Therefore, the SSD wear leveling device will immediately suspend the current data migration operation and mark all third target blocks involved, temporarily not allowing any form of read and write operations on these target blocks, thereby avoiding accidental changes in the data block status during the migration process from a mechanism perspective, and ensuring the atomicity and consistency of data migration.

[0080] In the above embodiment, the wear leveling device of the solid-state drive introduces real-time detection of the read and write frequency of the solid-state drive, and when it is detected that the read and write frequency exceeds the preset threshold, the data migration operation is suspended in time. This dynamic control migration scheme effectively avoids the performance degradation problem caused by data migration in high-frequency read and write scenarios, and reduces the impact of data migration on the real-time read and write performance of the solid-state drive.

[0081] S210: Do not perform data migration.

[0082] After obtaining the number of accesses to the first target block, the wear leveling device of the solid-state hard disk needs to further determine whether the number of accesses is less than a preset first threshold. For target blocks whose number of accesses is greater than or equal to the first preset threshold, data migration is not performed. This avoids unnecessary migration operations on data blocks that already have a certain number of accesses, reduces the number of migrations and the amount of data moved, reduces the consumption of the wear leveling mechanism itself on the life of the solid-state hard disk, and makes the implementation of wear leveling more efficient and accurate.

[0083] The wear leveling device for a solid state hard disk according to an embodiment of the present invention is an electronic device. Figure 3 A schematic diagram of the architecture of an electronic device suitable for implementing an embodiment of the present invention is shown.

[0084] It should be noted that Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0085] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructions (computer programs), or by controlling related hardware through instructions (computer programs), and the instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. The electronic device of this embodiment includes a storage medium and a processor, wherein a plurality of instructions are stored in the storage medium, and the instructions can be loaded by the processor to execute any step of the method provided in the embodiment of the present invention.

[0086] Specifically, the storage medium and the processor are electrically connected directly or indirectly to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more signal lines. The storage medium stores computer execution instructions for implementing the data access control method, including at least one software function module that can be stored in the storage medium in the form of software or firmware. The processor executes various functional applications and data processing by running the software program and module stored in the storage medium. The storage medium can be, but is not limited to, random access storage medium (Random Access Memory, referred to as: RAM), read-only storage medium (Read Only Memory, referred to as: ROM), programmable read-only storage medium (Programmable Read-Only Memory, referred to as: PROM), erasable read-only storage medium (Erasable Programmable Read-Only Memory, referred to as: EPROM), electrically erasable read-only storage medium (Electric Erasable Programmable Read-Only Memory, referred to as: EEPROM), etc. Among them, the storage medium is used to store programs, and the processor executes the program after receiving the execution instruction.

[0087] Furthermore, the software programs and modules in the above-mentioned storage medium may also include an operating system, which may include various software components and / or drivers for managing system tasks (such as memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide an operating environment for other software components. The processor may be an integrated circuit chip having signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., which may implement or execute the various methods, steps, and logic flow diagrams disclosed in this embodiment. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0088] Since the instructions stored in the storage medium can execute the steps in any method provided in the embodiments of the present invention, the beneficial effects of any method provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0089] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A control method for solid state hard disk storage wear leveling, applied to a solid state hard disk wear leveling device, characterized in that: The method comprises: Screening out a plurality of first target blocks in the solid state drive that have not been accessed within a preset time threshold; Obtaining the number of accesses to the first target block; If the access count is less than a first preset threshold, acquiring storage data and remaining capacity of the first target block; Integrate all target blocks according to the storage data and the remaining capacity to obtain a plurality of second target blocks, wherein the number of the second target blocks is less than or equal to the number of the first target blocks; The data in the second target block is migrated to a third target block, and the number of accesses to the third target block is between the first preset threshold and the second preset threshold.

2. The method according to claim 1, characterized in that The step of integrating all target blocks according to the storage data and the remaining capacity to obtain a plurality of second target blocks specifically includes: Determine two first target blocks that match the storage data and the remaining capacity; The two first target blocks are integrated to obtain a second target block.

3. The method according to claim 1, characterized in that The step of determining two first target blocks that match the storage data and the remaining capacity specifically includes: sorting the plurality of first target blocks in ascending order according to the storage data and the remaining capacity to obtain a first sequence and a second sequence; Selecting one first target block from the second sequence in turn and setting it as a target block to be matched; Selecting one or more temporary target blocks that can be integrated with the target block to be matched from the first sequence; The temporary target block storing the largest data and the target block to be matched are determined as two matching first target blocks.

4. The method according to claim 1, characterized in that: Before the step of migrating the data in the second target block to the third target block, the method further includes: Determine a blank data block whose access count is between the first preset threshold and the second preset threshold; Sorting the blank data blocks according to the number of accesses; A corresponding target blank data block is determined as the third target block according to the importance level of the data in the second target block, and the importance level is positively correlated with the number of accesses to the blank data block.

5. The method according to claim 1, characterized in that Before the step of migrating the data in the second target block to the third target block, the method further includes: Detect the current read and write frequency of the solid state drive; If the read and write frequency exceeds a preset frequency threshold, data migration is suspended.

6. The method according to claim 5, characterized in that After the step of detecting the current read and write frequency of the solid state hard disk, the method further includes: marking the third target block; No read or write operations are performed on marked data blocks.

7. The method according to claim 1, characterized in that After the step of obtaining the number of accesses to the first target block, the method further includes: If the access times are greater than or equal to the first preset threshold, data migration is not performed.

8. A wear leveling device for a solid state hard disk, characterized in that: The wear leveling device for a solid state hard disk comprises: one or more processors and a memory; The memory is coupled to the one or more processors, and the memory is used to store computer program code, wherein the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the solid state drive wear leveling device to execute the method as described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on a wear leveling device of a solid state drive, the wear leveling device of the solid state drive is caused to execute the method as described in any one of claims 1-7.

10. A computer program product, characterized in that When the computer program product runs on a solid state drive wear leveling device, the solid state drive wear leveling device is enabled to execute the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Data processing method and device for high-frequency read-write

    CN120215823A