File creation request processing method and device and medium

By analyzing the request for batch file creation in the network file system and allocating the files to be created to each FSAL instance, the problem of load imbalance in the FSAL instance caused by the creation of a large number of files in the directory is solved, and a more efficient file creation processing is achieved.

CN119719047AActive Publication Date: 2025-03-28INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202412000312.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-03-28
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

In a network file system, creating a large number of files in a certain directory will cause unbalanced load of the file system abstraction layer (FSAL) instance, resulting in unbalanced performance problems.

Method used

When receiving a batch file creation request, parse the request, obtain the parent directory and the total number of files to be created, query the directory items of the parent directory from the cache, obtain the object handles of each FSAL instance, and allocate the files to be created to each FSAL instance based on the total number of files. Through these instances, file creation is completed based on the object handles.

Benefits of technology

It effectively alleviates the problem of unbalanced load of FSAL instances, and improves the processing efficiency and performance of file creation by balancing allocation of file creation tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719047A_ABST
    Figure CN119719047A_ABST
Patent Text Reader

Abstract

The invention discloses a file creation request processing method, a file creation request processing device and a medium, relates to the field of file servers, is used for processing batch file creation requests, and provides a file creation request processing method aiming at the problem of load imbalance caused by creating all files under a directory by using an FSAL instance in a traditional scheme. And judging whether all the FSAL instances have the Inode information corresponding to the parent directory in the density or not by querying the density corresponding to the parent directory aiming at the batch file creation in the cache. And if the FSAL instance exists, creating the file through the FSAL instance. And if the corresponding fsalobjhand does not exist, the active acquisition of the Inode information is realized by creating the corresponding fsalobjhand. Furthermore, according to the method, the creation of a large batch of files under the parent directory can be completed on all the FSAL instances in the NFS, so that the problem of load imbalance of the FSAL instances is effectively relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of file servers, and in particular to a method, device and medium for processing file creation requests. Background Art

[0002] NFS-Ganesha is a user-mode file server that supports the Network File System (NFS) protocol. Currently, when the Ganesha program is initialized, the File System Abstract Layer (FSAL) module needs to be specified. In order to improve the processing power of the program, multiple FSAL instances can be created when the Ganesha program is initialized, so that any FSAL instance can be used for business processing when processing business.

[0003] In the Network File System (NFS), NFS itself has a cache. After creating a directory or a file, NFS will create a new directory entry (dentry) and add it to the cache. Through the dentry, you can find the index node (Inode) information corresponding to the file or directory. Most operations that NFS calls to specify the FSAL instance require Inode information as an input parameter. For example, when creating a directory or file, the Inode information of the parent directory of the directory or file is required.

[0004] Therefore, under normal circumstances, when creating a new file in a directory, the inode information of the directory is required. The inode information will exist in a certain FSAL instance, which means that all files in the directory are created through this FSAL instance. When a large number of files need to be created in the directory, this FSAL instance must be used, which causes excessive load pressure on this FSAL instance. At the same time, the other FSAL instances are idle, resulting in uneven performance.

[0005] Therefore, technicians in this field are in urgent need of a file creation request processing method to solve the problem that creating a large number of files in a certain directory will cause FSAL instance load imbalance. Summary of the invention

[0006] The purpose of the present invention is to provide a method, device and medium for processing file creation requests, which are used to solve the problem that creating a large number of files in a certain directory will cause FSAL instance load imbalance.

[0007] In order to solve the above technical problems, the present invention provides a method for processing a file creation request, comprising:

[0008] When receiving a batch file creation request, parsing the batch file creation request to obtain a parent directory and a total number of files to be created;

[0009] Querying the directory entry corresponding to the parent directory from the cache, and obtaining the object handle corresponding to each file system abstraction layer instance from the directory entry; if there is a file system abstraction layer instance lacking the corresponding object handle, creating the object handle;

[0010] According to the total number of files, all the files to be created are allocated to each of the file system abstraction layer instances, and the allocated files to be created are created based on the object handles through each of the file system abstraction layer instances.

[0011] In a possible embodiment, allocating all the to-be-created files to each of the file system abstraction layer instances according to the total number of files includes:

[0012] According to the total number of files, all the files to be created are evenly distributed to each of the file system abstraction layer instances.

[0013] In a possible embodiment, allocating all the to-be-created files to each of the file system abstraction layer instances according to the total number of files, and completing the creation of the allocated to-be-created files based on the object handle through each of the file system abstraction layer instances includes:

[0014] Each of the file system abstraction layer instances completes the creation of all the files to be created by polling;

[0015] Each of the file system abstraction layer instances only creates one file to be created in one polling, and polls the next file system abstraction layer instance after the creation is completed.

[0016] In a possible embodiment, allocating all the to-be-created files to each of the file system abstraction layer instances according to the total number of files includes:

[0017] Query the number of real-time tasks on each file system abstraction layer instance through a function;

[0018] The files to be created are allocated according to the total number of files and the number of real-time tasks of each file system abstraction layer instance, with the number of tasks of each file system abstraction layer instance being equal after allocation as a target condition.

[0019] In a possible embodiment, allocating the files to be created according to the total number of files and the number of real-time tasks of each file system abstraction layer instance, with the number of tasks of each file system abstraction layer instance being equal after allocation as a target condition, includes:

[0020] Determine the maximum number of real-time tasks corresponding to each of the file system abstraction layer instances;

[0021] Performing a first allocation of the to-be-created files for each of the file system abstraction layer instances with the number of tasks of each of the file system abstraction layer instances after allocation being the maximum value as a target condition;

[0022] Based on the condition of even distribution, all the remaining files to be created are distributed to each of the file system abstraction layer instances.

[0023] In a possible embodiment, allocating all the files to be created to each of the file system abstraction layer instances according to the total number of files, and completing the creation of the allocated files to be created based on the object handle through each of the file system abstraction layer instances includes:

[0024] Query the number of real-time tasks on each file system abstraction layer instance through a function;

[0025] Determining the total number of tasks according to the total number of files and the number of real-time tasks of each file system abstraction layer instance;

[0026] Determine an instance task average value according to the total number of tasks and the total number of file system abstraction layer instances;

[0027] Each of the file system abstraction layer instances creates the file to be created by polling;

[0028] Each of the file system abstraction layer instances only creates one file to be created in one polling, and the process of one polling of each of the file system abstraction layer instances includes:

[0029] Determine whether the current corresponding number of real-time tasks is less than the average value of instance tasks;

[0030] If not, skip this polling and go to the next polling of the file system abstraction layer instance;

[0031] If so, the creation of the file to be created is executed, and the count value of the corresponding number of real-time tasks is increased by 1.

[0032] In a possible embodiment, the method further includes:

[0033] If the directory entry corresponding to the parent directory cannot be found in the cache, the directory entry is created through any of the file system abstraction layer instances, and the object handle of the file system abstraction layer instance is updated to the directory entry corresponding to the parent directory.

[0034] In order to solve the above technical problems, the present invention also provides a file creation request processing device, comprising:

[0035] A request parsing module, for parsing a batch file creation request when receiving the batch file creation request, so as to obtain a parent directory and a total number of files of the files to be created;

[0036] A handle acquisition module is used to query the directory entry corresponding to the parent directory from the cache, and obtain the object handle corresponding to each file system abstraction layer instance from the directory entry; if there is a file system abstraction layer instance that lacks the corresponding object handle, create the object handle;

[0037] The file creation module is used to allocate all the files to be created to each of the file system abstraction layer instances according to the total number of files, and complete the creation of the allocated files to be created based on the object handle through each of the file system abstraction layer instances.

[0038] In order to solve the above technical problems, the present invention also provides a file creation request processing device, comprising:

[0039] Memory for storing computer programs;

[0040] A processor is used to implement the steps of the file creation request processing method as described above when executing the computer program.

[0041] To solve the above technical problem, the present invention further provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the file creation request processing method as described above are implemented.

[0042] The present invention provides a method for processing file creation requests, which determines whether all FSAL instances have Inode information corresponding to the parent directory in the dentry by querying the dentry corresponding to the parent directory for the batch file creation. In the FSAL instance of NFS, the object handle (fsal_obj_handle) is used as the identifier of the object (such as a file or directory). The fsal_obj_handle allows the NFS server and the client to reference and operate a specific file system object through the handle. That is, by whether the dentry contains the fsal_obj_handle of the corresponding FSAL instance, it can be determined whether the parent directory has Inode information under the target FSAL instance. Further, if so, the file can be created through this FSAL instance. If not, the corresponding fsal_obj_handle is created to realize the active acquisition of Inode information. Furthermore, the method can complete the creation of large batches of files under the parent directory on all FSAL instances in NFS, thereby effectively alleviating the problem of unbalanced load of FSAL instances.

[0043] The file creation request processing device and non-volatile storage medium provided by the present invention correspond to the above method and have the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0045] Figure 1 A flowchart of a method for processing a file creation request provided by an embodiment of the present invention;

[0046] Figure 2 An overall flow chart of a method for processing a file creation request provided by an embodiment of the present invention;

[0047] Figure 3 A structural diagram of a file creation request processing device provided by an embodiment of the present invention;

[0048] Figure 4 A structural diagram of another file creation request processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] The core of the present invention is to provide a method, device and medium for processing a file creation request.

[0051] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0052] NFS-Ganesha is a user-mode file server that supports the Network File System (NFS) protocol. It provides a File System Abstraction Layer (FSAL) interface that is compatible with the Filesystem in Userspace (FUSE) for Unix (an operating system) and Unix-like operating systems. In this way, users can access their storage devices through the NFS client. The NFS-Ganesha service allows users to access data in user mode through FSAL without frequent interaction with the kernel, greatly reducing the response time for data reading.

[0053] When the Ganesha program is initialized, a FSAL instance needs to be specified. This instance provides a general interface to the upper layer, and after receiving a request, it will call a specific interface for processing. In order to improve the processing capability of the program, multiple FSAL instances can be created when the Ganesha program is initialized, so that any FSAL instance can be used for business processing when processing business.

[0054] In NFS, NFS itself has a cache. After creating a directory or a file, NFS will create a new directory entry (dentry) and add it to the cache. Through the dentry, you can find the index node (Inode) information corresponding to the file or directory. Most operations that NFS calls to specify FSAL instances require Inode information as an input parameter. For example, when creating a directory or file, the Inode information of the parent directory of the directory or file is required.

[0055] Therefore, under normal circumstances, when creating a new file in a directory, the inode information of the directory is required. The inode information will exist in a certain FSAL instance, which means that all files in the directory are created through this FSAL instance. When a large number of files need to be created in the directory, this FSAL instance must be used, which causes excessive load pressure on this FSAL instance. At the same time, the other FSAL instances are idle, resulting in uneven performance.

[0056] In view of this, the present invention provides a method for processing a file creation request, such as Figure 1 As shown, including:

[0057] S11: When a batch file creation request is received, the batch file creation request is parsed to obtain the parent directory of the files to be created and the total number of files.

[0058] S12: query the directory entry corresponding to the parent directory from the cache, and obtain the object handle corresponding to each file system abstraction layer instance from the directory entry; if there is a file system abstraction layer instance that lacks a corresponding object handle, create an object handle.

[0059] S13: Allocate all the files to be created to each file system abstraction layer instance according to the total number of files, and complete the creation of the allocated files to be created based on the object handle through each file system abstraction layer instance.

[0060] Regarding step S11, it should be first explained that the present invention is aimed at solving the problem of FSAL instance load imbalance caused by a large number of files being created in the same directory. Therefore, the batch file creation request in step S11 refers to a request to create files in the same directory in a certain number of levels (the number can be determined according to actual needs). This request should at least include the parent directory of the file to be created (i.e., where to create the file) and the total number of files (i.e., how many files to create).

[0061] After that, for step S12, the file creation process of this method starts. Step S12 first queries the dentry corresponding to the parent directory specified in the request from the system cache. From the above description, it can be seen that the dentry can find the Inode information corresponding to the file or directory. Specifically, there is an object handle (fsal_obj_handle) corresponding to the file or directory in the dentry. This object handle is an internal identifier used by the system to reference and access specific objects (such as files, directories, etc.). Therefore, after finding the dentry corresponding to the parent directory, the fsal_obj_handle corresponding to the parent directory can be found through this dentry, and then the Inode information corresponding to the parent directory can be found through the fsal_obj_handle, so as to create a file under the parent directory according to this Inode information. In addition, the creation of fsal_obj_handle can be implemented through the function tool create_handle() supported by the NFS system.

[0062] But it should be noted that when there are multiple FSAL instances in a single NFS, that is, for the same file or directory, different Inode information will be obtained through different FSAL instances. That is, the Inode information is only valid in the FSAL instance, and is invalid in other FSAL instances. Therefore, in step S12, the fsal_obj_handle corresponding to different FSAL instances is also different, indicating different Inode information. Since not all FSAL instances have the Inode information corresponding to the parent directory, in order to ensure that each in the NFS can participate in the subsequent file creation to average the load. In step S12, for the FSAL instance that does not have the fsal_obj_handle corresponding to the parent directory in the dentry, the command to create fsal_obj_handle is executed. The created fsal_obj_handle is added to the dentry to enable this FSAL instance to support the execution of the file creation task under the parent directory specified by the request.

[0063] Finally, for step S13. After step S12 is executed, all FSAL instances in NFS can have the Inode information corresponding to the parent directory specified in the request. Therefore, when the file creation officially starts in step S13, all FSAL instances in NFS can be used to batch create files under the parent directory. Based on this, in step S13, all the files to be created this time can be allocated to each FSAL instance according to a certain rule, and the file creation under the parent directory can be implemented by each FSAL instance, thereby balancing the FSAL instance load.

[0064] It should be noted that this embodiment does not limit how to allocate file creation tasks to each FSAL instance. In a possible implementation, the total number of files required to be created in this request may be evenly allocated, or different numbers of files may be allocated to different FSAL instances for creation according to other needs and their actual conditions, and this embodiment does not limit this.

[0065] However, it is not difficult to know from the above that the file creation process implemented by this method. Multiple file creation tasks that need to be executed under the same parent directory of NFS can be implemented by all FSAL instances in NFS. Compared with the traditional solution, because the Inode information of the same file or directory in different FSAL instances is different and cannot be universal, the solution of using only one FSAL instance to complete the creation of all files under this directory can fundamentally solve the problem of FSAL instance load imbalance. This method queries the dentry corresponding to the parent directory specified by the request from the NFS system cache, and then determines whether each FSAL instance has the fsal_obj_handle corresponding to the parent directory specified by the request. If it exists, it means that the FSAL instance has the Inode information corresponding to the parent directory specified by the request, and the file can be created under the parent directory specified by the request. If it does not exist, it is necessary to create fsal_obj_handle and add it to the dentry so that this FSAL instance can perform subsequent file creation under the parent directory, so as to provide a prerequisite for creating files under the same directory through all FSAL instances in the NFS system.

[0066] Further, it can be seen from the above embodiment that the present invention does not limit the allocation rule based on which all the files to be created in the batch file creation request are allocated to each FSAL instance in step S13. However, this embodiment provides a possible implementation scheme, and the above step S13: allocating all the files to be created to each file system abstraction layer instance according to the total number of files is specifically:

[0067] S13-A: According to the total number of files, all the files to be created are evenly distributed to each file system abstraction layer instance.

[0068] That is, in this embodiment, all the files to be created are evenly distributed to each FSAL instance for creation in an even distribution manner. This ensures that the number of files required to be created by each FSAL instance is the same (or differs by at most 1). This makes the load of each FSAL instance the same during this batch file creation request, bringing higher performance to the NFS system, and is also conducive to improving the efficiency of file creation request processing, reducing user waiting time, and improving user experience.

[0069] It should also be noted that, in actual applications, the total number of files to be created is uncertain, and the total number of FSAL instances included in the NFS system is also uncertain. Therefore, it may happen that the total number of files cannot be divided evenly by the total number of FSAL instances, that is, the files to be created cannot be evenly distributed to each FSAL instance. In this case, a difference of at most 1 between the number of files allocated to different FSAL instances can be allowed.

[0070] Further, based on the allocation rule of evenly distributing the files to be created provided in the above embodiment, this embodiment also provides a corresponding and specific implementation scheme of creating files by the FSAL instance, and the above step S13 is specifically as follows:

[0071] S13-A1: Each file system abstraction layer instance completes the creation of all files to be created by polling.

[0072] Each file system abstraction layer instance only creates one file to be created in one polling, and polls to the next file system abstraction layer instance after the creation is completed.

[0073] That is, in this embodiment, a scheme is provided for implementing the creation of files by each FSAL instance through polling. Among them, each FSAL instance can be sorted according to any rule to create files through polling, and each FSAL instance only creates one file in one polling process. Based on this method, polling is continued until all files are created.

[0074] For example, assume that this batch file creation request needs to create 100 files under directory A, and the NFS system contains 5 FSAL instances (FSAL-01~FSAL-05). Further, each FSAL instance performs polling to create files in a numbered order. The process of creating files based on the implementation scheme provided in this embodiment includes: the first file is created by FSAL-01, the second file is created by FSAL-02... the fifth file is created by FSAL-05, the sixth file is created by FSAL-06... until the 100th file is created by FSAL-05. It can be seen that the file creation scheme provided in this embodiment can ensure that all files are evenly distributed to each FSAL instance for creation (FSAL-01~FSAL-05 are responsible for the creation of 20 files), and eliminates unnecessary file allocation steps. Each FSAL instance can directly start the file creation work, thereby improving the efficiency of file creation.

[0075] In addition, the polling scheme for creating files provided in this embodiment is also applicable to the case where the total number of files to be created cannot be divided evenly by the FSAL instance. Take the above example as an example, but the number of files to be created is changed from 100 to 101, and the other parameters remain unchanged. Then: the first file is created by FSAL-01, the second file is created by FSAL-02... the 100th file is created by FSAL-05, and the 101st file is created by FSAL-01. It is not difficult to see that only FSAL-01 needs to create 21 files, while FSAL-02~FSAL-05 only need to create 20 files. The above condition that the difference between FSAL instances is allowed to be at most 1 when it cannot be divided evenly is met, and the load balancing effect can be guaranteed.

[0076] On the other hand, this embodiment also provides another possible file allocation solution. The above step S13: allocating all the files to be created to each file system abstraction layer instance according to the total number of files is specifically as follows:

[0077] S13-B: query the number of real-time tasks on each file system abstraction layer instance through a function. According to the total number of files and the number of real-time tasks of each file system abstraction layer instance, the allocation of each file to be created is performed with the goal condition that the number of tasks of each file system abstraction layer instance after allocation is equal.

[0078] The Get Objecter Requests function can be used to obtain the number of tasks on each library (lib) to achieve the acquisition of the FSAL instance load in the above steps.

[0079] The difference from S13-A provided in the above embodiment is that the load balancing implemented in this embodiment is not limited to the load brought by the batch file request, but extends the load balancing range to all the loads of the FSAL instance. That is, this embodiment also reasonably distributes the files to be created based on the real-time load of each FSAL instance, so as to ensure that all the loads on each FSAL instance can be balanced after the files are distributed. Compared with the previous embodiment, the load balancing implemented in this embodiment is more effective and closer to the load balancing required in actual applications, which can better guarantee the performance of each FSAL instance and reduce the impact of file creation on NFS performance.

[0080] For example, it is also assumed that this batch file creation request needs to create 100 files under directory A, and the NFS system contains 5 FSAL instances (FSAL-01~FSAL-05). However, unlike the above example, there are already 20 real-time tasks in FSAL-01, and the other FSAL instances have no real-time tasks. Based on the allocation rules provided in this embodiment, the number of tasks on each FSAL instance should be (100+20) / 5=24. Reflected on each FSAL instance, FSAL-01 is assigned to 4 file creation tasks, and FSAL-02~FSAL-05 are each assigned to 24 file creation tasks.

[0081] Furthermore, this embodiment provides a possible implementation scheme for how to allocate the files to be created in the previous embodiment. The above step S13-B specifically includes:

[0082] S13-B1: Determine the maximum number of real-time tasks corresponding to each file system abstraction layer instance.

[0083] S13-B2: Taking the maximum number of tasks of each file system abstraction layer instance after allocation as a target condition, perform the first allocation of files to be created for each file system abstraction layer instance.

[0084] S13-B3: Allocate all remaining files to be created to each file system abstraction layer instance under the condition of even distribution.

[0085] In this embodiment, the allocation process of the files to be created is divided into two allocations. The first allocation first allocates the files to be created according to the number of real-time tasks of each FSAL instance. Each file creation task is a real-time task of a FSAL instance. By taking the maximum value of the number of real-time tasks of each FSAL instance as the target, the file creation tasks are allocated to all embodiments except the FSAL instance with the maximum number of real-time tasks. The number of real-time tasks of all FSAL instances reaches this maximum value, and a preliminary load balance is achieved. Afterwards, since the first file allocation is usually not enough to allocate all the files to be created in the current request in actual application, a second file allocation is required. During the second file allocation, since the first file allocation is carried out so that the number of real-time tasks of all FSAL instances is the same, all of them are the maximum values ​​determined above. At this time, the load balance of the FSAL instance can be guaranteed by allocating the files to be created through the average allocation rule. The specific allocation method and process can refer to the above-mentioned average allocation embodiment, which will not be repeated in this embodiment.

[0086] For example, assume that this batch file creation request needs to create 100 files under directory A, and the NFS system contains 5 FSAL instances (FSAL-01~FSAL-05). However, unlike the above example, there are already 20 real-time tasks in FSAL-01, and the other FSAL instances have no real-time tasks. Based on the allocation rules provided in this embodiment, 20 file creation tasks are first allocated to FSAL-02~FSAL-05, and each FSAL instance of FSAL-01~FSAL-05 has 20 tasks. There are still 100-20*4=20 files left to be created. These 20 files are evenly distributed to each FSAL instance, that is, 4 file creation tasks are allocated to each FSAL-01~FSAL-05. Finally, the number of tasks on each FSAL instance is still 24. Reflected on each FSAL instance, FSAL-01 is assigned 4 file creation tasks, and FSAL-02 to FSAL-05 are each assigned 24 file creation tasks, which is consistent with the previous example.

[0087] In addition, the to-be-created file allocation scheme provided in the above embodiment can also be implemented by polling. Specifically, this embodiment provides a possible implementation scheme, and the above step S13 specifically includes:

[0088] S13-C1: Query the number of real-time tasks on each file system abstraction layer instance through the function.

[0089] S13-C2: Determine the total number of tasks according to the total number of files and the number of real-time tasks of each file system abstraction layer instance.

[0090] S13-C3: Determine an instance task average value based on the total number of tasks and the total number of file system abstraction layer instances.

[0091] S13-C4: Each file system abstraction layer instance creates the file to be created by polling.

[0092] In steps S13-C4, each file system abstraction layer instance only creates one file to be created in one polling, and the process of each file system abstraction layer instance in one polling includes:

[0093] S13-C41: Determine whether the current corresponding real-time task quantity is less than the instance task average value, if not, go to step S13-C42, if yes, go to step S13-C43.

[0094] S13-C42: Skip this polling and go to polling of the next file system abstraction layer instance.

[0095] S13-C43: Execute the creation of the file to be created, and increase the count value of the corresponding real-time task number by 1.

[0096] It is not difficult to understand that the file creation solution provided in this embodiment is also based on the idea of ​​S13-B provided in the above embodiment, that is, the purpose is to achieve the balance of all tasks of all FSAL instances including file creation, but it is another file allocation solution that is closer to real load balancing. In addition, this solution also has the advantage of the above embodiment of realizing file creation through polling, that is, there is no need to make file allocation in advance, and the load is evenly distributed during the file creation process of each FSAL instance.

[0097] For example, it is still assumed that this batch file creation request needs to create 100 files under directory A, and the NFS system contains 5 FSAL instances (FSAL-01~FSAL-05) and FSAL-01 already has 20 real-time tasks, and the other FSAL instances have no real-time tasks. Based on the allocation rule provided in this embodiment, it can be determined that the average value of instance tasks is (100+20) / 5=24. At this time, for the first file, the number of real-time tasks of FSAL-01 is 20, which is less than 24, so the first file is created by FSAL-01. Similarly, in the first round, FSAL-02~FSAL-05 also create a file once. Then, in the second round of polling, for the sixth file, the number of real-time tasks of FSAL-01 is 20+1=21, which is still less than 24, so the sixth file can also be created by FSAL-01. Based on the same principle, continuous polling is performed, and in the first four rounds of polling, FSAL-01 can participate in file creation. Until the fifth round, for the 21st file, the number of real-time tasks of FSAL-01 is 24, which is equal to the average value of the implemented tasks. Therefore, FSAL-01 skips the creation of the 21st file and polls FSAL-02 to determine whether the 21st file can be created until all files are created. Based on this file creation method, FSAL-01 finally creates 4 files, namely the 1st, 6th, 11th and 16th files. The remaining files are created by FSAL-02~ FSAL-05 on average. FSAL-02~ FSAL-05 each creates 24 files, which is consistent with the results of the previous example.

[0098] In addition, this embodiment also provides a possible implementation scheme. After obtaining the number of real-time tasks on each FSAL instance, the method further includes:

[0099] If the number of real-time tasks of the existing FSAL instance is greater than the preset threshold, this FSAL instance will not participate in this file creation task.

[0100] For example, assume that this batch file creation request needs to create 100 files under directory A, and the NFS system contains 5 FSAL instances (FSAL-01 to FSAL-05). In addition, 100 real-time tasks already exist in FSAL-01, which exceeds the preset threshold (such as 80), and the other FSAL instances have no real-time tasks. In this file creation, FSAL-01 does not participate in this file creation, and the remaining 4 FSAL instances FSAL-02 to FSAL-05 will evenly distribute the files to be created.

[0101] The solution provided in this embodiment is to pre-emptively exclude FSAL instances with excessive loads, thereby avoiding redundant operations caused by repeated polling of this FSAL instance and failure to create files through this FSAL instance in implementation methods such as file creation in polling mode, thereby further improving the efficiency of file polling creation.

[0102] On the other hand, the above embodiment explains that when the fsal_obj_handle corresponding to the FSAL instance does not exist, it needs to be created and provides a specific creation method. Then, further, for what to do if the dentry corresponding to the parent directory specified in the request is not found in the NFS system cache, this embodiment also provides a possible implementation scheme, and this method also includes:

[0103] S14: If the directory entry corresponding to the parent directory cannot be found in the cache, a directory entry is created through any file system abstraction layer instance, and the object handle of the file system abstraction layer instance is updated to the directory entry corresponding to the parent directory.

[0104] That is, when querying the dentry of the specified parent directory from the cache in step S12, if it exists, it is used directly; if it does not exist, a dentry is created through any FSAL instance (assuming that there are instances FSAL-01~FSAL-05, and it is created through FSAL-01 here), and the fsal_obj_handle corresponding to the FSAL instance (FSAL-01) is updated to the created dentry to complete the creation of the dentry. And since the created dentry did not exist originally, it was created through one of the FSAL instances (FSAL-01), so the dentry must only contain the fsal_obj_handle of the created FSAL instance (FSAL-01), and does not contain the fsal_obj_handle of other FSAL instances (FSAL-02~FSAL-05). At this time, for step S12, the situation that there is a FSAL instance lacking the corresponding fsal_obj_handle is met, and the corresponding fsal_obj_handle needs to be created. That is, at most fsal_obj_handle creation is performed through the same number of FSAL instances. Even if there is no corresponding dentry in the cache at the beginning, all FSAL instances can participate in the batch creation of files, further expanding the scope of application of this solution.

[0105] In addition to the embodiment of a method for processing a file creation request provided in the above embodiment, the present invention also provides an embodiment corresponding to a computer program product. A computer program product includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the method for processing a file creation request described in any of the above embodiments can be implemented.

[0106] Since the embodiments of the computer program product part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the computer program product part, which will not be repeated here.

[0107] Based on the above embodiments, the overall process of a file creation request processing method provided by the present invention can be as follows: Figure 2As shown in the figure: After receiving the batch file creation request, the number of files and the parent directory are parsed first. Then the dentry corresponding to the parent directory is queried from the cache. If it exists, it is used directly. If it does not exist, it is created through any FSAL instance, and the fsal_obj_handle corresponding to the FSAL instance is updated to this dentry. When it comes to actual file creation, the number of real-time tasks on all FSAL instances is first queried through the function. If the load on each FSAL instance is currently balanced, all FSAL instances are directly polled to achieve average file creation. If it is not balanced, the first file allocation is first performed to balance the load, and then all FSAL instances are polled to achieve average file creation for the remaining files to be created. In addition, during the file creation process, since file creation requires the Inode information of the parent directory, when the polled FSAL instance does not have the corresponding fsal_obj_handle in the dentry of the parent directory, it is created through create_handle() and updated to the entry. In this way, you only need to create the fsal_obj_handle corresponding to all FSAL instances a maximum of the number of times equal to the total number of FSAL instances, and then all polling creations can be successfully completed.

[0108] In the above embodiment, a method for processing a file creation request is described in detail, and the present invention also provides an embodiment of a file creation request processing device. It should be noted that the present invention describes the embodiment of the device part from two perspectives, one is based on the perspective of functional modules, and the other is based on the perspective of hardware.

[0109] Based on the perspective of functional modules, such as Figure 3 As shown, this embodiment provides a file creation request processing device, including:

[0110] A request parsing module 11 is used for parsing a batch file creation request when receiving the batch file creation request to obtain a parent directory and a total number of files to be created;

[0111] A handle acquisition module 12 is used to query the directory entry corresponding to the parent directory from the cache, and obtain the object handle corresponding to each file system abstraction layer instance from the directory entry; if there is a file system abstraction layer instance that lacks the corresponding object handle, create the object handle;

[0112] The file creation module 13 is used to allocate all the files to be created to each of the file system abstraction layer instances according to the total number of files, and complete the creation of the allocated files to be created based on the object handle through each of the file system abstraction layer instances.

[0113] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0114] Figure 4 A structural diagram of a file creation request processing device provided by another embodiment of the present invention, such as Figure 4 As shown, a file creation request processing device includes: a memory 20, for storing a computer program;

[0115] The processor 21 is used to implement the steps of a method for processing a file creation request in the above embodiment when executing a computer program.

[0116] The file creation request processing device provided in this embodiment may include but is not limited to a mobile terminal, a personal computer, a workstation, etc.

[0117] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0118] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of a file creation request processing method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, a file creation request processing method, etc.

[0119] In some embodiments, a file creation request processing device may also include a display screen 22 , an input and output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .

[0120] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on a file creation request processing device, and may include more or less components than those shown in the figure.

[0121] An embodiment of the present invention provides a file creation request processing device, which includes a memory and a processor. When the processor executes a program stored in the memory, it can implement the following method: a file creation request processing method.

[0122] Finally, the present invention also provides an embodiment corresponding to a non-volatile storage medium. The non-volatile storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.

[0123] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.

[0124] The above is a detailed introduction to a file creation request processing method, device and medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.

[0125] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A method for processing a file creation request, characterized in that: include: When receiving a batch file creation request, parsing the batch file creation request to obtain a parent directory and a total number of files to be created; Querying the directory entry corresponding to the parent directory from the cache, and obtaining the object handle corresponding to each file system abstraction layer instance from the directory entry; if there is a file system abstraction layer instance lacking the corresponding object handle, creating the object handle; According to the total number of files, all the files to be created are allocated to each of the file system abstraction layer instances, and the allocated files to be created are created based on the object handles through each of the file system abstraction layer instances.

2. The file creation request processing method according to claim 1, characterized in that: According to the total number of files, allocating all the files to be created to each of the file system abstraction layer instances includes: According to the total number of files, all the files to be created are evenly distributed to each of the file system abstraction layer instances.

3. The file creation request processing method according to claim 2, characterized in that: According to the total number of files, allocating all the files to be created to each of the file system abstraction layer instances, and completing the creation of the allocated files to be created based on the object handle through each of the file system abstraction layer instances includes: Each of the file system abstraction layer instances completes the creation of all the files to be created by polling; Each of the file system abstraction layer instances only creates one file to be created in one polling, and polls the next file system abstraction layer instance after the creation is completed.

4. The method for processing a file creation request according to claim 1, wherein: According to the total number of files, allocating all the files to be created to each of the file system abstraction layer instances includes: Query the number of real-time tasks on each file system abstraction layer instance through a function; The files to be created are allocated according to the total number of files and the number of real-time tasks of each file system abstraction layer instance, with the number of tasks of each file system abstraction layer instance being equal after allocation as a target condition.

5. The method for processing a file creation request according to claim 4, characterized in that: According to the total number of files and the number of real-time tasks of each file system abstraction layer instance, with the number of tasks of each file system abstraction layer instance being equal after allocation as a target condition, allocating each of the to-be-created files includes: Determine the maximum number of real-time tasks corresponding to each of the file system abstraction layer instances; Performing a first allocation of the to-be-created files for each of the file system abstraction layer instances with the number of tasks of each of the file system abstraction layer instances after allocation being the maximum value as a target condition; Based on the condition of even distribution, all the remaining files to be created are distributed to each of the file system abstraction layer instances.

6. The method for processing a file creation request according to claim 1, wherein: According to the total number of files, allocating all the files to be created to each of the file system abstraction layer instances, and completing the creation of the allocated files to be created based on the object handle through each of the file system abstraction layer instances includes: Query the number of real-time tasks on each file system abstraction layer instance through a function; Determining the total number of tasks according to the total number of files and the number of real-time tasks of each file system abstraction layer instance; Determine an instance task average value according to the total number of tasks and the total number of file system abstraction layer instances; Each of the file system abstraction layer instances creates the file to be created by polling; Each of the file system abstraction layer instances only creates one file to be created in one polling, and the process of one polling of each of the file system abstraction layer instances includes: Determine whether the current corresponding number of real-time tasks is less than the average value of the instance tasks; If not, skip this polling and go to the next polling of the file system abstraction layer instance; If so, the creation of the file to be created is executed, and the count value of the corresponding number of real-time tasks is increased by 1.

7. The method for processing a file creation request according to any one of claims 1 to 6, characterized in that: The method further comprises: If the directory entry corresponding to the parent directory cannot be found in the cache, the directory entry is created through any of the file system abstraction layer instances, and the object handle of the file system abstraction layer instance is updated to the directory entry corresponding to the parent directory.

8. A file creation request processing device, characterized in that: include: A request parsing module, for parsing a batch file creation request when receiving the batch file creation request, so as to obtain a parent directory and a total number of files of the files to be created; A handle acquisition module is used to query the directory entry corresponding to the parent directory from the cache, and obtain the object handle corresponding to each file system abstraction layer instance from the directory entry; if there is a file system abstraction layer instance that lacks the corresponding object handle, create the object handle; The file creation module is used to allocate all the files to be created to each of the file system abstraction layer instances according to the total number of files, and complete the creation of the allocated files to be created based on the object handle through each of the file system abstraction layer instances.

9. A file creation request processing device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the file creation request processing method as described in any one of claims 1 to 7 when executing the computer program.

10. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the file creation request processing method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Management method and device for file system directory entry

    CN104516974A

  • System and method for asynchronous and batched file creation in file system

    CN105740334A

  • A librados-based distributed NFS system and a construction method thereof

    CN109783438A

  • Method and device for mapping file sentence

    CN1472660A

  • Directory with an associated query

    US20060161536A1