CN114238162A - Garbage recycling method and device, readable storage medium and electronic equipment - Google Patents

Garbage recycling method and device, readable storage medium and electronic equipment Download PDF

Info

Publication number
CN114238162A
CN114238162A CN202210154235.0A CN202210154235A CN114238162A CN 114238162 A CN114238162 A CN 114238162A CN 202210154235 A CN202210154235 A CN 202210154235A CN 114238162 A CN114238162 A CN 114238162A
Authority
CN
China
Prior art keywords
data
garbage collection
strategy
recovered
writing
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.)
Granted
Application number
CN202210154235.0A
Other languages
Chinese (zh)
Other versions
CN114238162B (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.)
Chengdu Baiwei Storage Technology Co ltd
Biwin Storage Technology Co Ltd
Original Assignee
Chengdu Baiwei Storage Technology Co ltd
Biwin Storage 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 Chengdu Baiwei Storage Technology Co ltd, Biwin Storage Technology Co Ltd filed Critical Chengdu Baiwei Storage Technology Co ltd
Priority to CN202210154235.0A priority Critical patent/CN114238162B/en
Publication of CN114238162A publication Critical patent/CN114238162A/en
Application granted granted Critical
Publication of CN114238162B publication Critical patent/CN114238162B/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/0253Garbage collection, i.e. reclamation of unreferenced 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/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/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Memory System (AREA)

Abstract

The invention discloses a garbage recovery method, a garbage recovery device, a readable storage medium and electronic equipment, which are used for receiving a garbage recovery request of a solid state disk, wherein the garbage recovery request comprises data to be recovered; acquiring residual space information of the solid state disk according to the garbage recycling request; determining a garbage collection strategy based on the residual space information; judging the type of the garbage recovery strategy, writing the data to be recovered into a flash memory if the garbage recovery strategy is a low-water-level garbage recovery strategy, writing the data to be recovered into a cache region if the garbage recovery strategy is a high-water-level garbage recovery strategy, combining the two strategies based on the SSD residual space to realize garbage recovery, not only balancing the write-in rate and the space recovery rate of a host, but also effectively shortening the maximum write delay under a GC scene, thereby reducing the maximum delay while avoiding space exhaustion.

Description

Garbage recycling method and device, readable storage medium and electronic equipment
Technical Field
The invention relates to the technical field of solid state disks, in particular to a garbage recycling method and device, a readable storage medium and electronic equipment.
Background
Currently, in mainstream enterprise-level SSD (Solid State Disk) firmware development, several key and difficult problems are often faced: how to ensure that the maximum time delay of a read-write request does not exceed a fixed threshold under the condition of starting GC (Gabage Collection); how to balance the writing data rate and the space releasing rate of the host to ensure that the space is not exhausted; different business models can cause the effective data to be unevenly distributed, and how to carry out targeted garbage collection according to the effective data.
For these problems, most of the current manufacturers preferentially ensure the first time release of the space, and the maximum write delay and performance under the scenario are considered less.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: provided are a garbage recycling method, device, readable storage medium and electronic equipment, which can reduce the maximum time delay while avoiding space exhaustion.
In order to solve the technical problems, the invention adopts a technical scheme that:
a method of waste recovery comprising:
receiving a garbage recovery request of a solid state disk, wherein the garbage recovery request comprises data to be recovered;
acquiring the residual space information of the solid state disk according to the garbage recycling request;
determining a garbage collection strategy based on the residual space information;
judging the type of the garbage collection strategy, writing the data to be collected into a flash memory if the garbage collection strategy is a low-water-level garbage collection strategy, and writing the data to be collected into a cache region if the garbage collection strategy is a high-water-level garbage collection strategy.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a waste recovery device comprising:
the request receiving module is used for receiving a garbage collection request of the solid state disk, wherein the garbage collection request comprises data to be collected;
the information acquisition module is used for acquiring the residual space information of the solid state disk according to the garbage collection request;
the strategy determining module is used for determining a garbage recycling strategy based on the residual space information;
and the data writing module is used for judging the type of the garbage recovery strategy, writing the data to be recovered into a flash memory if the garbage recovery strategy is a low-water-level garbage recovery strategy, and writing the data to be recovered into a cache region if the garbage recovery strategy is a high-water-level garbage recovery strategy.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of a garbage collection method as described above.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of a garbage collection method as described above when executing the computer program.
The invention has the beneficial effects that: acquiring the residual space information of a Solid State Disk according to a received garbage Collection request, determining a garbage Collection strategy based on the residual space information, writing data to be collected into a flash memory when the strategy type is a low-water-level garbage Collection strategy, writing the data to be collected into a cache region when the strategy type is a high-water-level garbage Collection strategy, starting different GC (ribbon Collection) strategies based on the SSD (Solid State Disk) residual space, wherein the high-water-level GC strategy has high execution rate, the space Collection is slow, the write influence on a host is small, the low-water-level GC strategy has low execution rate, the space Collection is fast, the host write influence is large, the two strategies are combined based on the SSD residual space to realize garbage Collection, the write rate and the space Collection rate of the host can be balanced, and the maximum write delay under a GC scene can be effectively shortened, thereby reducing the maximum time delay while avoiding space exhaustion.
Drawings
FIG. 1 is a flow chart illustrating the steps of a garbage recycling method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a garbage recycling device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
FIG. 4 is a schematic view of garbage recycling in the garbage recycling method according to the embodiment of the present invention;
fig. 5 is a flowchart of determining a garbage collection policy in the garbage collection method according to the embodiment of the present invention.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
Referring to fig. 1, an embodiment of the present invention provides a garbage recycling method, including:
receiving a garbage recovery request of a solid state disk, wherein the garbage recovery request comprises data to be recovered;
acquiring the residual space information of the solid state disk according to the garbage recycling request;
determining a garbage collection strategy based on the residual space information;
judging the type of the garbage collection strategy, writing the data to be collected into a flash memory if the garbage collection strategy is a low-water-level garbage collection strategy, and writing the data to be collected into a cache region if the garbage collection strategy is a high-water-level garbage collection strategy.
From the above description, the beneficial effects of the present invention are: acquiring the residual space information of a Solid State Disk according to a received garbage Collection request, determining a garbage Collection strategy based on the residual space information, writing data to be collected into a flash memory when the strategy type is a low-water-level garbage Collection strategy, writing the data to be collected into a cache region when the strategy type is a high-water-level garbage Collection strategy, starting different GC (ribbon Collection) strategies based on the SSD (Solid State Disk) residual space, wherein the high-water-level GC strategy has high execution rate, the space Collection is slow, the write influence on a host is small, the low-water-level GC strategy has low execution rate, the space Collection is fast, the host write influence is large, the two strategies are combined based on the SSD residual space to realize garbage Collection, the write rate and the space Collection rate of the host can be balanced, and the maximum write delay under a GC scene can be effectively shortened, thereby reducing the maximum time delay while avoiding space exhaustion.
Further, the determining a garbage collection policy based on the remaining space information includes:
and judging whether the residual space information is less than or equal to a preset low water level, if so, determining that the garbage collection strategy is a low water level garbage collection strategy, otherwise, judging whether the residual space information is less than or equal to a preset high water level and greater than the preset low water level, and if so, determining that the garbage collection strategy is a high water level garbage collection strategy.
As can be seen from the above description, by setting the low water level threshold and the high water level threshold, when the remaining space information is less than or equal to the preset low water level, the residual space of the current solid state disk is insufficient, the low-water-level garbage collection strategy directly writes the data to be collected into the flash memory, the space corresponding to the data to be recovered can be quickly released, thereby ensuring that the space of the solid state disk can be released at the first time, avoiding the space from being exhausted, when the residual space information is less than or equal to the preset high water Level and greater than the preset low water Level, it indicates that the space in the current solid state disk is still sufficient, the high water Level garbage collection strategy writes the data to be collected into the cache region, the execution time is short, and the influence of the data writing quantity of a TLC (Trinary Level cell) flash memory 3 x 16k is not required to be considered, the maximum delay influence on the host write request is small, so that the maximum delay can be reduced, and the performance of the host is ensured.
Further, the writing the data to be recycled into the cache area includes:
acquiring a logic address of the data to be recovered;
judging whether the cache region has changes or not, judging whether the logic address exists in the cache region or not, if not, writing the data to be recovered into the cache region, and if so, discarding the data to be recovered.
As can be seen from the above description, the logical address of the data to be recovered is obtained, and when there is no change in the cache region and there is no logical address of the data to be recovered in the cache region, it indicates that the data to be recovered is the latest data of the current logical address, and the condition of writing in the cache region is satisfied, the data to be recovered is written in the cache region, so that the validity of writing the data to be recovered in the cache region is improved.
Further, when writing the data to be recycled into the cache area, the method includes:
judging whether the residual space information is less than or equal to the preset low water level, if so, stopping the step of writing the data to be recovered into a cache region, and acquiring residual data to be recovered, wherein the residual data to be recovered is the data to be recovered which is not written into the cache region;
and writing the residual data to be recycled into the flash memory.
It can be known from the above description that, when data to be recovered is written into the cache region, whether the remaining space is reduced to a low level is determined, if yes, the current GC flow is automatically stopped, and the remaining data to be recovered, which is not written into the cache region, is written into the flash memory, so that space exhaustion of the solid state disk can be timely avoided, and thus, the host writing rate and the space recovery rate are balanced.
Further, the writing the data to be recycled into the flash memory includes:
determining redundant data to be recovered from the data to be recovered according to a preset write data volume;
writing the data to be recovered in the data to be recovered except the redundant data to be recovered into a flash memory;
and writing the redundant data to be recycled into a cache region.
As can be seen from the above description, in a TLC write-through scenario, data to be recovered is written into a flash memory, and if the written data does not satisfy the requirement of TLC write data amount, padding (filling) data needs to be supplemented, which may cause an unnecessary write amplification phenomenon.
Further, the cache region includes reclaimed data and dirty data;
after the writing the data to be recycled into the cache region, the method comprises the following steps:
and judging whether the total quantity of the recycled data and the dirty data reaches a preset value, if so, writing the recycled data and the dirty data into the flash memory in a mixed manner according to the preset write data quantity.
As can be seen from the above description, after the data to be recovered is written into the cache region, if the total amount of the recovered data and the dirty data reaches the preset value, the recovered data and the dirty data are mixed and written into the flash memory according to the preset write data amount, and the dirty data and the recovered data are mixed and written into the flash memory, so that the situation that the write data does not satisfy the TLC write data amount and causes write amplification can be effectively avoided.
Further, still include:
acquiring a read count corresponding to the data to be recovered according to the garbage recovery request;
determining a garbage collection policy based on the read count;
judging the type of the garbage collection strategy, writing the data to be collected into a flash memory if the garbage collection strategy is a high-hot-spot garbage collection strategy, and writing the data to be collected into a cache area if the garbage collection strategy is a low-hot-spot garbage collection strategy.
As can be seen from the above description, in a special scenario, the heat of old data is far lower than that of new data, so that the space where the old data is located cannot be released for a long time, in the prior art, the old data is gathered together, if the old data is not accessed for a long time, the risk of losing the old data is increased, by obtaining the read count corresponding to the data to be recovered, the read count can reflect whether the data is frequently accessed, a garbage recovery policy is determined based on the read count, if the garbage to be recovered is in a high hot spot, the data to be recovered is written into a flash memory, and if the garbage to be recovered is in a low hot spot, the data to be recovered is written into a cache region, which is beneficial to protection and wear balance of the old data.
Referring to fig. 2, another embodiment of the present invention provides a garbage recycling apparatus, including:
the request receiving module is used for receiving a garbage collection request of the solid state disk, wherein the garbage collection request comprises data to be collected;
the information acquisition module is used for acquiring the residual space information of the solid state disk according to the garbage collection request;
the strategy determining module is used for determining a garbage recycling strategy based on the residual space information;
and the data writing module is used for judging the type of the garbage recovery strategy, writing the data to be recovered into a flash memory if the garbage recovery strategy is a low-water-level garbage recovery strategy, and writing the data to be recovered into a cache region if the garbage recovery strategy is a high-water-level garbage recovery strategy.
Another embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of a garbage collection method described above.
Referring to fig. 3, another embodiment of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the garbage collection method when executing the computer program.
The garbage collection method, apparatus, readable storage medium and electronic device of the present invention can be applied to any type of SSD (Solid State Disk), such as flash-based SSD, DRAM-based SSD, etc., and are described below by specific embodiments:
example one
Referring to fig. 1, fig. 4 and fig. 5, a garbage recycling method of the present embodiment includes:
s1, receiving a garbage collection request of the solid state disk, wherein the garbage collection request comprises data to be collected;
s2, obtaining the residual space information of the solid state disk according to the garbage collection request;
wherein, the residual space information is the number of free space strips;
s3, determining a garbage collection policy based on the remaining space information, as shown in fig. 4 and 5, specifically including:
s31, judging whether the residual space information is less than or equal to a preset low water level, if so, executing S32, and if not, executing S33;
the preset low water level can be set according to actual conditions, and in the embodiment, the preset low water level is 6;
s32, determining the garbage collection strategy to be a low-water-level garbage collection strategy;
s33, judging whether the residual space information is less than or equal to a preset high water level and greater than the preset low water level, if so, executing S34; if not, exiting;
the preset high water level can be set according to actual conditions, and in the embodiment, the preset high water level is 9;
for example, when the number of the idle space bands is 3 and is less than the preset low water level 6, S32 is executed, and when the number of the idle space bands is 7 and is less than the preset high water level 9 and greater than the preset low water level 6, S34 is executed;
s34, determining the garbage collection strategy to be a high-water-level garbage collection strategy;
s4, judging the type of the garbage collection strategy, if the garbage collection strategy is a low-water-level garbage collection strategy, executing S41, and if the garbage collection strategy is a high-water-level garbage collection strategy, executing S42;
s41, writing the data to be recycled into a flash memory (NAND), specifically including:
s411, determining redundant data to be recovered from the data to be recovered according to preset write data quantity;
wherein the preset write data amount is specified by TLC and is 3 x 16 k;
for example, 159k is total data to be recovered, and the redundant data to be recovered is determined to be 15k from the data to be recovered according to 3 x 16 k;
s412, writing the data to be recovered in the data to be recovered except the redundant data to be recovered into a flash memory;
s413, writing the redundant data to be recycled into a Cache area (Cache);
in this embodiment, as shown in fig. 4, the cache region is implemented based on a Hash Table (Hash Table), and in another optional implementation, the cache region may be implemented based on other data structures, such as a B-Tree (multi-way search Tree), an RB-Tree (red and black Tree), and the like, which is not described herein again;
s42, writing the data to be recycled into the cache area, as shown in fig. 4, specifically including:
s421, acquiring a logic address (LAA) of the data to be recovered;
s422, judging whether a cache region has changes or not, judging whether the logic address exists in the cache region or not, if not, executing S4221, and if so, executing S4222; if yes, executing S4222 if only one is satisfied, one is not satisfied, or both are satisfied;
specifically, whether the cache area has a change and whether the logical address exists in the cache area may be determined through an L2P cache table of the cache area, as shown in fig. 4;
s4221, writing the data to be recovered into a cache region;
s4222, discarding the data to be recovered;
when the step S42 is executed, as shown in fig. 5, the method includes:
s43, judging whether the residual space information is smaller than or equal to the preset low water level, if so, stopping S42, and acquiring residual data to be recovered, wherein the residual data to be recovered is data to be recovered which is not written into the cache region;
writing the residual data to be recycled into the flash memory;
the S43 is executed in synchronization with the S42;
wherein the cache region comprises reclaimed data and dirty data; the dirty data is written by the host;
as shown in fig. 4, the S42 includes:
s44, judging whether the total quantity of the recycled data and the dirty data reaches a preset value, if so, executing S441, and if not, executing S442;
the preset value can be set according to actual conditions;
s441, writing the recycled data and the dirty data into the flash memory in a mixed manner according to the preset write data volume;
writing data into a new space (i.e., a flash memory) and needing to update mapping of LAA → PAA in an L2P cache table of a cache area, finding a space stripe where old data is located through an old mapping relation LAA → old PAA before updating, reducing effective data count of the space stripe where the old data is located, and when the effective data count is 0, releasing the space as a whole, so that the release of an old address space can be triggered by writing the recycled data and the dirty data into the flash memory in a mixed manner according to the preset write data amount;
and S442, returning to execute the S44.
Example two
The difference between this embodiment and the first embodiment lies in that garbage collection is performed based on a hot spot of data to be collected, which specifically includes:
s2, obtaining a reading count corresponding to the data to be recovered according to the garbage recovery request;
s3, determining a garbage collection strategy based on the reading count;
specifically, whether the read count reaches a preset number is judged, if yes, the garbage collection strategy is determined to be a high hot spot garbage collection strategy, and if not, the garbage collection strategy is determined to be a low hot spot garbage collection strategy;
the preset times can be set according to actual conditions, whether the data to be recovered is high-heat-point data or low-heat-point data can be effectively judged through the preset times, the high-heat-point data adopts a high-heat-point garbage recovery strategy, and the low-heat-point data adopts a low-heat-point garbage recovery strategy;
s4, judging the type of the garbage collection strategy, writing the data to be collected into a flash memory if the garbage collection strategy is a high hot spot garbage collection strategy, and writing the data to be collected into a cache area if the garbage collection strategy is a low hot spot garbage collection strategy;
S2-S4 in this embodiment may be performed in place of S2-S4 in the first embodiment to facilitate old data protection and wear leveling.
EXAMPLE III
Referring to fig. 2, a garbage recycling apparatus includes:
the request receiving module is used for receiving a garbage collection request of the solid state disk, wherein the garbage collection request comprises data to be collected;
the information acquisition module is used for acquiring the residual space information of the solid state disk according to the garbage collection request;
the strategy determining module is used for determining a garbage recycling strategy based on the residual space information;
and the data writing module is used for judging the type of the garbage recovery strategy, writing the data to be recovered into a flash memory if the garbage recovery strategy is a low-water-level garbage recovery strategy, and writing the data to be recovered into a cache region if the garbage recovery strategy is a high-water-level garbage recovery strategy.
Example four
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, is capable of implementing the steps of the garbage collection method according to one or the second embodiment.
EXAMPLE five
Referring to fig. 3, an electronic device includes a memory, a processor, and a computer program stored in the memory and running on the processor, where the processor executes the computer program to implement the steps of the garbage collection method according to the first embodiment or the second embodiment.
To sum up, according to the garbage collection method, apparatus, readable storage medium and electronic device provided by the present invention, the remaining space information of the solid state disk is obtained according to the garbage collection request, the garbage collection policy is determined based on the remaining space information, if the garbage collection policy is the low-level garbage collection policy, the data to be collected is written into the flash memory, if the garbage collection policy is the high-level garbage collection policy, the data to be collected is written into the cache region, the garbage collection policy that needs to be adopted for the remaining space information is determined by setting the preset low-level and the preset high-level, different GC policies are started according to different remaining spaces, the high-level GC policy has a fast execution rate, slow space collection, and less influence on the writing of host, while the low-level GC policy has a slow execution rate, fast space collection, and great influence on writing of host, the two policies are combined to realize garbage collection based on the SSD remaining space, the write-in rate and the space recovery rate of the host can be balanced, and the maximum write delay in a GC scene can be effectively shortened, so that the maximum delay can be reduced while the space is prevented from being exhausted; when the data to be recovered is written into the cache region, judging whether the residual space is reduced to a low water level, if so, automatically stopping the current GC flow, and writing the residual data to be recovered which is not written into the cache region into the flash memory, so that the space exhaustion of the solid state disk can be avoided in time, and the host writing speed and the space recovery speed are balanced; the method comprises the steps of determining a garbage collection strategy according to the residual space, obtaining a reading count corresponding to data to be collected, wherein the reading count can reflect whether the data are frequently visited, determining the garbage collection strategy based on the reading count, writing the data to be collected into a flash memory if the garbage collection strategy is high in hot spot, and writing the data to be collected into a cache region if the garbage collection strategy is low in hot spot, so that the protection and wear balance of old data are facilitated.
In the above embodiments provided in the present application, it should be understood that the disclosed method, apparatus, computer-readable storage medium, and electronic device may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical division, and other divisions may be realized in practice, for example, a plurality of components or modules may be combined or integrated into another apparatus, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or components or modules, and may be in an electrical, mechanical or other form.
The components described as separate parts may or may not be physically separate, and parts displayed as components may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the components can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each component may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present invention is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no acts or modules are necessarily required of the invention.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method of recycling waste, comprising:
receiving a garbage recovery request of a solid state disk, wherein the garbage recovery request comprises data to be recovered;
acquiring the residual space information of the solid state disk according to the garbage recycling request;
determining a garbage collection strategy based on the residual space information;
judging the type of the garbage collection strategy, writing the data to be collected into a flash memory if the garbage collection strategy is a low-water-level garbage collection strategy, and writing the data to be collected into a cache region if the garbage collection strategy is a high-water-level garbage collection strategy.
2. The garbage collection method of claim 1, wherein the determining the garbage collection policy based on the remaining space information comprises:
and judging whether the residual space information is less than or equal to a preset low water level, if so, determining that the garbage collection strategy is a low water level garbage collection strategy, otherwise, judging whether the residual space information is less than or equal to a preset high water level and greater than the preset low water level, and if so, determining that the garbage collection strategy is a high water level garbage collection strategy.
3. The garbage collection method of claim 1, wherein writing the data to be collected into a cache area comprises:
acquiring a logic address of the data to be recovered;
judging whether the cache region has changes or not, judging whether the logic address exists in the cache region or not, if not, writing the data to be recovered into the cache region, and if so, discarding the data to be recovered.
4. The garbage collection method according to claim 2, wherein said writing the data to be collected into the cache area comprises:
judging whether the residual space information is less than or equal to the preset low water level, if so, stopping the step of writing the data to be recovered into a cache region, and acquiring residual data to be recovered, wherein the residual data to be recovered is the data to be recovered which is not written into the cache region;
and writing the residual data to be recycled into the flash memory.
5. The garbage collection method of claim 1, wherein writing the data to be collected into a flash memory comprises:
determining redundant data to be recovered from the data to be recovered according to a preset write data volume;
writing the data to be recovered in the data to be recovered except the redundant data to be recovered into a flash memory;
and writing the redundant data to be recycled into a cache region.
6. A garbage collection method according to claim 5, wherein said cache region comprises collected data and dirty data;
after the writing the data to be recycled into the cache region, the method comprises the following steps:
and judging whether the total quantity of the recycled data and the dirty data reaches a preset value, if so, writing the recycled data and the dirty data into the flash memory in a mixed manner according to the preset write data quantity.
7. A method of recycling waste as claimed in claim 1, further comprising:
acquiring a read count corresponding to the data to be recovered according to the garbage recovery request;
determining a garbage collection policy based on the read count;
judging the type of the garbage collection strategy, writing the data to be collected into a flash memory if the garbage collection strategy is a high-hot-spot garbage collection strategy, and writing the data to be collected into a cache area if the garbage collection strategy is a low-hot-spot garbage collection strategy.
8. A waste recycling apparatus, comprising:
the request receiving module is used for receiving a garbage collection request of the solid state disk, wherein the garbage collection request comprises data to be collected;
the information acquisition module is used for acquiring the residual space information of the solid state disk according to the garbage collection request;
the strategy determining module is used for determining a garbage recycling strategy based on the residual space information;
and the data writing module is used for judging the type of the garbage recovery strategy, writing the data to be recovered into a flash memory if the garbage recovery strategy is a low-water-level garbage recovery strategy, and writing the data to be recovered into a cache region if the garbage recovery strategy is a high-water-level garbage recovery strategy.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of a garbage collection method according to any one of claims 1 to 7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of a garbage collection method according to any one of claims 1 to 7 when executing the computer program.
CN202210154235.0A 2022-02-21 2022-02-21 Garbage recycling method and device, readable storage medium and electronic equipment Active CN114238162B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210154235.0A CN114238162B (en) 2022-02-21 2022-02-21 Garbage recycling method and device, readable storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210154235.0A CN114238162B (en) 2022-02-21 2022-02-21 Garbage recycling method and device, readable storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN114238162A true CN114238162A (en) 2022-03-25
CN114238162B CN114238162B (en) 2022-06-10

Family

ID=80747603

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210154235.0A Active CN114238162B (en) 2022-02-21 2022-02-21 Garbage recycling method and device, readable storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114238162B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117234962A (en) * 2023-11-10 2023-12-15 成都佰维存储科技有限公司 Space recycling method and device, readable storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598878A (en) * 2016-12-27 2017-04-26 湖南国科微电子股份有限公司 Method for separating cold data and hot data of solid state disk
US20170123686A1 (en) * 2015-11-03 2017-05-04 Samsung Electronics Co., Ltd. Mitigating gc effect in a raid configuration
CN106681935A (en) * 2016-12-29 2017-05-17 郑州云海信息技术有限公司 Trash recycling method for solid state disk
CN111708713A (en) * 2020-05-20 2020-09-25 杭州电子科技大学 Intelligent garbage recycling and scheduling method for solid state disk

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170123686A1 (en) * 2015-11-03 2017-05-04 Samsung Electronics Co., Ltd. Mitigating gc effect in a raid configuration
CN106598878A (en) * 2016-12-27 2017-04-26 湖南国科微电子股份有限公司 Method for separating cold data and hot data of solid state disk
CN106681935A (en) * 2016-12-29 2017-05-17 郑州云海信息技术有限公司 Trash recycling method for solid state disk
CN111708713A (en) * 2020-05-20 2020-09-25 杭州电子科技大学 Intelligent garbage recycling and scheduling method for solid state disk

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117234962A (en) * 2023-11-10 2023-12-15 成都佰维存储科技有限公司 Space recycling method and device, readable storage medium and electronic equipment
CN117234962B (en) * 2023-11-10 2024-03-26 成都佰维存储科技有限公司 Space recycling method and device, readable storage medium and electronic equipment

Also Published As

Publication number Publication date
CN114238162B (en) 2022-06-10

Similar Documents

Publication Publication Date Title
US9092323B2 (en) Systems and methods for recovering addressing data
US20140129758A1 (en) Wear leveling in flash memory devices with trim commands
EP2203825B1 (en) Apparatus using flash memory as storage and method of operating the same
KR100526190B1 (en) Remapping method for flash memory
CN109783017B (en) Storage device bad block processing method and device and storage device
CN110427158B (en) Writing method of solid state disk and solid state disk
CN104461391A (en) Method and system for managing and processing metadata of storage equipment
US20120166709A1 (en) File system of flash memory
US10552335B2 (en) Method and electronic device for a mapping table in a solid-state memory
CN109902034B (en) Snapshot creating method and device, electronic equipment and machine-readable storage medium
US20150149692A1 (en) Efficient reuse of segments in nonoverwrite storage systems
CN111930301A (en) Garbage recycling optimization method and device, storage medium and electronic equipment
CN114238162B (en) Garbage recycling method and device, readable storage medium and electronic equipment
CN101999117A (en) Memory drive that can be operated like optical disk drive and method for virtualizing memory drive as optical disk drive
CN107908358A (en) A kind of method of reduction NVMe solid state disk writes amplification
CN109690465B (en) Storage device management method and user terminal
KR101077901B1 (en) Apparatus and method for managing flash memory using log block level mapping algorithm
CN112347001B (en) Verification method and device for flash memory garbage collection and electronic equipment
CN111143238B (en) Data erasing method and system based on eFlash memory chip
CN113190180A (en) Storage device based on mixed media and distributed storage system
CN109739688B (en) Snapshot resource space management method and device and electronic equipment
CN111124294B (en) Sector mapping information management method and device, storage medium and equipment
CN114924923A (en) Method, system, equipment and medium for verifying correctness of hard disk write-in point
CN109960611B (en) Data recovery method and device, electronic equipment and machine-readable storage medium
CN112035065B (en) Data writing method, device and equipment and computer readable storage medium

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