CN110659217B - Garbage recycling method, device and equipment for solid state disk and storage medium - Google Patents

Garbage recycling method, device and equipment for solid state disk and storage medium Download PDF

Info

Publication number
CN110659217B
CN110659217B CN201910818228.4A CN201910818228A CN110659217B CN 110659217 B CN110659217 B CN 110659217B CN 201910818228 A CN201910818228 A CN 201910818228A CN 110659217 B CN110659217 B CN 110659217B
Authority
CN
China
Prior art keywords
garbage collection
garbage
solid state
subjected
state disk
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
CN201910818228.4A
Other languages
Chinese (zh)
Other versions
CN110659217A (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN201910818228.4A priority Critical patent/CN110659217B/en
Publication of CN110659217A publication Critical patent/CN110659217A/en
Application granted granted Critical
Publication of CN110659217B publication Critical patent/CN110659217B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1032Reliability improvement, data loss prevention, degraded operation etc
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/21Employing a record carrier using a specific recording technology
    • G06F2212/214Solid state disk

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)

Abstract

The application discloses a method, a device, equipment and a medium for recycling garbage of a solid state disk, wherein the method comprises the following steps: when a forced garbage collection request is received, determining a target physical block to be subjected to garbage collection in a solid state disk; judging whether the number of physical blocks to be garbage recycled in the GC linked list reaches a preset limited number or not; if not, adding the target physical block to be recycled to the GC linked list; if yes, setting a garbage recycling mark for the target physical block to be subjected to garbage recycling; traversing each physical block in the solid state disk according to a preset time period, and adding the currently scanned physical blocks to be garbage recycled, which are provided with garbage recycling marks, into the GC chain table when the physical blocks to be garbage recycled in the GC chain table do not reach a preset limited number; and sequentially moving effective data in the physical blocks to be garbage-recovered in the GC linked list to a target idle block according to a preset sequence, and deleting the physical blocks to be garbage-recovered after the moving operation is executed, so that the performance stability of the solid state disk is improved.

Description

Garbage recycling method, device and equipment for solid state disk and storage medium
Technical Field
The invention relates to the field of solid state disks, in particular to a garbage recycling method, a garbage recycling device, garbage recycling equipment and a computer readable storage medium of a solid state disk.
Background
In the solid state disk, after data written in the NAND Flash is held (retained) for a preset time length, in order to avoid data loss, a forced moving operation is required, that is, a garbage collection operation is required for the solid state disk.
When garbage collection is realized on the solid state disk, the method takes a physical block as a unit: firstly, data moving operation is carried out on a physical block corresponding to a physical page in the solid state disk, wherein effective data are stored in the physical page, namely the effective data in the physical block to be subjected to garbage collection are moved to a target idle block, and then the original physical block to be subjected to garbage collection is deleted, so that addressing burden can be reduced, and more idle physical blocks can be reserved.
However, if the time for writing data into a large number of physical blocks in the solid state disk is concentrated in a period of time, the physical blocks will need to be moved forcibly in the same period of time, which will cause a garbage collection storm, occupy a large amount of operating resources, and cause unstable performance of the solid state disk.
Therefore, how to improve the stability of the performance of the solid state disk on the basis of relieving the garbage collection storm of the solid state disk is a technical problem to be solved by the technical personnel in the field.
Disclosure of Invention
In view of this, the present invention provides a garbage collection method for a solid state disk, which can improve the stability of the performance of the solid state disk on the basis of alleviating a garbage collection storm of the solid state disk; another object of the present invention is to provide a garbage recycling device, apparatus and computer readable storage medium for solid state disk, all of which have the above advantages.
In order to solve the technical problem, the invention provides a garbage recycling method for a solid state disk, which comprises the following steps:
when a mandatory garbage collection request is received, determining a target physical block to be subjected to garbage collection in a solid state disk according to the mandatory garbage collection request;
judging whether the number of physical blocks to be garbage recycled in the GC linked list reaches a preset limited number or not;
if not, adding the target physical block to be recycled to the GC linked list;
if yes, setting a garbage recycling mark for the target physical block to be subjected to garbage recycling;
traversing each physical block in the solid state disk according to a preset time period, and adding the currently scanned target physical block to be subjected to garbage collection, which is provided with the garbage collection mark, to the GC chain table when the physical blocks to be subjected to garbage collection in the GC chain table do not reach the preset limited number;
and sequentially moving the effective data in the physical blocks to be subjected to garbage collection in the GC linked list to a target idle block according to a preset sequence, and deleting the physical blocks to be subjected to garbage collection after the moving operation is executed.
Preferably, the traversing each physical block in the solid state disk according to a preset time period, and when the physical blocks to be garbage collected in the GC chain table do not reach the preset limited number, adding the currently scanned target physical block to be garbage collected, which is provided with the garbage collection flag, to the GC chain table specifically includes:
scanning and judging whether each physical block in the solid state disk is provided with the garbage recycling mark or not according to a preset time period;
if so, further judging whether the first number of the physical blocks to be garbage recycled in the GC linked list is smaller than the preset limited number or not;
if the number of the target physical blocks to be subjected to garbage collection is smaller than the preset number, adding the currently scanned target physical blocks to be subjected to garbage collection with the garbage collection marks into the GC linked list;
and if so, not processing, and performing the steps of scanning in sequence according to a preset time period and judging whether each physical block in the solid state disk is provided with the garbage recycling mark or not.
Preferably, the forced garbage collection request is specifically triggered to be generated when a read-write error of Flash is detected, and/or when the data retention time of the data information written into the NAND reaches the upper limit of the data retention time limited by the NAND characteristic, and/or when the number of read interferences of the data information written into the NAND reaches the upper limit of the number of read interferences limited by the NAND characteristic.
Preferably, the preset time period is 20 ms.
Preferably, further comprising:
recording a second number of the target physical blocks to be subjected to garbage collection, which are provided with the garbage collection marks, in the solid state disk in real time;
when the second quantity is larger than a preset quantity threshold value, entering a step of determining a target physical block to be subjected to garbage collection in the solid state disk according to the mandatory garbage collection request when the mandatory garbage collection request is received; otherwise, the process is exited.
In order to solve the above technical problem, the present invention further provides a garbage recycling apparatus for solid state disk, including:
the determining module is used for determining a target physical block to be subjected to garbage collection in the solid state disk according to the mandatory garbage collection request when the mandatory garbage collection request is received;
the judging module is used for judging whether the number of the physical blocks to be subjected to garbage recovery in the GC linked list reaches a preset limited number or not; if not, calling a first execution module; if yes, calling a second execution module;
the first execution module is configured to add the target physical block to be recycled to garbage to the GC linked list;
the second execution module is used for setting a garbage collection mark for the target physical block to be subjected to garbage collection;
the traversal module is used for traversing each physical block in the solid state disk according to a preset time period, and adding the currently scanned target physical block to be subjected to garbage collection, which is provided with the garbage collection mark, to the GC chain table when the physical blocks to be subjected to garbage collection in the GC chain table do not reach the preset limited number;
and the moving module is used for sequentially moving the effective data in the physical blocks to be subjected to garbage collection in the GC linked list to a target idle block according to a preset sequence and deleting the physical blocks to be subjected to garbage collection after moving operation is executed.
In order to solve the above technical problem, the present invention further provides a garbage recycling apparatus for solid state disk, including:
a memory for storing a computer program;
and the processor is used for realizing the steps of any solid state disk garbage collection method when executing the computer program.
In order to solve the above technical problem, the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps of any one of the above garbage collection methods for a solid state disk.
Compared with the method for simultaneously processing a large number of physical blocks to be subjected to garbage collection according to a forced garbage collection request in the prior art, the garbage collection method for the solid state disk determines a target physical block to be subjected to garbage collection in the solid state disk according to the forced garbage collection request when the forced garbage collection request is received; then judging whether the number of the physical blocks to be subjected to garbage recovery in the GC linked list reaches a preset limited number or not; if not, adding the target physical block to be recycled to the GC linked list; if yes, setting a garbage recycling mark for the target physical block to be subjected to garbage recycling; traversing each physical block in the solid state disk according to a preset time period, and adding a currently scanned target physical block to be subjected to garbage collection, which is provided with a garbage collection mark, to a GC chain table when the physical blocks to be subjected to garbage collection in the GC chain table do not reach a preset limited number; and sequentially moving the effective data in the physical blocks to be subjected to garbage collection in the GC linked list to a target idle block according to a preset sequence, and deleting the physical blocks to be subjected to garbage collection after the moving operation is executed. Therefore, the method can relieve the garbage collection storm in the solid state disk by carrying out data moving operation on the garbage collection physical blocks to be treated in a frequency mode, not only can treat all the garbage collection physical blocks to be treated, but also avoids the influence of the garbage collection storm on the performance of the solid state disk, and improves the stability of the performance of the solid state disk.
In order to solve the technical problem, the invention also provides a garbage recycling device and equipment of the solid state disk and a computer readable storage medium, which have the beneficial effects.
Drawings
In order to more clearly illustrate the embodiments or technical solutions of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a garbage collection method for a solid state disk according to an embodiment of the present invention;
fig. 2 is a structural diagram of a garbage recycling device for solid state drives according to an embodiment of the present invention;
fig. 3 is a structural diagram of a garbage recycling apparatus for a solid state disk according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. 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 core of the embodiment of the invention is to provide a garbage recycling method for a solid state disk, which can improve the stability of the performance of the solid state disk on the basis of relieving the garbage recycling storm of the solid state disk; the other core of the invention is to provide a garbage recycling device, equipment and a computer readable storage medium of the solid state disk, which all have the beneficial effects.
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.
Fig. 1 is a flowchart of a garbage collection method for a solid state disk according to an embodiment of the present invention. As shown in fig. 1, a garbage collection method for a solid state disk includes:
s10: and when a forced garbage collection request is received, determining a target physical block to be subjected to garbage collection in the solid state disk according to the forced garbage collection request.
First, garbage collection in the solid state disk refers to moving valid data in a physical block to be garbage collected, in which valid data is stored, to a target free block, and then deleting the original physical block to be garbage collected.
Specifically, in this embodiment, first, a forced garbage collection request is received, and after the forced garbage collection request is received, a target physical block to be garbage collected in the corresponding solid state disk is determined according to the received forced garbage collection request, where the physical block to be garbage collected is also a physical block in which valid data is stored, and the target physical block to be garbage collected refers to the physical block to be garbage collected corresponding to the current forced garbage collection request.
S20: judging whether the number of physical blocks to be garbage recycled in the GC linked list reaches a preset limited number or not;
s30: if not, adding the target physical block to be recycled to the GC linked list;
s40: and if so, setting a garbage recycling mark for the target physical block to be subjected to garbage recycling.
Specifically, a GC linked list (Gabage Collection linked list) is preset, and the GC linked list is also used for storing a data structure of the physical block to be garbage recycled. The GC linked list corresponds to the linked list depth, and the linked list depth is the maximum number of the physical blocks to be garbage recycled, which can be stored by the GC linked list. Judging whether the number of physical blocks to be subjected to garbage recovery in the GC linked list reaches a preset limited number, if not, indicating that the GC linked list is idle, and therefore adding the target physical blocks to be subjected to garbage recovery to the GC linked list; if the preset limited number is reached, the current GC linked list is full, the current target physical block to be subjected to garbage collection cannot be added into the GC linked list, and therefore a garbage collection mark is set for the target physical block to be subjected to garbage collection. Specifically, a garbage collection flag may be set in the block information of the target physical block to be garbage collected. The embodiment does not limit the specific way of setting the garbage collection mark for the target physical block to be subjected to garbage collection, and does not limit the specific form of the garbage collection mark.
S50: traversing each physical block in the solid state disk according to a preset time period, and adding a currently scanned target physical block to be subjected to garbage collection, which is provided with a garbage collection mark, to a GC chain table when the physical blocks to be subjected to garbage collection in the GC chain table do not reach a preset limited number;
s60: and sequentially moving the effective data in the physical blocks to be subjected to garbage collection in the GC linked list to a target idle block according to a preset sequence, and deleting the physical blocks to be subjected to garbage collection after the moving operation is executed.
Specifically, in an actual operation, the wlm (wear Leveling manager) in the solid state disk sequentially performs data moving operation on the physical blocks to be garbage collected according to a preset sequence, such as the arrangement sequence of the physical blocks to be garbage collected in the GC chain table, so that the physical blocks to be garbage collected in the GC chain table are gradually reduced. Meanwhile, all physical blocks in the solid state disk are traversed according to a preset time period, and when the physical blocks to be subjected to garbage collection in the GC chain table do not reach a preset limited number, the scanned target physical blocks to be subjected to garbage collection, which are provided with garbage collection marks, are added into the GC chain table, so that garbage collection operation of all the physical blocks to be subjected to garbage collection in the solid state disk is achieved in a frequency division mode.
It should be noted that the process of moving the valid data in the physical block to be garbage collected to the target idle block is common knowledge of those skilled in the art, and is not described herein again. And, in the solid state disk, there are 768 physical pages per physical block, and the write time of each physical page is about 3.8 ms. If all the physical pages in the physical block store valid data, that is, the physical block is a physical block to be garbage collected, and it is necessary to perform a data transfer operation on all the physical pages in the physical block to be garbage collected, the time required for the entire data transfer is about 768 × 3.8ms — 2918 ms.
Compared with the method for simultaneously processing a large number of physical blocks to be garbage recycled according to a forced garbage recycling request in the prior art, the garbage recycling method for the solid state disk provided by the embodiment of the invention determines a target physical block to be garbage recycled in the solid state disk according to the forced garbage recycling request when the forced garbage recycling request is received; then judging whether the number of the physical blocks to be subjected to garbage recovery in the GC linked list reaches a preset limited number or not; if not, adding the target physical block to be recycled to the GC linked list; if yes, setting a garbage recycling mark for the target physical block to be subjected to garbage recycling; traversing each physical block in the solid state disk according to a preset time period, and adding a currently scanned target physical block to be subjected to garbage collection, which is provided with a garbage collection mark, to a GC chain table when the physical blocks to be subjected to garbage collection in the GC chain table do not reach a preset limited number; and sequentially moving the effective data in the physical blocks to be subjected to garbage collection in the GC linked list to a target idle block according to a preset sequence, and deleting the physical blocks to be subjected to garbage collection after the moving operation is executed. Therefore, the method can relieve the garbage collection storm in the solid state disk by carrying out data moving operation on the garbage collection physical blocks to be treated in a frequency mode, not only can treat all the garbage collection physical blocks to be treated, but also avoids the influence of the garbage collection storm on the performance of the solid state disk, and improves the stability of the performance of the solid state disk.
On the basis of the foregoing embodiment, this embodiment further describes and optimizes the technical solution, and specifically, in this embodiment, the process of traversing each physical block in the solid state disk according to a preset time period and adding a currently scanned target physical block to be garbage-recycled, which is provided with a garbage-recycling flag, to the GC chain table when the physical blocks to be garbage-recycled in the GC chain table do not reach a preset limited number includes:
scanning and judging whether each physical block in the solid state disk is provided with a garbage recycling mark or not according to a preset time period;
if so, further judging whether the first number of the physical blocks to be subjected to garbage collection in the GC linked list is smaller than a preset limited number or not;
if the number of the target physical blocks to be subjected to garbage collection is smaller than the preset number, adding the currently scanned target physical blocks to be subjected to garbage collection with the garbage collection marks into a GC linked list;
and if so, not processing, and sequentially scanning according to a preset time period and judging whether each physical block in the solid state disk is provided with a garbage collection mark or not.
It can be understood that the physical blocks in the solid state disk are arranged in sequence, in this embodiment, the physical blocks in the solid state disk are sequentially scanned according to a preset time period, and whether the physical blocks are provided with garbage collection marks is determined, and if so, whether the first number of the physical blocks to be garbage collected in the GC chain table is smaller than a preset limited number is further determined; if the number of the target physical blocks to be subjected to garbage collection is smaller than the preset number, adding the currently scanned target physical blocks to be subjected to garbage collection with the garbage collection marks into a GC linked list; and if so, not operating the currently scanned physical block to be garbage recycled, and scanning and judging the next physical block in the solid state disk in the next time period.
Therefore, the garbage collection method for the solid state disk provided by the embodiment can conveniently and accurately add the target to-be-garbage-collected physical block with the garbage collection mark to the GC chain table for garbage collection operation.
On the basis of the foregoing embodiment, this embodiment further describes and optimizes the technical solution, and specifically, in this embodiment, the forced garbage collection request is specifically triggered to be generated when a read/write error of Flash is detected, and/or when the data retention time of data information written into the NAND reaches the upper limit of the data retention time limited by the NAND characteristic, and/or when the read disturb number of data information written into the NAND reaches the upper limit of the read disturb number limited by the NAND characteristic.
It should be noted that, in the specific implementation, there are various ways of triggering generation of the forced garbage collection request, and generally, the forced garbage collection request is obtained by directly receiving an operation instruction generated by user triggering, so as to execute a garbage collection operation on the solid state disk according to the forced garbage collection request.
In this embodiment, the method for generating a forced garbage collection request further includes: when detecting that the Flash has read-write errors, indicating that data transfer operation needs to be carried out on physical blocks corresponding to the read-write errors, and triggering to generate a forced garbage collection request; or, when the data holding time of the data information written to the NAND reaches the upper limit of the data holding time of the NAND characteristic limit; or when the read interference frequency of the data information written into the NAND reaches the read interference frequency upper limit limited by the NAND characteristic, the data information in the corresponding physical block needs to be subjected to data transfer operation currently, otherwise, the data information in the physical block is in error, and a forced garbage collection request is triggered and generated.
The embodiment realizes the generation of the forced garbage collection request through various modes, can trigger the garbage collection operation through various modes, and can improve the efficiency of the solid state disk.
As a preferred embodiment, the preset time period is 20 ms.
In this embodiment, the time period of sequentially traversing the physical blocks in the solid state disk is preferably set to 20ms according to the total time of traversing the whole solid state disk and the preset maximum time allowed for the physical blocks in the solid state disk to be maintained after the data retention time is reached.
The preset time period is preferably set to be 20ms, and on the basis of guaranteeing the pressure capable of relieving the garbage recycling storm, the garbage recycling physical blocks can be sequentially processed by time-sharing and frequency-dividing, so that the garbage recycling efficiency is improved.
On the basis of the foregoing embodiment, the present embodiment further describes and optimizes the technical solution, and specifically, in the present embodiment, the present embodiment further includes:
recording a second number of target physical blocks to be subjected to garbage collection, which are provided with garbage collection marks, in the solid state disk in real time;
when the second quantity is larger than the preset quantity threshold value, determining a target physical block to be subjected to garbage collection in the solid state disk according to the forced garbage collection request when the forced garbage collection request is received; otherwise, the process is exited.
In this embodiment, a second number of target to-be-garbage-recycled physical blocks with garbage recycling marks set in the solid state disk is further recorded in real time, and whether the second number is smaller than a preset number threshold is judged; when the second quantity is larger than the preset quantity threshold value, determining a target physical block to be subjected to garbage collection in the solid state disk according to the forced garbage collection request when the forced garbage collection request is received; correspondingly, if the number of the physical blocks to be garbage recycled in the current solid state disk is less than or equal to the preset number threshold, the process is exited. In addition, in this embodiment, the preset number threshold is preferably set to be 0, and in other embodiments, other preset number thresholds may also be set, which is not limited in this embodiment. In other words, in this embodiment, it is determined whether the timer needs to be started to execute the garbage collection operation of the solid state disk provided in the above embodiment by determining whether the second number of target to-be-garbage-collected physical blocks in the solid state disk, which are provided with the garbage collection flag, is greater than the preset number threshold, so that the CPU resources can be relatively saved, and the performance consumption of the CPU can be reduced.
The above detailed description is given to the embodiment of the garbage collection method for a solid state disk provided by the present invention, and the present invention further provides a garbage collection apparatus, a device and a computer-readable storage medium for a solid state disk corresponding to the method.
Fig. 2 is a structural diagram of a garbage collection apparatus for a solid state disk according to an embodiment of the present invention, and as shown in fig. 2, the garbage collection apparatus for a solid state disk includes:
the determining module 21 is configured to determine, when receiving the forced garbage collection request, a target physical block to be subjected to garbage collection in the solid state disk according to the forced garbage collection request;
the judging module 22 is configured to judge whether the number of the physical blocks to be recycled in the GC chain table reaches a preset limited number; if not, calling a first execution module; if yes, calling a second execution module;
the first execution module 23 is configured to add the target physical block to be recycled to the GC chain table;
the second execution module 24 is configured to set a garbage collection flag for the target physical block to be subjected to garbage collection;
the traversal module 25 is configured to traverse each physical block in the solid state disk according to a preset time period, and add a currently scanned target physical block to be garbage-recovered, which is provided with a garbage-recovery flag, to the GC chain table when the physical blocks to be garbage-recovered in the GC chain table do not reach a preset limited number;
and the moving module 26 is configured to sequentially move the valid data in the physical blocks to be garbage collected in the GC chain table to the target idle block according to a preset sequence, and delete the physical blocks to be garbage collected after the moving operation is performed.
The garbage recycling device for the solid state disk provided by the embodiment of the invention has the beneficial effects of the garbage recycling method for the solid state disk.
Fig. 3 is a structural diagram of a garbage recycling device for a solid state disk according to an embodiment of the present invention, and as shown in fig. 3, the garbage recycling device for a solid state disk includes:
a memory 31 for storing a computer program;
and the processor 32 is configured to implement the steps of the garbage collection method for the solid state disk as described above when executing the computer program.
The garbage recycling device for the solid state disk provided by the embodiment of the invention has the beneficial effects of the garbage recycling method for the solid state disk.
In order to solve the above technical problem, the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the garbage collection method for the solid state disk are implemented.
The computer-readable storage medium provided by the embodiment of the invention has the beneficial effects of the garbage recycling method of the solid state disk.
The garbage collection method, device, equipment and computer readable storage medium of the solid state disk provided by the invention are described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are set forth only to help understand the method and its core ideas of the present invention. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and 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.

Claims (8)

1. A garbage recycling method of a solid state disk is characterized by comprising the following steps:
when a mandatory garbage collection request is received, determining a target physical block to be subjected to garbage collection in a solid state disk according to the mandatory garbage collection request;
judging whether the number of physical blocks to be garbage recycled in the GC linked list reaches a preset limited number or not;
if not, adding the target physical block to be recycled to the GC linked list;
if yes, setting a garbage recycling mark for the target physical block to be subjected to garbage recycling;
traversing each physical block in the solid state disk according to a preset time period, and adding the currently scanned target physical block to be subjected to garbage collection, which is provided with the garbage collection mark, to the GC chain table when the physical blocks to be subjected to garbage collection in the GC chain table do not reach the preset limited number;
and sequentially moving the effective data in the physical blocks to be subjected to garbage collection in the GC linked list to a target idle block according to a preset sequence, and deleting the physical blocks to be subjected to garbage collection after moving operation in the GC linked list.
2. The method according to claim 1, wherein the traversing each physical block in the solid state disk according to a preset time period and adding the currently scanned target physical block to be garbage collected, which is provided with the garbage collection flag, to the GC chain table when the physical blocks to be garbage collected in the GC chain table do not reach the preset limited number specifically includes:
scanning and judging whether each physical block in the solid state disk is provided with the garbage recycling mark or not according to a preset time period;
if so, further judging whether the first number of the physical blocks to be garbage recycled in the GC linked list is smaller than the preset limited number or not;
if the number of the target physical blocks to be subjected to garbage collection is smaller than the preset number, adding the currently scanned target physical blocks to be subjected to garbage collection with the garbage collection marks into the GC linked list;
and if so, not processing, and performing the steps of scanning in sequence according to a preset time period and judging whether each physical block in the solid state disk is provided with the garbage recycling mark or not.
3. The method according to claim 1, wherein the request for forced garbage collection is specifically triggered to be generated when a read-write error of Flash is detected and/or when a data retention time of data information written into the NAND reaches an upper limit of a data retention time limited by the NAND characteristic and/or when a number of read-disturb times of data information written into the NAND reaches an upper limit of a number of read-disturb times limited by the NAND characteristic.
4. The method of claim 1, wherein the predetermined time period is 20 ms.
5. The method of any of claims 1 to 4, further comprising:
recording a second number of the target physical blocks to be subjected to garbage collection, which are provided with the garbage collection marks, in the solid state disk in real time;
when the second quantity is larger than a preset quantity threshold value, entering a step of determining a target physical block to be subjected to garbage collection in the solid state disk according to the mandatory garbage collection request when the mandatory garbage collection request is received; otherwise, the process is exited.
6. The utility model provides a rubbish recovery unit of solid state hard drives which characterized in that includes:
the determining module is used for determining a target physical block to be subjected to garbage collection in the solid state disk according to the mandatory garbage collection request when the mandatory garbage collection request is received;
the judging module is used for judging whether the number of the physical blocks to be subjected to garbage recovery in the GC linked list reaches a preset limited number or not; if not, calling a first execution module; if yes, calling a second execution module;
the first execution module is configured to add the target physical block to be recycled to garbage to the GC linked list;
the second execution module is used for setting a garbage collection mark for the target physical block to be subjected to garbage collection;
the traversal module is used for traversing each physical block in the solid state disk according to a preset time period, and adding the currently scanned target physical block to be subjected to garbage collection, which is provided with the garbage collection mark, to the GC chain table when the physical blocks to be subjected to garbage collection in the GC chain table do not reach the preset limited number;
and the moving module is used for sequentially moving the effective data in the physical blocks to be subjected to garbage collection in the GC linked list to a target idle block according to a preset sequence, and deleting the physical blocks to be subjected to garbage collection after the moving operation is executed in the GC linked list.
7. The utility model provides a garbage recycling equipment of solid state hard drives which characterized in that includes:
a memory for storing a computer program;
a processor for implementing the steps of the garbage collection method of the solid state disk according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, having a computer program stored thereon, which, when being executed by a processor, implements the steps of the garbage collection method for solid state disks according to any one of claims 1 to 5.
CN201910818228.4A 2019-08-30 2019-08-30 Garbage recycling method, device and equipment for solid state disk and storage medium Active CN110659217B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910818228.4A CN110659217B (en) 2019-08-30 2019-08-30 Garbage recycling method, device and equipment for solid state disk and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910818228.4A CN110659217B (en) 2019-08-30 2019-08-30 Garbage recycling method, device and equipment for solid state disk and storage medium

Publications (2)

Publication Number Publication Date
CN110659217A CN110659217A (en) 2020-01-07
CN110659217B true CN110659217B (en) 2021-10-15

Family

ID=69036607

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910818228.4A Active CN110659217B (en) 2019-08-30 2019-08-30 Garbage recycling method, device and equipment for solid state disk and storage medium

Country Status (1)

Country Link
CN (1) CN110659217B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930301A (en) * 2020-06-29 2020-11-13 深圳佰维存储科技股份有限公司 Garbage recycling optimization method and device, storage medium and electronic equipment
CN111813343B (en) * 2020-07-16 2022-07-08 济南浪潮数据技术有限公司 Solid state disk garbage recovery method, system and related components
CN112162701B (en) * 2020-09-18 2023-12-22 北京浪潮数据技术有限公司 Storage space recycling method, device, equipment and computer storage medium
CN112783802B (en) * 2021-01-29 2022-11-01 山东华芯半导体有限公司 Method for optimizing read interference processing in SSD
CN112988618B (en) * 2021-02-20 2023-02-28 山东英信计算机技术有限公司 Garbage recycling method, device and equipment for solid state disk and storage medium
CN113568581B (en) * 2021-07-29 2023-08-01 武汉天喻信息产业股份有限公司 Multi-application resource recovery method and system for embedded equipment
CN114064516B (en) * 2021-11-16 2022-08-30 深圳市时创意电子有限公司 Data processing method and device, computer equipment and storage medium
CN114415949B (en) * 2021-12-31 2024-03-01 山东云海国创云计算装备产业创新中心有限公司 Method, system, storage medium and equipment for scanning and recycling blocks
CN114063935B (en) * 2022-01-17 2022-06-14 阿里云计算有限公司 Method and device for processing data
CN114895846A (en) * 2022-04-28 2022-08-12 阿里巴巴(中国)有限公司 Data processing method, device and equipment
CN116820861B (en) * 2023-08-31 2023-11-21 江苏华存电子科技有限公司 Method and device for testing enterprise-level solid state disk garbage collection mechanism

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530237A (en) * 2013-10-31 2014-01-22 厦门大学 Solid-state disc array garbage collecting method
CN103559138A (en) * 2013-10-09 2014-02-05 华为技术有限公司 Solid state disk (SSD) and space management method thereof
CN105138277A (en) * 2015-07-23 2015-12-09 厦门大学 Cache management method for solid-state disc array
CN108804339A (en) * 2018-03-29 2018-11-13 北京白山耘科技有限公司 A kind of memory rubbish recovering method and device
CN109597584A (en) * 2018-12-04 2019-04-09 浪潮电子信息产业股份有限公司 A kind of solid state hard disk rubbish recycling management method, device and equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9898404B2 (en) * 2013-07-14 2018-02-20 Cnex Labs Method and apparatus for providing improved garbage collection process in solid state drive
TWI529719B (en) * 2013-08-30 2016-04-11 慧榮科技股份有限公司 Data storage device and flash memory control method
CN107844432B (en) * 2017-11-22 2021-01-12 深圳忆联信息系统有限公司 Method for recovering dynamic garbage of solid state disk and solid state disk

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559138A (en) * 2013-10-09 2014-02-05 华为技术有限公司 Solid state disk (SSD) and space management method thereof
CN103530237A (en) * 2013-10-31 2014-01-22 厦门大学 Solid-state disc array garbage collecting method
CN105138277A (en) * 2015-07-23 2015-12-09 厦门大学 Cache management method for solid-state disc array
CN108804339A (en) * 2018-03-29 2018-11-13 北京白山耘科技有限公司 A kind of memory rubbish recovering method and device
CN109597584A (en) * 2018-12-04 2019-04-09 浪潮电子信息产业股份有限公司 A kind of solid state hard disk rubbish recycling management method, device and equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
固态硬盘存储管理及数据恢复探讨;谢艺平;《硕士学位论文》;20160401;17-18 *

Also Published As

Publication number Publication date
CN110659217A (en) 2020-01-07

Similar Documents

Publication Publication Date Title
CN110659217B (en) Garbage recycling method, device and equipment for solid state disk and storage medium
CN107967122B (en) Data writing method, device and medium for block device
US20160132429A1 (en) Method and Storage Device for Collecting Garbage Data
CN109508148B (en) Metadata reconstruction method and device and computer readable storage medium
JP2008521123A (en) Data processing apparatus and method for flash memory
CN108777158B (en) Method and device for testing Trim performance of solid state disk and computer equipment
CN111045956A (en) Solid state disk garbage recycling method and device based on multi-core CPU
TWI608350B (en) Memory device and control unit thereof, and data movement method for memory device
CN109144428B (en) Garbage recycling method, device and medium applied to solid state disk
CN109558263B (en) Method and related device for processing data reading errors of solid state disk
JP2005209188A (en) Data recovery apparatus and method used for flash memory
CN109582488B (en) Error prevention method and related device for solid state disk
WO2023174394A1 (en) Data processing method and apparatus
CN109521969B (en) Solid state disk data recovery method and device and computer readable storage medium
KR100631765B1 (en) Apparatus and method for processing data in flash memory
CN111061429B (en) Data access method, device, equipment and medium
CN111190835B (en) Data writing method, device, equipment and medium
CN111158598B (en) Garbage recycling method, device, equipment and medium for full-flash disk array
WO2022166265A1 (en) Data recovery method and apparatus, device and medium
CN109324929B (en) Snapshot creating method, device and equipment and readable storage medium
CN111124943B (en) Data processing method, device, equipment and storage medium
US20230297263A1 (en) Method and system for testing conversion relationship between block reading and page reading in flash memory chip
CN106611364B (en) Storage fragment sorting method and device
JPWO2021076378A5 (en)
CN115599589B (en) Data recovery method and related device

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