CN108681435B - Wear leveling method, device, equipment and storage medium for solid state disk - Google Patents

Wear leveling method, device, equipment and storage medium for solid state disk Download PDF

Info

Publication number
CN108681435B
CN108681435B CN201810514481.6A CN201810514481A CN108681435B CN 108681435 B CN108681435 B CN 108681435B CN 201810514481 A CN201810514481 A CN 201810514481A CN 108681435 B CN108681435 B CN 108681435B
Authority
CN
China
Prior art keywords
data block
erasing times
recovered
solid state
actual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810514481.6A
Other languages
Chinese (zh)
Other versions
CN108681435A (en
Inventor
刘哲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201810514481.6A priority Critical patent/CN108681435B/en
Publication of CN108681435A publication Critical patent/CN108681435A/en
Application granted granted Critical
Publication of CN108681435B publication Critical patent/CN108681435B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Abstract

The embodiment of the invention discloses a wear leveling method, a wear leveling device, wear leveling equipment and a computer readable storage medium for a solid state disk. The method comprises the steps of calculating the priority of each data block in garbage collection according to the erasure number adjustment value of each data block and the number of effective data frames; the erasing times adjusting value is determined according to the actual erasing times and the deviation adjusting value, and the deviation adjusting value is set according to the abrasion target of the solid state disk; and determining the garbage recycling sequence of each data block according to the priority of each data block obtained by calculation in the process. The technical scheme provided by the application is simple and easy to implement, avoids the phenomenon that data blocks with fewer erasing times but more effective data frames are always concentrated and recovered in a short period, effectively solves the occurrence of cold data migration storm, improves the efficiency of recovering the available data blocks by a garbage recovery algorithm, enables the reading and writing efficiency of users to be free from influence, and is favorable for improving the stability and the reliability of the solid state disk.

Description

Wear leveling method, device, equipment and storage medium for solid state disk
Technical Field
The embodiment of the invention relates to the technical field of solid state disks, in particular to a method, a device and equipment for wear leveling of a solid state disk and a computer readable storage medium.
Background
With the rapid development and wide popularization and application of computer technologies such as the internet, cloud computing, the internet of things and the like, mass data can be generated at any moment in daily work or life and needs to be processed and stored, and the explosive growth of the data, the increase of the safety requirement of a user on the data and the high-speed development of the information technology all put higher requirements on the performance of a storage system.
SSD (Solid State Drives), also called Solid State disk, is a hard disk made of an array of Solid State electronic memory chips, and is composed of a control unit and a Solid State memory unit (FLASH chip or DRAM chip). Because of its stable performance (such as fast read-write speed and low energy consumption), it effectively overcomes many defects of mechanical hard disk, and the FLASH memory (FLASH chip) is more stable than DRAM, and the solid state disk whose storage medium is FLASH memory is widely used.
The storage unit of the solid state disk comprises a plurality of data blocks (blocks), and the data blocks are the minimum erasing unit of the solid state disk. Because the solid state disk has no rewriting mechanism, after a data block is fully written with data, the data on the data block needs to be erased to write new data, the erasing frequency of each data block is limited, the service life of the solid state disk depends on the data block with the minimum service life, in order to prolong the service life of the solid state disk, the erasing operation of each data block needs to be balanced, preferably, the erasing frequency of each data block is ensured to be the same, and the balancing frequency of the erasing operation of each data block is wear balancing.
In the use process of the solid state disk, it is necessary to effectively improve the space utilization rate of the solid state disk. In the process of reading and writing the solid state disk by a user, hot data is data which changes frequently, cold data is data which cannot change for a long time, effective data frames in a plurality of source data blocks can be moved to a new data block in a centralized mode through garbage collection, then the source data blocks are erased, and the space utilization rate of the solid state disk can be effectively improved.
In the data migration process, wear leveling is considered, and a source data block needs to be selected by comprehensively considering the number of valid data frames contained in a data block and the erasing times of the data block, but if a plurality of data blocks with lower erasing times need to be migrated within a period of time and the number of valid data frames contained in the data blocks is large, the data blocks cannot be recovered for a long time, the efficiency of recovering the valid data blocks is influenced, and the performance of a solid state disk is easily influenced. That is to say, in the prior art, when a source data block is garbage-recovered according to the wear leveling degree, a large number of data blocks with a large number of valid data frames are easily recovered within a short period of time, which results in low efficiency of available data blocks recovered by a garbage recovery algorithm, and further affects the read-write efficiency of a user.
Disclosure of Invention
The embodiment of the invention provides a wear leveling method, a wear leveling device, wear leveling equipment and a computer readable storage medium for a solid state disk, which are simple and easy to implement, can effectively prevent cold data migration storm and are beneficial to improving the stability and reliability of the solid state disk.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
an embodiment of the present invention provides a wear leveling method for a solid state disk, including:
calculating the priority of each data block in garbage collection according to the erasing times adjustment value and the number of effective data frames of each data block; the erasing times adjusting value is determined according to the actual erasing times and a deviation adjusting value, and the deviation adjusting value is set according to the abrasion target of the solid state disk;
and selecting the source data blocks for garbage recovery according to the priority of each data block.
Optionally, the determining the erase count adjustment value according to the actual erase count and the deviation adjustment value includes:
acquiring the average erasing times of the fixed hard disk and the actual erasing times of each data block;
judging whether the actual erasing times of the current data block are larger than the average erasing times or not;
if so, the erasing time adjustment value of the current data block is the sum of the actual erasing time value and the deviation adjustment value; if not, the adjustment value of the erasing times of the current data block is the difference between the actual erasing times and the deviation adjustment value.
Optionally, the selecting the garbage-recovered source data block according to the priority of each data block includes:
judging whether the actual erasing times of the data block to be recovered exceed the preset maximum erasing times or not;
if so, taking the next data block adjacent to the priority of the data block to be recovered as a candidate source data block, and if the actual erasing times of the candidate source data block do not exceed the maximum erasing times, taking the candidate source data block as a source data block for garbage recovery; if the actual erasing times of the candidate source data block exceed the maximum erasing times, judging whether the actual erasing times of a next data block adjacent to the candidate source data block priority exceeds a preset maximum erasing times;
and if not, taking the data block to be recovered as a source data block for garbage recovery.
Optionally, the selecting the garbage-recovered source data block according to the priority of each data block includes:
comparing the actual erasing times of the data block to be recovered and the next candidate data block adjacent to the priority of the data block to be recovered;
if the actual erasing times of the data block to be recovered are greater than the actual erasing times of the candidate data block, preferentially recovering the candidate data block;
and if the actual erasing times of the data block to be recovered are not more than the actual erasing times of the candidate data blocks, preferentially recovering the data block to be recovered.
Another aspect of an embodiment of the present invention provides a wear leveling apparatus for a solid state disk, including:
the priority calculating module is used for calculating the priority of each data block in the garbage recovery process according to the erasing times adjusting value and the number of effective data frames of each data block; the erasing times adjusting value is determined according to the actual erasing times and a deviation adjusting value, and the deviation adjusting value is set according to the abrasion target of the solid state disk;
and the source data block determining module is used for selecting the garbage-recovered source data blocks according to the priority of each data block.
Optionally, the priority calculating module includes:
the information acquisition submodule is used for acquiring the average erasing times of the fixed hard disk and the actual erasing times of each data block;
the erasure number judging submodule is used for judging whether the actual erasure number value of the current data block is larger than the average erasure number;
the adjustment submodule is used for adjusting the actual erasing times of the current data block to be larger than the average erasing times, and the erasing times adjustment value of the current data block is the sum of the actual erasing times and the deviation adjustment value; and if the actual erasing times of the current data block is not more than the average erasing times, the erasing times adjusting value of the current data block is the difference between the actual erasing times and the deviation adjusting value.
Optionally, the source data block determining module includes:
the judgment submodule is used for judging whether the actual erasing times of the data block to be recovered exceed the preset maximum erasing times;
judging an execution submodule, if the actual erasing times of the data block to be recovered exceed the preset maximum erasing times, taking the next data block adjacent to the priority of the data block to be recovered as a candidate source data block, and if the actual erasing times of the candidate source data block do not exceed the maximum erasing times, taking the candidate source data block as a source data block for garbage recovery; if the actual erasing times of the candidate source data block exceed the maximum erasing times, judging whether the actual erasing times of a next data block adjacent to the candidate source data block priority exceeds a preset maximum erasing times; and if the actual erasing times of the data block to be recovered do not exceed the preset maximum erasing times, taking the data block to be recovered as a source data block for garbage recovery.
Optionally, the source data block determining module includes:
the comparison submodule is used for comparing the actual erasing times of the data block to be recovered and the next candidate data block adjacent to the priority of the data block to be recovered;
the position adjusting submodule preferentially recovers the candidate data block if the actual erasing times of the data block to be recovered are greater than the actual erasing times of the candidate data block; and if the actual erasing times of the data block to be recovered are not more than the actual erasing times of the candidate data blocks, preferentially recovering the data block to be recovered.
The embodiment of the present invention further provides a wear leveling device for a solid state disk, which includes a processor, where the processor is configured to implement the steps of the wear leveling method for a solid state disk according to any one of the preceding items when executing a computer program stored in a memory.
Finally, an embodiment of the present invention provides a computer-readable storage medium, where a wear leveling program of a solid state disk is stored on the computer-readable storage medium, and when being executed by a processor, the wear leveling program of the solid state disk implements the steps of the wear leveling method of the solid state disk according to any one of the foregoing items.
The embodiment of the invention provides a wear leveling method of a solid state disk, which comprises the steps of firstly calculating the priority of each data block in garbage collection according to the erasing time adjustment value and the number of effective data frames of each data block; the erasing times adjusting value is determined according to the actual erasing times and the deviation adjusting value, and the deviation adjusting value is set according to the abrasion target of the solid state disk; and finally, selecting the source data blocks for garbage recovery according to the priority of each data block.
The technical scheme provided by the application has the advantages that when the calculation of the garbage collection priority is carried out and the sequence of collecting all the data blocks is determined, the actual erasing times of the data blocks are not directly used, but a random value is added to the erasing times of the data blocks, so that the erasing times of all the data blocks are scattered, the situation that only the data blocks containing cold data are collected for a long time in the garbage collection process is avoided, namely, the phenomenon that the data blocks with less erasing times but more effective data frames are collected all the time in a short period is avoided. The method is simple and easy to implement, can effectively solve the problem of cold data migration storm, improves the efficiency of recovering the usable data blocks by the garbage recovery algorithm, enables the read-write efficiency of users to be free of influence, and is favorable for improving the stability and reliability of the solid state disk.
In addition, the embodiment of the invention also provides a corresponding implementation device, equipment and a computer readable storage medium for the wear leveling method of the solid state disk, so that the method has higher practicability, and the device, the equipment and the computer readable storage medium have corresponding advantages.
Drawings
In order to more clearly illustrate the embodiments or technical solutions of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a wear leveling method for a solid state disk according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another wear leveling method for a solid state disk according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a wear leveling method for a solid state disk according to another embodiment of the present invention;
fig. 4 is a schematic flowchart of a wear leveling method for a solid state disk according to another embodiment of the present invention;
fig. 5 is a structural diagram of an embodiment of a wear leveling device for a solid state disk according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and claims of this application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements but may include other steps or elements not expressly listed.
Having described the technical solutions of the embodiments of the present invention, various non-limiting embodiments of the present application are described in detail below.
Referring to fig. 1, fig. 1 is a schematic flow chart of a wear leveling method for a solid state disk according to an embodiment of the present invention, where the embodiment of the present invention includes the following:
s101: and calculating the priority of each data block in garbage collection according to the erasure number adjustment value and the number of effective data frames of each data block.
S102: and selecting the source data blocks for garbage recovery according to the priority of each data block.
The erasing times of each data block reflect the service life of the data block, each data block in the solid state disk has fixed and limited erasing times, and the data block cannot be used after the erasing times of the data block are used up.
In the use process of the solid state disk, some data are frequently updated and are hot data, some data cannot be changed for a long time, the data are cold data, namely effective data frames, and when garbage is recovered, the cold data (the effective data frames) need to be migrated to other data blocks for storage, so that the space utilization rate of the whole solid state disk is improved.
In the garbage collection process, a large number of data blocks with low erasure times but a large number of effective data frames inevitably occur, and when a wear leveling mechanism is considered, the data blocks with low erasure times are necessarily and preferentially collected, so that the data blocks are collected for a long time, the number of effective data blocks collected by garbage is small, and the efficiency of collecting available data blocks by the whole garbage algorithm is reduced. In order to avoid this phenomenon (i.e. to avoid a cold data migration storm), the actual erase values of the data blocks may be dispersed, and the actual erase value of each data block may be shifted, i.e. the erase times of each data block are adjusted, i.e. the erase time adjustment value and the number of valid data frames are used as the basis for the sequence of the garbage collection data blocks.
The erase count adjustment value may be determined according to the actual erase count and the offset adjustment value, and the offset adjustment value may be set according to a wear target of the solid state disk, for example, 100.
In a specific embodiment, the erase count adjustment value may be calculated by:
acquiring an average erasing number value of the fixed hard disk and an actual erasing number value of each data block;
the average erasing number value is calculated according to the erasing number of each data block in the solid state disk and the number of the data blocks, and the actual erasing number value can be the current erasing number of each data block.
Judging whether the actual erasing times value of the current data block is larger than the average erasing times or not;
if so, the erasing time adjustment value of the current data block is the sum of the actual erasing time value and the deviation adjustment value; if not, the adjustment value of the erasing times of the current data block is the difference between the actual erasing times and the deviation adjustment value.
For example, if the average erase count value of the system is 120, the offset adjustment value is 50, and the actual erase count of the first data block is 100, the erase count adjustment value of the first data block may be 100-50; the actual erase count of the second data block is 150, and the erase count adjustment value of the second data block may be 150+ 50-200.
Of course, the erase count adjustment value for each data block may be determined in other ways, such as by setting four threshold ranges (greater than the maximum erase count value, less than the minimum erase count value, less than the maximum erase count value but greater than the average erase count value, greater than the minimum erase count value but less than the average erase count value) based on the maximum erase count value, the minimum erase count value, and the average erase count value (which is necessarily between the maximum erase count value and the minimum erase count value), and a deviation adjustment value is set in each range to judge the range in which the actual erasing times of the current data block is, and the actual erasing times are adjusted by using the deviation adjustment value, specifically how to adjust the actual erasing times by using the deviation adjustment value, a person skilled in the art can select the actual erasing times according to specific situations, and the application does not limit the actual erasing times.
In the technical scheme provided by the embodiment of the invention, when the calculation of the garbage collection priority is carried out and the sequence of collecting each data block is determined, the actual erasing times of the data blocks are not directly used, but a random value is added to the erasing times of the data blocks, so that the erasing times of each data block are dispersed, and the phenomenon that only the data blocks containing cold data are collected for a long time in the garbage collection process, namely the phenomenon that the data blocks with less erasing times but more effective data frames are collected all the time in a short time is avoided. The method is simple and easy to implement, can effectively solve the problem of cold data migration storm, improves the efficiency of recovering the usable data blocks by the garbage recovery algorithm, enables the read-write efficiency of users to be free of influence, and is favorable for improving the stability and reliability of the solid state disk.
Based on the foregoing embodiment, the present application further provides another embodiment, please refer to fig. 2, and fig. 2 is a schematic flow chart of another wear leveling method for a solid state disk according to the embodiment of the present invention, which specifically includes the following steps:
s201: and acquiring the average erasing times of the fixed hard disk and the actual erasing times of each data block.
S202: and judging whether the actual erasing frequency value of the current data block is greater than the average erasing frequency, if so, executing S203, and if not, executing S204.
S203: and calculating the sum of the actual erasing number value and the deviation adjusting value to be used as the erasing number adjusting value of the current data block.
S204: and calculating the difference between the actual erasing time value and the deviation adjusting value to be used as the erasing time adjusting value of the current data block.
S205: and calculating the priority of each data block in garbage collection according to the erasure number adjustment value and the number of effective data frames of each data block.
S206: and selecting the source data blocks for garbage recovery according to the priority of each data block.
Therefore, the embodiment of the invention is simple and easy to implement, can effectively prevent the occurrence of cold data migration storm, and is beneficial to improving the stability and reliability of the solid state disk.
Because the above embodiment disperses the actual erasing times of each data block when the wear is equalized, in order to further equalize the erasing times of each data block, based on the above embodiment, the present application further provides another embodiment, please refer to fig. 3, which may specifically include:
s301: and calculating the priority of each data block in garbage collection according to the erasure number adjustment value and the number of effective data frames of each data block.
Specifically, the description is the same as that of S101 in the above embodiment, and is not repeated here.
S302: and judging whether the actual erasing times of the current data block to be recycled exceed the preset maximum erasing times, if so, executing S303, and if not, executing S305.
The specific value of the maximum erasing time can be determined according to the fixed erasing time of the data block and the use condition of the whole solid state disk, for example, the fixed limited erasing time of each data block in the solid state disk is 200 times, and then the maximum erasing time can be 180 times.
S303: and taking the next data block adjacent to the priority of the current data block as a candidate source data block.
The data blocks can be sorted in advance from highest priority to lowest priority or from lowest priority to highest priority according to the priorities calculated in S301, and for the first data block with the highest priority, if the current actual erasure number (181) of the first data block exceeds the preset maximum erasure number (180), the second data block with the second priority is used as a candidate source data block for judgment.
S304: and judging whether the actual erasing times of the candidate source data block exceed the maximum erasing times, if so, executing S305, and if not, returning to S303.
S305: and taking the current data block or the candidate source data block as a source data block for garbage recovery.
After the priority is calculated, the data blocks with the erasing times lower than the preset maximum erasing times are further selected for preferential recovery, so that the data blocks with higher erasing times can be prevented from being excessively recovered, and the cold data storm can be prevented from occurring.
Therefore, the embodiment of the invention not only can effectively prevent the occurrence of cold data migration storm, but also can further balance the erasing times of each data block, thereby being beneficial to improving the stability and reliability of the solid state disk and prolonging the service life of the solid state disk.
In order to further equalize the erase times of the data blocks, the present application further provides another embodiment, please refer to fig. 4, which specifically includes:
s401: and calculating the priority of each data block in garbage collection according to the erasure number adjustment value and the number of effective data frames of each data block.
Specifically, the description is the same as that of S101 in the above embodiment, and is not repeated here.
S402: and judging whether the actual erasing times of the data block to be recovered is greater than the actual erasing times of the next candidate data block adjacent to the priority of the data block to be recovered, if so, executing S403, and if not, executing S404.
The data blocks can be sorted from highest priority to lowest priority or from lowest priority to highest priority according to the priorities calculated in S401, and for the first data block with the highest priority, if the current actual erasing times (181) of the first data block exceed the second data block (176) with the second priority, the second data block is preferentially recycled; if the current actual erasure count (181) exceeds the second data block (183) with the second priority, the first data block is preferentially recycled.
S403: the candidate data blocks are preferentially recycled.
S404: and preferentially recycling the data blocks to be recycled.
Therefore, the embodiment of the invention not only can effectively prevent the occurrence of cold data migration storm, but also can further balance the erasing times of each data block, thereby being beneficial to improving the stability and reliability of the solid state disk and prolonging the service life of the solid state disk.
The embodiment of the invention also provides a corresponding implementation device for the wear leveling method of the solid state disk, so that the method has higher practicability. In the following, the wear leveling device for a solid state disk provided in the embodiments of the present invention is introduced, and the wear leveling device for a solid state disk described below and the wear leveling method for a solid state disk described above may be referred to correspondingly.
Referring to fig. 5, fig. 5 is a structural diagram of a wear leveling apparatus for a solid state disk according to an embodiment of the present invention, where the apparatus may include:
a priority calculating module 501, configured to calculate a priority of each data block during garbage collection according to the erasure number adjustment value and the number of valid data frames of each data block; and the erasing time adjusting value is determined according to the actual erasing time and the deviation adjusting value, and the deviation adjusting value is set according to the abrasion target of the solid state disk.
A source data block determining module 502, configured to select a source data block for garbage collection according to the priority of each data block.
Optionally, in some implementations of this embodiment, the priority calculating module 501 may include:
the information acquisition submodule is used for acquiring the average erasing times of the fixed hard disk and the actual erasing times of each data block;
the erasure number judging submodule is used for judging whether the actual erasure number value of the current data block is larger than the average erasure number;
the adjustment submodule is used for adjusting the actual erasing time value of the current data block to be greater than the average erasing time, and the erasing time adjustment value of the current data block is the sum of the actual erasing time value and the deviation adjustment value; and if the actual erasing times of the current data block is not more than the average erasing times, the erasing times adjusting value of the current data block is the difference between the actual erasing times and the deviation adjusting value.
In a specific embodiment, the source data block determining module 502 may include, for example:
the judgment submodule is used for judging whether the actual erasing times of the data block to be recovered exceed the preset maximum erasing times;
judging an execution submodule, if the actual erasing times of the data block to be recovered exceed the preset maximum erasing times, taking the next data block adjacent to the priority of the data block to be recovered as a candidate source data block, and if the actual erasing times of the candidate source data block do not exceed the maximum erasing times, taking the candidate source data block as a source data block for garbage recovery; if the actual erasing times of the candidate source data block exceed the maximum erasing times, judging whether the actual erasing times of the next data block adjacent to the candidate source data block priority exceeds the preset maximum erasing times; and if the actual erasing times of the data block to be recovered do not exceed the preset maximum erasing times, taking the data block to be recovered as a source data block for garbage recovery.
In another specific implementation, the source data block determining module 502 may further include:
the comparison submodule is used for comparing the actual erasing times of the data block to be recovered and the next candidate data block adjacent to the priority of the data block to be recovered;
the position adjusting submodule preferentially recovers the candidate data block if the actual erasing times of the data block to be recovered are greater than the actual erasing times of the candidate data block; and if the actual erasing times of the data block to be recovered are not more than the actual erasing times of the candidate data blocks, preferentially recovering the data block to be recovered.
The functions of the functional modules of the wear leveling device for a solid state disk according to the embodiments of the present invention may be specifically implemented according to the method in the above method embodiments, and the specific implementation process may refer to the related description of the above method embodiments, which is not described herein again.
Therefore, the embodiment of the invention is simple and easy to implement, can effectively prevent the occurrence of cold data migration storm, and is beneficial to improving the stability and reliability of the solid state disk.
The embodiment of the present invention further provides a wear leveling device for a solid state disk, which specifically includes:
a memory for storing a computer program;
a processor for executing a computer program to implement the steps of the wear leveling method for a solid state disk according to any one of the above embodiments.
The functions of the functional modules of the wear leveling device of the solid state disk according to the embodiment of the present invention may be specifically implemented according to the method in the embodiment of the method, and the specific implementation process may refer to the related description of the embodiment of the method, which is not described herein again.
Therefore, the embodiment of the invention is simple and easy to implement, can effectively prevent the occurrence of cold data migration storm, and is beneficial to improving the stability and reliability of the solid state disk.
The embodiment of the present invention further provides a computer-readable storage medium, in which a wear leveling program of a solid state disk is stored, and the steps of the wear leveling method of the solid state disk according to any one of the above embodiments are performed when the wear leveling program of the solid state disk is executed by a processor.
The functions of the functional modules of the computer-readable storage medium according to the embodiment of the present invention may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Therefore, the embodiment of the invention is simple and easy to implement, can effectively prevent the occurrence of cold data migration storm, and is beneficial to improving the stability and reliability of the solid state disk.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The method, the apparatus, the device and the computer readable storage medium for wear leveling of a solid state disk provided by the present invention are described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

Claims (6)

1. A wear leveling method for a solid state disk is characterized by comprising the following steps:
calculating the priority of each data block in garbage collection according to the erasing times adjustment value and the number of effective data frames of each data block; the erasing times adjusting value is determined according to actual erasing times and a deviation adjusting value, the deviation adjusting value is set according to a wear target of the solid state disk, and the deviation adjusting value is a random value;
selecting a source data block for garbage recovery according to the priority of each data block;
wherein, the selecting the source data block for garbage collection according to the priority of each data block comprises:
comparing the actual erasing times of the data block to be recovered and the next candidate data block adjacent to the priority of the data block to be recovered;
if the actual erasing times of the data block to be recovered are greater than the actual erasing times of the candidate data block, preferentially recovering the candidate data block;
and if the actual erasing times of the data block to be recovered are not more than the actual erasing times of the candidate data blocks, preferentially recovering the data block to be recovered.
2. The method according to claim 1, wherein the selecting the source data blocks for garbage collection according to the priority of each data block comprises:
judging whether the actual erasing times of the data block to be recovered exceed the preset maximum erasing times or not;
if so, taking the next data block adjacent to the priority of the data block to be recovered as a candidate source data block, and if the actual erasing times of the candidate source data block do not exceed the maximum erasing times, taking the candidate source data block as a source data block for garbage recovery; if the actual erasing times of the candidate source data block exceed the maximum erasing times, judging whether the actual erasing times of a next data block adjacent to the candidate source data block priority exceeds a preset maximum erasing times;
and if not, taking the data block to be recovered as a source data block for garbage recovery.
3. A wear leveling apparatus for a solid state disk, comprising:
the priority calculating module is used for calculating the priority of each data block in the garbage recovery process according to the erasing times adjusting value and the number of effective data frames of each data block; the erasing times adjusting value is determined according to actual erasing times and a deviation adjusting value, the deviation adjusting value is set according to a wear target of the solid state disk, and the deviation adjusting value is a random value;
a source data block determining module, configured to select a source data block for garbage collection according to the priority of each data block; the source data block determination module includes:
the comparison submodule is used for comparing the actual erasing times of the data block to be recovered and the next candidate data block adjacent to the priority of the data block to be recovered;
the position adjusting submodule preferentially recovers the candidate data block if the actual erasing times of the data block to be recovered are greater than the actual erasing times of the candidate data block; and if the actual erasing times of the data block to be recovered are not more than the actual erasing times of the candidate data blocks, preferentially recovering the data block to be recovered.
4. The apparatus for wear leveling of a solid state disk according to claim 3, wherein the source data block determining module comprises:
the judgment submodule is used for judging whether the actual erasing times of the data block to be recovered exceed the preset maximum erasing times;
judging an execution submodule, if the actual erasing times of the data block to be recovered exceed the preset maximum erasing times, taking the next data block adjacent to the priority of the data block to be recovered as a candidate source data block, and if the actual erasing times of the candidate source data block do not exceed the maximum erasing times, taking the candidate source data block as a source data block for garbage recovery; if the actual erasing times of the candidate source data block exceed the maximum erasing times, judging whether the actual erasing times of a next data block adjacent to the candidate source data block priority exceeds a preset maximum erasing times; and if the actual erasing times of the data block to be recovered do not exceed the preset maximum erasing times, taking the data block to be recovered as a source data block for garbage recovery.
5. A wear leveling apparatus for a solid state disk, comprising a processor for implementing the steps of the wear leveling method for a solid state disk according to claim 1 or 2 when executing a computer program stored in a memory.
6. A computer-readable storage medium, wherein the computer-readable storage medium stores thereon a wear leveling program for a solid state disk, and the wear leveling program for a solid state disk, when executed by a processor, implements the steps of the wear leveling method for a solid state disk according to claim 1 or 2.
CN201810514481.6A 2018-05-25 2018-05-25 Wear leveling method, device, equipment and storage medium for solid state disk Active CN108681435B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810514481.6A CN108681435B (en) 2018-05-25 2018-05-25 Wear leveling method, device, equipment and storage medium for solid state disk

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810514481.6A CN108681435B (en) 2018-05-25 2018-05-25 Wear leveling method, device, equipment and storage medium for solid state disk

Publications (2)

Publication Number Publication Date
CN108681435A CN108681435A (en) 2018-10-19
CN108681435B true CN108681435B (en) 2021-06-29

Family

ID=63808187

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810514481.6A Active CN108681435B (en) 2018-05-25 2018-05-25 Wear leveling method, device, equipment and storage medium for solid state disk

Country Status (1)

Country Link
CN (1) CN108681435B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110618792B (en) * 2019-09-17 2023-08-29 深圳忆联信息系统有限公司 Internal task optimization method and device based on solid state disk and computer equipment
CN111090595B (en) * 2019-11-19 2022-12-20 中国航空工业集团公司西安航空计算技术研究所 NAND FLASH garbage recovery balanced optimization method
CN111090398B (en) * 2019-12-13 2022-06-17 北京浪潮数据技术有限公司 Garbage recycling method, device and equipment for solid state disk and readable storage medium
CN111414138B (en) * 2020-03-19 2024-02-13 镕铭微电子(济南)有限公司 Wear balancing method and device for solid state disk
CN111930300A (en) * 2020-06-28 2020-11-13 深圳佰维存储科技股份有限公司 Data writing method and device, computer readable storage medium and electronic equipment
CN113641304B (en) * 2021-07-05 2023-10-20 深圳市宏旺微电子有限公司 Method, device, terminal equipment and storage medium for managing data blocks
CN113608702A (en) * 2021-08-18 2021-11-05 合肥大唐存储科技有限公司 Method and device for realizing data processing, computer storage medium and terminal
CN115586874B (en) * 2022-11-24 2023-03-10 苏州浪潮智能科技有限公司 Data block recovery method and device, electronic equipment and storage medium
CN115599308B (en) * 2022-11-28 2023-03-21 苏州浪潮智能科技有限公司 Garbage recycling method and device for solid state disk, electronic equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8458133B2 (en) * 2011-01-24 2013-06-04 Apple Inc. Coordinating sync points between a non-volatile memory and a file system
CN106339324B (en) * 2016-08-19 2019-05-10 浪潮(北京)电子信息产业有限公司 A kind of method and device selecting garbage reclamation block
CN106528000B (en) * 2016-12-02 2019-12-31 苏州浪潮智能科技有限公司 Data storage device and read-write performance optimization method and system thereof
CN106775474B (en) * 2016-12-16 2020-01-10 苏州浪潮智能科技有限公司 Nand Flash wear leveling method and device and memory
CN106951193B (en) * 2017-03-27 2019-11-12 深圳佰维存储科技股份有限公司 Improve the method and its system of Nand Flash storage performance

Also Published As

Publication number Publication date
CN108681435A (en) 2018-10-19

Similar Documents

Publication Publication Date Title
CN108681435B (en) Wear leveling method, device, equipment and storage medium for solid state disk
US10216440B2 (en) Disk management in distributed storage system including grouping disks into cold and hot data disk rings and reducing a spinning rate of disks storing cold data
US10620839B2 (en) Storage pool capacity management
CN111090398B (en) Garbage recycling method, device and equipment for solid state disk and readable storage medium
CN106775474B (en) Nand Flash wear leveling method and device and memory
US8793427B2 (en) Remote memory for virtual machines
CN111124305B (en) Solid state disk wear leveling method and device and computer readable storage medium
CN102156738A (en) Method for processing data blocks, and data block storage equipment and system
CN101398749B (en) Static state attrition balancing method, device and system
CN108733324B (en) Data reading and writing method, device and equipment of solid state disk and storage medium
CN110673789B (en) Metadata storage management method, device, equipment and storage medium of solid state disk
CN104199784A (en) Data migration method and device based on hierarchical storage
CN109669621B (en) File management method, file management system, electronic device and storage medium
CN105138472B (en) Flash memory abrasion optimization method and equipment
KR20140109689A (en) Apparatus and method for optimization for improved performance and enhanced lifetime of hybrid flash memory devices
CN108153481B (en) NAND storage block recovery method and device
CN115114180A (en) Method and related controller for performing wear leveling operation in flash memory and storage system
CN109343796B (en) Data processing method and device
CN111435403A (en) Wear leveling method and device for flash memory system
CN116737064A (en) Data management method and system for solid state disk
CN113805812B (en) Cache management method, device, equipment and storage medium
CN116185624A (en) Garbage collection method and device for hard disk, computer equipment and storage medium
CN107924350B (en) Electronic equipment and data compression method thereof
CN108572924B (en) Request processing method of 3D MLC flash memory device
CN110364207B (en) Decoding method and storage controller

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant