CN109086001B - NAND Flash garbage recovery method and system - Google Patents
NAND Flash garbage recovery method and system Download PDFInfo
- Publication number
- CN109086001B CN109086001B CN201810670318.9A CN201810670318A CN109086001B CN 109086001 B CN109086001 B CN 109086001B CN 201810670318 A CN201810670318 A CN 201810670318A CN 109086001 B CN109086001 B CN 109086001B
- Authority
- CN
- China
- Prior art keywords
- command
- erasing
- data
- nand flash
- index node
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 17
- 238000011084 recovery Methods 0.000 title abstract description 8
- 238000004458 analytical method Methods 0.000 claims abstract description 11
- 230000009471 action Effects 0.000 claims description 10
- 238000005192 partition Methods 0.000 claims description 6
- 238000004064 recycling Methods 0.000 claims 1
- 230000003321 amplification Effects 0.000 abstract description 7
- 238000003199 nucleic acid amplification method Methods 0.000 abstract description 7
- 238000010586 diagram Methods 0.000 description 5
- 230000006872 improvement Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/062—Securing storage systems
- G06F3/0623—Securing storage systems in relation to content
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/0652—Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
Abstract
The invention relates to the technical field of storage systems, and provides a NAND Flash garbage recovery method and a NAND Flash garbage recovery system, wherein the method comprises the following steps: receiving a data operation command sent by an upper file system; performing type analysis on the received data operation command to acquire the type of the data operation command; when the type of the data operation command is an erasing command, judging whether the erasing command is a quick erasing command; when the erasing command is a quick erasing command, searching an index node corresponding to the quick erasing command; and searching the data blocks linked with the index nodes according to the searched index nodes, and erasing all the data blocks occupied by the file, thereby realizing intelligent identification and erasure of potential invalid data blocks, effectively reducing write amplification and improving the write efficiency of the file system.
Description
Technical Field
The invention belongs to the technical field of storage systems, and particularly relates to a NAND Flash garbage recovery method and system.
Background
The NAND Flash garbage collection means that: after any memory is allocated and used for a period of time, free areas and fragmented data occur, and garbage collection is required to ensure efficient use of memory space. Since physical pages in NAND Flash cannot be written repeatedly, data to be updated is written into other free space, the mapping of logical addresses to physical addresses is modified, and invalid blocks are erased as appropriate, a process called garbage collection.
However, in the existing garbage collection process based on the NAND Flash, invalid blocks are passively collected according to a fixed algorithm, and potential invalid data blocks cannot be intelligently identified, so that the write amplification phenomenon is caused.
Disclosure of Invention
The invention aims to provide a method for recovering garbage of NAND Flash, and aims to solve the problem that in the prior art, the garbage recovery process based on NAND Flash passively recovers invalid blocks according to a fixed algorithm, and potential invalid data blocks cannot be intelligently identified, so that the write amplification phenomenon is caused.
The invention is realized in such a way that a NAND Flash garbage recovery method comprises the following steps:
receiving a data operation command sent by an upper file system, wherein the data operation command comprises a read command, a write command and an erase command;
performing type analysis on the received data operation command to acquire the type of the data operation command;
when the type of the data operation command is an erasing command, judging whether the erasing command is a quick erasing command;
when the erasing command is a quick erasing command, searching an index node corresponding to the quick erasing command;
and searching the data blocks linked with the index nodes according to the searched index nodes, and erasing all the data blocks occupied by the files.
As an improved scheme, after the step of searching for the data blocks linked to the index node according to the searched index node, the step of erasing all the data blocks occupied by the file further includes the following steps:
and judging whether the NAND Flash controller is in an idle state, if so, executing the step of erasing all data blocks occupied by the file, and otherwise, continuing to judge.
As an improved solution, the file system is a second-generation extended file system ext 2;
the partitions of the second-generation extended file system ext2 comprise a boot block and 10 block groups, and the storage medium of each block group is NAND Flash;
each block group consists of a super block, a group descriptor, a data block bitmap, an index node table and a data block, wherein the content corresponding to the data block is file data.
As an improvement, the method further comprises the steps of:
and when the erasing command is a common erasing command, executing normal file deleting action.
As an improved scheme, the step of determining whether the erase command is a fast erase command specifically includes the following steps:
acquiring an erasing address corresponding to the erasing command;
and judging whether the erasing address is an index node bitmap area, if so, judging that the erasing command is a quick erasing command, otherwise, judging that the erasing command is a general erasing command.
Another object of the present invention is to provide a NAND Flash garbage collection system, including:
the data operation command receiving module is used for receiving data operation commands sent by an upper file system, and the data operation commands comprise read commands, write commands and erase commands;
the command type analysis module is used for carrying out type analysis on the received data operation command to acquire the type of the data operation command;
the first judgment module is used for judging whether the erasing command is a quick erasing command or not when the type of the data operation command is the erasing command;
the index node searching module is used for searching an index node corresponding to the quick erasing command when the erasing command is the quick erasing command;
the data block searching module is used for searching the data block linked with the index node according to the searched index node;
and the data erasing module is used for erasing all data blocks occupied by the file according to the searched data blocks linked with the index nodes.
As an improvement, the system further comprises:
and the second judgment module is used for judging whether the NAND Flash controller is in an idle state, executing the step of erasing all data blocks occupied by the file if the NAND Flash controller is in the idle state, and otherwise, continuing to judge.
As an improved solution, the file system is a second-generation extended file system ext 2;
the partitions of the second-generation extended file system ext2 comprise a boot block and 10 block groups, and the storage medium of each block group is NAND Flash;
each block group consists of a super block, a group descriptor, a data block bitmap, an index node table and a data block, wherein the content corresponding to the data block is file data.
As an improvement, the system further comprises:
and the file deleting action executing module is used for executing normal file deleting action when the erasing command is a common erasing command.
As an improved scheme, the first determining module specifically includes:
the erasing address obtaining module is used for obtaining an erasing address corresponding to the erasing command;
a third judging module, configured to judge whether the erasure address is an index node bitmap area, and if the erasure address is the index node bitmap area;
the first judging module is used for judging that the erasing command is a quick erasing command when the third judging module judges that the erasing address is an index node bitmap area;
and the second judging module is used for judging that the erasing command is a general erasing command when the third judging module judges that the erasing address is not the index node bitmap area.
In the embodiment of the invention, a data operation command sent by an upper file system is received; performing type analysis on the received data operation command to acquire the type of the data operation command; when the type of the data operation command is an erasing command, judging whether the erasing command is a quick erasing command; when the erasing command is a quick erasing command, searching an index node corresponding to the quick erasing command; and searching the data blocks linked with the index nodes according to the searched index nodes, and erasing all the data blocks occupied by the file, thereby realizing intelligent identification and erasure of potential invalid data blocks, effectively reducing write amplification and improving the write efficiency of the file system.
Drawings
FIG. 1 is a flowchart of an implementation of the NAND Flash garbage collection method provided by the present invention;
FIG. 2 is a schematic structural diagram of a partition of a second-generation extended file system ext2 provided by the present invention;
FIG. 3 is a block diagram of the NAND Flash garbage collection system provided by the present invention;
fig. 4 is a block diagram of a first determining module provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 shows an implementation flowchart of the NAND Flash garbage collection method provided by the present invention, which specifically includes the following steps:
in step S101, a data operation command sent by an upper file system is received, where the data operation command includes a read command, a write command, and an erase command.
In step S102, type analysis is performed on the received data operation command to obtain the type of the data operation command.
In step S103, when the type of the data operation command is an erase command, it is determined whether the erase command is a fast erase command.
In step S104, when the erase command is a fast erase command, an index node corresponding to the fast erase command is searched.
And when the erasing command is a common erasing command, executing normal file deleting action.
In step S105, according to the searched index node, the data blocks linked to the index node are searched, and all the data blocks occupied by the file are erased.
Wherein, the file system is a second-generation extended file system ext 2;
referring to fig. 2, the partition of the second-generation extended file system ext2 includes a boot block and 10 block groups, and the storage medium of the block groups is NAND Flash;
each block group consists of a super block, a group descriptor, a data block bitmap, an index node table and a data block, wherein the content corresponding to the data block is file data.
In an embodiment of the present invention, the step of determining whether the erase command is a fast erase command specifically includes the following steps:
(1) acquiring an erasing address corresponding to the erasing command;
(2) and judging whether the erasing address is an index node bitmap area, if so, judging that the erasing command is a quick erasing command, otherwise, judging that the erasing command is a general erasing command.
When the erase command is a fast erase command, the erase operation is not only for the portion corresponding to the index node bitmap shown in fig. 2, but also for the file content department corresponding to the data block, thereby solving the write amplification phenomenon when data is written again.
In this embodiment of the present invention, after the step of searching for the data block linked to the index node according to the searched index node, the step of erasing all data blocks occupied by the file further includes the following steps:
and judging whether the NAND Flash controller is in an idle state, if so, executing the step of erasing all data blocks occupied by the file, and otherwise, continuing to judge.
When the erasing command is a quick erasing command, the action execution of erasing the file content needs to be in a system idle state so as not to influence the execution of other reading and writing processes, and the stability of the system and the data reading and writing speed are improved.
In the embodiment of the invention, when a fast erasing command is given by an upper-layer file system, according to the division of the NAND Flash storage area, the potential invalid data of the file content part corresponding to the data block is identified and deleted while the data of the specified storage area is erased, so that the problem of write amplification is solved.
Fig. 3 shows a block diagram of a NAND Flash garbage collection system provided by the present invention, and for convenience of description, only the relevant parts related to the embodiment of the present invention are shown in the diagram.
The NAND Flash garbage collection system comprises:
the data operation command receiving module 11 is configured to receive a data operation command sent by an upper file system, where the data operation command includes a read command, a write command, and an erase command;
the command type analyzing module 12 is configured to perform type analysis on the received data operation command to obtain a type of the data operation command;
a first judging module 13, configured to, when the type of the data operation command is an erase command, judge whether the erase command is a fast erase command;
the index node searching module 14 is configured to search an index node corresponding to the fast erase command when the erase command is the fast erase command;
a data block searching module 15, configured to search, according to the searched index node, a data block linked to the index node;
and the data erasing module 16 is configured to erase all data blocks occupied by the file according to the searched data block linked to the index node.
Wherein, this NAND Flash rubbish recovery system still includes:
a second judging module 17, configured to judge whether the NAND Flash controller is in an idle state, if the NAND Flash controller is in the idle state, execute the step of erasing all data blocks occupied by the file, otherwise, continue to judge;
and the file deleting action executing module 18 is used for executing a normal file deleting action when the erasing command is a common erasing command.
In the embodiment of the present invention, as shown in fig. 4, the first determining module 13 specifically includes:
an erasing address obtaining module 19, configured to obtain an erasing address corresponding to the erasing command;
a third determining module 20, configured to determine whether the erasure address is an index node bitmap area, if the erasure address is the index node bitmap area;
a first determining module 21, configured to determine that the erase command is a fast erase command when the third determining module determines that the erase address is an index node bitmap area;
and the second judging module 22 is configured to judge that the erase command is a general erase command when the third judging module judges that the erase address is not the index node bitmap area.
The functions of the above modules are described in the above embodiments, and are not described herein again.
In the embodiment of the invention, a data operation command sent by an upper file system is received; performing type analysis on the received data operation command to acquire the type of the data operation command; when the type of the data operation command is an erasing command, judging whether the erasing command is a quick erasing command; when the erasing command is a quick erasing command, searching an index node corresponding to the quick erasing command; and searching the data blocks linked with the index nodes according to the searched index nodes, and erasing all the data blocks occupied by the file, thereby realizing intelligent identification and erasure of potential invalid data blocks, effectively reducing write amplification and improving the write efficiency of the file system.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.
Claims (8)
1. A NAND Flash garbage recycling method is characterized by comprising the following steps:
receiving a data operation command sent by an upper file system, wherein the data operation command comprises a read command, a write command and an erase command;
performing type analysis on the received data operation command to acquire the type of the data operation command;
when the type of the data operation command is an erasing command, judging whether the erasing command is a quick erasing command;
when the erasing command is a quick erasing command, searching an index node corresponding to the quick erasing command;
searching data blocks linked with the index nodes according to the searched index nodes, and erasing all data blocks occupied by the files;
after the step of searching for the data blocks linked to the index node according to the searched index node, the step of erasing all the data blocks occupied by the file further comprises the following steps:
and judging whether the NAND Flash controller is in an idle state, if so, executing the step of erasing all data blocks occupied by the file, and otherwise, continuing to judge.
2. The NAND Flash garbage collection method according to claim 1, wherein the file system is a second-generation extended file system ext 2;
the partitions of the second-generation extended file system ext2 comprise a boot block and 10 block groups, and the storage medium of each block group is NAND Flash;
each block group consists of a super block, a group descriptor, a data block bitmap, an index node table and a data block, wherein the content corresponding to the data block is file data.
3. The NAND Flash garbage collection method according to claim 1, further comprising the steps of:
and when the erasing command is a common erasing command, executing normal file deleting action.
4. The NAND Flash garbage collection method according to claim 1, wherein the step of determining whether the erase command is a fast erase command includes the following steps:
acquiring an erasing address corresponding to the erasing command;
and judging whether the erasing address is an index node bitmap area, if so, judging that the erasing command is a quick erasing command, otherwise, judging that the erasing command is a general erasing command.
5. A NAND Flash garbage collection system, the system comprising:
the data operation command receiving module is used for receiving data operation commands sent by an upper file system, and the data operation commands comprise read commands, write commands and erase commands;
the command type analysis module is used for carrying out type analysis on the received data operation command to acquire the type of the data operation command;
the first judgment module is used for judging whether the erasing command is a quick erasing command or not when the type of the data operation command is the erasing command;
the index node searching module is used for searching an index node corresponding to the quick erasing command when the erasing command is the quick erasing command;
the data block searching module is used for searching the data block linked with the index node according to the searched index node;
the data erasing module is used for erasing all data blocks occupied by the file according to the searched data blocks linked with the index nodes;
the system further comprises:
and the second judgment module is used for judging whether the NAND Flash controller is in an idle state, executing the step of erasing all data blocks occupied by the file if the NAND Flash controller is in the idle state, and otherwise, continuing to judge.
6. The NAND Flash garbage collection system of claim 5, wherein the file system is a second generation extended file system ext 2;
the partitions of the second-generation extended file system ext2 comprise a boot block and 10 block groups, and the storage medium of each block group is NAND Flash;
each block group consists of a super block, a group descriptor, a data block bitmap, an index node table and a data block, wherein the content corresponding to the data block is file data.
7. The NAND Flash garbage collection system of claim 5, further comprising:
and the file deleting action executing module is used for executing normal file deleting action when the erasing command is a common erasing command.
8. The NAND Flash garbage collection system of claim 5, wherein the first judgment module specifically comprises:
the erasing address obtaining module is used for obtaining an erasing address corresponding to the erasing command;
a third judging module, configured to judge whether the erasure address is an index node bitmap area, and if the erasure address is the index node bitmap area;
the first judging module is used for judging that the erasing command is a quick erasing command when the third judging module judges that the erasing address is an index node bitmap area;
and the second judging module is used for judging that the erasing command is a general erasing command when the third judging module judges that the erasing address is not the index node bitmap area.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810670318.9A CN109086001B (en) | 2018-06-26 | 2018-06-26 | NAND Flash garbage recovery method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810670318.9A CN109086001B (en) | 2018-06-26 | 2018-06-26 | NAND Flash garbage recovery method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109086001A CN109086001A (en) | 2018-12-25 |
CN109086001B true CN109086001B (en) | 2021-07-27 |
Family
ID=64839791
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810670318.9A Active CN109086001B (en) | 2018-06-26 | 2018-06-26 | NAND Flash garbage recovery method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109086001B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111930517B (en) * | 2020-09-18 | 2023-07-14 | 北京中科立维科技有限公司 | High-performance self-adaptive garbage collection method and computer system |
CN114942908B (en) * | 2022-07-19 | 2023-01-17 | 阿里巴巴(中国)有限公司 | Index system, data processing method, electronic device, and medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101562045A (en) * | 2009-06-02 | 2009-10-21 | 成都市华为赛门铁克科技有限公司 | Data erasing method and device and solid-state disk thereof |
CN105426408A (en) * | 2015-11-02 | 2016-03-23 | 北京锐安科技有限公司 | Multi-index data processing method and apparatus |
CN105511981A (en) * | 2015-11-24 | 2016-04-20 | 上海斐讯数据通信技术有限公司 | Method for rapidly detecting NAND Flash memory |
CN106775448A (en) * | 2016-11-15 | 2017-05-31 | 航天信息股份有限公司 | The file memory method and safety deleting method of a kind of encrypted card |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100501868C (en) * | 2006-03-02 | 2009-06-17 | 浙江大学 | Method for realizing memory file system based on NAND Flash |
CN102511044B (en) * | 2011-09-06 | 2013-10-02 | 华为技术有限公司 | Method for deleting the data and device thereof |
KR101779174B1 (en) * | 2016-05-26 | 2017-09-18 | 성균관대학교산학협력단 | Data discard method for journaling filesystem and memory management apparatus thereof |
US10304551B2 (en) * | 2016-06-27 | 2019-05-28 | Sandisk Technologies Llc | Erase speed based word line control |
-
2018
- 2018-06-26 CN CN201810670318.9A patent/CN109086001B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101562045A (en) * | 2009-06-02 | 2009-10-21 | 成都市华为赛门铁克科技有限公司 | Data erasing method and device and solid-state disk thereof |
CN105426408A (en) * | 2015-11-02 | 2016-03-23 | 北京锐安科技有限公司 | Multi-index data processing method and apparatus |
CN105511981A (en) * | 2015-11-24 | 2016-04-20 | 上海斐讯数据通信技术有限公司 | Method for rapidly detecting NAND Flash memory |
CN106775448A (en) * | 2016-11-15 | 2017-05-31 | 航天信息股份有限公司 | The file memory method and safety deleting method of a kind of encrypted card |
Also Published As
Publication number | Publication date |
---|---|
CN109086001A (en) | 2018-12-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106598878B (en) | Solid state disk cold and hot data separation method | |
KR101453313B1 (en) | Method for Page-level address mapping using flash memory and System thereof | |
US8037112B2 (en) | Efficient access of flash databases | |
CN107481762B (en) | Trim processing method and device of solid state disk | |
CN102541757B (en) | Write cache method, cache synchronization method and device | |
CN107391774B (en) | The rubbish recovering method of log file system based on data de-duplication | |
CN108431783B (en) | Access request processing method and device and computer system | |
CN112395212B (en) | Method and system for reducing garbage recovery and write amplification of key value separation storage system | |
CN1645516B (en) | Data recovery apparatus and method used for flash memory | |
CN109671458A (en) | The method of management flash memory module and relevant flash controller | |
CN103970669A (en) | Method for accelerating physical-to-logic address mapping of recycling operation in solid-state equipment | |
CN107092563B (en) | Garbage recovery method and device | |
CN104516959A (en) | Method and device for managing database logs | |
CN110968269A (en) | SCM and SSD-based key value storage system and read-write request processing method | |
CN109086001B (en) | NAND Flash garbage recovery method and system | |
CN101452422A (en) | Chip data read-write method, corresponding apparatus and system | |
CN108431784B (en) | Access request processing method and device and computer system | |
CN109840218B (en) | Effective data management method and storage controller | |
CN108563586B (en) | Method for separating garbage recovery data and user data in solid-state disk | |
CN111984604B (en) | Method for reducing fragments of log-structured file system and flash memory storage system | |
CN102880553A (en) | Read-write method of off-chip flash file system based on micro control unit (MCU) | |
CN107430546A (en) | A kind of file updating method and storage device | |
CN111737165A (en) | Memory control method, memory storage device and memory control circuit unit | |
CN102375779B (en) | A kind of data processing method and data processing module | |
CN113010091A (en) | Method for writing data into solid state disk, and method and device for garbage collection |
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 |