Control method and device of tape file system and storage medium

By writing the metadata of the file to be stored in the tape file system together with the files to be stored on the tape and generating external file storage records, the problem of large space in the tape file system is solved, and storage efficiency is improved.

CN120019355APending Publication Date: 2025-05-16SHENZHEN JIETENG TECHNOLOGY CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202480002869.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The tape space occupied by metadata in the tape file system is large, resulting in insufficiency of storage.

Method used

When saving the file to be stored in the tape memory, the metadata of the file to be stored is generated together with the file to be stored, and an external file storage record is generated based on the file starting block and metadata allocated for the file to be stored in the tape memory.

Benefits of technology

This avoids writing every metadata in a full amount, thereby reducing the storage space occupied by metadata in the tape memory and improving storage efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120019355A_ABST
    Figure CN120019355A_ABST
Patent Text Reader

Abstract

The invention discloses a control method and device for a tape file system and a storage medium, and the method comprises the steps: determining a file start block of a tape file corresponding to a to-be-stored file in a tape memory according to a stored region of the tape memory, generating the tape file based on metadata of the to-be-stored file and the to-be-stored file, and storing the generated tape file in the tape memory. And according to the file starting block, writing the tape file into a storage space, taking the file starting block as a storage starting point, of the tape memory, according to the metadata and the file starting block, generating a file storage record of the to-be-stored file, and storing the file storage record into an external memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a control method, device and storage medium of a tape file system. Background Art

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

[0003] In the related art, LTFS writes file data in an append-write manner, and while writing incremental file data to the data partition, generates metadata and writes it to the index partition. Among them, LTFS usually writes metadata in full. Therefore, each time metadata is written, the metadata contains index information of all file data on the current tape. This results in a large amount of tape storage space occupied by metadata.

[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. SUMMARY OF THE INVENTION Technical issues

[0005] The main purpose of the present application is to provide a control method, device and storage medium for a tape file system, aiming to solve the technical problem that the tape space occupied by metadata in a tape file system is large. Technical Solutions

[0006] To achieve the above object, the present application provides a method for controlling a tape file system, the method comprising the following steps:

[0007] Determine, according to the stored area of ​​the magnetic tape storage, a file start block of the file to be stored in the magnetic tape storage;

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

[0009] A file storage record of the file to be stored is generated according to the metadata and the file start block, and the file storage record is stored in the external storage device.

[0010] In one embodiment, the tape file includes file header metadata, the file to be stored, and file tail metadata, and 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:

[0011] Generate the file header metadata based on the metadata and the check code type;

[0012] Calculating a check code of the file to be stored according to the check code type, and generating the file tail metadata according to the check code and the metadata;

[0013] Starting from the file start block, the file header metadata, the file to be stored and the file tail metadata are written into the tape storage in sequence.

[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 into the tape storage based on the file start block, the method further comprises:

[0015] a file separator written into the tape file; and / or,

[0016] Locating the file delimiter of the tape storage;

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

[0018] Acquire the file storage capacity of the tape file in the file tail metadata, and locate the file header metadata according to the file tail metadata and the file storage capacity;

[0019] The file storage record is generated according to 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 into the tape storage based on the file start block, the method further comprises:

[0021] Determining the remaining storage capacity of the magnetic tape storage;

[0022] When the remaining storage capacity is less than a storage capacity threshold, determining the tape file storage information according to the tape file stored in the tape storage;

[0023] Generate an entry information file according to the tape file storage information, and generate an entry information file header and an entry information file trailer according to the tape file occupied space and the number of tape file entries of the tape file storage information;

[0024] generating a tape trailer file based on the entry information file header, the entry information file and the entry information file trailer;

[0025] The tape tail file is written to the end of the storage space of the tape storage, and the tape state of the tape storage is updated to a sealed state.

[0026] In one embodiment, after the step of writing the tape tail file to the end of the storage space of the tape storage and updating the tape state of the tape storage to a sealed state, the following steps are included:

[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] Obtaining the space occupied by the tape file recorded in the end of the entry information file;

[0029] Determine the storage location of the entry information file according to the space occupied by the tape file, and obtain the entry information file based on the storage location;

[0030] The file storage record is generated according to the tape information storage information of the entry information file.

[0031] In one embodiment, before the step of determining, based on the stored area of ​​the tape storage device, the data block of the file to be stored at the file start block of the tape storage device, the step further includes:

[0032] Clearing the stored data in the magnetic tape storage;

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

[0034] The tape header file is written into the tape storage, and the tape state of the tape storage is updated to a writable state.

[0035] In one embodiment, after the step of generating a file storage record of the file to be stored according to the metadata and the file start block of the data block, and storing the file storage record in the external storage device, the step further includes:

[0036] Receive a file reading request, and determine a file to be read and a reading parameter of the file reading request;

[0037] Obtaining the file storage record of the to-be-read file in the storage record file, and determining the offset of the to-be-read file in the corresponding target tape file and the file start block of the target tape file according to the file storage record;

[0038] Determine a read start block of the file to be read according to the file start block and the offset;

[0039] The number of read data blocks of the to-be-read file in the read parameter is obtained, and the to-be-read file is read according to the read start block and the number of read data blocks.

[0040] In one embodiment, after the step of generating a file storage record of the file to be stored according to the metadata and the file start block of the data block, and storing the file storage record in the external storage device, the step further includes:

[0041] After receiving the file deletion request, determining the file to be deleted in the file deletion request;

[0042] Determining the file storage record of the to-be-deleted file in the storage record file, and marking the file storage record as deleted;

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

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

[0045] In addition, to achieve the above-mentioned purpose, the present application also provides a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the control method of the tape file system as described above are implemented. Beneficial Effects

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

[0047] The present application generates a tape file together with the metadata of the file to be stored when saving the file to be stored in the tape storage, and generates an external file storage record according to the file start block allocated by the tape storage for the file to be stored and the metadata, so that the user can quickly query the data in the tape storage according to the file storage record and the metadata, and avoids the need to write the metadata in full each time, thereby reducing the storage space occupied by the metadata in the tape storage. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0050] Figure 1 This is a flow chart of a first embodiment of a method for controlling a tape file system of the present application;

[0051] Figure 2 This is a flow chart of a second embodiment of a method for controlling a tape file system of the present application;

[0052] Figure 3 This is a flow chart of a third embodiment of the control method of the tape file system of the present application;

[0053] Figure 4 This is a flow chart of a fourth embodiment of a method for controlling a tape file system of the present application;

[0054] Figure 5 This is a flowchart of a fifth embodiment of a method for controlling a tape file system of the present application;

[0055] Figure 6 This is a flow chart of a sixth embodiment of the control method of the tape file system of the present application;

[0056] Figure 7 This is a flow chart of a seventh embodiment of the method for controlling a tape file system of the present application;

[0057] Figure 8 It is a structural diagram of a control device of a tape file system in a hardware operating environment involved in an embodiment of the present application.

[0058] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with 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 only used to explain the present application and are not used to limit the present application.

[0060] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

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

[0062] Since the Linear Tape File System (LTFS) uses the append-write method to write file data in the process of searching for file data stored in the data partition through the metadata in the index partition, and writes the generated metadata to the index partition in full while writing the incremental file data to the data partition, each time the metadata is written, the metadata contains the index information of all file data on the current tape, resulting in a large tape space occupied by the metadata in the tape.

[0063] The present application generates a tape file together with the metadata of the file to be stored when saving the file to be stored in the tape storage, and generates an external file storage record according to the file start block allocated by the tape storage for the file to be stored and the metadata, so that the user can quickly query the data in the tape storage according to the file storage record and the metadata, and avoids the need to write the metadata in full each time, thereby reducing the storage space occupied by the metadata in the tape storage.

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

[0065] It should be noted that the execution subject of this embodiment can be a tape file system, or a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a control device of the tape file system, etc., and this embodiment does not specifically limit this. The tape file system is taken as an example to illustrate this embodiment and the following embodiments.

[0066] Based on this, the present application embodiment provides a method for controlling a tape file system, referring to Figure 1 , Figure 1This is a flow chart of a first embodiment of a method for controlling a tape file system of the present application.

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

[0068] Step S10: determining a file start block of a file to be stored in the tape storage according to the stored area of ​​the tape storage;

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

[0070] Furthermore, the tape file system stores the tape files in sequence based on the order of the tape storage space. After obtaining the file to be stored, the tape file system determines the stored area in the tape storage used to store the file to be stored, and uses the next data block space of the stored area as the file start block of the tape file, and uses the file start block as the starting point to store the data blocks generated based on the file to be stored in the tape storage in sequence according to the order of the tape storage space, that is, a 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 the tape data area (EOD) and records the current position as the file start block. The file start block is the first data block in the space where the tape file is stored in the tape storage. The tape file system uses a 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: writing 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 file start block;

[0073] It should be noted that the Linear Tape File System (LTFS) stores metadata and file data separately in a partitioned manner. Therefore, each time LTFS writes metadata, it writes the index information of all files contained in the tape. The space complexity of metadata writing is O(n2). Metadata occupies a large space and depends on the tape's support for multiple partitions, where n is the number of files. At the same time, if the tape file system writes metadata periodically, if the data cannot be written due to server downtime or tape medium failure before the data is written, the index of all files written after the most recent data write will be lost and cannot be retrieved. In addition, for multi-partition scenarios of tapes, different partitions need to be isolated by protection areas. Data cannot be written to the protection area, resulting in loss of available capacity.

[0074] In this embodiment, when each file to be stored is written, the tape file system also writes its metadata information, thereby ensuring that the files written to the tape are not lost and that the metadata overhead meets the O(n) complexity. And based on a single tape partition implementation, the reliance on the tape medium hardware supporting multi-partition features is reduced. At the same time, after writing the metadata of the data to be stored, a single metafile will not affect other metafiles.

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

[0076] Step S21: generating the file header metadata based on the metadata and the verification code type;

[0077] In this embodiment, the tape file system first determines the corresponding metadata based on the file to be stored, constructs the file header metadata, and writes the file header metadata into the file header. The file header metadata includes information such as the file storage capacity and the file path. At the same time, the tape file system can determine the check code type of the tape file according to the system preset or the user's selection, and write the identification information corresponding to the check code type into the file header metadata.

[0078] Step S22: calculating the check code of the file to be stored according to the check code type, and generating the file tail metadata according to the check code and the metadata;

[0079] In this embodiment, when writing the file to be stored, the check code is calculated according to the check code type and written into the file tail metadata. At the same time, the tape file system obtains the file storage capacity of the tape file and writes it into the file tail metadata.

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

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

[0082] Exemplarily, each tape file is composed of continuous 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, check code type, file number, file storage capacity, file write timestamp, file path, and file extension attributes written by the application. Among them, the file header magic number is an identifier of the file format, the check code type is used to determine the method for calculating the check code for the file to be stored, and the file number is used to indicate that each tape file is unique in an instance. After the file header metadata of the tape file, it is the data block of the file to be stored. The tape file system divides the file to be stored into multiple data blocks for storage based on the data block size set in the system, and the data part of the file is divided into fixed-length data blocks, for example, the fixed length can be selected as 512KiB. 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 storage capacity, and file check code. In addition, each file tail is followed by a FileMark, which is used to divide 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 checked based on the checksum when reading the tape file. The file header will record the path and size content of the file, and the file tail will record the checksum of the file. When reading, first locate the header to further confirm whether the stored file location is consistent with that saved on the tape. In addition, after reading the entire file, read the checksum from the file tail to further verify the data consistency.

[0084] In one embodiment, the tape file system may also store all metadata of the data to be stored in the file header or the file tail, so that the tape file system determines and obtains the corresponding metadata storage location through the file delimiter.

[0085] Step S30: Generate a file storage record of the file to be stored according to the metadata and the file start block, and store the file storage record in the external storage device.

[0086] In this embodiment, after the tape file system completes the storage of the file to be stored, it will generate a file storage record of the tape storage, and summarize the file storage record into a storage record file to record the file information. The file information recording method can be recorded in a tape external database or file mode, and the file storage record is stored in the external storage.

[0087] For example, taking database records as an example, the tape file system allocates a table for each tape in the database, and each row of the table records information such as the file name, starting block, file number, deletion mark, file storage capacity, etc. Users can use the file storage records to determine the storage location of the tape file to be queried and obtain it.

[0088] The embodiment of the present application generates a tape file together with the metadata of the file to be stored when saving the file to be stored to the tape storage, and generates an external file storage record according to the file start block allocated by the tape storage for the file to be stored and the metadata, so that the user can quickly query the data in the tape storage according to the file storage record and the metadata, and avoids the need to write the metadata in full each time, thereby reducing the storage space occupied by the metadata in the tape storage.

[0089] Based on the same inventive concept, the present application also provides a second embodiment, referring to Figure 2 , Figure 2 This is a flow chart of a second embodiment of a method for controlling a tape file system of the present application.

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

[0091] Step S41: writing the file separator of the tape file;

[0092] In this embodiment, the tape file system adds a file separator after the end of a tape file, a tape header file, or a tape tail file, so as to mark the boundary of the tape file.

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

[0094] Step S43: reading the file tail metadata of the tape file based on the previous data block of the file delimiter;

[0095] Step S44: obtaining the file storage capacity of the tape file in the file tail metadata, and locating the file header metadata according to the file tail metadata and the file storage capacity;

[0096] Step S45: Generate the file storage record according to the file header metadata.

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

[0098] Specifically, the tape file system uses a traversal method to locate the file separator in the tape, obtain the previous data block of the file identifier, that is, the file tail of the tape file, read the file tail metadata, and determine the file storage capacity of the tape file. Based on the file storage capacity and the storage address of the tape file tail, the tape file system can locate the file header and obtain the file header metadata, thereby reading the file storage record of the tape file corresponding to the file separator. After completing the traversal of all file separators, the tape file can obtain the file storage records of all tape files in the tape storage.

[0099] Exemplarily, the tape file system locates the first file separator in the tape storage based on the spacefm forward instruction, that is, skips the tape header file. The tape file system locates the next file separator in a loop execution manner, and moves back one data block, reads the file tail metadata (FileMetaTail), and obtains the file storage capacity. Calculate the file header metadata (FileMetaHeader) position, that is, the current block offset-1-(file storage capacity / data block storage capacity)-1. Locate the FileMetaHeader position, read the FileMetaHeader, and obtain the file entry information based on the information stored in the FileMetaHeader. If the file entry corresponding to the file already exists in the external record, it is updated. If not, a new file entry is inserted. When the tape file system locates to the end of the tape, it exits the loop.

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

[0101] The embodiment of the present application recovers the file storage record by traversing the tape file metadata when the tape tail file is not generated on the disk.

[0102] Since the system introduced in the second embodiment of the present application is a system used to implement the method of the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the system, so it is not repeated here. All systems used in the method of the first embodiment of the present application belong to the scope of protection of this application.

[0103] Based on the same inventive concept, the present application also provides a third embodiment, referring to Figure 3 , Figure 3 This is a flow chart of a third embodiment of a method for controlling a tape file system of the present application.

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

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

[0106] Step S52: when the remaining storage capacity is less than the storage capacity threshold, determining the tape file storage information according to the tape file stored in the tape storage;

[0107] Step S53: generating an entry information file according to the tape file storage information, and generating an entry information file header and an entry information file trailer according to the tape file occupied space and the number of tape file entries of the tape file storage information;

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

[0109] In this embodiment, the tape storage includes a writable state and a sealed state. The writable state indicates that the tape storage is not sealed, the tape contains a tape header file and a tape file, and the tape file system can continuously store the tape file generated by the file to be stored at the front end of the area in the tape file system where no data is stored. The sealed state indicates that the current data has been fully stored and entered the sealing state, at which time the disk can no longer be used for storage. When the remaining storage capacity of the tape storage is less than the storage capacity threshold, the tape file system seals the tape. After sealing, the tape is no longer written.

[0110] Specifically, the tape file system obtains all valid file items of the current tape, that is, all files that are not marked as deleted and 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 items. Among them, based on the file system layout, the entry information file header contains a magic number, a file system version, the number of file entries, and the space occupied by the file entries. Each entry information file includes an entry magic number, an entry size, a starting offset of the corresponding file on the tape, a file storage capacity, a file number, a file path, a file entry write timestamp, and extended attributes written by the application. The entry information file tail contains a magic number, a version number, and the space occupied by the file entry. The tape file system forms a tape tail file by appending the constructed entry information file header, entry information file, and entry information file tail to the end of the tape, and writing a file delimiter.

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

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

[0113] In this embodiment, after the tape tail file is written to the end of the storage space of the tape storage, the current state of the tape storage can be updated. For example, the state of the tape file system is identified by the private MAM_TAPE_STATUS attribute on the tape. The MAM_TAPE_STATUS attribute identification includes two states: writable and sealed.

[0114] The embodiment of the present application records the file entry information of the tape files stored in 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 to the tape and avoiding the files in the tape from being overwritten.

[0115] Since the system introduced in the third embodiment of the present application is a system used to implement the method of the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the system, so it is not repeated here. All systems used in the method of the first embodiment of the present application belong to the scope of protection of the present application.

[0116] Based on the same inventive concept, the present application also provides a fourth embodiment, referring to Figure 4 , Figure 4 This is a flow chart of a fourth embodiment of a method for controlling a tape file system of the present application.

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

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

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

[0120] Step S63: determining the storage location of the entry information file according to the space occupied by the tape file, and acquiring the entry information file based on the storage location;

[0121] Step S64: Generate the file storage record according to the tape information storage information of the entry information file.

[0122] In this embodiment, when the tape file system reads the tape file, it relies on the file storage record to avoid searching for the file through the file system metadata recorded by the tape file system itself each time. In order to avoid the tape file storage record being damaged and causing the file in the tape file system to be unreadable, the file storage record can be restored based on the metadata stored in the tape itself.

[0123] Specifically, when the read magnetic tape is in a sealed state, the magnetic tape file system can regenerate the file storage record by directly acquiring the entry information file in the tail file of the magnetic tape.

[0124] In one embodiment, the tape file system locates the end of the tape, and reads the end of the entry information file at the last data block of the file delimiter at the end of the tape, that is, the last data block at the end of the storage space, obtains the space occupied by the file entry, and calculates the position of the entry information file header and the entry information according to the space occupied by the file entry. Based on the entry information file header, each entry information file is read and parsed, the tape file storage information in the entry information file is obtained, and the file storage record is regenerated.

[0125] The embodiment of the present application uses the metadata at the end of the entry information file in the tape tail file to read the tape file storage information in the entry information file and restore the file storage record, thereby improving the stability of storing and searching data in the tape file system.

[0126] Since the system introduced in the fourth embodiment of the present application is a system used to implement the method of the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the system, so it is not repeated here. All systems used in the method of the first embodiment of the present application belong to the scope of protection of this application.

[0127] Based on the same inventive concept, the present application also provides a fifth embodiment, referring to Figure 5 , Figure 5 This is a flow chart of a fifth embodiment of a method for controlling a tape file system of the present application.

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

[0129] Step S11: clearing the stored data in the magnetic tape storage;

[0130] Step S12: obtaining a pre-stored file system layout, and generating a tape header file of the tape storage 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 data currently stored in the tape, for example, by using the format command, and write a tape header file at the head of the tape based on the file system layout, and write a file separator at the end of the tape header file. The tape header data includes a file system magic number, a file system version number, a tape barcode, a tape number, a data block size, and an application-defined header extended attribute.

[0132] Step S13: Write the tape header file into the tape storage, and update the tape state of the tape storage to a writable state.

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

[0134] Since the system introduced in the fifth embodiment of the present application is a system used to implement the method of the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the system, so it is not repeated here. All systems used in the method of the first embodiment of the present application belong to the scope of protection of the present application.

[0135] Based on the same inventive concept, the present application also provides a sixth embodiment, referring to Figure 6 , Figure 6 This is a flow chart of a sixth embodiment of a method for controlling a tape file system of the present application.

[0136] In this embodiment, after generating the file storage record of the file to be stored according to the metadata and the file start block as described in step S30, steps S31 to S34 are also included:

[0137] Step S31: receiving a file reading request, and determining a file to be read and a reading parameter of the file reading request;

[0138] Step S32: obtaining the file storage record of the to-be-read file in the storage record file, and determining the offset of the to-be-read file 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: determining a read start block of the file to be read according to the file start block and the offset;

[0140] Step S34: acquiring the number of read data blocks of the to-be-read file in the read parameter, and reading the to-be-read file 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 the file name according to the information recorded when the file is written, and calculates the read start block of the read area by reading the offset, where the start block is the file start block + 1 + (read offset / block size).

[0142] Specifically, the tape file system locates the starting block of the file reading area in the tape, calculates the number of continuous blocks required to be read according to the continuous length specified by the reading parameter, and reads the continuous block content. In addition, after obtaining the continuous block content, the tape file system truncates the first read block and the last read block that are not located in the request area according to the file reading request, and returns the last determined read file.

[0143] Since the system introduced in the sixth embodiment of the present application is a system used to implement the method of the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the system, so it is not repeated here. All systems used in the method of the first embodiment of the present application belong to the scope of protection of the present application.

[0144] Based on the same inventive concept, the present application also provides a seventh embodiment, referring to Figure 7 , Figure 7This is a flow chart of a seventh embodiment of the control method of a tape file system of the present application.

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

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

[0147] Step S72: determining the file storage record of the to-be-deleted file in the storage record file, and marking the file storage record as deleted;

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

[0149] In this embodiment, the tape file system can mark the file item corresponding to the to-be-deleted file corresponding to the file deletion request as deleted in the storage record file. After marking as deleted, the tape file system can directly use the storage space corresponding to the to-be-deleted file, and overwrite the to-be-deleted file in the tape storage in the disk storage space when storing other to-be-stored files.

[0150] Since the system introduced in the seventh embodiment of the present application is a system used to implement the method of the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the system, so it is not repeated here. All systems used in the method of the first embodiment of the present application belong to the scope of protection of the present application.

[0151] The present application provides a control device for a tape file system, the device comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the control method for the tape file system in the above-mentioned embodiment 1.

[0152] Reference below Figure 8, which shows a schematic diagram of the structure of a control device for implementing a tape file system in an embodiment of the present application. The control device for the tape file system in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The control device of the tape file system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0153] like Figure 8 As shown, the control device of the tape file system may include a processing device 1001 (e.g., a core processor, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the control device of the tape file system are also stored. The processing device 1001, ROM 1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the control device of the tape file system to communicate with other devices wirelessly or by wire to exchange data. Although the control device of the tape file system with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0154] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

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

[0156] It should be understood that the various parts disclosed in this application can be implemented by 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 one or more embodiments or examples in a suitable manner.

[0157] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0158] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the control method of the tape file system in the above-mentioned embodiment.

[0159] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer tape, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact tape read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. 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 combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0160] The computer-readable storage medium may be included in the control device of the tape file system; or may exist independently without being assembled into the control device of the tape file system.

[0161] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by a control device of the tape file system, the control device of the tape file system: determines the file start block of the file to be stored in the tape storage according to the stored area of ​​the tape storage; writes 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 file start block; generates a file storage record of the file to be stored according to the metadata and the file start block, and stores the file storage record in the external storage.

[0162] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Small talk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may 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 may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0163] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0164] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

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

[0166] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

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

2. The method of claim 1, wherein: The tape file includes file header metadata, The steps of generating the tape file based on the metadata of the file to be stored and the file tail metadata and writing the tape file into the tape storage according to the file start block include: Generate the file header metadata based on the metadata and the check code type; Calculating a check code of the file to be stored according to the check code type, and generating the file tail metadata according to the check code and the metadata; Starting from the file start block, the file header metadata, the file to be stored and the file tail metadata are written into the tape storage in sequence.

3. 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 into the tape storage based on the file start block, the method further comprises: a file separator written into the tape file; and / or, Locating the file delimiter of the tape storage; Based on the previous data block of the file delimiter, reading the file tail metadata of the tape file; Acquire the file storage capacity of the tape file in the file tail metadata, and locate the file header metadata according to the file tail metadata and the file storage capacity; The file storage record is generated according to 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 into the tape storage based on the file start block, the method further comprises: Determining the remaining storage capacity of the magnetic tape storage; When the remaining storage capacity is less than a storage capacity threshold, determining the tape file storage information according to the tape file stored in the tape storage; Generate an entry information file according to the tape file storage information, and generate an entry information file header and an entry information file trailer according to the tape file occupied space and the number of tape file entries of the tape file storage information; generating a tape trailer file based on the entry information file header, the entry information file and the entry information file trailer; The tape tail file is written to the end of the storage space of the tape storage, and the tape state of the tape storage is updated to a sealed state.

5. The method of claim 4, wherein: After the step of writing the tape tail file to the end of the storage space of the tape storage and updating the tape state of the tape storage to a sealed state, the method further comprises: At the last data block at the end of the storage space, read the entry information file tail of the tape tail file; Obtaining the space occupied by the tape file recorded in the end of the entry information file; Determining a storage location of the entry information file according to the space occupied by the tape file, and acquiring the entry information file based on the storage location; The file storage record is generated according to the tape information storage information of 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 at the file start block of the tape storage according to the stored area of ​​the tape storage, the method further includes: Clearing the stored data in the magnetic tape storage; Acquire a pre-stored file system layout, and generate a tape header file of the tape storage according to the file system layout; The tape header file is written into the tape storage, and the tape state of the tape storage is updated to a writable state.

7. The method of claim 1, wherein: After the step of generating a file storage record of the file to be stored according to the metadata and the file start block of the data block, and storing the file storage record in the external storage device, the method further includes: Receive a file reading request, and determine a file to be read and a reading parameter of the file reading request; Obtaining the file storage record of the to-be-read file in the storage record file, and determining the offset of the to-be-read file in the corresponding target tape file and the file start block of the target tape file according to the file storage record; Determine a read start block of the file to be read according to the file start block and the offset; The number of read data blocks of the to-be-read file in the read parameter is obtained, and the to-be-read file is read according to the read start block and the number of read data blocks.

8. The method of claim 1, wherein: After the step of generating a file storage record of the file to be stored according to the metadata and the file start block of the data block, and storing the file storage record in the external storage device, the method further includes: After receiving the file deletion request, determining the file to be deleted in the file deletion request; Determining the file storage record of the to-be-deleted file in the storage record file, and marking the file storage record as deleted; Based on the file to be stored, the file to be deleted in the tape storage is overwritten.

9. A control device for a tape file system, wherein: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for controlling a tape file system according to 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, the steps of the method for controlling the tape file system according to any one of claims 1 to 8 are implemented.

Citation Information

Cited By

  • Cross-cloud data migration method and device and storage medium

    CN120856666A

  • Cross-cloud data migration method, device and storage medium

    CN120856666B

  • Method and system for storing severe environment monitoring data

    CN121785548A