Fast file system applied to embedded hardware

By adopting a fast file system with dual partition design in embedded hardware, the problems of file system complexity and crash corruption in the prior art are solved, and simple, small space-consuming and stable file management is achieved.

CN119847990APending Publication Date: 2025-04-18航天银山电气有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510007280.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

Existing file systems have complexity in embedded hardware and are prone to corruption of file systems when system crashes or power supply is interrupted.

Method used

A fast file system with a dual-partition design is used. The file allocation area is responsible for storing file names, file sizes, data area addresses, file data areas store file contents, and pre-dividing partitions according to the number and size of files when creating a file system to ensure that the file system does not cause corruption in any case.

Benefits of technology

A simpler file management solution is implemented, with a small amount of code and less space, suitable for embedded hardware, and the file system corruption caused by interrupts is avoided through pre-allocation design.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847990A_ABST
    Figure CN119847990A_ABST
Patent Text Reader

Abstract

The invention discloses a fast file system scheme applied to embedded hardware. Aiming at the characteristics of fixed storage size and few file directories of embedded hardware files, file management of a file system is simplified by adopting a file distribution area and a data area. The fast file system is divided into a file distribution area and a file data area. The file distribution area records a file name, the maximum file capacity and a file data area address. The file data area stores actual file content. In order to solve the problem that the file system is damaged due to sudden power failure during reading and writing of a common file system, the file distribution area is solidified according to the file number and the maximum capacity in the created file system in a pre-distribution mode, and the situation that the whole file system is damaged due to accidental interruption of file writing operation is avoided. According to the fast file system, file retrieval and file data area positioning can be accelerated through a method for hiding file names and file data area addresses. The method is simple in structure and suitable for embedded hardware.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to file storage, and is mainly aimed at file storage of embedded hardware. Background Art

[0002] Existing file systems: (1) NTFS: NTFS is a journaling file system, which means that in addition to writing information to the disk, the file system also keeps a log of all changes that occur. This feature makes the NTFS file system easier to recover when errors occur (such as system crashes or power outages), and also makes the system more robust. In these cases, NTFS can quickly recover without losing any data. In the rare case of an error, Microsoft says the probability that you need to run the CHKDSK repair program to maintain the disk volume is extremely low, with a probability of less than 1%; (2) EXT4: The Ext3 file system uses 32-bit space to record the number of blocks and i-nodes, while the Ext4 file system expands them to 64 bits. When data is written to the Ext3 file system, the Ext3 data block allocator can only allocate a 4KB block at a time. If you write a 100MB file, you have to call the data block allocator 25,600 times. The Ext4 multiblock allocator "Multiblock Allocator (MBAlloc)" supports allocating multiple data blocks in one call; (3) FatFs is a general file system (FAT / exFAT) module used to implement FAT file system in small embedded systems. The FatFs component is written in accordance with ANSI C (C89) and is completely separated from the disk I / O layer, so it is not dependent on the hardware platform. It can be embedded in microcontrollers with limited resources, such as 8051, PIC, AVR, ARM, Z80, RX, etc., without any modification. Summary of the invention

[0003] In view of the fact that the above file system is too complicated, the fast file system adopts a two-partition design, one is the file allocation area and the other is the file data area.

[0004] In view of the fact that the above-mentioned file system is easily damaged when the system crashes or the power supply is interrupted, the fast file system adopts a pre-allocation design to ensure that the file system will not be damaged in any situation.

[0005] The file allocation area is pre-divided according to the maximum number of files.

[0006] Divide the file data area in advance according to the maximum space occupied by the file.

[0007] The technical solution adopted by the present invention is: The fast file system adopts a dual partition design. The file allocation area is responsible for storing the file name, file size, and data area address. The file data area stores the file content; The pre-allocation mode is adopted for the file system for embedded use scenarios. When creating the file system, the file allocation area and file data area are divided according to the number and size of files; When the file system is started, the file allocation area is read and loaded into the memory. The file data area can be directly accessed through the data area address in the memory; When writing a file, if the file size changes, you only need to update the corresponding data block in the file allocation area. If a sudden power failure occurs during file operation, it will only affect the update of the data block in the current file allocation area, thus avoiding damage to the entire file system.

[0008] Effects of the present invention: A simpler file management solution is adopted, and the entire file system implementation code is extremely small, reducing the space occupied by the program. The file system occupies very little memory, and 400 files occupy 200KB of memory, which is more suitable for embedded hardware. File access is accelerated through caching. The file pre-allocation design can avoid damage to the entire file system due to accidental interruptions when modifying files. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 This is a schematic diagram of the file system storage structure.

[0010] Figure 2 A flowchart for creating and starting a file system. DETAILED DESCRIPTION

[0011] [Example 1] For a dashcam, use a 4G SD card. For example, create 400 files, each with a size of 10MB. Step 1: Divide the allocation area of ​​400 files in advance. Each file allocation area occupies 512 bytes, that is, this file allocation area occupies 200KB of space (400*512B = 200KB); Step 2: As each file occupies a maximum of 10MB, the data area address interval is 0x5000. Modify the file allocation area and write the data area address corresponding to each file. (One block of SD is 512B bytes, so 0x5000*512B = 10MB); Step 3: When the system starts, read the file allocation area to map the file name with the data area address; Step 4: When reading and writing files, the data area can be quickly accessed according to the mapping table. When the power is suddenly cut off during file reading and writing, the file allocation area and data area will not change as the file size increases or decreases, so the file system is protected.

Claims

1. A fast file system for embedded systems, characterized in that: The method comprises the following steps: Step 1, dividing the entire memory into a file allocation area and a data content area; Step 2, pre-allocate the file allocation area according to the number of files; Step 3, allocating data area according to the number of files and the maximum space occupied by the files; Step 4: The system starts traversing the file allocation area and establishes a mapping table of file names and data area addresses.

2. Step 5, the file data area can be quickly accessed based on the mapping table of the file name and data area address.

3. The embedded fast file system according to claim 1, characterized in that: Step 1 divides the entire memory into a file allocation area and a data content area.

4. The embedded fast file system according to claim 1, characterized in that: Step 2 pre-allocates the file allocation area according to the number of files.

5. The embedded fast file system according to claim 1, characterized in that: Step 3 allocates the data area according to the number of files and the maximum space occupied by the files.

6. The embedded fast file system according to claim 1, characterized in that: Step 4: The system starts traversing the file allocation area and establishes a mapping table of file names and data area addresses.

7. The embedded fast file system according to claim 1, characterized in that: Step 5: The file data area can be quickly accessed based on the mapping table of the file name and the data area address.

Citation Information

Cited By

  • File system management method based on pre-distribution and direct addressing and related device

    CN121681474A