Method, apparatus, electronic device and medium for managing files
Patent Information
- Application Number
- CN202210061849.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-19
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2042-01-19
AI Technical Summary
这种方法需要较长的时间才能完成,难以满足业务需要
Smart Images

Figure CN116501693B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of this disclosure relate to the field of computers, and more specifically, to storage systems. Embodiments of this disclosure provide methods, apparatus, electronic devices, media, and computer program products for managing files. Background Technology
[0002] Storage systems often contain a large number of files. Typically, a single directory may hold tens of thousands or even more files. In some applications, batch processing of these files is required, which consumes significant computing resources. This is because it necessitates retrieving the storage addresses of the file data blocks from their metadata before any manipulation of those blocks can occur. This method is time-consuming and unsuitable for business needs. Therefore, an efficient solution is required to manage the large number of files in a storage system. Summary of the Invention
[0003] According to a first aspect of this disclosure, a method for managing files is provided. The method includes setting a group identifier for the file. The method also includes determining the storage address of a data block of the file, the storage address indicating the disk extent and offset where the data block resides. The method further includes setting a tag for the data block based on the offset in a storage area of the disk extent corresponding to the group identifier.
[0004] According to a second aspect of this disclosure, an apparatus for managing files is also provided. The apparatus includes a grouping unit, an address determination unit, and a tagging unit. The grouping unit is configured to set group identifiers for files. The address determination unit is configured to determine the storage addresses of data blocks of the file, the storage addresses indicating the disk extent and offset where the data blocks reside. The tagging unit is configured to set a tag for the data blocks based on the offset in a storage area of the disk extent corresponding to the group identifier.
[0005] According to a third aspect of this disclosure, an electronic device is provided. The electronic device includes at least one processing unit and at least one memory. The at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit, which, when executed by the at least one processing unit, cause the electronic device to perform the method according to a first aspect of this disclosure.
[0006] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided, including machine-executable instructions that, when executed by a device, cause the device to perform a method according to a first aspect of this disclosure.
[0007] According to a fifth aspect of this disclosure, a computer program product is provided, which is tangibly stored on a computer-readable medium and includes machine-executable instructions that, when executed by a device, cause the device to perform the method according to the first aspect. Attached Figure Description
[0008] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0009] Figure 1 A block diagram of an example environment according to some embodiments of the present disclosure is shown;
[0010] Figure 2 A schematic flowchart of a method for managing files according to some embodiments of the present disclosure is shown;
[0011] Figure 3 A schematic flowchart illustrating a method for deleting files in a storage system according to some embodiments of the present disclosure is shown;
[0012] Figure 4 A schematic block diagram of an apparatus for managing files according to some embodiments of the present disclosure is shown; and
[0013] Figure 5 A schematic block diagram of an example device that can be used to implement some embodiments of the present disclosure is shown. Detailed Implementation
[0014] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0015] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "an embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0016] Furthermore, all specific values in this article are examples only, intended to aid understanding, and are not intended to limit any range.
[0017] As mentioned above, a large number of files are stored in the storage system. When these files need to be processed in batches, the processor needs to access the metadata of these files to find the storage location of the file's data blocks before it can operate on the file's data blocks. However, accessing the metadata of each file individually will consume a lot of computing resources, and since the individual data blocks of the files are distributed throughout the storage system, operating on these data blocks will introduce a large amount of scattered input / output (I / O) on the storage devices, which also degrades the performance of the storage system.
[0018] One known approach involves using asynchronous threads to perform batch operations on files in the background. However, this method is difficult to complete in a short time. For example, when the storage system is short of space and needs to delete a large number of expired files to free up space, the deletion operation may take several hours or even longer.
[0019] Embodiments of this disclosure provide a scheme for managing files. According to embodiments of this disclosure, files are divided into several groups (also referred to as "domains") by setting group identifiers, and storage areas are set up in a disk extent for each group. The storage areas have tags for data blocks within the disk extent. In other words, the tags set in each storage area indicate that the file to which the data block at the corresponding offset belongs is set in the corresponding group. Thus, file group management can be achieved through these tags.
[0020] As will be understood from the following description, compared with known conventional solutions, the solution according to the embodiments of this disclosure utilizes the tags already set in the disk areas of the storage system to perform batch operations on a large number of files in the storage system according to the group identifier, without needing to access the file's metadata, thereby saving computing resources and improving management efficiency.
[0021] The following description will continue with reference to the accompanying drawings, which will provide some exemplary embodiments of this disclosure.
[0022] Figure 1 A block diagram of an example environment 100 according to some embodiments of the present disclosure is shown. Figure 1 As shown, the example environment 100 can generally relate to a distributed storage system. In some embodiments, the example environment 100 includes electronic devices 100 and storage nodes 120 and 130 connected to each other via a network.
[0023] Electronic device 110 may be a computing device such as a personal computer, workstation, or server. The scope of this disclosure is not limited in this respect. In some embodiments, electronic device 110 may access or manipulate files stored on storage nodes 120 and 130 via a network, for example, by creating new files, reading files, writing files, deleting files, migrating files, etc. In this document, files may also include directories in the storage system.
[0024] Storage nodes 120 and 130 may include clusters of storage devices such as disk arrays. Figure 1 As shown, storage node 120 includes multiple disks 120-1, 120-2, 120-3, etc., and storage node 130 includes multiple disks 130-1, 130-2, 130-3, etc. In the example environment 100, such as a distributed storage system, storage nodes 120 and 130 may be geographically distant from each other and may jointly provide a unified storage address space using the management software or hardware of the distributed storage system. It should be understood that environment 100 may include more or fewer storage nodes, and storage nodes 120 or 130 may include more or fewer disks. The scope of this disclosure is not limited in this respect.
[0025] Files can be divided into data blocks, which can be distributed across the disks of storage nodes 120 and 130. Metadata, such as inodes (also known as index nodes), is provided for file management. Metadata can record the file's byte count, the file owner's identifier, read, write, and execute permissions, the file's timestamp, and the storage address of the file's data blocks. In a distributed storage system, the storage address indicates the storage node, extent, and offset of the data block. For example, a storage node can be identified by its node identifier (ID), an extent by its disk identifier, and the offset by the number of blocks on the extent relative to the beginning of the disk.
[0026] Although example environment 100 is shown as a distributed storage system, embodiments of this disclosure can also be implemented in different environments. For example, embodiments of this disclosure may be implemented in an environment with a single disk or a single storage node.
[0027] Figure 2 A schematic flowchart of a method 200 for managing files according to some embodiments of the present disclosure is shown. Method 200 may be, for example... Figure 1 The electronic device 110 is used to implement this.
[0028] In box 210, electronic device 110 sets a group identifier for files. The group identifier may also be referred to as a domain identifier. The group identifier can be represented by a number, for example, one of 0 to 7 (3 bits are required in binary form). In some embodiments, the action of setting a group identifier can be manually triggered or automatically triggered. For example, a user may want to delete all files in a directory in the future; the user can set a group identifier for that directory, an operation that can be referred to as "grouping." Accordingly, the files (and their snapshots) in that directory are automatically set with the same group identifier. Alternatively, if a directory has not been updated for a period of time, electronic device 110 can automatically trigger the setting of a group identifier for that directory in preparation for future actual deletion. It should be understood that setting a group identifier for files is not limited to setting the same group identifier for the same directory, and the group identifier is not necessarily used for deleting files; it can be used for other purposes, and the scope of this disclosure is not limited in this respect.
[0029] In some embodiments, the group identifier can be set in the file's metadata. As mentioned above, a file has corresponding metadata, which stores basic information about the file, such as size, access permissions, and storage addresses of data blocks. Therefore, the metadata also includes the file's group identifier for subsequent access and use.
[0030] Metadata blocks, like regular data blocks, are stored in the storage system. For example, the storage address of metadata indicates the storage node, extent, offset, etc., where the metadata resides. In some embodiments, the storage unit for storing regular data can be an 8KB block on an extent, while the storage unit for storing metadata can be a 512-byte region on an extent. This is because metadata is typically small, and storing it in 512-byte regions saves storage space.
[0031] In some embodiments, a mapping table is also provided that corresponds to the storage addresses of files and their metadata. The mapping table can be implemented as a B-tree or other data structures. For distributed storage systems, the mapping table can also be referred to as a logical inode (LIN) tree. The mapping table is used when a file is opened. The mapping table includes entries with the file's identifier (also referred to as a "logical inode" or LIN) and the storage addresses of its metadata. In some embodiments, the file identifier can be represented by 8 bytes, or 64 bits. Once a file is created, its identifier is determined and cannot be changed. In a storage system, even if a file is deleted, its identifier may no longer be used by any other file. As mentioned above, the storage address of the metadata indicates the storage node, extent, and offset where the metadata resides.
[0032] In some embodiments, the group identifier can be set in the file's metadata. Specifically, the electronic device 110 can determine the metadata address corresponding to the file's identifier based on a mapping table, and then set the group identifier in the metadata based on that metadata address.
[0033] In some embodiments, group identifiers can be set in directories as described in the documentation, thereby assigning the same group identifier to all files in the same directory. That is, all files (including existing and future files) in the same directory are grouped together for management.
[0034] Suppose we can choose any one of 1 to 7 as the group identifier. For example, we can set a directory to have a specific group identifier, such as "3". Then, all existing files in that directory can be set to have group identifier "3", and any new files created in that directory afterward will also be automatically set to group identifier "3". This is advantageous because all files in the entire directory can be processed together using the same group identifier, as will be explained in detail below.
[0035] Furthermore, in some embodiments, if the group identifier is used to prevent the creation of references to the directory or files within the directory outside the directory if the directory is subsequently deleted, the references will become invalid because the directory or files within the directory will be deleted at some point in the future.
[0036] Continue to refer to Figure 2 In box 220, electronic device 110 determines the storage address of a data block of a file, the storage address indicating the disk area and offset where the data block is located. In some embodiments, the determination of the storage address of the data block of the file and the subsequent setting of a marker in box 230 can be triggered manually or automatically by the user, and this action can be collectively referred to as "marking".
[0037] Let's continue with the example of group identifier "3". Electronic device 110 traverses the metadata of all files in a certain directory of the storage system, finds the files with group identifier "3", and the storage addresses of their data blocks. A file's data block can include data blocks containing the file's metadata and data blocks containing the file's general data. To do this, electronic device 110 can first access a mapping table to obtain the storage address of the metadata's data block, then access the metadata at that address, and based on the data block address information in the metadata, determine the storage address of the file's general data block.
[0038] As mentioned above, in a distributed storage system, the storage address of a data block indicates the storage node, extent, and offset where the data block resides. For storage systems that include a single disk or a single storage node, the storage address may not indicate the storage node.
[0039] A disk extent can be a cylinder group (CG) of a disk. In a storage system, a disk is divided into one or more regions called cylinder groups, which consist of one or more consecutive cylinders at the same distance from the center of the disk. For example, a cylinder group can have 32MB of storage space, comprising 4096 blocks of 8KB each. The blocks within a cylinder group have corresponding offsets relative to the beginning of the cylinder group. Therefore, the extent indicated by the storage address and the offset uniquely indicate the location of a file's data block.
[0040] For ease of explanation, please refer to Table 1 for further explanation of the layout of the panel area.
[0041] Table 1: Exemplary Panel Layout
[0042] Offset CG0 0 Startup block 1 Super Block 2 Backup superblock 3 Assigning state blocks 4 cleaning blocks 5-39 Reserved block 40-46 Grouping marker block 47-4095 Data blocks
[0043] Table 1 shows an example extent layout. The following example uses the cylinder group described above as an example. In a cylinder group (e.g., CG 0), the block at offset 0 is the start block, the block at offset 1 is the superblock, and the block at offset 2 is the backup superblock. These blocks are used to store basic information about the extent, such as the size of each block and the number of metadata entries in the extent.
[0044] The block at offset 3 is called the allocation status block, which is 8KB in size. Each bit in the allocation status block maps to a block or a portion of a block within the cylinder group, indicating the status of the corresponding block or portion of a block—for example, allocated (e.g., value 1) or free (value 0). As an example, in a disk extent, if the corresponding bit in the allocation status block for a block is 1, it means the block has been allocated and belongs to a file; if the corresponding bit is 0, it means the block is free and can be allocated to a newly created file. Here, 1 represents the allocated state and 0 represents the free state; it should be understood that the reverse configuration is also possible.
[0045] Note that the allocation status block comprises 8K * 8 = 64K bits, while the cylinder group comprises 4K data blocks, each 8K bytes in size. Depending on the granularity of the correspondence, one bit in the allocation status block can be used to represent the allocation status of 512 bytes (therefore, 4K * 8K / 512 = 64K) of storage space in the extent. As mentioned above, a 512-byte granularity is suitable for storing metadata. It should be understood that for larger granularities (e.g., general data), an 8K-byte allocation status block is sufficient. Based on the above analysis, it can be seen that an 8K block is sufficient to represent and manage the status of all blocks in the extent.
[0046] A sweep block with an offset of 4 can be used to discover and sweep unused storage space in the storage area. In some embodiments, the electronic device 110 first sets all sweep blocks to 0, then determines the storage location of file data blocks by accessing the file's metadata, and sets the corresponding bits in the sweep block to 1. That is, after traversing all files in the storage system, blocks whose corresponding bits in the sweep block are still 0 do not belong to any file, so the bits in the corresponding allocation status block can be set to indicate free (value 0). Simply put, the sweep block can be copied to the allocation status block, thereby sweeping the storage space of the disk area.
[0047] Blocks with offsets of 5-39 are reserved blocks that can be used to expand other functions in the future.
[0048] The blocks at offsets 40-46 are called group marker blocks. Specifically, a block at offset 40 in a disk extent can be used to store markers for data blocks in the extent associated with a first group identifier (e.g., group identifier "1"), a block at offset 41 can be used to store markers for data blocks associated with a second group identifier (e.g., group identifier "2"), a block at offset 42 can be used to store markers for data blocks associated with a second group identifier (e.g., group identifier "3"), and so on. The markers can be binary 0 or 1.
[0049] Continue to refer to Figure 2 In box 230, in the storage area of the disk extent corresponding to the group identifier, the tag corresponding to the data block is set based on the offset. As mentioned above, the disk extent and offset of the data block of the file with group identifier "3" have been obtained in box 220. Therefore, at least one bit in the storage area (i.e., the block with offset 42) corresponding to the offset of the data block can be set to the corresponding tag, for example, set to "1". For example, a file is set with group identifier "3", and its data blocks are offset from 4000 to 4095 in the disk extent. In this case, the last 96*2 bytes of the block with offset 42 (2 bytes in the group tag block correspond to one of the data blocks from 47 to 4095) can all be set to "1". It should be understood that the above tagging method is only an example, and other tagging methods can also be used, for example, the tagged bit can be "0" or a combination of other values.
[0050] In some embodiments, the group identifier can be synchronized to the mapping table of file identifiers and metadata addresses mentioned above. In some embodiments, for entries in the mapping table, the group identifier can be set in a reserved data structure for files, as follows:
[0051] struct lin_entry_flags{
[0052] struct btree_flags btree_flags[0];
[0053] uint8_t needs_repair:1;
[0054] uint8_t is_minisnap:1;
[0055] uint8_t to_be_deleted:3; / / new assigned bits
[0056] uint8_t unused:1;
[0057] uint8_t ignored:2;
[0058] }
[0059] The variable "to_be_deleted" (meaning the file will be deleted) consists of 3 bits, representing the group identifier set for the file, with a value between 0 and 7 (2^3-1). Therefore, the group identifier is synchronously recorded in the file's metadata and the storage system's mapping table.
[0060] In some embodiments, group identifiers recorded in the mapping table can be used to control access to files. Specifically, in response to a request to access a file, the mapping table can be queried. If the group identifier recorded in the entry for that file in the mapping table, i.e., the variable "to_be_deleted", has a value of any one of 1 to 7, the access request is denied. If the value of the variable "to_be_deleted" for a file in the mapping table is 0, it indicates that the file does not belong to the files to be deleted, and access to the file can be allowed. It should be understood that "to_be_deleted" is merely an exemplary name for the group identifier. Depending on the specific application, the group identifier can be used for various purposes, not limited to deleting files. For example, it can also be used to hide files in the mapping table whose group identifier is set to a specified value from the user.
[0061] In some embodiments, after the bits in the group tag block are set, the group tag block can be updated if a new data block of a file belonging to that group tag is allocated in the extent, or if an existing file is deleted. Therefore, in response to the allocation of a data block of another file in the extent, a tag for the data block is set in the storage area of the extent corresponding to the group identifier of that other file. Additionally, in response to the release of a data block of another file in the extent, the tag for the released data block is cleared in the storage area of the extent corresponding to the group identifier of that other file.
[0062] Once the grouping tag block is set, it can be used to efficiently manage a large number of files on a disk without needing to access the file's metadata. See below for reference. Figure 3 This section describes an application example for batch file deletion.
[0063] Figure 3 A schematic flowchart of a method 300 for deleting a file in a storage system according to some embodiments of the present disclosure is shown. Method 300 can be, for example... Figure 1 The electronic device 110 is used to implement this.
[0064] In box 310, electronic device 110 receives a request to delete files with a group identifier. For example, electronic device 110 receives a request to delete all files in a specified directory on a storage system, triggered manually or automatically by a user, and that directory and all files within the directory have been assigned the group identifier.
[0065] In box 320, electronic device 110 removes the entry for the file with the group identifier from a mapping table containing metadata addresses. For example, in response to a request to delete a directory, electronic device 110 can remove the link between the directory and the tree from a mapping table, for example, a tree structure.
[0066] In box 330, electronic device 110 determines the storage area of the disk corresponding to the group identifier. In response to a request to delete files, electronic device 110 can traverse the disks of the storage system and delete the data blocks of those files from each disk. Continuing with the example of group identifier "3", electronic device 110 determines the storage area of each disk corresponding to the group identifier, that is, the block at offset 42.
[0067] In block 340, electronic device 110 releases data blocks in the disk region corresponding to the set tags in the storage region based on tags in the storage region. In some embodiments, these data blocks are released by updating the allocation status block of the disk region (the block with offset 3 in Table 1). For example, the block with offset 42 is aligned with the allocation status block of the disk region such that the bits in the allocation status block aligned with the set tags are updated to indicate an idle state.
[0068] In box 350, electronic device 110 clears the markers in the storage area. For example, electronic device 110 sets all bits of the block at offset 42 to 0, indicating that there are no data blocks belonging to the file with group identifier 3 in the disk area. This completes the batch deletion of files.
[0069] According to reference Figure 3The described method allows for more efficient deletion of large numbers of files in a directory. For example, a directory might be created for a short-term project, which will be deleted sometime after the project concludes. Users can mark all files as pending deletion throughout the project's lifecycle, so that upon project completion, only a single trigger is needed. Figure 3 The process shown can delete this directory more efficiently and at a lower cost.
[0070] Through the above combination Figures 1 to 3 As can be seen from the description, the solution of the embodiments of the present disclosure utilizes the markers already set in the disk areas of the storage system to perform batch operations on a large number of files in the storage system according to groups, without needing to access the file metadata, thereby saving computing resources and improving management efficiency.
[0071] As an additional advantage, according to embodiments of this disclosure, the above references are made before any actual operations are performed on the files in the storage system. Figure 2 The described process can be seamless for the user. The user can normally read and write files or data blocks that have been grouped and marked on the disk area. However, once actual operation begins, the file's metadata may have been cleaned up or is incorrect. In this case, the solution according to embodiments of this disclosure can determine whether to deny any operation on the file by accessing the grouping identifier in the mapping table, without needing to access the metadata. Furthermore, if the user does not intend to actually perform an operation after marking, it can also be performed with reference to... Figure 2 The described process is reversed and rolled back and forth.
[0072] Figure 4 A schematic block diagram of a file management apparatus 400 according to an embodiment of the present disclosure is shown. The apparatus 400 includes a grouping unit 410, an address determination unit 420, and a tagging unit 430. The apparatus 400 can be implemented in, for example... Figure 1 In the electronic device 110 shown.
[0073] Grouping unit 410 is configured to set a group identifier for files. In some embodiments, the grouping unit may also be configured to determine the group identifier of a file based on the directory where the file is located, such that files in the directory have the same group identifier. Additionally, grouping unit 410 may be configured to prevent the creation of references to the directory or files within the directory outside of the directory.
[0074] The address determination unit 420 is configured to determine the storage address of a data block of a file, wherein the storage address indicates the disk extent and offset where the data block is located. In some embodiments, the address determination unit may also be configured to determine the storage address of at least one data block of a file based on the file's metadata.
[0075] The tagging unit 430 is configured to set a tag for a data block based on an offset in a storage area corresponding to the group identifier in the disk area. In some embodiments, the tagging unit may also be configured to set at least one bit in the storage area corresponding to the offset as the tag. The tag may be a binary value, such as 0 or 1.
[0076] In some embodiments, the grouping unit 410 may also be configured to determine the metadata address of a file based on a mapping table including the file's metadata address; and to set a grouping identifier in the file's metadata based on the metadata address. In some embodiments, the marking unit 430 may also be configured to set a grouping identifier for a file in the mapping table.
[0077] In some embodiments, the apparatus 400 may further include an access control unit (not shown), which may be configured to receive a request to access the file and to reject the request in response to the file having a group identifier set in a mapping table.
[0078] In some embodiments, the marking unit 430 may also be configured to, in response to allocating a data block of another file in the disk area, set a mark for the data block in the storage area of the disk area corresponding to the group identifier of the other file; or, in response to releasing a data block of another file in the disk area, clear the mark for the released data block in the storage area of the disk area corresponding to the group identifier of the other file.
[0079] In some embodiments, the apparatus 400 may further include a deletion unit (not shown), configured to receive a request to delete a file with a group identifier; determine a storage area of the disk corresponding to the group identifier; release data blocks of the disk corresponding to the tags set in the storage area based on tags in the storage area; and clear the tags in the storage area.
[0080] In some embodiments, the disk area can be a group of cylinders of the disk.
[0081] Figure 5 A schematic block diagram is shown of an example device 500 that can be used to implement some embodiments according to this disclosure. Figure 5 As shown, device 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) 502 or loaded from storage unit 508 into random access memory (RAM) 503. RAM 503 may also store various programs and data required for the operation of device 500. CPU 501, ROM 502, and RAM 503 are interconnected via bus 504. Input / output (I / O) interface 505 is also connected to bus 504.
[0082] Multiple components in device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0083] The various processes and handling described above, such as methods 200 and 300, can be executed by processing unit 501. For example, in some embodiments, methods 200 and 300 can be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by CPU 501, one or more actions of methods 200 and 300 described above can be performed.
[0084] This disclosure can be a method, apparatus, system, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of this disclosure.
[0085] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination of the foregoing. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0086] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0087] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute 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 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). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions to implement various aspects of this disclosure.
[0088] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0089] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0090] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0091] 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 the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive 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, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0092] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for managing files, comprising: The file sets a group identifier for the file in the file's metadata based on the file's metadata address, wherein setting the group identifier is automatically triggered based on a first criterion; Determine the storage address of the data block of the file, the storage address indicating the disk extent and offset of the data block, wherein the disk extent is a group of cylinders of the disk, and the disk extent includes a storage area, the storage area including a corresponding group tag block for a group identifier of the group identifier set, and wherein the group of cylinders includes one or more consecutive cylinders. as well as In the group tag block corresponding to the group identifier, a tag is set for the data block based on the offset, wherein setting the tag is automatically triggered; Receive a request to delete a specified file that has the group identifier; Determine the group marker block in the disk area that corresponds to the group identifier; Based on the marker in the group marker block, release the data block in the disk area corresponding to the marker set in the group marker block; as well as Clear the markers from the grouped marker block.
2. The method according to claim 1, wherein setting the group identifier for the file includes: Based on the directory where the file is located, a group identifier for the file is determined, such that files in the directory have the same group identifier.
3. The method according to claim 2, further comprising: Prevent the creation of references to the directory or files within the directory outside of the directory.
4. The method of claim 1, wherein determining the storage address of the data block of the file comprises: Based on the metadata of the file, determine the storage address of at least one data block of the file.
5. The method of claim 1, wherein setting the tag for the data block based on the offset comprises: Set at least one bit in the grouped tag block to the tag.
6. The method of claim 1, wherein setting the group identifier for the file comprises: The metadata address of the file is determined based on a mapping table that includes the file's metadata address; as well as Based on the metadata address, the group identifier is set in the metadata of the file.
7. The method of claim 1, wherein the data block of the file is a first data block, and the method further comprises at least one of the following: In response to allocating another data block of another file in the disk extent, another tag for the other data block is set in another group tag block of the disk extent corresponding to another group identifier of the other file; or In response to releasing another data block of the other file in the disk area, a released data block is generated, and the other tag for the released data block is cleared in the other group tag block of the disk area corresponding to the other group identifier of the other file.
8. An apparatus for managing documents, comprising: A grouping unit is configured to set a grouping identifier for the file in the file's metadata based on the file's metadata address, wherein setting the grouping identifier is automatically triggered based on a first criterion; The address determination unit is configured to determine the storage address of a data block of the file, the storage address indicating the disk extent and offset where the data block is located, wherein the disk extent is a group of cylinders of a disk, and the disk extent includes a storage area, the storage area including a corresponding group tag block for a group identifier of the group identifier set, and wherein the group of cylinders includes one or more consecutive cylinders. as well as A marking unit is configured to set a mark for the data block based on the offset in a group marking block corresponding to the group identifier, wherein setting the mark is automatically triggered; as well as The deleted unit is configured as follows: Receive a request to delete a specified file that has the group identifier; Determine the group marker block in the disk area that corresponds to the group identifier; Based on the marker in the group marker block, release the data block in the disk area corresponding to the marker set in the group marker block; as well as Clear the markers from the grouped marker block.
9. The apparatus of claim 8, wherein the grouping unit is further configured to: Based on the directory where the file is located, a group identifier for the file is determined, such that files in the directory have the same group identifier.
10. The apparatus of claim 9, wherein the grouping unit is further configured to: Prevent the creation of references to the directory or files within the directory outside of the directory.
11. The apparatus of claim 8, wherein the address determination unit is further configured to: Based on the metadata of the file, determine the storage address of at least one data block of the file.
12. The apparatus of claim 8, wherein the marking unit is further configured to: Set at least one bit in the grouped tag block to the tag.
13. The apparatus of claim 8, wherein the grouping unit is further configured to: The metadata address of the file is determined based on a mapping table that includes the file's metadata address; and Based on the metadata address, the group identifier is set in the metadata of the file.
14. The apparatus of claim 8, wherein the data block of the document is a first data block, and the tagging unit is further configured to be at least one of the following: In response to allocating another data block of another file in the disk extent, another tag for the other data block is set in another group tag block of the disk extent corresponding to another group identifier of the other file; or In response to releasing another data block of the other file in the disk area, a released data block is generated, and the other tag for the released data block is cleared in the other group tag block of the disk area corresponding to the other group identifier of the other file.
15. An electronic device comprising: At least one processing unit; as well as At least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the electronic device to perform the method according to any one of claims 1 to 7.
16. A computer-readable storage medium comprising machine-executable instructions that, when executed by a device, cause the device to perform the method according to any one of claims 1 to 7.
17. A computer program product comprising machine-executable instructions that, when executed by a device, cause the device to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
File processing method, device and file system
CN106294352A
File processing method and device and distributed file system
CN106354840A