Path resolution method, apparatus, and system

By determining the index information in the directory tree and performing reverse recursive operations, the CPU resource bottleneck caused by directory tree parsing in metadata services is solved, achieving fast parsing and efficient metadata services.

CN116361287BActive Publication Date: 2025-11-25ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310204451.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-27
Publication Date
2025-11-25
Estimated Expiration
2043-02-27

Smart Images

  • Figure CN116361287B_ABST
    Figure CN116361287B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a path resolution method, device and system, wherein the path resolution method comprises: determining first index information and second index information according to a user access path submitted for a directory tree in a file system; locating a target index item in a directory index table corresponding to the directory tree by using the first index information, and reading third index information in the target index item; performing a recursive operation from a directory item in the directory tree to a root directory item according to the first index information, the second index information and the third index information; resolving the directory tree according to a recursive operation result and a preset resolution strategy, and determining access information corresponding to the user access path in the file system according to a resolution result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments in this specification relate to the field of distributed storage technology, and in particular to path resolution methods, apparatus and systems. Background Technology

[0002] With the development of internet technology, distributed storage technology is being applied in an increasing number of scenarios. In distributed storage services, the metadata system's service capability is a crucial indicator. In a metadata system, any file operation is accompanied by at least one metadata operation, with directory tree parsing being the most frequent. The speed of directory tree parsing directly impacts the metadata system's service capability. Currently, metadata services require multiple filename comparisons during directory tree parsing. This process consumes significant CPU resources, leading to a single-machine CPU resource bottleneck and limiting service performance. This restricts directory tree access performance. Therefore, an effective solution is urgently needed to address these issues. Summary of the Invention

[0003] In view of this, embodiments of this specification provide a path resolution method. One or more embodiments of this specification also relate to a path resolution apparatus, a path resolution system, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.

[0004] According to a first aspect of the embodiments of this specification, a path resolution method is provided, comprising:

[0005] The first index information and the second index information are determined based on the user access path submitted to the directory tree in the file system;

[0006] The first index information is used to locate the target index item in the directory index table corresponding to the directory tree, and the third index information is read from the target index item;

[0007] According to the first index information, the second index information and the third index information, a recursive operation is performed from the directory item in the directory tree to the root directory item;

[0008] The directory tree is parsed based on the recursive operation result and the preset parsing strategy, and the access information corresponding to the user access path is determined in the file system based on the parsing result.

[0009] According to a second aspect of the embodiments of this specification, a path resolution apparatus is provided, comprising:

[0010] The determination module is configured to determine the first index information and the second index information based on the user access path submitted against the directory tree in the file system;

[0011] The positioning module is configured to locate the target index item in the directory index table corresponding to the directory tree using the first index information, and read the third index information from the target index item.

[0012] The operation module is configured to perform recursive operations from the directory item in the directory tree to the root directory item according to the first index information, the second index information and the third index information;

[0013] The parsing module is configured to parse the directory tree based on the result of the recursive operation and a preset parsing strategy, and determine the access information corresponding to the user access path in the file system based on the parsing result.

[0014] According to a third aspect of the embodiments of this specification, a path resolution system is provided, comprising:

[0015] File storage nodes and path resolution nodes;

[0016] The file storage node is used to store file information corresponding to the directory tree, and the path resolution node is used to execute path resolution executable instructions. When the path resolution executable instructions are executed by the path resolution node, the steps of the path resolution method are implemented.

[0017] According to a fourth aspect of the embodiments of this specification, a computing device is provided, comprising:

[0018] Memory and processor;

[0019] The memory is used to store computer-executable instructions, and the processor is used to implement the steps of any of the above-described path resolution methods when executing the computer-executable instructions.

[0020] According to a fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions that, when executed by a processor, implement the steps of the path resolution method described above.

[0021] According to a sixth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the path resolution method described above.

[0022] The path resolution method provided in this specification aims to reduce computational resource consumption and improve metadata service capabilities. After obtaining the user access path submitted to the directory tree in the file system, it determines the first and second index information based on the user access path. The first index information is then used to locate the target index entry in the directory index table built for the directory tree, allowing the reading of the third index information through the target index entry. Based on this, the first, second, and third index information are combined, and a recursive operation is performed from the directory entry in the directory tree to the root directory entry. This achieves fast directory tree parsing in reverse order, saving the filename comparison operation from the root directory entry to the directory entry, thus completing the processing of parsing the directory tree based on the local user access path. Subsequently, based on the recursive operation results and a preset parsing strategy, the unparsed parts of the directory tree are parsed, thereby determining the access information corresponding to the user access path in the file system. This achieves the goal of saving computational resources and improving metadata service capabilities. When accessing the file system based on a user access path, the target directory entry can be quickly located without requiring numerous filename comparison operations, enabling rapid response to user access requests. Attached Figure Description

[0023] Figure 1 This is a schematic diagram of a path resolution method provided in one embodiment of this specification;

[0024] Figure 2 This is a flowchart illustrating a path resolution method provided in one embodiment of this specification;

[0025] Figure 3 This is a schematic diagram of a directory tree in a path resolution method provided in one embodiment of this specification;

[0026] Figure 4 This is a flowchart illustrating the processing procedure of a path resolution method provided in one embodiment of this specification;

[0027] Figure 5 This is a schematic diagram of the structure of a path resolution device provided in one embodiment of this specification;

[0028] Figure 6 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0029] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0030] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0031] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0032] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0033] File system: The data structure used by the operating system for files on storage devices or partitions; that is, the system for organizing files on storage devices.

[0034] Directory tree: The directory tree of a file system is an inverted tree structure. The root directory is at the top level, and it contains several subdirectories and files. Each subdirectory can contain several lower-level subdirectories. This organizational structure is called a directory tree.

[0035] This specification provides a path resolution method, and also relates to a path resolution device, a path resolution system, a computing device, a computer-readable storage medium, and a computer program, which will be described in detail in the following embodiments.

[0036] See Figure 1The schematic diagram illustrates the path resolution method provided in this specification. To reduce computational resource consumption and improve metadata service capabilities, after obtaining the user access path submitted to the directory tree in the file system, it determines the first and second index information based on the user access path. The first index information is used to locate the target index entry in the directory index table built for the directory tree, allowing the reading of the third index information through the target index entry. Based on this, combining the first, second, and third index information, a recursive operation is performed from the directory entry in the directory tree to the root directory entry, achieving rapid resolution of the directory tree in reverse order. This saves the filename comparison operation from the root directory entry to the directory entry, completing the processing of resolving the directory tree based on the local user access path. Subsequently, based on the recursive operation results and a preset resolution strategy, the unresolved parts of the directory tree are resolved, thus determining the access information corresponding to the user access path in the file system. This achieves the goal of saving computational resources and improving metadata service capabilities. When accessing the file system based on a user access path, the target directory entry can be quickly located without requiring numerous filename comparison operations, enabling a rapid response to user access requests.

[0037] It should be noted that all data involved in this application are information and data authorized by the user or fully authorized by all parties, and their use and processing must comply with the relevant laws, regulations and standards of the relevant countries and regions. Corresponding operation portals are provided for users to choose to authorize or refuse.

[0038] Figure 2 A flowchart of a path resolution method according to an embodiment of this specification is shown, which specifically includes the following steps.

[0039] Step S202: Determine the first index information and the second index information based on the user access path submitted for the directory tree in the file system.

[0040] Specifically, a file system refers to a data system used to store and / or manage files, providing users with file storage space for convenient file storage. Correspondingly, a directory tree refers to a tree-like structure in the file system, composed of directory entries as nodes, with the root node being the root directory and child nodes being subdirectories under the root directory. When searching for a file in the file system, the location of the file being searched for needs to be determined by parsing the directory tree, and then data is recursively read from the target file to provide the result.

[0041] Accordingly, the user access path specifically refers to the path through which a user reads the information they need when accessing the file system; this path points to the target directory entry. Parsing the directory tree according to the user access path is the process of reading the required access information from the file system. Correspondingly, the first index information specifically refers to the index information corresponding to the full path of the parent directory in the user access path, and the second index information specifically refers to the index information corresponding to the full path of the grandparent directory in the user access path. Based on the first and second index information, the filename comparison operation for all directory entries preceding the parent directory entry corresponding to the full path of the parent directory can be saved during directory tree parsing, thus enabling faster directory tree parsing.

[0042] In practical applications, see Figure 3 As shown in the diagram (a), when parsing a directory tree, the typical parsing path is from top to bottom. For example, to parse the path / a / b / c, the metadata node of the root path ( / ) is first obtained. This root node contains a data structure pointing to all child nodes, such as a linked list, red-black tree, or hash table. However, regardless of the method, the metadata node of directory 'a' needs to be located through multiple comparisons. Then, the parsing continues through the child node structure contained in node 'a' to determine the metadata node of the directory. This process continues until the entire path is completed before the directory 'c' pointed to by the user's access path can be found. In this process, 18 name comparisons are required, meaning that all nodes before the directory is found need to be compared at each level, which will cause a lot of resource waste.

[0043] In view of this, this embodiment records the relevant index information of the nodes in the directory tree by setting a directory index table, so that it can be directly reused in the application stage, thereby saving comparison operations and achieving the purpose of quickly parsing the directory tree and quickly responding to user access requests.

[0044] Furthermore, after obtaining the user access path, in order to quickly parse the directory tree of the file system based on the user access path, it is necessary to combine index information to complete the process. This allows for the subsequent location of directory entries in the directory index table, saving computational resources consumed by parsing by reading directory entries. The determination of the first and second index information is fundamental to the completion of the parsing operation; therefore, the accuracy of the index information must be ensured before subsequent processing can proceed. In this embodiment, the specific implementation method is as follows:

[0045] Obtain the user access path submitted for the directory tree in the file system; parse the user access path to obtain the full path of the first directory and the full path of the second directory; load the first index information corresponding to the full path of the first directory and the second index information corresponding to the full path of the second directory.

[0046] Specifically, the full path of the first directory refers to the access path of the parent directory preceding the subdirectory in the user's access path; similarly, the full path of the second directory refers to the access path of the grandparent directory preceding the subdirectory in the user's access path. For example, if the user's access path is / a / b / c / d / e / f / g, then the full path of the parent directory is / a / b / c / d / e / f, and the full path of the grandparent directory is / a / b / c / d / e.

[0047] Based on this, after obtaining the user's access path submitted by the user regarding the directory tree in the file system, it indicates that the user needs to access file information in a specified directory. To quickly locate the target directory and provide feedback on the access information, the user's access path can be parsed first. Based on the parsing result, the full path of the parent directory (i.e., the first directory) and the full path of the grandparent directory (i.e., the second directory) can be obtained. Since a directory index table is stored and updated in real-time in this scenario, combining the first index information of the first directory's full path and the second index information corresponding to the second directory's full path allows for subsequent reading of the directory index table, locating directory entries, and parsing the directory tree. Therefore, after obtaining the first and second directory full paths, the first index information corresponding to the first directory's full path and the second index information corresponding to the second directory's full path can be loaded for convenient subsequent use.

[0048] In practical applications, when parsing user access paths, you can start parsing from the end of the user access path to quickly determine the full path of the parent directory and the full path of the grandparent directory, thereby improving the parsing speed of the directory tree.

[0049] In summary, by parsing the user access path to obtain the full paths of the first and second directories, and using these as a basis to determine the first and second index information, it is possible to avoid parsing the nodes before the full paths of the first and second directories when parsing the directory tree later, thereby improving the directory tree parsing speed and reducing resource consumption.

[0050] Based on this, in order to complete subsequent processing operations by combining index information with the parsed directory tree nodes, index information can be used to combine content with different results; in this embodiment, the specific implementation method is as follows:

[0051] Calculate the first hash code corresponding to the full path of the first directory, the second hash code corresponding to the full path of the second directory, and the first directory depth corresponding to the full path of the first directory; generate the first index information based on the first hash code and the first directory depth, and generate the second index information based on the second hash code.

[0052] Specifically, the first hash code refers to the hash code obtained by calculating the full path of the first directory, and the second hash code refers to the hash code obtained by calculating the full path of the second directory. Similarly, the first directory depth refers to the directory depth corresponding to the full path of the first directory, indicating the number of operations required to read a file using the full path of the first directory. For example, if the full path of the first directory is / a / b / c / d / e / f, then its corresponding directory depth is 7, meaning that it takes 7 operations to access the f directory.

[0053] Based on this, after obtaining the user access path, in order to speed up the parsing of the directory tree corresponding to the file system, the full path of the parent directory (i.e., the full path of the first directory) and the full path of the grandparent directory (i.e., the full path of the second directory) can be determined first from the user access path. Then, the first hash code corresponding to the full path of the first directory, the second hash code corresponding to the full path of the second directory, and the first directory depth corresponding to the full path of the first directory are calculated. This allows us to obtain index information that can be used to locate the target index entry in the subsequent reading of the directory index table. At this point, the first index information can be generated based on the first hash code and the first directory depth, and the second index information can be generated based on the second hash code, facilitating subsequent use.

[0054] For example, after obtaining the user access path ` / a / b / c / d / e / f / g`, we can parse the path `{ / a / b / c / d / e / f / g}` to obtain the full path of the parent directory (`parent_path`) as `{ / a / b / c / d / e / f}` and the full path of the grandparent directory (`grand_path`) as `{ / a / b / c / d / e}`. After obtaining the parent and grandparent full paths, we can calculate their respective hash codes. The hash code for the parent path is determined to be HC1, and the hash code for the grandparent path is determined to be HC2. We also determine that the directory depth corresponding to the parent path is 7, to facilitate the subsequent use of the directory index table and to quickly parse the directory tree.

[0055] In summary, by combining directory depth and hash code to construct index information, it is possible to quickly locate the target index item when reading the directory index table later, thereby achieving the goal of fast parsing of the directory tree and reducing computing resources.

[0056] Step S204: Use the first index information to locate the target index item in the directory index table corresponding to the directory tree, and read the third index information from the target index item.

[0057] Specifically, based on the above-mentioned acquisition of the user access path and determination of the first and second index information, in order to save computing resources, a real-time updated directory index table can be preset in the metadata system. The directory index table records the index entries corresponding to all nodes before the subdirectory nodes in the directory tree, and records the index information corresponding to each directory entry. This allows the application stage to directly read the directory index table, find the target index entry corresponding to the current user access path, and read the third index information from the target index entry.

[0058] In other words, an empty directory index table is first constructed for the directory tree. Then, according to the current structure of the directory tree, index information is written to each index entry in the directory index table. This allows the directory index table to record the index information corresponding to each directory entry in the directory tree in real time. When the directory tree needs to be parsed, the directory index table can be read directly to locate the target index entry corresponding to the user's access path. The third index information is then read from the target index entry and used as the basis for subsequent directory tree parsing operations. This effectively saves on the consumption of computing resources.

[0059] Specifically, the directory index table refers to a list of index entries corresponding to integrated directory entries. It records the index entries corresponding to different directory entries, and each index entry records all the index information of the associated directory entries. This index information can be used to parse the directory tree. Correspondingly, the target index entry refers to the index entry corresponding to the parent directory entry, which can save the name comparison operation before the parent directory entry.

[0060] See Figure 3As shown in the diagram in Figure (b), in practical applications, the directory index table can be constructed using a fixed-size array or a dynamically expandable two-dimensional array. Each entry in the index table stores an index item, which can consist of 7 parts: a 32-bit EntryID (identifying the directory item ID, capable of distinguishing 4 billion entries); a 16-bit version number (the version number of the duplicate EntryID, which can be expanded into a 48-bit unique EntryID); a 10-bit hashCode of the full path of the current directory; a 6-bit Depth (modulo 64) indicating the depth of the current directory item in the directory tree; a 32-bit hashCode of the full path of the parent directory of the current directory; a 27-bit cache set / modified timestamp; and a 5-bit cache validity TTL (TTL=0 can be replaced). This is used to record the index information of the directory items in the directory tree, enabling the direct determination of partial parsing results based on the index items during directory tree parsing. Based on this, the unparsed parts can then be parsed, effectively speeding up the parsing operation and reducing resource consumption.

[0061] Furthermore, when locating and using the target index entry from the directory index table, since the directory index table is a dynamically expandable two-dimensional array that records the directory tree corresponding to the current file system in real time, its purpose is to reduce the computing resources consumed when parsing the directory tree. Therefore, it needs to combine different information to complete the location. In this embodiment, the specific implementation method is as follows:

[0062] Extract the first hash code from the first index information; query the directory index table corresponding to the directory tree based on the first hash code, and locate the target index item based on the query result; extract the third hash code and the third directory depth from the target index item, and generate the third index information based on the third hash code and the third directory depth.

[0063] Specifically, the third hash code refers to the hash code of this directory recorded in the target index entry, and correspondingly, the third directory depth refers to the third directory depth recorded in the directory index table.

[0064] Based on this, after obtaining the first and second index information, in order to save computing resources, a directory index table can be used to determine the index information, thereby reducing the recursive operations when parsing the directory tree. At this time, in order to save the operation of comparing all names before the parent directory item, the first hash code can be extracted from the first index information. Then, the directory index table corresponding to the directory tree is queried according to the first hash code to locate the target index item of the corresponding user access path based on the query result. At this time, the third hash code and the third directory depth are extracted from the target index item, and the third index information can be generated according to the third hash code and the third directory depth for convenient subsequent use.

[0065] Following the previous example, after obtaining the above information, we can first determine that the hashCode of the full path of the parent directory (parent_path) is HC1. Then, we use the HC1 of the full path of the parent directory (parent_path) to locate the target index entry in the directory index table, and determine the record in the target index entry, such as... Figure 3 The information shown in (b) indicates that the HashCode is HC3 and the directory depth is D, which can be read from the target index item for later use.

[0066] In summary, by using a directory index table to locate the target index item, it is convenient to directly read the target index item during the subsequent parsing stage to determine the index information, thereby reducing the consumption of computing resources.

[0067] Step S206: Perform a recursive operation from the directory item in the directory tree to the root directory item according to the first index information, the second index information, and the third index information.

[0068] Specifically, after reading the first, second, and third index information, further, since the first index information corresponds to the full path of the parent directory, the second index information corresponds to the full path of the grandparent directory, and the third index information corresponds to the index entry, combining these three pieces of information allows direct determination of the root directory entry and directory entry corresponding to the user access path in the directory tree. The directory entry is the parent directory entry. Based on this, a recursive operation is performed from the directory entry to the root directory entry in the directory tree, thus achieving the parsing of the directory tree according to the local user access path. This parsing process is completed from the parent directory entry to the root directory entry; the reverse operation does not require name comparison, thereby accelerating the parsing of the directory tree. Here, the directory entry is the parent directory entry corresponding to the user access path, and the root directory entry is the root directory entry of the user access path.

[0069] Correspondingly, recursive operation specifically refers to the parsing operation from the directory item to the root directory item. Since the process from the directory item to the root directory item is in reverse order, it can determine the parent directory item of each directory item without comparison. By analogy, it can directly parse to the root directory item and realize the parsing processing of all tree nodes before the parent directory item.

[0070] Furthermore, when performing recursive operations, considering that the first index information, the second index information, and the third index information come from different sources, the purpose is to be able to parse the directory tree in reverse order. This will save computing resources when parsing the directory tree according to the user access path. Therefore, it is necessary to combine the parsing conditions to ensure the parsing accuracy. In this embodiment, the following steps S2062 to S2066 are specifically implemented.

[0071] Step S2062: If the first index information, the second index information, and the third index information satisfy the parsing conditions, locate the directory item in the directory tree according to the third index information.

[0072] Specifically, the parsing conditions refer to the conditions for checking whether the directory tree can be parsed at the current moment according to the first index information, the second index information, and the third index information. If the conditions are met, it means that the above index information can be used to parse the directory tree according to the user access path. If the conditions are not met, it means that the third index information read at the current moment may not be the latest index information corresponding to the directory entry in the file system.

[0073] Based on this, after obtaining the first index information, the second index information, and the third index information, in order to ensure that the directory tree is parsed smoothly according to the above index information and that the parsing result corresponds to the structure of the directory tree at the current moment, we can first check whether the first index information, the second index information, and the third index information meet the parsing conditions. If they do, we can then locate the directory item, i.e. the parent directory item, in the directory tree according to the third index information for subsequent recursive operation processing.

[0074] Furthermore, the parsing condition detection is actually performed from different dimensions. In this embodiment, the specific implementation method is as follows:

[0075] The first hash code in the first index information is compared with the third hash code in the third index information; the first directory depth in the first index information is compared with the third directory depth in the third index information; and the first hash code in the first index information is compared with the second hash code in the second index information. If the comparison results are all the same, it is determined that the first index information, the second index information, and the third index information satisfy the parsing condition, and the step of locating the directory item in the directory tree based on the third index information is executed.

[0076] Based on this, to ensure that the third index information currently read from the target index item can assist in parsing the directory tree and avoid it not corresponding to the current structure of the directory tree, the first hash code in the first index information can be compared with the third hash code in the third index information, the first directory depth in the first index information can be compared with the third directory depth in the third index information, and the first hash code in the first index information can be compared with the second hash code in the second index information. If the results of the above comparisons are all the same, it can be determined that the first index information, the second index information, and the third index information all meet the parsing conditions. At this time, the directory item can be located in the directory tree based on the third index information.

[0077] In summary, considering that files in the file system may change at any time, and the directory tree structure may also change, the directory index table may not be updated in time. If the target index item is determined based on this, the subsequent parsing of the directory tree may not be possible. Therefore, it is advisable to compare and then locate the directory item to facilitate the subsequent parsing of the directory tree.

[0078] Furthermore, when locating directory items, in order to ensure that the execution order of recursive operations conforms to the user's access path and to ensure that accurate access information can be fed back to the user, it is necessary to combine the directory item identifier. In this embodiment, the specific implementation method is as follows:

[0079] The third index information is parsed to obtain the directory item identifier, and the directory item is located in the directory tree according to the directory item identifier; the third index information is parsed to obtain the index item version number, and the directory item version number corresponding to the directory item is determined; if the index item version number is the same as the directory item version number, step S2064 is executed.

[0080] Specifically, the directory entry identifier refers to the EntryID read from the third index information, the corresponding index entry version number refers to the version number recorded in the target index entry, and the directory entry version number refers to the version number corresponding to the parent directory entry.

[0081] Based on this, in order to more accurately locate the directory item, i.e. the parent directory item, the third index information can be parsed first to obtain the directory item identifier. Then, the directory item, i.e. the parent directory item, can be located in the directory tree according to the directory item identifier. After that, the third index information can be parsed again to obtain the index item version number and determine the directory item version number corresponding to the directory item. If the index item version number and the directory item version number are the same by comparison, step S2064 can be executed.

[0082] Step S2064: Locate the root directory entry in the directory tree according to the first directory depth in the first index information.

[0083] Step S2066: Perform a recursive operation from the directory item in the directory tree to the root directory item.

[0084] Based on this, after determining the directory items as described above, since recursion needs to be performed in reverse order, the root directory item can be located in the directory tree based on the first directory depth in the first index information. Finally, the recursive operation can be performed from the directory items in the directory tree to the root item.

[0085] In other words, during recursive operations, the process recursively searches for the parent directory entries of the current directory entry based on the directory depth of the full path of the parent directory, continuing until the root directory entry is reached. This allows for a reverse, bottom-up parsing of the directory tree, resolving all tree nodes preceding the current directory entry. The introduction of index information saves on name comparison operations during this process. This recursive operation effectively collects the ancestor directory entry nodes of the user's access path in reverse order, without performing any directory name comparisons. Finally, by rapidly recursively traversing the directory tree from top to bottom, the directory tree can be parsed.

[0086] Following the example above, after obtaining the above information, we can compare the hashCode HC3 in the target index with HC1 in the parent directory full path (parent_path), and compare the directory depth D in the target index with the directory depth 7 in the parent directory full path (parent_path). At the same time, we can also compare HC2 in the grandparent directory full path (grand_path) with HC1 in the parent directory full path (parent_path).

[0087] If all the above comparisons pass, then it is CacheHit. At this time, the EntryID can be read from the target index entry, and the directory entry f can be located in the directory tree based on the EntryID. If the version number of the directory entry f is the same as the version number in the target index entry, then the parent directory entry of the directory entry f can be recursively searched D times based on the directory depth. If the final directory entry is the root directory entry ( / ), then it is further CacheHit, and the TTL is incremented by 1.

[0088] During this process, the ancestor directory entry nodes of the user's access path have been collected in reverse order through the recursive parsing described above, without any directory entry name comparison operations. Then, by rapidly recursively parsing the directory tree from top to bottom, partial parsing of the directory tree can be achieved. Finally, further parsing of the remaining part completes the operation of parsing the directory tree according to the user's access path.

[0089] In summary, by combining three types of index information for partial parsing of the directory tree, it is possible to complete the directory tree parsing without comparing directory item names, thereby effectively saving computing resources.

[0090] Step S208: Parse the directory tree according to the recursive operation result and the preset parsing strategy, and determine the access information corresponding to the user access path in the file system according to the parsing result.

[0091] Specifically, after the recursive processing described above, the nodes of ancestor directory entries in the user access path are collected in reverse order through recursive operations. Then, the nodes of the directory entries in the user access path that were not collected are parsed. At this point, the directory tree can be parsed again based on the recursive operation results and a preset parsing strategy, allowing the access information corresponding to the user access path to be determined in the file system based on the parsing results.

[0092] Specifically, the preset parsing strategy refers to the strategy for parsing the nodes of uncollected directory entries in the directory tree within the user's access path. This strategy can employ a sequential parsing method, that is, comparing the names of the nodes corresponding to the uncollected directory entries one by one according to their levels, thereby completing the operation of parsing the directory tree according to the user's access path. Correspondingly, the access information specifically refers to the content stored in the target directory entry pointed to by the user's access path, which can be files, resources, information, data, etc. This embodiment does not impose any limitations.

[0093] Furthermore, when parsing the directory tree using recursive operations, since most of the parsing processing has already been completed through recursion, only the nodes at the last level need to be compared to determine the access information corresponding to the user's access path. Therefore, the parsing of the last level can be completed using a preset parsing strategy. In this embodiment, the specific implementation method is as follows:

[0094] Based on the result of the recursive operation, the first directory entry node corresponding to the user access path in the directory tree is determined, wherein the result of the recursive operation is the reverse recursive operation information from the directory entry to the root directory entry; the first subdirectory entry node corresponding to the directory entry is determined in the first directory entry node, and the second directory entry node is determined in the directory tree based on the first subdirectory entry node; the second directory entry node is parsed according to the preset parsing strategy to obtain the second subdirectory entry node; based on the first directory entry node and the second subdirectory entry node, the access information corresponding to the user access path is determined in the file system.

[0095] Specifically, the first directory entry node refers to the node in the directory entry that has matched the user's access path and completed the resolution. Correspondingly, the first subdirectory entry node refers to the node in the directory tree that corresponds to the parent directory entry. Correspondingly, the second directory entry node refers to all directory entry nodes corresponding to the level to which the subdirectory entry belongs. Correspondingly, the second subdirectory entry node refers to the directory entry node that has been hit in the level to which the subdirectory entry belongs.

[0096] Based on this, according to the result of the recursive operation, the first directory entry node corresponding to the user access path in the directory tree can be determined first, then the first subdirectory entry node corresponding to the directory entry can be determined in the first directory entry node, and the second directory entry node can be determined in the directory tree according to the first subdirectory entry node; the second directory entry node can be obtained by parsing the second directory entry node according to the preset parsing strategy; at this time, the collected first directory entry node and second subdirectory entry node are integrated to determine the access information corresponding to the user access path in the file system.

[0097] In summary, by combining index entries and preset parsing strategies to parse the directory tree according to user access strategies, it is possible to ensure that the parsing results correspond to the user access path, while improving parsing speed and reducing the computing resources consumed by name comparison.

[0098] Based on this, in order to achieve fast parsing, parsing can also be completed by locking protection. In this embodiment, the specific implementation method is as follows:

[0099] The process involves determining the name of the directory entry to be accessed based on the user access path, and determining the name of the directory entry corresponding to the second subdirectory entry node; if the second subdirectory entry node is a child node of the first subdirectory entry node, and the name of the directory entry to be accessed is the same as the name of the directory entry, then the step of determining the access information corresponding to the user access path in the file system based on the first directory entry node and the second subdirectory entry node is executed.

[0100] Based on this, when determining access information, in order to ensure the correctness of parsing, the name of the directory entry to be accessed and the name of the directory entry corresponding to the second subdirectory entry node can be determined according to the user access path. If the second subdirectory entry node is a child node of the first subdirectory entry node and the name of the directory entry to be accessed is the same as the name of the directory entry, the step of determining the access information corresponding to the user access path in the file system based on the first directory entry node and the second subdirectory entry node can be performed.

[0101] In other words, if the current directory entry is still a subdirectory entry of the parent directory entry, meaning the parent directory entry points to the correct parent node, and the name of the current directory entry is the directory entry that the user wants to access, then the resolution can be considered correct, and the access information can be determined.

[0102] Following the previous example, after recursively processing and determining the corresponding nodes { / , a, b, c, d, e, f} for each directory entry in the directory tree, we can use a top-down comparison method to determine whether the directory names stored in the corresponding nodes of the directory entries at each level of the path / a / b / c / d / e / f match the directory entry names at the same level. If all match, the validity of the f node can be quickly determined. Based on this, we can then use the standard method of determining whether the g node is a child node of the f node to search for and locate the directory entry g, and finally complete the parsing of the directory tree, thus providing the directory tree node information corresponding to the g node back to the user.

[0103] In summary, by combining index entries and preset parsing strategies to parse the directory tree according to user access strategies, it is possible to ensure that the parsing results correspond to the user access paths, while improving parsing speed and effectively reducing the computing resources consumed by name comparison.

[0104] Furthermore, considering the possibility of misses during the above parsing process, i.e., the inability to continue parsing may result in the inability to provide feedback, a layer-by-layer parsing approach can be used to complete the directory tree parsing in order to determine the access information corresponding to the user's access path. In this embodiment, the specific implementation method is as follows:

[0105] A task execution link is created for the user access path, wherein the task execution link includes at least one task execution node, and the at least one task execution node is used to locate the target directory entry node in the directory tree; by running the task execution link, at least two target directory entry nodes are determined in the directory tree; based on the at least two target directory entry nodes, the target access information corresponding to the user access path is determined in the file system.

[0106] Based on this, a task execution link can be created for the user access path. The task execution link contains at least one task execution node, which is used to locate the target directory entry node in the directory tree. Then, by running the task execution link, at least two target directory entry nodes are determined in the directory tree. Thus, the target access information corresponding to the user access path can be determined in the file system based on at least two target directory entry nodes.

[0107] In summary, when parsing fails, the above solutions can be used to resolve the issue and avoid the problem of not being able to provide feedback to the user after submitting the access path.

[0108] Based on this, after parsing using the above method, in order to enable the directory index table to be used normally for fast parsing of the directory tree in the future, the index items can be updated based on the parsing results. In this embodiment, the specific implementation method is as follows:

[0109] Determine the directory entry node to be updated from the at least two target directory entry nodes; determine the directory entry to be updated corresponding to the directory entry node to be updated, load the index information to be updated corresponding to the directory entry to be updated; update the index information to be updated to the target index entry.

[0110] Based on this, in the event of a CacheMiss, the directory entry node to be updated can be determined from at least two target directory entry nodes; then, the directory entry to be updated corresponding to the directory entry node to be updated can be determined, and the index information to be updated corresponding to the directory entry to be updated can be loaded; thus, the index information to be updated can be updated to the target index entry.

[0111] In other words, after a CacheMiss occurs, the path to be accessed can be resolved according to the normal process, and the current parent directory entry can be updated to the target index entry determined above according to the following rules: if the time difference between the current time and the TimeInSecond recorded in the directory entry is within a certain range, and the TTL is greater than 1, it means that the index entry is valid, the TTL is decremented by 1, and the update can be skipped; otherwise, the relevant information of the current parent directory entry is used to fill the index entry, and TimeInSecond is set to the current time, and TTL is equal to 1.

[0112] The path resolution method provided in this specification aims to reduce computational resource consumption and improve metadata service capabilities. After obtaining the user access path submitted to the directory tree in the file system, it determines the first and second index information based on the user access path. The first index information is then used to locate the target index entry in the directory index table built for the directory tree, allowing the reading of the third index information through the target index entry. Based on this, the first, second, and third index information are combined, and a recursive operation is performed from the directory entry in the directory tree to the root directory entry. This achieves fast directory tree parsing in reverse order, saving the filename comparison operation from the root directory entry to the directory entry, thus completing the processing of parsing the directory tree based on the local user access path. Subsequently, based on the recursive operation results and a preset parsing strategy, the unparsed parts of the directory tree are parsed, thereby determining the access information corresponding to the user access path in the file system. This achieves the goal of saving computational resources and improving metadata service capabilities. When accessing the file system based on a user access path, the target directory entry can be quickly located without requiring numerous filename comparison operations, enabling rapid response to user access requests.

[0113] The following is in conjunction with the appendix Figure 4 Taking the path resolution method provided in this specification as an example in the application of distributed storage services, the path resolution method will be further explained. Figure 4 A flowchart illustrating the processing procedure of a path resolution method provided in one embodiment of this specification is shown, specifically including the following contents.

[0114] In practical applications, since any file operation is accompanied by at least one metadata operation, the metadata performance requirements are relatively low in a single-machine storage engine due to limited storage capacity and small service scale. However, in a distributed storage service, a cluster typically has a few or even one master metadata server managing hundreds or thousands of data servers and serving tens of thousands of compute servers, thus increasing the resource and performance requirements of the metadata server by several orders of magnitude.

[0115] In existing technologies, the performance limit of directory tree access has always been limited to tens of thousands to hundreds of thousands of OPS. To further improve performance, the only solution is to use more machine resources to create multiple volumes through federation. However, this approach requires more hardware, which brings more cost pressure. In addition, federation also brings more limitations and complexity, such as the overly complex implementation of cross-volume renaming and a significant increase in operation latency.

[0116] Analysis revealed that a significant amount of CPU resources are dedicated to directory tree parsing during metadata services. This is because it's the most frequent operation, and almost all other services rely on it. Directory tree parsing involves comparing the directory a user wants to access with the file system directory tree to determine if the directory exists and if the user has permission. When a single directory contains tens of thousands to millions of subdirectories or files, the overhead of this comparison is even greater. To accelerate this process, various index structures have been designed and applied to directory tree acceleration, such as hash-based or red-black tree-based index structures. However, these require index memory related to the size of the directory tree and incur high update overhead. Furthermore, even with these index structures, searching for a specific entry in a large directory tree still requires ten to hundreds of comparison operations per directory, resulting in a still significant overhead.

[0117] In view of this, the path resolution method provided in this embodiment, after obtaining the user access path submitted for the directory tree in the file system, can determine the first index information and the second index information based on the user access path. It then uses the first index information to locate the target index entry in the directory index table established for the directory tree, and reads the third index information through the target index entry. Based on this, combining the first, second, and third index information, a recursive operation is performed from the directory entry in the directory tree to the root directory entry, achieving fast resolution of the directory tree in reverse order. This saves the filename comparison operation from the root directory entry to the directory entry, completing the processing of resolving the directory tree based on the local user access path. Subsequently, based on the recursive operation result and the preset resolution strategy, the unresolved parts of the directory tree are resolved, thereby determining the access information corresponding to the user access path in the file system. This achieves the purpose of saving computing resources and improving metadata service capabilities, enabling rapid location of the target directory entry when accessing the file system based on the user access path, without requiring a large number of filename comparison operations, thus quickly responding to user access requests. The specific implementation process is shown in steps S402 to S428.

[0118] Step S402: Obtain the user access path submitted for the directory tree in the file system, and parse the user access path to obtain the full path of the first directory and the full path of the second directory.

[0119] Step S404: Calculate the first hash code corresponding to the full path of the first directory, the second hash code corresponding to the full path of the second directory, and calculate the depth of the first directory corresponding to the full path of the first directory.

[0120] Step S406: Generate first index information based on the first hash code and the first directory depth, and generate second index information based on the second hash code.

[0121] Step S408: Extract the first hash code from the first index information, query the directory index table corresponding to the directory tree based on the first hash code, and locate the target index item based on the query result.

[0122] Step S410: Extract the third hash code and the third directory depth from the target index item, and generate the third index information based on the third hash code and the third directory depth.

[0123] Step S412: Compare the first hash code in the first index information with the third hash code in the third index information, compare the first directory depth in the first index information with the third directory depth in the third index information, and compare the first hash code in the first index information with the second hash code in the second index information.

[0124] Step S414: If the comparison results are all the same, and the first index information, second index information and third index information satisfy the parsing conditions, the third index information is parsed to obtain the directory entry identifier, and the directory entry is located in the directory tree according to the directory entry identifier.

[0125] Step S416: Parse the third index information to obtain the index item version number, and determine the directory item version number corresponding to the directory item.

[0126] Step S418: If the version number of the index item is the same as the version number of the directory item, locate the root directory item in the directory tree according to the first directory depth in the first index information, and perform a recursive operation from the directory item in the directory tree to the root directory item.

[0127] Step S420: Determine the first directory entry node in the directory tree corresponding to the user access path based on the recursive operation result, wherein the recursive operation result is the reverse recursive operation information from the directory entry to the root directory entry.

[0128] Step S422: Determine the first subdirectory entry node corresponding to the directory entry in the first directory entry node, and determine the second directory entry node in the directory tree based on the first subdirectory entry node.

[0129] Step S424: Parse the second directory item node according to the preset parsing strategy to obtain the second subdirectory item node.

[0130] Step S426: Determine the name of the directory entry to be accessed based on the user access path, and determine the name of the directory entry corresponding to the second subdirectory entry node.

[0131] Step S428: If the second subdirectory entry node is a child node of the first subdirectory entry node, and the name of the directory entry to be accessed is the same as the name of the directory entry, determine the access information corresponding to the user access path in the file system based on the first directory entry node and the second subdirectory entry node.

[0132] The path resolution method provided in this specification aims to reduce computational resource consumption and improve metadata service capabilities. After obtaining the user access path submitted to the directory tree in the file system, it determines the first and second index information based on the user access path. The first index information is then used to locate the target index entry in the directory index table built for the directory tree, allowing the reading of the third index information through the target index entry. Based on this, the first, second, and third index information are combined, and a recursive operation is performed from the directory entry in the directory tree to the root directory entry. This achieves fast directory tree parsing in reverse order, saving the filename comparison operation from the root directory entry to the directory entry, thus completing the processing of parsing the directory tree based on the local user access path. Subsequently, based on the recursive operation results and a preset parsing strategy, the unparsed parts of the directory tree are parsed, thereby determining the access information corresponding to the user access path in the file system. This achieves the goal of saving computational resources and improving metadata service capabilities. When accessing the file system based on a user access path, the target directory entry can be quickly located without requiring numerous filename comparison operations, enabling rapid response to user access requests.

[0133] Corresponding to the above method embodiments, this specification also provides embodiments of a path resolution device. Figure 5 A schematic diagram of a path resolution device according to one embodiment of this specification is shown. Figure 5 As shown, the device includes:

[0134] The determination module 502 is configured to determine the first index information and the second index information based on the user access path submitted for the directory tree in the file system;

[0135] The positioning module 504 is configured to locate the target index item in the directory index table corresponding to the directory tree using the first index information, and read the third index information in the target index item.

[0136] Operation module 506 is configured to perform recursive operations from directory items in the directory tree to the root directory item according to the first index information, the second index information and the third index information;

[0137] The parsing module 508 is configured to parse the directory tree according to the result of the recursive operation and the preset parsing strategy, and determine the access information corresponding to the user access path in the file system according to the parsing result.

[0138] In an optional embodiment, the determining module 502 is further configured to:

[0139] Obtain the user access path submitted for the directory tree in the file system; parse the user access path to obtain the full path of the first directory and the full path of the second directory; load the first index information corresponding to the full path of the first directory and the second index information corresponding to the full path of the second directory.

[0140] In an optional embodiment, the determining module 502 is further configured to:

[0141] Calculate the first hash code corresponding to the full path of the first directory, the second hash code corresponding to the full path of the second directory, and the first directory depth corresponding to the full path of the first directory; generate the first index information based on the first hash code and the first directory depth, and generate the second index information based on the second hash code.

[0142] In an optional embodiment, the positioning module 504 is further configured to:

[0143] Extract the first hash code from the first index information; query the directory index table corresponding to the directory tree based on the first hash code, and locate the target index item based on the query result; extract the third hash code and the third directory depth from the target index item, and generate the third index information based on the third hash code and the third directory depth.

[0144] In an optional embodiment, the operation module 506 is further configured to:

[0145] If the first index information, the second index information, and the third index information satisfy the parsing conditions, locate the directory item in the directory tree according to the third index information; locate the root directory item in the directory tree according to the first directory depth in the first index information; and perform a recursive operation from the directory item in the directory tree to the root item.

[0146] In an optional embodiment, the operation module 506 is further configured to:

[0147] The first hash code in the first index information is compared with the third hash code in the third index information; the first directory depth in the first index information is compared with the third directory depth in the third index information; and the first hash code in the first index information is compared with the second hash code in the second index information. If the comparison results are all the same, it is determined that the first index information, the second index information, and the third index information satisfy the parsing condition, and the step of locating the directory item in the directory tree based on the third index information is executed.

[0148] In an optional embodiment, the operation module 506 is further configured to:

[0149] The third index information is parsed to obtain a directory item identifier, and the directory item is located in the directory tree according to the directory item identifier. Accordingly, after the step of locating the directory item in the directory tree according to the third index information is executed, the method further includes: parsing the third index information to obtain an index item version number, and determining the directory item version number corresponding to the directory item; if the index item version number is the same as the directory item version number, the step of locating the root directory item in the directory tree according to the first directory depth in the first index information is executed.

[0150] In an optional embodiment, the parsing module 508 is further configured to:

[0151] Based on the result of the recursive operation, the first directory entry node corresponding to the user access path in the directory tree is determined, wherein the result of the recursive operation is the reverse recursive operation information from the directory entry to the root directory entry; the first subdirectory entry node corresponding to the directory entry is determined in the first directory entry node, and the second directory entry node is determined in the directory tree based on the first subdirectory entry node; the second directory entry node is parsed according to the preset parsing strategy to obtain the second subdirectory entry node; based on the first directory entry node and the second subdirectory entry node, the access information corresponding to the user access path is determined in the file system.

[0152] In an optional embodiment, the parsing module 508 is further configured to:

[0153] The process involves determining the name of the directory entry to be accessed based on the user access path, and determining the name of the directory entry corresponding to the second subdirectory entry node; if the second subdirectory entry node is a child node of the first subdirectory entry node, and the name of the directory entry to be accessed is the same as the name of the directory entry, then the step of determining the access information corresponding to the user access path in the file system based on the first directory entry node and the second subdirectory entry node is executed.

[0154] In an optional embodiment, the apparatus further includes:

[0155] The path parsing module is configured to create a task execution link for the user access path, wherein the task execution link includes at least one task execution node, the at least one task execution node being used to locate a target directory entry node in the directory tree; by running the task execution link, at least two target directory entry nodes are determined in the directory tree; and based on the at least two target directory entry nodes, target access information corresponding to the user access path is determined in the file system.

[0156] In an optional embodiment, the apparatus further includes:

[0157] The update module is configured to: determine the directory entry node to be updated among the at least two target directory entry nodes; determine the directory entry to be updated corresponding to the directory entry node to be updated; load the index information to be updated corresponding to the directory entry to be updated; and update the index information to be updated to the target index entry.

[0158] The path resolution device provided in this specification, in order to reduce the consumption of computing resources and improve metadata service capabilities, can, after obtaining the user access path submitted for the directory tree in the file system, determine the first index information and the second index information based on the user access path. It then uses the first index information to locate the target index entry in the directory index table built for the directory tree, and reads the third index information through the target index entry. Based on this, it combines the first, second, and third index information to perform a recursive operation from the directory entry in the directory tree to the root directory entry, achieving fast parsing of the directory tree in reverse order. This saves the filename comparison operation from the root directory entry to the directory entry, completing the processing of parsing the directory tree based on the local user access path. Subsequently, based on the recursive operation results and the preset parsing strategy, it parses the unparsed parts of the directory tree, thus determining the access information corresponding to the user access path in the file system. This achieves the purpose of saving computing resources and improving metadata service capabilities, enabling rapid location of the target directory entry when accessing the file system based on a user access path, without requiring a large number of filename comparison operations, and thus quickly responding to user access requests.

[0159] The above is a schematic scheme of a path resolution device according to this embodiment. It should be noted that the technical solution of this path resolution device and the technical solution of the path resolution method described above belong to the same concept. For details not described in detail in the technical solution of the path resolution device, please refer to the description of the technical solution of the path resolution method described above.

[0160] Figure 6A structural block diagram of a computing device 600 according to one embodiment of this specification is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is used to store data.

[0161] The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0162] In one embodiment of this application, the aforementioned components of the computing device 600 and Figure 6 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 6 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.

[0163] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 600 can also be a mobile or stationary server.

[0164] The processor 620 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the path resolution method described above.

[0165] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the path resolution method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the path resolution method described above.

[0166] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the path resolution method described above.

[0167] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the path resolution method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the path resolution method described above.

[0168] An embodiment of this specification also provides a path resolution system, including a file storage node and a path resolution node; the file storage node is used to store file information corresponding to a directory tree, and the path resolution node is used to execute path resolution executable instructions, which, when executed by the path resolution node, implement the steps of the above-described path resolution method.

[0169] The above is an illustrative scheme of a path resolution system according to this embodiment. It should be noted that the technical solution of this path resolution system and the technical solution of the path resolution method described above belong to the same concept. For details not described in detail in the technical solution of the path resolution system, please refer to the description of the technical solution of the path resolution method described above.

[0170] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the path resolution method described above.

[0171] The above is an illustrative example of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the path resolution method described above belong to the same concept. Details not described in detail in the technical solution of the computer program can be found in the description of the technical solution of the path resolution method described above.

[0172] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0173] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0174] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0175] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0176] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A path resolution method, comprising: The first index information and the second index information are determined based on the user access path submitted to the directory tree in the file system; The first index information is specifically the index information corresponding to the full path of the parent directory in the user access path, and the second index information is specifically the index information corresponding to the full path of the grandparent directory in the user access path; The first index information is used to locate the target index item in the directory index table corresponding to the directory tree, and the third index information is read from the target index item; According to the first index information, the second index information and the third index information, a recursive operation is performed from the directory item in the directory tree to the root directory item. The recursive operation from the directory item in the directory tree to the root directory item specifically includes: directly determining the root directory item and parent directory item corresponding to the user access path in the directory tree according to the first index information, the second index information and the third index information. The directory tree is parsed based on the recursive operation result and the preset parsing strategy, and the access information corresponding to the user access path is determined in the file system based on the parsing result.

2. The method according to claim 1, wherein determining the first index information and the second index information based on the user access path submitted for the directory tree in the file system includes: Obtain the user access path submitted for the directory tree in the file system; Parse the user access path to obtain the full path of the first directory and the full path of the second directory; Load the first index information corresponding to the full path of the first directory, and the second index information corresponding to the full path of the second directory.

3. The method according to claim 2, wherein loading the first index information corresponding to the full path of the first directory and the second index information corresponding to the full path of the second directory includes: Calculate the first hash code corresponding to the full path of the first directory, the second hash code corresponding to the full path of the second directory, and calculate the first directory depth corresponding to the full path of the first directory; The first index information is generated based on the first hash code and the first directory depth, and the second index information is generated based on the second hash code.

4. The method according to claim 3, wherein locating the target index item in the directory index table corresponding to the directory tree using the first index information and reading the third index information from the target index item comprises: Extract the first hash code from the first index information; The first hash code is used to query the directory index table corresponding to the directory tree, and the target index item is located based on the query result. Extract the third hash code and the third directory depth from the target index item, and generate the third index information based on the third hash code and the third directory depth.

5. The method according to claim 1, wherein the recursive operation from the directory item in the directory tree to the root directory item according to the first index information, the second index information, and the third index information includes: If the first index information, the second index information, and the third index information satisfy the parsing conditions, the directory item is located in the directory tree according to the third index information; The root directory item is located in the directory tree based on the first directory depth in the first index information; Perform a recursive operation from the directory entry in the directory tree to the root directory entry.

6. The method according to claim 5, wherein locating the directory item in the directory tree based on the third index information when the first index information, the second index information, and the third index information satisfy the parsing conditions, comprises: The first hash code in the first index information is compared with the third hash code in the third index information, the first directory depth in the first index information is compared with the third directory depth in the third index information, and the first hash code in the first index information is compared with the second hash code in the second index information. If the comparison results are all the same, and it is determined that the first index information, the second index information, and the third index information satisfy the parsing conditions, then the step of locating the directory item in the directory tree based on the third index information is executed.

7. The method according to claim 5 or 6, wherein locating the directory item in the directory tree based on the third index information comprises: The third index information is parsed to obtain the directory item identifier, and the directory item is located in the directory tree according to the directory item identifier; Accordingly, after the step of locating the directory item in the directory tree based on the third index information is executed, the method further includes: The third index information is parsed to obtain the index item version number, and the directory item version number corresponding to the directory item is determined. If the version number of the index entry is the same as the version number of the directory entry, the step of locating the root directory entry in the directory tree according to the first directory depth in the first index information is performed.

8. The method according to claim 1, wherein parsing the directory tree based on the recursive operation result and a preset parsing strategy, and determining the access information corresponding to the user access path in the file system based on the parsing result, includes: The first directory entry node corresponding to the user access path in the directory tree is determined based on the result of the recursive operation, wherein the result of the recursive operation is the reverse recursive operation information from the directory entry to the root directory entry; In the first directory entry node, determine the first subdirectory entry node corresponding to the directory entry, and in the directory tree, determine the second directory entry node based on the first subdirectory entry node; The second directory item node is parsed according to the preset parsing strategy to obtain the second subdirectory item node; Based on the first directory entry node and the second subdirectory entry node, the access information corresponding to the user access path is determined in the file system.

9. The method according to claim 8, further comprising, before executing the step of determining the access information corresponding to the user access path in the file system based on the first directory entry node and the second subdirectory entry node: The name of the directory item to be accessed is determined based on the user access path, and the name of the directory item corresponding to the second subdirectory item node is also determined. If the second subdirectory entry node is a child node of the first subdirectory entry node, and the name of the directory entry to be accessed is the same as the name of the directory entry, then the step of determining the access information corresponding to the user access path in the file system based on the first directory entry node and the second subdirectory entry node is executed.

10. The method according to any one of claims 1-6, further comprising: A task execution chain is created for the user access path, wherein the task execution chain includes at least one task execution node, and the at least one task execution node is used to locate the target directory item node in the directory tree; By running the task execution chain, at least two target directory entry nodes are identified in the directory tree; Based on the at least two target directory entry nodes, the target access information corresponding to the user access path is determined in the file system.

11. The method according to claim 10, further comprising, after the step of determining the target access information corresponding to the user access path in the file system based on the at least two target directory entry nodes: Determine the directory entry node to be updated from the at least two target directory entry nodes; Determine the directory item to be updated corresponding to the directory item node to be updated, and load the index information to be updated corresponding to the directory item to be updated; Update the index information to be updated to the target index item.

12. A path resolution system, comprising: File storage nodes and path resolution nodes; The file storage node is used to store file information corresponding to the directory tree, and the path resolution node is used to execute path resolution executable instructions. When the path resolution executable instructions are executed by the path resolution node, the steps of the method according to any one of claims 1 to 11 are implemented.

13. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 11.

14. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Peer-to-Peer Redundant File Server System and Methods

    US20090271412A1

  • System and method for network file system server replication using reverse path lookup

    US20140122428A1