CN111124305B - Solid state disk wear leveling method, device and computer readable storage medium - Google Patents

Solid state disk wear leveling method, device and computer readable storage medium Download PDF

Info

Publication number
CN111124305B
CN111124305B CN201911328658.4A CN201911328658A CN111124305B CN 111124305 B CN111124305 B CN 111124305B CN 201911328658 A CN201911328658 A CN 201911328658A CN 111124305 B CN111124305 B CN 111124305B
Authority
CN
China
Prior art keywords
block
data
linked list
data block
dirty
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
CN201911328658.4A
Other languages
Chinese (zh)
Other versions
CN111124305A (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.)
IEIT Systems Co Ltd
Original Assignee
Inspur Electronic Information Industry 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 Inspur Electronic Information Industry Co Ltd filed Critical Inspur Electronic Information Industry Co Ltd
Priority to CN201911328658.4A priority Critical patent/CN111124305B/en
Publication of CN111124305A publication Critical patent/CN111124305A/en
Priority to PCT/CN2020/110986 priority patent/WO2021120665A1/en
Application granted granted Critical
Publication of CN111124305B publication Critical patent/CN111124305B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0646Configuration or reconfiguration

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

本申请公开了一种固态硬盘磨损均衡方法、装置及计算机可读存储介质。其中,方法包括构建多个以数据块擦除次数区分优先级的空闲块链表和脏块链表,将各数据块按照擦除次数、块类型、擦除次数允许范围分类至相应表;若存在满足磨损均衡条件的空闲块链表,为擦除次数最低的数据块对应的区块设置重置标签;若在规定时间内未收到主机的区块重置指令,则将各脏块链表中擦除次数最低的数据块作为源数据块,将各空闲块链表中擦除次数最高的数据块作为目的数据块进行数据搬移;当接收到申请数据块请求,从擦除次数最低的空闲块链表中选择数据块,从而实现了基于ZNS协议的固态硬盘磨损均衡,有利于保证固态硬盘中各数据块的磨损均衡,有效延长固态硬盘寿命。

Figure 201911328658

The present application discloses a wear leveling method, device and computer-readable storage medium for a solid-state hard disk. Among them, the method includes constructing a plurality of free block linked lists and dirty block linked lists prioritized by the number of data block erasures, and classifying each data block into the corresponding table according to the number of erasures, the block type, and the allowable range of the number of erasures; The free block chain list of wear leveling conditions, set reset labels for the blocks corresponding to the data blocks with the lowest erasure times; if the block reset command from the host is not received within the specified time, the dirty block chain list will be erased The data block with the lowest number of times is used as the source data block, and the data block with the highest number of erasures in each free block list is used as the destination data block for data movement; when a request for a data block is received, it is selected from the free block list with the lowest number of erasures data blocks, thus realizing the wear leveling of the SSD based on the ZNS protocol, which is conducive to ensuring the wear leveling of each data block in the SSD, and effectively prolonging the life of the SSD.

Figure 201911328658

Description

Solid state disk wear leveling method and device and computer readable storage medium
Technical Field
The present disclosure relates to wear leveling technologies, and in particular, to a method and an apparatus for wear leveling of a solid state disk, and a computer readable storage medium.
Background
With the rapid development of cloud computing and internet technologies, mass data are generated at all times in daily work and life and need to be stored, and the data storage technology is correspondingly developed to meet the actual storage requirement of explosively-increased data. The SSD (Solid State Drives) 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. 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 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, and in order to prolong the service life of the solid state disk, the erasing operation of each data block needs to be subjected to wear leveling so as to ensure that the erasing frequency of each data block is the same.
The host side and the solid state disk can cooperate based on a ZNS (Zoned Namespace) protocol. In the using process of the solid state disk, the host end is responsible for garbage recovery to improve the space utilization rate of the solid state disk, correspondingly, the solid state disk can move data due to wear balance, and in the data moving process, all data are effective data and need to be moved. Garbage collection refers to moving effective pages in several physical data blocks with full data to new idle physical data blocks, and then erasing the several source data blocks, thereby improving the space utilization rate of the solid state disk. In the garbage recycling process, the space recovery rate is considered, the continuous and rapid supply of idle blocks by the solid state disk energy source is ensured, and the wear times, namely the wear balance of the whole disk and the wear times of a single data block, are considered, so that the service life of the solid state disk is ensured.
In the related art, in the process of implementing wear leveling based on the ZNS protocol, when zoneopen (open block) applies for a new physical block, the physical block with a low erase count is not necessarily provided to the zoneopen, which results in uneven wear of each data block.
In view of this, how to implement wear leveling of a solid state disk based on a ZNS protocol is a technical problem to be solved by those skilled in the art.
Disclosure of Invention
The application provides a solid state disk wear leveling method, a solid state disk wear leveling device and a computer readable storage medium, which realize solid state disk wear leveling based on a ZNS protocol and effectively prolong the service life of a 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 method for wear leveling of a solid state disk, including:
the method comprises the steps that a plurality of idle block linked lists and dirty block linked lists which are prioritized by the erasing times of data blocks and used for storing the data blocks are constructed in advance, and each data block is classified into the idle block linked list or the dirty block linked list based on the erasing times and the erasing average value difference, the block type and the erasing time allowable range corresponding to each list;
when detecting that an idle block linked list meeting the wear leveling condition exists, setting a reset label for a block corresponding to a data block with the lowest erasing times; if a block reset instruction issued by a host end is not received within a preset time threshold, taking a data block with the lowest erasing frequency in each dirty block linked list as a source data block, and taking a data block with the highest erasing frequency in each idle block linked list as a target data block for data transfer;
when a request for applying for a data block is received, selecting the data block from the idle block chain table with the lowest erasing times;
the erasing times of the data blocks in the same idle block linked list or dirty block linked list are within the same erasing time allowable range, and the number of the tables is determined based on a preset abrasion threshold value and the erasing mean value; the block types are a free block and a dirty data block.
Optionally, when it is detected that there is an idle block linked list that meets the wear leveling condition, setting a reset tag for a block corresponding to the idle block linked list with the lowest erase frequency as:
and when detecting that the total number of the data blocks contained in the free block chain table with the maximum value of the allowable range of the erasing times lower than the erasing average value is lower than a number threshold, setting a reset label for the block corresponding to the free block chain table with the lowest erasing times.
Optionally, when a request for applying for a data block is received, selecting a data block from the idle block chain table with the lowest erasing frequency as:
when a request for applying for a data block is received, determining a target idle block linked list with the lowest erasing times from each idle block linked list;
and feeding back the data block with the lowest erasing times in the target idle block linked list.
Optionally, before the pre-constructing a plurality of free block linked lists and dirty block linked lists that are prioritized by the number of times of erasing the data block and are used for storing the data block, the method further includes:
and randomizing the abrasion times of each data block in the solid state disk according to a block logic number randomization algorithm.
Optionally, after the pre-constructing a plurality of free block linked lists and dirty block linked lists that are prioritized by the number of times of erasing the data block and are used for storing the data block, the method further includes:
and after the erasing mean value changing instruction is received, adjusting the data blocks stored in each idle block chain table and each dirty block chain table based on the difference value between the current erasing times of the data blocks and the updated erasing mean value.
Optionally, the allowable range of the number of times of erasing of each free block linked list and each dirty block linked list is determined according to the wear threshold and the total number of the lists.
Another aspect of the embodiments of the present invention provides a solid state disk wear leveling apparatus, including:
the table pre-construction module is used for pre-constructing a plurality of idle block linked lists and dirty block linked lists which are prioritized by the erasing times of the data blocks and are used for storing the data blocks; the erasing times of the data blocks in the same idle block linked list or dirty block linked list are within the same erasing time allowable range, and the number of the tables is determined based on a preset abrasion threshold value and the erasing mean value;
the data block classification module is used for classifying each data block into an idle block linked list or a dirty block linked list based on the erasing times and the erasing average value difference, the block type and the erasing time allowable range corresponding to each table; the block types are idle blocks and dirty data blocks;
the wear leveling processing module is used for setting a reset label for a block corresponding to a data block with the lowest erasing frequency when detecting that an idle block linked list meeting a wear leveling condition exists; if a block reset instruction issued by a host end is not received within a preset time threshold, taking a data block with the lowest erasing frequency in each dirty block linked list as a source data block, and taking a data block with the highest erasing frequency in each idle block linked list as a target data block for data transfer;
and the data block providing module is used for selecting the data block from the idle block chain table with the lowest erasing times when a request for applying for the data block is received.
Optionally, the system further includes a table updating module, where the table updating module is configured to adjust the free block linked lists and the data blocks stored in the dirty block linked lists based on a difference between a current erasing frequency of the data block and an updated erasing mean value after receiving the erasing mean value changing instruction.
The embodiment of the present invention further provides a solid state disk wear leveling device, which includes a processor, where the processor is configured to implement the steps of the solid state disk wear leveling method 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 solid state disk wear leveling program is stored on the computer-readable storage medium, and when being executed by a processor, the solid state disk wear leveling program implements the steps of the solid state disk wear leveling method according to any one of the foregoing embodiments.
The technical scheme provided by the application has the advantages that the data blocks are classified into different tables according to the difference between the erasing times and the erasing mean value to realize priority discrimination, repeated operation caused by comparison between every two data blocks is avoided, and the data block priority classification efficiency is improved; the data moving is realized by improving and exchanging the data blocks with low erasing times in the dirty block linked list and the data blocks with high erasing times in the idle block linked list, the total erasing times of the data blocks in the dirty block linked list is increased, the total erasing times of the data blocks in the idle block linked list is reduced, and the number of the data blocks which are lower than the average erasing times in the idle block linked list is increased, so that the data blocks with low erasing times can be provided all the time when zoneopen applies for the data blocks, the wear balance of the solid state disk based on the ZNS protocol is realized, the wear balance of each data block in the solid state disk is favorably ensured, and the service life of the solid state disk is effectively prolonged.
In addition, the embodiment of the invention also provides a corresponding implementation device and a computer readable storage medium for the solid state disk wear leveling method, so that the method has higher practicability, and the device and the computer readable storage medium have corresponding advantages.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the related art, the drawings required to be used in the description of the embodiments or the related 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 for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for wear leveling of 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 structural diagram of an embodiment of a solid state disk wear leveling apparatus according to an embodiment of the present invention;
fig. 4 is a structural diagram of another specific embodiment of a solid state disk wear leveling device according to an embodiment of the present invention;
fig. 5 is a structural diagram of another embodiment of a solid state disk wear leveling device 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 method for wear leveling of a solid state disk according to an embodiment of the present invention, where the embodiment of the present invention includes the following:
s101: a plurality of idle block linked lists and dirty block linked lists which are prioritized by the erasing times of the data blocks and used for storing the data blocks are constructed in advance, and each data block is classified into the idle block linked list or the dirty block linked list based on the erasing times and the erasing average value difference, the block type and the erasing time allowable range corresponding to each list.
In the present application, there are a plurality of idle block linked lists and dirty block linked lists, each idle block linked list and each dirty block linked list have a unique priority level, and the priority levels of the lists are distinguished by the number of times of database erasure. Each priority level uniquely corresponds to a group of allowable range of erasing times, and the erasing times of the data blocks in the same idle block linked list or the same dirty block linked list are within the same allowable range of erasing times. Before the idle block linked list and the dirty block linked list are constructed, a wear threshold value is preset, the total number of the idle block linked list and the dirty block linked list can be determined according to the wear threshold value and the erase mean value, the total number of the idle block linked list and the total number of the dirty block linked list can be the same or different, and the method is not limited at all. Of course, after the number of tables is determined, the allowable range of the erasing times of each free block linked list and each dirty block linked list can be determined according to the wear threshold and the total number of the tables.
It can be understood that after the free block chain table and the dirty block chain table are constructed, the free block chain table is used for storing free data blocks, where a free data block refers to a data block whose data block is empty or has a free space capacity to accommodate data, and these data blocks may be new data blocks, that is, data blocks that have not been subjected to an erase operation, or data blocks that have undergone multiple erase operations; the free block chain table is used for storing dirty data blocks, where a dirty data block refers to a data block in which data is written, and the data block may be a data block in which data is newly written full, that is, a data block in which an erase operation is not performed, or a data block in which multiple erase operations are performed. The total number of the data blocks stored in each free block chain table and each dirty block chain table can be determined according to an actual application scenario, which is not limited in this application. Because the priority levels of each idle block linked list and each dirty block linked list are distinguished based on the erasing times of the data blocks, and correspondingly, each idle block linked list and each dirty block linked list correspond to a unique erasing time allowable range, the data blocks can be classified into the idle block linked list or the dirty block linked list based on the erasing times and the erasing average value difference, the block type and the erasing time allowable range corresponding to each list, wherein the block type is an idle block and a dirty data block.
For example, the wear threshold is 100, and according to the threshold limit of wear leveling distance average 100, that is, 100 < the wear count of the current data block-the erase average < 100, the total number of tables of the idle block linked list and the dirty block linked list may be 20, that is, 20 priorities may be set for the idle block linked list and the dirty block linked list, each priority may include 10 PEs, based on which, the allowable range of the erase count of the first idle block linked list may be 0 to 10, the allowable range of the erase count of the second idle block linked list may be 10 to 20, the allowable range of the erase count of the third idle block linked list may be 20 to 30, the allowable range of the erase count of the fourth idle block linked list may be 30 to 40, the allowable range of the erase count of the fifth idle block linked list may be 40 to 50, and the allowable range of the erase count of the sixth idle block linked list may be 50 to 60, the allowable range of the erasing times of the seventh idle block linked list can be 60-70, the allowable range of the erasing times of the eighth idle block linked list can be 70-80, the allowable range of the erasing times of the ninth idle block linked list can be 80-90, the allowable range of the erasing times of the tenth idle block linked list can be 90-100, the allowable range of the erasing times of the eleventh idle block linked list can be-10-0, the allowable range of the erasing times of the twelfth idle block linked list can be-10-20, the allowable range of the erasing times of the thirteenth idle block linked list can be-20-30, the allowable range of the erasing times of the fourteenth idle block linked list can be-30-40, the allowable range of the erasing times of the fifteenth idle block linked list can be-40-50, the allowable range of the erasing times of the sixteenth idle block linked list can be-50-60, the allowable range of the erasing times of the seventeenth idle block linked list can be-60 to-70, the allowable range of the erasing times of the eighteenth idle block linked list can be-70 to-80, the allowable range of the erasing times of the nineteenth idle block linked list can be-80 to-90, and the allowable range of the erasing times of the twentieth idle block linked list can be-90 to-100. And adding the data blocks into different idle block linked lists according to the difference between the data block PE and the mean value PE, wherein the current data block is an idle data block, the erasing times are 25 times, and the erasing mean value is 100, so that the current data block can be classified into an eighteenth idle block linked list.
S102: and when detecting that the idle block linked list meeting the wear leveling condition exists, setting a reset label for the block corresponding to the data block with the lowest erasing frequency.
In this application, when it is detected that there is a free block linked list satisfying a wear leveling condition, a wear leveling operation is started, where the wear leveling operation may include S102, setting a reset tag for a block corresponding to a data block with the lowest erase frequency, and S103. Satisfying the wear leveling condition may be, for example, if the number of data blocks included in the free block linked list that is lower than the erase mean is lower than 8, starting wear leveling. The zone corresponding to the data block with low PE value can be selected to set a recormed reset mark, and the host end is waited to issue a reset instruction to the zone.
S103: and if the block reset instruction issued by the host end is not received within the preset time threshold, taking the data block with the lowest erasing frequency in each dirty block linked list as a source data block, and taking the data block with the highest erasing frequency in each idle block linked list as a target data block for data transfer.
Wherein, the preset time threshold can be determined according to the actual application scenario, for example, 30s can be selected, if within 30s, the block reset command of the block has not been issued, selecting the zone with low PE from the dirty block linked list as a source data block, selecting the data block with high PE from the idle block linked list as a target data block, moving the data, adding the source data block into the idle block linked list and the target data block into the dirty block linked list after the moving is finished and the block resetting instruction is finished, thus, the data transfer is realized by improving and exchanging the data blocks with low erasing times in the dirty block linked list and the data blocks with high erasing times in the idle block linked list, the total erasing times of the data blocks in the dirty block linked list are increased, the total erasing times of the data blocks in the idle block linked list are reduced, the number of the data blocks in the idle block linked list, which are lower than the average erasing times, is increased, therefore, when zoneopen applies for the data block, the data block with low erasing times can be guaranteed to be provided all the time.
S104: and when a request for applying for the data block is received, selecting the data block from the idle block chain table with the lowest erasing times.
After the wear leveling in S102 and S103, when the zone open newly applies for a data block, a data block with a low PE can be provided to the zone open all the time.
In the technical scheme provided by the embodiment of the invention, the data blocks are classified into different tables according to the difference between the erasing times and the erasing mean value to realize priority discrimination, so that repeated operation caused by comparison between every two data blocks is avoided, and the priority classification efficiency of the data blocks is improved; the data moving is realized by improving and exchanging the data blocks with low erasing times in the dirty block linked list and the data blocks with high erasing times in the idle block linked list, the total erasing times of the data blocks in the dirty block linked list is increased, the total erasing times of the data blocks in the idle block linked list is reduced, and the number of the data blocks which are lower than the average erasing times in the idle block linked list is increased, so that the data blocks with low erasing times can be provided all the time when zoneopen applies for the data blocks, the wear balance of the solid state disk based on the ZNS protocol is realized, the wear balance of each data block in the solid state disk is favorably ensured, and the service life of the solid state disk is effectively prolonged.
In the above embodiment, how to execute the wear leveling start condition of step S102 is not limited, and a specific set of implementation methods is provided in this embodiment, as shown in fig. 2, in step S102, when it is detected that there is a situation where the total number of data blocks included in the free block chain table whose maximum value of the allowable range of the erase times is lower than the erase mean value is lower than the number threshold, a reset tag is set for a block corresponding to the free block chain table whose erase times is the lowest.
The erase mean value is an average value of erase times, the threshold value of the number may be 8, for example, but may also be other values, and may be determined mainly according to the requirement of wear leveling and the total number of data blocks included in the table, which is not limited in this application.
As another alternative, S104 may include:
s1041: and when a request for applying for the data block is received, determining a target idle block linked list with the lowest erasing times from all the idle block linked lists.
S1042: and feeding back the data block with the lowest erasing times in the target idle block linked list.
In another embodiment, it is understood that, when the erasure average value changes, the data blocks included in the free block linked list and the dirty block linked list change, and based on this, the present application may further include:
s105: and when an erasing mean value changing instruction is received, adjusting the data blocks stored in each idle block chain table and each dirty block chain table based on the difference value between the current erasing times of the data blocks and the updated erasing mean value.
In addition, it can be understood that there may be a case where a large difference between the wear frequency of a large number of dirty data blocks and the erase mean value exists in the solid state disk, and each table establishes a limit based on the wear threshold and the erase mean value, so that the wear frequency of each data block in the solid state disk may be randomized within a preset random range according to the block logic number randomization algorithm, and the specific process of the wear frequency randomization may refer to the implementation process of the block logic number randomization algorithm described in the related art, and thus, details are not repeated here. That is, based on the above-described embodiments, the present application may further include:
s106: and randomizing the abrasion times of each dirty data block in the solid state disk according to a block logic number randomizing algorithm.
It should be noted that, in the present application, there is no strict sequential execution order among the steps, and as long as a logical order is met, the steps may be executed simultaneously or according to a certain preset order, and fig. 1 to fig. 2 are only schematic manners, and do not represent only such an execution order.
The embodiment of the invention also provides a corresponding device for the solid state disk wear leveling method, so that the method has higher practicability. Wherein the means can be described separately from the functional module point of view and the hardware point of view. In the following, the solid state disk wear leveling device provided by the embodiment of the present invention is introduced, and the solid state disk wear leveling device described below and the solid state disk wear leveling method described above may be referred to correspondingly.
Based on the angle of the functional module, referring to fig. 3, fig. 3 is a structural diagram of a solid state disk wear leveling apparatus according to an embodiment of the present invention, where the apparatus may include:
a table pre-construction module 301, configured to pre-construct a plurality of idle block linked lists and dirty block linked lists, which are prioritized by data block erasure times and used for storing data blocks; the erasing times of the data blocks in the same idle block linked list or dirty block linked list are within the same allowable range of the erasing times, and the number of the tables is determined based on a preset abrasion threshold value and an erasing average value.
A data block classification module 302, configured to classify each data block into an idle block linked list or a dirty block linked list based on an erase frequency and an erase mean difference, a block type, and an erase frequency allowable range corresponding to each table; the block types are free blocks and dirty data blocks.
The wear leveling processing module 303 is configured to set a reset tag for a block corresponding to a data block with the lowest erasure number when detecting that an idle block linked list satisfying a wear leveling condition exists; and if the block reset instruction issued by the host end is not received within the preset time threshold, taking the data block with the lowest erasing frequency in each dirty block linked list as a source data block, and taking the data block with the highest erasing frequency in each idle block linked list as a target data block for data transfer.
And the data block providing module 304 is configured to, when a request for applying for a data block is received, select a data block from the free block chain table with the lowest erasure number.
Optionally, in some embodiments of this embodiment, referring to fig. 4, for example, the apparatus may further include a table updating module 305, where the table updating module 305 may be configured to, after receiving the erase mean change instruction, adjust the data blocks stored in each free block chain table and each dirty block chain table based on a difference between a current number of times of erasing the data block and an updated erase mean. The method further includes a randomizing module 306, which is specifically configured to randomize the wear times of each dirty data block in the solid state disk according to a block logical number randomizing algorithm.
In other embodiments of this embodiment, the wear leveling processing module 303 is specifically configured to, when it is detected that there is a situation where the total number of data blocks included in the free block chain table whose maximum value of the allowable range of the erase times is lower than the erase mean is lower than a number threshold, set a reset tag for a block corresponding to the free block chain table with the lowest erase times.
In addition, in an alternative implementation, the data block providing module 304 may be configured to determine, when a request for applying for a data block is received, a target idle block linked list with the lowest erasing frequency from each idle block linked list; and feeding back the data block with the lowest erasing times in the target idle block linked list.
The functions of the functional modules of the wear leveling device for 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 realizes the wear balance of the solid state disk based on the ZNS protocol, and effectively prolongs the service life of the solid state disk.
The solid state disk wear leveling device mentioned above is described from the perspective of a functional module, and further, the present application also provides a solid state disk wear leveling device described from the perspective of hardware. Fig. 5 is a structural diagram of another solid state disk wear leveling device according to an embodiment of the present application. As shown in fig. 5, the apparatus comprises a memory 50 for storing a computer program;
the processor 51 is configured to implement the steps of the solid state disk wear leveling method according to the above embodiments when executing the computer program.
The processor 51 is configured to implement the steps of the data access and storage method of the board chip mentioned in the above embodiments when executing the computer program.
The processor 51 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 51 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). In some embodiments, the processor 51 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 51 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 50 may include one or more computer-readable storage media, which may be non-transitory. Memory 50 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 50 is at least used for storing the following computer program 501, wherein after being loaded and executed by the processor 51, the computer program can implement the relevant steps of the testing method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 50 may also include an operating system 502, data 503, and the like, and the storage manner may be a transient storage manner or a permanent storage manner. Operating system 502 may include Windows, Unix, Linux, etc. Data 503 may include, but is not limited to, data corresponding to test results, and the like.
In some embodiments, the data access device of the board chip may further include a display screen 52, an input/output interface 53, a communication interface 54, a power supply 55, and a communication bus 56.
Those skilled in the art will appreciate that the structure shown in fig. 5 does not constitute a limitation to the data access means of the board chip, and may include more or fewer components than those shown, for example, sensor 57.
The functions of the functional modules of the wear leveling device for 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 realizes the wear balance of the solid state disk based on the ZNS protocol, and effectively prolongs the service life of the solid state disk.
It is understood that, if the solid state disk wear leveling method in the above embodiments is implemented in the form of a software functional unit and sold or used as a stand-alone product, it may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application may be substantially or partially implemented in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the methods of the embodiments of the present application, or all or part of the technical solutions. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), an electrically erasable programmable ROM, a register, a hard disk, a removable magnetic disk, a CD-ROM, a magnetic or optical disk, and other various media capable of storing program codes.
Based on this, an embodiment of the present invention further provides a computer-readable storage medium, which stores a solid state disk wear leveling program, where the solid state disk wear leveling program is executed by a processor, and the steps of the solid state disk wear leveling method according to any one of the above embodiments are provided.
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 realizes the wear balance of the solid state disk based on the ZNS protocol, and effectively prolongs the service life 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 method, the apparatus, and the computer-readable storage medium for wear leveling of a solid state disk provided in the present application 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 application.

Claims (10)

1.一种固态硬盘磨损均衡方法,其特征在于,包括:1. A wear leveling method for a solid-state hard disk, comprising: 预先构建多个以数据块擦除次数区分优先级并用于存储数据块的空闲块链表和脏块链表,且将各数据块基于擦除次数与擦除均值差、块类型、各表对应的擦除次数允许范围分类至空闲块链表或脏块链表;Pre-build multiple free block linked lists and dirty block linked lists that are prioritized by the number of data block erasures and used to store data blocks, and each data block is based on the number of erasures and erasure average difference, block type, and the corresponding erasure of each table. The allowable range of division times is classified into free block linked list or dirty block linked list; 当检测到存在满足磨损均衡条件的空闲块链表,则为擦除次数最低的数据块对应的区块设置重置标签;若在预设时间阈值内未收到主机端下发的区块重置指令,则将各脏块链表中擦除次数最低的数据块作为源数据块,将各空闲块链表中擦除次数最高的数据块作为目的数据块进行数据搬移;When it is detected that there is a free block chain list that meets the wear leveling condition, a reset label is set for the block corresponding to the data block with the lowest erasure count; if the block reset from the host side is not received within the preset time threshold command, the data block with the lowest number of erasures in each dirty block linked list is used as the source data block, and the data block with the highest number of erasures in each free block linked list is used as the destination data block for data movement; 当接收到申请数据块请求,从擦除次数最低的空闲块链表中选择数据块;When receiving a request for a data block, select a data block from the free block list with the lowest erasure count; 其中,同一个空闲块链表或脏块链表中的数据块的擦除次数位于相同的擦除次数允许范围内且表个数基于预先设置的磨损阈值和所述擦除均值来确定;所述块类型为空闲块和脏数据块。Wherein, the erasing times of the data blocks in the same free block linked list or dirty block linked list are within the same allowable range of erasing times, and the number of tables is determined based on the preset wear threshold and the erasure average; the block The types are free blocks and dirty data blocks. 2.根据权利要求1所述的固态硬盘磨损均衡方法,其特征在于,所述当检测到存在满足磨损均衡条件的空闲块链表,则为擦除次数最低的空闲块链表对应的区块设置重置标签为:2 . The wear leveling method of the solid-state hard disk according to claim 1 , wherein when it is detected that there is a free block linked list that satisfies the wear leveling condition, a reset is set for the block corresponding to the free block linked list with the lowest number of erasures. 3 . Set the label to: 当检测到存在擦除次数允许范围的最大值低于所述擦除均值的空闲块链表中包含的数据块总数低于个数阈值,则为擦除次数最低的空闲块链表对应的区块设置重置标签。When it is detected that the maximum value of the allowable range of erasing times is lower than the average erasure value, the total number of data blocks contained in the free block chain list is lower than the number threshold, then the block corresponding to the free block chain list with the lowest erasure times is set. Reset labels. 3.根据权利要求2所述的固态硬盘磨损均衡方法,其特征在于,所述当接收到申请数据块请求,从擦除次数最低的空闲块链表中选择数据块为:3. The wear-leveling method for solid-state hard disks according to claim 2, wherein when receiving a request for applying for a data block, selecting a data block from a free block chain list with the lowest erasure count is: 当接收到申请数据块请求,从各空闲块链表中确定擦除次数最低的目标空闲块链表;When receiving a request to apply for a data block, determine the target free block chain list with the lowest erasure count from each free block chain list; 将所述目标空闲块链表中擦除次数最低的数据块进行反馈。Feedback the data block with the lowest number of erasures in the target free block chain list. 4.根据权利要求1所述的固态硬盘磨损均衡方法,其特征在于,所述预先构建多个以数据块擦除次数区分优先级并用于存储数据块的空闲块链表和脏块链表之前,还包括:4 . The wear leveling method for a solid-state hard disk according to claim 1 , wherein before constructing a plurality of free block linked lists and dirty block linked lists that are prioritized by the number of data block erasures and used for storing data blocks, the method further comprises: 5 . include: 按照块逻辑编号随机化算法对固态硬盘中各数据块的磨损次数进行随机化处理。Randomize the wear times of each data block in the SSD according to the block logical number randomization algorithm. 5.根据权利要求1至4任意一项所述的固态硬盘磨损均衡方法,其特征在于,所述预先构建多个以数据块擦除次数区分优先级并用于存储数据块的空闲块链表和脏块链表之后,还包括:5 . The wear leveling method for a solid-state disk according to any one of claims 1 to 4, wherein the pre-built multiple free block linked lists and dirty block lists that are prioritized by the number of data block erasures and used to store data blocks are constructed in advance. After the blockchain list, it also includes: 当接收到所述擦除均值更改指令后,基于数据块当前擦除次数与更新擦除均值的差值调整各空闲块链表和各脏块链表中存储的数据块。After receiving the erasure mean value modification instruction, the data blocks stored in each free block linked list and each dirty block linked list are adjusted based on the difference between the current erasing times of the data block and the updated erasure mean value. 6.根据权利要求5所述的固态硬盘磨损均衡方法,其特征在于,各空闲块链表和各脏块链表的擦除次数允许范围根据所述磨损阈值和表总数确定。6 . The wear leveling method of the solid state disk according to claim 5 , wherein the allowable range of erasure times of each free block linked list and each dirty block linked list is determined according to the wear threshold and the total number of tables. 7 . 7.一种固态硬盘磨损均衡装置,其特征在于,包括:7. A wear leveling device for a solid-state hard disk, comprising: 表预构建模块,用于预先构建多个以数据块擦除次数区分优先级并用于存储数据块的空闲块链表和脏块链表;同一个空闲块链表或脏块链表中的数据块的擦除次数位于相同的擦除次数允许范围内且表个数基于预先设置的磨损阈值和擦除均值来确定;The table pre-construction module is used to pre-build multiple free block linked lists and dirty block linked lists that are prioritized by the number of data block erasures and used to store data blocks; erasure of data blocks in the same free block linked list or dirty block linked list The number of times is within the same allowable range of erasure times and the number of tables is determined based on the preset wear threshold and the average erasure value; 数据块分类模块,用于将各数据块基于擦除次数与擦除均值差、块类型、各表对应的擦除次数允许范围分类至空闲块链表或脏块链表;所述块类型为空闲块和脏数据块;The data block classification module is used to classify each data block into a free block linked list or a dirty block linked list based on the difference between the number of erasures and the mean value of erasure, the block type, and the allowable range of the number of erasures corresponding to each table; the block type is a free block. and dirty data blocks; 磨损均衡处理模块,用于当检测到存在满足磨损均衡条件的空闲块链表,则为擦除次数最低的数据块对应的区块设置重置标签;若在预设时间阈值内未收到主机端下发的区块重置指令,则将各脏块链表中擦除次数最低的数据块作为源数据块,将各空闲块链表中擦除次数最高的数据块作为目的数据块进行数据搬移;The wear leveling processing module is used to set a reset label for the block corresponding to the data block with the lowest number of erasures when it is detected that there is a free block list that meets the wear leveling condition; if the host is not received within the preset time threshold When the block reset command is issued, the data block with the lowest number of erasures in each dirty block linked list is used as the source data block, and the data block with the highest number of erasures in each free block linked list is used as the destination data block for data movement; 数据块提供模块,用于当接收到申请数据块请求,从擦除次数最低的空闲块链表中选择数据块。The data block providing module is used to select a data block from the free block chain list with the lowest erasing times when a request for applying for a data block is received. 8.根据权利要求7所述的固态硬盘磨损均衡装置,其特征在于,还包括表更新模块,所述表更新模块用于当接收到所述擦除均值更改指令后,基于数据块当前擦除次数与更新擦除均值的差值调整各空闲块链表和各脏块链表中存储的数据块。8 . The wear leveling device of the solid-state hard disk according to claim 7 , further comprising a table updating module, the table updating module is configured to, after receiving the erasure mean value modification instruction, erase current data blocks based on the data block. The difference between the number of times and the average update erasure value adjusts the data blocks stored in each free block linked list and each dirty block linked list. 9.一种固态硬盘磨损均衡装置,其特征在于,包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现如权利要求1至6任一项所述固态硬盘磨损均衡方法的步骤。9 . A wear leveling device for a solid state disk, characterized in that it comprises a processor, and the processor is configured to implement the steps of the wear leveling method for a solid state disk according to any one of claims 1 to 6 when the processor executes a computer program stored in a memory. . 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有固态硬盘磨损均衡程序,所述固态硬盘磨损均衡程序被处理器执行时实现如权利要求1至6任一项所述固态硬盘磨损均衡方法的步骤。10. A computer-readable storage medium, wherein the computer-readable storage medium stores a solid-state disk wear-leveling program, and when the solid-state disk wear-leveling program is executed by a processor, any one of claims 1 to 6 is implemented. A step of the method for wear leveling of a solid state drive.
CN201911328658.4A 2019-12-20 2019-12-20 Solid state disk wear leveling method, device and computer readable storage medium Active CN111124305B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911328658.4A CN111124305B (en) 2019-12-20 2019-12-20 Solid state disk wear leveling method, device and computer readable storage medium
PCT/CN2020/110986 WO2021120665A1 (en) 2019-12-20 2020-08-25 Solid state drive wear balancing method and apparatus, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911328658.4A CN111124305B (en) 2019-12-20 2019-12-20 Solid state disk wear leveling method, device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111124305A CN111124305A (en) 2020-05-08
CN111124305B true CN111124305B (en) 2021-08-31

Family

ID=70500792

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911328658.4A Active CN111124305B (en) 2019-12-20 2019-12-20 Solid state disk wear leveling method, device and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN111124305B (en)
WO (1) WO2021120665A1 (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124305B (en) * 2019-12-20 2021-08-31 浪潮电子信息产业股份有限公司 Solid state disk wear leveling method, device and computer readable storage medium
CN112612420A (en) * 2020-12-28 2021-04-06 苏州浪潮智能科技有限公司 Flash wear leveling method, device, equipment and storage medium
TWI775268B (en) 2021-01-07 2022-08-21 慧榮科技股份有限公司 Storage device, flash memory control and control method thereof
US11537293B2 (en) 2021-02-18 2022-12-27 Western Digital Technologies, Inc. Wear leveling methods for zoned namespace solid state drive
US11537303B1 (en) 2021-06-03 2022-12-27 Western Digital Technologies, Inc. Dissimilar write prioritization in ZNS devices
US11537305B1 (en) 2021-06-03 2022-12-27 Western Digital Technologies, Inc. Dissimilar write prioritization in ZNS devices
CN113407126B (en) * 2021-08-20 2022-02-18 苏州浪潮智能科技有限公司 A wear leveling method, apparatus, device and readable storage medium
CN113851171B (en) * 2021-09-27 2023-11-03 苏州浪潮智能科技有限公司 PE frequency range determining method of SSD and related components
CN115480698B (en) * 2022-09-05 2025-10-03 中国电信股份有限公司 ZNS flash solid state drive operating method, device, and electronic device
CN115586874B (en) * 2022-11-24 2023-03-10 苏州浪潮智能科技有限公司 A data block recovery method, device, electronic equipment, and storage medium
CN115599308B (en) * 2022-11-28 2023-03-21 苏州浪潮智能科技有限公司 Solid state disk garbage collection method, device, electronic equipment and storage medium
CN118092809B (en) * 2024-03-26 2025-09-16 西北工业大学深圳研究院 Solid state disk wear balancing method, device and equipment based on reinforcement learning
CN119356604A (en) * 2024-09-30 2025-01-24 联想(北京)有限公司 Storage control method, storage device and electronic device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102810068A (en) * 2011-05-30 2012-12-05 三星电子株式会社 Storage device, storage system and method of virtualizing storage device
CN103136121A (en) * 2013-03-25 2013-06-05 中国人民解放军国防科学技术大学 Cache management method for solid-state disc

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101777026B (en) * 2009-01-09 2011-12-28 成都市华为赛门铁克科技有限公司 Memory management method, hard disk and memory system
US8819328B2 (en) * 2010-12-30 2014-08-26 Sandisk Technologies Inc. Controller and method for performing background operations
CN102508785B (en) * 2011-11-02 2015-08-19 清华大学 A kind of abrasion equilibrium method and device
US9400723B2 (en) * 2012-03-15 2016-07-26 Hitachi, Ltd. Storage system and data management method
CN102880556B (en) * 2012-09-12 2015-05-20 浙江大学 Wear leveling method and system of Nand Flash
CN103092770B (en) * 2013-01-18 2015-08-12 山东华芯半导体有限公司 The method of memory cost is reduced during a kind of abrasion equilibrium process
CN104731515B (en) * 2013-12-18 2018-02-23 华为技术有限公司 Control the method and apparatus of storage device group of planes abrasion equilibrium
CN105468291B (en) * 2014-08-21 2019-09-20 腾讯科技(深圳)有限公司 Dynamic and static wear balance control method and device
US9336136B2 (en) * 2014-10-08 2016-05-10 HGST Netherlands B.V. Apparatus, systems, and methods for providing wear leveling in solid state devices
CN106339324B (en) * 2016-08-19 2019-05-10 浪潮(北京)电子信息产业有限公司 A method and apparatus for selecting garbage collection blocks
CN106484323A (en) * 2016-09-13 2017-03-08 郑州云海信息技术有限公司 A kind of loss equalizing method of solid-state storage and system
CN106844227A (en) * 2017-01-14 2017-06-13 郑州云海信息技术有限公司 Solid state hard disc abrasion equilibrium method and device based on grouping mechanism
CN106990926A (en) * 2017-06-14 2017-07-28 郑州云海信息技术有限公司 A kind of processing method of solid state hard disc abrasion equilibrium
CN107562641A (en) * 2017-07-11 2018-01-09 捷开通讯(深圳)有限公司 The balance abrasion mthods, systems and devices of memory space
CN107562381A (en) * 2017-08-30 2018-01-09 紫光华山信息技术有限公司 A kind of data processing method and device
CN110211622A (en) * 2019-06-14 2019-09-06 山东大学 Improve the data erasing-writing method of multivalue NAND-flash memory data storage total amount
CN111124305B (en) * 2019-12-20 2021-08-31 浪潮电子信息产业股份有限公司 Solid state disk wear leveling method, device and computer readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102810068A (en) * 2011-05-30 2012-12-05 三星电子株式会社 Storage device, storage system and method of virtualizing storage device
CN103136121A (en) * 2013-03-25 2013-06-05 中国人民解放军国防科学技术大学 Cache management method for solid-state disc

Also Published As

Publication number Publication date
CN111124305A (en) 2020-05-08
WO2021120665A1 (en) 2021-06-24

Similar Documents

Publication Publication Date Title
CN111124305B (en) Solid state disk wear leveling method, device and computer readable storage medium
CN111090398B (en) Garbage recycling method, device and equipment for solid state disk and readable storage medium
US11704239B2 (en) Garbage collection method for storage medium, storage medium, and program product
CN110673789B (en) Metadata storage management method, device, equipment and storage medium of solid-state hard disk
CN107102819A (en) The method and apparatus of data is write to solid state hard disc
CN101419842B (en) Loss equalizing method, apparatus and system for hard disc
EP3118745A1 (en) A heuristic interface for enabling a computer device to utilize data property-based data placement inside a nonvolatile memory device
CN109753443B (en) Data processing method and device and electronic equipment
US20120317337A1 (en) Managing data placement on flash-based storage by use
CN101419573A (en) Storage management method, system and storage apparatus
CN106339324B (en) A method and apparatus for selecting garbage collection blocks
CN106990926A (en) A kind of processing method of solid state hard disc abrasion equilibrium
CN108681435A (en) A kind of abrasion equilibrium method of solid state disk, device, equipment and storage medium
US9946476B2 (en) Memory management method, memory control circuit unit and memory storage apparatus
CN103500072A (en) Data migration method and data migration device
CN111159058B (en) A wear leveling method, device and non-volatile storage device
EP2927779A1 (en) Disk writing method for disk arrays and disk writing device for disk arrays
KR101996641B1 (en) Apparatus and method for memory overlay
CN105117168A (en) Information processing method and electronic equipment
CN108170789A (en) A kind of classification storage method and relevant apparatus based on distributed file system
CN105224238B (en) Memory management method, memory storage device, and memory control circuit unit
CN120596011A (en) SSD wear leveling method, device and medium based on dynamic data migration
CN119718212A (en) Wear balance processing method, device, equipment and medium
CN106933653A (en) A kind of data file storage method of virtual machine, device and KVM virtual machines
CN105204775A (en) Electronic device and data writing method

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