[go: up one dir, main page]

CN111949201A - A storage device and its control method and control device - Google Patents

A storage device and its control method and control device Download PDF

Info

Publication number
CN111949201A
CN111949201A CN201910412956.5A CN201910412956A CN111949201A CN 111949201 A CN111949201 A CN 111949201A CN 201910412956 A CN201910412956 A CN 201910412956A CN 111949201 A CN111949201 A CN 111949201A
Authority
CN
China
Prior art keywords
physical block
erasing
physical
data
threshold
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.)
Pending
Application number
CN201910412956.5A
Other languages
Chinese (zh)
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.)
GigaDevice Semiconductor Beijing Inc
Beijing Zhaoyi Innovation Technology Co Ltd
Original Assignee
Beijing Zhaoyi Innovation 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 Beijing Zhaoyi Innovation Technology Co Ltd filed Critical Beijing Zhaoyi Innovation Technology Co Ltd
Priority to CN201910412956.5A priority Critical patent/CN111949201A/en
Publication of CN111949201A publication Critical patent/CN111949201A/en
Pending legal-status Critical Current

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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0658Controller construction arrangements
    • 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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING 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/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 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/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 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/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]

Landscapes

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

Abstract

本发明实施例公开了一种存储设备及其控制方法和控制装置,该存储设备包括存储模块,存储模块包括多个物理块,该控制方法包括:如果检测到物理块的擦除次数大于或等于第一擦除阈值,切换至磨损平衡模式;将第一物理块的数据和第二物理块的数据进行搬移交换,第一物理块的擦除次数小于第一擦除阈值,第二物理块的擦除次数大于第一擦除阈值。本发明实施例中,将第一物理块和第二物理块的数据交换,则经常被更新的数据搬移至第一物理块使得第一物理块的擦除机会增多,而第二物理块的擦除机会减小,由此降低了至少两个物理块的擦除次数差异,提高了磨损平衡效果,达到了物理块的均衡使用,减小了物理块损耗程度,延长了设备端物理块的使用寿命。

Figure 201910412956

Embodiments of the present invention disclose a storage device and a control method and control device thereof. The storage device includes a storage module, and the storage module includes a plurality of physical blocks. The control method includes: if it is detected that the erasing times of the physical blocks are greater than or equal to The first erasing threshold is switched to the wear leveling mode; the data of the first physical block and the data of the second physical block are moved and exchanged, the erasing times of the first physical block is less than the first erasing threshold, and the second physical block is The number of times of erasing is greater than the first erasing threshold. In the embodiment of the present invention, the data of the first physical block and the second physical block are exchanged, and the frequently updated data is moved to the first physical block, so that the erasing opportunities of the first physical block are increased, while the erasing opportunities of the second physical block are increased. The removal opportunity is reduced, thereby reducing the difference in the number of erasures between at least two physical blocks, improving the wear leveling effect, achieving a balanced use of physical blocks, reducing the degree of physical block wear, and extending the use of physical blocks on the device side. life.

Figure 201910412956

Description

一种存储设备及其控制方法和控制装置A storage device and its control method and control device

技术领域technical field

本发明实施例涉及存储技术,尤其涉及一种存储设备及其控制方法和控制装置。Embodiments of the present invention relate to storage technologies, and in particular, to a storage device and a control method and control device thereof.

背景技术Background technique

磨损平衡Wear leveling是大多数固态硬盘SSD产品都会实现的闪存转换层FTL算法之一。其核心思想是平衡设备端的所有物理块的擦写次数。Wear leveling is one of the flash translation layer FTL algorithms that most solid-state drive SSD products will implement. Its core idea is to balance the erasing and writing times of all physical blocks on the device side.

现有技术中,采用随机性算法执行磨损平衡机制,具体的按照均匀分布概率,随机选择某个物理块进行擦除操作。不论物理块上存放的是“冷”数据还是“热”数据,让每个物理块被擦除的概率相等,之后将原始块中的有效数据复制到空的块后擦除该块。In the prior art, a randomness algorithm is used to implement a wear leveling mechanism, and specifically, a certain physical block is randomly selected for an erasing operation according to a uniform distribution probability. Regardless of whether the physical block contains "cold" data or "hot" data, let each physical block have an equal probability of being erased, and then copy the valid data in the original block to an empty block and erase the block.

显然,该算法效果受随机因素影响较大,每个块的擦除次数并不能达到等概率,因此不能达到良好的磨损平衡效果。Obviously, the effect of this algorithm is greatly affected by random factors, and the number of erasures of each block cannot reach equal probability, so it cannot achieve a good wear balance effect.

发明内容SUMMARY OF THE INVENTION

本发明实施例提供一种存储设备及其控制方法和控制装置,以提高磨损平衡效果。Embodiments of the present invention provide a storage device and a control method and control device thereof, so as to improve the wear leveling effect.

本发明实施例提供了一种存储设备的控制方法,所述存储设备包括存储模块,所述存储模块包括多个物理块,该控制方法包括:An embodiment of the present invention provides a control method for a storage device, where the storage device includes a storage module, and the storage module includes a plurality of physical blocks, and the control method includes:

如果检测到所述物理块的擦除次数大于或等于第一擦除阈值,切换至磨损平衡模式;If it is detected that the erasing times of the physical block is greater than or equal to the first erasing threshold, switch to the wear leveling mode;

将第一物理块的数据和第二物理块的数据进行搬移交换,其中,所述第一物理块的擦除次数小于所述第一擦除阈值,所述第二物理块的擦除次数大于所述第一擦除阈值。The data of the first physical block and the data of the second physical block are moved and exchanged, wherein the erasing times of the first physical block is less than the first erasing threshold, and the erasing times of the second physical block is greater than the first erase threshold.

进一步地,所述第一擦除阈值等于所述存储模块中多个物理块的擦除次数均值。Further, the first erasing threshold is equal to the mean value of erasing times of a plurality of physical blocks in the storage module.

进一步地,将第一物理块的数据和第二物理块的数据进行搬移交换包括:Further, moving and exchanging the data of the first physical block and the data of the second physical block includes:

将所述多个物理块中擦除次数最小的物理块确定为所述第一物理块,将所述多个物理块中擦除次数最大的物理块确定为所述第二物理块,并交换所述第一物理块和所述第二物理块的数据。Determining the physical block with the smallest number of erasures among the plurality of physical blocks as the first physical block, determining the physical block with the largest number of erasures among the plurality of physical blocks as the second physical block, and swapping data of the first physical block and the second physical block.

进一步地,检测到所述物理块的擦除次数大于或等于第一擦除阈值之前,还包括:Further, before detecting that the erasing times of the physical block is greater than or equal to the first erasing threshold, the method further includes:

接收第一操作命令并确定所述第一操作命令对应的物理块,再检测该物理块的擦除次数是否大于或等于所述第一擦除阈值。Receive the first operation command, determine the physical block corresponding to the first operation command, and then detect whether the erasing times of the physical block is greater than or equal to the first erasing threshold.

基于同一发明构思,本发明实施例还提供了一种存储设备的控制装置,所述存储设备包括存储模块,所述存储模块包括多个物理块,该控制装置包括:Based on the same inventive concept, an embodiment of the present invention further provides a control device for a storage device, the storage device includes a storage module, the storage module includes a plurality of physical blocks, and the control device includes:

模式切换模块,用于如果检测到所述物理块的擦除次数大于或等于第一擦除阈值,切换至磨损平衡模式;a mode switching module, configured to switch to the wear leveling mode if it is detected that the erasing times of the physical block is greater than or equal to the first erasing threshold;

数据搬移模块,用于将第一物理块的数据和第二物理块的数据进行搬移交换,其中,所述第一物理块的擦除次数小于所述第一擦除阈值,所述第二物理块的擦除次数大于所述第一擦除阈值。A data moving module, configured to move and exchange the data of the first physical block and the data of the second physical block, wherein the erasing times of the first physical block is less than the first erasing threshold, and the second physical block is erased. The number of times of erasing the block is greater than the first erasing threshold.

进一步地,所述第一擦除阈值等于所述存储模块中多个物理块的擦除次数均值。Further, the first erasing threshold is equal to the mean value of erasing times of a plurality of physical blocks in the storage module.

进一步地,所述数据搬移模块,具体用于将所述多个物理块中擦除次数最小的物理块确定为所述第一物理块,将所述多个物理块中擦除次数最大的物理块确定为所述第二物理块,并交换所述第一物理块和所述第二物理块的数据。Further, the data moving module is specifically configured to determine the physical block with the smallest number of erasures among the multiple physical blocks as the first physical block, and determine the physical block with the largest number of erasures among the multiple physical blocks. A block is determined as the second physical block, and data of the first physical block and the second physical block are exchanged.

进一步地,还包括:Further, it also includes:

检测模块,用于接收第一操作命令并确定所述第一操作命令对应的物理块,再检测该物理块的擦除次数是否大于或等于所述第一擦除阈值。The detection module is configured to receive the first operation command and determine the physical block corresponding to the first operation command, and then detect whether the erasing times of the physical block is greater than or equal to the first erasing threshold.

基于同一发明构思,本发明实施例还提供了一种存储设备,所述存储设备包括存储模块和如上所述的控制装置,所述控制装置与所述存储模块电连接。Based on the same inventive concept, an embodiment of the present invention further provides a storage device, the storage device includes a storage module and the above-mentioned control device, and the control device is electrically connected to the storage module.

本发明实施例中,采用确定性算法,根据存储设备中物理块的擦除次数是否大于或等于第一擦除阈值来判段是否触发磨损平衡,在触发磨损平衡模式后将擦除次数小于第一擦除阈值的第一物理块和擦除次数大于第一擦除阈值的第二物理块的数据进行交换。由于第二物理块擦除次数大,说明第二物理块的数据经常被更新以得到较多的擦除机会,而第一物理块擦除次数小,说明第一物理块的数据很少被更新故很少得到擦除机会,将第一物理块和第二物理块的数据交换,则经常被更新的数据搬移至第一物理块使得第一物理块的擦除机会增多,反之第二物理块的擦除机会减小,由此降低了存储设备中至少两个物理块的擦除次数差异,提高了磨损平衡效果,达到了物理块的均衡使用,减小了物理块损耗程度,延长了设备端物理块的使用寿命。In this embodiment of the present invention, a deterministic algorithm is used to determine whether a segment triggers wear leveling according to whether the number of erasures of physical blocks in the storage device is greater than or equal to the first erasure threshold, and after triggering the wear leveling mode, the number of erasures is less than the first erasure threshold. The first physical block with an erasing threshold and the data of the second physical block whose erasing times are greater than the first erasing threshold are exchanged. Since the second physical block has a large number of erasures, it means that the data of the second physical block is frequently updated to obtain more erasure opportunities, while the number of erasures of the first physical block is small, indicating that the data of the first physical block is rarely updated. Therefore, the erasure opportunities are rarely obtained. If the data of the first physical block and the second physical block are exchanged, the frequently updated data is moved to the first physical block, which increases the erasing opportunities of the first physical block, and vice versa. Therefore, the difference in the number of erasures of at least two physical blocks in the storage device is reduced, the wear leveling effect is improved, the balanced use of physical blocks is achieved, the degree of physical block wear is reduced, and the equipment is prolonged. End physical block lifetime.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图做一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the embodiments of the present invention or the technical solutions in the prior art more clearly, the following will briefly introduce the accompanying drawings used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to these drawings without creative efforts.

图1是本发明实施例提供的一种存储设备的控制方法的流程图;1 is a flowchart of a method for controlling a storage device provided by an embodiment of the present invention;

图2是本发明实施例提供的一种存储设备的控制装置的示意图。FIG. 2 is a schematic diagram of a control apparatus of a storage device according to an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚,以下将参照本发明实施例中的附图,通过实施方式清楚、完整地描述本发明的技术方案,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the following will refer to the accompanying drawings in the embodiments of the present invention, and describe the technical solutions of the present invention clearly and completely through the implementation manner. Obviously, the described embodiments are the present invention. Some examples, but not all examples. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

如图1所示,为本发明实施例提供的一种存储设备的控制方法的流程图,该存储设备可选为任意集成有存储模块的芯片或器件,例如集成有闪存颗粒的固态硬盘,在其他实施例中还可选该存储设备为其他集成有存储模块的器件。在此,存储设备包括存储模块,存储模块包括多个物理块,存储模块以物理块为单元进行数据写入。本实施例中集成在存储设备的控制装置可执行该控制方法,该控制装置采用软件和/或硬件的方式实现。As shown in FIG. 1 , it is a flowchart of a method for controlling a storage device provided by an embodiment of the present invention. The storage device can be any chip or device integrated with a storage module, such as a solid-state hard disk integrated with flash memory particles. In other embodiments, the storage device can also be selected to be another device integrated with a storage module. Here, the storage device includes a storage module, the storage module includes a plurality of physical blocks, and the storage module writes data in units of physical blocks. In this embodiment, the control apparatus integrated in the storage device may execute the control method, and the control apparatus may be implemented by means of software and/or hardware.

本实施例提供的存储设备的控制方法包括:The control method of the storage device provided by this embodiment includes:

步骤110、如果检测到物理块的擦除次数大于或等于第一擦除阈值,切换至磨损平衡模式。Step 110: If it is detected that the erasing times of the physical block is greater than or equal to the first erasing threshold, switch to the wear leveling mode.

本实施例中,对于存储设备中所有的物理块,控制装置中存储有每个物理块的擦除次数,并且控制装置在每次操作之后会及时更新每个物理块的擦除次数。控制装置检测到物理块的擦除次数大于或等于第一擦除阈值时,触发磨损平衡。In this embodiment, for all physical blocks in the storage device, the control device stores the erasure times of each physical block, and the control device updates the erasure times of each physical block in time after each operation. The control device triggers wear leveling when detecting that the number of times of erasing the physical block is greater than or equal to the first erasing threshold.

需要说明的是,第一擦除阈值是与物理块擦除次数相关的参数,其目的在于使得物理块擦除次数均衡,因此第一擦除阈值可以是预先设定的固定值,也可以是随着物理块擦除次数而变化的不定值。例如,可选第一擦除阈值等于存储模块中多个物理块的擦除次数均值,即存储设备中各个物理块的擦除次数求和再求平均值得出的数值即为第一擦除阈值。还可选第一擦除阈值等于(m+n)/2,m为存储设备中物理块的最大擦除次数,n为存储设备中物理块的最小擦除次数。还可选第一擦除阈值为k,k为固定值。在保证能够达到物理块的均衡使用的基础上,可合理设定第一擦除阈值。It should be noted that the first erasing threshold is a parameter related to the number of physical block erasures, and its purpose is to balance the number of physical block erasing. Therefore, the first erasing threshold may be a preset fixed value, or may be An indeterminate value that varies with the number of physical block erases. For example, the optional first erasing threshold is equal to the average of erasing times of multiple physical blocks in the storage module, that is, the value obtained by summing the erasing times of each physical block in the storage device and then averaging the value is the first erasing threshold . Optionally, the first erasing threshold is equal to (m+n)/2, where m is the maximum erasing number of physical blocks in the storage device, and n is the minimum erasing number of physical blocks in the storage device. Optionally, the first erasing threshold is k, and k is a fixed value. The first erasing threshold may be reasonably set on the basis of ensuring that the physical blocks can be used in a balanced manner.

可选的,检测到物理块的擦除次数大于或等于第一擦除阈值之前,还包括:接收第一操作命令并确定第一操作命令对应的物理块,再检测该物理块的擦除次数是否大于或等于第一擦除阈值。本实施例中第一操作命令可以是读操作、写操作或擦除操作等任意一种针对存储设备的操作命令。控制装置根据第一操作命令可以确定该命令对应的物理块,然后检测该物理块的擦除次数是否大于或等于第一擦除阈值。在此将存储设备接收到操作命令作为检测物理块擦除次数的触发条件的目的在于,避免存储设备频繁执行磨损平衡而占用用户擦写时间。可选在执行完第一操作命令之后,再执行磨损平衡的数据交换。Optionally, before detecting that the erasing times of the physical block is greater than or equal to the first erasing threshold, the method further includes: receiving the first operation command and determining the physical block corresponding to the first operation command, and then detecting the erasing times of the physical block. Is greater than or equal to the first erase threshold. In this embodiment, the first operation command may be any operation command for the storage device, such as a read operation, a write operation, or an erase operation. The control device can determine the physical block corresponding to the command according to the first operation command, and then detect whether the erasing times of the physical block is greater than or equal to the first erasing threshold. The purpose of using the storage device receiving an operation command as a triggering condition for detecting the number of physical block erasures is to prevent the storage device from frequently performing wear leveling and occupying the user's erasing and writing time. Optionally, after the first operation command is executed, the data exchange of wear leveling is executed.

步骤120、将第一物理块的数据和第二物理块的数据进行搬移交换,其中,第一物理块的擦除次数小于第一擦除阈值,第二物理块的擦除次数大于第一擦除阈值。Step 120: Move and exchange the data of the first physical block and the data of the second physical block, wherein the erasing times of the first physical block is less than the first erasing threshold, and the erasing times of the second physical block is greater than the first erasing threshold. except threshold.

本实施例中,触发磨损平衡后,控制装置可从多个物理块中选取出执行磨损平衡机制的第一物理块和第二物理块,进行搬移交换,实现第一物理块和第二物理块的均衡使用。具体的,将其中擦除次数小于第一擦除阈值的至少一个物理块确定为第一物理块,将其中擦除次数大于第一擦除阈值的至少一个物理块确定为第二物理块,然后交换第一物理块和第二物理块中的数据。需要说明的是,存储设备中擦除次数小于第一擦除阈值的物理块可能有多个,则可选取其中至少一个物理块作为第一物理块,或者,可选取其中擦除次数最小的物理块作为第一物理块;存储设备中擦除次数大于第一擦除阈值的物理块可能有多个,则可选取其中至少一个物理块作为第二物理块,或者,可选取其中擦除次数最大的物理块作为第二物理块,在本发明中不进行具体限定。In this embodiment, after the wear leveling is triggered, the control device may select the first physical block and the second physical block for implementing the wear leveling mechanism from the plurality of physical blocks, and perform transfer and exchange to realize the first physical block and the second physical block. balanced use. Specifically, at least one physical block in which the number of erasures is less than the first erasure threshold is determined as the first physical block, and at least one physical block in which the number of erasures is greater than the first erasure threshold is determined as the second physical block, and then Swap data in the first physical block and the second physical block. It should be noted that, there may be multiple physical blocks in the storage device whose erasing times are less than the first erasing threshold. The block is used as the first physical block; there may be multiple physical blocks in the storage device whose erasing times are greater than the first erasing threshold, then at least one physical block can be selected as the second physical block, or the largest erasing times can be selected. The physical block is used as the second physical block, which is not specifically limited in the present invention.

可选的,将第一物理块的数据和第二物理块的数据进行搬移交换包括:将多个物理块中擦除次数最小的物理块确定为第一物理块,将多个物理块中擦除次数最大的物理块确定为第二物理块,并交换第一物理块和第二物理块的数据。由此可减小物理块中擦除次数差异,达到良好的磨损平衡效果。Optionally, moving and exchanging the data of the first physical block and the data of the second physical block includes: determining the physical block with the smallest number of erasures among the multiple physical blocks as the first physical block, and erasing the multiple physical blocks. The physical block with the largest number of divisions is determined as the second physical block, and the data of the first physical block and the second physical block are exchanged. Therefore, the difference in the number of erasures in the physical block can be reduced, and a good wear balance effect can be achieved.

本实施例中,采用确定性算法,根据存储设备中物理块的擦除次数是否大于或等于第一擦除阈值来判段是否触发磨损平衡,在触发磨损平衡模式后将擦除次数小于第一擦除阈值的第一物理块和擦除次数大于第一擦除阈值的第二物理块的数据进行交换。由于第二物理块擦除次数大,说明第二物理块的数据经常被更新以得到较多的擦除机会,而第一物理块擦除次数小,说明第一物理块的数据很少被更新故很少得到擦除机会,将第一物理块和第二物理块的数据交换,则经常被更新的数据搬移至第一物理块使得第一物理块的擦除机会增多,反之第二物理块的擦除机会减小,由此降低了存储设备中至少两个物理块的擦除次数差异,提高了磨损平衡效果,达到了物理块的均衡使用,减小了物理块损耗程度,延长了设备端物理块的使用寿命。In this embodiment, a deterministic algorithm is used to determine whether the segment triggers wear leveling according to whether the number of times of erasing a physical block in the storage device is greater than or equal to the first erasure threshold. The data of the first physical block whose erasing threshold is greater than the first erasing threshold and the data of the second physical block whose number of times of erasing is greater than the first erasing threshold is exchanged. Since the second physical block has a large number of erasures, it means that the data of the second physical block is frequently updated to obtain more erasure opportunities, while the number of erasures of the first physical block is small, indicating that the data of the first physical block is rarely updated. Therefore, the erasure opportunities are rarely obtained. If the data of the first physical block and the second physical block are exchanged, the frequently updated data is moved to the first physical block, which increases the erasing opportunities of the first physical block, and vice versa. Therefore, the difference in the number of erasures of at least two physical blocks in the storage device is reduced, the wear leveling effect is improved, the balanced use of physical blocks is achieved, the degree of physical block wear is reduced, and the equipment is prolonged. End physical block lifetime.

基于同一发明构思,本发明实施例还提供了一种存储设备的控制装置,该控制装置可执行上述任意实施例所述的控制方法。存储设备包括存储模块,存储模块包括多个物理块。Based on the same inventive concept, an embodiment of the present invention further provides a control apparatus for a storage device, where the control apparatus can execute the control method described in any of the foregoing embodiments. The storage device includes a storage module, and the storage module includes a plurality of physical blocks.

本实施例提供的存储设备的控制装置包括:模式切换模块210,用于如果检测到物理块的擦除次数大于或等于第一擦除阈值,切换至磨损平衡模式;数据搬移模块220,用于将第一物理块的数据和第二物理块的数据进行搬移交换,其中,第一物理块的擦除次数小于第一擦除阈值,第二物理块的擦除次数大于第一擦除阈值。The control apparatus of the storage device provided in this embodiment includes: a mode switching module 210, configured to switch to the wear leveling mode if it is detected that the erasing times of the physical block is greater than or equal to the first erasing threshold; and the data moving module 220, configured to The data of the first physical block and the data of the second physical block are moved and exchanged, wherein the erasing times of the first physical block is less than the first erasing threshold, and the erasing times of the second physical block is greater than the first erasing threshold.

可选第一擦除阈值等于存储模块中多个物理块的擦除次数均值。The optional first erasing threshold is equal to the mean value of erasing times of multiple physical blocks in the storage module.

可选数据搬移模块,具体用于将多个物理块中擦除次数最小的物理块确定为第一物理块,将多个物理块中擦除次数最大的物理块确定为第二物理块,并交换第一物理块和第二物理块的数据。The optional data moving module is specifically used to determine the physical block with the smallest number of erasures among the multiple physical blocks as the first physical block, and determine the physical block with the largest number of erasures among the multiple physical blocks as the second physical block, and The data of the first physical block and the second physical block are exchanged.

可选该控制装置还包括:检测模块,用于接收第一操作命令并确定第一操作命令对应的物理块,再检测该物理块的擦除次数是否大于或等于第一擦除阈值。Optionally, the control device further includes: a detection module configured to receive the first operation command and determine the physical block corresponding to the first operation command, and then detect whether the erasing times of the physical block is greater than or equal to the first erasing threshold.

本实施例中,采用确定性算法执行磨损平衡机制。第二物理块擦除次数大,说明第二物理块的数据经常被更新以得到较多的擦除机会,而第一物理块擦除次数小,说明第一物理块的数据很少被更新故很少得到擦除机会,将第一物理块和第二物理块的数据交换,则经常被更新的数据搬移至第一物理块使得第一物理块的擦除机会增多,反之第二物理块的擦除机会减小,由此降低了存储设备中至少两个物理块的擦除次数差异,实现了磨损平衡,减小了物理块损耗程度,延长了设备使用寿命。In this embodiment, a deterministic algorithm is used to implement the wear leveling mechanism. The second physical block has a large number of erasures, indicating that the data of the second physical block is frequently updated to obtain more erasure opportunities, while the first physical block has a small number of erasures, indicating that the data of the first physical block is rarely updated. Rarely get erasing opportunities, exchange the data of the first physical block and the second physical block, then the frequently updated data is moved to the first physical block, which increases the erasing opportunities of the first physical block, and vice versa. The erasure opportunity is reduced, thereby reducing the difference in the number of erasures of at least two physical blocks in the storage device, achieving wear leveling, reducing the degree of physical block wear, and prolonging the service life of the device.

现有技术中,采用随机性算法执行磨损平衡机制,具体的按照均匀分布概率,随机选择某个物理块进行擦除操作。不论物理块上存放的是“冷”数据还是“热”数据,让每个物理块被擦除的概率相等,之后将原始块中的有效数据复制到空的块后擦除该块。显然,该算法效果受随机因素影响较大,每个块的擦除次数并不能达到等概率,因此不能达到良好的磨损平衡效果。In the prior art, a randomness algorithm is used to implement a wear leveling mechanism, and specifically, a certain physical block is randomly selected for an erasing operation according to a uniform distribution probability. Regardless of whether the physical block contains "cold" data or "hot" data, let each physical block have an equal probability of being erased, and then copy the valid data in the original block to an empty block and erase the block. Obviously, the effect of this algorithm is greatly affected by random factors, and the number of erasures of each block cannot reach equal probability, so it cannot achieve a good wear balance effect.

本实施例中,通过该方法使得数据每次被写入到内存中的不同物理块中,达到了物理块的均衡使用,提高了设备端物理块的使用寿命,可以最大限度地使用设备物理块,减少了损耗程度,延长了设备的最长使用期限。In this embodiment, by this method, data is written into different physical blocks in the memory each time, so as to achieve balanced use of physical blocks, improve the service life of physical blocks on the device side, and maximize the use of physical blocks on the device , reducing the degree of wear and tear and extending the longest service life of the equipment.

基于同一发明构思,本发明实施例还提供了一种存储设备,存储设备包括存储模块和如上任意实施例所述的控制装置,控制装置与存储模块电连接。可选存储模块为与非闪存NAND Flash,存储设备为固态硬盘SSD。Based on the same inventive concept, an embodiment of the present invention further provides a storage device, the storage device includes a storage module and the control device described in any of the above embodiments, and the control device is electrically connected to the storage module. The optional storage module is NAND Flash, and the storage device is SSD.

注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整、相互结合和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, combinations and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention. The scope is determined by the scope of the appended claims.

Claims (9)

1. A control method of a storage device, wherein the storage device includes a storage module, the storage module includes a plurality of physical blocks, the control method comprising:
if the number of times of erasing the physical block is detected to be larger than or equal to a first erasing threshold value, switching to a wear leveling mode;
and carrying out moving exchange on the data of the first physical block and the data of the second physical block, wherein the erasing times of the first physical block are smaller than the first erasing threshold value, and the erasing times of the second physical block are larger than the first erasing threshold value.
2. The method of claim 1, wherein the first erase threshold is equal to an average number of erases of a plurality of physical blocks in the memory module.
3. The control method according to claim 1, wherein the moving and exchanging the data of the first physical block and the data of the second physical block comprises:
and determining the physical block with the minimum erasing times in the plurality of physical blocks as the first physical block, determining the physical block with the maximum erasing times in the plurality of physical blocks as the second physical block, and exchanging data of the first physical block and the second physical block.
4. The method of claim 1, wherein before detecting that the number of times the physical block is erased is greater than or equal to a first erase threshold, the method further comprises:
receiving a first operation command, determining a physical block corresponding to the first operation command, and detecting whether the erasing times of the physical block is greater than or equal to the first erasing threshold.
5. A control apparatus of a storage device, wherein the storage device includes a storage module including a plurality of physical blocks, the control apparatus comprising:
the mode switching module is used for switching to a wear leveling mode if the fact that the erasing times of the physical block are larger than or equal to a first erasing threshold value is detected;
and the data moving module is used for moving and exchanging the data of the first physical block and the data of the second physical block, wherein the erasing times of the first physical block are less than the first erasing threshold, and the erasing times of the second physical block are greater than the first erasing threshold.
6. The control device of claim 5, wherein the first erase threshold is equal to an average number of erases of a plurality of physical blocks in the memory module.
7. The control device according to claim 5, wherein the data moving module is specifically configured to determine a physical block with a smallest number of times of erasure from among the plurality of physical blocks as the first physical block, determine a physical block with a largest number of times of erasure from among the plurality of physical blocks as the second physical block, and exchange data of the first physical block and the second physical block.
8. The control device according to claim 5, characterized by further comprising:
the detection module is used for receiving a first operation command, determining a physical block corresponding to the first operation command, and then detecting whether the erasing times of the physical block is larger than or equal to the first erasing threshold.
9. A memory device, characterized in that the memory device comprises a memory module and a control means according to any of claims 5-8, which control means is electrically connected to the memory module.
CN201910412956.5A 2019-05-17 2019-05-17 A storage device and its control method and control device Pending CN111949201A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910412956.5A CN111949201A (en) 2019-05-17 2019-05-17 A storage device and its control method and control device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910412956.5A CN111949201A (en) 2019-05-17 2019-05-17 A storage device and its control method and control device

Publications (1)

Publication Number Publication Date
CN111949201A true CN111949201A (en) 2020-11-17

Family

ID=73336819

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910412956.5A Pending CN111949201A (en) 2019-05-17 2019-05-17 A storage device and its control method and control device

Country Status (1)

Country Link
CN (1) CN111949201A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407126A (en) * 2021-08-20 2021-09-17 苏州浪潮智能科技有限公司 Wear leveling method, device, equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100023675A1 (en) * 2008-07-23 2010-01-28 Phison Electronics Corp. Wear leveling method, and storage system and controller using the same
CN107908570A (en) * 2017-10-25 2018-04-13 记忆科技(深圳)有限公司 A kind of method for realizing solid state hard disc abrasion equilibrium
CN108154899A (en) * 2018-02-28 2018-06-12 长江存储科技有限责任公司 Flush memory device and its method for deleting
CN109524046A (en) * 2018-09-05 2019-03-26 广东工业大学 A kind of flash memory abrasion equalization algorithm of low memory consumption
CN109542354A (en) * 2018-11-28 2019-03-29 广东工业大学 A kind of abrasion equilibrium method, device and equipment based on the erasing upper limit

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100023675A1 (en) * 2008-07-23 2010-01-28 Phison Electronics Corp. Wear leveling method, and storage system and controller using the same
CN107908570A (en) * 2017-10-25 2018-04-13 记忆科技(深圳)有限公司 A kind of method for realizing solid state hard disc abrasion equilibrium
CN108154899A (en) * 2018-02-28 2018-06-12 长江存储科技有限责任公司 Flush memory device and its method for deleting
CN109524046A (en) * 2018-09-05 2019-03-26 广东工业大学 A kind of flash memory abrasion equalization algorithm of low memory consumption
CN109542354A (en) * 2018-11-28 2019-03-29 广东工业大学 A kind of abrasion equilibrium method, device and equipment based on the erasing upper limit

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CANY1000: "Flash磨损均衡技术解析(wear-leveling)", pages 1, Retrieved from the Internet <URL:https://blog.csdn.net/dongyanxia1000/article/details/79458082> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407126A (en) * 2021-08-20 2021-09-17 苏州浪潮智能科技有限公司 Wear leveling method, device, equipment and readable storage medium

Similar Documents

Publication Publication Date Title
TWI632457B (en) Method of wear leveling for data storage device
US8699287B2 (en) Techniques for increasing a lifetime of blocks of memory
KR100974954B1 (en) Read Wear Leveling Method in Storage Devices Using Flash Memory
US8103820B2 (en) Wear leveling method and controller using the same
US8230184B2 (en) Techniques for writing data to different portions of storage devices based on write frequency
US20160034202A1 (en) Multi-tiered storage device system and method thereof
CN106164873B (en) Method and apparatus for constraining writes to solid-state memory when end-of-life conditions are reached
CN114303197A (en) Read disturb scan combining
US11500547B2 (en) Mitigating data errors in a storage device
CN107329902B (en) Data storage device and flash memory control method
TW200907965A (en) Flash memory refresh techniques triggered by controlled scrub data reads
TWI606336B (en) Memory device and control unit thereof, and data storage method for memory device
US20170199680A1 (en) System and method of write amplification factor mitigation and flash lifespan extension
JP5858081B2 (en) Memory controller, memory system, and memory control method
US9778862B2 (en) Data storing method for preventing data losing during flush operation, memory control circuit unit and memory storage apparatus
CN111949569A (en) A storage device and its control method and control device
JP2018160060A (en) Memory system
KR20180042699A (en) Data storage device and operating method thereof
CN111949201A (en) A storage device and its control method and control device
KR20180039802A (en) Data storage device and operating method thereof
CN103425586B (en) Storage unit management method, memory controller and memory storage device
US20110055459A1 (en) Method for managing a plurality of blocks of a flash memory, and associated memory device and controller thereof
KR20170045406A (en) Data storage device and operating method thereof
CN107346216A (en) A kind of storage device and its data processing 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
CB02 Change of applicant information

Address after: Room 101, Floor 1-5, Building 8, Yard 9, Fenghao East Road, Haidian District, Beijing 100094

Applicant after: Zhaoyi Innovation Technology Group Co.,Ltd.

Address before: 100083 12 Floors, Block A, Tiangong Building, Science and Technology University, 30 College Road, Haidian District, Beijing

Applicant before: GIGADEVICE SEMICONDUCTOR(BEIJING) Inc.

CB02 Change of applicant information
RJ01 Rejection of invention patent application after publication

Application publication date: 20201117

RJ01 Rejection of invention patent application after publication