CN109697019A - The method and system of data write-in based on FAT file system - Google Patents

The method and system of data write-in based on FAT file system Download PDF

Info

Publication number
CN109697019A
CN109697019A CN201710984493.0A CN201710984493A CN109697019A CN 109697019 A CN109697019 A CN 109697019A CN 201710984493 A CN201710984493 A CN 201710984493A CN 109697019 A CN109697019 A CN 109697019A
Authority
CN
China
Prior art keywords
data
fat
table item
written
fat table
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
CN201710984493.0A
Other languages
Chinese (zh)
Other versions
CN109697019B (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710984493.0A priority Critical patent/CN109697019B/en
Publication of CN109697019A publication Critical patent/CN109697019A/en
Application granted granted Critical
Publication of CN109697019B publication Critical patent/CN109697019B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • G06F3/0611Improving I/O performance in relation to response time
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses the method and systems of the data write-in based on FAT file system, are related to field of computer technology.One specific embodiment of this method includes: the residual memory space in the corresponding cluster space of FAT table item occupied according to file where data to be written and the data volume of the data to be written, determines the quantity of the FAT table item for the FAT file system that need to be searched;Find out the FAT table item of the corresponding quantity, and the residual memory space is written into the data to be written and the FAT table item that finds out corresponding to cluster space.The embodiment is able to ascend the speed of write-in data, solves the problems, such as that small data quantity write-in searches FAT table item with multiple access file directory and causes file data writing speed low.

Description

The method and system of data write-in based on FAT file system
Technical field
The present invention relates to field of computer technology more particularly to a kind of methods of the data write-in based on FAT file system And system.
Background technique
In recent years, with the continuous development of embedded system, embedded device is to flexible, high speed, the data of big data quantity Storage demand is more and more.Many embedded systems, which both increase, stores the low capacities such as external SD card (safe digital card), USB flash disk The function of equipment is supported.FAT file system by its perfect in shape and function, structure is simple, is easy to the advantages of software realization, become embedding A kind of file system being widely used in embedded system.By using FAT file system, embedded device can be easily right Data in the low capacities such as FLASH, SD card, USB flash disk storage equipment are organized and managed.
In the prior art, the data manipulation of FAT file system is using cluster as basic unit, and the data volume being written every time The byte number for being included no more than a cluster space.Each write operation can only write the data of a cluster space size Enter, and the operation of data write-in every time, requires to search FAT table, according to root or file directory, search current file Then the idle FAT table item for needing to occupy corresponds to the physical address of cluster by calculating FAT table item, obtains target storage space position It sets, then carries out the read-write of file data.If still had after storing data into the corresponding cluster space of a FAT table item Remaining data then searches a FAT table item again and carries out data storage.In turn, a complete data writing process includes Multiple cluster writing process.
Realize process of the present invention in, inventor discovery at least there are the following problems in the prior art: when need be written compared with When large-data documents content, since the data volume that single cluster space can include is limited, entire data are written, need more List item in secondary read-write catalogue file and FAT table causes write operation needs to take more time, and then increases data and write The space complexity and time complexity entered.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of method and system of data write-in based on FAT file system, energy The enough speed for promoting write-in data, solution small data quantity is written and repeatedly access file directory lookup FAT table item leads to number of files According to the low problem of writing speed.
To achieve the above object, according to an aspect of an embodiment of the present invention, it provides a kind of based on FAT file system The method of data write-in.
The method of the data write-in based on FAT file system of the embodiment of the present invention includes: according to where data to be written The residual memory space in the corresponding cluster space of FAT table item that file occupies and the data volume of the data to be written, are determined The quantity of the FAT table item for the FAT file system that need to be searched;The FAT table item of the corresponding quantity is found out, and will be described to be written Enter data the residual memory space is written and the FAT table item that finds out corresponding to cluster space.
Optionally, the step of quantity of the FAT table item for determining the FAT file system that need to be searched comprise determining that The FAT table item that file where data are written occupies, and determine the remaining storage in the corresponding cluster space of FAT table item of the occupancy Space;The data volume of the data to be written is calculated, and determines the data volume and the remaining storage of the data to be written The difference in space;The quantity of the FAT table item for the FAT file system for determining to search according to the difference.
Optionally, it is idle that the process of the FAT table item for finding out the corresponding quantity, which includes: from current markers, FAT table item is inquired one by one, finds out serial number continuously idle FAT table item.
Optionally, before the quantity of the FAT table item for the FAT file system for determining to search, further includes: according to described The data volume of data to be written determines that the cluster space of storing data is sufficient.
To achieve the above object, other side according to an embodiment of the present invention provides a kind of based on FAT file system Data write-in system.
The embodiment of the present invention based on FAT file system data write-in system comprise determining that module, for according to The residual memory space in the corresponding cluster space of FAT table item that file where data are written occupies and the number of the data to be written According to amount, the quantity of the FAT table item for the FAT file system that need to be searched is determined;Lookup and writing module, for finding out corresponding institute The FAT table item institute for stating the FAT table item of quantity, and the residual memory space being written into the data to be written and is found out Corresponding cluster space.
Optionally, the determining module is also used to: the FAT table item that file where determining data to be written occupies, and really The residual memory space in the corresponding cluster space of FAT table item of the fixed occupancy;The data volume of the data to be written is calculated, and Determine the data volume of the data to be written and the difference of the residual memory space;It determines need to search according to the difference The quantity of the FAT table item of FAT file system.
Optionally, the lookup and writing module are also used to: being that idle FAT table item is inquired one by one from current markers, looked into Find out serial number continuously idle FAT table item.
Optionally, further include space abundance determining module, stored for being determined according to the data volume of the data to be written The cluster space of data is sufficient.
To achieve the above object, another aspect according to an embodiment of the present invention provides a kind of based on FAT file system Data write-in device.
The device of the data write-in based on FAT file system of the embodiment of the present invention includes: one or more processors;It deposits Storage device, for storing one or more programs, when one or more of programs are executed by one or more of processors, So that the method that one or more of processors realize any of the above-described data write-in based on FAT file system.
To achieve the above object, another aspect according to an embodiment of the present invention provides a kind of computer-readable medium, Be stored thereon with computer program, which is characterized in that realized when described program is executed by processor it is any of the above-described it is described based on The method of the data write-in of FAT file system.
One embodiment in foregoing invention has the following advantages that or the utility model has the advantages that because it is being written in total data Before, determine the quantity of the FAT table item for the FAT file system that need to be searched, and then when searching the FAT table item of the corresponding quantity, The cluster space block gone out as corresponding to continuous several FAT table item can be found out.Equipment, the big number in contiguous sector are stored for low capacity It is far faster than dispersion sector small data quantity writing speed according to amount single writing speed.So finding out by continuous several After the corresponding cluster space block out of FAT table item, the cluster space block can be write data into, reduces repeatedly access file directory and searches The time of FAT table item improves the speed of the data write-in based on FAT file system, and solving in the prior art can only be primary Find out the low problem of data write efficiency caused by a FAT table item.Also, it is disclosed by the invention to be based on FAT file system The method of data write-in do not destroy former FAT file system architecture, the feelings that compatible individual data is repeatedly written and modifies Condition can be realized file and connect write-in.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is showing for the main flow of the method for the data write-in according to an embodiment of the present invention based on FAT file system It is intended to;
Fig. 2 is showing for the preferred flow of the method for the data write-in according to an embodiment of the present invention based on FAT file system It is intended to;
Fig. 3 is showing for the main modular of the system of the data write-in according to an embodiment of the present invention based on FAT file system It is intended to;
Fig. 4 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 5 is adapted for the structural representation of the computer system for the terminal device or server of realizing the embodiment of the present invention Figure.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
BPB_BytePerSec Byte number shared by one sector
BPB_RootEntCnt The directory entry mesh number of root
BPB_FATSz32 Sector number shared by one FAT table
BPB_SecPerClust Sector number shared by one cluster
BPB_NumFATs The number of FAT table in file system
FAT file system is mainly made of BPB data structure, FAT tables of data, root, the several parts of file data. BPB is stored in first sector of FAT volume, is a part in boot sector.It wherein include some heavy of FAT file system Want parameter, such as each sector include byte number, FAT data structure size important information.FAT tables of data is to indicate cluster number A list, each FAT table item represents a cluster, and the two is one-to-one relationship.Root and file data are in FAT32 All file is taken as to treat in file system.In general, the storage location of root, when file system is formatted operation It waits, is all arranged on first sector of cluster 2.
Wherein, a kind of cluster: storage cell of data block.
Volume a: subregion in storage equipment.By taking SD card as an example, a SD card can divide multiple volumes, and each volume includes Several clusters, each cluster include several sectors, and each sector includes several bytes.
FAT32:File Allocation Table, 32 versions of one kind of FAT file system.
BPB:BIOS Parameters Block.A data structure in file system volume guide space.In structure Data indicate some important parameters information in file system.
In the prior art, when needing to be written larger data amount file content, since single cluster space can include Data volume it is limited, entire data are written, need the list item repeatedly read and write in catalogue file and FAT table, there are data write-ins Slow-footed problem.Moreover, there is low capacity storage equipment big data quantity single writing speed to be faster than dispersion sector small data quantity The data of write-in, so single cluster space write-in data can reduce the writing speed of data.For example, the size of one sector of SD card It is set as 512 bytes.When formatting SD card, a FAT32 cluster space is set as 8 sectors, i.e. 8*512 byte.Then every time When data are written, the corresponding FAT table position of file data is obtained from file directory, then inquires FAT table, obtain practical The physical address of operation, is then written data.But write-in data amount check is no more than 8*512 byte every time.
Fig. 1 is showing for the main flow of the method for the data write-in according to an embodiment of the present invention based on FAT file system It is intended to, as shown in Figure 1, the method for the data write-in based on FAT file system of the embodiment of the present invention specifically includes that
Step S101: according to the remaining storage sky in the corresponding cluster space of FAT table item that file where data to be written occupies Between and data to be written data volume, determine the quantity of the FAT table item for the FAT file system that need to be searched.Specifically, determining The FAT table item that file where data to be written occupies, and determine that the remaining storage in the corresponding cluster space of FAT table item occupied is empty Between;The data volume of data to be written is calculated, and determines the data volume of data to be written and the difference of residual memory space;According to Difference determines the quantity of the FAT table item for the FAT file system that need to be searched.The need determined search in FAT table item do not include to The FAT table item that file where data are written occupies.Wherein, due to the not necessarily entire file data of data to be written, Ke Nengxu A part in this document data, such as one word document of editor are saved, has edited and has saved 1000 words, then compiled again 300 words are collected, which needs to save.300 word is data to be written, which is file where data to be written. When being saved 300 word, judge whether word document belonging to 300 word occupies FAT table item, because of the word document 1000 words are saved, and 1000 words of the preservation do not take a cluster space, it is known that the data to be written occupy FAT List item.
If starting to write a new file, the FAT table item that this document has not occupied, the data institute to be written at this time The residual memory space in the cluster space corresponding to the FAT table item that file occupies is zero, then during write-in, not having to should Data are written to residual memory space.In addition, if file has the FAT table item occupied where data to be written, but this is accounted for The residual memory space in cluster space corresponding to FAT table item is zero, during write-in, without writing the data to The residual memory space in cluster space corresponding to the FAT table item of the occupancy.Above situation is included in the embodiment of the present invention.
Before step S101, determine that the cluster space of storing data is sufficient also according to the data volume of data to be written.If The data volume of data to be written is greater than the capacity in all cluster spaces of storing data, then illustrates that the storage equipment will cannot be somebody's turn to do completely Data storage to be written, illustrates that the cluster space of storing data is inadequate at this time.If the data volume of data to be written is less than storage The capacity in the cluster space of data then illustrates that the storage equipment can completely store the data to be written, illustrates to store number at this time According to cluster space it is sufficient, and then the data to be written be written in cluster space.
FAT file system is FAT32 file system.Wherein, FAT32 file system has 32 number of clusters, is a kind of wide The general file system for being popular in the field PC, under operating system environment, to the file data on the storage mediums such as disk into Row organization and management.FAT32 file system is an important component in FAT file system, obtained Windows, The support of the mainstream operation systems such as Linux is widely used in low capacity movable storage device.Also, apply FAT32 text The embedded equipment of part system can transmit the data of universal data format, greatly between different hardware environment, different operating system Improve the transmission efficiency of data.
Step S102: finding out the FAT table item of the corresponding quantity, and be written into data write-in residual memory space with And cluster space corresponding to the FAT table item found out.In this step, the process searched and be written is not successive.For example, it is desired to The quantity of the FAT table item of lookup is 100, then after finding out 10 continuous FAT table items, writes data into this 10 continuously FAT table item it is corresponding go out cluster space block, then proceed to search remaining 90 FAT table items, and will count during lookup According to write-in.Cluster space block cluster space corresponding to several continuous FAT table items forms, such as the 101st list item of FAT, the 102nd Three cluster spaces corresponding to list item and the 103rd list item form a cluster space block, and the 111st list item of FAT and the 112nd list item institute are right The two cluster spaces answered form cluster space block etc..In embodiments of the present invention, this 100 FAT table items can also all be looked into It finds out, wherein then writing data into the FAT found out again comprising the corresponding cluster space block out of several continuous AT list items Cluster space block corresponding to list item.It, can the corresponding cluster space out of the continuous FAT table item of one-time write 10 by the process The data that block can accommodate solve and obtain a cluster space only every time in the prior art to carry out data caused by data processing The slow problem of writing speed.
Whether during finding out the FAT table item of the corresponding quantity, it is occupied to inquire FAT table item one by one, from current It is begun looking for labeled as idle FAT table item, searches serial number continuously idle FAT table item.In turn, continuous idle FAT table item Corresponding cluster space constitutes cluster space block.In data write-in, the data volume being written every time is not only a cluster space institute The byte number for including, but the byte number that a cluster space block is included.It not only reduces retrieval root, search FAT table item Number, save the time, and since low capacity storage equipment big data quantity write-in data are faster than small data quantity writing speed Characteristic, even more substantially increase data write-in speed.
The cluster corresponding to the FAT table item that the residual memory space is written in the data to be written and is found out is empty Between after, further includes: judge whether there is remaining data to be written;If it does, according to the remaining data to be written Data volume determine the quantity of required FAT table item;The FAT table item of the corresponding quantity is found out, and will be described to be written Cluster space corresponding to the FAT table item is written in remaining data, until all data are all written into.By the process, can avoid The problem of data are omitted.
Fig. 2 is showing for the preferred flow of the method for the data write-in according to an embodiment of the present invention based on FAT file system It is intended to.
As shown in Fig. 2, the preferred flow packet of the method for the data write-in based on FAT file system of the embodiment of the present invention It includes:
Step S201: judge whether file where data to be written occupies FAT table item.If it is, carrying out step S202; Otherwise, step S205 is carried out.
Low capacity storage device format turn to FAT file system after, low capacity storage equipment write-in thread receive to Data are written, the remaining memory space of equipment is stored according to the data volume of the data to be written and the low capacity, judges little Rong Whether the amount storage remaining memory space of equipment is sufficient, carries out step S201 if sufficient, otherwise abandons carrying out data write-in. Wherein, low capacity storage equipment includes SD card, USB flash disk etc., and stores equipment, contiguous sector big data quantity mono-recordable for low capacity Entering speed is far faster than dispersion sector small data quantity writing speed.In embodiments of the present invention, it carries out by taking SD card as an example into one Walk explanation.
Step S202: the corresponding cluster space of FAT table item that file where judging data to be written occupies is with the presence or absence of residue Memory space.If so, carrying out step S203;Otherwise, step S205 is carried out.
Judge that file where current data to be written occupies FAT table item by step S201, illustrates that this is current to be written Data are continuous content, i.e., current data to be written possibly can not be written since a cluster initial position.If current to be written There are residual memory spaces in the corresponding cluster space of FAT table item that file where entering data occupies, then illustrate that the data can not be from one A cluster initial position starts to be written, to guarantee that the data are continuous, then ability after needing to store the residual memory space completely Other cluster spaces are write data into again.
Step S203: the residue in cluster space corresponding to the FAT table item that file where being written into data write-in occupies is deposited Store up space.If current data to be written cannot be written since the initial position in a cluster space, current cluster space is calculated The data volume of write-in can be continued, the data of corresponding data amount are written, then current cluster space is fully written.It can be with by the process Guarantee that file system realizes the connecting storage of data, to require since the initial position of cluster without requiring each data segment Write-in.The process does not write a full cluster just for a cluster, i.e., last write-in, and next time, write-in then needed in current cluster Clear position continues to write to.
Step S204: the remaining data not being written is judged whether there is.If it is, carrying out step S205;Otherwise, number Terminate according to writing process.It is to be written there are also data in the presence of the remaining data explanation not being written, it needs to continue the remaining data It is written.
Step S205: the quantity of required FAT table item is determined according to the data volume of current data to be written.In the step Current data to be written are the remaining data not being written that step S204 is determined.The SD card represented according to each FAT table item The data volume size of amount of physical memory size and current data to be written calculates current goal write-in data and needs what is occupied to deposit Space is stored up, to obtain the FAT table item sum that this storage needs to occupy.
The physical structure of equipment such as SD card is stored according to low capacity, FAT table item itself is also stored in one on SD It include the FAT table item of partial entry in a sector, in each sector.The prior art one FAT table item of every reading, it is necessary to from Corresponding sector contents are read in card, if SD card will repeatedly be read and write by retrieving multiple FAT table items, than relatively time-consuming.The present invention is real It applies example and reads a SD card sector, then can retrieve the FAT table item of corresponding number, and then reduce the read-write number of SD card, thus Save the time.
Step S206: finding out the FAT table item of the corresponding quantity, and current data write-in to be written is found out Cluster space corresponding to FAT table item.Specifically, finding what data currently needed to occupy according to file directory or root FAT table item, and the quantity for the FAT table item searched is the quantity that step S205 is determined.From current lookup to first free time FAT List item starts to search one by one, finds continuous idle FAT table item.If the memory space that the continuous FAT table item found represents Size stores target data enough, then occupies the idle FAT table item found, one-time write total data.If found Continuous FAT table item represent storage size be not enough to be written target complete data, then according to the big of free memory It is small, the idle FAT table item found is occupied, the file data of corresponding space size is written.Pass through the process, it is possible to reduce FAT The lookup number of list item increases the data volume of the sector block of single write-in SD card, to improve the writing speed of entire file.
If SD card is written in data A by the method for the data write-in according to an embodiment of the present invention based on FAT file system, Detailed process is as follows.Wherein, data A to be written is to connect file content, and data volume is 41472 bytes;The case where SD card Are as follows: the FAT table item that every 512 byte of sector, i.e. 4096 bytes in 8 sectors of every cluster, and file where current data A occupy is 100, 100th list item free time, 512 bytes.After confirming that current SD card capacity is sufficient, confirmation data A is that (data A needs to be written connecting content The remaining space in cluster space corresponding to the 100th list item cannot be written since the initial position in a cluster space), to FAT The data of the residual memory space write-in corresponding data amount in the corresponding cluster space of 100 list items.File occupies where data A to be written FAT table item be the residual memory space in 100 corresponding cluster spaces be 512 bytes, the data volume of data A to be written is 41472 Byte, then needing the quantity of the FAT table item for the FAT file system searched is 10.
The data that residual memory space is written are preceding 512 byte of data A to be written, remaining 40960 bytes after write-in.It can It is searched one by one list item after the 100th list item of FAT, if finding the 101st list item of FAT, the 102nd list item free time, 103 Occupied, then this data that can be written into two cluster spaces (two cluster spaces constitute a cluster space block) capacity, is written Preceding 8192 byte of remaining 40960 bytes.It since there are also data to be written, therefore is begun looking for from FAT102, finds the 104th list item It is idle (cluster space corresponding to the 104th list item to the 111st list item constitutes a cluster space block) to the 111st list item, this is idle Cluster space be required remaining space maximum value, the then remaining total data of one-time write.
The method of the data write-in based on FAT file system of the embodiment of the present invention, can before total data is written It determines the quantity of the FAT table item for the FAT file system that need to be searched, and then when searching the FAT table item of the corresponding quantity, searches The cluster space block gone out as corresponding to continuous several FAT table item out.And equipment, contiguous sector big data are stored for low capacity Amount single writing speed is far faster than dispersion sector small data quantity writing speed.So finding out by continuous several FAT After the corresponding cluster space block out of list item, the cluster space block can be write data into, reduces repeatedly access file directory and searches FAT The time of list item improves the speed of the data write-in based on FAT file system, and solving can only once search in the prior art The low problem of data write efficiency caused by a FAT table item out.Also, the number disclosed by the invention based on FAT file system It can be realized file according to the method for write-in and connect write-in, be compatible with the case where individual data is repeatedly written and modifies, meet existing FAT The rule of file system storing data, does not destroy existing FAT file system architecture, and implementation is high.
Fig. 3 is showing for the main modular of the system of the data write-in according to an embodiment of the present invention based on FAT file system It is intended to.
As shown in figure 3, the system of the data write-in based on FAT file system 300 of the embodiment of the present invention specifically includes that
Determining module 301, for the surplus of the cluster space according to corresponding to the FAT table item of file occupancy where data to be written The data volume of remaining memory space and data to be written determines the quantity of the FAT table item for the FAT file system that need to be searched.Really Cover half block 301 is also used to: the FAT table item that file where determining data to be written occupies, and determines that the FAT table item occupied is corresponding Cluster space residual memory space;The data volume of data to be written is calculated, and determines the data volume of data to be written and remains The difference of remaining memory space;The quantity of the FAT table item for the FAT file system for determining to search according to difference.
Lookup and writing module 302 for finding out the FAT table item of the corresponding quantity, and are written into data write-in Cluster space corresponding to residual memory space and the FAT table item found out.In the mistake for the FAT table item for finding out the corresponding quantity Cheng Zhong is that whether inquiry FAT table item is occupied one by one, is that idle FAT table item is begun looking for from current markers, searches serial number and connect Continuous idle FAT table item.In turn, cluster space corresponding to continuous idle FAT table item constitutes cluster space block.It is written in data When, the data volume being written every time is no longer only the byte number that a cluster space is included, but a cluster space block is included Byte number.It not only reduces retrieval root, the number of searching FAT table item, save the time, and since low capacity stores Equipment big data quantity write-in data are faster than the characteristic of small data quantity writing speed, even more substantially increase the speed of data write-in.
The embodiment of the present invention further includes space abundance determining module based on FAT file system, for according to number to be written According to data volume determine that the cluster space of storing data is sufficient.If the data volume of data to be written is greater than all clusters of storing data The capacity in space then illustrates that the storage equipment cannot completely store the data to be written, illustrates that the cluster of storing data is empty at this time Between it is inadequate.If the data volume of data to be written is less than the capacity in the cluster space of storing data, illustrate that the storage equipment can Completely to store the data to be written, illustrate that the cluster space of storing data is sufficient at this time, so can by the data to be written into Row is written in cluster space.
Technical solution according to an embodiment of the present invention passes through the number of the FAT table item for the FAT file system for determining to search Amount can find out the cluster space block gone out as corresponding to continuous several FAT table item.And equipment is stored for low capacity, continuously Sector big data quantity single writing speed is far faster than dispersion sector small data quantity writing speed.So finding out by even After the corresponding cluster space block out of continuous several FAT table items, the cluster space block can be write data into, reduces repeatedly access file The time of directory search FAT table item improves the speed of the data write-in based on FAT file system, solves in the prior art The low problem of data write efficiency caused by a FAT table item can only once be found out.Also, disclosure of the invention based on The method of the data write-in of FAT file system does not destroy former FAT file system architecture, and compatible individual data is multiple The case where write-in and modification, can be realized file and connect write-in.
Fig. 4 shows the method for the data write-in based on FAT file system that can apply the embodiment of the present invention or is based on The exemplary system architecture 400 of the system of the data write-in of FAT file system.
As shown in figure 4, system architecture 400 may include terminal device 401,402,403, network 404 and server 405. Network 404 between terminal device 401,402,403 and server 405 to provide the medium of communication link.Network 404 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 401,402,403 and be interacted by network 404 with server 405, to receive or send out Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 401,402,403 (merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 401,402,403 can be the various electronic equipments with display screen and supported web page browsing, packet Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 405 can be to provide the server of various services, such as utilize terminal device 401,402,403 to user The shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to reception To the data such as information query request carry out the processing such as analyzing, and processing result is fed back into terminal device.
It should be noted that the method for the data write-in provided by the embodiment of the present invention based on FAT file system is general It is executed by server 405, correspondingly, the system of the data write-in based on FAT file system is generally positioned in server 405.
It should be understood that the number of terminal device, network and server in Fig. 4 is only schematical.According to realization need It wants, can have any number of terminal device, network and server.
Below with reference to Fig. 5, it illustrates the computer systems 500 for the terminal device for being suitable for being used to realize the embodiment of the present invention Structural schematic diagram.Terminal device shown in Fig. 5 is only an example, function to the embodiment of the present invention and should not use model Shroud carrys out any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and Execute various movements appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data. CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always Line 504.
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 508 including hard disk etc.; And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because The network of spy's net executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to read from thereon Computer program be mounted into storage section 508 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.? In such embodiment, which can be downloaded and installed from network by communications portion 509, and/or from can Medium 511 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 501, system of the invention is executed The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction It closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet Include determining module, lookup and writing module.Wherein, the title of these modules is not constituted to the module itself under certain conditions Restriction, for example, determining module is also described as, " the FAT table item occupied according to file where data to be written is corresponding The data volume of the residual memory space in cluster space and the data to be written, determines the FAT for the FAT file system that need to be searched The module of the quantity of list item ".
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes Obtain the residual memory space that the equipment includes: the cluster space according to corresponding to the FAT table item of file occupancy where data to be written And the data volume of the data to be written, determine the quantity of the FAT table item for the FAT file system that need to be searched;It finds out pair Answer the FAT table item of the quantity, and the FAT table that the data to be written are written the residual memory space and found out Cluster space corresponding to.
Technical solution according to an embodiment of the present invention passes through the number of the FAT table item for the FAT file system for determining to search Amount can find out the cluster space block gone out as corresponding to continuous several FAT table item.And equipment is stored for low capacity, continuously Sector big data quantity single writing speed is far faster than dispersion sector small data quantity writing speed.So finding out by even After the corresponding cluster space block out of continuous several FAT table items, the cluster space block can be write data into, reduces repeatedly access file The time of directory search FAT table item improves the speed of the data write-in based on FAT file system, solves in the prior art The low problem of data write efficiency caused by a FAT table item can only once be found out.Also, disclosure of the invention based on The method of the data write-in of FAT file system does not destroy former FAT file system architecture, and compatible individual data is multiple The case where write-in and modification, can be realized file and connect write-in.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention Within.

Claims (10)

1. a kind of method of the data write-in based on FAT file system characterized by comprising
The residual memory space in the corresponding cluster space of FAT table item occupied according to file where data to be written and described to be written The data volume for entering data determines the quantity of the FAT table item for the FAT file system that need to be searched;
Find out the FAT table item of the corresponding quantity, and will the data write-in to be written residual memory space and Cluster space corresponding to the FAT table item found out.
2. the method according to claim 1, wherein the FAT table of the FAT file system for determining to search Quantity the step of include:
The FAT table item that file where determining data to be written occupies, and determine the corresponding cluster space of FAT table item of the occupancy Residual memory space;
The data volume of the data to be written is calculated, and determines that the data volume of the data to be written and the remaining storage are empty Between difference;
The quantity of the FAT table item for the FAT file system for determining to search according to the difference.
3. the method according to claim 1, wherein the mistake of the FAT table item for finding out the corresponding quantity Journey includes:
It is that idle FAT table item is inquired one by one from current markers, finds out serial number continuously idle FAT table item.
4. the method according to claim 1, wherein in the FAT table item for the FAT file system for determining to search Quantity before, further includes:
Determine that the cluster space of storing data is sufficient according to the data volume of the data to be written.
5. a kind of system of the data write-in based on FAT file system characterized by comprising
The remaining storage of determining module, the corresponding cluster space of FAT table item for being occupied according to file where data to be written is empty Between and the data to be written data volume, determine the quantity of the FAT table item for the FAT file system that need to be searched;
Institute is written for finding out the FAT table item of the corresponding quantity, and by the data to be written in lookup and writing module State residual memory space and the FAT table item that finds out corresponding to cluster space.
6. system according to claim 5, which is characterized in that the determining module is also used to: determining data institute to be written In the FAT table item that file occupies, and determine the residual memory space in the corresponding cluster space of FAT table item of the occupancy;It calculates The data volume of the data to be written, and determine the data volume of the data to be written and the difference of the residual memory space Value;The quantity of the FAT table item for the FAT file system for determining to search according to the difference.
7. system according to claim 5, which is characterized in that the lookup and writing module are also used to: from current markers It is inquired one by one for idle FAT table item, finds out serial number continuously idle FAT table item.
8. system according to claim 5, which is characterized in that further include space abundance determining module, for according to The data volume of data to be written determines that the cluster space of storing data is sufficient.
9. a kind of device of the data write-in based on FAT file system characterized by comprising
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real The now method as described in any in claim 1-4.
10. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor The method as described in any in claim 1-4 is realized when row.
CN201710984493.0A 2017-10-20 2017-10-20 Data writing method and system based on FAT file system Active CN109697019B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710984493.0A CN109697019B (en) 2017-10-20 2017-10-20 Data writing method and system based on FAT file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710984493.0A CN109697019B (en) 2017-10-20 2017-10-20 Data writing method and system based on FAT file system

Publications (2)

Publication Number Publication Date
CN109697019A true CN109697019A (en) 2019-04-30
CN109697019B CN109697019B (en) 2022-12-27

Family

ID=66225368

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710984493.0A Active CN109697019B (en) 2017-10-20 2017-10-20 Data writing method and system based on FAT file system

Country Status (1)

Country Link
CN (1) CN109697019B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111159064A (en) * 2019-12-30 2020-05-15 南京六九零二科技有限公司 Low-complexity data block caching method
CN111897484A (en) * 2019-05-05 2020-11-06 北京兆易创新科技股份有限公司 Data storage method and device, electronic equipment and storage medium
CN113064605A (en) * 2021-03-26 2021-07-02 中国航空无线电电子研究所 Configuration-based multi-data card automatic identification and unloading method
CN113900994A (en) * 2021-12-02 2022-01-07 新华三智能终端有限公司 File writing method and device

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101042696A (en) * 2006-03-23 2007-09-26 北京握奇数据系统有限公司 Smart card storage system and managing method for file creation in the system
CN101051318A (en) * 2007-05-11 2007-10-10 北京中星微电子有限公司 Method for cluster linking and track hunting magnetic disc data using file distribution table
CN101303667A (en) * 2008-06-25 2008-11-12 炬力集成电路设计有限公司 Method and device for establishing magnetic disk null cluster table and seeking magnetic disk null cluster
CN101876956A (en) * 2009-12-15 2010-11-03 北京中星微电子有限公司 File access method and device of SD (Secure Digital) card
CN101882132A (en) * 2009-04-27 2010-11-10 深圳市闪联信息技术有限公司 Creating and reading method and device for virtual FAT file system
US20110016238A1 (en) * 2009-07-17 2011-01-20 Sanyo Electric Co., Ltd. Data Access Apparatus
CN102004700A (en) * 2010-11-26 2011-04-06 华为终端有限公司 Memory space distribution method and device for flash memory
CN102841894A (en) * 2011-06-22 2012-12-26 比亚迪股份有限公司 Data storage method of file allocation table
CN104394371A (en) * 2014-12-01 2015-03-04 北京理工大学 System for large amount continuous image collection and quick storage

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101042696A (en) * 2006-03-23 2007-09-26 北京握奇数据系统有限公司 Smart card storage system and managing method for file creation in the system
CN101051318A (en) * 2007-05-11 2007-10-10 北京中星微电子有限公司 Method for cluster linking and track hunting magnetic disc data using file distribution table
CN101303667A (en) * 2008-06-25 2008-11-12 炬力集成电路设计有限公司 Method and device for establishing magnetic disk null cluster table and seeking magnetic disk null cluster
CN101882132A (en) * 2009-04-27 2010-11-10 深圳市闪联信息技术有限公司 Creating and reading method and device for virtual FAT file system
US20110016238A1 (en) * 2009-07-17 2011-01-20 Sanyo Electric Co., Ltd. Data Access Apparatus
CN101876956A (en) * 2009-12-15 2010-11-03 北京中星微电子有限公司 File access method and device of SD (Secure Digital) card
CN102004700A (en) * 2010-11-26 2011-04-06 华为终端有限公司 Memory space distribution method and device for flash memory
CN102841894A (en) * 2011-06-22 2012-12-26 比亚迪股份有限公司 Data storage method of file allocation table
CN104394371A (en) * 2014-12-01 2015-03-04 北京理工大学 System for large amount continuous image collection and quick storage

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
KESHAVA MUNEGOWDA 等: ""Cluster Allocation Strategies of the ExFAT and FAT File Systems: A Comparative Study in Embedded Storage Systems"", 《HTTPS://WWW.RESEARCHGATE.NET/PUBLICATION/291074681_CLUSTER_ALLOCATION_STRATEGIES_OF_THE_EXFAT_AND_FAT_FILE_SYSTEMS_A_COMPARATIVE_STUDY_IN_EMBEDDED_STORAGE_SYSTEMS》 *
刘晓明 等: ""基于TMS320VC5509A的SD卡文件系统的开发应用"", 《工业控制计算机》 *
张延伟 等: ""基于ARM7TDMI实现简易嵌入式文件"", 《电脑知识与技术》 *
李奇阳: ""FAT文件系统元数据合理性检测的研究"", 《中国优秀硕士学位论文全文数据库(信息科技辑)》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111897484A (en) * 2019-05-05 2020-11-06 北京兆易创新科技股份有限公司 Data storage method and device, electronic equipment and storage medium
CN111897484B (en) * 2019-05-05 2024-03-29 兆易创新科技集团股份有限公司 Data storage method and device, electronic equipment and storage medium
CN111159064A (en) * 2019-12-30 2020-05-15 南京六九零二科技有限公司 Low-complexity data block caching method
CN111159064B (en) * 2019-12-30 2023-09-01 南京六九零二科技有限公司 Low-complexity data block caching method
CN113064605A (en) * 2021-03-26 2021-07-02 中国航空无线电电子研究所 Configuration-based multi-data card automatic identification and unloading method
CN113064605B (en) * 2021-03-26 2023-09-15 中国航空无线电电子研究所 Configuration-based multi-data card automatic identification and unloading method
CN113900994A (en) * 2021-12-02 2022-01-07 新华三智能终端有限公司 File writing method and device

Also Published As

Publication number Publication date
CN109697019B (en) 2022-12-27

Similar Documents

Publication Publication Date Title
KR102240557B1 (en) Method, device and system for storing data
CN106886375B (en) The method and apparatus of storing data
CN101567003B (en) Method for managing and allocating resource in parallel file system
CN104699423B (en) The method and apparatus that drive is bound in linux system
CN109697019A (en) The method and system of data write-in based on FAT file system
CN108629029A (en) A kind of data processing method and device applied to data warehouse
US20130227085A1 (en) Terminal and method for using cloud services
CN112765271A (en) Block chain transaction index storage method and device, computer equipment and medium
CN110347651A (en) Method of data synchronization, device, equipment and storage medium based on cloud storage
CN103064637A (en) Network disk cache synchronizing method and system
CN103067480A (en) Synchronized method and system of network disk
CN110688096B (en) Method and device for constructing application program containing plug-in, medium and electronic equipment
CN110109868A (en) Method, apparatus and computer program product for index file
CN109669925A (en) The management method and device of unstructured data
US20180284999A1 (en) Data Migration with Application-Native Export and Import Capabilities
CN110019437A (en) A kind of method and system exporting data
CN107480205A (en) A kind of method and apparatus for carrying out data partition
CN109947709A (en) Date storage method and device
CN110352410B (en) Tracking access patterns of index nodes and pre-fetching index nodes
CN113688139B (en) Object storage method, gateway, device and medium
CN112596949B (en) High-efficiency SSD (solid State disk) deleted data recovery method and system
CN104391947B (en) Magnanimity GIS data real-time processing method and system
CN113554394A (en) File storage method and device, electronic equipment and storage medium
CN110119418A (en) Data export method and device
CN110427394B (en) Data operation method and device

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