CN100501868C - Method for realizing memory file system based on NAND Flash - Google Patents
Method for realizing memory file system based on NAND Flash Download PDFInfo
- Publication number
- CN100501868C CN100501868C CNB2006100496784A CN200610049678A CN100501868C CN 100501868 C CN100501868 C CN 100501868C CN B2006100496784 A CNB2006100496784 A CN B2006100496784A CN 200610049678 A CN200610049678 A CN 200610049678A CN 100501868 C CN100501868 C CN 100501868C
- Authority
- CN
- China
- Prior art keywords
- file system
- data
- flash
- flash file
- block
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 14
- 239000010813 municipal solid waste Substances 0.000 claims abstract description 17
- 238000011084 recovery Methods 0.000 claims abstract description 6
- 238000004140 cleaning Methods 0.000 claims description 7
- 238000013507 mapping Methods 0.000 claims description 5
- 238000003860 storage Methods 0.000 description 6
- 230000003139 buffering effect Effects 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 4
- 230000009172 bursting Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000007726 management method Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 241001269238 Data Species 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000002035 prolonged effect Effects 0.000 description 1
- 238000004064 recycling Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000026676 system process Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Landscapes
- Memory System (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
This invention discloses a realization method based on NAND Flash memory file system, which sets up a control block index of the NAND Flash memory file system to be used to carry out block distribution and rubbish data recovery in the way of chained list and reads and writes data in burst mode input and output and the rubbish block recovery system is used in recovering blocks not containing effective data any more, which can reduce the loading time obviously.
Description
Technical field
The present invention relates to the embedded system field of filesystems, relate in particular to a kind of implementation method based on NAND Flash memory file system.
Background technology
The Flash storer is a kind of rapidly storer of development in recent years, belongs to Nonvolatile memory.It has the advantages that the EEPROM electricity is wiped, but also has low-power consumption, density height, volume is little, reliability is high, can wipe, can rewrite advantages such as overprogram.The Flash storer also has some shortcomings, and this comprises limited erasable, and any Flash device carries out must elder generation's execution wiping before the write operation.The Flash memory mainly contains NAND and NOR two classes.NAND Flash is the unit read-write with the piece, and it is very simple to carry out erase operation; NOR then is the unit read-write with the byte, requires before wiping, and positions all in the object block all will be written as 0 earlier.Be that piece with 64~128KB carries out when wiping the NOR device, the time of carrying out a write/erase operation is 1~5s; The piece of wiping the NAND device and being with 8~32KB carries out, and carrying out identical operations at most only needs 4ms.When execution was wiped, different nearly step of piece size had widened the performance gap between NOR and the NAND.Therefore, say that traditional file system is applied to the Flash storer, must improve.Generally speaking, all realize, but use FTL need pay patent fee by FTL.
That at present, the use of the file system of basic Flash storer is more is JFFS2 and YAFFS.It is to need between the whole memory block of scanning for a memory that capacity is very big, to exist long problem of loading time to seek index node and file control block that JFFS2 and YAFFS start; Both are also bigger to the consumption of internal memory.
Summary of the invention
The object of the present invention is to provide a kind of implementation method based on NAND Flash memory file system.
The technical scheme that the present invention solves its technical matters employing is as follows:
1) Flash File System loads
The loading of Flash File System is begun by the guiding of Flash File System controll block FlashFSCB, find newest F lashFSCB from the FlashFSCB data interval, carry out the loading of file system, the initialization files system data, start the garbage-cleaning kernel thread, thereby finish initial work;
2) the Flash File System piece distributes and the associated data assembly
Flash File System uses a kind of data with association, promptly a plurality of of the content of same file composition, assembles the space allocation policy in one section continuous zone in the same independent erase unit;
3) Flash File System rubbish block reclaims
Flash File System rubbish block reclaims from copying all valid data pieces in the pre-erase unit to another new erase unit that is called as buanch unit, upgrades the piece mapping table then and wipes this waste and old pre-erase unit again;
4) the Flash File System mistake is recovered
Flash File System uses the method for " write afterwards earlier and wipe " to carry out the mistake recovery, when upgrading sectors of data of Flash, only after the data check success that the renewal operation is finished and newly stored, previous data just can be allowed to wipe, if it is effective to operate successfully new sectors of data, otherwise old sectors of data is effective.
The present invention compares with background technology, and the useful effect that has is:
The present invention is a kind of realization based on NAND Flash memory file system, and its major function is by setting up file system control block FlashFSCB index in the interval beginning of NAND Flash zone, improving the file system rate of loading; To the management of idle block and dirty data block link list, and the scheduling kernel thread carries out garbage-cleaning, realizes evenly erasable between storage portions; Realize bursting input and output, reduced power consumption.This document system is managing mass NAND Flash storer effectively, and realizes starting fast, is applicable to various high capacity mobile data storages and multimedia embedded device.
(1) accelerates the Flash File System rate of loading.The present invention sets up file system control block FlashFSCB index in the interval beginning of NAND Flash zone, by pointing to the pointer in superblock interval in the index area, find superblock, carry out loading, the initialization of file system, need not scan entire flash storage space, speed advantage obviously has certain real-time.
(2) Flash File System is evenly erasable.The Flash storer can not unlimitedly be reused, and the present invention uses all storage unit by balance, to the application that circulates of whole interval, and does not allow a certain unit excessively use, and has realized even erasablely, has prolonged serviceable life of NAND Flash.
(3) reduce memory consumption.The present invention visits Flash from a little memory window, can reduce by the associated data of having assembled and to call mapping physical piece number of times to this window, accelerate file and continue access speed, can reduce the generation of rubbish block, therefore reduced use internal memory.
(4) reduce the Flash File System power consumption.All visits to file data all indirectly by the SRam buffering, during the access file data, according to the index node indication, are read in the SRAM buffering with corresponding page or leaf, and then are carried out read and write access.When needing to revise data, revise the corresponding SRAM buffering page or leaf of page or leaf, the data write-back adopts the time-delay writing technology, when abandoning the memory buffer page or leaf, writes the Flash page or leaf again.This bursting I/O visit can effectively reduce power consumption.
Description of drawings
Fig. 1 is the file system process flow diagram;
Fig. 2 is the file system initialization process flow diagram;
Fig. 3 is free block allocation flow figure;
Fig. 4 is rubbish block recovery process figure;
Fig. 5 is the file data error-detecting and recovers process flow diagram.
Embodiment
Concrete use based on NAND Flash memory file system is as follows.
1) Flash File System loads
In Fig. 1, the realization of this document system is by file system initialization, read/write file data, data block is handled, and four parts of garbage reclamation, because fault processing is distributed in the middle of the whole process, therefore 4) the Flash File System mistake describes in recovering.
In Fig. 2, the loading of Flash File System is begun by the guiding of Flash File System controll block FlashFSCB, FlashFSCB is a data structure that resides between certain Flash memory field and indicate the operating position of Flash File System on this interval, comprise between index node, catalogue, file, free zone and distributing and dirty data interval and garbage-cleaning information, file system datas such as various index nodes, catalogue, file are carried out OO management method; Start the refuse collection kernel thread.
Begin areal structure Flash File System controll block index area in the interval, the inside is deposited and is pointed to the pointer of depositing the FlashFSCB data interval, when loading, file system determines valid pointer by the size that compares pointer Version territory, and then by comparing the Version territory of FlashFSCB, find newest F lashFSCB from the FlashFSCB data interval, carry out the loading of file system, the initialization index node table, file table and bibliographic structure, start the garbage-cleaning kernel thread, thereby finish initial work, owing to avoided needing to scan whole interval in the classic method by index search FlashFSCB controll block, obviously shortened initialization time to determine the way of file system directories structure.
2) the Flash File System piece distributes and the associated data assembly
In Fig. 3, occurring between the free zone after the request for allocation, at first check the active area block pointer settled before block whether can meet the demands, if can meet the demands, revise current block pointer data information, permit distributing; If can not meet the demands, check whether arrive free zone block pointer head, if arrive, then start the garbage-cleaning thread, carry out garbage-cleaning work, otherwise, then pointer is turned to next free block.
Flash File System uses a kind of space allocation policy: with the data of association, it is a plurality of that the content of same file is formed, assemble in one section continuous zone in the same independent erase unit, Flash File System is kept a storage pool of being made up of a plurality of physically continuous pieces freely as far as possible in same erase unit, if continuous like this storage pool can't be realized, Flash File System can guarantee as far as possible that all pieces in the pond are in same erase unit, if the also impossible words of such situation, Flash File System can be tried one's best the piece pond is assigned in the erase unit that has maximum free spaces, and is evenly erasable to realize.
3) Flash File System rubbish block reclaims
In Fig. 4, at first Flash File System rubbish block reclaims definite rubbish block that will reclaim, and judges whether it contains data effectively, if block does not comprise valid data, and then direct erasable block; If comprised valid data in the target block, data are write other block, carry out data check simultaneously, the words that the result is correct, from copying all valid data pieces in the pre-erase unit to another new erase unit that is called as buanch unit, upgrade the piece mapping table then and wipe this waste and old pre-erase unit again, like this, though these data have left other space of Flash storer now in, still comprise original data when piece originally appears at the external world, otherwise carried out error handling processing.At last all idle blocks are hung into free block tabulation.
In Flash File System inside, the rubbish block reclaims just and just can trigger when block-distributing algorithm needs, block-distributing algorithm remains on as far as possible one section continuous free piece pond in the same erase unit, the if block pond becomes too little, block-distributing algorithm will adopt rubbish block recovery algorithm to carry out the rubbish block at once and reclaim, algorithm will find and reclaim and the most identical erase unit of following standard then: useless piece is maximum, the minimum or the most static zone of erase cycle data;
In addition, the rubbish block reclaims algorithm also can adopt the disposal route of selecting at random, can cover whole storage space equably to guarantee recycling, and can not use the mode of data and deviation owing to application program;
4) the Flash File System mistake is recovered
In Fig. 5, when response file system write request, the rubbish block is between payback period even in format or when wiping Flash, may make mistakes to the Flash write data, in this case, Flash File System can recover from mistake.
Flash File System uses the method for " write afterwards earlier and wipe ", if mistake in operating process, occurred, when upgrading sectors of data of Flash, only after the data check success that the renewal operation is finished and newly stored, previous data just can be allowed to wipe, it is effective to operate the successful new sectors of data of words, otherwise old sectors of data is effective, Flash File System can only not be placed on critical map information among the RAM simultaneously, if run into the situation that power down or Flash medium are removed when upgrading map information, map information originally still is available, when power up or Flash reconnect, Flash File System can use the information that leaves on the Flash to rebuild or the resident version of RAM of verification Flash mapping table.All visits to file data all cushion indirectly, during the access file data, according to the index node indication, corresponding page or leaf is read in the SRAM buffering, and then carry out read and write access.When needing to revise data, revise the corresponding SRAM buffering page or leaf of page or leaf, the data write-back adopts the time-delay writing technology, after finding correct data, abandons the memory buffer page or leaf, writes the Flash page or leaf.This bursting I/O visit can effectively reduce power consumption.
Claims (1)
1. implementation method based on NAND Flash memory file system is characterized in that:
1) Flash File System loads
The loading of Flash File System is begun by the guiding of Flash File System controll block FlashFSCB, find newest F lashFSCB from the FlashFSCB data interval, carry out the loading of file system, the initialization files system data, start the garbage-cleaning kernel thread, thereby finish initial work;
2) the Flash File System piece distributes and the associated data assembly
Flash File System uses a kind of data with association, promptly a plurality of of the content of same file composition, assembles the space allocation policy in one section continuous zone in the same independent erase unit;
3) Flash File System rubbish block reclaims
Flash File System rubbish block reclaims from copying all valid data pieces in the pre-erase unit to another new erase unit that is called as buanch unit, upgrades the piece mapping table then and wipes pre-erase unit again;
4) the Flash File System mistake is recovered
Flash File System uses the method for " write afterwards earlier and wipe " to carry out the mistake recovery, when upgrading sectors of data of Flash, only after the data check success that the renewal operation is finished and newly stored, previous data just can be allowed to wipe, if it is effective to operate successfully new sectors of data, otherwise old sectors of data is effective.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2006100496784A CN100501868C (en) | 2006-03-02 | 2006-03-02 | Method for realizing memory file system based on NAND Flash |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2006100496784A CN100501868C (en) | 2006-03-02 | 2006-03-02 | Method for realizing memory file system based on NAND Flash |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1822230A CN1822230A (en) | 2006-08-23 |
CN100501868C true CN100501868C (en) | 2009-06-17 |
Family
ID=36923468
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2006100496784A Expired - Fee Related CN100501868C (en) | 2006-03-02 | 2006-03-02 | Method for realizing memory file system based on NAND Flash |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100501868C (en) |
Families Citing this family (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100449549C (en) * | 2007-09-30 | 2009-01-07 | 浙江大学 | Method for building file systems on NAND flash memory in embedded system |
CN101436431B (en) * | 2007-11-14 | 2013-01-02 | 深圳市朗科科技股份有限公司 | Data storage method of flash memory medium |
CN102004697B (en) * | 2010-10-21 | 2012-09-19 | 北京握奇数据系统有限公司 | Flash recovery method and device |
CN102880553B (en) * | 2012-09-18 | 2015-09-16 | 武汉虹信通信技术有限责任公司 | The reading/writing method of the outer FLASH file system of a kind of sheet based on MCU |
CN102981965A (en) * | 2012-11-07 | 2013-03-20 | 江苏乐买到网络科技有限公司 | NAND FLASH file system |
CN103577574B (en) * | 2013-11-05 | 2017-02-08 | 中船重工(武汉)凌久电子有限责任公司 | High-reliability linear file system based on nand flash |
CN103593219B (en) * | 2013-11-27 | 2016-08-17 | 中国航空工业集团公司第六三一研究所 | A kind of quick start method of the highly reliable file system for NAND FLASH device |
CN104778099B (en) * | 2015-04-16 | 2017-09-22 | 北京工业大学 | A kind of damaged file reconstructing methods of the YAFFS2 based on old version |
CN108874298B (en) * | 2017-05-15 | 2021-08-03 | 深圳市奇辉电气有限公司 | Data storage method and device |
CN109086001B (en) * | 2018-06-26 | 2021-07-27 | 郑州云海信息技术有限公司 | NAND Flash garbage recovery method and system |
CN110471764A (en) * | 2019-08-01 | 2019-11-19 | 郑州阿帕斯科技有限公司 | A kind of processing method and processing device of memory cleaning |
CN113094107B (en) * | 2021-03-18 | 2023-12-22 | 深圳市塞防科技有限公司 | Data protection method, device, equipment and computer storage medium |
CN114840450B (en) * | 2022-07-04 | 2022-11-18 | 荣耀终端有限公司 | Storage space arrangement method and electronic equipment |
CN115328922B (en) * | 2022-10-10 | 2022-12-30 | 北京紫光芯能科技有限公司 | Data management method, device and system for one-way linked list |
-
2006
- 2006-03-02 CN CNB2006100496784A patent/CN100501868C/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN1822230A (en) | 2006-08-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100501868C (en) | Method for realizing memory file system based on NAND Flash | |
US8612719B2 (en) | Methods for optimizing data movement in solid state devices | |
CN100435116C (en) | Non-volatile memory and method with memory planes alignment | |
CN100470506C (en) | Flash memory management based on sector access | |
CN101169751B (en) | System with flash memory device and data recovery method thereof | |
KR100849221B1 (en) | Method for managing non-volatile memory, and memory-based apparatus including the non-volatile memory | |
CN102298555B (en) | Based on the modularization flash management system of NAND technology | |
CN100565477C (en) | A kind of dynamic management approach of NAND Flash storer | |
CN100449549C (en) | Method for building file systems on NAND flash memory in embedded system | |
US8214578B2 (en) | Method of storing data into flash memory according to usage patterns of addresses and data storage system using the same | |
JP2005242897A (en) | Flash disk drive | |
CN111708713B (en) | Intelligent garbage recycling and scheduling method for solid state disk | |
CN100533408C (en) | Flashmemory safety read-write method | |
CN101673245A (en) | Information processing device including memory management device and memory management method | |
CN101382918A (en) | NAND flash memory optimizing and managing method based on data interchange zone | |
CN110362499B (en) | Electronic machine and control method thereof, computer system and control method thereof, and control method of host | |
KR20090012821A (en) | Method and apparatus for controlling i/o to optimize flash memory | |
CN110531927B (en) | Garbage collection method based on block classification and nonvolatile storage device | |
US20100318726A1 (en) | Memory system and memory system managing method | |
CN110309077B (en) | Method and device for constructing flash translation layer of cooperative work of host and equipment | |
CN109669889B (en) | Light Nor Flash control method and device | |
CN101464836B (en) | Data memory method for flash memory device | |
US20170017405A1 (en) | Systems and methods for improving flash-oriented file system garbage collection | |
JP2009205689A (en) | Flash disk device | |
CN114297092A (en) | Data processing method, system, device, storage system and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C17 | Cessation of patent right | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20090617 Termination date: 20120302 |