CN102622431A - Stream-oriented file system based on flash and method for reading and writing files - Google Patents

Stream-oriented file system based on flash and method for reading and writing files Download PDF

Info

Publication number
CN102622431A
CN102622431A CN2012100473345A CN201210047334A CN102622431A CN 102622431 A CN102622431 A CN 102622431A CN 2012100473345 A CN2012100473345 A CN 2012100473345A CN 201210047334 A CN201210047334 A CN 201210047334A CN 102622431 A CN102622431 A CN 102622431A
Authority
CN
China
Prior art keywords
data
bunch
file
flash
stream
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012100473345A
Other languages
Chinese (zh)
Other versions
CN102622431B (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.)
Fujian Landi Commercial Equipment Co Ltd
Original Assignee
Fujian Landi Commercial Equipment 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 Fujian Landi Commercial Equipment Co Ltd filed Critical Fujian Landi Commercial Equipment Co Ltd
Priority to CN201210047334.5A priority Critical patent/CN102622431B/en
Publication of CN102622431A publication Critical patent/CN102622431A/en
Application granted granted Critical
Publication of CN102622431B publication Critical patent/CN102622431B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a stream-oriented file system based on flash and a method for reading and writing files. The stream-oriented file system based on flash comprises that the flash is divided into a plurality of storage units. The storage unit is divided into a system cluster and a data cluster. The system cluster is used for storing logs, backups, file catalogue lists and file distribution tables. The data cluster is used for storing data. Therefore, reading and writing of the files can be conducted by first looking through cluster head information of each cluster and then obtaining types and space using conditions of each cluster. Cost time is less due to the fact that only information of cluster head portion is read. Information such as beginning cluster, size, modifying time and storage distribution condition of the files can be obtained by reading the system cluster, so that matched clusters can be found more effectively, and then reading and writing can be conducted on the files. Simultaneously, free clusters can be effectively distributed due to the fact that space using condition of each cluster can be obtained, and management of the storage space is more effective.

Description

Stream-oriented file system and file based on flash read the method that writes
Technical field
The present invention relates to a kind of stream-oriented file system field, relate in particular to a kind of stream-oriented file system and method that reads or write based on the file of this system based on flash.
Background technology
Along with various cards are applied in the consumer sale, pos also is widely used in all kinds of businessmans.Usually the pos machine all need be stored all kinds of transaction data, and such as information such as transaction merchant, place, time, type of transaction, card numbers, original pos only need provide these flowing water data of file system record of recording just can satisfy the demands.But along with the variation of pos application form, the pos machine is not only wanted store transaction flowing water data, also will store other forms of data, such as the interface data of user individual, font, figure, or various script datas.So, the file system of original recording can not satisfy growing user's request.Therefore a kind of simple, easy-to-use, transplantability strong, just ready to appear to the low stream-oriented file system of hardware requirement.
At present available stream-oriented file system has often, such as the most frequently used file system such as jffs2, yaffs, ext, fat, ntfs is arranged.
(1) jffs2 (Journaling Flash File System, flash log type file system the 2nd edition), its function is exactly the log type file system that management realizes on MTD equipment.Except the log-structured file system with outage reliability is provided, jffs2 also can realize characteristics such as abrasion equilibration and data compression on the MTD equipment of its management.The weak point of Jffs2: (a) need this powerful operating system support of similar linux, (b) flash memory is scanned from the beginning to the end during carry, speed is slow, and needs a large amount of internal memories.
(2) yaffs (Yet Another Flash File System): first is the embedded file system of NAND Flash reservoir designs specially; Be applicable to jumbo memory device; Yaffs is based on the file system of daily record; The characteristic of abrasion equilibration and power loss recovery is provided, is mainly used among linux and the wince.
(3) ext (extended file system): be the original extended file system of developing for linux specially.
(4) fat (based on file allocation table file system): be applied to disk usually, on the jumbo storage medium such as USB flash disk.Its main thought is on storage medium, to mark the information and the file allocation table (File Allocation Table, FAT table) of fixing regional record file system, to reach the purpose in managed storage space.The normal medium of FAT file system that uses all has controller, and controller can also be realized the abrasion equilibration of physical medium except realizing the normal access physical storage medium.Be not suitable for direct visit flash equipment.
(5) ntfs (New Technology File System): the disk file system that is based on windows operating system.
File system commonly used at present needs powerful operating system support usually, and the memory source that needs is bigger, even some file system is not supported flash equipment.The problem that the present invention will solve is: develop a kind of file system and support norflash and nandflash simultaneously; And need not the operating system support; Can be at the operating system such as the nucleus of no operating system or lightweight, uclinux is last moves, and has the special-purpose stream-oriented file system of pos machine of abrasion equilibration.
Summary of the invention
The present invention provides a kind of stream-oriented file system based on flash, can solve and not support flash equipment in the prior art, the technical matters that transplantability is not high, high to hardware requirement.
For solving the problems of the technologies described above, the present invention provides a kind of stream-oriented file system based on flash, and flash is divided a plurality of storage unit, and the classification of said storage unit is system bunch or aggregate of data; System bunch is used for storing daily record, backup, FDT, file allocation table; Aggregate of data is used to store data.
For solving the problems of the technologies described above, it is a kind of to the method that reads file based on the stream-oriented file system of flash that the present invention also provides, and comprising:
S1: travel through bunch header of each bunch among the flash, obtain the type and the space behaviour in service of each bunch;
S2: obtain system bunch,, obtain the canned data of file according to FDT and the file allocation table in the system bunch;
S3: the canned data according to file, read file data.
Wherein, the canned data of the file of said step S2 comprises file name, file allocation situation.
For solving the problems of the technologies described above, it is a kind of to the method that writes file based on the stream-oriented file system of flash that the present invention also provides, and comprising:
S1: travel through bunch header of each bunch among the flash, obtain the type and the space behaviour in service of each bunch;
S2: obtain system bunch,, obtain the information of the required aggregate of data that writes, judge whether said aggregate of data is empty, if write data according to the file allocation table in the system bunch; If not, forward S3 to;
S3: idle data of Random assignment bunch writes data.
Wherein, Among the said step S3, said data comprise useful data A and the newly-increased data B in old bunch, and the method for said write data is; Obtain data A and data B; Abandon the aggregate of data that comprises data A, data A and data B are write the idle data bunch of Random assignment, updating file allocation table together.
Adopt technique scheme, the invention has the beneficial effects as follows:, just can travel through bunch header of each bunch earlier to the read-write of file because flash is divided system bunch and aggregate of data; Obtain the type and the space operating position of each bunch, owing to only read a bunch header information, therefore the time of cost is few; The present invention provides independently file operation interface; Use less internal memory, therefore do not need powerful operating system support; Through to the reading of system bunch, just can obtain information such as starting cluster, size, modification time and file storage distribution situation like file, like this, can more efficiently find coupling bunch, again file is read and write; Simultaneously owing to known the space operating position of each bunch, just can these free time of Random assignment bunch, make the balance that file system acquires a certain degree to the frequency of utilization degree of each bunch, thus more efficient to the management of storage space.
Description of drawings
Fig. 1 is the synoptic diagram of the stream-oriented file system based on flash provided by the invention;
Fig. 2 is the system initialization synoptic diagram of the stream-oriented file system based on flash provided by the invention;
Fig. 3 is for provided by the invention to the process flow diagram that reads the method for file based on the stream-oriented file system of flash;
Fig. 4 is for provided by the invention to the process flow diagram that writes the method for file based on the stream-oriented file system of flash.
Embodiment
By specifying technology contents of the present invention, structural attitude, realized purpose and effect, give explanation below in conjunction with embodiment and conjunction with figs. are detailed.
See also Fig. 1, the present invention provides a kind of stream-oriented file system based on flash, it is characterized in that flash is divided a plurality of storage unit, and said storage unit comprises system bunch and aggregate of data; System bunch is used for storing daily record, backup, FDT, file allocation table;
The present invention provides independently file operation interface, uses less internal memory, does not therefore need powerful operating system support.
So-called FDT is FDT (File Directory Table), and file allocation table is FAT (File Allocation Table).Aggregate of data is used to store data.So-called bunch is the least unit in the flash space that can in a flash, can distribute, bunch size depend on size and the form of flash.If write the size of file surpass flash bunch size; This file will be crossed over a plurality of bunches (sometimes as bunch of chains), and for example, certain file can occupy 0,2,4, No. 8 bunch; And flash be limited to use fixed number bunch; So bunch size variation to depend on the capacity of subregion, it is more little that subregion is done, bunch size just more little.Bunch size more little, the space of waste is just few more when bunch being used.
Therefore, the present invention is divided into a plurality of bunches with storage area, can effectively utilize the flash space.
See also Fig. 2 and Fig. 3, it is a kind of to the method that reads file based on the stream-oriented file system of flash that the present invention also provides, and comprising:
S1: when system start-up, file system just travels through bunch header of each bunch among the flash, obtains the type and the space behaviour in service of each bunch; Owing to only read a bunch header information, therefore the time less of cost.
S2: obtain system bunch; According to FDT and the file allocation table in the system bunch, obtain the canned data of file, specifically refer to; According to the corresponding FDT record of FDT table inquiry this document; According to first bunch number of the FDT record, search the corresponding FAT record of this document from the FAT table again, obtain important informations such as file storing space distribution situation, file size.
S3: the canned data according to file, read file data.
Adopt this method, owing to divide system bunch and aggregate of data at flash, bunch header of each bunch of traversal obtains the type and the space operating position of each bunch earlier, owing to only read a bunch header information, therefore the time of cost is few; Through to the reading of system bunch, just can obtain information such as starting cluster, size, modification time and file storage distribution situation like file, like this, can more efficiently find required read bunch, again file is read.
See also Fig. 4, it is a kind of to the method that writes file based on the stream-oriented file system of flash that the present invention also provides, and comprising:
S1: travel through bunch header of each bunch among the flash, obtain the type and the space behaviour in service of each bunch;
S2: obtain system bunch,, obtain the information of the required aggregate of data that writes, judge whether said aggregate of data is empty, if write data according to the file allocation table in the system bunch; If not, forward S3 to;
S3: idle data of Random assignment bunch writes data.Wherein, Among the said step S3, said data comprise useful data A and the newly-increased data B in old bunch, and the method for said write data is; Obtain data A and data B; Abandon the aggregate of data that comprises data A, data A and data B are write the idle data bunch of Random assignment, updating file allocation table together.Through such processing; Just can prevent that data from repeating to write, the legacy data in can in time clearing up simultaneously bunch, and adopted the principle of Random assignment free cluster; Make file system to the balance that the frequency of utilization of each bunch acquires a certain degree, played the effect of abrasion equilibration.
The above is merely embodiments of the invention; Be not so limit claim of the present invention; Every equivalent structure or equivalent flow process conversion that utilizes instructions of the present invention and accompanying drawing content to be done; Or directly or indirectly be used in other relevant technical fields, all in like manner be included in the scope of patent protection of the present invention.

Claims (5)

1. stream-oriented file system based on flash is characterized in that: flash is divided a plurality of storage unit, and said storage unit classification is system bunch or aggregate of data;
System bunch is used for storing daily record, backup, FDT, file allocation table;
Aggregate of data is used to store data.
2. one kind to the method that reads file based on the stream-oriented file system of flash, it is characterized in that, comprising:
S1: travel through bunch header of each bunch among the flash, obtain the type and the space behaviour in service of each bunch;
S2: obtain system bunch,, obtain the canned data of file according to FDT and the file allocation table in the system bunch;
S3: the canned data according to file, read file data.
3. according to claim 2 to the method that reads file based on the stream-oriented file system of flash, it is characterized in that: the canned data of the file of said step S2 comprises file name, file allocation situation.
4. one kind to the method that writes file based on the stream-oriented file system of flash, it is characterized in that, comprising:
S1: travel through bunch header of each bunch among the flash, obtain the type and the space behaviour in service of each bunch;
S2: obtain system bunch,, obtain the information of the required aggregate of data that writes, judge whether said aggregate of data is empty, if write data according to the file allocation table in the system bunch; If not, forward S3 to;
S3: idle data of Random assignment bunch writes data.
5. according to claim 4 to the method that writes file based on the stream-oriented file system of flash; It is characterized in that: among the said step S3, said data comprise useful data A and the newly-increased data B in old bunch, and the method for said write data is; Obtain data A and data B; Abandon the aggregate of data that comprises data A, data A and data B are write the idle data bunch of Random assignment, updating file allocation table together.
CN201210047334.5A 2012-02-27 2012-02-27 Stream-oriented file system based on flash and method for reading and writing files Active CN102622431B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210047334.5A CN102622431B (en) 2012-02-27 2012-02-27 Stream-oriented file system based on flash and method for reading and writing files

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210047334.5A CN102622431B (en) 2012-02-27 2012-02-27 Stream-oriented file system based on flash and method for reading and writing files

Publications (2)

Publication Number Publication Date
CN102622431A true CN102622431A (en) 2012-08-01
CN102622431B CN102622431B (en) 2014-04-16

Family

ID=46562350

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210047334.5A Active CN102622431B (en) 2012-02-27 2012-02-27 Stream-oriented file system based on flash and method for reading and writing files

Country Status (1)

Country Link
CN (1) CN102622431B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109326307A (en) * 2018-09-07 2019-02-12 江苏菲利斯通信息科技有限公司 CD streaming carving method
CN111367474A (en) * 2020-03-02 2020-07-03 湖南师范大学 Embedded memory oriented FAT file system post-allocation method and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1273392A (en) * 1999-05-07 2000-11-15 英业达集团(南京)电子技术有限公司 Structure and operation method of flash memory
CN101013397A (en) * 2007-02-08 2007-08-08 深圳万利达电子工业有限公司 Method for implementing nandflsh file system
CN102142032A (en) * 2011-03-28 2011-08-03 中国人民解放军国防科学技术大学 Method and system for reading and writing data of distributed file system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1273392A (en) * 1999-05-07 2000-11-15 英业达集团(南京)电子技术有限公司 Structure and operation method of flash memory
CN101013397A (en) * 2007-02-08 2007-08-08 深圳万利达电子工业有限公司 Method for implementing nandflsh file system
CN102142032A (en) * 2011-03-28 2011-08-03 中国人民解放军国防科学技术大学 Method and system for reading and writing data of distributed file system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109326307A (en) * 2018-09-07 2019-02-12 江苏菲利斯通信息科技有限公司 CD streaming carving method
CN109326307B (en) * 2018-09-07 2020-12-11 江苏菲利斯通信息科技有限公司 Optical disk stream recording method
CN111367474A (en) * 2020-03-02 2020-07-03 湖南师范大学 Embedded memory oriented FAT file system post-allocation method and system
CN111367474B (en) * 2020-03-02 2021-03-02 湖南师范大学 Embedded memory oriented FAT file system post-allocation method and system

Also Published As

Publication number Publication date
CN102622431B (en) 2014-04-16

Similar Documents

Publication Publication Date Title
CN101241472B (en) Mapping management process and system
CN101571869B (en) File memory and read method of smart card and device thereof
CN101968795B (en) Cache method for file system with changeable data block length
WO2016086819A1 (en) Method and apparatus for writing data into shingled magnetic record smr hard disk
CN101777017B (en) Rapid recovery method of continuous data protection system
CN101645043B (en) Methods for reading and writing data and memory device
CN106445405B (en) Data access method and device for flash memory storage
CN102662856A (en) Solid state disk and access method
CN102467455A (en) Memory system, data storage device, user device and data management method thereof
CN102301349A (en) Database operation-aware striping technique
CN103902669A (en) Separating type file system based on different storage media
CN103608866A (en) Data wiping method and device for flash memory
CN103150258A (en) Writing, reading and garbage collection method of solid-state memory system
CN101510332B (en) Method and apparatus for managing memory space of smart card
CN101320594A (en) Physical operation method of flash memory chip
CN108628542B (en) File merging method and controller
CN102043687A (en) Copy on first write device for realizing data snapshot and control method
CN101702139A (en) Method and device for accessing data of Nand flash memory
CN102135943A (en) Storing and accessing method of flash memory data and device thereof
CN104376099A (en) Flash-memory-based file system implementation method and device
CN102981975A (en) Management method of flash data and system thereof
CN101441596B (en) Method for improving flash memory medium read-write speed
CN102622431B (en) Stream-oriented file system based on flash and method for reading and writing files
CN101763426B (en) Method and device for realizing reliability of file allocation table file system
CN103309619A (en) NAND Flash memory data storage method

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