Block mapping file system supporting data cycle recording and management method

By adopting a block-mapping DCBM file system that supports data cyclic recording in an aviation airborne environment, it solves the problem of difficult to meet the needs of high reliability, high flexibility and data cyclic recording in the prior art, and achieves high reliability and timeliness of massive data records.

CN119884027APending Publication Date: 2025-04-25CHINESE AERONAUTICAL RADIO ELECTRONICS RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411951730.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

Existing embedded file systems are difficult to meet the needs of high reliability, high flexibility and data cycle recording in aviation airborne environments, especially in abnormal situations such as power failure and hot-swap removal.

Method used

The block mapping DCBM file system that supports data loop recording is adopted, and the disk space is divided through the DOS partition specification and the main boot record setting principle, so as to realize the management of the data directory area, data file area, disk block mapping area and data unit area, and record the file system operation log through the hidden log partition.

Benefits of technology

It improves the reliability of massive data recording in airborne airborne environments, ensures the timeliness of recording data, simplifies the operation process of users actively freeing disk space, improves response speed, and provides a key technical route for the research and development of highly reliable file systems in airborne airborne embedded environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884027A_ABST
    Figure CN119884027A_ABST
Patent Text Reader

Abstract

The invention relates to the field of embedded operating systems, in particular to a block mapping file system supporting data cycle recording and a management method. According to the DCBM file system, a DOS partition specification is adopted, a disk space is divided according to a master boot record (MBR) setting principle, and the disk space is divided into a super block, a data directory area DDI, a DDI control area, a data file area DFI, a DFI control area, a disk block mapping area BBM, a data unit area DBU and a log area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of embedded operating systems, and in particular to a block mapping file system supporting data cycle recording and a management method. Background Art

[0002] The embedded file system is an important part of the embedded real-time operating system, used for mass data storage and management in embedded systems. By organizing and managing user files on storage devices or partitions, the embedded file system is responsible for providing methods and software interfaces for users to create, read, write, retrieve and delete files, so as to enable users to access data.

[0003] The coupling degree between the embedded file system and the operating system is relatively low. In order to adapt to different hardware environments and operating system environments, it has good portability. According to the embedded usage scenario, the file system needs to implement structured management of data files and directories, determine the storage method of data on the storage device and the logical relationship between data files, and complete the management of data files through storage space mapping.

[0004] And provide users with a transparent file operation interface.

[0005] At present, the FAT32 file system, EXT4 file system and customized file system are commonly used in aviation airborne environments. The FAT32 file system has a complex data structure. In actual use, it has exposed many problems such as poor reliability and easy file damage. The EXT4 file system is commonly used in the LINUX operating system, which is difficult to transplant under embedded real-time operating systems. Like the FAT32 file system, its reliability cannot be guaranteed under abnormal conditions such as power failure and hot plugging. In addition, although the FAT32 file system and the EXT4 file system can provide a standard user interface, they cannot meet the data loop recording requirements in the airborne environment, and their usage scenarios are limited.

[0006] To address these issues, the customized file system adopts a lightweight design with high reliability and non-volatile files when power is off. According to different airborne usage scenarios, the customized file system has developed two main branches. One is a high-reliability file system based on a standard interface. It is not limited to the storage of fixed types of data in a specific area of ​​the disk. It reclaims storage space for storing other types of data by deleting files, realizing dynamic management of disk space. There are two ways to delete files to reclaim storage space. One is to delete files by traversing through the airborne program, which will make the application software design too complicated and inefficient, reducing the reliability of the software. The other is to delete files manually through ground tools, which will bring complexity to users and the risk of missing deletions. Since the storage space of this type of file system is uniformly divided according to clusters or blocks, long-term use of the disk will generate a large amount of disk fragments, affecting the usage efficiency and storage efficiency; the other is a customized cyclic recording high-reliability file system. This type of file system divides specific storage areas according to the data type, and the file system is responsible for cyclically covering the oldest data. Since data can only be stored sequentially, the number of files stored is consistent with the data type, and the file management and storage space usage are not flexible enough. In addition, the interface of this type of file system is generally not standard and cannot be registered in the operating system. The rapid development of the aviation field has put forward higher requirements for massive data storage, loop recording, and plug-and-play. The above-mentioned embedded file systems can no longer meet the requirements of high reliability and high flexibility at the same time. Summary of the invention

[0007] The purpose of the present invention is to provide an aviation embedded file system with high reliability, high flexibility, support for cyclic overwriting and interface standards for existing and future aviation airborne data storage devices and ground support equipment.

[0008] The technical solution adopted by the present invention is:

[0009] In a first aspect, a block mapping DCBM file system supporting data circular recording is provided, wherein the DCBM file system adopts the DOS partition specification and follows the master boot record MBR setting principle to divide the disk space, wherein the disk space is divided into a super block, a data directory area DDI, a DDI control area, a data file area DFI, a DFI control area, a disk block mapping area BBM, a data unit area DBU and a log area;

[0010] Among them, BBM is the mapping of DBU. Each DBU has a corresponding item in BBM, which stores the data attributes and operation attributes of DBU;

[0011] The DDI control area and the DFI control area record the current cycle positions of DDI and DFI respectively. When the disk space is insufficient, the control area is used to locate the data directory and data files that need to be deleted.

[0012] There are two copies of the DDI control area and the DFI control area respectively. The DCBM file system updates the DDI and DFI cycle positions alternately to prevent data corruption in one of the copies due to abnormal power failure of the device or other reasons, thereby ensuring the reliability of the DCBM file system cycle;

[0013] The DCBM file system also adds a hidden log partition to record file system operation logs. The hidden log partition has a fixed size and will be overwritten from the beginning when it is full.

[0014] The DCBM file system is mainly divided into five layers from top to bottom, namely: file system driver interface layer; file system directory management layer; file system file management layer; file system data management layer; file system block device driver management layer.

[0015] The file system driver interface layer is the driver interface encapsulated by the DCBM file system, which is used to register with the operating system device management layer IOS or the virtual file management interface layer VFS;

[0016] The file system directory management layer is used to manage directories through DDI: specifically, the location of file entries is determined by querying the DDI tree structure; DDI is divided into two categories: first-level directory DDI and non-first-level directory DDI; the DCBM file system manages the DDI allocation position through the DDI control area. When a user creates a first-level directory or a second-level directory and there are insufficient directory entries, the file system deletes the first-level directory folder with the longest history for first-level or second-level directory circular recording.

[0017] The file system file management layer is used to manage files through DFI: specifically, after querying the location of DFI, DFI is responsible for completing the file request processing and finally returning the result to the file system driver interface layer to complete the user request response; the DCBM file system manages the DFI allocation location of each type through the DFI control area. When the user creates a data file and there are insufficient file entries, the file system deletes the file with the longest history of the corresponding data type for circular recording.

[0018] The file system data management layer is used to manage disk space through BBM and DBU: after querying the first BBM location, the file system data management layer determines whether there is a qualified DBU available for use. The basic unit of disk space is called DBU. BBM and DBU correspond one to one. DBU is only used to store user data, and its data block attribute information and operation information are stored in the corresponding BBM; the DCBM file system manages the allocation position of each type of BBM through the DFI control area, and the number of BBMs for each data type is set through formatting. When the user writes a data file and the number of BBMs is insufficient, the file system deletes the file with the longest history of the corresponding data type for circular recording.

[0019] File system block device driver management layer: The DCBM file system uses an XBD-like management block device driver. By building a unified device management driver, it shields the impact of different operating systems and different storage device drivers on the file system.

[0020] In addition to providing directory management, the file system directory management layer also provides data type identification management: through the secondary directory item name, the DCBM file system divides the DFI metadata area and the DBU data area, and the type of data type is stored in the super block of the file system. When the secondary directory item name cannot match the stored data type, the DCBM file system returns a processing failure to the file system driver interface layer.

[0021] DCBM manages operation logs through hidden partitions. The hidden partitions are divided into hidden log control areas and hidden log data areas. The hidden log control area manages the record position of the hidden log data area. When the log record position of the data area exceeds the total amount of the data area, the hidden log control area updates the log write position to the starting position of the hidden log data area.

[0022] The operating system device management layer or virtual file management interface layer provides the application with a direct access POSIX standard interface, and the application indirectly accesses the DCBM file system through the POSIX standard interface; in addition, the driver interface layer also provides the file system's dcbmFs_mount interface and dcbmFs_unmount interface for mounting and unmounting file system IO.

[0023] Each DDI entry occupies 8 sectors, including the folder's attribute information and 487 subfolders or subfiles' index information; when there are more than 487 subfolders or subfiles in the parent directory, the parent directory is constructed by establishing a bidirectional linked list between DDI and DDI; the number of first-level directory DDIs is 1024; the number of subdirectories under a single first-level directory does not exceed 10, the total number of non-first-level directory DDIs required is 10240, and the total size of the DDI space occupied is 44MB bytes.

[0024] Each DFI entry occupies 8 sectors, including the file's attribute information and the first disk block mapping area information of the file list; the total number of DFIs of each data type is 1024, and the total space occupied is 4MB bytes.

[0025] The disk is divided into multiple disk partitions. The first sector of each disk partition is the super block, which stores the partition boot record. The partition boot record stores file system related information, including the number of DDI sectors, the number of DFI sectors, the number of BBM sectors, the size of the DBU data unit, the magic number of the file system, the name of the data type, and the number of BBMs of the data type. The super block information in the airborne is read-only and not written. Its information is written by the ground tool when the disk is formatted and read during the process of inserting the disk into the device and mounting it.

[0026] In a second aspect, a block mapping DCBM file management method supporting data circular recording is provided, applying the file system described in any one of the first aspects, the method comprising:

[0027] When a user creates or opens a file of a certain type, the DCBM file system first applies for an available DFI entry or BBM entry of that type. When the number of available DFIs or BBMs of the data type is insufficient, the file system deletes the file with the smallest number of mounts and the same type to release DFI and BBM resources.

[0028] Beneficial Effects

[0029] The block mapping file system supporting data circular recording of the present invention improves the reliability of massive data recording in an aviation airborne environment through the circular use of disk space, guarantees the timeliness of recorded data to the greatest extent, simplifies the operation process of users actively releasing disk space, improves the response speed, and provides a key technology roadmap for the research and development of high-reliability file systems in aviation airborne embedded environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 This is the architectural layer diagram of the DCBM file system;

[0031] Figure 2 It is the disk space division diagram of DCBM file system;

[0032] Figure 3 This is a schematic diagram of the DCBM file system directory tree composition;

[0033] Figure 4 This is a schematic diagram of the DCBM file system file composition;

[0034] Figure 5 This is a schematic diagram of the DCBM file system data type partition;

[0035] Figure 6 This is a diagram of the DCBM file system data structure. DETAILED DESCRIPTION

[0036] In order to better understand the present invention, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0037] The present invention is described in further detail below.

[0038] The block mapping file system (Data Cycle Block Mapping FileSystem) that supports data cycle recording divides specific data storage areas corresponding to data types. The storage area of ​​each data type is divided into a certain number of data blocks according to the set size for management. Users can create multiple files in each data type storage area for reading and writing. At the same time, the space after file deletion will be reclaimed by the file system to store other files. When the storage area of ​​a certain data type is full, the DCBM file system will delete the oldest file in the area for cycle recording; for all data types, the DCBM file system uniformly divides a fixed number of directories for file directory management. When the file directory is insufficient, the file system deletes the oldest directory for directory cycle; the DCBM file system comes with an implicit partition for storing file system operation logs and realizing the cycle recording of log data; as a customized high-reliability file system developed for embedded environments, the DCBM file system can meet the product support of aviation airborne and ground environments under multiple operations such as LINUX, Tianmai, and Yihui, and has the characteristics of safe and reliable data storage, flexible disk space management, record data cycle coverage, interface standard, plug-and-play, etc.

[0039] The block mapping file systems that support data circular recording mainly include:

[0040] The block mapping file system that supports data circular recording manages the entire disk space in a unified manner, manages the disk space in the form of a mapping table, and divides the data types on this basis. The addition, deletion, and disk space release of files of each data type are simple and flexible. When the storage space of this data type is insufficient, the storage space is released by deleting the historical files of this type to achieve circular storage of data.

[0041] The DCBM file system adopts the DOS partition specification and follows the MBR (Main Boot Record) master boot record setting principle. On this basis, the data directory area DDI (Data Dir Index), data file area DFI (Data File Index), disk block mapping area BBM (Block to Block Map) and data unit area DBU (Data Block Unit) are added. BBM is the mapping of the data unit DBU. Each DBU has a corresponding item in BBM, which stores the data attributes and operation attributes of the DBU. In addition to the above metadata area, the DCBM file system also adds a DDI control area and a DFI control area, which respectively record the current loop position of the data directory area DDI and the data file area DFI. When the disk space is insufficient, the data directory and data file to be deleted are located through the control area. There are two copies of the DDI control area and the DFI control area respectively. The file system alternately updates the DDI and DFI loop positions to prevent the data from being damaged due to abnormal power failure of the device or other reasons, thereby ensuring the reliability of the DCBM file system loop. The DCBM file system also adds a hidden log partition to record the file system operation log. The size of the hidden log partition is fixed, and the log is overwritten from the beginning when it is full.

[0042] The DCBM file system is mainly divided into five layers from top to bottom:

[0043] 1) File system driver interface layer;

[0044] 2) File system directory management layer;

[0045] 3) File system file management layer;

[0046] 4) File system data management layer;

[0047] 5) File system block device driver management layer;

[0048] The file system driver interface layer is the driver interface encapsulated by the DCBM file system, which is used to register with the operating system device management layer IOS (Input / Output System) or the virtual file management interface layer VFS (Virtual FileSystem). The operating system device management layer or the virtual file management interface layer provides the application with a direct access POSIX standard interface, and the application indirectly accesses the DCBM file system through the POSIX standard interface. The interfaces provided by the file system driver interface layer include dcbmFs_create(), dcbmFs_open(), dcbmFs_read(), dcbmFs_write(), dcbmFs_close(), dcbmFs_ioctl(), dcbmFs_delete(), etc. In addition, the driver interface layer also provides the file system's dcbmFs_mount interface and dcbmFs_unmount interface for mounting and unmounting the file system IO.

[0049] File system directory management layer, the DCBM file system manages directories through DDI, and DDI is divided into two categories: first-level directory DDI and non-first-level directory DDI. For read and write requests issued by the upper layer (the file system driver interface layer), the file system directory management layer determines the location of the file entry by querying the DDI tree structure. Each DDI entry occupies 8 sectors (4096 bytes), including the attribute information of the folder and 487 sub-folders or sub-file index information (each index information occupies 8 bytes). When there are more than 487 sub-folders or sub-files in the parent directory, the parent directory is constructed by establishing a DDI and DDI bidirectional linked list. The number of first-level directory DDIs is 1024 (of which the root directory occupies 1, the Lost directory occupies 1, and a maximum of 1022 first-level directories are allowed to be established). According to usage requirements, the number of sub-directories under a single first-level directory does not exceed 10, the total number of non-first-level directory DDIs required is 10240, and the total size of the DDI space occupied is 44MB bytes. The DCBM file system manages the DDI allocation position through the DDI control area. When a user creates a primary directory or a secondary directory and there are insufficient directory entries, the file system deletes the primary directory folder with the longest history for the primary directory or the secondary directory circular record.

[0050] File system file management layer, the DCBM file system manages files through DFI. After querying the location of DFI through the upper layer (the file system directory management layer), DFI is responsible for completing the file request processing and finally returning the result to the file system driver interface layer to complete the user request response. Each DFI entry occupies 8 sectors (4096 bytes), containing the attribute information of the file and the first disk block mapping area information (BBM) of the file list. The entire file can be accessed in sequence through the first BBM. The total number of DFIs of each data type is 1024, and the total space occupied is 4MB bytes. The DCBM file system manages the allocation location of each type of DFI through the DFI control area. When a user creates a data file and there are insufficient file entries, the file system deletes the file with the longest history of the corresponding data type for circular recording.

[0051] File system data management layer, the DCBM file system manages disk space through BBM and DBU. The basic unit of disk space is called DBU, and BBM and DBU correspond one to one. After querying the first BBM position through the upper layer (the file system file management layer), the file system data management layer determines whether there is a qualified DBU available for use. The size of each BBM is 32Bytes, and the size of each DBU is determined based on factors such as the type of product storage data, data flow size, and disk physical capacity. It can be set to 64Kbytes, 128KB, 512KB, and 1MBytes, and the size is fixed in the same storage device. DBU is only used to store user data, and its data block attribute information and operation information are stored in the corresponding BBM. According to the 2TBytes capacity of the disk, the DBU size is set to 1Mbytes, and a total of 2M BBMs are required, occupying a total space of 64MB bytes. The DCBM file system manages the allocation position of each type of BBM through the DFI control area. The number of BBMs for each data type is set by formatting. When the user writes a data file and the number of BBMs is insufficient, the file system deletes the file with the longest history of the corresponding data type for circular recording.

[0052] The file system block device driver management layer, the DCBM file system uses the XBD (extended block device) class to manage the block device driver. By building a unified device management driver, the impact of different operating systems and different storage device drivers on the file system is shielded. The driver encapsulation interfaces provided by the block device driver management layer include dcbmFs_DrvCreate, dcbmFs_DrvDelete, dcbmFs_DrvWrite, and dcbmFs_DrvRead. When the DCBM file system accesses the storage device, it only needs to complete the access to the storage device through the encapsulation interface.

[0053] In addition to providing directory management, the file system directory management layer also provides data type identification management. The DCBM file system divides the DFI metadata area and the DBU data area through the secondary directory item name. The type of data type is stored in the super block of the file system. When the secondary directory item name cannot match the stored data type, the DCBM file system returns the processing failure to the upper layer (the file system driver interface layer).

[0054] Hidden log partition, DCBM manages operation logs through hidden partitions. Hidden partitions are divided into hidden log control area and hidden log data area. The hidden log control area manages the record position of the hidden log data area. When the log record position of the data area exceeds the total amount of the data area, the hidden log control area updates the log write position to the starting position of the hidden log data area.

[0055] The DCBM file system uses DBU as the basic data unit for allocation and recycling. The DBU size can be flexibly configured to achieve dynamic management of storage space for various data types. The disk is recycled through DDI directory loop, DFI file loop, and BBM data loop, which simplifies the complexity of user data records and ensures the timeliness of data to the greatest extent. There are two copies of the DDI control area and the DFI control area, and the metadata is updated alternately to ensure the reliability of the cycle record to the greatest extent. The BBM linked list used to construct the file adopts a bidirectional index method to ensure that the file system can roll back to a certain state after an error occurs, thereby avoiding the phenomenon of file system crashes due to damage to key information and improving the reliability of the file system.

[0056] Figure 1This is the architectural layered diagram of the DCBM file system. This file system is registered through the operating system device management layer IOS or the virtual file management interface layer VFS, providing users with a set of file system interfaces that comply with the POSIX specification. Users can complete operations such as creating, reading, writing, and closing user files on storage devices through interfaces such as create(), open(), read(), write(), and close(). The driver interface layer of the DCBM file system completes the operating system IO registration upward, and the registration interfaces provided include dcbmFs_create(), dcbmFs_open(), dcbmFs_read(), dcbmFs_write(), dcbmFs_close(), dcbmFs_ioctl(), dcbmFs_delete(), dcbmFs_node_lkup, and dcbmFs_node_open. This interface can seamlessly connect mainstream embedded real-time operating systems and standard file transfer protocols. The operating system accesses the DCBM file system by calling the above registration interfaces. The DCBM file system directory management layer mainly involves DDI management, and DDI is divided into two categories: first-level directory DDI and non-first-level directory DDI. When a user creates or opens a file (folder) under a certain path, the directory management layer of the file system determines the location of the file entry by querying the DDI tree structure, and determines whether to allocate a new DDI or open an existing DDI based on the opening mode. The file management layer of the DCBM file system mainly involves DFI management. When a user creates or opens a file under a certain path, the corresponding data type is parsed according to the file path passed in by the user, the DFI to which the file belongs is determined based on the data type and the DDI tree structure, and whether to allocate a new DFI or open an existing DFI based on the opening mode. The data management layer of the DCBM file system mainly involves the management of BBM and DBU. The corresponding BBM data structure is found based on the first BBM index information in the DFI. The BBM data structure records the BBM number information of the first and last items of the BBM, that is, a DFI file consists of a BBM bidirectional linked list. According to the mapping relationship between BBM and DBU, the specific DBU data area is located to perform user data read and write operations. The DCBM file system block device driver management layer provides a set of standard block device driver encapsulation interfaces to shield the impact of different drivers on the DCBM file system. The DCBM file system completes the operation of block physical devices by calling block device drivers. The block device driver encapsulation interfaces include dcbmFs_DrvCreate, dcbmFs_DrvDelete, dcbmFs_DrvWrite, and dcbmFs_DrvRead.The DCBM file system driver interface layer and block device driver management layer solve the impact of different operating systems and different disk drivers on this file system. When the operating system or disk driver changes, the DCBM file system can be directly applied without changing or adjusting the interface.

[0057] Figure 2 This is the disk space division diagram of the DCBM file system. The DCBM file system adopts the DOS partition specification and follows the MBR (Main Boot Record) master boot record setting principle. The entire disk can be divided into multiple disk partitions. The first sector of each disk partition is the super block sector, which stores the partition boot record. The partition boot record stores file system related information, including the number of DDI sectors, the number of DFI sectors, the number of BBM sectors, the size of the DBU data unit, the file system magic number, the data type name, and the number of data type BBMs. The super block information in the airborne is read-only and not written. Its information is written by the ground tool when the disk is formatted and read during the disk insertion and device mounting process.

[0058] The DDI control area stores DDI entry application information. When creating a directory, the DCBM file system searches for available DDI entries based on the DDI control area information for allocation. The DFI control area stores DFI entry information for each data type. When creating a file, the DCBM file system obtains the data type based on name resolution and searches for available DFI entries based on the data type from the DFI control area information for allocation.

[0059] The data directory area DDI stores file directory information. Each DDI is 4096 bytes long and can store 487 sub-directories or sub-file information. When there are more than 487 sub-directories or sub-files in the parent directory, the parent directory is constructed by establishing a DDI and DDI bidirectional linked list. The number of first-level directory DDIs is 1024, that is, the file system only allows a maximum of 1024 first-level folders to be recorded, and the total number of non-first-level directory DDIs is 10240. When the number of first-level directory or non-first-level directory DDIs is insufficient, delete the first-level directory with the longest history (that is, the smallest mount count) to start the DDI cycle. DDI information is only updated when a folder or sub-file (folder) is created, and the DDI information is directly written to the disk when updated.

[0060] The data file area DFI stores file entry information. Each DFI stores a starting BBM serial number for quickly finding the BBM corresponding to the actual content of the file. Each DFI is 4096 bytes long, and the number of DFIs for each data type is 1024, that is, the file system only allows a maximum of 1024 files of each data type to be recorded. When the number of DFIs is insufficient, the DFI with the longest history of the corresponding data type (that is, the smallest mount count) is deleted to start the DFI cycle.

[0061] The length of each table entry in the disk block mapping area BBM is 32 bytes, and the total number of BBMs is consistent with the total number of DBUs. Based on the disk capacity of 1TByte and the DBU size of 1Mbyte, the required BBM capacity is (1024*1024 / 1)*32 bytes, a total of 32M bytes. BBM is divided according to data type. When the number of BBMs for a certain data type is insufficient, the DFI with the longest history of the corresponding data type (that is, the smallest mount count) is deleted to start the BBM cycle. DBU is the basic unit of data storage. Within a DBU, the data storage space remains continuous. The DBU size is optional from 64MByte to 1MByte, and the DBU size of each data type in the same product remains consistent.

[0062] The log area is a hidden area. It does not allow users to write or create data. It is only used for reading. The log area uses continuous disk storage space to record file system operation logs. When the log area is full, the log records are overwritten cyclically from the starting position of the log area.

[0063] Figure 3 This is a schematic diagram of the composition of the DCBM file system directory tree. The file system manages folders and files through DDI and DFI, where DDI is divided into first-level directory DDI and non-first-level directory DDI. The number of first-level directory DDI is 1024 (numbered DDI1 to DDI1024 in the figure). When the number of subfolders or subfiles in the DDI directory exceeds the upper limit of the number of subentries contained in the DDI, the DDI information of the folder is established by constructing a DDI linked list (numbered DDI2 and DDI4 in the figure). The first-level directory DDI can store second-level subdirectories and subfiles, and the second-level directory can store third-level subdirectories and subfiles, and so on; non-first-level DDI includes second-level subdirectories, third-level subdirectories, ..., n-level subdirectories. When a user opens or creates a file, the first-level directory DDI information is first traversed according to the path, and the feature value is calculated by the folder name, and the first-level DDI number can be directly located. After obtaining the DDI directory information according to the DDI number, the feature value of the DDI subentry is matched with the feature value of the second-level file (folder) name, and the next-level file (folder) information can be directly located, and so on.

[0064] Figure 4This is a schematic diagram of the composition of files in the DCBM file system. In the DCBM file system, a DFI index corresponds to a file in the file system. The DFI records the first BBM index number assigned to this file. Through this index number, the corresponding BBM data structure can be quickly located. Through the preceding and succeeding BBM index numbers in the BBM data structure, it is possible to quickly determine which BBM indexes a file is composed of. The total number of BBMs is consistent with the total number of DBUs, that is, BBM1 corresponds to DBU1, BBM2 corresponds to DBU2, and so on. The BBM size is 32 bytes and is used to store magic numbers, BBM numbers, preceding BBM numbers, succeeding BBM numbers, file index DFI numbers, etc. The basic data unit of the file system is the DBU, which only stores user data. The file uses the BBM linked list to determine which DBUs the file is composed of. Figure 4 In the example, this file is composed of DBU2, DBU10, DBU16, DBU30 and DBU36. The end position of the last DBU36 can be determined by the file length in DFI. To ensure data reliability, the file system first updates the BBM linked list, then writes data, and finally updates the file length in DFI. When the storage device loses power abnormally, there will be no inconsistency between the data indicated by DFI and the data stored in the actual DBU.

[0065] Figure 5 This is a schematic diagram of the data type partition of the DCBM file system. The DCBM file system can divide the disk into up to 20 data type partitions, and the DFI metadata and BBM metadata of each data type partition are independent of each other. When a user creates or opens a file of a certain type, the DCBM file system first applies for an available DFI entry or BBM entry of that type. When the number of DFIs or BBMs of the data type is insufficient, the file system deletes the files of the same type with the smallest number of mounts to release DFI and BBM resources. Since files with the same number of disk mounts are relatively concentrated when stored, when a certain type of data partition is full of storage records and a loop occurs, deleting files will not generate or generate a small amount of disk fragmentation, and the storage efficiency of the disk will not be reduced, which solves the problem of low disk writing efficiency caused by full storage device records and improves the reliability of onboard data recording.

[0066] The DDI control area in the DCBM file system records the usage of DDI. Since the number of first-level directories is fixed, the first-level directory DDI needs to be read from the disk when mounting, and the characteristic information of DDI needs to be saved in the memory. Therefore, the DDI control area only records the usage location of non-first-level directory DDI. The size of the DDI control area is 4096 bytes, and the specific meaning in the data structure is defined in Table 1 below:

[0067] Table 1

[0068]

[0069] The DFI control area in the DCBM file system records the usage of DFI. Since DFI cycles will occur when DFI is insufficient and BBM is insufficient, the DFI control area records the usage locations of DFI and BBM. The size of the DFI control area is 4096 bytes, and the specific meaning of the data structure is defined in Table 2 below:

[0070] Table 2

[0071]

[0072] Each DDI in the DCBM file system occupies 4096 bytes, and each disk partition has a total of 1024 primary DDI indexes and 10240 non-primary DDI indexes. The specific meaning of the DDI data structure is defined in Table 3 below:

[0073] Table 3

[0074]

[0075]

[0076] Each DFI in the DCBM file system occupies 4096 bytes, and each disk partition has a total of 1024 DFI indexes for each data type. The specific meaning of the DFI data structure is defined in Table 4 below:

[0077] Table 4

[0078]

[0079]

[0080] Each BBM in the DCBM file system occupies 32 bytes. BBMs can be grouped into 16, 32, 64, or 128 bytes. When applying for BBMs, files can apply for them individually or in groups. The specific meaning of the BBM data structure is defined in Table 5 below:

[0081] Table 5

[0082]

[0083]

[0084] Figure 6This is a data structure relationship diagram of the DCBM file system. The superblock is the top-level data structure that records the key information of the file system. The superblock can be used to determine the DDI position, DFI position, BBM position, total number of DDIs, total number of DFIs, and total number of BBMs. The position of each DFI can be found through the DDI index, and the position of the first BBM assigned to this DFI can be found through the DFI. The previous and next BBM index numbers in the BBM can finally determine the DBU position and the relevant information of the corresponding file.

Claims

1. A block mapping DCBM file system supporting data cyclic recording, characterized in that: The DCBM file system adopts the DOS partitioning specification and follows the master boot record MBR setting principle to divide the disk space. The disk space is divided into super block, data directory area DDI, DDI control area, data file area DFI, DFI control area, disk block mapping area BBM, data unit area DBU and log area. Among them, BBM is the mapping of DBU. Each DBU has a corresponding item in BBM, which stores the data attributes and operation attributes of DBU; The DDI control area and the DFI control area record the current cycle positions of DDI and DFI respectively. When the disk space is insufficient, the control area is used to locate the data directory and data files that need to be deleted. There are two copies of the DDI control area and the DFI control area respectively. The DCBM file system updates the DDI and DFI cycle positions alternately to prevent data corruption in one of the copies due to abnormal power failure of the device or other reasons, thereby ensuring the reliability of the DCBM file system cycle; The DCBM file system also adds a hidden log partition to record file system operation logs. The hidden log partition has a fixed size and will be overwritten from the beginning when it is full.

2. The file system according to claim 1, characterized in that: The DCBM file system is divided into five layers from top to bottom: file system driver interface layer; file system directory management layer; file system file management layer; file system data management layer; File system block device driver management layer; The file system driver interface layer is the driver interface encapsulated by the DCBM file system, which is used to register with the operating system device management layer IOS or the virtual file management interface layer VFS; The file system directory management layer is used to manage directories through DDI: specifically, the location of file entries is determined by querying the DDI tree structure; DDI is divided into two categories: primary directory DDI and non-primary directory DDI; DCBM file system manages DDI allocation position through DDI control area. When the user creates a primary directory or a secondary directory and the directory entries are insufficient, the file system deletes the primary directory folder with the longest history for primary directory or secondary directory loop record; The file management layer of the file system is used to manage files through DFI: Specifically, after querying the location of DFI, DFI is responsible for completing the file request processing and returning the result to the file system driver interface layer to complete the user request response; the DCBM file system manages the DFI allocation location of each type through the DFI control area. When the user creates a data file and the file entries are insufficient, the file system deletes the file with the longest history of the corresponding data type for circular recording; The file system data management layer is used to manage disk space through BBM and DBU: after querying the first BBM location, the file system data management layer determines whether there is a qualified DBU available for use. The basic unit of disk space is called DBU. BBM and DBU correspond one to one. DBU is only used to store user data, and its data block attribute information and operation information are stored in the corresponding BBM; the DCBM file system manages the allocation position of each type of BBM through the DFI control area. The number of BBMs for each data type is set through formatting. When the user writes a data file and the number of BBMs is insufficient, the file system deletes the file with the longest history of the corresponding data type for circular recording; File system block device driver management layer: The DCBM file system uses an XBD-like management block device driver. By building a unified device management driver, it shields the impact of different operating systems and different storage device drivers on the file system.

3. The file system according to claim 2, characterized in that: In addition to providing directory management, the file system directory management layer also provides data type identification management: through the secondary directory item name, the DCBM file system divides the DFI metadata area and the DBU data area, and the type of data type is stored in the super block of the file system. When the secondary directory item name cannot match the stored data type, the DCBM file system returns a processing failure to the file system driver interface layer.

4. The file system according to claim 3, characterized in that: DCBM manages operation logs through hidden partitions. The hidden partitions are divided into hidden log control areas and hidden log data areas. The hidden log control area manages the record position of the hidden log data area. When the log record position of the data area exceeds the total amount of the data area, the hidden log control area updates the log write position to the starting position of the hidden log data area.

5. The file system according to claim 4, characterized in that: The operating system device management layer or virtual file management interface layer provides the application with a direct access POSIX standard interface, and the application indirectly accesses the DCBM file system through the POSIX standard interface; in addition, the driver interface layer also provides the file system's dcbmFs_mount interface and dcbmFs_unmount interface for mounting and unmounting file system IO.

6. The file system according to claim 5, characterized in that: Each DDI entry occupies 8 sectors, including the folder's attribute information and 487 subfolders or subfiles' index information; when there are more than 487 subfolders or subfiles in the parent directory, the parent directory is constructed by establishing a bidirectional linked list between DDI and DDI; the number of first-level directory DDIs is 1024; the number of subdirectories under a single first-level directory does not exceed 10, the total number of non-first-level directory DDIs required is 10240, and the total size of the DDI space occupied is 44MB bytes.

7. The file system according to claim 6, characterized in that: Each DFI entry occupies 8 sectors, including the file's attribute information and the first disk block mapping area information of the file list; the total number of DFIs of each data type is 1024, and the total space occupied is 4MB bytes.

8. The file system according to claim 1, characterized in that: The disk is divided into multiple disk partitions. The first sector of each disk partition is the super block, which stores the partition boot record. The partition boot record saves the file system related information, including the number of DDI sectors, the number of DFI sectors, the number of BBM sectors, the size of the DBU data unit, the magic number of the file system, the name of the data type, and the number of BBMs of the data type. The super block information on board is read-only and not write-able. The information is written by the ground tool when the disk is formatted and read during the process of inserting the disk into the device and mounting it.

9. A block mapping DCBM file management method supporting data loop recording, characterized in that: Using the file system described in any one of claims 1 to 8, the method comprises: When a user creates or opens a file of a certain type, the DCBM file system first applies for an available DFI entry or BBM entry of that type. When the number of available DFIs or BBMs of the data type is insufficient, the file system deletes the file with the smallest number of mounts and the same type to release DFI and BBM resources.