CN112052193B - 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
CN112052193B
CN112052193B CN202011038436.1A CN202011038436A CN112052193B CN 112052193 B CN112052193 B CN 112052193B CN 202011038436 A CN202011038436 A CN 202011038436A CN 112052193 B CN112052193 B CN 112052193B
Authority
CN
China
Prior art keywords
garbage
index information
stripe block
updated
stripe
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
CN202011038436.1A
Other languages
Chinese (zh)
Other versions
CN112052193A (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
Original Assignee
Chengdu Baiwei 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 filed Critical Chengdu Baiwei Storage Technology Co ltd
Priority to CN202011038436.1A priority Critical patent/CN112052193B/en
Publication of CN112052193A publication Critical patent/CN112052193A/en
Application granted granted Critical
Publication of CN112052193B publication Critical patent/CN112052193B/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
    • G06F12/0261Garbage collection, i.e. reclamation of unreferenced memory using reference counting
    • 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/10Address translation
    • G06F12/1009Address translation using page tables, e.g. page table structures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a garbage recycling method, a garbage recycling device, a readable storage medium and electronic equipment, wherein the following steps are added while an L2P mapping table is refreshed in batch: storing the replaced physical distribution addresses, updating corresponding junk index information according to each stored replaced physical distribution address, storing the updated junk index information, and determining effective data quickly and efficiently according to the updated junk index information; in the prior art, data needing to be moved is directly stored in an L2P mapping table without additional operation, so that the performance burden is heavy when effective data are scanned in garbage collection at a later stage.

Description

Garbage recycling method and device, readable storage medium and electronic equipment
Technical Field
The present invention relates to the field of storage space management, and in particular, to a garbage collection method and apparatus, a readable storage medium, and an electronic device.
Background
Garbage Collection (GC) is a key link in SSD (Solid State Drive) firmware for balancing space and performance, and whether the efficiency of a Garbage Collection algorithm directly affects the performance of the entire SSD when the space is insufficient. The common garbage recovery algorithm generally needs to scan an L2P (local to physical) table when a whole block stripe is recovered, the table entries stored in the L2P table are data needing to be moved at this time, the method usually does not need to perform extra operation when the L2P table entries are stored, the performance burden is concentrated in a later stage of scanning effective data, the method is suitable for scenes with high burst writing performance requirements and low GC writing performance requirements, and the existing garbage recovery algorithm cannot meet the requirements of scenes requiring stable and continuous writing performance.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: provided are a garbage collection method, a garbage collection device, a readable storage medium and an electronic device, which can improve the stability of writing performance.
In order to solve the technical problems, the invention adopts a technical scheme that:
a method of recycling waste comprising the steps of:
when the L2P mapping tables are refreshed in batch, the replaced physical distribution addresses in the L2P mapping tables are saved;
updating corresponding garbage index information according to each replaced physical distribution address, and storing the updated garbage index information;
receiving a garbage recycling request, reading the updated garbage index information corresponding to the garbage recycling request, and recycling the storage space according to the corresponding updated garbage index information.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a waste recovery device comprising:
the storage module is used for storing the replaced physical distribution address in the L2P mapping table when the L2P mapping tables are refreshed in batches;
the updating module is used for updating corresponding junk index information according to each replaced physical allocation address and storing the updated junk index information;
and the recovery module is used for receiving a garbage recovery request, reading the updated garbage index information corresponding to the garbage recovery request, and recovering the storage space according to the corresponding updated garbage index information.
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 the above-mentioned garbage collection method.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
an electronic device comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the computer program to realize the steps of the garbage collection method.
The invention has the beneficial effects that: the method is characterized in that the following steps are added while the L2P mapping tables are refreshed in batch: the replaced physical distribution addresses are stored, the corresponding garbage index information is updated according to each stored replaced physical distribution address, and the updated garbage index information is stored, so that when garbage recycling operation is subsequently executed, the corresponding updated garbage index information is directly determined, effective data can be rapidly and efficiently determined according to the updated garbage index information, and rapid recycling of storage space is realized; the performance of the garbage recycling algorithm is distributed to the stage of storing the mapping table, so that the performance of centralized garbage recycling is greatly improved; in the prior art, data needing to be moved is directly stored in an L2P mapping table without additional operation, so that the performance burden is heavy when effective data are scanned in garbage collection at a later stage.
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 flowchart illustrating steps of updating garbage index information according to a garbage recycling method of an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a stripe block according to an embodiment of the present invention;
fig. 6 is a schematic diagram illustrating marking of garbage index information according to a garbage collection method in an embodiment of the present invention;
fig. 7 is a schematic diagram of a format of a physical allocation address of a garbage collection method according to an 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:
when the L2P mapping tables are refreshed in batch, the replaced physical distribution addresses in the L2P mapping tables are saved;
updating corresponding garbage index information according to each replaced physical distribution address, and storing the updated garbage index information;
receiving a garbage collection request, reading the updated garbage index information corresponding to the garbage collection request, and collecting the storage space according to the corresponding updated garbage index information.
As can be seen from the above description, the beneficial effects of the present invention are: the method is characterized in that the following steps are added while the L2P mapping tables are refreshed in batch: the replaced physical distribution addresses are stored, the corresponding garbage index information is updated according to each stored replaced physical distribution address, and the updated garbage index information is stored, so that when garbage recycling operation is subsequently executed, the corresponding updated garbage index information is directly determined, effective data can be rapidly and efficiently determined according to the updated garbage index information, and rapid recycling of storage space is realized; the performance of the garbage recycling algorithm is distributed to the stage of storing the mapping table, so that the performance of centralized garbage recycling is greatly improved; in the prior art, data needing to be moved is directly stored in the L2P mapping table without additional operation, so that the performance burden is heavy when garbage collection is carried out and effective data are scanned in the later period.
Further, the updating the corresponding spam index information according to each replaced physical allocation address, and saving the updated spam index information includes:
carrying out deduplication processing on the stripe block corresponding to the replaced physical allocation address and storing the stripe block;
and updating the stored garbage index information corresponding to each band block according to each replaced physical distribution address, and storing the updated garbage index information.
It can be known from the above description that performing deduplication processing on the stripe block of the replaced physically allocated address can avoid repeatedly reading the same piece of garbage index information, and is beneficial to reducing data errors caused by redundant data and data duplication operations.
Further, the performing deduplication processing and saving on the stripe block corresponding to the replaced physically allocated address includes:
selecting a replaced physical distribution address from the replaced physical distribution addresses;
determining a stripe block identifier of a stripe block corresponding to the selected replaced physical allocation address, judging whether the stripe block identifier is marked, if so, returning to the step of selecting a replaced physical allocation address from the replaced physical allocation address until the replaced physical allocation addresses are traversed; if not, marking the stripe block identification, storing the stripe block identification, and returning to execute the step of selecting one replaced physical distribution address from the replaced physical distribution addresses until the replaced physical distribution addresses are traversed.
It can be known from the above description that the stripe blocks are marked by traversing all the stripe block identifiers of the replaced physical allocation addresses, and only the non-marked stripe blocks are stored and marked, which is beneficial to removing repeated stripe blocks simply and quickly and improving the processing efficiency.
Further, storing the replaced physical allocation address to a garbage physical allocation address cache region;
the updating the stored garbage index information corresponding to each stripe block according to each replaced physical allocation address includes:
acquiring a stored stripe block identifier of each stripe block;
determining garbage index information corresponding to the stripe block according to the stripe block identifier;
and matching the corresponding stripe block from the garbage physical distribution address cache region according to the stripe block identification, and updating the garbage index information according to the matched stripe block.
As can be seen from the above description, the total number of the stripe blocks included in the replaced physical allocation address is determined, then the corresponding stripe block is matched from the garbage physical allocation address cache area according to the stripe block identifier corresponding to each stripe block, and the garbage index information is updated according to the matched stripe block, so that the garbage index information can be updated in a centralized manner, and the efficiency is improved.
Further, the replaced physical allocation address is saved, and meanwhile, the stripe block corresponding to the replaced physical allocation address is obtained, and the stripe block is subjected to deduplication processing and is saved.
It can be known from the above description that the replaced physical allocation address is saved and the corresponding stripe block is obtained at the same time, and the deduplication processing and saving are performed, and the saving and reading are performed synchronously, so that the step of subsequently re-reading the replaced physical allocation address is avoided, and the processing efficiency is further improved.
Further, each bit is a first preset value when the garbage index information is initialized;
and when the garbage index information is updated, setting the corresponding bit to be a second preset value different from the first preset value.
As can be seen from the above description, each bit is set to the first preset value when the garbage index information is initialized, and the corresponding bit is set to the second preset value when the garbage index information is updated, which is beneficial to visually distinguishing valid data from invalid data, and is convenient for subsequently searching for valid data.
Further, the garbage collection request includes a stripe block identifier of a stripe block to be spatially collected;
the reading of the updated garbage index information corresponding to the garbage collection request includes:
reading updated garbage index information corresponding to the stripe block according to the stripe block identification of the stripe block to be spatially recycled;
the recycling of the storage space according to the corresponding updated spam index information includes:
scanning a bit position corresponding to the updated median value of the junk index information as the first preset value, and transferring data on a to-be-recovered stripe block corresponding to the bit position to a new stripe block;
and after the data is moved, recovering the storage space of the stripe block to be recovered.
According to the description, the bit position with the median value of the garbage index information as the first preset value is moved to a new stripe block, so that the space recovery of the whole stripe block can be completed, the position of effective data can be rapidly obtained, the effective data can be conveniently reintegrated, and the fragmentation of the memory space can be avoided.
Referring to fig. 2, another embodiment of the present invention provides a garbage recycling apparatus, including:
the storage module is used for storing the replaced physical distribution address in the L2P mapping table when the L2P mapping tables are refreshed in batches;
the updating module is used for updating corresponding garbage index information according to each replaced physical distribution address and storing the updated garbage index information;
and the recovery module is used for receiving a garbage recovery request, reading the updated garbage index information corresponding to the garbage recovery request, and recovering the storage space according to the corresponding updated garbage index information.
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 the 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 executable on the processor, where the processor implements the steps of the garbage collection method when executing the computer program.
The garbage collection method, the garbage collection device, the computer-readable storage medium and the electronic device of the present invention are applicable to garbage collection of various types of solid state disks and applicable to scenes with requirements on stability performance, and are described below by specific embodiments:
example one
Referring to fig. 1, a garbage recycling method includes the steps of:
s1, storing a replaced physical distribution address in an L2P mapping table when the L2P mapping table is refreshed in batches;
specifically, as shown in fig. 4, when the Flash Translation Layer FLT (Flash Translation Layer) stores data in the Nand Flash memory, the metadata is stored in the metadata write buffer, and at this time, the mapping table is triggered to manage the batch refresh L2P mapping table, and when the L2P mapping table is batch refreshed, the replaced Physical Allocation Address in the L2P mapping table, that is, the Old (Physical Allocation Address) is stored, and a garbage Physical Allocation Address buffer, that is, a garbage PAA buffer, may be set to store the Old PAA;
s2, updating corresponding junk index information according to each replaced physical allocation address, and storing the updated junk index information;
the schematic diagram of a stripe block is shown in fig. 5, which means that a stripe block is formed by data blocks at the same position on each plane; each physical allocation address belongs to a slice block, each slice block contains complete garbage index information, and if the size of a single slice block is 256MB, the spatial size of the garbage index information of the single slice block is calculated by the following formula: an SSD of 256MB/4KB/8bits =8KB,256G also requires only 8MB of space to store garbage index information; in fig. 5, channel is a data Channel, block is a data block, plane is a data plane, LUN is a logical unit number, and Target is a Target.
During initialization, setting each bit of the garbage index information to be a first preset value, for example, setting the initial value to be all 0, when the L2P mapping table is updated, setting the bit corresponding to the garbage index information to be a second preset value different from the first preset value, for example, to be 1, according to the stripe block corresponding to the replaced physical allocation address in the L2P mapping table and according to the stripe block;
as shown in fig. 6, when the address of the updated LAA0 is PAA5, it is found that the original LAA0 is stored in PAA0, and at this time, the block stripe and offset to which the block stripe belongs need to be determined by PAA 0; the format of the PAA is as shown in fig. 7, id of a stripe block stripe can be confirmed by block id, offset can be confirmed by page id and page offset, and then corresponding bit in the garbage index information is set to 1;
in this embodiment, for replaced PAAs stored in the garbage PAA buffer in bulk, the replaced PAAs may be scanned, the replaced PAAs are fetched one by one, and then their corresponding stripe blocks and offsets are determined, and the corresponding positions in the garbage index information are set to 1 until the replaced PAAs in the garbage PAA buffer are all traversed;
after traversing the replaced PAAs in the garbage PAA cache region and updating the garbage index information corresponding to each replaced PAA, storing the updated garbage index information to the NAND;
s3, receiving a garbage collection request, reading the updated garbage index information corresponding to the garbage collection request, and collecting the storage space according to the corresponding updated garbage index information;
the garbage collection request comprises a stripe block identifier of a stripe block to be subjected to space collection;
reading garbage index information which is updated correspondingly to the stripe block from an NAND according to the stripe block identifier of the stripe block to be spatially recycled;
scanning a bit position corresponding to the updated median value of the junk index information as the first preset value, and transferring data on a to-be-recovered stripe block corresponding to the bit position to a new stripe block;
after the data is moved, recovering the storage space of the stripe block to be recovered, namely completing the space recovery task of the whole stripe block;
in another optional implementation manner, the garbage collection request may include multiple stripe block identifiers, that is, multiple stripe blocks may be collected at one time, because the garbage index information is centrally updated in the stage of storing the L2P mapping table, when garbage collection is performed subsequently, whether data validity in each garbage index information is confirmed or not is found, and after a bit position in the garbage index information whose median is a first preset value is found to be valid data, the valid data is directly moved, and thus centralized garbage collection may be achieved.
Example two
The difference between this embodiment and the first embodiment is that how to update the corresponding garbage index information according to each replaced physical allocation address is further defined, specifically:
carrying out deduplication processing on the stripe block corresponding to the replaced physical allocation address and storing the stripe block;
acquiring a stored stripe block identifier of each stripe block;
determining garbage index information corresponding to the stripe block according to the stripe block identification;
matching the corresponding stripe block from the garbage physical distribution address cache region according to the stripe block identification, and updating the garbage index information according to the matched stripe block;
wherein, the performing the deduplication processing and the saving of the stripe block corresponding to the replaced physical allocation address comprises:
selecting a replaced physical distribution address from the replaced physical distribution addresses;
determining the stripe block identifier of the stripe block corresponding to the selected replaced physical distribution address, judging whether the stripe block identifier is marked, if so, returning to the step of selecting a replaced physical distribution address from the replaced physical distribution addresses until the replaced physical distribution addresses are traversed; if not, marking the stripe block identification, storing the stripe block identification, and returning to execute the step of selecting one replaced physical distribution address from the replaced physical distribution addresses until the replaced physical distribution addresses are traversed;
specifically, in this embodiment, according to the size of a PAA being 4Bytes, a space reserved for 40KB may reserve 10k Old PAA, store the Old PAA and obtain stripe block information at the same time, preset a total of 2048 stripe blocks, establish two data structures to store stripe block information corresponding to all replaced physical allocation addresses, establish an array block _ stripe _ id _ array [2048] to store stripe blocks needing to be updated in batch refresh, establish an array block _ stripe _ id _ mask [2048/32] to correspond to all stripe blocks, and perform deduplication processing for the same stripe blocks; the de-duplication treatment is specifically as follows:
firstly, acquiring a replaced physical allocation address old PAA0 to obtain a stripe block serial number block stripe id 2 corresponding to the old PAA 0;
checking whether the 2 nd bit in the block _ stripe _ id _ mask is set to be 1 or not, if not, setting the 2 nd bit of the block _ stripe _ id _ mask to be 1, and storing the stripe block serial number block stripe id 2 into an array block _ stripe _ id _ array; returning to the garbage physical distribution address cache region to obtain the next replaced physical distribution address;
if yes, directly returning to the garbage physical distribution address cache region to obtain the next replaced physical distribution address;
repeating the steps of obtaining the replaced physical distribution addresses and checking operation until all the replaced physical distribution addresses are traversed;
after the Old PAA is stored, the block stripe id needing to be processed is taken out from the block _ stripe _ id _ array, corresponding garbage index information is sequentially read from nand, then the garbage PAA cache region, the garbage index information and the block stripe id are transmitted into a hardware search engine, the hardware search engine is matched with the block stripe id from the garbage cache region, and then the corresponding bit is updated into the garbage index information.
EXAMPLE III
Referring to fig. 2, a garbage recycling apparatus includes:
the storage module is used for storing the replaced physical distribution address in the L2P mapping table when the L2P mapping tables are refreshed in batches;
the updating module is used for updating corresponding junk index information according to each replaced physical allocation address and storing the updated junk index information;
and the recovery module is used for receiving a garbage recovery request, reading the updated garbage index information corresponding to the garbage recovery request, and recovering the storage space according to the corresponding updated garbage index information.
Example four
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 according to any one of the first to second embodiments.
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 any one of the first to second embodiments.
In summary, the garbage collection method, apparatus, readable storage medium and electronic device provided by the present invention add the following steps while refreshing the L2P mapping tables in batch: the replaced physical distribution addresses are stored, the corresponding garbage index information is updated according to each stored replaced physical distribution address, and the updated garbage index information is stored, so that when garbage recycling operation is subsequently executed, the corresponding updated garbage index information is directly determined, effective data can be rapidly and efficiently determined according to the updated garbage index information, and rapid recycling of storage space is realized; when updating the garbage index information, the replacement of the stripe block corresponding to the physical distribution address is firstly carried out, and then the centralized updating is carried out, so that the updating efficiency is greatly improved, and the performance of the centralized garbage recovery is greatly improved by distributing the performance of the garbage recovery algorithm to the stage of storing the mapping table; in the prior art, data needing to be moved is directly stored in an L2P mapping table without additional operation, so that the performance burden is heavy when effective data are scanned in garbage collection at a later stage, compared with the existing garbage collection method, the method has the advantages that a large amount of time-consuming operation in the garbage collection process is dispersed and completed in a writing stage, time consumption is further shortened through reasonable updating setting, obvious performance fluctuation cannot occur in the whole writing process, the stability of writing performance is improved, and the method is more suitable for scenes with requirements on stable performance.
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 position, 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 separate product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present invention, which is substantially or partly contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform 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 this specification are presently considered to be preferred embodiments and that no single act or module is essential to the invention.
In the foregoing 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 the 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 (8)

1. A garbage recycling method is characterized by comprising the following steps:
when the L2P mapping tables are refreshed in batch, the replaced physical distribution addresses in the L2P mapping tables are saved;
updating corresponding garbage index information according to each replaced physical distribution address, and storing the updated garbage index information;
receiving a garbage collection request, reading the updated garbage index information corresponding to the garbage collection request, and collecting a storage space according to the corresponding updated garbage index information;
each bit is a first preset value when the garbage index information is initialized;
when the garbage index information is updated, setting corresponding bits to a second preset value different from the first preset value;
the garbage collection request comprises a stripe block identifier of a stripe block to be spatially collected;
the reading the updated garbage index information corresponding to the garbage collection request comprises:
reading updated garbage index information corresponding to the stripe block according to the stripe block identification of the stripe block to be spatially recycled;
the recycling of the storage space according to the corresponding updated spam index information includes:
scanning a bit position corresponding to the updated median value of the junk index information as the first preset value, and transferring data on a to-be-recovered stripe block corresponding to the bit position to a new stripe block;
and after the data is moved, recovering the storage space of the stripe block to be recovered.
2. The garbage collection method of claim 1, wherein the updating the corresponding garbage index information according to each replaced physical allocation address, and saving the updated garbage index information comprises:
carrying out deduplication processing on the stripe block corresponding to the replaced physical allocation address and storing the stripe block;
and updating the stored garbage index information corresponding to each band block according to each replaced physical distribution address, and storing the updated garbage index information.
3. The garbage collection method of claim 2, wherein the performing deduplication processing and saving on the stripe block corresponding to the replaced physically allocated address comprises:
selecting a replaced physical distribution address from the replaced physical distribution addresses;
determining the stripe block identifier of the stripe block corresponding to the selected replaced physical distribution address, judging whether the stripe block identifier is marked, if so, returning to the step of selecting a replaced physical distribution address from the replaced physical distribution addresses until the replaced physical distribution addresses are traversed; if not, marking the strip block identification, storing the strip block identification, and returning to execute the step of selecting one replaced physical distribution address from the replaced physical distribution addresses until the replaced physical distribution addresses are traversed.
4. A garbage collection method according to claim 2, wherein the replaced physically allocated address is saved to a garbage physically allocated address buffer;
the updating the stored garbage index information corresponding to each stripe block according to each replaced physical allocation address includes:
acquiring a stored stripe block identifier of each stripe block;
determining garbage index information corresponding to the stripe block according to the stripe block identifier;
and matching the corresponding stripe block from the garbage physical distribution address cache region according to the stripe block identification, and updating the garbage index information according to the matched stripe block.
5. The garbage collection method according to any one of claims 2 to 4, wherein the replaced physical allocation address is saved, and meanwhile, the stripe block corresponding to the replaced physical allocation address is obtained, and the stripe block is subjected to deduplication processing and saved.
6. A waste recycling apparatus, comprising:
the storage module is used for storing the replaced physical allocation addresses in the L2P mapping table when the L2P mapping tables are refreshed in batches;
the updating module is used for updating corresponding junk index information according to each replaced physical allocation address and storing the updated junk index information;
the recovery module is used for receiving a garbage recovery request, reading the updated garbage index information corresponding to the garbage recovery request, and recovering the storage space according to the corresponding updated garbage index information;
each bit is a first preset value when the garbage index information is initialized;
when the garbage index information is updated, setting corresponding bits to a second preset value different from the first preset value;
the garbage collection request comprises a stripe block identifier of a stripe block to be spatially collected;
the reading of the updated garbage index information corresponding to the garbage collection request includes:
reading updated garbage index information corresponding to the stripe block according to the stripe block identification of the stripe block to be spatially recycled;
the recycling of the storage space according to the corresponding updated spam index information includes:
scanning a bit position corresponding to the updated median value of the junk index information as the first preset value, and transferring data on a to-be-recovered stripe block corresponding to the bit position to a new stripe block;
and after the data is moved, recovering the storage space of the to-be-recovered stripe block.
7. 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-5.
8. 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-5 when executing the computer program.
CN202011038436.1A 2020-09-28 2020-09-28 Garbage recycling method and device, readable storage medium and electronic equipment Active CN112052193B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011038436.1A CN112052193B (en) 2020-09-28 2020-09-28 Garbage recycling method and device, readable storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011038436.1A CN112052193B (en) 2020-09-28 2020-09-28 Garbage recycling method and device, readable storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112052193A CN112052193A (en) 2020-12-08
CN112052193B true CN112052193B (en) 2023-04-07

Family

ID=73605306

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011038436.1A Active CN112052193B (en) 2020-09-28 2020-09-28 Garbage recycling method and device, readable storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112052193B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112667152B (en) * 2020-12-18 2023-04-07 成都佰维存储科技有限公司 Heap memory management method and device, readable storage medium and electronic equipment
CN112988618B (en) * 2021-02-20 2023-02-28 山东英信计算机技术有限公司 Garbage recycling method, device and equipment for solid state disk and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103729303A (en) * 2014-01-20 2014-04-16 飞天诚信科技股份有限公司 Data writing and data reading methods of Flash
CN110399310A (en) * 2018-04-18 2019-11-01 杭州宏杉科技股份有限公司 A kind of recovery method and device of memory space
CN110531927A (en) * 2019-08-06 2019-12-03 深圳大普微电子科技有限公司 A kind of rubbish recovering method based on block-grading and non-volatile storage equipment

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100789406B1 (en) * 2006-11-03 2007-12-28 삼성전자주식회사 Flash memory system and garbage collection method therof
TWI489466B (en) * 2011-06-15 2015-06-21 Phison Electronics Corp Memory erasing method, memory controller and memory storage apparatus
US9436720B2 (en) * 2013-01-10 2016-09-06 Pure Storage, Inc. Safety for volume operations
KR20160027805A (en) * 2014-09-02 2016-03-10 삼성전자주식회사 Garbage collection method for non-volatile memory device
US10067960B2 (en) * 2015-06-04 2018-09-04 Microsoft Technology Licensing, Llc Controlling atomic updates of indexes using hardware transactional memory
CN107562646A (en) * 2017-08-28 2018-01-09 记忆科技(深圳)有限公司 A kind of method for lifting solid-state storage garbage reclamation performance
CN107656875B (en) * 2017-09-15 2020-05-15 至誉科技(武汉)有限公司 Method and system for shortening power-on time of solid state disk serving as system disk
TWI643066B (en) * 2018-01-15 2018-12-01 慧榮科技股份有限公司 Method for reusing destination block related to garbage collection in memory device, associated memory device and controller thereof, and associated electronic device
CN108874682A (en) * 2018-04-27 2018-11-23 江苏华存电子科技有限公司 A kind of promotion flash memory junk data recovery method
CN108763102B (en) * 2018-05-31 2021-10-29 郑州云海信息技术有限公司 Garbage recycling method and device for solid state disk
CN110825653B (en) * 2018-08-09 2023-11-24 深圳大心电子科技有限公司 Memory management method and memory controller
CN111610930B (en) * 2019-02-26 2023-05-02 慧荣科技股份有限公司 Data storage device and non-volatile memory control method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103729303A (en) * 2014-01-20 2014-04-16 飞天诚信科技股份有限公司 Data writing and data reading methods of Flash
CN110399310A (en) * 2018-04-18 2019-11-01 杭州宏杉科技股份有限公司 A kind of recovery method and device of memory space
CN110531927A (en) * 2019-08-06 2019-12-03 深圳大普微电子科技有限公司 A kind of rubbish recovering method based on block-grading and non-volatile storage equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于SSD缓存的RAID5/6写优化技术研究;詹玲等;《小型微型计算机系统》;20181015(第10期);2226-2232 *

Also Published As

Publication number Publication date
CN112052193A (en) 2020-12-08

Similar Documents

Publication Publication Date Title
US10303596B2 (en) Read-write control method for memory, and corresponding memory and server
CN107481762B (en) Trim processing method and device of solid state disk
CN101364166B (en) Method and device for simulating Nand flash of 2048 byte page into hard disk
WO2016127658A1 (en) Snapshot processing method and apparatus
CN109144886B (en) Data storage device
CN103514212B (en) Method for writing data and system
CN112052193B (en) Garbage recycling method and device, readable storage medium and electronic equipment
KR101678868B1 (en) Apparatus for flash address translation apparatus and method thereof
US10552377B2 (en) Data discard method for journaling file system and memory management apparatus thereof
CN106548789A (en) Method and apparatus for operating stacked tile type magnetic recording equipment
CN111832065A (en) Software implemented using circuitry and method for key-value storage
CN107992269A (en) A kind of affairs wiring method based on duplicate removal SSD
CN114721972B (en) Garbage recycling method and device, readable storage medium and electronic equipment
CN112379830B (en) Method and device for creating effective data bitmap, storage medium and electronic equipment
CN112084070A (en) L2P mapping data recovery method and device, storage medium and electronic equipment
CN111459919A (en) Data query method, loading assembly, search assembly and storage medium
CN107273306B (en) Data reading and writing method for solid state disk and solid state disk
CN111966281B (en) Data storage device and data processing method
CN106776361B (en) Caching method and system for large-scale nonvolatile storage medium
CN107463333B (en) Method, device and system for recovering network hard disk space
JP4897885B2 (en) Methods for managing data
US9535796B2 (en) Method, apparatus and computer for data operation
CN114356246B (en) Storage management method and device for SSD internal data, storage medium and SSD device
CN111625198A (en) Metadata caching method and metadata caching device
CN112817879B (en) Garbage recycling method and device, readable storage medium and electronic equipment

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