FAT file system and electronic device

By introducing a first file data area and a second file data area into the FAT file system, the fragmentation problem was solved, and file read/write speed and compatibility were improved.

CN115408343BActive Publication Date: 2026-01-27FUZHOU ROCKCHIP SEMICON
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110593864.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-28
Publication Date
2026-01-27
Estimated Expiration
2041-05-28

AI Technical Summary

Technical Problem

The existing FAT file system suffers from severe fragmentation, resulting in slow file read and write speeds.

Method used

The system adopts a structural design that includes a first file data area and a second file data area. The first file data area is used to store files of the same size, and the second file data area is used to store files of any size. The system also improves file access efficiency by continuously configuring parameter areas, directory areas, and data areas.

Benefits of technology

It effectively reduces file fragmentation, improves file read and write speeds, and maintains good compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115408343B_ABST
    Figure CN115408343B_ABST
Patent Text Reader

Abstract

The application provides a FAT file system and an electronic device, the FAT file system comprises a hidden area and a data area, the data area comprises a parameter area, a directory area, a first file data area and a second file data area, wherein: the hidden area comprises a boot area and a FAT table; the parameter area is used for storing start and end address information and a macro block size of the directory area, the first file data area and the second file data area; the directory area is used for storing folder information and file information; the first file data area comprises at least one first file storage area with a preset size, each first file storage area is used for storing a first file with a matching size; the second file data area comprises at least one second file storage area, the size of each second file storage area is the same as the macro block size, and an integer multiple of the second file storage areas is used for storing a second file with any size. The FAT file system can reduce the number of file fragments, and thus has a higher file read-write rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a file system, and more particularly to a FAT file system and an electronic device. Background Technology

[0002] A file system is an essential part of an operating system, used to organize and allocate space on file storage devices, and responsible for file storage, protection, and retrieval. Common file systems include FAT (File Allocation Table) and NTFS (New Technology File System). Among these, FAT is widely used because it is supported by the vast majority of operating systems and is suitable for data exchange between different operating systems. However, the existing FAT file system suffers from severe fragmentation. When multiple files are written simultaneously, or after multiple file deletions and creations, a large amount of fragmentation occurs in the FAT file system, and the more fragmentation there is, the slower the file read and write speed becomes. Summary of the Invention

[0003] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a FAT file system and electronic device to solve the problem of severe fragmentation in the existing FAT file system.

[0004] To achieve the above and other related objectives, a first aspect of the present invention provides a FAT file system, the FAT file system comprising a hidden area and a data area, the data area comprising a parameter area, a directory area, a first file data area, and a second file data area, wherein: the hidden area comprises a boot sector and a FAT table; the parameter area is used to store the start and end address information of the directory area, the start and end address information of the first file data area, the start and end address information of the second file data area, and the macroblock size; the directory area is used to store folder information and file information; the first file data area comprises at least one first file storage area of ​​a preset size, each first file storage area being used to store a first file with a matching size; the second file data area comprises at least one second file storage area, the size of each second file storage area being the same as the macroblock size, and an integer number of second file storage areas being used to store a second file with any size.

[0005] In one embodiment of the first aspect, each of the first file storage areas pre-stores a placeholder file.

[0006] In one embodiment of the first aspect, for any of the first file storage areas, when the first file storage area is used to store a first file, the data in the first file is written into a placeholder file in the first file storage area, and the name of the placeholder file in the first file storage area is configured to be the same as that of the first file.

[0007] In one embodiment of the first aspect, for any of the first file storage areas, when the first file storage area is not used to store the first file, a placeholder file in the first file storage area is hidden and its name is configured to a default name.

[0008] In one embodiment of the first aspect, when the second file data area is used to store a second file, the second file is divided into at least one data block, the size of each data block is less than or equal to the macroblock size, and each data block is stored in a different second file storage area.

[0009] In one embodiment of the first aspect, after the second file is segmented, only one of the data blocks has a size smaller than the macroblock size.

[0010] In one embodiment of the first aspect, the parameter area, the directory area, the first file data area, and / or the second file data area are contiguous spaces.

[0011] A second aspect of the present invention provides another FAT file system, the FAT file system including a hidden area and a data area, the data area including a parameter area, a directory area and a first file data area, wherein: the hidden area includes a boot sector and a FAT table; the parameter area is used to store the start and end address information of the directory area and the start and end address information of the first file data area; the directory area is used to store folder information and file information; the first file data area includes at least one first file storage area of ​​a preset size, each of the first file storage areas being used to store a first file with a matching size.

[0012] A third aspect of the present invention provides yet another FAT file system, the FAT file system comprising a hidden area and a data area, the data area comprising a parameter area, a directory area, and a second file data area, wherein: the hidden area comprises a boot sector and a FAT table; the parameter area is used to store the start and end address information of the directory area, the start and end address information of the second file data area, and the macroblock size; the directory area is used to store folder information and file information; the second file data area comprises at least one second file storage area, the size of each second file storage area is the same as the macroblock size, and an integer number of second file storage areas are used to store a second file having any size.

[0013] A fourth aspect of the present invention provides an electronic device comprising the FAT file system described in any one of the first aspects of the present invention, the FAT file system described in the third aspect of the present invention, or the FAT file system described in the fourth aspect of the present invention.

[0014] As described above, one technical solution of the FAT file system of the present invention has the following beneficial effects:

[0015] The FAT file system includes a first file data area and a second file data area. The first file data area includes at least one first file storage area of ​​a preset size, and each first file storage area is used to store a first file of a matching size, thus minimizing fragmentation in the first file storage area. The second file data area includes multiple second file storage areas of fixed sizes, and a second file of any size is stored using an integer number of second file storage areas, thus generating very little fragmentation in the second file data area. Therefore, the FAT file system can effectively reduce the amount of fragmentation, thereby improving file read and write speeds. Attached Figure Description

[0016] Figure 1 The diagram shown is a structural schematic of the FAT file system according to an embodiment of the present invention.

[0017] Figure 2 This is another structural diagram of the FAT file system described in an embodiment of the present invention.

[0018] Figure 3 This is another structural diagram of the FAT file system described in an embodiment of the present invention.

[0019] Component designation explanation

[0020] 1. FAT file system

[0021] 11 Hidden Area

[0022] 111 Guide Area

[0023] 112 FAT Table

[0024] 12 Data Area

[0025] Parameter area 121

[0026] 122 Directory Area

[0027] 123 First File Data Area

[0028] 124 Second File Data Area

[0029] 2 FAT file system

[0030] 21 Hidden Area

[0031] 211 Guide Area

[0032] 212 FAT Table

[0033] 22 Data Area

[0034] 221 Parameter Area

[0035] 222 Directory Area

[0036] 223 First File Data Area

[0037] 3. FAT file system

[0038] 31 Hidden Area

[0039] 311 Guiding Area

[0040] 312 FAT Table

[0041] 32 Data Area

[0042] 321 Parameter Area

[0043] 322 Directory Area

[0044] 323 Second File Data Area Detailed Implementation

[0045] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0046] It should be noted that the illustrations provided in the following embodiments are merely schematic representations of the basic concept of the present invention. The illustrations only show components relevant to the present invention and are not drawn according to the actual number, shape, and size of the components in implementation. In actual implementation, the form, quantity, and proportion of each component can be arbitrarily changed, and the component layout may also be more complex. Furthermore, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0047] The existing FAT file system suffers from severe fragmentation. When multiple files are written simultaneously, or after multiple file deletions and creations, a large amount of fragmentation occurs in the FAT file system, and the more fragmentation, the slower the file read and write speed. To address this problem, this invention provides a FAT file system comprising a first file data area and a second file data area. The first file data area includes at least one first file storage area of ​​a preset size, and each first file storage area is used to store a first file of a matching size, thus minimizing fragmentation in the first file storage area. The second file data area includes multiple second file storage areas of fixed sizes, and a second file of any size is stored using an integer number of second file storage areas, thus generating very little fragmentation in the second file data area. Therefore, the proposed FAT file system effectively reduces the amount of fragmentation, thereby improving file read and write speeds.

[0048] Please see Figure 1 In one embodiment of the present invention, the FAT file system includes a hidden area 11 and a data area 12. The data area 12 includes a parameter area 121, a directory area 122, a first file data area 123, and a second file data area 124. The size of each area can be preset according to actual needs.

[0049] The hidden area 11 includes a guide area 111 and a FAT table 112, wherein the FAT table 112 includes FAT table 1 and FAT table 2, and the contents of the two are exactly the same.

[0050] The parameter area 121 is used to store the start and end address information of the directory area 122, the start and end address information of the first file data area 123, the start and end address information of the second file data area 124, and a macroblock size. The macroblock size is a preset value and can be set according to actual needs in specific applications.

[0051] The directory area 122 is used to store folder information and file information. In this embodiment, the directory area 122 stores folder information and file information of the root directory, directory 1... directory N1, where N1 is a positive integer.

[0052] Preferably, the directory area 122 is a continuous space, thereby improving the speed of obtaining folder information and file information.

[0053] The first file data area 123 includes a first file storage area 1, a first file storage area 2, ..., a first file storage area N2 of a preset size, where N2 is a positive integer. The size of each of the first file storage areas may be the same or different, and the size of each of the first file storage areas can be specified during quick formatting or after quick formatting is completed.

[0054] Each of the first file storage areas is used to store a first file with a matching size. For example, if the size of the first file storage area 1 is Size1 and the size of the first file storage area 2 is Size2, and a first file A matches the size of the first file storage area 2 but does not match the size of the first file storage area 1, then the first file A can be stored in the first file storage area 2 but cannot be stored in the first file storage area 1.

[0055] For example, assuming the cluster size of the FAT file system is 64KB and the size of a first file B is 190MB, if there is a first file storage area b with a preset size of 190MB in the first file data area 123, then the first file B can be directly stored in the first file storage area b without any fragmentation. If the first file B is stored in a standard FAT32 file system using existing technology, in the worst case, the first file B may be split into 190MB*1024 / 64KB = 3040 blocks, which will generate a large number of fragments in the file system, thereby slowing down the file read and write speed.

[0056] It should be noted that matching the size of the first file with the size of the first file storage area means that their sizes are the same or approximately the same. When their sizes are exactly the same, the first file storage area will not generate file fragmentation. If the file fragmentation caused by the difference in their sizes is within an acceptable range for the user, they can be considered approximately the same. In this way, the first file data area 123 will basically not generate file fragmentation during use, thus achieving a high file read and write speed.

[0057] The second file data area 124 includes a second file storage area 1, a second file storage area 2, ..., a second file storage area N3, where N3 is a positive integer. The size of each second file storage area is the same as the macroblock size, and an integer number of second file storage areas are used to store a second file of any size. For example, if the size of a second file is greater than the macroblock size but less than or equal to twice the macroblock size, then two second file storage areas can be used to store the second file.

[0058] Optionally, when the second file data area 124 is used to store a second file, the second file is divided into at least one data block, the size of each data block being less than or equal to the macroblock size, and each block being stored in a second file storage area. When the second file data area 124 does not need to store files, the files can be deleted, thus the second file data area 124 can be used cyclically.

[0059] Preferably, in the data blocks obtained by splitting the second file, there is one and only one data block whose size is smaller than the macroblock size, while the sizes of the remaining data blocks are the same as the macroblock size. In this case, even if multiple files are written simultaneously, or files are deleted and created multiple times, the fragments in the second file data area 124 will always remain less than or equal to the quotient of the file size and the macroblock size.

[0060] For example, if the cluster size of the FAT file system is 64KB, the macroblock size is 20MB, and a second file C is 190MB in size, when storing the second file C in the second file data area 124, due to the need for 20MB alignment, the actual space occupied by the second file C must be greater than or equal to 190MB and must be an integer multiple of 20MB. Therefore, the second file C is divided into nine 20MB data blocks and one 10MB data block, and the ten data blocks are stored in ten different second file storage areas. In this case, the second file C is only divided into ten blocks. If the second file C is stored in the standard FAT32 file system using existing technology, in the worst case, the second file C may be divided into 190MB * 1024 / 64KB = 3040 blocks, which will generate a large number of fragments in the file system, thereby slowing down the file read and write speed.

[0061] As described above, the FAT file system 1 in this embodiment includes a first file data area 123 and a second file data area 124. The first file data area 123 is suitable for storing files of relatively fixed size, and includes at least one first file storage area of ​​a preset size. When a first file is stored in the first file data area, file fragmentation is minimal. The second file data area 124 is suitable for storing files of relatively variable size, and includes at least one second file storage area of ​​the same size. When a second file is stored in the second file data area, only a small amount of file fragmentation is generated. Furthermore, even with repeated file deletion and creation, the file fragmentation in the second file data area remains less than or equal to the quotient of the file size and the macroblock size. Therefore, the FAT file system 1 in this embodiment can effectively reduce file fragmentation, thereby improving file read and write speeds.

[0062] Furthermore, in this embodiment, allocating a contiguous space to the directory area can improve the speed of obtaining directory information, thereby further enhancing the file read and write speed.

[0063] Furthermore, this embodiment only extends and improves the data area of ​​the FAT file system, thus having good compatibility.

[0064] It should be noted that the first file and the second file are only used to identify the files stored in the first file data area and the second file data area, and there is no difference between them in essence. The first file can also be stored in the second file data area 124, and the second file with a specific size can also be stored in the first file data area 123.

[0065] In one embodiment of the present invention, each of the first file storage areas pre-stores a placeholder file, and the size of each first file storage area is the same as the size of the placeholder file it stores. Specifically, if it is known that files of certain specific sizes are needed, placeholder files of the specific sizes can be pre-created in the first file data area 123 during quick formatting, or immediately after quick formatting is completed, and the storage space of each placeholder file is the first file storage area. This method allows the device to configure contiguous storage space for each placeholder file, so that fragmentation is basically not generated when the first file data area is used to store the first file.

[0066] Optionally, for any of the first file storage areas d, when the first file storage area d is used to store a first file D, the data in the first file D is written into a placeholder file in the first file storage area d, and the name of the placeholder file in the first file storage area d is configured to be the same as that of the first file D, thereby realizing the storage of the first file D.

[0067] Optionally, for any of the first file storage areas e, when the first file storage area e is not used to store the first file, the placeholder file in the first file storage area e is hidden, and the name of the placeholder file in the first file storage area e is configured to a default name.

[0068] In one embodiment of the present invention, the parameter area, the directory area, the first file data area, and / or the second file data area are contiguous spaces. This embodiment, by configuring the parameter area, the directory area, the first file data area, and / or the second file data area as contiguous spaces, can further improve the file read / write speed.

[0069] This invention also provides another FAT file system. See [link to FAT file system]. Figure 2In one embodiment of the present invention, the FAT file system 2 includes a hidden area 21 and a data area 22, wherein the data area 22 includes a parameter area 221, a directory area 222, and a first file data area 223. The hidden area 21 includes a boot area 211 and a FAT table 212. The parameter area 221 is used to store the start and end address information of the directory area 222 and the start and end address information of the first file data area 223. The directory area 222 is used to store folder information and file information. The first file data area 223 includes at least one first file storage area of ​​a preset size, and each first file storage area is used to store a first file with a matching size.

[0070] In this embodiment, the structure and function of the hidden area 21, the data area 22, the parameter area 221, the directory area 222, and the first file data area 223 are the same as those of the hidden area 21, the data area 22, the parameter area 221, the directory area 222, and the first file data area 223. Figure 1 The hidden area 11, data area 12, parameter area 121, directory area 122 and the first file data area 123 shown are the same, and will not be described in detail here.

[0071] This invention also provides yet another FAT file system. See [link to FAT file system]. Figure 3 In one embodiment of the present invention, the FAT file system 3 includes a hidden area 31 and a data area 32. The data area 32 includes a parameter area 321, a directory area 322, and a second file data area 323. The hidden area 31 includes a boot area 311 and a FAT table 312. The parameter area 321 is used to store the start and end address information of the directory area 322, the start and end address information of the second file data area 323, and the macroblock size. The directory area 322 is used to store folder information and file information. The second file data area 323 includes at least one second file storage area. The size of each second file storage area is the same as the macroblock size, and an integer number of second file storage areas are used to store a second file with any size.

[0072] In this embodiment, the structure and function of the hidden area 31, the data area 32, the parameter area 321, the directory area 322, and the second file data area 323 are the same as those of the hidden area 31, the data area 32, the parameter area 321, the directory area 322, and the second file data area 323. Figure 1 The hidden area 11, data area 12, parameter area 121, directory area 122, and second file data area 124 shown are the same, so we will not go into details here.

[0073] The present invention also provides an electronic device, the electronic device comprising: Figure 1 , Figure 2 or Figure 3 The aforementioned FAT file system.

[0074] The FAT file system described in this embodiment of the invention includes a first file data area and a second file data area, wherein: the first file data area hardly generates fragments, and the second file data area only generates a small number of file fragments. Compared with the prior art, the FAT file system described in this embodiment of the invention can greatly reduce the number of file fragments, thereby improving the file read and write speed.

[0075] Furthermore, the FAT file system described in this embodiment of the invention can configure the directory area as a contiguous space, thereby further improving the file read and write speed.

[0076] Furthermore, the embodiments of the present invention only require expansion and improvement of the data area of ​​the FAT file system, thus exhibiting good compatibility. Memory configured with the FAT file system described in the embodiments of the present invention can be directly applied to devices that support the standard FAT file system.

[0077] In summary, this invention effectively overcomes the various shortcomings of the prior art and has high industrial application value.

[0078] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A FAT file system, characterized in that, The FAT file system includes a hidden area and a data area. The data area includes a parameter area, a directory area, a first file data area, and a second file data area, wherein: The hidden area includes the boot sector and the FAT table; The parameter area is used to store the start and end address information of the directory area, the start and end address information of the first file data area, the start and end address information of the second file data area, and the macroblock size; The directory area is used to store folder information and file information; The first file data area includes at least one first file storage area of ​​a preset size, and each of the first file storage areas is used to store a first file with a matching size; The second file data area includes at least one second file storage area, each of which has the same size as the macroblock size, and an integer number of the second file storage areas are used to store a second file with any size.

2. The FAT file system according to claim 1, characterized in that: Each of the first file storage areas pre-stores a placeholder file.

3. The FAT file system according to claim 2, characterized in that: For any of the first file storage areas, when the first file storage area is used to store a first file, the data in the first file is written into a placeholder file in the first file storage area, and the name of the placeholder file in the first file storage area is configured to be the same as that of the first file.

4. The FAT file system according to claim 2, characterized in that: For any of the first file storage areas, when the first file storage area is not used to store the first file, hide the placeholder file in the first file storage area and configure its name to the default name.

5. The FAT file system according to claim 1, characterized in that: When the second file data area is used to store a second file, the second file is divided into at least one data block, the size of each data block is less than or equal to the macroblock size, and each data block is stored in a different second file storage area.

6. The FAT file system according to claim 5, characterized in that: After the second file is segmented, only one of the data blocks is smaller than the macroblock size.

7. The FAT file system according to claim 1, characterized in that: The parameter area, the directory area, the first file data area, and / or the second file data area are contiguous spaces.

8. A FAT file system, characterized in that, The FAT file system includes a hidden area and a data area. The data area includes a parameter area, a directory area, and a file data area, wherein: The hidden area includes the boot sector and the FAT table; The parameter area is used to store the start and end address information of the directory area, the start and end address information of the file data area, and the macroblock size; The directory area is used to store folder information and file information; The file data area includes at least one file storage area, each of which has the same size as the macroblock size, and an integer number of the file storage areas are used to store a file of any size.

9. An electronic device, characterized in that: The electronic device includes the FAT file system as described in any one of claims 1-8.

Citation Information

Patent Citations

  • File system data management method and system

    CN102253985A

  • Data storage method for monitoring device

    CN103345477A