Tape file system control method and device, and storage medium

By generating file storage records in the tape file system and writing metadata along with the files onto the tape, the problem of large metadata space consumption is solved, and efficient data query and storage management are achieved.

WO2026097576A1PCT designated stage Publication Date: 2026-05-15SHENZHEN JIETENG TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
SHENZHEN JIETENG TECHNOLOGY CO LTD
Filing Date
2024-11-11
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Metadata in tape file systems occupies a large amount of tape storage space. In existing technologies, the entire data needs to be written each time metadata is written, which leads to wasted space and the risk of data loss.

Method used

The metadata of the file to be stored is generated together with the file to form a tape file, and a file storage record is generated based on the file's starting block, avoiding full writing and reducing the storage space occupied by the metadata.

Benefits of technology

By generating file storage records, users can quickly query data, reduce the storage space occupied by metadata, avoid data loss, and improve data query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024131336_15052026_PF_FP_ABST
    Figure CN2024131336_15052026_PF_FP_ABST
Patent Text Reader

Abstract

The present application discloses a tape file system control method and device, and a storage medium. The method comprises: on the basis of a stored area of a tape storage, determining a file start block of a tape file corresponding to a file to be stored in the tape storage; generating the tape file on the basis of metadata of the file to be stored and the file to be stored, and on the basis of the file start block, writing the tape file into a storage space of the tape storage, the storage space using the file start block as a storage start point; and on the basis of the metadata and the file start block, generating a file storage record of the file to be stored, and storing the file storage record in an external storage.
Need to check novelty before this filing date? Find Prior Art

Description

Control methods, devices and storage media for magnetic tape file systems Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a control method, device and storage medium for a magnetic tape file system. Background Technology

[0002] The Linear Tape File System (LTFS) consists of an index partition and a data partition. The file data stored in the data partition can be searched through the metadata in the index partition.

[0003] In related technologies, LTFS uses an append-only write method to write file data, generating metadata and writing it to the index partition simultaneously with the incremental file data written to the data partition. LTFS typically writes metadata in full. Therefore, each time metadata is written, it contains index information for all file data on the current tape. This results in a large amount of tape storage space being occupied by the metadata.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Technical issues

[0005] The main purpose of this application is to provide a control method, device and storage medium for a magnetic tape file system, which aims to solve the technical problem that the metadata in a magnetic tape file system occupies a large amount of magnetic tape space. Technical solutions

[0006] To achieve the above objectives, this application provides a control method for a magnetic tape file system, the method comprising the following steps:

[0007] Based on the stored area of ​​the magnetic tape storage, determine the file start block of the magnetic tape storage where the file to be stored will be stored;

[0008] Based on the file start block, the metadata of the file to be stored and the file to be stored are written as a magnetic tape file to the magnetic tape storage;

[0009] Based on the metadata and the file start block, a file storage record for the file to be stored is generated and stored in the external storage.

[0010] In one embodiment, the tape file includes header metadata, the file to be stored, and tail metadata. The step of generating the tape file based on the metadata of the file to be stored and the file to be stored, and writing the tape file to the tape storage according to the file start block, includes:

[0011] The file header metadata is generated based on the metadata and the checksum type;

[0012] Calculate the checksum of the file to be stored according to the checksum type, and generate the file end metadata according to the checksum and the metadata;

[0013] Starting from the beginning block of the file, the file header metadata, the file to be stored, and the file tail metadata are sequentially written into the tape storage.

[0014] In one embodiment, after the step of writing the metadata of the file to be stored and the file to be stored as a tape file to the tape storage based on the file start block, the method includes:

[0015] Write the file delimiter of the tape file; and / or,

[0016] Locate the file delimiter to the magnetic tape storage;

[0017] Based on the previous data block of the file delimiter, read the file tail metadata of the tape file;

[0018] Obtain the file storage size of the tape file from the file end metadata, and locate the file header metadata based on the file end metadata and the file storage size;

[0019] The file storage record is generated based on the file header metadata.

[0020] In one embodiment, after the step of writing the metadata of the file to be stored and the file to be stored as a tape file to the tape storage based on the file start block, the method includes:

[0021] Determine the remaining storage capacity of the magnetic tape storage device;

[0022] When the remaining storage amount is less than the storage amount threshold, the tape file storage information is determined based on the tape file stored in the tape memory.

[0023] Based on the magnetic tape file storage information, an entry information file is generated, and based on the magnetic tape file space occupied and the number of magnetic tape file entries in the magnetic tape file storage information, an entry information file header and an entry information file footer are generated;

[0024] Based on the entry information file header, the entry information file, and the entry information file footer, a tape end file is generated;

[0025] Write the tape end file to the end of the storage space of the tape memory, and update the tape status of the tape memory to the sealed state.

[0026] In one embodiment, after the steps of writing the tape end file to the end of the storage space of the tape memory and updating the tape status of the tape memory to a sealed state, the method further includes:

[0027] At the last data block at the end of the storage space, read the entry information file tail of the tape tail file;

[0028] Obtain the space occupied by the tape file recorded at the end of the entry information file;

[0029] Based on the space occupied by the magnetic tape file, determine the storage location of the entry information file, and obtain the entry information file based on the storage location;

[0030] The file storage record is generated based on the magnetic tape information storage information in the entry information file.

[0031] In one embodiment, before the step of determining the data block of the file to be stored in the starting block of the tape memory based on the stored area of ​​the tape memory, the method further includes:

[0032] Clear the stored data of the magnetic tape memory;

[0033] Obtain the pre-stored file system layout, and generate the tape header file of the tape storage device according to the file system layout;

[0034] Write the tape header file to the tape storage and update the tape status of the tape storage to writable.

[0035] In one embodiment, after the steps of generating a file storage record for the file to be stored based on the metadata and the file start block of the data block, and storing the file storage record to the external storage, the method further includes:

[0036] Receive a file read request and determine the file to be read and the read parameters;

[0037] Obtain the file storage record of the file to be read from the storage record file, and determine the offset of the file to be read from the corresponding target tape file and the file start block of the target tape file based on the file storage record;

[0038] The starting block of the file to be read is determined based on the file start block and the offset;

[0039] Obtain the number of data blocks to be read from the read parameters, and read the file according to the start block and the number of data blocks to be read.

[0040] In one embodiment, after the steps of generating a file storage record for the file to be stored based on the metadata and the file start block of the data block, and storing the file storage record to the external storage, the method further includes:

[0041] Upon receiving a file deletion request, identify the file to be deleted in the file deletion request;

[0042] The file storage record of the file to be deleted is determined in the storage record file, and the file storage record is marked as deleted;

[0043] Based on the file to be stored, overwrite the file to be deleted in the magnetic tape storage.

[0044] In addition, to achieve the above objectives, this application also provides a control device for a magnetic tape file system, the device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the control method for the magnetic tape file system as described above.

[0045] In addition, to achieve the above objectives, this application also provides a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the control method of the magnetic tape file system as described above. Beneficial effects

[0046] One or more technical solutions proposed in this application have at least the following technical effects:

[0047] This application generates a tape file by including the metadata of the file to be stored along with the file itself when saving it to the tape storage device. Based on the file start block allocated to the file to be stored by the tape storage device and the metadata, an external file storage record is generated. This allows users to quickly query the data in the tape storage device based on the file storage record and metadata, while avoiding the need to write the metadata in a full write mode every time, thereby reducing the storage space occupied by the metadata in the tape storage device. Attached Figure Description

[0048] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0049] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0050] Figure 1 is a flowchart illustrating the first embodiment of the control method for the magnetic tape file system of this application;

[0051] Figure 2 is a flowchart illustrating the second embodiment of the control method for the magnetic tape file system of this application.

[0052] Figure 3 is a flowchart illustrating the third embodiment of the control method for the magnetic tape file system of this application.

[0053] Figure 4 is a flowchart illustrating the fourth embodiment of the control method for the magnetic tape file system of this application.

[0054] Figure 5 is a flowchart illustrating the fifth embodiment of the control method for the magnetic tape file system of this application.

[0055] Figure 6 is a flowchart illustrating the sixth embodiment of the control method for the magnetic tape file system of this application;

[0056] Figure 7 is a flowchart illustrating the seventh embodiment of the control method for the magnetic tape file system of this application;

[0057] Figure 8 is a schematic diagram of the structure of the control device of the tape file system in the hardware operating environment involved in the embodiment of this application.

[0058] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Embodiments of the present invention

[0059] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0060] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific implementation methods.

[0061] The main solution of this application embodiment is: based on the stored area of ​​the magnetic tape storage, determine the file start block of the magnetic tape storage where the file to be stored is located; based on the file start block, write the metadata of the file to be stored and the file to be stored as a magnetic tape file into the magnetic tape storage; based on the metadata and the file start block, generate a file storage record of the file to be stored, and store the file storage record to the external storage.

[0062] Because the Linear Tape File System (LTFS) appends file data to the data partition during the process of searching for file data in the data partition using metadata in the index partition, and simultaneously writes the generated metadata to the index partition in full while writing incremental file data to the data partition, each time metadata is written, the metadata contains index information of all file data on the current tape, resulting in a large amount of tape space occupied by the metadata.

[0063] This application generates a tape file by including the metadata of the file to be stored along with the file itself when saving it to the tape storage device. Based on the file start block allocated to the file to be stored by the tape storage device and the metadata, an external file storage record is generated. This allows users to quickly query the data in the tape storage device based on the file storage record and metadata, while avoiding the need to write the metadata in a full write mode every time, thereby reducing the storage space occupied by the metadata in the tape storage device.

[0064] To better understand the above technical solutions, exemplary embodiments of this application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.

[0065] It should be noted that the executing entity in this embodiment can be a magnetic tape file system, or a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or control device for a magnetic tape file system capable of the above functions. This embodiment does not specifically limit the specific implementation. The following uses a magnetic tape file system as an example to describe this embodiment and the following embodiments.

[0066] Based on this, the present application provides a control method for a magnetic tape file system. Referring to Figure 1, Figure 1 is a flowchart of the first embodiment of the control method for a magnetic tape file system of the present application.

[0067] In this embodiment, the magnetic tape file system includes a magnetic tape storage device and an external storage device, and the control method of the magnetic tape file system includes steps S10 to S40:

[0068] Step S10: Determine the file start block of the tape memory where the file to be stored is located, based on the stored area of ​​the tape memory;

[0069] In this embodiment, the tape file system includes a tape storage device and an external storage device. The tape file system can save tape files generated based on files to be stored to the tape storage device in the form of data blocks. The tape file contains the files to be stored and their metadata.

[0070] Furthermore, the tape file system stores tape files sequentially based on the order of the tape storage space. After acquiring the file to be stored, the tape file system determines the already stored area in the tape storage used to store the file, and uses the next data block space of the already stored area as the file start block of the tape file. Starting from this file start block, the data blocks generated based on the file to be stored are sequentially stored into the tape storage space according to the order of the tape storage space. In other words, a segment of storage space starting from the file start block is used to store the tape file.

[0071] Specifically, the tape file system locates the end of data (EOD) of the tape data area and records the current position, denoted as the file start block. The file start block is the first data block in the spatial location of the tape file stored in the tape storage. The tape file system uses a segment of data space in the tape storage, starting from the file start block, to store the data to be stored and the corresponding metadata information.

[0072] Step S20: Based on the file start block, write the metadata of the file to be stored and the file to be stored as a tape file into the tape storage;

[0073] It's important to note that the Linear Tape File System (LTFS) stores metadata and file data in partitions. Therefore, LTFS writes the index information of all files on the tape each time metadata is written, resulting in a space complexity of O(n²). Metadata occupies a significant amount of space and relies on the tape to support multiple partitions, where n is the number of files. Furthermore, if the tape file system performs metadata writes periodically, and a server crash or tape media failure prevents writing before the last write operation, the indexes of all files written after the most recent write will be lost and unrecoverable. Additionally, in multi-partition tape scenarios, different partitions need to be isolated by protection regions, which cannot be written to, leading to a loss of usable capacity.

[0074] In this embodiment, the tape file system writes its metadata information simultaneously with each file to be stored, thereby ensuring that the files written to the tape are not lost and that the metadata overhead meets the O(n) complexity requirement. Furthermore, it is implemented based on a single tape partition, reducing reliance on the tape media hardware's support for multi-partition features. Also, after writing the metadata of the data to be stored, a single metadata file does not affect other metadata files.

[0075] As an optional implementation of writing a magnetic tape file, the magnetic tape file includes file header metadata, the file to be stored, and file tail metadata. Step S20 includes steps S21 to S24:

[0076] Step S21: Generate the file header metadata based on the metadata and the checksum type;

[0077] In this embodiment, the tape file system first determines the corresponding metadata based on the file to be stored, constructs file header metadata, and writes this file header metadata into the file header. This file header metadata contains information such as the file storage size and file path. Simultaneously, the tape file system can determine the checksum type of the tape file according to system presets or user selection, and write the corresponding identification information into the file header metadata.

[0078] Step S22: Calculate the checksum of the file to be stored according to the checksum type, and generate the file tail metadata according to the checksum and the metadata;

[0079] In this embodiment, while writing the file to be stored, a checksum is calculated based on the checksum type and written to the file's end metadata. Simultaneously, the tape file system obtains the file's storage capacity and writes it to the file's end metadata.

[0080] Step S23: Starting from the file start block, write the file header metadata, the file to be stored, and the file tail metadata into the tape storage in sequence.

[0081] In this embodiment, the tape file system generates header metadata and footer metadata for the tape file based on the file to be stored, and then sequentially writes the header metadata, the file to be stored, and the footer metadata into the tape storage to form the tape file. Specifically, the tape file system fills the header metadata into the header of the tape file and the footer metadata into the footer of the tape file.

[0082] For example, each tape file consists of contiguous data blocks. The first data block of the tape file is the file header metadata (FileMetaHeader), which contains information such as the file header magic number, file system version, path length, checksum type, file number, file size, file write timestamp, file path, and file extended attributes written by the application. The file header magic number is an identifier of the file format, the checksum type determines how the checksum is calculated for the file to be stored, and the file number ensures that each tape file is unique within an instance. Following the file header metadata are the data blocks of the file to be stored. The tape file system divides the file to be stored into multiple data blocks based on the data block size set in the system. The data portion of the file is divided into fixed-length data blocks, for example, a fixed length of 512 KiB. The last data block of the tape file is the file tail metadata (FileMetaTail), which contains the file tail magic number, file system version, file number, file size, and file checksum. Additionally, each file tail is followed by a FileMark, used to separate different tape files.

[0083] Furthermore, by recording the checksum type in the file header metadata and the checksum in the file tail metadata, the integrity of the tape file can be verified based on the checksum when reading the tape file. The file header records the file's path and size, while the file tail records the file's checksum. During reading, the process first locates the header to further confirm whether the stored file location is consistent with that saved on the tape. After reading the entire file, the checksum is read from the file tail to further verify data consistency.

[0084] In one embodiment, the tape file system can also save all the metadata of the data to be stored in the file header or file footer, so that the tape file system can determine and retrieve the corresponding metadata storage location through the file delimiter.

[0085] Step S30: Based on the metadata and the file start block, generate a file storage record for the file to be stored, and store the file storage record to the external storage device.

[0086] In this embodiment, after the tape file system completes the storage of the file to be stored, it generates a file storage record for the tape storage device and summarizes the file storage records into a storage record file to record file information. The file information can be recorded using an external tape database or as a file, and the file storage record is stored in the external storage device.

[0087] For example, using database records, the tape file system allocates a table in the database for each tape. Each row in the table contains information such as the filename, starting block, file number, deletion flag, and file size. Users can use this file to determine the storage location of the tape file they need to query and retrieve it.

[0088] This application embodiment generates a tape file by combining the metadata of the file to be stored with the file itself when saving it to the tape storage device. An external file storage record is generated based on the file start block allocated to the file to be stored by the tape storage device and the metadata. This allows users to quickly query the data in the tape storage device based on the file storage record and metadata, while avoiding the need to write the metadata in a full write mode every time, thereby reducing the storage space occupied by the metadata in the tape storage device.

[0089] Based on the same inventive concept, this application also provides a second embodiment. Referring to FIG2, FIG2 is a flowchart illustrating the second embodiment of the control method for the magnetic tape file system of this application.

[0090] In this embodiment, the control method of the magnetic tape file system further includes steps S41-S45:

[0091] Step S41: Write the file delimiter of the tape file;

[0092] In this embodiment, the tape file system adds a file delimiter after the end of files such as tape files, tape header files, or tape tail files to identify the boundaries of the tape files.

[0093] Step S42: Locate the file delimiter of the magnetic tape storage;

[0094] Step S43: Based on the previous data block of the file delimiter, read the file end metadata of the tape file;

[0095] Step S44: Obtain the file storage amount of the tape file from the file end metadata, and locate the file header metadata based on the file end metadata and the file storage amount;

[0096] Step S45: Generate the file storage record based on the file header metadata.

[0097] In this embodiment, if the tape storage is currently writable, it indicates that the tape does not have a tail file. Therefore, the tape file system recovers the file storage records by traversing the tape files already stored in the tape storage and using a slow recovery method.

[0098] Specifically, the tape file system uses a traversal approach to locate file delimiters on the tape, obtain the data block preceding that delimiter (i.e., the end of the tape file), read the end-of-file metadata, and determine the file size of the tape file. Based on this file size and the storage address of the end of the tape file, the tape file system can locate the file header, obtain its metadata, and thus read the file storage record corresponding to that delimiter. After traversing all file delimiters, the tape file system can retrieve the file storage records of all tape files in the tape storage.

[0099] For example, the tape file system, based on the spacefm forward instruction, locates the first file delimiter in the tape storage, skipping the tape header file. The tape file system executes in a loop, locating the next file delimiter and backscrambling one data block, reading the file tail metadata (FileMetaTail) to obtain the file size. It calculates the file header metadata (FileMetaHeader) position, which is the current block offset - 1 - (file size / data block size) - 1. It locates the FileMetaHeader position, reads the FileMetaHeader, and retrieves the file entry information based on the information stored in the FileMetaHeader. If the file corresponding to the file entry already exists in the external record, it is updated; otherwise, a new file entry is inserted. The tape file system exits the loop when it reaches the end of the tape.

[0100] In one example, when the tape file system receives a recovery command for a file storage record, it retrieves the MAM_TAPE_STATUS attribute field of the tape. If MAM_TAPE_STATUS is in a sealed state, it indicates that the tape end file of the tape file system has been constructed, and a fast recovery is performed. If MAM_TAPE_STATUS is in a writable state, it means that the tape end file of the tape file system has not been constructed, and a slow recovery is performed.

[0101] This application embodiment restores file storage records by traversing the tape file metadata when the tape end file is not generated on the disk.

[0102] Since the system described in Embodiment 2 of this application is a system used to implement the method of Embodiment 1 of this application, those skilled in the art can understand the specific structure and variations of the system based on the method described in Embodiment 1 of this application, and therefore will not be described again here. All systems used in the method of Embodiment 1 of this application fall within the scope of protection of this application.

[0103] Based on the same inventive concept, this application also provides a third embodiment. Referring to FIG3, FIG3 is a flowchart illustrating the third embodiment of the control method for the magnetic tape file system of this application.

[0104] In this embodiment, the control method of the magnetic tape file system further includes steps S51-S54:

[0105] Step S51: Determine the remaining storage capacity of the magnetic tape memory;

[0106] Step S52: When the remaining storage amount is less than the storage amount threshold, determine the tape file storage information based on the tape file stored in the tape memory;

[0107] Step S53: Generate an entry information file based on the magnetic tape file storage information, and generate an entry information file header and an entry information file footer based on the magnetic tape file space occupied and the number of magnetic tape file entries in the magnetic tape file storage information;

[0108] Step S54: Generate a tape end file based on the entry information file header, the entry information file, and the entry information file tail;

[0109] In this embodiment, the magnetic tape storage includes a writable state and a sealed state. The writable state indicates that the magnetic tape storage is not sealed, and the tape contains a tape header file and a tape file. The tape file system can continuously store the generated tape file of the files to be stored to the beginning of the unstored data area in the tape file system. The sealed state indicates that the current data storage is full and it enters the sealing process; at this time, the disk can no longer be used for storage. When the remaining storage capacity of the magnetic tape storage is less than the storage capacity threshold, the tape file system seals the tape. After sealing, the tape is no longer written to.

[0110] Specifically, the tape file system retrieves all valid file entries on the current tape, i.e., all files not marked for deletion that can be obtained from the file storage record, and constructs an entry information file header, multiple entry information files, and an entry information file tail based on the valid file entries. As described in the file system layout, the entry information file header includes the magic number, file system version, number of file entries, and file entry space. Each entry information file includes the entry magic number, entry size, starting offset of the corresponding file on the tape, file storage size, file number, file path, file entry write timestamp, and extended attributes applied during the write. The entry information file tail includes the magic number, version number, and file entry space. The tape file system appends the constructed entry information file header, entry information files, and entry information file tail to the end of the tape and writes a file delimiter to form the tape tail file.

[0111] For example, the end of the tape storage space is the tape tail file, which mainly stores all the valid file information stored on the tape when the tape is sealed. It consists of three parts: the entry information file header (TapeFileEntriesHeader), multiple entry information files (TapeFileEntries), and the entry information file tail (TapeFileEntriesTail).

[0112] Step S55: Write the tape end file to the end of the storage space of the tape memory, and update the tape status of the tape memory to the sealed state.

[0113] In this embodiment, after the tape file writes the end-of-tape file to the end of the tape storage space, it can update the current state of the tape storage. For example, the tape file system status is identified by a private MAM_TAPE_STATUS attribute. The MAM_TAPE_STATUS attribute identifies two states: writable and sealed.

[0114] This application embodiment records the file entry information of the stored tape files on the tape and updates the tape to a sealed state when the remaining storage capacity of the tape is less than the storage capacity threshold, thereby stopping the writing of files on the tape and preventing the files on the tape from being overwritten.

[0115] Since the system described in Embodiment 3 of this application is a system used to implement the method of Embodiment 1 of this application, those skilled in the art can understand the specific structure and variations of the system based on the method described in Embodiment 1 of this application, and therefore will not be described again here. All systems used in the method of Embodiment 1 of this application fall within the scope of protection of this application.

[0116] Based on the same inventive concept, this application also provides a fourth embodiment. Referring to FIG4, FIG4 is a flowchart illustrating the fourth embodiment of the control method for the magnetic tape file system of this application.

[0117] In this embodiment, the control method of the magnetic tape file system further includes steps S61 to S64:

[0118] Step S61: At the last data block at the end of the storage space, read the entry information file tail of the tape tail file;

[0119] Step S62: Obtain the space occupied by the tape file recorded at the end of the entry information file;

[0120] Step S63: Determine the storage location of the entry information file based on the space occupied by the tape file, and obtain the entry information file based on the storage location;

[0121] Step S64: Generate the file storage record based on the magnetic tape information storage information in the entry information file.

[0122] In this embodiment, when the tape file system reads a tape file, it relies on the file storage record to avoid searching for the file each time using the file system metadata recorded by the tape file system itself. Specifically, to prevent files in the tape file system from becoming unreadable due to corruption of the tape file storage record, the file storage record can be recovered based on the metadata stored on the tape itself.

[0123] Specifically, when the tape being read is in a sealed state, the tape file system can directly obtain the entry information file in the tape end file to regenerate the file storage record.

[0124] In one embodiment, the tape file system locates the end of the tape and reads the end of the entry information file from the data block above the file delimiter at the end of the tape, i.e., the last data block at the end of the storage space. It then obtains the space occupied by the file entry and calculates the positions of the entry information file header and the entry information based on the space occupied. Each entry information file is read and parsed based on the entry information file header to obtain the tape file storage information within the entry information file, and the file storage record is regenerated.

[0125] This application embodiment reads the tape file storage information in the entry information file by using the metadata at the end of the tape end file to restore the file storage record, thereby improving the stability of the tape file system for storing and searching data.

[0126] Since the system described in Embodiment 4 of this application is a system used to implement the method of Embodiment 1 of this application, those skilled in the art can understand the specific structure and variations of the system based on the method described in Embodiment 1 of this application, and therefore will not be described again here. All systems used in the method of Embodiment 1 of this application fall within the scope of protection of this application.

[0127] Based on the same inventive concept, this application also provides a fifth embodiment. Referring to FIG5, FIG5 is a flowchart illustrating the fifth embodiment of the control method for the magnetic tape file system of this application.

[0128] In this embodiment, as described in step S10, determining the file to be stored before the file start block of the corresponding tape file based on the stored area of ​​the tape memory, the method further includes steps S11 to S13:

[0129] Step S11: Clear the stored data of the magnetic tape memory;

[0130] Step S12: Obtain the pre-stored file system layout and generate the tape header file of the tape storage device according to the file system layout;

[0131] In this embodiment, the tape storage needs to be formatted before writing files. The tape file system can delete all currently stored data on the tape, for example, using the format command, and write a tape header file based on the file system layout at the beginning of the tape, and a file delimiter at the end of the tape header file. This tape header data includes the file system magic number, file system version number, tape barcode, tape number, data block size, and application-custom header extension attributes.

[0132] Step S13: Write the tape header file to the tape storage and update the tape status of the tape storage to writable.

[0133] In this embodiment, the tape file system restores the tape state of the tape file system to the Science and Technology Association state after formatting. For example, the tape file system updates the MAM_TAPE_STATUS attribute field to a writable state.

[0134] Since the system described in Embodiment 5 of this application is a system used to implement the method of Embodiment 1 of this application, those skilled in the art can understand the specific structure and variations of the system based on the method described in Embodiment 1 of this application, and therefore will not be described again here. All systems used in the method of Embodiment 1 of this application fall within the scope of protection of this application.

[0135] Based on the same inventive concept, this application also provides a sixth embodiment. Referring to FIG6, FIG6 is a flowchart illustrating the sixth embodiment of the control method for the magnetic tape file system of this application.

[0136] In this embodiment, after generating the file storage record of the file to be stored based on the metadata and the file start block as described in step S30, the method further includes steps S31 to S34:

[0137] Step S31: Receive a file read request and determine the file to be read and the read parameters of the file read request;

[0138] Step S32: Obtain the file storage record of the file to be read from the storage record file, and determine the offset of the file to be read in the corresponding target tape file and the file start block of the target tape file according to the file storage record;

[0139] Step S33: Determine the starting block of the file to be read based on the file start block and the offset;

[0140] Step S34: Obtain the number of read data blocks of the file to be read from the read parameters, and read the file to be read according to the read start block and the number of read data blocks.

[0141] In this embodiment, the tape file system finds the recorded file information by file name based on the information recorded when the file is written, and calculates the starting block of the read area by reading offset. The starting block is the file starting block + 1 + (read offset / block size).

[0142] Specifically, the tape file system locates the starting block of the file read region on the tape, calculates the number of consecutive blocks to be read based on the continuous length specified in the read parameters, and reads the contents of those consecutive blocks. Furthermore, after obtaining the contents of the consecutive blocks, the tape file system truncates the portions of the first and last read blocks that are not located in the requested region, according to the file read request, and returns the final determined file to be read.

[0143] Since the system described in Embodiment Six of this application is a system used to implement the method of Embodiment One of this application, those skilled in the art can understand the specific structure and variations of the system based on the method described in Embodiment One of this application, and therefore will not be described again here. All systems used in the method of Embodiment One of this application fall within the scope of protection of this application.

[0144] Based on the same inventive concept, this application also provides a seventh embodiment. Referring to FIG7, FIG7 is a flowchart illustrating the seventh embodiment of the control method for the magnetic tape file system of this application.

[0145] In this embodiment, the control method of the magnetic tape file system further includes steps S71-S73:

[0146] Step S71: After receiving a file deletion request, determine the file to be deleted in the file deletion request;

[0147] Step S72: Determine the file storage record of the file to be deleted in the storage record file, and mark the file storage record as deleted;

[0148] Step S73: Based on the file to be stored, overwrite the file to be deleted in the magnetic tape storage.

[0149] In this embodiment, the tape file system can mark the file entry corresponding to the file to be deleted in the storage record file as deleted. After being marked as deleted, the tape file system can directly use the storage space corresponding to the file to be deleted, and when storing other files to be stored, it can overwrite the file to be deleted in the tape storage space in the disk storage space.

[0150] Since the system described in Embodiment 7 of this application is a system used to implement the method of Embodiment 1 of this application, those skilled in the art can understand the specific structure and variations of the system based on the method described in Embodiment 1 of this application, and therefore will not be described again here. All systems used in the method of Embodiment 1 of this application fall within the scope of protection of this application.

[0151] This application provides a control device for a magnetic tape file system, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the control method for the magnetic tape file system in Embodiment 1 described above.

[0152] Referring now to Figure 8, a schematic diagram of a control device suitable for implementing the tape file system embodiments of this application is shown. The control device for the tape file system in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. The control device for the tape file system shown in Figure 8 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0153] As shown in Figure 8, the control device for the tape file system may include a processing unit 1001 (e.g., a core processor, graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1002 or a program loaded from storage device 1003 into random access memory (RAM) 1004. RAM 1004 also stores various programs and data required for the operation of the tape file system control device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. The communication device 1009 allows the control device of the tape file system to communicate wirelessly or wiredly with other devices to exchange data. Although the figure shows control devices for tape file systems with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented alternatively.

[0154] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0155] The tape file system control device provided in this application, employing the tape file system control method described in the above embodiments, can solve the technical problem of large tape space occupied by metadata in the tape file system. Compared with the prior art, the beneficial effects of the tape file system control device provided in this application are the same as those of the tape file system control method provided in the above embodiments, and other technical features of the tape file system control device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0156] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0157] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0158] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the control method of the magnetic tape file system in the above embodiments.

[0159] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer magnetic tape, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact magnetic tape read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0160] The aforementioned computer-readable storage medium may be included in the control device of the tape file system; or it may exist independently and not be mounted in the control device of the tape file system.

[0161] The aforementioned computer-readable storage medium carries one or more programs. When the one or more programs are executed by the control device of the tape file system, the control device of the tape file system causes the following: based on the stored area of ​​the tape storage, to determine the file to be stored in the file start block of the tape storage; based on the file start block, to write the metadata of the file to be stored and the file to be stored as a tape file into the tape storage; based on the metadata and the file start block, to generate a file storage record of the file to be stored, and to store the file storage record to the external storage.

[0162] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0163] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0164] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0165] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., computer programs) for executing the control method of the above-described tape file system, thereby solving the technical problem of the large tape space occupied by metadata in the tape file system. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the control method of the tape file system provided in the above embodiments, and will not be repeated here.

[0166] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A control method for a magnetic tape file system, wherein, The tape file system includes tape storage and external storage, and the method includes the following steps: Based on the stored area of ​​the magnetic tape storage, determine the file start block of the magnetic tape storage where the file to be stored will be stored; Based on the file start block, the metadata of the file to be stored and the file to be stored are written as a magnetic tape file to the magnetic tape storage; Based on the metadata and the file start block, a file storage record for the file to be stored is generated and stored in the external storage.

2. The method as described in claim 1, wherein, The tape file includes header metadata, the file to be stored, and tail metadata. The steps of generating the tape file based on the metadata of the file to be stored and the file to be stored, and writing the tape file to the tape storage according to the file start block, include: The file header metadata is generated based on the metadata and the checksum type; Calculate the checksum of the file to be stored according to the checksum type, and generate the file end metadata according to the checksum and the metadata; Starting from the beginning block of the file, the file header metadata, the file to be stored, and the file tail metadata are sequentially written into the tape storage.

3. The method as described in claim 1, wherein, After the step of writing the metadata of the file to be stored and the file to be stored as a tape file to the tape storage based on the file start block, the method includes: Write the file delimiter of the tape file; and / or, Locate the file delimiter to the magnetic tape storage; Based on the previous data block of the file delimiter, read the file tail metadata of the tape file; Obtain the file storage size of the tape file from the file end metadata, and locate the file header metadata based on the file end metadata and the file storage size; The file storage record is generated based on the file header metadata.

4. The method of claim 1, wherein, After the step of writing the metadata of the file to be stored and the file to be stored as a tape file to the tape storage based on the file start block, the method includes: Determine the remaining storage capacity of the magnetic tape storage device; When the remaining storage amount is less than the storage amount threshold, the tape file storage information is determined based on the tape file stored in the tape memory. Based on the magnetic tape file storage information, an entry information file is generated, and based on the magnetic tape file space occupied and the number of magnetic tape file entries in the magnetic tape file storage information, an entry information file header and an entry information file footer are generated; Based on the entry information file header, the entry information file, and the entry information file footer, a tape end file is generated; Write the tape end file to the end of the storage space of the tape memory, and update the tape status of the tape memory to the sealed state.

5. The method of claim 4, wherein, After the steps of writing the tape end file to the end of the storage space of the tape memory and updating the tape status of the tape memory to the sealed state, the method includes: At the last data block at the end of the storage space, read the entry information file tail of the tape tail file; Obtain the space occupied by the tape file recorded at the end of the entry information file; Based on the space occupied by the magnetic tape file, determine the storage location of the entry information file, and obtain the entry information file based on the storage location; The file storage record is generated based on the magnetic tape information storage information in the entry information file.

6. The method of claim 1, wherein, Before the step of determining the data block of the file to be stored in the starting block of the tape memory based on the stored area of ​​the tape memory, the method further includes: Clear the stored data of the magnetic tape memory; Obtain the pre-stored file system layout, and generate the tape header file of the tape storage device according to the file system layout; Write the tape header file to the tape storage and update the tape status of the tape storage to writable.

7. The method of claim 1, wherein, After the steps of generating a file storage record for the file to be stored based on the metadata and the file start block of the data block, and storing the file storage record to the external storage, the method further includes: Receive a file read request and determine the file to be read and the read parameters; Obtain the file storage record of the file to be read from the storage record file, and determine the offset of the file to be read from the corresponding target tape file and the file start block of the target tape file based on the file storage record; The starting block of the file to be read is determined based on the file start block and the offset; Obtain the number of data blocks to be read from the read parameters, and read the file according to the start block and the number of data blocks to be read.

8. The method of claim 1, wherein, After the steps of generating a file storage record for the file to be stored based on the metadata and the file start block of the data block, and storing the file storage record to the external storage, the method further includes: Upon receiving a file deletion request, identify the file to be deleted in the file deletion request; The file storage record of the file to be deleted is determined in the storage record file, and the file storage record is marked as deleted; Based on the file to be stored, overwrite the file to be deleted in the magnetic tape storage.

9. A control device for a magnetic tape file system, wherein, The device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the control method for the magnetic tape file system as described in any one of claims 1 to 8.

10. A storage medium, wherein, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the control method of the magnetic tape file system as described in any one of claims 1 to 8.