CN1627272A - Method for managing files in flash memory of mobile terminal - Google Patents

Method for managing files in flash memory of mobile terminal Download PDF

Info

Publication number
CN1627272A
CN1627272A CN 200310109217 CN200310109217A CN1627272A CN 1627272 A CN1627272 A CN 1627272A CN 200310109217 CN200310109217 CN 200310109217 CN 200310109217 A CN200310109217 A CN 200310109217A CN 1627272 A CN1627272 A CN 1627272A
Authority
CN
China
Prior art keywords
file
space
piece
type
enough
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.)
Pending
Application number
CN 200310109217
Other languages
Chinese (zh)
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.)
BEIHAO COMMUNICATION ELECTRONIC Co Ltd SHANGHAI
Original Assignee
BEIHAO COMMUNICATION ELECTRONIC Co Ltd SHANGHAI
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 BEIHAO COMMUNICATION ELECTRONIC Co Ltd SHANGHAI filed Critical BEIHAO COMMUNICATION ELECTRONIC Co Ltd SHANGHAI
Priority to CN 200310109217 priority Critical patent/CN1627272A/en
Publication of CN1627272A publication Critical patent/CN1627272A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

This invention discloses a file management method in the flash memory of a mobile terminal including allocating storage spaces based on the file types looking for if left space corresponding said file type is enough, if the space is enough, the file is reserved, if not, the fail reserve is fed back. Said method also includes a step of deleting files. The minimum allocating unit is block in the step of allocating stored space in the file type, and the smallest unit is byte when looking for and reserved files, which adopts a continuous way with byte as the unit fully utilizing space in a memory and reducing generation of pieces.

Description

File management method in the flash memory of portable terminal
Technical field
The present invention relates to the EMS memory management process of portable terminal, relate in particular to the file management method in a kind of flash memory of portable terminal.
Background technology
Along with the development of portable terminal technology, the user is more and more higher to the requirement of portable terminal, also requires portable terminal that more software support is provided.But the internal memory of portable terminal is limited, can not preserve lot of data simultaneously as computing machine, therefore, just needs a kind of effectively method of managing mobile terminal internal memory.Simultaneously, more and more in the present portable terminal use flash memory (flash), and flash has accessing operation and can be undertaken by byte, the characteristics that deletion action will be carried out according to piece, so, just more need a kind of These characteristics, the method for carrying out file management among the flash at flash.
Summary of the invention
The purpose of this invention is to provide the file management method in a kind of flash memory of portable terminal, utilizing the space of storer more fully, and locating file more promptly.
In order to achieve the above object, the present invention adopts following technical scheme:
File management method in a kind of flash memory of portable terminal comprises:
According to the step in file type memory allocated space, whole storage space is divided into several zones, each corresponding a kind of file type in zone, and have an index value and first address; When preserving file,, search zone corresponding in the described storage space at first according to the type of described file;
Search the whether enough steps of remaining space in the zone of this document type correspondence, when the space is enough, described file is write and return index value and first address; If the described file of the not enough preservation in space then returns and preserves failure.
In one embodiment, the corresponding continuous or discrete a plurality of zones of each file type, each described zone has an index value and first address; Because the corresponding a plurality of zones of same file type, so need to travel through the whether enough steps of remaining space of the All Ranges of searching this document type correspondence among this embodiment, at first search first corresponding region, when the space is enough, described file is write and return index value and first address; If the described file of the not enough preservation in space is then searched next corresponding region; If when the remaining space of all corresponding regions is all not enough, returns and preserve failure.
In the described step according to file type memory allocated space of the foregoing description, the least unit of distribution is a piece, and each piece is the 64K byte.Whether enough in the described remaining space of searching or travel through the All Ranges of searching this document type correspondence step, the least unit of searching is a byte.When preserving file, least unit is a byte; File is kept in the continuous storage space that first unappropriated byte rises in its type The corresponding area.
In the embodiment in the corresponding a plurality of zones of file type of above-mentioned employing, can be when the file traversal of each type be searched end, the step of the file size that the pairing index value of preservation current region and this time are searched; When carrying out the finding step of traversal next time of the type file, if the size of file less than the file size of described preservation, then begins traversal from the index value The corresponding area of described preservation and searches, otherwise begin to search from first corresponding region again.
In one embodiment, this method also comprises the step of deleted file, in this embodiment, need keep a piece at least and in return distinguish in whole storage space.The step of this deleted file comprises at first definite all the shared pieces of file that will delete, operate first piece, to play content replication before the described file that will delete from the first address of this piece to the exchange area, will play the described content replication of tail address after the described file that will delete in the remaining space of described exchange area; Content in deleting described; With the content replication in the described exchange area in described; Delete the content in the described exchange area; Operate next piece, repeat above-mentioned steps, all finish aforesaid operations up to all pieces that the file that will delete is shared.
In one embodiment, this method also is included in the step of adding the block mark section in each piece, and the block mark section comprises busy flag, write state sign, writes complement mark and deleted marker.And be the step of the file interpolation file mark section of each preservation, the file mark section comprises service marking, write state sign, writes complement mark and deleted marker.
Owing to adopted technique scheme, it is the continuous preserving type of unit that file management method of the present invention adopts with the byte, can utilize the space in the storer fully, reduce the generation of fragment, simultaneously, the mode that the distribution of storage space adopts two-stage to distribute, and search the size of all preserving index value and search after finishing in each traversal, to improve the efficient of search, accelerated the speed of retrieving files.
Description of drawings
Fig. 1 is the process flow diagram of the file management method of one embodiment of the present of invention;
Fig. 2 is the process flow diagram of another embodiment of file management method of the present invention;
Fig. 3 is the process flow diagram that adopts the acceleration search method in the file management method of the present invention;
Fig. 4 A, B are the synoptic diagram of the zone bit that adds in the file management method of the present invention.
Embodiment
Further specify technical scheme of the present invention below in conjunction with embodiment and accompanying drawing.
Because the memory span of portable terminal is limited, therefore how to utilize limited storage space just to become crucial problem fully.To this, the present invention adopts the mode of continuous storage to make full use of the space of storer, will be set at byte for the smallest allocation unit of file, rather than piece generally or bunch, so just can reduce the generation of fragment in the storer as far as possible.But, is exactly to cause slowing down of locating file speed with the byte for smallest allocation unit stores the problem of being brought continuously, must search to a byte one byte, can have a strong impact on the travelling speed of total system, therefore, the present invention adopts the mode in two fraction allocate memory spaces, and at first the relative concentrated area of file with same type is kept in the memory area, and in this zone each file being adopted with the byte is the continuous preservation of unit.When searching, at first find the zone of file type correspondence, in this zone, once searching according to byte, so just can under the situation that as far as possible makes full use of storage space, improve the speed of search file.
Have a look an embodiment according to this method below, Fig. 1 is its process flow diagram, among this embodiment, and the corresponding block storage zone of same file type, because the file type on the portable terminal is fewer, therefore this method is feasible.This method may further comprise the steps:
S11. according to the step in file type memory allocated space, whole storage space is divided into several zones, each corresponding a kind of file type in zone, and have an index value and first address; When preserving file,, search zone corresponding in the storage space at first according to the type of described file; Like this, just can be kept at together by the file that all types is identical.In the step according to file type memory allocated space, the least unit of distribution is a piece, and each piece is the 64K byte.Because the space of distributing in this step is relatively large, be that unit is more suitable therefore with the piece, be that unit also is convenient to search with the piece simultaneously.
S12. search the whether enough steps of remaining space in the zone of this document type correspondence, when the space is enough, file is write and returns index value and first address; If file is preserved in the space inadequately, then return and preserve failure.In the whether enough step of the remaining space of the All Ranges of searching this document type correspondence, the least unit of searching is a byte, in order to utilize storage space as far as possible fully, so when each file is operated, least unit is carried out with byte, and is same, when preserving file, least unit also is a byte, and file is kept in the continuous storage space that first unappropriated byte rises in its type The corresponding area.
Adopt this method, the file of each type is with regard to a corresponding block storage zone, bottom line can be reduced in the space that should waste, but, according to the method for this embodiment underaction that seems, because for the needed space of the various file types of different application programs is different, so the mode of this embodiment may cause the too many again situation in space of the not enough and another kind of file type in space of certain file type.So, can adopt another kind of embodiment, make the corresponding a plurality of continuous or discontinuous memory areas of each file type, each zone is smaller comparatively speaking, the method of this embodiment is more flexible, the especially application that do not wait of the desired space of corresponding every type file.This method may further comprise the steps, as shown in Figure 2:
S21. in the step according to file type memory allocated space, whole storage space is divided into several zones, the corresponding continuous or discrete a plurality of zones of each file type, each zone has an index value and first address; In this step, the least unit of distribution also is a piece, and each piece is the 64K byte.
S22. whether enough traversal search remaining space the step of the All Ranges of this document type correspondence, at first searches first corresponding region, when the space is enough, file write and returns index value and first address; If file is preserved in the space inadequately, then search next corresponding region; If when the remaining space of all corresponding regions is all not enough, returns and preserve failure.Whether enough search in the remaining space of All Ranges of this document type correspondence the step in traversal, the least unit of searching is a byte, and when preserving file, least unit also is a byte; File is kept in the continuous storage space that first unappropriated byte rises in its type The corresponding area.
In this embodiment, can also use the method for acceleration search, Fig. 3 is the process flow diagram of acceleration search method, and using the acceleration search method promptly is to add following steps in the described method of the foregoing description:
S23. search when finishing at the file traversal of each type, preserve the step of the file size that the pairing index value of current region and this time search; When carrying out the finding step of traversal next time of the type file, if the size of file less than the file size of preserving, then begins traversal from the index value The corresponding area of preserving and searches, otherwise begin to search from first corresponding region again.If the file size of Bao Cuning is greater than the size that will search for now like this, when then restarting to search for, in the ideal case, system once just can find required space before the piece of search on searching; If the file size of preserving is less than the size that will search for now, then search for from the BOB(beginning of block) of last time search, because the remaining space in all pieces before the piece of last once search is all big than this, so consider from the angle that makes full use of storage space, should search at first downwards, look at that the piece that whether is more suitable for can be used for preserving this document.
In the file management method of the present invention, the step that also comprises deleted file, because storer is the flash storer, and the flash storer is when deletion, must be least unit with piece (64K), and file management method of the present invention is a least unit with the byte when preserving file, therefore the mode below when deletion, just needing to use, earlier the content that does not need in the piece to delete is saved in the temporary space, delete this piece then, again the content replication in the temporary space is returned, so just need be in whole storage space, at least keep a piece and in return distinguish, carry out following deletion step again:
The step of deleted file, at first definite all the shared pieces of file that will delete, operate first piece, to play content replication before the described file that will delete from the first address of this piece to the exchange area, the content replication of tail address of playing piece after the file that will delete is in the remaining space of exchange area; Content in the deleted block; With the content replication in the exchange area in piece; Content in the deletion exchange area; Operate next piece, repeat above-mentioned steps, all finish aforesaid operations up to all pieces that the file that will delete is shared.
As mentioned above, the mode that all adopts two-stage to distribute among each embodiment according to method of the present invention, so, following situation will appear, in a memory block, preserve a plurality of files, and a file takies a plurality of memory blocks.Therefore, just a kind of mechanism of needs conclusivelys show the relation between above-mentioned file and the piece, in one embodiment, adopts following method to realize, in the various embodiments described above, adds following steps:
Add the step of block mark section in each piece, the block mark section comprises busy flag, write state sign, writes complement mark and deleted marker.Please refer to Fig. 4 A, this identification fields is arranged in the header fields (BlockHeader) of piece, described 4 signs are continuous positions, wherein, busy flag (B_used) represents that this piece is occupied, and write state sign (B_write) represents that this piece is written into, write complement mark (B_write_done) and represent that doing the write operation that is used for this piece finishes, data are complete, and deleted marker (B_deleted) represents that this piece is deleted, can be by sub-distribution again.
For the file of each preservation adds the step of file mark section, the file mark section comprises service marking, write state sign, writes complement mark and deleted marker.Please refer to Fig. 4 B, this identification fields is arranged in the header fields (File_Header) of file, described 4 signs are continuous positions, wherein, service marking (F_used) expression file is used, write state sign (F_write) expression file is written into, and writes the write operation of complement mark (F_write_done) expression file and finishes, and data are complete.Deleted marker (F_deleted) zone bit represents that this document is deleted.The use of these zone bits is in order to increase the security of file system, to prevent that file from by the deletion of the unscheduled event of power down and so on mistake, having guaranteed the integrality of file simultaneously.
By increasing above-mentioned identification fields, just conclusivelyed show the relation between file and the piece.
Owing to adopted technique scheme, it is the continuous preserving type of unit that file management method of the present invention adopts with the byte, can utilize the space in the storer fully, reduce the generation of fragment, simultaneously, the mode that the distribution of storage space adopts two-stage to distribute, and search the size of all preserving index value and search after finishing in each traversal, to improve the efficient of search, accelerated the speed of retrieving files.In addition, also increase identification fields, can clearly illustrate that the relation between piece and the file.

Claims (10)

1. the file management method in the flash memory of a portable terminal comprises:
According to the step in file type memory allocated space, whole storage space is divided into several zones, each corresponding a kind of file type in zone, and have an index value and first address; When preserving file,, search zone corresponding in the described storage space at first according to the type of described file;
Search the whether enough steps of remaining space in the zone of this document type correspondence, when the space is enough, described file is write and return index value and first address; If the described file of the not enough preservation in space then returns and preserves failure.
2. the method for claim 1 is characterized in that,
In the described step, whole storage space is divided into several zones according to file type memory allocated space, the corresponding continuous or discrete a plurality of zones of each file type, each described zone has an index value and first address;
Whether enough traversal search remaining space the step of the All Ranges of this document type correspondence, at first searches first corresponding region, when the space is enough, described file write and return index value and first address; If the described file of the not enough preservation in space is then searched next corresponding region; If when the remaining space of all corresponding regions is all not enough, returns and preserve failure.
3. method as claimed in claim 2 is characterized in that, also comprises
When the file traversal of each type is searched end, the step of the file size that the pairing index value of preservation current region and this time are searched; When carrying out the finding step of traversal next time of the type file, if the size of file less than the file size of described preservation, then begins traversal from the index value The corresponding area of described preservation and searches, otherwise begin to search from first corresponding region again.
4. as each described method in the claim 1 to 3, it is characterized in that,
In the described step according to file type memory allocated space, the least unit of distribution is a piece, and each piece is the 64K byte.
5. method as claimed in claim 4 is characterized in that,
In whole storage space, keep a piece at least and in return distinguish.
6. method as claimed in claim 4 is characterized in that, also comprises
The step of deleted file, at first definite all the shared pieces of file that will delete, operate first piece, to play content replication before the described file that will delete from the first address of this piece to described exchange area, will play the described content replication of tail address after the described file that will delete in the remaining space of described exchange area; Content in deleting described; With the content replication in the described exchange area in described; Delete the content in the described exchange area; Operate next piece, repeat above-mentioned steps, all finish aforesaid operations up to all pieces that the file that will delete is shared.
7. method as claimed in claim 4 is characterized in that, also comprises
Add the step of block mark section in each piece, the block mark section comprises busy flag, write state sign, writes complement mark and deleted marker.
8. as each described method in the claim 1 to 3, it is characterized in that,
Whether enough in the described remaining space of searching or travel through the All Ranges of searching this document type correspondence the step, the least unit of searching is a byte.
9. method as claimed in claim 8 is characterized in that,
When preserving file, least unit is a byte; File is kept in the continuous storage space that first unappropriated byte rises in its type The corresponding area.
10. method as claimed in claim 8 is characterized in that, also comprises
For the file of each preservation adds the step of file mark section, the file mark section comprises service marking, write state sign, writes complement mark and deleted marker.
CN 200310109217 2003-12-10 2003-12-10 Method for managing files in flash memory of mobile terminal Pending CN1627272A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200310109217 CN1627272A (en) 2003-12-10 2003-12-10 Method for managing files in flash memory of mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200310109217 CN1627272A (en) 2003-12-10 2003-12-10 Method for managing files in flash memory of mobile terminal

Publications (1)

Publication Number Publication Date
CN1627272A true CN1627272A (en) 2005-06-15

Family

ID=34758882

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200310109217 Pending CN1627272A (en) 2003-12-10 2003-12-10 Method for managing files in flash memory of mobile terminal

Country Status (1)

Country Link
CN (1) CN1627272A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101187926B (en) * 2006-11-16 2011-05-11 康佳集团股份有限公司 Multi-kind resource management method
CN103268201A (en) * 2013-04-19 2013-08-28 北京经纬恒润科技有限公司 Data storing method, storing device and reading method
CN105630965A (en) * 2015-12-24 2016-06-01 西安电子科技大学 System and method for securely deleting file from user space on mobile terminal flash medium
CN106604150A (en) * 2016-12-16 2017-04-26 深圳Tcl新技术有限公司 Method and device for sharing wireless device storage space
CN106980676A (en) * 2017-03-29 2017-07-25 江西金格科技股份有限公司 File management method based on intelligent key disk
CN107608639A (en) * 2017-10-20 2018-01-19 深圳益邦阳光有限公司 Queue-type cycle storage method, electronic equipment and storage medium based on flash memory
WO2018045634A1 (en) * 2016-09-08 2018-03-15 百富计算机技术(深圳)有限公司 Method and device for loading application of small embedded system
CN108694129A (en) * 2018-03-22 2018-10-23 霍尼韦尔环境自控产品(天津)有限公司 Determine the method that position is ultimately written in the memory block of flash storage
CN111225169A (en) * 2018-11-26 2020-06-02 浙江宇视科技有限公司 Storage method and device for small video files
CN112307033A (en) * 2020-11-23 2021-02-02 杭州迪普科技股份有限公司 Method, device and equipment for reconstructing data packet file

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101187926B (en) * 2006-11-16 2011-05-11 康佳集团股份有限公司 Multi-kind resource management method
CN103268201A (en) * 2013-04-19 2013-08-28 北京经纬恒润科技有限公司 Data storing method, storing device and reading method
CN103268201B (en) * 2013-04-19 2016-02-17 北京经纬恒润科技有限公司 A kind of date storage method, memory storage and read method
CN105630965B (en) * 2015-12-24 2019-02-26 西安电子科技大学 User's space safety deleting file system and method on a kind of mobile terminal flash media
CN105630965A (en) * 2015-12-24 2016-06-01 西安电子科技大学 System and method for securely deleting file from user space on mobile terminal flash medium
WO2018045634A1 (en) * 2016-09-08 2018-03-15 百富计算机技术(深圳)有限公司 Method and device for loading application of small embedded system
CN106604150A (en) * 2016-12-16 2017-04-26 深圳Tcl新技术有限公司 Method and device for sharing wireless device storage space
CN106980676A (en) * 2017-03-29 2017-07-25 江西金格科技股份有限公司 File management method based on intelligent key disk
CN107608639A (en) * 2017-10-20 2018-01-19 深圳益邦阳光有限公司 Queue-type cycle storage method, electronic equipment and storage medium based on flash memory
CN108694129A (en) * 2018-03-22 2018-10-23 霍尼韦尔环境自控产品(天津)有限公司 Determine the method that position is ultimately written in the memory block of flash storage
CN108694129B (en) * 2018-03-22 2021-06-22 霍尼韦尔环境自控产品(天津)有限公司 Method for determining last writing position in storage area of Flash memory
CN111225169A (en) * 2018-11-26 2020-06-02 浙江宇视科技有限公司 Storage method and device for small video files
CN112307033A (en) * 2020-11-23 2021-02-02 杭州迪普科技股份有限公司 Method, device and equipment for reconstructing data packet file
CN112307033B (en) * 2020-11-23 2023-04-25 杭州迪普科技股份有限公司 Reconstruction method, device and equipment of data packet file

Similar Documents

Publication Publication Date Title
US8745316B2 (en) System and method of managing indexation of flash memory
US9684462B2 (en) Method and apparatus utilizing non-uniform hash functions for placing records in non-uniform access memory
CN100498740C (en) Data cache processing method, system and data cache device
CN104346357B (en) The file access method and system of a kind of built-in terminal
CN103186350B (en) The moving method of mixing storage system and hot spot data block
US7571163B2 (en) Method for sorting a data structure
US7937522B2 (en) Method for flash memory data management
US20050132126A1 (en) Method and file structures for managing data on a flash disk
CN103164490B (en) A kind of efficient storage implementation method of not fixed-length data and device
CN101039278A (en) Data management method and system
CN101777061B (en) JAVA card object management method and JAVA card
CN101030165A (en) Magnetic disk space management and managing system
CN111522507B (en) Low-delay file system address space management method, system and medium
CN103425435B (en) Disk storage method and disk storage system
CN102262512A (en) System, device and method for realizing disk array cache partition management
WO2010125574A1 (en) Description
CN1627272A (en) Method for managing files in flash memory of mobile terminal
CN105045850A (en) Method for recovering junk data in cloud storage log file system
CN1845093A (en) Attribute extensible object file system
CN1266614C (en) Method for quickening logic block mapping speed in Flash file system
CN100347705C (en) Method for file merge
KR100907477B1 (en) Apparatus and method for managing index of data stored in flash memory
CN1908937A (en) FLASH document management method and system in FLASH memory
CN106294189B (en) Memory defragmentation method and device
CN101034416A (en) Method for file seek track using file allocation table and system frame thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication