CN114490516A - File system processing method, recycle bin management method, device and equipment - Google Patents

File system processing method, recycle bin management method, device and equipment Download PDF

Info

Publication number
CN114490516A
CN114490516A CN202210114765.2A CN202210114765A CN114490516A CN 114490516 A CN114490516 A CN 114490516A CN 202210114765 A CN202210114765 A CN 202210114765A CN 114490516 A CN114490516 A CN 114490516A
Authority
CN
China
Prior art keywords
file
directory
file system
metadata
directory tree
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210114765.2A
Other languages
Chinese (zh)
Inventor
谢东凯
廖晨歌
张锋
周沁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Alibaba China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN202210114765.2A priority Critical patent/CN114490516A/en
Publication of CN114490516A publication Critical patent/CN114490516A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a processing method of a file system, a management method of a recycle bin, a device and equipment. The method comprises the following steps: an operation instruction of an application program for a file system is taken; and if the operation instruction is a deletion instruction, deleting the metadata of the directory/file targeted by the operation instruction in the directory tree of the file system from the directory tree of the file system and storing the metadata into a recovery directory tree of the file system, and associating the metadata of the file in the recovery directory tree with the metadata for describing the storage position of the file when the operation instruction is targeted to the file, so as to put the directory/file targeted by the operation instruction into a recovery station of the file system. The method can prevent the situation that the application program can not normally appear due to the fact that the directory/file is deleted by mistake, and avoids loss to users.

Description

File system processing method, recycle bin management method, device and equipment
Technical Field
The present application relates to the field of file storage technologies, and in particular, to a processing method of a file system, a recycle bin management method, an apparatus, and a device.
Background
Network Attached Storage (NAS) is a file system which can share access, is elastically expanded, and has high reliability and high performance. The method is based on a Portable Operating System Interface (POSIX) file Interface, naturally adapts to a native Operating System, and provides shared access for application programs.
In actual applications, there are cases where a file or directory in the file system is deleted by mistake by the application program. For example, the directories/files in the file system are deleted by mistake due to misoperation of the operation and maintenance personnel, or the directories/files in the file system are deleted by mistake due to abnormality of the application program. Generally, in response to a delete instruction for a directory/file of a file system, metadata of the directory/file is deleted directly from a directory tree of the file system, and the deleted directory/file cannot be restored. Therefore, the directory/file is deleted by mistake, so that the application program cannot be normally used, and loss is brought to the user.
Disclosure of Invention
The embodiment of the application provides a processing method of a file system, a management method of a recycle bin, a device and equipment, and aims to solve the problem that in the prior art, due to the fact that a directory/file is deleted by mistake, an application program cannot be normally used, and loss is brought to a user.
In a first aspect, an embodiment of the present application provides a processing method for a file system, including:
acquiring an operating instruction of an application program aiming at the file system;
if the operation instruction is a delete instruction, deleting the metadata of the directory/file targeted by the operation instruction in a file system directory tree of the file system from the file system directory tree and storing the metadata into a recovery directory tree of the file system, and associating the metadata of the file in the recovery directory tree with the metadata for describing the storage location of the file when the operation instruction is targeted to the file, so as to put the directory/file targeted by the operation instruction into a recovery station of the file system.
In a second aspect, an embodiment of the present application provides a recycle bin management method for a file system, including:
acquiring a recovery command of a user for the file system;
and deleting and saving the metadata of the directory/file targeted by the recovery command from a recovery directory tree of the file system into a file system directory tree of the file system, and associating the metadata of the file in the file system directory tree with the metadata for describing the storage position of the file when the recovery command is targeted at the file, so as to recover the directory/file targeted by the recovery command from a recovery station of the file system.
In a third aspect, an embodiment of the present application provides a processing apparatus for a file system, including:
the acquisition module is used for acquiring an operating instruction of an application program aiming at the file system;
and the deleting module is used for deleting the metadata of the directory/file which is aimed at by the operating instruction in a directory tree of a file system of the file system from the directory tree of the file system and storing the metadata into a recovery directory tree of the file system if the operating instruction is a deleting instruction, and associating the metadata of the file in the recovery directory tree with the metadata for describing the storage position of the file when the operating instruction is directed at the file, so as to realize that the directory/file which is aimed at by the operating instruction is put into a recovery station of the file system.
In a fourth aspect, an embodiment of the present application provides a recycle bin management method for a file system, including:
the acquisition module is used for acquiring a recovery command of a user for the file system;
and the recovery module is used for deleting and saving the metadata of the directory/file targeted by the recovery command from a recovery directory tree of the file system into a directory tree of the file system, and associating the metadata of the file in the directory tree of the file system with the metadata for describing the storage position of the file when the recovery command is targeted at the file, so as to recover the directory/file targeted by the recovery command from a recovery station of the file system.
In a fifth aspect, an embodiment of the present application provides a computing device, including: a memory, a processor; wherein the memory is to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any of the first aspects.
In a sixth aspect, an embodiment of the present application provides a computing device, including: a memory, a processor; wherein the memory is configured to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any of the second aspects.
In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the method according to any one of the first aspect is implemented.
In an eighth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the method according to any one of the second aspects is implemented.
Embodiments of the present application also provide a computer program, which is used to implement the method according to any one of the first aspect when the computer program is executed by a computer.
Embodiments of the present application also provide a computer program, which is used to implement the method according to any one of the second aspect when the computer program is executed by a computer.
In the embodiment of the application, after an operation instruction of an application program for a file system is obtained, if the operation instruction is a delete instruction, metadata of a directory/file to which the operation instruction is directed in a directory tree of the file system can be deleted from the directory tree of the file system and saved in a recycle bin directory tree of the file system, and when the operation instruction is directed at a file, the metadata of the file in the recycle directory tree is associated with metadata for describing a storage location of the file, so that the directory/file to which the operation instruction is directed is put in a recycle bin of the file system, so that when the application program deletes the directory/file in the file system by mistake due to misoperation of an operation and maintenance person or abnormality of the application program, the mistakenly deleted directory/file can be recovered from the recycle bin of the file system, therefore, the situation that the application program cannot normally appear due to the fact that the directory/file is deleted by mistake can be prevented, and loss of the user is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 and fig. 2 are schematic diagrams of application scenarios of methods provided in embodiments of the present application;
fig. 3 is a schematic flowchart of a processing method of a file system according to an embodiment of the present application;
FIG. 4A is a diagram illustrating a directory tree of a file system according to an embodiment of the present application;
FIG. 4B is a diagram illustrating a recycle directory tree according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating a recycle bin management method for a file system according to an embodiment of the present application;
FIG. 6 is a block diagram of an implementation of a recycle bin of a system provided in an embodiment of the present application;
FIG. 7 is a block diagram of a processing device of a file system according to an embodiment of the present disclosure;
FIG. 8 is a schematic structural diagram of a computing device according to an embodiment of the present application;
FIG. 9 is a schematic structural diagram of a recycle bin management apparatus of a file system according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a computing device according to another embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the examples of this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and "a" and "an" typically include at least two, but do not exclude the presence of at least one.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a good or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such good or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a commodity or system that includes the element.
In addition, the sequence of steps in each method embodiment described below is only an example and is not strictly limited.
Fig. 1 is a schematic view of an application scenario of a method provided in an embodiment of the present application. As shown in fig. 1, the application scenario may include: a first computing device 11, a second computing device 12, and a file system 13, the file system 13 including at least one third computing device 13A and a plurality of storage devices 13B. The first computing device 11 may have an application program of a user running thereon, the file system 13 may be mounted on the first computing device 11, and the application program running on the first computing device 11 may read a directory/file stored in the storage device 13B of the file system 13 through a POSIX interface provided by the operating system.
Wherein, the application program running on the first computing device 11 may send a message conforming to the standard protocol for requesting to operate the file system 13 to the second computing device 12, and the second computing device 12 may parse the message to obtain the operation instruction for the file system 13. The standard protocol may be, for example, a Network File System (NFS) protocol or a Server Message Block (SMB) protocol. The third computing device 13A may perform corresponding processing on the operation instructions of the application program for the file system 13.
It should be noted that, the computing device that parses the packet to obtain the operation instruction in fig. 1 is a different computing device from the computing device in the file system 13, which is only an example.
In general, after the third computing device 13A obtains the deletion instruction of the application program for the file system, the metadata of the directory/file targeted by the deletion instruction is directly deleted from the directory tree of the file system 13, and the deletion of the metadata of the file in the directory tree of the file system triggers the deletion of the data of the file, so that the deleted directory/file cannot be recovered. Therefore, the directory/file is deleted by mistake, so that the application program cannot be normally used, and loss is brought to the user.
In order to solve the technical problem that the application program cannot be normally used due to the incorrect deletion of the directory/file, and the loss is caused to the user, as shown in fig. 1, in the embodiment of the present application, after the third computing device 13A obtains the operation instruction of the application program for the file system 13, if the operation instruction is a delete instruction, the metadata of the directory/file for which the operation instruction is directed in the file system directory tree of the file system 13 may be deleted from the file system directory tree and stored in the recycle bin directory tree of the file system 13, and when the operation instruction is directed to a file, the metadata of the file in the recycle directory tree may be associated with the metadata describing the storage location of the file, so as to put the directory/file for which the operation instruction is directed into the recycle bin of the file system 13, so that when the reason that the operation of an operation and maintenance person is operated by mistake or the application program is abnormal occurs, when the application program deletes the directory/file in the file system by mistake, the deleted directory/file can be recovered from the recycle bin of the file system 13, so that the situation that the application program cannot normally appear due to the fact that the directory/file is deleted by mistake can be prevented, and loss of a user is avoided.
As shown in fig. 2, a fourth computing device 14 and a fifth computing device 15 may also be included in the application scenario. The fourth computing device 14 may be configured to perform a management and control operation on the file system 13 by a user, and in response to the management and control operation of the user, the fourth computing device 14 may send a corresponding request message (for example, an http request message) to the fifth computing device 15, and the fifth computing device 15 may obtain a corresponding management and control command based on the request message sent by the fourth computing device 14. The third computing device 13A may acquire a management and control command of the user for the file system from the fifth computing device 15, and perform management and control processing based on the acquired management and control command.
It should be noted that, the computing device that parses the packet to obtain the management and control command in fig. 2 is different from the computing device in the file system 13, which is only an example.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Fig. 3 is a flowchart illustrating a processing method of a file system according to an embodiment of the present application, where an execution subject of the embodiment may be the third computing device 13A in fig. 1. As shown in fig. 3, the method of this embodiment may include:
step 31, acquiring an operation instruction of an application program for the file system;
step 32, if the operation instruction is a delete instruction, deleting the metadata of the directory/file targeted by the operation instruction in the file system directory tree of the file system from the file system directory tree and storing the metadata into a recovery directory tree of the file system, and associating the metadata of the file in the recovery directory tree with the metadata for describing the storage location of the file when the operation instruction is targeted to the file, so as to put the directory/file targeted by the operation instruction into a recovery station of the file system.
In the embodiment of the present application, the operation instruction of the application program acquired by the computing device 13A for the file system 13 may be a deletion instruction for the file system 13, and may also be other instructions for the file system 13, such as a read instruction, a write instruction, a rename instruction, and the like.
Optionally, step 32 may be preceded by: determining whether the directory/file targeted by the operation instruction is in a recycle bin of the file system; if it is determined that the directory/file targeted by the operating system is not in the recycle bin, step 22 may be performed, so that it is possible to avoid a situation in which the directory/file targeted by the operation instruction has been deleted when the processing corresponding to the operation instruction is performed.
Further optionally, if it is determined that the directory/file targeted by the operating system is in the recycle bin, an error prompt message may be returned, where the error prompt message may be used to prompt that the directory/file targeted by the operating instruction does not exist, so that the application program may know the reason for the operation failure.
In this embodiment of the application, if the operation instruction is a delete instruction, the metadata of the directory/file to which the operation instruction is directed in the directory tree of the file system may be deleted from the directory tree of the file system and stored in the recycle directory tree of the file system.
The directory/file of the recycle bin of the file system can adopt a name space independent from the file system, the directory tree of the file system is a directory tree of the file system, the directory tree of the recycle bin is a recycle directory tree, and metadata in the recycle directory tree is used for recovering the mistakenly deleted directory/file by a user. Taking the example of a directory tree with "/" as the root node in the file system namespace, the file system directory tree may be as shown in fig. 4A, for example, where dir may represent metadata of directories, files may represent metadata of files, and gray dashed boxes may represent metadata of directories and files deleted from the file system directory tree. Further, taking the recycle bin namespace as an example of a directory tree with "RecycleBin" as the root node, the recycle bin directory tree may be, for example, as shown in FIG. 4B, where the metadata of the directories and files is the metadata of the directories and files deleted from the file system directory tree shown in FIG. 4A.
In addition, as shown in FIG. 4B, to facilitate distinguishing which directories and files are placed in the recycle bin, for example, one of the attributes of a directory and a file in the recycle directory tree may be set to a Deleted (Deleted) state, and the one of the attributes of a file and a directory in the file system directory tree may also be set to a Normal (Normal) state. Based on this, the determining whether the directory/file targeted by the operation instruction is in the recycle bin may specifically include: it is determined whether the state attribute of the directory/file to which the operation instruction is directed is a deletion state. The state attribute of the directory/file to which the operation instruction is directed is not a deletion state, which indicates that the directory/file to which the operation instruction is directed is not in the recycle bin, otherwise, indicates that the directory/file to which the operation instruction is directed is in the recycle bin.
For example, the directory tree of the file system and the recycle directory tree may be stored in a key-value (value) manner.
It should be noted that the metadata of the file in the directory tree of the file system may be partial metadata of the file. Metadata used for describing the directory structure relationship of the files, the creation time of the files, the file sizes, the file permissions and the like can be stored in a directory tree of the file system; metadata for describing directory structure relationship of the directory and creation time, directory size, directory authority and the like of the directory can be saved in a directory tree of the file system; metadata describing the storage location of a file in a storage medium may not be stored in the file system directory tree. Therefore, when the operation instruction is directed to the file, the metadata of the file in the recycle directory tree can be associated with the metadata for describing the storage location of the file, so that the complete metadata of the file can be obtained.
In addition, the metadata of a directory in the file system directory tree of the file system is deleted from the file system directory tree and stored in the recycle directory tree, and the directory is understood to be placed in the recycle bin. Accordingly, deleting metadata of a directory in the file system directory tree of the file system from the recycle bin directory tree and saving the metadata to the file system directory tree may be understood as restoring the directory from the recycle bin.
It should be noted that, by deleting and saving the metadata of a file in the file system directory tree of the file system from the file system directory tree into the recycle directory tree, and associating the metadata of the file in the recycle directory tree with the metadata describing the storage location of the file, it can be understood that the file will be sent to the recycle bin. Accordingly, the file is recovered from the recycle bin by deleting the metadata of the file in the file system directory tree of the file system from the recycle bin directory tree and storing the metadata of the file in the file system directory tree with the metadata describing the storage location of the file.
It should be noted that deletion of metadata of any file in the collection directory tree can trigger deletion of data of any file, and deletion of metadata of any file in the file system directory tree cannot trigger deletion of data of any file.
In one embodiment, if the operation instruction is a delete instruction, the metadata of the directory/file targeted by the operation instruction in the directory tree of the file system may be directly deleted from the directory tree of the file system and saved in the recycle directory tree.
In another embodiment, if the operation instruction is a delete instruction and all conditions in the target conditions are met, the metadata of the directory/file targeted by the operation instruction in the directory tree of the file system may be deleted from the directory tree of the file system and saved in the recycle directory tree. Illustratively, the target conditions may include one or more of a recycle bin being turned on, a name prefix not within a target prefix range, a name suffix not within a target suffix range, or a parent directory not within a target parent directory range.
If the operating system is a delete command but does not satisfy all of the target conditions, the metadata of the directory/file to which the operating command is directed in the directory tree of the file system may be deleted from the directory tree of the file system, but not saved in the recycle directory tree. In addition, deletion of metadata of any file that is not placed in the recycle bin in the directory tree of the file system can trigger deletion of data of the file.
The target condition comprises that the recycle bin is opened, so that whether the recycle bin of the file system is used or not can be flexibly determined according to needs, and the flexibility is improved. The target condition comprises that the name prefix is not in the target prefix range, so that the directory and/or the file of which the name prefix is in the target prefix range can be controlled not to enter the recycle bin according to the requirement, and the storage space is saved. The storage space is saved by the target condition that the name suffix is not in the range of the target suffix, so that the directory and/or the file with the name suffix in the range of the target suffix can be controlled not to enter the recycle bin according to requirements. The target condition comprises that the parent directory is not in the range of the target parent directory, so that the directories and/or files of the parent directory in the range of the target parent directory can be controlled not to enter the recycle bin according to the requirement, and the storage space is saved.
Illustratively, one or more of the target conditions may be configured by the user as desired. Based on this, the method provided in this embodiment may further include: the method comprises the steps of obtaining a configuration command of a user, and determining one or more of a switch state, a target prefix range, a target suffix range or a target parent directory range of the recycle bin based on the configuration command. The configuration command may be understood as one of the management and control commands.
Optionally, based on the directory and the file deleted into the recycle bin, the relevant statistics of the file system and the recycle bin thereof may be correspondingly updated, so that the statistics may reflect respective actual conditions of the file system and the recycle bin. Based on this, in an embodiment, the method provided in this embodiment may further include: and performing reduction processing on the relevant statistics of the file system and performing increase processing on the relevant statistics of the recycle bin based on the directory/file targeted by the operation instruction.
Illustratively, the file system related statistics may include one or more of a file system usage capacity, a number of files under a directory, and a number of directories under a directory; relevant statistics for a recycle bin may include the usage capacity of the recycle bin and/or the number of files under the directory. The file system related statistics value may be used for quota control, for example, to control the used capacity of the file system not to exceed a capacity threshold of the file system, and for example, to control the number of files under a directory not to exceed a file number threshold of the directory. The relevant statistics of the recycle bin may be available for the user to view, for example.
Deleting the metadata of the directory/file targeted by the operation instruction in the file system directory tree from the file system directory tree and saving the metadata into the recovery directory tree, and after determining that the state attribute of the directory/file targeted by the operation instruction is not in a deleted state, the method may further include: and setting the state attribute of the directory/file to which the operation instruction is directed to be in a deletion state.
In the processing method for a file system provided in this embodiment, after an operation instruction of an application program for a file system is obtained, if the operation instruction is a delete instruction, metadata of a directory/file to which the operation instruction is directed in a directory tree of the file system may be deleted from the directory tree of the file system and stored in a recycle bin directory tree of the file system, and when the operation instruction is directed at a file, the metadata of the file in the recycle bin directory tree is associated with metadata describing a storage location of the file, so as to put the directory/file to which the operation instruction is directed into the recycle bin of the file system, so that when the application program deletes the directory/file in the file system by mistake due to misoperation of an operation and maintenance person or abnormality of the application program, the erroneously deleted directory/file may be recovered from the recycle bin of the file system, therefore, the situation that the application program cannot normally appear due to the fact that the directory/file is deleted by mistake can be prevented, and loss of the user is avoided.
Fig. 5 is a flowchart illustrating a recycle bin management method of a file system according to an embodiment of the present application, where an execution subject of the embodiment may be the third computing device 13A in fig. 1. As shown in fig. 5, the method of this embodiment may include:
step 51, acquiring a recovery command of a user for the file system;
and step 52, deleting and saving the metadata of the directory/file targeted by the recovery command from the recovery directory tree of the file system into the directory tree of the file system, and associating the metadata of the file in the directory tree of the file system with the metadata for describing the storage location of the file when the recovery command is targeted at the file, so as to recover the directory/file targeted by the recovery command from the recovery station of the file system.
Wherein, the recovery command can be understood as one of the management and control commands. To improve security, the fifth computing device 15 may authenticate the user and control the permissions. For example, for a request message sent by the fourth computing device 14 to request to recover data from the recycle bin, the fifth computing device 15 may first perform identification on the user through the identification system to obtain a successful or failed identification result, when the identification result is successful, the fifth computing device 15 may further determine whether the user has an authority to recover the data in the recycle bin through the authority management system, if so, the fifth computing device 15 may transmit a recovery command obtained based on the request message to the third computing device 13A, and the third computing device 13A may perform processing based on the obtained recovery command.
Optionally, when the duration of the directory/file existing in the recycle bin is greater than the duration threshold, the directory/file can be automatically cleared from the recycle bin, so that the storage space is saved. Based on this, in an embodiment, the method provided in this embodiment may further include: and when any directory/file is any file, triggering the deletion of the data of any file based on the associated metadata of the metadata of any file in the recovery directory tree. The metadata associated with the metadata of any file in the recycle directory tree is the metadata describing the storage location of any file.
Further optionally, the method provided in this embodiment further includes: and when the existing time length of the directory/file in the recycle bin is more than a time length threshold value, reducing the relevant statistical value of the recycle bin based on any directory/file. Thereby being beneficial to improving the accuracy of the relevant statistical values of the recycle bin.
Optionally, the user can be supported to clean the directories/files from the recycle bin through the management and control command, so that the user can clean the directories and files in the recycle bin as required, and the improvement of the user experience is facilitated. Based on this, in an embodiment, the method provided in this embodiment may further include: acquiring a cleaning command of a user for a file system; and deleting the metadata of the directory/file targeted by the cleaning command from the recovery directory tree, and triggering the deletion of the data of the file based on the associated metadata of the file in the recovery directory tree when the cleaning command is targeted at the file. The deletion command may also be understood as one of the management and control commands.
Similarly, for the request message sent by the fourth computing device 14 and used for requesting to clean the recycle bin, the fifth computing device 15 may first perform identity recognition on the user through the identity recognition system to obtain a successful or failed identity recognition result, when the identity recognition result is successful, the fifth computing device 15 may further determine whether the user has the authority to clean the data in the recycle bin through the authority management system, if so, the fifth computing device 15 may transmit a cleaning command obtained based on the request message to the third computing device 13A, and the third computing device 13A may perform processing based on the obtained cleaning command.
Further optionally, the method provided in this embodiment may further include: and reducing relevant statistics of the recycle bin based on the directory/file targeted by the cleaning instruction. Thereby being beneficial to improving the accuracy of the relevant statistical values of the recycle bin.
Optionally, the user can be supported to check the relevant information of the recycle bin through the management and control command, so that the user can check the information about the recycle bin according to the requirement, and the use experience of the user is improved. Based on this, in an embodiment, the method provided in this embodiment may further include: acquiring a query command of a user for a recycle bin of a file system; and determining a query result corresponding to the query command, and returning the query result to the user. The query command may be used to query the usage capacity of the recycle bin, the number of files in the directory, and the like.
The processing method for the file system provided by this embodiment deletes and stores the metadata of the directory/file targeted by the recovery command of the user from the recycle directory tree of the file system into the directory tree of the file system, and associates the metadata of the file in the directory tree of the file system with the metadata describing the storage location of the file when the recovery command is targeted at the file, so as to recover the directory/file targeted by the recovery command from the recycle bin of the file system, and when the directory/file in the file system is deleted by the application program due to misoperation of the operation and maintenance staff or abnormal application program, the erroneously deleted directory/file can be recovered from the recycle bin of the file system according to the command of the user, so that it is possible to prevent the situation that the application program cannot normally appear due to the erroneously deleted directory/file, avoiding the loss to the user.
For example, an implementation block diagram of a recycle bin of a file system may be as shown in fig. 6, where a computing device 61 may send a message conforming to a standard protocol for requesting to operate a file system 63 to an NFS/SMB front-end 62, the NFS/SMB front-end 62 may parse the message to obtain an operation instruction for the file system 63, and send the operation instruction to the file system 63, and the file system 63 may execute the processing method of the file system provided in the embodiment of the present application.
The file system directory structure and the recycle bin metadata in the file system 63 are separate namespaces, wherein the file system directory structure is a file directory structure of the file system 63 not placed in the recycle bin, and the recycle bin metadata is a file directory structure of the file system placed in the recycle bin. The file system directory structure may be stored as a file system directory tree by using a key-value (value) manner, a parent directory + directory name in the file system directory tree may be used as a key, the parent directory + file name may be used as a key, and an attribute (attrib, abbreviated as attr) may be used as a value. Recycle bin metadata may also be stored in a key-value manner as a recycle directory tree, where deleted files/directories in the recycle directory tree may be used as keys and attr may be used as values. Wherein the attribute is the content of the metadata.
As shown in FIG. 6, the delete operation may correspond to deleting metadata of a directory/file in a file system directory structure, and since the recycle bin metadata and the file system directory use separate namespaces, the operation instruction may be controlled not to operate the metadata of the directory/file in the recycle bin metadata.
The computing device 64 may send a request message to the management and control service 65 in response to a management and control operation, the management and control service 65 may obtain a corresponding management and control command based on the request message, and when the management and control command is a recovery/deletion command for recovering/deleting directories/files in the recycle bin, the management and control service 65 may send the recovery/deletion command to the management apparatus 66 of the file system 63, and the management apparatus 66 may execute the recycle bin management method provided in this embodiment of the present application. The management device 66 may restore the directories/files from the recycle bin in response to the restore command, may remove the directories/files from the recycle bin in response to the remove command, or may automatically remove the directories/files in the recycle bin.
When the management and control command is a browse command for the recycle bin, the management and control service 65 may further send the browse command to the file system 63, and the file system 63 may return corresponding information of the recycle bin according to the browse command.
The link of the computing device 61 to the file system 63 in fig. 6 may be referred to as a data link, the corresponding request may be understood as a data link request, the link of the computing device 64 to the file system 63 may be referred to as a regulation link, and the corresponding request may be understood as a regulation link request. The data link may be to read a directory/file in the file system through a POSIX interface, and the management link may be to access the file system through a non-POSIX interface (e.g., an http interface).
FIG. 7 is a block diagram of a processing device of a file system according to an embodiment of the present disclosure; referring to fig. 7, the present embodiment provides an apparatus, which can perform the method provided in the embodiment shown in fig. 3, and specifically, the apparatus can include:
an obtaining module 71, configured to obtain an operation instruction of an application program for the file system;
a deleting module 72, configured to delete and save metadata of a directory/file in a directory tree of a file system of the file system, to which the operation instruction is directed, from the directory tree of the file system to a recycle directory tree of the file system if the operation instruction is a delete instruction, and associate the metadata of the file in the recycle directory tree with metadata describing a storage location of the file when the operation instruction is directed to the file, so as to place the directory/file to which the operation instruction is directed into a recycle bin of the file system.
Optionally, the deleting module 72 is specifically configured to: if the operation instruction is a deletion instruction and meets all conditions in target conditions, deleting the metadata of the directory/file targeted by the operation instruction in the directory tree of the file system from the directory tree of the file system and storing the metadata in the recovery directory tree; wherein the target conditions include one or more of a recycle bin being turned on, a name prefix not within a target prefix range, a name suffix not within a target suffix range, or a parent directory not within a target parent directory range.
Optionally, the obtaining module 71 is further configured to obtain a configuration command of the user for the file system;
the apparatus also includes a configuration module to determine one or more of a switch status of a recycle bin, a target prefix range, a target suffix range, or a target parent directory range based on the configuration command.
Optionally, the apparatus further includes a statistics module, configured to perform reduction processing on the relevant statistics of the file system and increase processing on the relevant statistics of the recycle bin based on the directory/file targeted by the operation instruction.
Optionally, the deleting module 72 is further configured to determine that the directory/file to which the operation instruction is directed is not in the recycle bin.
The apparatus shown in fig. 7 can perform the method provided by the embodiment shown in fig. 3, and reference may be made to the related description of the embodiment shown in fig. 3 for a part not described in detail in this embodiment. The implementation process and technical effect of the technical solution refer to the description in the embodiment shown in fig. 3, and are not described herein again.
In one possible implementation, the architecture of the apparatus shown in FIG. 7 may be implemented as a computing device. As shown in fig. 8, the computing device may include: a processor 81 and a memory 82. Wherein the memory 82 is used for storing programs that support the computing device to execute the methods provided in the above-described embodiment shown in fig. 3, and the processor 81 is configured for executing the programs stored in the memory 82.
The program comprises one or more computer instructions which, when executed by the processor 81, are capable of performing the steps of:
acquiring an operating instruction of an application program aiming at the file system;
if the operation instruction is a delete instruction, deleting the metadata of the directory/file targeted by the operation instruction in a file system directory tree of the file system from the file system directory tree and storing the metadata into a recovery directory tree of the file system, and associating the metadata of the file in the recovery directory tree with the metadata for describing the storage location of the file when the operation instruction is targeted to the file, so as to put the directory/file targeted by the operation instruction into a recovery station of the file system.
Optionally, the processor 81 is further configured to perform all or part of the steps in the foregoing embodiment shown in fig. 3.
The computing device may also include a communication interface 83 for the computing device to communicate with other devices or a communication network.
FIG. 9 is a schematic structural diagram of a recycle bin management apparatus of a file system according to an embodiment of the present application; referring to fig. 9, the present embodiment provides an apparatus, which may perform the method provided in the embodiment shown in fig. 5, and specifically, the apparatus may include:
an obtaining module 91, configured to obtain a recovery command of the user for the file system;
a restoring module 92, configured to delete and save the metadata of the directory/file targeted by the restoring instruction from the recycle directory tree of the file system into the file system directory tree of the file system, and when the restoring instruction is for a file, associate the metadata of the file in the file system directory tree with the metadata describing the storage location of the file, so as to restore the directory/file targeted by the restoring instruction from the recycle bin of the file system.
Optionally, the obtaining module 91 is further configured to obtain a cleaning command of the user for the file system;
the device also comprises a first cleaning module, which is used for deleting the metadata of the directory/file targeted by the cleaning command from the recycling directory tree and triggering the deletion of the data of the file based on the associated metadata of the file in the recycling directory tree when the cleaning command is targeted at the file, so as to delete the directory/file targeted by the deletion command from the recycling bin.
Optionally, the apparatus further comprises a determining module and a second cleaning module;
the determining module is configured to determine that a duration of existence of metadata of any directory/file in the recycle directory tree reaches a duration threshold;
the second cleaning module is configured to delete the metadata of any directory/file from the recycle directory tree, and when any directory/file is any file, trigger deletion of the data of any file based on the associated metadata of the metadata of any file in the recycle directory tree, so as to delete any directory/file from the recycle bin.
Optionally, the apparatus further includes a statistics module, configured to increase the statistics value of the file system and decrease the statistics value of the recycle bin based on the directory/file targeted by the restore command.
The apparatus shown in fig. 9 can execute the method provided by the embodiment shown in fig. 5, and reference may be made to the related description of the embodiment shown in fig. 5 for a part not described in detail in this embodiment. The implementation process and technical effect of the technical solution are described in the embodiment shown in fig. 5, and are not described herein again.
In one possible implementation, the architecture of the apparatus shown in FIG. 9 may be implemented as a computing device. As shown in fig. 10, the computing device may include: a processor 101 and a memory 102. Wherein the memory 102 is used for storing programs that support the computing device to execute the method provided in the embodiment shown in fig. 5 described above, and the processor 101 is configured for executing the programs stored in the memory 102.
The program comprises one or more computer instructions, wherein the one or more computer instructions, when executed by the processor 101, are capable of performing the steps of:
acquiring a recovery command of a user for the file system;
and deleting and saving the metadata of the directory/file targeted by the recovery command from a recovery directory tree of the file system into a file system directory tree of the file system, and associating the metadata of the file in the file system directory tree with the metadata for describing the storage position of the file when the recovery command is targeted at the file, so as to recover the directory/file targeted by the recovery command from a recovery station of the file system.
Optionally, the processor 101 is further configured to perform all or part of the steps in the embodiment shown in fig. 5.
The computing device may further include a communication interface 103 for the computing device to communicate with other devices or a communication network.
In addition, the embodiment of the present application provides a computer storage medium, on which a computer program is stored, and when the computer program is executed, the method provided by the embodiment shown in fig. 3 is implemented.
The embodiment of the application provides a computer storage medium, on which a computer program is stored, and when the computer program is executed, the method provided by the embodiment shown in fig. 5 is realized.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement such a technique without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course, can also be implemented by a combination of hardware and software. With this understanding in mind, the above-described technical solutions and/or portions thereof that contribute to the prior art may be embodied in the form of a computer program product, which may be embodied on one or more computer-usable storage media having computer-usable program code embodied therein (including but not limited to disk storage, CD-ROM, optical storage, etc.).
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, linked lists, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (14)

1. A method for processing a file system, comprising:
acquiring an operating instruction aiming at the file system;
if the operation instruction is a delete instruction, deleting the metadata of the directory/file targeted by the operation instruction in a file system directory tree of the file system from the file system directory tree and storing the metadata into a recovery directory tree of the file system, and associating the metadata of the file in the recovery directory tree with the metadata for describing the storage location of the file when the operation instruction is targeted to the file, so as to put the directory/file targeted by the operation instruction into a recovery station of the file system.
2. The method according to claim 1, wherein if the operation instruction is a delete instruction, deleting metadata of a directory/file in a file system directory tree of the file system, to which the operation instruction is directed, from the file system directory tree of the file system and storing the metadata in a recycle directory tree of the file system, and the deleting comprises:
if the operation instruction is a deletion instruction and all conditions in target conditions are met, deleting the metadata of the directory/file aimed by the operation instruction in the directory tree of the file system from the directory tree of the file system and storing the metadata in the recovery directory tree;
wherein the target conditions include one or more of a recycle bin being turned on, a name prefix not within a target prefix range, a name suffix not within a target suffix range, or a parent directory not within a target parent directory range.
3. The method of claim 2, further comprising:
acquiring a configuration command of a user for the file system;
based on the configuration command, one or more of a switch status of a recycle bin, a target prefix range, a target suffix range, or a target parent directory range is determined.
4. The method of claim 1, further comprising: and based on the directory/file aimed at by the operation instruction, performing reduction processing on the relevant statistics of the file system, and performing increase processing on the relevant statistics of the recycle bin.
5. The method according to any one of claims 1 to 4, wherein before deleting the metadata of the directory/file in the file system directory tree of the file system, which the operation instruction targets, from the file system directory tree of the file system and storing the metadata in the recycle directory tree of the file system, if the operation instruction is a delete instruction, the method further comprises: determining that the directory/file to which the operation instruction is directed is not in the recycle bin.
6. The method of claim 5, wherein the state attribute of a directory/file in the file system is a delete state indicating that the directory/file is in a recycle bin;
the determining that the directory/file to which the operation instruction is directed is not in the recycle bin comprises: determining that the state attribute of the directory/file to which the operation instruction is directed is not a deletion state;
after the deleting and storing the metadata of the directory/file targeted by the operation instruction in the directory tree of the file system from the directory tree of the file system into the recovery directory tree of the file system, the method further includes: and setting the state attribute of the directory/file to which the operation instruction is directed to be in a deletion state.
7. A method for managing a recycle bin of a file system, comprising:
acquiring a recovery command of a user for the file system;
and deleting and saving the metadata of the directory/file targeted by the recovery command from a recovery directory tree of the file system into a file system directory tree of the file system, and associating the metadata of the file in the file system directory tree with the metadata for describing the storage position of the file when the recovery command is targeted at the file, so as to recover the directory/file targeted by the recovery command from a recovery station of the file system.
8. The method of claim 7, further comprising:
acquiring a cleaning command of a user for the file system;
and deleting the metadata of the directory/file targeted by the cleaning command from the recycle directory tree, and when the cleaning command is targeted at a file, triggering the deletion of the data of the file based on the associated metadata of the file in the recycle directory tree so as to delete the directory/file targeted by the deletion command from the recycle bin.
9. The method of claim 7, comprising:
determining that the time length of the metadata of any directory/file in the recovery directory tree reaches a time length threshold;
and deleting the metadata of any directory/file from the recovery directory tree, and triggering the deletion of the data of any file based on the associated metadata of the metadata of any file in the recovery directory tree when any directory/file is any file, so as to delete any directory/file from the recovery station.
10. The method according to any one of claims 7-9, further comprising:
and based on the directory/file targeted by the recovery command, performing increasing processing on the related statistics of the file system, and performing decreasing processing on the related statistics of the recycle bin.
11. A processing apparatus of a file system, comprising:
the acquisition module is used for acquiring an operating instruction of an application program aiming at the file system;
and the deleting module is used for deleting the metadata of the directory/file which is aimed at by the operating instruction in a directory tree of a file system of the file system from the directory tree of the file system and storing the metadata into a recovery directory tree of the file system if the operating instruction is a deleting instruction, and associating the metadata of the file in the recovery directory tree with the metadata for describing the storage position of the file when the operating instruction is directed at the file, so as to realize that the directory/file which is aimed at by the operating instruction is put into a recovery station of the file system.
12. A recycle bin management apparatus of a file system, comprising:
the acquisition module is used for acquiring a recovery command of a user for the file system;
and the recovery module is used for deleting and saving the metadata of the directory/file targeted by the recovery command from a recovery directory tree of the file system into a directory tree of the file system, and associating the metadata of the file in the directory tree of the file system with the metadata for describing the storage position of the file when the recovery command is targeted at the file, so as to recover the directory/file targeted by the recovery command from a recovery station of the file system.
13. A computing device, comprising: a memory, a processor; wherein the memory is to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any of claims 1 to 5 or the method of any of claims 6 to 9.
14. A computer-readable storage medium, having stored thereon a computer program which, when executed, implements the method of any one of claims 1 to 9.
CN202210114765.2A 2022-01-30 2022-01-30 File system processing method, recycle bin management method, device and equipment Pending CN114490516A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210114765.2A CN114490516A (en) 2022-01-30 2022-01-30 File system processing method, recycle bin management method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210114765.2A CN114490516A (en) 2022-01-30 2022-01-30 File system processing method, recycle bin management method, device and equipment

Publications (1)

Publication Number Publication Date
CN114490516A true CN114490516A (en) 2022-05-13

Family

ID=81478389

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210114765.2A Pending CN114490516A (en) 2022-01-30 2022-01-30 File system processing method, recycle bin management method, device and equipment

Country Status (1)

Country Link
CN (1) CN114490516A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024114344A1 (en) * 2022-11-28 2024-06-06 华为技术有限公司 File management method and electronic device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024114344A1 (en) * 2022-11-28 2024-06-06 华为技术有限公司 File management method and electronic device

Similar Documents

Publication Publication Date Title
US9830231B2 (en) Processes and methods for client-side fingerprint caching to improve deduplication system backup performance
US8756199B2 (en) File level hierarchical storage management system, method, and apparatus
US9792316B1 (en) System and method for efficient data removal in a deduplicated storage system
US20170206353A1 (en) Method and system for preventing malicious alteration of data in computer system
US8606759B2 (en) Apparatus, system and method for recovering meta data using fragmentary information
US10013312B2 (en) Method and system for a safe archiving of data
EP3495981B1 (en) Directory deletion method and device, and storage server
US8606751B1 (en) System and method for backup by inode number
CN108197270B (en) Distributed file system data recovery method
CN111240892B (en) Data backup method and device
CN107832470A (en) A kind of object storage method and device based on storage system
US20200145359A1 (en) Handling large messages via pointer and log
CN109947730B (en) Metadata recovery method, device, distributed file system and readable storage medium
CN112328363A (en) Cloud hard disk mounting method and device
CN114490516A (en) File system processing method, recycle bin management method, device and equipment
CN112306957A (en) Method and device for acquiring index node number, computing equipment and storage medium
CN103984622A (en) Method and device for managing logs for Linux-based GPON ONU (Gigabit Passive Optical Network Optical Unit) equipment
WO2009031158A2 (en) Method and apparatus for network based data recovery
CN110888847B (en) Recycle bin system and file recycling method
CN110928945B (en) Data processing method and device for database and data processing system
US9852031B2 (en) Computer system and method of identifying a failure
US20190065065A1 (en) Data protection method and storage server
CN114281769A (en) Method and device for managing files on disk, computer equipment and storage medium
CN115361377A (en) File uploading method, user terminal, network disk server, equipment and medium
CN113742786B (en) Method and device for checking archive data in blockchain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination