CN114610228A - File management system and file management method and device thereof - Google Patents

File management system and file management method and device thereof Download PDF

Info

Publication number
CN114610228A
CN114610228A CN202110473580.6A CN202110473580A CN114610228A CN 114610228 A CN114610228 A CN 114610228A CN 202110473580 A CN202110473580 A CN 202110473580A CN 114610228 A CN114610228 A CN 114610228A
Authority
CN
China
Prior art keywords
file
cluster
files
file management
allocation 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.)
Pending
Application number
CN202110473580.6A
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.)
Hosin Global Electronics Co Ltd
Original Assignee
Hosin Global Electronics 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 Hosin Global Electronics Co Ltd filed Critical Hosin Global Electronics Co Ltd
Priority to CN202110473580.6A priority Critical patent/CN114610228A/en
Publication of CN114610228A publication Critical patent/CN114610228A/en
Pending legal-status Critical Current

Links

Images

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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • 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/0608Saving storage space on storage systems
    • 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
    • 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/0644Management of space entities, e.g. partitions, extents, pools
    • 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/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • 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/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Abstract

The application discloses a file management system and a file management method and a device thereof, wherein the file management system comprises: the file management system comprises a storage space, wherein the storage space comprises a reserved area, a file allocation area and a data area, the data area comprises at least one cluster, and the cluster comprises at least more than two files. The file management system can improve the utilization rate of the storage space.

Description

File management system and file management method and device thereof
Technical Field
The present application relates to the field of computer technologies, and in particular, to a file management system, a file management method, and an apparatus.
Background
The NAND Flash memory is internally divided into a plurality of memory cell blocks (blocks), each of which includes a plurality of pages (pages), the memory cell block being a minimum unit of erase, and the page being a minimum unit of write data.
The file system is located between the device driver and the upper application program in the whole system, and is responsible for managing creation, revocation, reading and writing, modification, copying, access control and the like of files, and managing various resources for storing the files. It manages the data access pattern and structure on the hardware to better utilize storage space and improve storage efficiency. Currently, the FAT file system is a file system widely used in the Microsoft DOS/Windows operating system. The FAT file system divides the disk space into clusters (clusters) with a certain number of sectors (sectors), and one cluster is composed of 2nA sector (sector) is formed, and a size of a sector is generally fixed to a size of 512 bytes (byte). Basic unit when file occupies disk spaceNot bytes but clusters, even if a file has only one byte, the operating system will assign a cluster to it; for large files, multiple clusters need to be allocated. In order to implement chained storage of files, the file system must accurately record which clusters are already occupied by the file, must also indicate, for each occupied cluster, the cluster number of the next cluster to store the successor, and for the last cluster of the file, indicates that the cluster has no successor clusters. These are all kept by a FAT table (file allocation table) which has recorded in its corresponding entry information about the cluster it represents: such as empty, whether it is a bad cluster, whether it is already a tail cluster of a certain file, etc.
Therefore, the whole performance is influenced by the cluster division, the number of clusters can be reduced by a larger cluster, the size of the FAT table is reduced, and the system performance is improved; however, when the storage file is small, a single file still occupies one cluster, and the storage space of each cluster cannot be fully utilized, so that the utilization rate of the disk space is not high. The smaller clusters are beneficial to improving the utilization rate of the storage space, but the number of the clusters is increased, and under the condition of a larger file, a plurality of clusters are occupied, so that the FAT table is enlarged, and still more effective data storage space is occupied.
Disclosure of Invention
In view of this, the present application provides a file management system, a file management method thereof, and an apparatus thereof, so as to solve the problem that the data storage space utilization rate of the existing file management system is not high.
The present application provides a file management system, comprising: the storage space comprises a reserved area, a file allocation area and a data area, wherein the data area comprises at least one cluster, and at least more than two files are contained in the cluster.
Optionally, the data area includes a root directory, where the root directory is used to record a first cluster number where the file is located, and the file allocation area includes a file allocation table, where the file allocation table is used to record a use condition of a cluster corresponding to the file and cluster chain information corresponding to each file.
Optionally, the file cluster includes an index document, and the index document is used to record index information of all files in the cluster.
Optionally, the index information at least includes a file name, a file size, and an offset position of the file within the cluster.
Optionally, the size of the cluster is equal to the size of the minimum read-write unit of the memory chip.
Optionally, the memory chip is NAND Flash, and the size of each cluster is the size of a memory page.
Optionally, the memory chip is NAND Flash, and the size of each cluster is the size of a memory block.
The present application further provides a file management method of a file management system, including: the storage space is divided into: a reserved area, a file allocation table and a data area; performing data management in the data area by taking a cluster as a unit; more than two files are stored in a single cluster, as permitted by the cluster space.
Optionally, the method further includes: establishing a root directory in the data area for recording the first cluster number of the file; and recording the use condition of the cluster corresponding to the file and the cluster chain information corresponding to each file in the file allocation table.
Optionally, the method further includes: and establishing an index document in the cluster in which the files are stored, and recording index information of all the files in the cluster in the index document.
Optionally, the file management includes file storage, and the file storage method further includes: acquiring the use condition of each cluster through the file allocation table, and acquiring the residual storage space of each cluster; searching a target cluster with a residual space larger than and closest to a file to be stored; copying the file in the target cluster, and storing the copied file and the file to be stored in a new blank cluster; updating the related information in the root directory and the file allocation table, and at least comprising: marking the copied data in the target cluster as invalid, and/or modifying the first cluster number of the corresponding file in the root directory, and/or modifying the use condition of the corresponding cluster in the file allocation table.
Optionally, the file management includes file storage, and the file storage method further includes: acquiring the use condition of each cluster through the file allocation table, and determining a target cluster according to the use condition of the cluster; caching the files to be stored and writing the files to be stored into the target cluster when the sum of the sizes of the files to be stored is close to the size of the target cluster; and updating the related information in the root directory and the file allocation table.
Optionally, the file management includes file reading, and the file reading method further includes: acquiring a first cluster number of a file to be read according to a root directory, and positioning a cluster of the file to be read according to the file allocation table; and when the cluster comprises a plurality of files, scanning the index document in the cluster, acquiring the specific storage position of the file to be read according to the index information, and reading.
Optionally, the file management includes file reading, and the file reading method further includes: acquiring a first cluster number of a file to be read according to a root directory, and positioning a cluster of the file to be read according to the file allocation table; when the cluster comprises a plurality of files, reading all the files in the cluster of the files to be read; and identifying the file names of all the files, and further determining the files to be read.
Optionally, the file management includes file deletion, and the file deletion method further includes: according to the root directory and the file allocation table, locating a cluster where a file to be deleted is located and a block to be erased where the cluster is located; copying other files in the block to be erased to a memory; and after all the data in the block to be erased are erased, writing each file into the erased block.
Optionally, the file management includes file deletion, and the file deletion method further includes: according to the root directory and the file allocation table, locating a cluster where a file to be deleted is located and a block to be erased where the cluster is located; copying other files in the block to be erased to blank clusters of other blocks; and marking the data in the cluster where the file to be deleted is located as invalid.
The present application also provides an apparatus comprising any of the file management systems described above, a microprocessor and a memory; a computer program stored in the memory and executable by the processor; or the computer program, when executed, is capable of performing any of the file management methods described above.
The file management system and the file management method thereof divide clusters by the minimum read-write unit of the storage chip, take the clusters as the data management unit, and store more than two files in a single cluster under the permission of the cluster space, so as to fully utilize the storage space in each cluster as much as possible and improve the space utilization rate of the storage chip. Moreover, the size of each cluster is consistent with the minimum unit of the memory, and a single complete cluster can be read and written at a single time, so that the integrity of data storage can be ensured, and the problem of data reading and writing errors when a plurality of clusters are read and written at a single time is avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a block diagram of a file system according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating cluster partitioning in a data area according to an embodiment of the present application;
FIG. 3 is a diagram illustrating a content of a root directory in a data area according to an embodiment of the present application;
FIG. 4 is a schematic flow chart of file storage according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating a document reading process according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating a document reading process according to an embodiment of the present application;
fig. 7 is a schematic flowchart of file deletion according to an embodiment of the present application.
Detailed Description
As described in the background art, the utilization ratio of the storage space of the file management system of the related art is to be further improved. Especially in the case of storing a large number of small files, a large amount of storage space is wasted.
Therefore, a new file management system is proposed to improve the utilization rate of the storage space. The file system is particularly suitable for memories which need to store a large number of small files, for example, in some memories, data is uploaded to the cloud, and only network address index files with addresses pointing to the cloud are stored in the memories locally, and the sizes of the address index files are usually small, so that a large amount of storage space is wasted if the conventional FAT file system is adopted. By adopting the file management method, the storage space can be fully utilized.
The technical solutions in the embodiments of the present application are clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. Based on the embodiments in the present application, other embodiments obtained by persons skilled in the art without any inventive work are within the scope of the present application. The following embodiments and their technical features may be combined with each other without conflict.
In an embodiment of the present invention, the file management system and the file management method include: dividing the storage space of the storage chip into: a reserved area, a file allocation table and a data area; performing data management in the data area by taking clusters as units, wherein the size of each cluster is equal to the size of the minimum read-write unit of the storage chip; more than two files are stored in a single cluster, as permitted by the cluster space.
Referring to fig. 1, a schematic structural diagram of a storage space under the file management system in an embodiment is shown.
Under the file management system, the storage space is divided into three continuous storage areas, namely a reserved area 101, a file allocation table 102 and a data area 103.
The reserved area 101 is used for storing the most important file system information, such as the type, capacity, version information, location and size of the data area, the host boot program, the start position of the file allocation table 102, and the like.
Two sub-tables, table 1 and table 2, are typically included within the file allocation table 102, with table 2 being a backup to table 1. The file allocation table 102 is used to record the locations of clusters where files are stored.
The data area 103 is used for storing specific file data. The data area 103 is divided into a plurality of consecutive clusters (clusters) of the same size. Data management is performed in the data area 103 in cluster units, the data area includes at least one cluster, the cluster includes at least two or more files, and the size of each cluster is equal to the size of the minimum read-write unit of the memory chip, for example, the size of each cluster may be equal to the size of a memory page of the memory chip or equal to the size of a memory block of the memory chip
Taking a NAND Flash memory as an example, the smallest read-write unit of the memory may be a storage page (page) or a storage block, and referring to fig. 2, in this embodiment, the smallest read-write unit of the memory is a storage page, and when the size of each cluster is equal to the size of the storage page of the storage chip, the data area 103 is divided into a plurality of clusters by taking the page as a unit, so that during each read-write operation, a single complete cluster can be read-written at a time, the integrity of data storage can be ensured, and the problem of data read-write errors occurring when a plurality of clusters are read-written at a time is avoided. The size of each memory page may be 8k, 16k, or 32k bytes (Byte), etc., depending on the configuration of the memory. While a memory block (block) of a NAND Flash memory is typically composed of a plurality of pages, e.g., 32, 64, etc. Referring to fig. 2, taking a memory with 1block of 64 pages and 1page of 8 kbytes as an example, in combination with the 8 kbyte-sized clusters defined above, each memory block of the memory may be divided into 64 clusters.
Further, where cluster space allows, more than two files are stored within a single cluster. Because the cluster space is relatively large, under the condition that most of the written small files are written, a plurality of small files can be written into a single cluster at one time. For example, the memory 1page is 8 kbytes, and each cluster may store 2 files with a size of 4 kbytes, or 1 file with a size of 4 kbytes and 2 files with a size of 2 kbytes, or even more smaller files, so as to fill up the storage space of the whole cluster as much as possible, and reduce the waste of the storage space. In the case of a large file, a single file may occupy multiple cluster spaces.
Writing the file in the data area, and establishing a root directory in the data area, wherein the root directory is used for recording the first cluster number of the file. And when the file is only located in one cluster, the first cluster number is the number of the cluster where the file is located. The number of each cluster corresponds one-to-one to the storage location of the cluster. The starting cluster where the file corresponding to the file is located can be found through the root directory. Typically, a fixed size of storage space may be allocated to the root directory, e.g. 2 clusters, two clusters usually occupying the first bits of the data area, cluster 0 and cluster 1, respectively. In other embodiments, the root directory may also be stored in other clusters, and 1 or more clusters may be allocated to the root directory, which is not limited herein.
Meanwhile, the usage of clusters corresponding to the files and cluster chain information corresponding to each file are further recorded in the file allocation table 102. Recording whether each cluster is completely used or whether the data in the cluster is valid data or not, and forming cluster chain information by taking the entry content corresponding to the initial cluster in the file allocation table as the number of the next cluster under the condition that the file occupies a plurality of clusters.
Since there may be a plurality of files in a cluster, it is also necessary to create an index document (see fig. 2) in the cluster, and index information of all files in the cluster is recorded in the index document. The index information at least includes information such as a file name, a file size, and an offset position of the file in the cluster (see fig. 3), so as to accurately locate the storage location of each file in the cluster. A fixed size of storage space may be allocated at the cluster start position for storing the index document. In other embodiments, the index information of each file in the index document may be stored in the first fixed storage space of the storage location of the file, or may be set by those skilled in the art according to actual situations. By indexing the documents, information of each file in the cluster can be recorded, and the files can be conveniently searched and read.
When the smallest read-write unit of the memory is a storage block, the size of each cluster may be equal to the storage block, and at this time, when multiple files are stored in the cluster, the multiple files may be stored into multiple storage pages or a single storage page of the stored block according to the size of a specific file. For example, when the size of a storage block is 24 kbytes and 3 storage pages, and files to be stored are 1.5K of file1, 6.5K of file2, 5.5K of file3 and 10.5K of flash 4 respectively, 1.5K of file1 and 6.5K of file2 can be stored in the same storage page, and 5.5K of file3 and 10.5K of flash 4 can be stored in two adjacent storage pages, and the four files in the cluster can be stored in the same storage block, so that when the data files in the cluster are stored and deleted, the data storage and deletion of the whole storage block can be achieved, the storage characteristics of the current flash memory are better met, and the storage, reading and deletion speeds of the data can be increased. Similarly, under this kind of situation, a root directory may be established first to record the first cluster number of the file, and an index document may be established to record index information of all files in the cluster to read the above flow and method.
The following describes the file management method of the file management system according to the present invention in detail for various situations.
Please refer to fig. 4, which is a flowchart illustrating a file storage process in a file management method according to an embodiment of the present invention.
The file storage method comprises the following steps:
and S101, acquiring the use condition of each cluster through the file allocation table, and acquiring the residual storage space of each cluster.
The file allocation table records the use condition of each cluster, whether the cluster is full of storage, whether the data in the cluster is valid, and the like. And searching a cluster in which the data is valid and is not stored fully, and scanning the index document in the cluster to determine the size of the residual space which is not stored in the cluster. In one embodiment, when the size of the file to be stored is smaller than the cluster size, a used but not full cluster can be preferentially found; when the size of the file to be stored is larger than the cluster size, firstly searching a blank cluster, then taking the size of the part of the data of the stored file exceeding the integral multiple of the cluster size as target data, and searching an unfilled cluster.
Step S102: and finding a target cluster with the residual space larger than and closest to the file to be stored.
The cluster with the residual space closest to the file (or target data) to be stored is preferentially selected as the target cluster, so that the residual space in each cluster is fully utilized. For example, the sum of the sizes of the written files to be stored is 1.5k, and if a plurality of clusters are found to have residual spaces of 2k, 1.6k and 1.4k, respectively, the cluster with the residual space of 1.6k is selected as the target cluster.
Or, when the file is stored, the file to be stored may be temporarily cached until the sum of the sizes of the plurality of files to be stored cached in the plurality of storage operations is equal to or close to the size of the remaining space of the target cluster. And then, storing the plurality of files to be stored which need to be stored at this time at one time. For example: when the size of the file a to be stored is 1.5k and the size of the determined target cluster is 8k, the file a to be stored may be cached in the cache unit or stored in another module, and then the file B to be stored next time is waited, for example, when the size of the file B to be stored is 6.5k, the file a to be stored and the file B to be stored may be stored together. And when the size of the file B to be stored is 2.5k, the file B can be continuously cached in the cache unit, and the file C to be stored or more files can be continuously waited for, and the storage is carried out until the sum of the sizes of the files to be stored is close to or equal to the size of the target cluster.
Step S103: and copying the file in the target cluster, and storing the copied file and the file to be stored in the new blank cluster.
Taking NAND Flash as an example, since data cannot be directly written into a storage area in which data is written, in this embodiment, a file in a target cluster may be copied into a memory, the file is modified (i.e., a new file or target data is added), and then the file is written into a blank cluster from the memory.
When the file to be stored is larger than the cluster space, the file is preferentially and sequentially stored in a plurality of blank clusters, and the residual target data which is less than one cluster size is written into the target cluster by adopting the method.
When there are many files in the file system, it may not be possible to find a blank cluster for transferring the stored data, at this time, the data in the block where the target cluster is located may be erased to obtain a blank cluster, and then the data in the block and the new file are written into the block again. How to erase data will be described in detail in the following embodiments, and will not be described herein again.
And step S104, updating the related information in the root directory and the file allocation table.
The updated content includes at least: marking the copied data in the target cluster as invalid, and/or modifying the first cluster number of the corresponding file in the root directory, and/or modifying the use condition of the corresponding cluster in the file allocation table.
When the file in the target cluster is copied and written into other clusters together with the file to be stored, the data is marked as invalid in the file allocation table, and the data in the cluster can be deleted through an erasing operation if necessary. Meanwhile, it is also necessary to update information such as the cluster number of the new cluster in which the file is located, the use state of the cluster, etc. in the update directory and the file allocation table, and to form a new index document in the cluster, etc.
Please refer to fig. 5, which is a flowchart illustrating a file reading method in the file management method according to an embodiment of the present invention.
The method for reading the file further comprises the following steps:
step S201, a first cluster number of a file to be read is obtained according to a root directory, and then a cluster of the file to be read is located according to the file allocation table.
A single file may correspond to one or more clusters due to different file sizes. When a cluster contains a plurality of files, the first cluster number of the file to be read is read through the root directory, and then the cluster of the file to be read is positioned according to the file allocation table.
Step S202, when the cluster comprises a plurality of files, scanning the index document in the cluster, acquiring the specific storage position of the file to be read according to the index information, and reading.
When the cluster where the file to be read is located, the index document of the file stored in the cluster is scanned or read, referring to fig. 3, the specific storage location of the file to be read can be obtained through the index document, and the file such as file1 can be read.
As an optional implementation manner, the index document may not be created in the cluster where the file is located, and at this time, referring to fig. 6, the file reading method includes the following steps:
and S301, acquiring the first cluster number of the file to be read according to the root directory, and positioning the cluster of the file to be read according to the file allocation table.
Step S302, when the cluster includes a plurality of files, reading all the files in the cluster where the files to be read are located.
Step S302, identifying the file names of all the files, and further determining the files to be read
When reading the files, all the files in the cluster are directly read, and then the file names of a plurality of files are analyzed to carry out file identification, so that the files to be read are read. For example: when there is file1 in the cluster: anf, file 2: bh, bic, file 3: bio and flie 4: when w.bx, file1, file2, file3 and file4 may be read first, and then the file1 to be read with the file name sh.anf is identified by identifying the file names sh.anf, who.bic, wo.bie and w.bx, and the file is read.
Referring to fig. 7, a flowchart of a file deleting (erasing) method in the file management method according to an embodiment of the invention is shown.
The file deletion method further comprises the following steps:
step S401, according to the root directory and the file allocation table, locating a cluster where a file to be deleted is located and a block to be erased where the cluster is located.
Since the erase operation of the NAND flash can be performed only for the entire block, it needs to be first located to the block where the erase operation needs to be performed. The file to be deleted may occupy one cluster or occupy multiple clusters simultaneously, and one or more blocks where one or more clusters occupied by the file to be deleted are located are used as blocks to be erased.
And S402, copying the file in the block to be erased into a memory, and modifying the file in the memory.
The modification of the file in the memory comprises the deletion operation of the file to be deleted.
In step S403, all data in the block to be erased are erased.
And carrying out erasing operation on the whole erasing block and emptying all data. Since other valid files in the block have already been copied into memory, the erase operation does not result in the loss of valid data.
And S404, writing the modified file in the memory into the erased block again.
The file can be rewritten into the corresponding cluster according to the file storage location before the erasure. In this case, it is only necessary to update the relevant information of the deleted file in the update list, the file allocation table, and the index document.
In other embodiments, the storage location of the file may be readjusted according to the size of each file, so as to store as many files as possible in a single cluster, improve the utilization rate of the storage space in the cluster, and avoid the waste of the storage space due to the deletion of the file. In this case, it is necessary to update a large amount of data for the update directory, the file allocation table, and the index document while changing the storage location of the file.
In another embodiment, other files in the block to be erased can be copied to blank clusters of other blocks, the cluster in which the file to be deleted is located is marked as invalid, and erasing can be performed when needed subsequently. Therefore, the erasing frequency of the memory block can be reduced as much as possible, and the service life of the memory can be prolonged.
And updating the related information of the root directory, the file allocation table and the index document according to the movement of the storage position of the file while finishing the operation.
An embodiment of the present invention further provides an apparatus, where the apparatus includes any one of the file management systems in the above embodiments, and further includes a microprocessor and a memory, where the memory stores therein a computer program that can be executed by the processor; the computer program, when executed, is capable of performing the file management method as described in the above embodiments.
The above-mentioned embodiments are only examples of the present application, and not intended to limit the scope of the present application, and all equivalent structures or equivalent flow transformations made by the contents of the specification and the drawings, such as the combination of technical features between the embodiments and the direct or indirect application to other related technical fields, are also included in the scope of the present application.

Claims (17)

1. The file management system is characterized by comprising a storage space, wherein the storage space comprises a reserved area, a file allocation area and a data area, the data area comprises at least one cluster, and at least two files are contained in the cluster.
2. The file management system according to claim 1, wherein the data area includes a root directory, the root directory is configured to record a first cluster number where the file is located, the file allocation area includes a file allocation table, and the file allocation table is configured to record a use condition of a cluster corresponding to the file and cluster chain information corresponding to each file.
3. The file management system according to claim 1, wherein said file cluster contains an index document for recording index information of all files in said cluster.
4. The file management system according to claim 3, wherein the index information includes at least a file name, a file size, and an offset position of the file within the cluster.
5. The file management system according to claim 1, wherein the size of the cluster is equal to the size of the smallest read-write unit of the memory chip.
6. The file management system according to claim 5, wherein the memory chip is a NAND Flash, and the size of each cluster is the size of a memory page.
7. The file management system according to claim 5, wherein the memory chip is a NAND Flash, and the size of each cluster is the size of a memory block.
8. A file management method of a file management system, comprising:
the storage space is divided into: a reserved area, a file allocation table and a data area;
performing data management in the data area by taking a cluster as a unit;
more than two files are stored in a single cluster, as permitted by the cluster space.
9. The file management method according to claim 8, further comprising:
establishing a root directory in the data area for recording the first cluster number of the file;
and recording the use condition of the cluster corresponding to the file and the cluster chain information corresponding to each file in the file allocation table.
10. The file management method according to claim 9, further comprising:
and establishing an index document in the cluster in which the files are stored, and recording index information of all the files in the cluster in the index document.
11. The file management method according to any one of claims 8 to 10, wherein the file management comprises file storage, and the file storage method further comprises:
acquiring the use condition of each cluster through the file allocation table, and acquiring the residual storage space of each cluster;
searching a target cluster with a residual space larger than and closest to a file to be stored;
copying the file in the target cluster, and storing the file and the file to be stored in a new blank cluster;
updating the related information in the root directory and the file allocation table, and at least comprising:
marking the copied data in the target cluster as invalid, and/or modifying the first cluster number of the corresponding file in the root directory, and/or modifying the use condition of the corresponding cluster in the file allocation table.
12. The file management method according to any one of claims 8 to 10, wherein the file management comprises file storage, and the file storage method further comprises:
acquiring the use condition of each cluster through the file allocation table, and determining a target cluster according to the use condition of the cluster;
caching the files to be stored, copying files in a target cluster when the sum of the sizes of the files to be stored is close to the size of the target cluster, communicating the files to be stored and writing the files into a blank cluster;
and updating the related information in the root directory and the file allocation table.
13. The file management method according to any one of claims 8 to 10, wherein the file management includes performing file reading, and the file reading method further includes:
acquiring a first cluster number of a file to be read according to a root directory, and positioning a cluster of the file to be read according to the file allocation table;
when the cluster comprises a plurality of files, scanning the index document in the cluster, acquiring the specific storage position of the file to be read according to the index information, and reading.
14. The file management method according to any one of claims 8 to 10, wherein the file management includes performing file reading, and the file reading method further includes:
acquiring a first cluster number of a file to be read according to a root directory, and positioning a cluster of the file to be read according to the file allocation table;
when the cluster comprises a plurality of files, reading all the files in the cluster of the files to be read;
and identifying the file names of all the files, and further determining the files to be read.
15. The file management method according to any one of claims 8 to 10, wherein the file management comprises file deletion, and the file deletion method further comprises:
according to the root directory and the file allocation table, locating a cluster where a file to be deleted is located and a block to be erased where the cluster is located;
copying other files in the block to be erased to the memory;
and after all the data in the block to be erased are erased, writing each file into the erased block.
16. The file management method according to any one of claims 8 to 10, wherein the file management comprises file deletion, and the file deletion method further comprises:
according to the root directory and the file allocation table, locating a cluster where a file to be deleted is located and a block to be erased where the cluster is located;
copying other files in the block to be erased to blank clusters of other blocks;
and marking the data in the cluster of the file to be deleted as invalid.
17. An apparatus comprising a file management system as claimed in any one of claims 1 to 7, a microprocessor and a memory; a computer program stored in the memory and executable by the processor; or which when executed is capable of performing a file management method as claimed in any one of claims 8 to 16.
CN202110473580.6A 2021-04-29 2021-04-29 File management system and file management method and device thereof Pending CN114610228A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110473580.6A CN114610228A (en) 2021-04-29 2021-04-29 File management system and file management method and device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110473580.6A CN114610228A (en) 2021-04-29 2021-04-29 File management system and file management method and device thereof

Publications (1)

Publication Number Publication Date
CN114610228A true CN114610228A (en) 2022-06-10

Family

ID=81857676

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110473580.6A Pending CN114610228A (en) 2021-04-29 2021-04-29 File management system and file management method and device thereof

Country Status (1)

Country Link
CN (1) CN114610228A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115952140A (en) * 2023-01-09 2023-04-11 弘泰信息技术(天津)有限公司 Computer resource management system and method based on big data

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115952140A (en) * 2023-01-09 2023-04-11 弘泰信息技术(天津)有限公司 Computer resource management system and method based on big data
CN115952140B (en) * 2023-01-09 2023-10-27 华苏数联科技有限公司 Big data-based computer resource management system and method

Similar Documents

Publication Publication Date Title
US7610434B2 (en) File recording apparatus
US7877569B2 (en) Reduction of fragmentation in nonvolatile memory using alternate address mapping
JP3708047B2 (en) Managing flash memory
US8386746B2 (en) Storage unit management methods and systems
US7669003B2 (en) Reprogrammable non-volatile memory systems with indexing of directly stored data files
US7395384B2 (en) Method and apparatus for maintaining data on non-volatile memory systems
US7949845B2 (en) Indexing of file data in reprogrammable non-volatile memories that directly store data files
US8180956B2 (en) Method for controlling memory card and method for controlling nonvolatile semiconductor memory
US7594062B2 (en) Method for changing data of a data block in a flash memory having a mapping area, a data area and an alternative area
US7752412B2 (en) Methods of managing file allocation table information
US7681008B2 (en) Systems for managing file allocation table information
JP4738038B2 (en) Memory card
EP3752905B1 (en) Append only streams for storing data on a solid state device
KR20070060070A (en) Fat analysis for optimized sequential cluster management
JPWO2007066720A1 (en) Nonvolatile storage device, data read method, and management table creation method
JP2006040264A (en) Control method of memory card, and control method of nonvolatile semiconductor memory
US20050169058A1 (en) Data management apparatus and method used for flash memory
KR20080038368A (en) Indexing of file data in reprogrammable non-volatile memories that directly store data files
JP4130808B2 (en) Formatting method
US20180232154A1 (en) Append Only Streams For Storing Data On A Solid State Device
CN114610228A (en) File management system and file management method and device thereof
WO2008042594A1 (en) Managing file allocation table information
US8782353B2 (en) Information processing device having data field and operation methods of the same
JP2008134777A (en) Caching method of file allocation table

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