CN112328169B - Wear leveling method and device for solid state disk and computer readable storage medium - Google Patents

Wear leveling method and device for solid state disk and computer readable storage medium Download PDF

Info

Publication number
CN112328169B
CN112328169B CN202011128180.3A CN202011128180A CN112328169B CN 112328169 B CN112328169 B CN 112328169B CN 202011128180 A CN202011128180 A CN 202011128180A CN 112328169 B CN112328169 B CN 112328169B
Authority
CN
China
Prior art keywords
flash memory
memory block
pool
cold
preset
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
CN202011128180.3A
Other languages
Chinese (zh)
Other versions
CN112328169A (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.)
Zhejiang Huayi Core Technology Co ltd
Original Assignee
Zhejiang Dahua 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 Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202011128180.3A priority Critical patent/CN112328169B/en
Publication of CN112328169A publication Critical patent/CN112328169A/en
Application granted granted Critical
Publication of CN112328169B publication Critical patent/CN112328169B/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
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to 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/0644Management of space entities, e.g. partitions, extents, pools
    • 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/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • 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/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • 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]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a wear leveling method, a wear leveling device and a storage medium for a solid state disk, wherein the method comprises the following steps: dividing the solid state disk into a hot pool and a cold pool according to the updating frequency of the flash memory block; wherein, the update frequency of the flash memory blocks in the hot pool is greater than that of the flash memory blocks in the cold pool; respectively acquiring the use conditions of flash memory blocks in a hot pool and a cold pool of the solid state disk; processing the flash memory block based on the usage, wherein the processing includes at least one of: and (3) carrying the flash memory blocks in the hot pool and/or the cold pool, and recycling the garbage of the flash memory blocks in the cold pool. Through the mode, the wear leveling effect of the solid state disk is better, and the service life of the solid state disk is prolonged.

Description

Wear leveling method and device for solid state disk and computer readable storage medium
Technical Field
The present application relates to the field of data storage technologies, and in particular, to a wear leveling method for a solid state disk, a wear leveling apparatus for a solid state disk, and a computer-readable storage medium.
Background
With the rapid development and wide application of computer technologies such as the internet, cloud computing and the internet of things, a large amount of data generated all the time in daily life needs to be stored, and the requirements of users on solid state disks for storing data are higher and higher.
For example, solid state disk (ssd) has been widely used because of its advantages of high performance, low power consumption, small size, large capacity, and better stability and reliability. When the solid state disk is used for storing data, the data are stored in the flash memory blocks, each flash memory block has a service life, and when the distribution of loads on the flash memory blocks is unbalanced, some flash memory blocks reach the service life first and become unusable, so that the performance of the solid state disk is gradually reduced. Due to the problem of uneven wear of the flash memory blocks, the service life of the solid state disk is difficult to guarantee, and the performance and the reliability of the solid state disk are reduced.
Disclosure of Invention
The application provides a method and a device for wear leveling of a solid state disk and a storage medium, which have a better wear leveling effect on the solid state disk and prolong the service life of the solid state disk.
In order to solve the technical problem, the application adopts a technical scheme that: provided is a wear leveling method for a solid state disk. The method comprises the following steps: dividing the solid state disk into a hot pool and a cold pool according to the updating frequency of the flash memory block; wherein, the update frequency of the flash memory blocks in the hot pool is greater than that of the flash memory blocks in the cold pool; respectively acquiring the use conditions of flash memory blocks in a hot pool and a cold pool of the solid state disk; processing the flash memory block based on the usage, wherein the processing includes at least one of: and (3) carrying the flash memory blocks in the hot pool and/or the cold pool, and recycling the garbage of the flash memory blocks in the cold pool.
In order to solve the above technical problem, another technical solution adopted by the present application is: provided is a device for wear leveling of a solid state disk. The device includes: the solid state disk wear leveling device comprises a processor and a memory, wherein the memory is used for storing a computer program, and the computer program realizes the wear leveling method of the solid state disk when being executed by the processor.
In order to solve the above technical problem, another technical solution adopted by the present application is: a computer-readable storage medium is provided. The computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the wear leveling method of the solid state disk described above.
The beneficial effect of this application is: the method comprises the steps that the solid state disk is divided into a hot pool and a cold pool according to the updating frequency of flash memory blocks, the cold pool and the hot pool are divided to manage data with different updating frequencies, the updating frequency of the flash memory blocks in the hot pool is greater than that of the flash memory blocks in the cold pool, so that the flash memory blocks with different updating frequencies are separately managed, the using conditions of the flash memory blocks in the hot pool and the cold pool are considered, the flash memory blocks in the hot pool and/or the cold pool are moved, the wear-leveling effect of the solid state disk is better, the performance of the solid state disk can be improved, and the service life of the solid state disk is prolonged; in addition, according to the application, the flash memory blocks with low updating frequency in the cold pool are subjected to garbage recovery according to the use condition of the flash memory blocks, so that the selection of the flash memory blocks of a garbage recovery source is more accurate, cold data can be prevented from occupying the flash memory blocks for a long time, and the wear balance effect is better.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a first embodiment of a wear leveling method for a solid state disk provided in the present application;
fig. 2 is a schematic flowchart of a second embodiment of a wear leveling method for a solid state disk provided in the present application;
fig. 3 is a schematic flowchart of a third embodiment of a wear leveling method for a solid state disk provided in the present application;
fig. 4 is a schematic flowchart of a fourth embodiment of a wear leveling method for a solid state disk provided in the present application;
FIG. 5 is a schematic structural diagram of a first embodiment of an apparatus for wear leveling of a solid state disk provided in the present application;
FIG. 6 is a schematic structural diagram of a second embodiment of an apparatus for wear leveling of a solid state disk provided in the present application;
fig. 7 is a schematic structural diagram of a computer-readable storage medium provided in the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all embodiments of the present application. 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 application.
The terms "first", "second" and "third" in this application are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any indication of the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of the feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless explicitly specifically limited otherwise. All directional indications (such as up, down, left, right, front, and rear … …) in the embodiments of the present application are only used to explain the relative positional relationship between the components, the movement, and the like in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indication is changed accordingly. Furthermore, the terms "include" and "have," 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 listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those skilled in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Through long-term research of the inventor of the application, the storage unit of the solid state disk comprises a plurality of flash memory blocks, data of the solid state disk is stored on the flash memory blocks, each flash memory block has a service life, the erasing frequency of each flash memory block is limited, if the erasing frequency of some flash memory blocks is extremely high, and the erasing frequency of other flash memory blocks is extremely low, part of flash memory blocks are quickly abraded to form bad blocks, so that the performance of the solid state disk is gradually reduced and becomes unusable. In order to prolong the service life of the solid state disk, the erasing operation of each flash memory block needs to be wear-balanced, so that the service life of each flash memory block is as long as possible and the service life of the whole solid state disk is prolonged.
In addition, in a monitoring scene, the main model is continuous writing and reading, most of data stored in the solid state disk is hot data, and cold data can be generated only when video locking and other conditions exist. When the solid state disk used for monitoring a scene is subjected to wear leveling, a general wear leveling algorithm needs to move more data to realize wear leveling, so that the data moving amount is high, and the performance and the service life of the solid state disk are influenced.
In order to solve the above problems, the present application provides the following embodiments, and the embodiments of the present application are explained below.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a first embodiment of a wear leveling method for a solid state disk according to the present application, where the method includes the following steps:
s110: dividing the solid state disk into a hot pool and a cold pool according to the updating frequency of the flash memory block; wherein the update frequency of the flash memory blocks in the hot pool is greater than the update frequency of the flash memory blocks in the cold pool.
When the solid state disk stores data, a double-pool management strategy can be adopted, the solid state disk is divided into a hot pool and a cold pool according to the updating frequency of the flash memory block, the hot data can be stored in the hot pool, and the cold data can be stored in the cold pool. Wherein the update frequency of the flash memory blocks in the hot pool is greater than the update frequency of the flash memory blocks in the cold pool. For example, during the use of the solid state disk, data with some data being updated frequently may be referred to as hot data, data with some data not changing for a long time, and data with little data being updated may be referred to as cold data. In addition, the hot pool may be used to write new data to store hot data and the cold pool may be used to store cold data.
The solid state disk can be partitioned or store space management data, wherein the hot pool and the cold pool can be respectively one area or storage space in the solid state disk, so that the hot data in the hot pool and the cold data in the cold pool can be stored in different areas or different storage spaces, and the hot data and the cold data with different update frequencies can be separately managed.
S120: and respectively acquiring the use conditions of the flash memory blocks in the hot pool and the cold pool of the solid state disk.
The storage unit of the solid state disk comprises a plurality of flash memory blocks, the flash memory blocks are the minimum erasing unit of the solid state disk, each flash memory block comprises a plurality of data pages, and the data pages are the minimum reading and writing unit.
The service condition at least comprises at least one of effective data page number, erasing frequency, cold pool adding time period and average erasing frequency of flash memory blocks in the solid state disk. The erasing times and the number of the flash memory blocks in the solid state disk can be obtained to obtain the average erasing times of the flash memory blocks in the solid state disk, wherein the erasing times represent the erasing times and the writing times, the number of effective data pages is the number of effective data pages stored in the flash memory blocks, the time period of adding the flash memory blocks into the cold pool can represent the time length of the flash memory blocks in the hot pool after being added into the cold pool, for example, after the flash memory blocks in the hot pool are counted into the cold pool, the time period of adding the flash memory blocks into the cold pool can be represented by the increased value of the average erasing times of the flash memory blocks in the solid state disk. It is understood that the time period of adding the flash memory block into the cold pool in the present application may also be represented by other data, for example, an increased value of the total erasing times of the flash memory block in the solid state disk, and the present application does not limit this.
S130: processing the flash memory block based on the usage, wherein the processing includes at least one of: and (3) carrying the flash memory blocks in the hot pool and/or the cold pool, and recycling the garbage of the flash memory blocks in the cold pool.
And carrying out wear leveling treatment on the flash memory blocks based on the service conditions of the flash memory blocks in the solid state disk. The erasing operation of the flash memory blocks can be controlled, and the erasing times of all data in the solid state disk are balanced as much as possible, so that the excessive erasing times of some flash memory blocks are avoided.
Because the cold data and the hot data are stored separately, the use condition of the data in the cold pool and the hot pool can be analyzed so as to balance the erasing times of the flash memory blocks in the cold pool and the hot pool. The flash memory blocks in the hot pool and the cold pool can be moved, and specifically, the erasing times of the flash memory blocks in the hot pool and the cold pool can be compared based on the obtained erasing times of each flash memory block in the hot pool and the cold pool so as to move the flash memory blocks in the hot pool and/or the cold pool; or the flash memory blocks with large erasing times in the hot pool and the flash memory blocks with small erasing times in the cold pool are moved; in addition, whether the hot data in the hot pool is changed into cold data or not can be judged, the corresponding flash memory blocks changed into the cold data are added into the cold pool, and the like, which is not limited by the application. For example, the data stored in the flash memory block with the smaller wear degree in the cold pool is moved to the flash memory block with the larger wear degree in the hot pool, so that the flash memory block with the smaller wear degree is subjected to read-write operation, and the erasing times of all the data in the solid state disk are balanced.
In addition, garbage collection can be performed on the flash memory blocks in the cold pool, the use conditions of the flash memory blocks in the cold pool can be compared, so that the flash memory blocks which are long in time period, few in erasing frequency and few in effective data page number are collected and added into the cold pool, and the erasing frequency of all data in the solid state disk is balanced.
In this embodiment, the solid state disk is divided into a hot pool and a cold pool according to the update frequency of the flash memory blocks, the cold pool and the hot pool are divided to manage data with different update frequencies, the update frequency of the flash memory blocks in the hot pool is greater than the update frequency of the flash memory blocks in the cold pool, so that the flash memory blocks with different update frequencies are separately managed, the use conditions of the flash memory blocks in the hot pool and the cold pool are considered, optimization is performed according to a monitoring scene, the flash memory blocks in the hot pool and/or the cold pool are moved, the wear leveling effect of the solid state disk in the monitoring scene is better, the performance of the solid state disk can be improved, and the service life of the solid state disk is prolonged; in addition, according to the use condition of the flash memory blocks, such as the number of effective data pages, erasing and writing times and the time period of adding the flash memory blocks into the cold pool, the cold pool is subjected to garbage recovery to release idle blocks, when garbage recovery source flash memory blocks are selected, the factors of the three aspects are fully considered, the data moving amount can be reduced, and the unbalanced wear caused by the fact that the flash memory blocks of the cold pool stay in the cold pool all the time can be prevented; furthermore, the flash memory blocks in the cold pool and the hot pool are moved under the condition that the combination of the solid state disk is suitable for monitoring scenes, so that the moving amount of data can be reduced, and the wear leveling efficiency is better.
In some embodiments, the flash blocks in the hot pool may be added to the cold pool to move the flash blocks based on the usage of the flash blocks.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating a second embodiment of a method for wear leveling of a solid state disk provided in the present application, where the method includes the following steps:
s210: based on the increased value of the average erasing times of the flash memory blocks in the hot pool and the number of effective data pages.
The erasing times of each flash memory block in the hot pool and the number of the flash memory blocks can be obtained to obtain the average erasing times of the flash memory blocks in the hot pool, and the average erasing times of the flash memory blocks in the hot pool can be counted in a period of time to obtain the added value of the average erasing times of the flash memory blocks. In addition, the number of valid data pages is the number of valid data pages stored in the flash block in the hot pool.
S220: and adding the flash memory blocks which meet the preset conditions of the cold data in the hot pool into the cold pool.
Wherein, satisfying the preset condition of the cold data includes: the increase value of the average erasing times of the flash memory blocks of the solid state disk reaches a preset second threshold value, and the erasing times of the flash memory blocks are not increased; the number of valid data pages of the flash block continues to be constant.
If the increase value of the average erasing times of the flash memory block of the solid state disk reaches the preset second threshold value, the read-write time period of the solid state disk can be indirectly represented, if the increase value of the average erasing times of the flash memory block of the solid state disk reaches the preset second threshold value, the erasing times of the flash memory block are not increased, the effective data page number of the flash memory block is continuously kept unchanged, the data stored in the current flash memory block is represented to be not updated in a long period of time, the data stored in the current flash memory block can be represented to be cold data, the flash memory block can be added into a cold pool, and at the moment, the data do not need to be moved. For example, when the increase value of the average erasing times of the flash memory block in the solid state disk reaches 1 in a period of time, but the erasing times of the flash memory block are not increased, and the number of effective data pages of the flash memory block is kept unchanged continuously, the flash memory block and the stored data can be added into a cold pool together, and the data does not need to be moved. In some application scenarios, the preset condition that satisfies the cold data may also be a characteristic condition of other cold data, which is not limited in the present application.
If the data stored in the flash memory block in the hot pool meets the preset condition of the cold data, the data stored in the flash memory block is the cold data, the flash memory block and the data stored in the flash memory block can be added into the cold pool together, and at the moment, the data does not need to be moved.
In this embodiment, by judging the condition that the hot data in the hot pool is changed into the cold data and optimizing according to the monitoring scene, the flash memory blocks meeting the cold data condition in the hot pool can be rapidly added into the cold pool, which is beneficial to subsequent wear leveling treatment.
In some embodiments, based on the usage, garbage collection may be performed on the flash memory blocks in the cold pool, please refer to fig. 3, where fig. 3 is a schematic flowchart of a third embodiment of a method for wear leveling of a solid state disk provided in the present application, where the method includes the following steps:
s310: and acquiring the number of free flash memory blocks in the solid state disk, wherein the flash memory blocks can write new data.
The method comprises the steps of obtaining the number of idle flash blocks capable of writing new data in the solid state disk, wherein the number of the idle flash blocks can represent the idle storage space of the current solid state disk, and if the solid state disk does not have enough idle storage space, a part of space of the solid state disk can be occupied by invalid data, for example, the invalid data is data deleted by an operating system, and performing garbage collection on the flash blocks in the solid state disk to clean the invalid data. If the solid state disk has enough free storage space, garbage collection is not needed, and garbage collection of the flash memory block can be stopped.
S320: it is determined whether the number of free flash blocks is below a preset first number threshold.
In step S320, if the number of free flash memory blocks is lower than the preset first number threshold, step 330 is executed; otherwise, step S310 may be continuously executed or the process may be ended, which is not limited in this application.
S330: and starting to recycle the garbage of the flash memory block.
When the number of the idle flash memory blocks is lower than the preset first number threshold, the solid state disk may not have enough idle storage space, or the current idle storage space of the solid state disk is lower, and garbage collection of the flash memory blocks can be started to collect garbage of the flash memory blocks in the cold pool.
S340: and obtaining the priority value of the flash memory block based on the effective data page number, erasing times and the cold pool adding time period of the flash memory block.
The method can obtain the priority value of each flash block in the cold pool based on the effective data page number, erasing and writing times and the cold pool adding time period of the flash blocks in the solid state disk cold pool, and can recycle the garbage of the flash blocks in the cold pool so as to recycle the flash blocks with less effective data page number, less erasing and writing times and long cold pool adding time period.
Wherein, based on the effective data page number, the erasing and writing times of the flash memory block and the time period of adding the flash memory block, the priority value of the flash memory block is obtained, which comprises the following steps: the priority value of the flash block is obtained by the following formula:
Figure BDA0002734254690000081
in the above formula, θ 123 =1;
Wherein P represents a priority value of the flash block; a. the max Indicating the maximum valid data page number of the flash memory block in the cold pool, A indicating the valid data page number of the current flash memory block, A min A minimum number of valid data pages representing the flash block in the cold pool; b max Represents the maximum number of times of erasing and writing the flash memory block in the cold pool, B min Representing the minimum erasing times of the flash memory block in the cold pool, and B representing the erasing times of the current flash memory block; c represents the time period of adding the current flash block into the cold pool, C max Indicating the maximum time period for adding a flash block to the cold pool, C min Represents the minimum time period for adding the flash memory block into the cold pool; theta 1 、θ 2 And theta 3 Respectively representing a preset first weight, a preset second weight and a preset third weight.
The time period of adding the flash memory blocks into the cold pool can be represented by the time length of the flash memory blocks in the hot pool after adding the flash memory blocks into the cold pool, for example, the time period of adding the flash memory blocks into the cold pool can be represented by the increased value of the average erasing times of the flash memory blocks in the solid state disk after the flash memory blocks in the hot pool are counted into the cold pool. In addition, the preset first weight, the preset second weight and the preset third weight, which correspond to the number of valid data pages, the erasing times and the time period of adding the cold pool, respectively, may represent the importance degree of each item, and the preset first weight, the preset second weight and the preset third weight may be set according to specific application conditions, which is not limited in this application.
S350: and taking the flash memory blocks with the priority values meeting the preset recovery conditions as source flash memory blocks for garbage recovery to carry out garbage recovery.
The preset recovery condition is that the priority value is the maximum, the larger the priority value of the flash memory block is, the smaller the number of effective data pages of the flash memory block is, the smaller the erasing frequency is, and the longer the time period for adding the flash memory block into the cold pool is, so as to recover the flash memory block with the maximum priority value in the cold pool, and the flash memory block with the maximum priority value can be used as a source flash memory block for garbage recovery to perform garbage recovery. For example, the current flash memory block with the largest priority value in the cold pool may be used as the source flash memory block, the valid data in the current flash memory block may be moved to other flash memory blocks, the data in the current flash memory block may be erased, and the flash memory block after the data is erased may be added to the free block linked list.
S360: and judging whether the number of the idle flash memory blocks is higher than a preset second number threshold.
Wherein the preset second number threshold is greater than the preset first number threshold.
In step S360, if the number of idle flash memory blocks is higher than the preset second number threshold, step S370 is executed; otherwise, the above step S340 is continuously executed.
S370: and stopping garbage collection of the flash memory blocks.
If the number of the idle flash memory blocks is higher than the preset second number threshold, the solid state disk has enough idle storage space, garbage collection is not needed at the moment, and garbage collection of the flash memory blocks in the cold pool can be stopped.
In the embodiment, the priority value of the flash memory block is obtained by calculation according to the effective data page number, erasing times and the time period of adding the flash memory block into the cold pool, and the flash memory block with the largest priority value is recovered, so that the wear balance of the flash memory block can be realized, and the service life of the solid state disk is prolonged; meanwhile, the flash memory block with the largest recovery priority, namely the flash memory block with the smaller number of pages of the recovered effective data, the smaller erasing and writing frequency and the longer time period for adding the flash memory block into the cold pool can take account of the data moving amount and the erasing and writing frequency of the flash memory block, and the phenomenon that a certain flash memory block stays in the cold pool for too long time can be avoided, so that the wear balance effect of the solid state disk is better.
In some embodiments, based on the usage, the erasing times of the flash memory blocks in the hot pool and the cold pool are compared, and the flash memory blocks in the hot pool and the cold pool are moved to realize static wear balance. Referring to fig. 4, fig. 4 is a schematic flowchart illustrating a fourth embodiment of a wear leveling method for a solid state disk according to the present application, where the method includes the following steps:
s410: and searching a first flash memory block with the maximum erasing times in the hot pool and a second flash memory block with the minimum erasing times in the cold pool.
The flash memory blocks in the hot pool can frequently carry out data writing operation, and the flash memory blocks in the cold pool can rarely carry out data updating. The erasing times of the flash memory blocks in the hot pool and the cold pool can be compared based on the erasing times of the flash memory blocks in the hot pool and the cold pool, the flash memory blocks in the hot pool and the cold pool are moved, static wear balance is achieved, and the erasing times of the flash memory blocks in the cold pool and the hot pool are balanced as much as possible. The first flash memory block with the maximum erasing times in the hot pool is found, and because the erasing times of the first flash memory block are the maximum, the using times are the maximum, and the abrasion degree of the first flash memory block in the hot pool is also the most serious. Similarly, the second flash block with the smallest erase times in the cold pool may be searched, which may indicate that the second flash block is least worn in the cold pool.
S420: and judging whether the difference value between the maximum erasing times and the minimum erasing times exceeds a preset first threshold value.
If the first flash memory Block with the maximum erasing times in the hot pool is recorded as Block 1, the second flash memory Block with the minimum erasing times in the cold pool is recorded as Block 2, and whether the difference value between the maximum erasing times and the minimum erasing times exceeds a preset first threshold value or not can be recorded as Block 1-Block 2> TH, wherein TH is represented as the preset first threshold value. The preset first threshold may be set according to a specific use condition, which is not limited in this application.
In the step S420, if it is determined that the threshold exceeds the preset first threshold, the step S430 is executed, otherwise, the step S410 may be continuously executed or the process is ended, which is not limited in this application.
S430: and marking the first flash memory block so as to move the first flash memory block and the second flash memory block based on the effective data page number of the first flash memory block, thereby realizing static wear balance.
Marking the first flash memory block with the maximum erasing times in the hot pool to determine that the first data is the flash memory block to be moved, and marking the first data by using a flag bit to be moved of the flash memory block, for example, in the flag bit, using "1" to indicate the flash memory block to be moved, changing the effective data page number of the first flash memory block waiting for the flag into a preset page number threshold value, and using "0" to indicate that the first flash memory block is not the flash memory block to be moved. The manner of marking the first flash memory block may have various forms, which is not limited in this application. And marking the first flash memory block, and after the flash memory block is determined to be moved, moving the first flash memory block and the second flash memory block based on the effective data page number of the first flash memory block so as to realize static wear balance.
In some embodiments, the second flash memory block with the minimum erasing times in the cold pool may also be marked, and it is understood that the second flash memory block with the minimum erasing times may also be marked in the form of a flag bit, for example, a "1" is used to indicate that the flash memory block is to be moved, and a "0" is used to indicate that the flash memory block is not to be moved, which is not limited in this application.
In some embodiments, after step S430, the following steps may be further included:
s440: and judging whether the effective data page number of the first flash memory block in the preset time is equal to a preset page number threshold value or not.
The preset threshold may be a fixed threshold, and if the preset page number threshold is zero, it is determined whether the number of valid data pages of the first flash memory block within the preset time reaches the preset page number threshold, so as to determine that the number of valid data pages in the first flash memory block is zero, that is, all data in the current first flash memory block are invalid data. The preset time can be set according to a specific use scene of the solid state disk, which is not limited in the present application.
In step S440, if the number of valid data pages of the first flash memory block in the preset time is equal to the preset page number threshold, step S450 is executed, otherwise, steps S460 to S470 are executed.
S450: and moving the first flash memory block in the hot pool and the second flash memory block in the cold pool to realize static wear balance.
If the effective data page number of the first flash memory block in the preset time is equal to the preset page number threshold, namely after the effective data page number of the first flash memory block with the maximum erasing frequency becomes zero, data transfer can be carried out on the first flash memory block marked in the hot pool and the second flash memory block in the cold pool.
In some embodiments, moving the first flash block in the hot pool and the second flash block in the cold pool may include the following: and erasing the data stored in the first flash memory block, moving the data stored in the second flash memory block to the first flash memory block for storage, adding the first flash memory block with the data moved in the storage into the cold pool, and adding the second flash memory block with the data moved into the idle block linked list.
Specifically, if the number of valid data pages of the first flash memory block becomes zero, since all data stored in the first flash memory block are invalid data, at this time, the invalid data in the first flash memory block can be erased, the data stored in the second flash memory block is moved to the erased first flash memory block for storage, after the data movement is completed, the first flash memory block stores the movement data of the second flash memory block, and the first flash memory block with a large number of erasing times is added into the cold pool. After the second flash memory block is subjected to data transfer, the second flash memory block has no data, and the second flash memory block in the cold pool can be added into the idle block linked list, so that data can be written into the second flash memory block with less erasing times subsequently.
S460: and judging whether the first flash memory block in the hot pool meets the preset condition of the cold data.
If the number of valid data pages of the first flash memory block in the preset time is not equal to the preset page number threshold, for example, the number of valid data pages of the first flash memory block in the preset time is not reduced to zero, it may be further determined whether the first flash memory block in the hot pool meets the preset condition of the cold data, so as to add the first flash memory block in the hot pool to the cold pool. In some application scenarios, it may be determined whether a first flash block in the hot pool satisfies a preset condition for cold data at a first time.
Wherein, satisfying the preset condition of the cold data includes: the increase value of the average erasing times of the flash memory blocks of the solid state disk reaches a preset second threshold value, and the erasing times of the first flash memory block are not increased; and/or the number of valid data pages of the first flash memory block is continuously unchanged.
The method includes the steps that the average erasing times increment value of a flash memory block of the solid state disk reaches a preset second threshold value, the reading and writing time period of the solid state disk can be indirectly represented, if the average erasing times increment value of the flash memory block of the solid state disk reaches the preset second threshold value, the erasing times of a first flash memory block are not increased, the effective data page number of the first flash memory block is continuously kept unchanged, the data stored in the current first flash memory block are not updated within a long period of time, the data stored in the current first flash memory block can be represented as cold data, the first flash memory block can be added into a cold pool, and at the moment, the data do not need to be moved. For example, when the increase value of the average erasing times of the solid state disk reaches 3, but the erasing times of the first flash memory block is not increased, and the number of valid data pages of the first flash memory block is kept unchanged, the first flash memory block and the stored data can be added into the cold pool together, and the data does not need to be moved.
In step S460, if the predetermined condition of the cold data is satisfied, step S470 is executed, otherwise, the above step S440 may be continuously executed.
In some embodiments, the above steps S440 and S460 may be performed simultaneously, for example, when it is determined whether the number of valid data pages of the first flash memory block in the preset time is less than or equal to the preset page number threshold, the preset time is not reached, but the first flash memory block is determined to satisfy the preset condition for adding cold data, and then the first flash memory block may be added to the cold pool. Alternatively, step S460 may be executed first, and step S440 may be executed again when the first flash memory block in the hot pool does not satisfy the preset condition of the cold data. The present application may be configured according to specific application conditions, and the present application is not limited to this.
S470: and adding the first flash memory block into the cold pool.
If the data stored in the first flash memory block meets the preset condition of the cold data, the data stored in the first flash memory block is the cold data, the first flash memory block and the data stored in the first flash memory block can be added into the cold pool together, and at the moment, the data does not need to be moved.
In step S470, after the first flash memory block is added to the cold pool, step S410 may be continuously executed, the flash memory block with the maximum erasing frequency is continuously searched in the hot pool as a new first flash memory block, and the step of determining whether the difference between the maximum erasing frequency and the minimum erasing frequency exceeds a preset first threshold is executed.
Different from the above embodiment, in this embodiment, because the first flash memory block with the largest number of times of erasing and writing in the hot pool is marked to determine that the first flash memory block is the to-be-first flash memory block, when the number of valid data pages of the first flash memory block becomes zero, data transfer between the first flash memory block and the second flash memory block is performed, so that the data transfer amount is reduced, the performance of the solid state disk is improved, and the service life of the solid state disk is prolonged.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a first embodiment of a device for wear leveling of a solid state disk provided in the present application, where the device 500 for wear leveling of a solid state disk includes a dividing module 510, an obtaining module 520, a moving module 530, and a recycling module 540.
The dividing module 510 is configured to divide the solid state disk into a hot pool and a cold pool according to the update frequency of the flash memory block; wherein the update frequency of the flash memory blocks in the hot pool is greater than the update frequency of the flash memory blocks in the cold pool.
The obtaining module 520 is configured to obtain the use conditions of the flash memory blocks in the hot pool and the cold pool of the solid state disk respectively; the service condition at least comprises at least one of effective data page number, erasing frequency, cold pool adding time period and average erasing frequency of flash memory blocks in the solid state disk.
Processing the flash memory block based on the usage, wherein the processing includes at least one of: and (3) carrying the flash memory blocks in the hot pool and/or the cold pool, and recycling the garbage of the flash memory blocks in the cold pool.
The move module 530 is used to move the flash blocks in the hot and/or cold pools based on usage.
In some embodiments, the moving module 530 is used for moving flash blocks in the hot and cold pools, including: based on the erasing frequency of each flash memory block in the hot pool and the cold pool; and comparing the erasing times of the flash memory blocks in the hot pool and the cold pool, and carrying out data transfer on the flash memory blocks in the hot pool and the cold pool to realize static wear balance.
In some embodiments, comparing the erasing times of the flash memory blocks in the hot pool and the cold pool, and moving the data of the flash memory blocks in the hot pool and the cold pool to realize static wear leveling includes: searching a first flash memory block with the maximum erasing times in the hot pool and a second flash memory block with the minimum erasing times in the cold pool; judging whether the difference value of the maximum erasing times and the minimum erasing times exceeds a preset first threshold value or not; if the first flash memory block exceeds the preset first threshold value, the first flash memory block is marked, and the first flash memory block and the second flash memory block are moved based on the number of valid data pages of the first flash memory block. And waiting for the effective data page number of the first flash memory block to become a preset page number threshold value, wherein the preset page number threshold value is zero. Judging whether the effective data page number of the first flash memory block in the preset time is equal to a preset page number threshold value or not; and if the effective data page number of the first flash memory block in the preset time is equal to the preset page number threshold value, moving the first flash memory block in the hot pool and the second flash memory block in the cold pool.
Move the first flash memory block in the hot pond and the second flash memory block in the cold pond, include: erasing the data stored in the first flash memory block, and moving the data stored in the second flash memory block to the first flash memory block for storage; and adding the first flash memory block which stores the moved data into a cold pool, and adding the second flash memory block which performs data movement into an idle block linked list after erasing the data.
If the effective data page number of the first flash memory block in the preset time is not equal to the preset page number threshold, judging whether the first flash memory block in the hot pool meets the preset condition of cold data or not; and if the preset condition of the cold data is met, adding the first flash memory block into the cold pool, continuously searching the flash memory block with the maximum erasing and writing times in the hot pool as a new first flash memory block, and executing the step of judging whether the difference value between the maximum erasing and writing times and the minimum erasing and writing times exceeds a preset first threshold value.
Wherein, satisfying the preset condition of the cold data comprises: the increase value of the average erasing times of the flash memory blocks of the solid state disk reaches a preset second threshold value, and the erasing times of the first flash memory block are not increased; the number of valid data pages of the first flash block continues to be constant.
In some embodiments, the migration module 530 is further configured to add the flash memory blocks in the hot pool that satisfy the preset condition of the cold data into the cold pool based on the increased value of the average erase times of the flash memory blocks in the hot pool and the number of valid data pages. Wherein, satisfying the preset condition of the cold data comprises: the increase value of the average erasing times of the flash memory blocks of the solid state disk reaches a preset second threshold value, and the erasing times of the flash memory blocks are not increased; the number of valid data pages of the flash block continues to be constant.
The recovery module 540 is used for performing garbage recovery on the flash memory blocks in the cold pool based on the use condition.
In some embodiments, the reclamation module 540 is configured to garbage reclaim the flash memory blocks, including: obtaining the priority value of the flash memory block based on the effective data page number, erasing times and the cold pool adding time period of the flash memory block; and taking the flash memory blocks with the priority values meeting the preset recovery conditions as source flash memory blocks for garbage recovery to carry out garbage recovery. Wherein the preset recovery condition is that the priority value is maximum.
In some embodiments, the priority value of the flash block is obtained using the following equation:
Figure BDA0002734254690000151
in the above formula, θ 123 =1;
Wherein P represents a priority value of the flash block; a. the max Indicating the maximum valid data page number of the flash memory block in the cold pool, A indicating the valid data page number of the current flash memory block, A min A minimum number of valid data pages representing the flash block in the cold pool; b is max Represents the maximum number of times of erasing and writing the flash memory block in the cold pool, B min Representing the minimum erasing times of the flash memory block in the cold pool, and B representing the erasing times of the current flash memory block; c represents the time period of adding the current flash block into the cold pool, C max Indicating the maximum time period for adding a flash block to the cold pool, C min Represents the minimum time period for adding the flash memory block into the cold pool; theta 1 、θ 2 And theta 3 Respectively representing a preset first weight, a preset second weight and a preset third weight.
In some embodiments, the obtaining module 520 is further configured to obtain the number of free flash memory blocks in the solid state disk, where new data can be written; the recovery module 540 is further configured to determine whether the number of idle flash memory blocks is lower than a preset first number threshold; if the number of the idle flash memory blocks is lower than a preset first number threshold, starting garbage collection on the flash memory blocks; after garbage collection is carried out on the flash memory blocks, whether the number of the idle flash memory blocks is higher than a preset second number threshold value or not is judged; and if the number of the idle flash memory blocks is higher than a preset second number threshold, stopping garbage collection of the flash memory blocks, wherein the preset second number threshold is larger than the preset first number threshold.
The specific implementation of this embodiment can refer to the implementation process of the above embodiment, and is not described herein again.
With reference to the foregoing embodiments, the present application provides an apparatus for wear leveling of a solid state disk, please refer to fig. 6, fig. 6 is a schematic structural diagram of a second embodiment of the apparatus for wear leveling of a solid state disk provided in the present application, and the apparatus 600 for wear leveling of a solid state disk includes: the wear leveling device comprises a processor 610 and a memory 620, wherein the processor 610 is connected with the memory 620, and the memory 620 is used for storing a computer program, and the computer program is executed by the processor 610 to realize the wear leveling method of the solid state disk.
In this embodiment, the processor 610 may also be referred to as a CPU (Central Processing Unit). The processor 610 may be an integrated circuit chip having signal processing capabilities. The processor 610 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor 610 may be any conventional processor or the like.
The specific implementation of this embodiment can refer to the implementation process of the above embodiment, and is not described herein again.
For the method of the above embodiment, it can be implemented by using a computer program, so that the present application provides a computer readable storage medium, please refer to fig. 7, where fig. 7 is a schematic structural diagram of the computer readable storage medium provided by the present application. The computer-readable storage medium 700 of the present embodiment stores therein a computer program 710 that can be executed by a processor to implement the method in the above-described embodiments.
The computer-readable storage medium 700 of this embodiment may be a medium that can store program instructions, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, or may be a server that stores the program instructions, and the server may send the stored program instructions to other devices for operation, or may self-execute the stored program instructions.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be apparent to those skilled in the art that the modules or steps of the present application described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and they may alternatively be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, or fabricated separately as individual integrated circuit modules, or fabricated as a single integrated circuit module from multiple modules or steps. Thus, the present application is not limited to any specific combination of hardware and software.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (13)

1. A wear leveling method for a solid state disk, the method comprising:
dividing the solid state disk into a hot pool and a cold pool according to the updating frequency of the flash memory block; wherein the update frequency of the flash memory blocks in the hot pool is greater than the update frequency of the flash memory blocks in the cold pool;
respectively acquiring the use conditions of the flash memory blocks in a hot pool and a cold pool of the solid state disk;
processing the flash memory block based on the usage, wherein the processing includes at least one of: the flash memory blocks in the hot pool and/or the cold pool are moved, and the garbage recovery is carried out on the flash memory blocks in the cold pool;
wherein, the moving the flash memory blocks in the hot pool and/or the cold pool comprises: based on the erasing times of each flash memory block in the hot pool and the cold pool; searching a first flash memory block with the maximum erasing times in the hot pool and a second flash memory block with the minimum erasing times in the cold pool; judging whether the difference value of the maximum erasing times and the minimum erasing times exceeds a preset first threshold value or not; if the judgment result shows that the static wear level exceeds the preset first threshold value, the first flash memory block is marked, and the first flash memory block and the second flash memory block are moved based on the number of effective data pages of the first flash memory block, so that the static wear level is realized.
2. The method of claim 1, wherein the usage comprises at least one of a number of valid data pages, a number of erasures, a time period for adding the cold pool, and an average number of erasures of the flash blocks in the solid state disk.
3. The method of claim 1, wherein the moving the first flash memory block and the second flash memory block based on the number of valid data pages of the first flash memory block to achieve the static wear leveling comprises:
judging whether the number of effective data pages of the first flash memory block in a preset time is equal to a preset page number threshold value or not; wherein the preset page number threshold value is zero;
and if the effective data page number of the first flash memory block in the preset time is equal to the preset page number threshold value, moving the first flash memory block in the hot pool and the second flash memory block in the cold pool to realize the static wear balance.
4. The method of claim 3,
the moving the first flash memory block in the hot pool and the second flash memory block in the cold pool to achieve the static wear leveling includes:
erasing the data stored in the first flash memory block, and moving the data stored in the second flash memory block to the first flash memory block for storage;
adding the first flash memory block storing the moved data into the cold pool;
and adding the second flash memory block subjected to data transfer into an idle block linked list.
5. The method of claim 3, further comprising:
if the number of effective data pages of the first flash memory block in a preset time is not equal to the preset page number threshold, judging whether the first flash memory block in the hot pool meets a preset condition of cold data;
if the preset condition of the cold data is met, adding the first flash memory block into the cold pool;
and continuously searching the flash memory block with the maximum erasing times in the hot pool as a new first flash memory block, and executing the step of judging whether the difference value between the maximum erasing times and the minimum erasing times exceeds a preset first threshold value.
6. The method of claim 5,
the preset conditions for satisfying the cold data include: the increase value of the average erasing times of the flash memory blocks of the solid state disk reaches a preset second threshold value, and the erasing times of the first flash memory block are not increased; the number of valid data pages of the first flash memory block is continuously unchanged.
7. The method of claim 1, wherein the moving of flash blocks in the hot and/or cold pools further comprises:
and adding the flash memory blocks meeting the preset condition of cold data in the hot pool into the cold pool based on the increased value of the average erasing times of the flash memory blocks in the hot pool and the number of effective data pages.
8. The method of claim 1, wherein said garbage collecting the flash memory blocks in the cold pool comprises:
obtaining the priority value of the flash memory block based on the effective data page number, erasing times and the cold pool adding time period of the flash memory block;
and taking the flash memory blocks with the priority values meeting the preset recovery conditions as source flash memory blocks for garbage recovery to carry out garbage recovery.
9. The method of claim 8, wherein the predetermined recovery condition is that the priority value is maximum.
10. The method according to claim 9, wherein the obtaining the priority value of the flash memory block based on the obtained number of valid data pages, erasing times and cold pool adding time period of the flash memory block comprises:
obtaining the priority value of the flash memory block by using the following formula:
Figure 2019DEST_PATH_IMAGE001
in the above formula, the first and second carbon atoms are,
Figure 397228DEST_PATH_IMAGE002
wherein P represents a priority value of the flash block; a. the max Showing the maximum valid data page number of the flash memory block in the cold pool, A showing the valid data page number of the current flash memory block, A min A minimum number of valid data pages representing a flash block in the cold pool; b is max Representing the maximum number of erasures of flash blocks in said cold pool, B min Representing the minimum erasing frequency of the flash memory block in the cold pool, and B representing the erasing frequency of the current flash memory block; c represents the time period of said joining cold pool of said current flash block, C max Represents the maximum time period for joining the flash memory block to the cold pool, C min Representing a minimum joining cold pool time period for the flash block;
Figure 149284DEST_PATH_IMAGE003
Figure 971746DEST_PATH_IMAGE004
and
Figure 238780DEST_PATH_IMAGE005
respectively representing a preset first weight, a preset second weight and a preset third weight.
11. The method of claim 1, wherein prior to garbage collecting the flash memory blocks in the cold pool, comprising:
acquiring the number of idle flash memory blocks capable of writing new data in the solid state disk;
judging whether the number of the idle flash memory blocks is lower than a preset first number threshold value or not;
if the number of the idle flash memory blocks is lower than the preset first number threshold, starting garbage collection on the flash memory blocks;
judging whether the number of the idle flash memory blocks is higher than a preset second number threshold value or not;
and if the number of the idle flash memory blocks is higher than the preset second number threshold, stopping garbage collection of the flash memory blocks, wherein the preset second number threshold is larger than the preset first number threshold.
12. An apparatus for wear leveling of a solid state disk, the apparatus comprising: a processor and a memory for storing a computer program which, when executed by the processor, implements the method of any of claims 1 to 11.
13. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method according to any one of claims 1 to 11.
CN202011128180.3A 2020-10-20 2020-10-20 Wear leveling method and device for solid state disk and computer readable storage medium Active CN112328169B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011128180.3A CN112328169B (en) 2020-10-20 2020-10-20 Wear leveling method and device for solid state disk and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011128180.3A CN112328169B (en) 2020-10-20 2020-10-20 Wear leveling method and device for solid state disk and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112328169A CN112328169A (en) 2021-02-05
CN112328169B true CN112328169B (en) 2022-08-09

Family

ID=74310444

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011128180.3A Active CN112328169B (en) 2020-10-20 2020-10-20 Wear leveling method and device for solid state disk and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112328169B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115599308B (en) * 2022-11-28 2023-03-21 苏州浪潮智能科技有限公司 Garbage recycling method and device for solid state disk, electronic equipment and storage medium
CN115586875B (en) * 2022-12-08 2023-07-04 合肥康芯威存储技术有限公司 Wear balancing method and device for storage system and storage system
CN115933996B (en) * 2023-01-12 2023-06-02 北京得瑞领新科技有限公司 SSD read interference optimization processing method and device, storage medium and SSD device
CN116661683B (en) * 2023-05-10 2024-02-23 珠海妙存科技有限公司 Wear balance management method, system, equipment and medium for flash memory
CN116774948B (en) * 2023-08-18 2023-11-28 合肥联宝信息技术有限公司 Data processing method, device, electronic device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090042035A (en) * 2007-10-25 2009-04-29 삼성전자주식회사 Data storage device, memory system, and computing system using nonvolatile memory device
CN102508785A (en) * 2011-11-02 2012-06-20 清华大学 Wear leveling method and device
CN108628758A (en) * 2018-03-14 2018-10-09 深圳忆联信息系统有限公司 A kind of method and solid state disk of selection garbage reclamation object block
CN109254927A (en) * 2018-08-30 2019-01-22 浪潮电子信息产业股份有限公司 A kind of implementation method of solid state hard disk abrasion equilibrium
CN109524046A (en) * 2018-09-05 2019-03-26 广东工业大学 A kind of flash memory abrasion equalization algorithm of low memory consumption
CN110768331A (en) * 2019-10-24 2020-02-07 浙江大华机器人技术有限公司 Robot charging method and related equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9652343B2 (en) * 2011-09-21 2017-05-16 Kevin Mark Klughart Raid hot spare system and method
US10338825B2 (en) * 2016-03-31 2019-07-02 EMC IP Holding Company LLC Managing SSD wear rate in hybrid storage arrays

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090042035A (en) * 2007-10-25 2009-04-29 삼성전자주식회사 Data storage device, memory system, and computing system using nonvolatile memory device
US8380945B2 (en) * 2007-10-25 2013-02-19 Samsung Electronics Co., Ltd. Data storage device, memory system, and computing system using nonvolatile memory device
CN102508785A (en) * 2011-11-02 2012-06-20 清华大学 Wear leveling method and device
CN108628758A (en) * 2018-03-14 2018-10-09 深圳忆联信息系统有限公司 A kind of method and solid state disk of selection garbage reclamation object block
CN109254927A (en) * 2018-08-30 2019-01-22 浪潮电子信息产业股份有限公司 A kind of implementation method of solid state hard disk abrasion equilibrium
CN109524046A (en) * 2018-09-05 2019-03-26 广东工业大学 A kind of flash memory abrasion equalization algorithm of low memory consumption
CN110768331A (en) * 2019-10-24 2020-02-07 浙江大华机器人技术有限公司 Robot charging method and related equipment

Also Published As

Publication number Publication date
CN112328169A (en) 2021-02-05

Similar Documents

Publication Publication Date Title
CN112328169B (en) Wear leveling method and device for solid state disk and computer readable storage medium
CN111090398B (en) Garbage recycling method, device and equipment for solid state disk and readable storage medium
CN108139968B (en) Method and equipment for determining quantity of threads of garbage collector and managing activities
CN108776614B (en) Recovery method and device of storage block
CN106775474B (en) Nand Flash wear leveling method and device and memory
CN103577336B (en) A kind of stored data processing method and device
CN104008061A (en) Internal memory recovery method and device
CN104572491A (en) Read cache management method and device based on solid-state drive (SSD)
CN108205473B (en) Memory processing method and device, computer device and computer readable storage medium
US20130198453A1 (en) Hybrid storage device inclucing non-volatile memory cache having ring structure
CN109086141B (en) Memory management method and device and computer readable storage medium
CN110673789B (en) Metadata storage management method, device, equipment and storage medium of solid state disk
US10853250B2 (en) Storage management method, electronic device and computer program product
CN108205471B (en) Memory recovery method and device, computer device and computer readable storage medium
JP6167646B2 (en) Information processing apparatus, control circuit, control program, and control method
CN112286459A (en) Data processing method, device, equipment and medium
CN103677893B (en) Method for reducing size of image file of starting up and arithmetic device
CN109343796B (en) Data processing method and device
CN108153481B (en) NAND storage block recovery method and device
CN111435403A (en) Wear leveling method and device for flash memory system
CN108228340B (en) Terminal control method and device, terminal equipment and computer readable storage medium
CN114995756A (en) Virtual disk space recovery method, device and medium
CN115525208A (en) Storage management method, storage device, and storage medium
CN113867624A (en) Data writing method and device, readable storage medium and electronic equipment
CN109086223B (en) Method and device for controlling garbage recovery

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
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: Room 1202, Floor 12, Building 3, No. 126, Yueda Lane, Changhe Street, Binjiang District, Hangzhou City, Zhejiang Province, 310056

Patentee after: Zhejiang Huayi Core Technology Co.,Ltd.

Address before: 310051 room 512, building 2, 2930 South Ring Road, Puyan street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: Zhejiang Dahua Technology Co.,Ltd.