Network file system and request processing method based on network file system
By using the FUSE communication protocol in the network file system for information interaction, the problem of FUSE lacking network access capabilities and complex NFS implementation is solved, and the effect of convenient client use and simple server development is achieved.
Patent Information
- Application Number
- CN202010987281.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-18
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2040-09-18
AI Technical Summary
The existing NFS implementation is relatively complex, and FUSE lacks network access capabilities, which leads to inconvenience in client use and difficulty in server development.
A network file system is designed to use the FUSE communication protocol to interact information, and to realize information exchange between the client and the server through network FUSE request processing between the file system client and the server.
It realizes the effect of convenient client use and simple server development, and solves the problem of FUSE lacking network access capabilities and complex NFS implementation.
Smart Images

Figure CN113760852B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technologies, and particularly to a network file system and a request processing method based on the network file system. Background Art
[0002] The Network File System (NFS for short) is one of the current mainstream heterogeneous platform shared file systems, enabling users to access files on other parts of the network as if using their own computers. The NFS client (usually an application server, such as a web server) can mount the shared data directory of the NFS server to the local system of the NFS client (under a certain mount point) by means of mounting. That is to say, from the perspective of the NFS client, the directory shared by the NFS server is like its own disk partition or directory, but in fact it is the directory of the remote NFS server.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: The background file system corresponding to NFS needs to develop a complete File System Abstraction Layer (FSAL for short, that is, abstract the backend storage into a unified application programming interface with an independent namespace for the application layer to call) module to be implemented, and the implementation is relatively complex. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a network file system and a request processing method based on the network file system, which can achieve the beneficial effects of convenient use by the client and simple development of the file system server, and solve the problems that FUSE has no network access ability and the existing NFS implementation is relatively complex.
[0005] To achieve the above object, according to the first aspect of the embodiments of the present invention, a network file system is provided.
[0006] A network file system according to an embodiment of the present invention includes: a file system client and a file system server, and information interaction is performed between the file system client and the file system server based on the FUSE communication protocol; the file system client is used to convert a written file operation request into a network FUSE request, send the network FUSE request to the file system server, and then receive the request processing result returned by the file system server; the file system server is used to obtain the network FUSE request sent by the file system client, process the network FUSE request to obtain the request processing result, and then return the request processing result to the file system client.
[0007] Optionally, the file system client includes a virtual file system located in the kernel space, a FUSE request writing module, and a sending queue; the virtual file system is configured to receive the file operation request to be written and send the file operation request to the FUSE request writing module; the FUSE request writing module is configured to convert the file operation request sent by the virtual file system into the network FUSE request and place the network FUSE request in the sending queue; the sending queue is configured to send the network FUSE request to the file system server.
[0008] Optionally, the sending queue includes a first instruction queue and a first data buffer, and the network FUSE request includes an instruction request and a data request; the FUSE request writing module is further configured to place the instruction request in the first instruction queue and place the data request in the first data buffer.
[0009] Optionally, the file system server includes a second instruction queue and a second data buffer located in the kernel space; the first instruction queue is configured to send the instruction request to the second instruction queue; the first data buffer is configured to send the data request to the second data buffer; the second instruction queue is configured to receive the instruction request sent by the first instruction queue; the second data buffer is configured to receive the data request sent by the first data buffer.
[0010] Optionally, the file system server includes a communication medium and an acquisition request module located in the kernel space; the communication medium is docked with the second instruction queue and is configured to capture the instruction request in the second instruction queue; the acquisition request module is configured to acquire the instruction request captured by the communication medium and acquire the data request from the second data buffer.
[0011] Optionally, the file system server includes a user-space file system located in the user space; the user-space file system includes: a read request module, a request processing module, and a file writing module; the read request module is configured to acquire the network FUSE request in the user space of the file system server; the request processing module is configured to process the network FUSE request acquired by the read request module to obtain a request processing result; the file writing module is configured to write the request processing result into a storage medium.
[0012] To achieve the above object, according to the second aspect of the embodiments of the present invention, a request processing method based on a network file system is provided.
[0013] A request processing method based on a network file system according to an embodiment of the present invention is applied to a file system client. The method includes: receiving a to-be-processed file operation request written, converting the to-be-processed file operation request into a to-be-processed network FUSE request, and sending the to-be-processed network FUSE request to a file system server; after the file system server processes the to-be-processed network FUSE request, receiving a target request processing result returned by the file system server.
[0014] Optionally, the file system client includes a virtual file system located in the kernel space, a FUSE request writing module, and a sending queue; and, the receiving the to-be-processed file operation request written, converting the to-be-processed file operation request into a to-be-processed network FUSE request, and sending the to-be-processed network FUSE request to the file system server includes: the virtual file system receiving the to-be-processed file operation request written and sending the to-be-processed file operation request to the FUSE request writing module; the FUSE request writing module converting the to-be-processed file operation request sent by the virtual file system into the to-be-processed network FUSE request and putting the to-be-processed network FUSE request into the sending queue; the sending queue sending the to-be-processed network FUSE request to the file system server.
[0015] Optionally, the sending queue includes a first instruction queue and a first data buffer; and, before putting the to-be-processed network FUSE request into the sending queue, the method further includes: the FUSE request writing module determining whether the to-be-processed network FUSE request includes a to-be-processed instruction request; if the to-be-processed network FUSE request includes the to-be-processed instruction request, putting the to-be-processed instruction request into the first instruction queue; the FUSE request writing module determining whether the to-be-processed network FUSE request includes a to-be-processed data request; if the to-be-processed network FUSE request includes the to-be-processed data request, putting the to-be-processed data request into the first data buffer.
[0016] To achieve the above object, according to a third aspect of the embodiments of the present invention, a request processing method based on a network file system is provided.
[0017] A request processing method based on a network file system according to an embodiment of the present invention is applied to a file system server. The method includes: obtaining a to-be-processed FUSE request sent by a file system client in the kernel space of the file system server; processing the to-be-processed network FUSE request in the user space of the file system server to obtain a target request processing result; returning the target request processing result to the file system client.
[0018] Optionally, the file system server includes a communication medium and an acquisition request module located in the kernel space; and, acquiring the to-be-processed FUSE request sent by the file system client in the kernel space of the file system server includes: the communication medium captures the to-be-processed instruction request sent by the file system client, and sends the to-be-processed instruction request to the acquisition request module; the acquisition request module receives the to-be-processed instruction request, and determines whether the to-be-processed instruction request requires corresponding data; if so, the acquisition request module acquires the to-be-processed data request corresponding to the to-be-processed instruction request sent by the file system client, and determines the to-be-processed instruction request and the to-be-processed data request as the to-be-processed FUSE request; if not, the acquisition request module determines the to-be-processed instruction request as the to-be-processed FUSE request.
[0019] Optionally, the file system server includes a second instruction queue located in the kernel space; the second instruction queue stores the to-be-processed instruction request sent by the file system client; and, the second instruction queue is docked with the communication medium so that the communication medium can capture the to-be-processed instruction request.
[0020] Optionally, the file system server includes a second data buffer located in the kernel space; the second data buffer stores the to-be-processed data request sent by the file system client; and, the acquisition request module acquires the to-be-processed data request corresponding to the to-be-processed instruction request sent by the file system client, including: the acquisition request module acquires the to-be-processed data request from the second data buffer.
[0021] Optionally, the file system server includes a user-mode file system located in the user space, and the user-mode file system includes: a read request module, a request processing module, and a file writing module; and, processing the to-be-processed network FUSE request in the user space of the file system server to obtain a target request processing result includes: the read request module acquires the network FUSE request in the user space of the file system server, and sends the acquired network FUSE request to the request processing module; the request processing module processes the network FUSE request acquired by the read request module to obtain the request processing result; the file writing module writes the request processing result into a storage medium.
[0022] One embodiment of the above invention has the following advantages or beneficial effects: The network file system according to the embodiment of the present invention optimizes FUSE to obtain a file system client and a file system server, and uses the FUSE communication protocol as the protocol method between the file system client and the file system server, achieving the beneficial effects of convenient use for the client and simple development for the file system server, and solving the problems that FUSE has no network access ability and the existing NFS implementation is relatively complex. In addition, the FUSE request writing module can convert requests in the user state into requests in the kernel state, enabling the file system client and the file system server to interact information according to the FUSE communication protocol. Moreover, the first instruction queue can send instruction requests using a low-latency queue, thereby improving the sending speed, and the first data buffer can send data requests using a high-throughput queue, thereby increasing the sending bandwidth.
[0023] The further effects of the above non-conventional optional methods will be described in combination with specific embodiments below. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings are used to better understand the present invention and do not unduly limit the present invention. Among them:
[0025] Figure 1 is a schematic structural diagram of a network file system according to an embodiment of the present invention;
[0026] Figure 2 is a schematic diagram of the working principle of FUSE;
[0027] Figure 3 is a schematic diagram of the main steps of a request processing method based on a network file system according to an embodiment of the present invention;
[0028] Figure 4 is a schematic diagram of the main process of a request processing method based on a network file system according to an embodiment of the present invention;
[0029] Figure 5 is a schematic diagram of the main steps of a request processing method based on a network file system according to another embodiment of the present invention;
[0030] Figure 6 is a schematic diagram of the main process of a request processing method based on a network file system according to another embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0031] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, descriptions of well-known functions and structures are omitted in the following description for clarity and conciseness.
[0032] A file system is a method and data structure used by an operating system to organize files on a storage device or partition, that is, a method of organizing files on a storage device. A file system consists of three parts: the interface of the file system, a set of software for manipulating and managing objects, and objects and their attributes. From a system perspective, a file system is a system that organizes and allocates the space of a file storage device, is responsible for file storage, and protects and retrieves the stored files. Specifically, it is responsible for creating files for users, storing, reading, modifying, dumping files, controlling file access, and deleting files when users no longer use them. NFS is a network abstraction on top of the file system that allows remote clients to access files over the network in a manner similar to accessing local file systems, that is, it allows users to access files elsewhere on the network as if they were using their own computers. However, the corresponding background file system of NFS needs to develop a complete file system abstraction layer FSAL module to be implemented, and the implementation is relatively complex.
[0033] To solve the technical problem of the relatively complex implementation of NFS, an embodiment of the present invention provides a network file system, which is constructed based on the Filesystem in Userspace (FUSE for short). Among them, FUSE is a current mainstream open-source user-space file system implementation solution. It moves the implementation of the file system from the kernel space to the user space, and a file system can be implemented in the user space, solving the problem that the file system must be in the kernel space. Since FUSE can provide the functions of a local user-space file system but does not have the ability to access the network, an embodiment of the present invention provides a network file system that can optimize FUSE, solving the problem that FUSE does not have the ability to access the network and also solving the problem of the relatively complex implementation of the existing NFS.
[0034] Figure 1 is a schematic structural diagram of the network file system according to an embodiment of the present invention, as Figure 1As shown, the network file system may include: a file system client 10 and a file system server 20. The file system client 10 can be regarded as a local client, and the user accesses the files on the file system server 20 through the file system client 10. Information interaction between the file system client 10 and the file system server 20 is based on the FUSE communication protocol, that is to say, the network file system works according to the working principle of FUSE.
[0035] To better understand the network file system of the embodiments of the present invention, the working principle of FUSE will be described next. Figure 2 It is a schematic diagram of the working principle of FUSE. Figure 2 In [diagram], FUSE is mounted under the directory / tmp / fuse. When an application layer program wants to access the files under / tmp / fuse, system calls are made through functions in glibc (i.e., the runtime library, which is the lowest-level call interface in the operating system). The functions in the virtual file system that process these system calls will call the file system of FUSE in the kernel (i.e., Figure 2 the FUSE in [diagram]); the FUSE file system in the kernel sends the user's request to the user-space file system; after receiving the request, the user-space file system processes it and returns the result to the FUSE file system in the kernel; finally, the FUSE file system in the kernel returns the data to the user program.
[0036] The file system client 10 can be used to: convert the written file operation request into a network FUSE request, send the network FUSE request to the file system server 20, and then receive the request processing result returned by the file system server 20.
[0037] Among them, the file operation request is a file operation request input by the user through an application program. For example, when the user submits order data through a certain shopping platform and writes the order data to a certain database, the file operation request is the request to write the order data to a certain database. The file operation request is a user-space request, that is, a request obtained by the user in the user space of the file system client 10. The network file system provided by the embodiments of the present invention is from Figure 2It works based on the working principle of the FUSE shown. After receiving a user-space request, the FUSE converts the user-space request into a kernel-space request and then processes the kernel-space request through the user-space file system. Therefore, after the file system client 10 in the embodiment of the present invention obtains a file operation request, it first converts the file operation request into a network FUSE request. The FUSE request is a request in a specific format used in the FUSE communication protocol, that is, a file operation request in the kernel space. Since the network file system in the embodiment of the present invention can implement information interaction between the file system client and the file system server, the file operation request in the kernel space is named as the network FUSE request. After converting the file operation request into a network FUSE request, the file system client 10 can send the network FUSE request to the file system server 20, so that the file system server 20 can process the request and return the request processing result to the file system client 10.
[0038] The file system server 20 can be used to: obtain the network FUSE request sent by the file system client 10, process the network FUSE request to obtain the request processing result, and then return the request processing result to the file system client 10.
[0039] The network FUSE request is a file operation request in the kernel space. Therefore, the file system client 10 sends the converted network FUSE request from the kernel space of the file system client 10 to the kernel space of the file system server 20, that is, obtains the network FUSE request sent by the file system client 10 in the kernel space of the file system server 20. According to the working principle of FUSE, the request is processed in the user space. Therefore, after the file system server 20 obtains the network FUSE request, it converts the obtained request into a user-space request, then processes the request in the user space of the file system server 20, and finally returns the request processing result to the file system client 10.
[0040] From Figure 1 It can be seen that the file system client 10 may include: a virtual file system 101, a FUSE request writing module 102, and a sending queue 103, and the virtual file system 101, the FUSE request writing module 102, and the sending queue 103 are all located in the kernel space of the file system client 10.
[0041] Among them, the virtual file system 101 can be used to: receive the written file operation request and send the file operation request to the FUSE request writing module 102. The virtual file system (Virtual File Systems, abbreviated as VFS) is a distributed file system used in a network environment and is an interface that allows the operating system to use different file system implementations. The virtual file system is an interface layer between the physical file system and the service. It abstracts all the details of each file system of the operating system, so that different file systems appear the same to the operating system kernel and other processes running in the system. Strictly speaking, the virtual file system is not an actual file system. It only exists in memory and does not exist in any external storage space. In the embodiment of the present invention, the virtual file system 101 determines the file system to be called according to the file operation request (that is, FUSE has been mounted on the file system list of the virtual file system), and sends this request to the FUSE request writing module 102.
[0042] The FUSE request writing module 102 can be used to: convert the file operation request sent by the virtual file system 101 into a network FUSE request and put the network FUSE request into the sending queue 103. Among them, the FUSE request writing module 102 is equivalent to Figure 2 the FUSE in
[0043] the kernel, that is, the file system of FUSE in the kernel.
[0044] Such as Figure 1As shown in the figure, the transmission queue 103 may include: a first instruction queue 1031 and a first data buffer 1032. Considering that the network FUSE request may include: an instruction request and a data request. The instruction request may contain a file system operation code and a link management operation request, and the data request may be the data part of a specific write operation and read operation. Taking the write operation request as an example, the file name to be written and the size of the data to be written may be placed in the instruction request part, and the specific data to be written is placed in the data request part. Since the instruction request generally has a small amount of data and the data request generally has a large amount of data, a low-latency queue can be used to send the instruction request, thereby improving the sending speed, and a high-throughput queue can be used to send the data request, thereby increasing the sending bandwidth. Therefore, the FUSE request writing module 102 places the network FUSE request into the transmission queue 103. Specifically, the FUSE request writing module 102 places the instruction request into the first instruction queue 1031 and the data request into the first data buffer 1032.
[0045] In the network file system according to the embodiment of the present invention, the file system client 10 places the instruction request with a small amount of data into the first instruction queue 1031, so that the first instruction queue 1031 can send the instruction request to the file system server 20 in the manner of a low-latency queue; further, the file system client 10 places the data request with a large amount of data into the first data buffer 1032, so that the first data buffer 1032 can send the data request to the file system server 20 in the manner of a high-throughput queue.
[0046] The file system client 10 has a first instruction queue 1031 and a first data buffer 1032 for sending requests. Correspondingly, the file system server 20 may include a second instruction queue 201 and a second data buffer 202 for receiving requests. Both the second instruction queue 201 and the second data buffer 202 are located in the kernel space of the file system server 20. The second instruction queue 201 can be used to: receive the instruction request sent by the first instruction queue 1031, and the second data buffer 202 can be used to: receive the data request sent by the first data buffer 1032.
[0047] Figure 1 In the file system server 20 may further include a communication medium 203 and a request acquisition module 204 located in the kernel space.
[0048] The communication medium 203 interfaces with the second instruction queue 201 and can be used to: capture instruction requests in the second instruction queue 201. The communication medium 203 is equivalent to an inter-process communication device. Since instruction requests and data requests are in two different processes and cannot directly access each other's data, the communication medium 203 is needed to obtain the instruction requests. In the embodiment of the present invention, after the file system server 20 is started, it continuously reads the communication medium 203. Since the read interface of the communication medium 203 interfaces with the second instruction queue 201, when the first instruction queue 1031 of the file system client 10 sends an instruction request to the second instruction queue 201 of the file system server 20, it will be captured by the read interface of the communication medium 203.
[0049] After the communication medium 203 captures the instruction requests in the second instruction queue 201, it can send the captured instruction requests to the acquisition request module 204. The acquisition request module 204 can also obtain data requests from the second data buffer 202. It should be noted that after the acquisition request module 204 obtains instruction request A, it determines whether the instruction request A requires a corresponding data request B. If so, it obtains the data request B corresponding to the instruction request A from the second data buffer 202. For example, for a write operation request, if the data request is the data to be written, it needs to obtain the data to be written from the second data buffer 202. If not, it does not need to obtain a data request from the second data buffer 202. For example, for a read operation request, it does not need to obtain a data request from the second data buffer 202. Generally speaking, the acquisition request module 204 can receive the instruction requests sent by the communication medium 203 and obtain data requests from the second data buffer 202.
[0050] In addition, the file system server 20 may further include a user-mode file system 205 located in the user space. The user-mode file system 205 corresponds to the Figure 2 shown user-mode file system and may include: a read request module 2051, a processing request module 2052, and a file writing module 2053.
[0051] Specifically, the read request module 2051 can be used to: obtain a network FUSE request in the user space of the file system server 20. As described above, the obtain request module 204 can obtain all parts of the request. Since the obtain request module 204 is located in the kernel space of the file system server 20, that is, the obtain request module 204 obtains all parts of the request in the kernel space of the file system server 20. However, the request processing is operated in the user space of the file system server 20. Therefore, the read request module 2051 can be used to: read the network FUSE request in the user space of the file system server 20, and then send the read network FUSE request to the process request module 2052. Furthermore, the process request module 2052 can be used to process the network FUSE request obtained by the read request module 2051 to obtain a request processing result. Finally, the file writing module 2053 can be used to write the request processing result into the storage medium.
[0052] The above text details the process of a file operation request from the virtual file module 101 of the file system client 10 to the process request module 2052 of the file system server 20 by introducing the components of the network file system. After the process request module 2052 processes the request, the request processing result can be returned in the reverse direction. Specifically, it is shown in the following steps a1 to a5:
[0053] Step a1, after obtaining the request processing result, the process read request module 2051 can return the request processing result to the obtain request module 204;
[0054] Step a2, after obtaining the request processing result, the obtain request module 204 divides the request processing result into the processing result corresponding to the instruction request and the processing result corresponding to the data request, and then sends the processing result corresponding to the instruction request into the communication medium 203. In this way, the communication medium 203 can put the processing result corresponding to the instruction request into the second instruction queue 201. At the same time, the obtain request module 204 puts the processing result corresponding to the data request into the second data buffer 202;
[0055] Step a3, the second instruction queue 201 sends the processing result corresponding to the instruction request to the first instruction queue 1031, and the second data buffer 202 sends the processing result corresponding to the data request to the first data buffer 1032;
[0056] Step a4, the FUSE request writing module 102 can obtain the processing result corresponding to the instruction request from the first instruction queue 1031 and the processing result corresponding to the data request from the first data buffer 1032. That is to say, the FUSE request writing module 102 can obtain the processing result corresponding to the network FUSE request. Since the processing result at this time is the processing result in the kernel mode, the FUSE request writing module 102 needs to convert the processing result in the kernel mode into the processing result in the user mode, and then send the processing result in the user mode to the virtual file system 101;
[0057] Step a5, the virtual file system 101 can return the processing request in the user mode to the user.
[0058] In addition, Figure 1 The arrow direction shown is the process of the file operation request from the virtual file module 101 of the file system client 10 to the processing request module 2052 of the file system server 20, and the return process of the request processing result is not marked.
[0059] The network file system according to the embodiment of the present invention optimizes FUSE to obtain a file system client and a file system server, and uses the FUSE communication protocol as the protocol method between the file system client and the file system server, achieving the beneficial effects of convenient use of the client and simple development of the file system server, and solving the problems that FUSE has no network access ability and the existing NFS implementation is relatively complex. In addition, the FUSE request writing module can convert the request in the user mode into the request in the kernel mode, so that the file system client and the file system server can perform information interaction according to the FUSE communication protocol. Moreover, the first instruction queue can use a low-latency queue to send instruction requests, thereby improving the sending speed, and the first data buffer can use a high-throughput queue to send data requests, thereby increasing the sending bandwidth.
[0060] Figure 3 is a schematic diagram of the main steps of a request processing method based on a network file system according to an embodiment of the present invention. Figure 3 The request processing method shown is applied to the file system client 10. The main steps of the request processing method may include:
[0061] Step S301, the file system client 10 receives the to-be-processed file operation request written, converts the to-be-processed file operation request into a to-be-processed network FUSE request, and sends the to-be-processed network FUSE request to the file system server 20;
[0062] Step S302, after the file system server 20 processes the to-be-processed network FUSE request, the file system client 10 receives the target request processing result returned by the file system server 20.
[0063] Among them, the file operation request to be processed is a file operation request to be processed written by the user through the application program. After obtaining the file operation request to be processed, the file system client 10 can convert it into a network FUSE request to be processed, and then send the network FUSE request to be processed to the file system server 20.
[0064] From Figure 1 It is known that the file system client 10 may include: a virtual file system 101, a FUSE request writing module 102, and a sending queue 103. Therefore, as a reference embodiment of the present invention, for the file system client 10 in step S301 to receive the written file operation request to be processed, convert the file operation request to be processed into a network FUSE request to be processed, and send the network FUSE request to be processed to the file system server 20, it may include: the virtual file system 101 receives the written file operation request to be processed and distributes the file operation request to be processed to the FUSE request writing module 102; the FUSE request writing module 102 converts the file operation request to be processed distributed by the virtual file system 101 into a network FUSE request to be processed, and places the network FUSE request to be processed in the sending queue 103; the sending queue 103 sends the network FUSE request to be processed to the file system server 20.
[0065] Considering that the form of the request may include an instruction request and a data request. For different requests, different sending methods can be adopted. Therefore, the sending queue 103 may include: a first instruction queue 1031 for storing instruction requests and a first data buffer 1032 for storing data requests. Therefore, as a reference embodiment of the present invention, before placing the network FUSE request to be processed in the sending queue, the request processing method may further include: step b1, the FUSE request writing module 102 places the instruction request to be processed in the network FUSE request to be processed in the first instruction queue 1031; step b2, the FUSE request writing module 102 determines whether the network FUSE request to be processed includes a data request to be processed; step b3, if the network FUSE request to be processed includes a data request to be processed, the data request to be processed is placed in the first data buffer 1032.
[0066] Note that since the network FUSE request to be processed may not include a specific data part, for example, the read operation request does not include a data part, that is, the network FUSE request to be processed may not include a data request. Therefore, in step b2, it is necessary to determine whether the network FUSE request to be processed includes a data request to be processed. If the network FUSE request to be processed does not include a data request to be processed, there is no need to put the request into the first data buffer 1032. Also, after putting the instruction request to be processed into the first instruction queue 1031, the first instruction queue 1031 can send the instruction request to be processed to the second instruction queue 201 in the file system server 20; after putting the data request to be processed into the first data buffer 1032, the first data buffer 1032 can send the data request to be processed to the second data buffer 202 in the file system server 20.
[0067] Figure 4 is a schematic diagram of the main process of a request processing method based on a network file system according to an embodiment of the present invention. Figure 4 The request processing method shown is applied to the file system client 10, and its main process may include:
[0068] Step S401, the virtual file system 101 receives the file operation request to be processed written thereto, and sends the file operation request to be processed to the FUSE request writing module 102;
[0069] Step S402, the FUSE request writing module 102 converts the file operation request to be processed sent by the virtual file system 101 into a network FUSE request to be processed;
[0070] Step S403, the FUSE request writing module 102 puts the instruction request to be processed in the network FUSE request to be processed into the first instruction queue 1031;
[0071] Step S404, the first instruction queue 1031 sends the instruction request to be processed to the second instruction queue 201 in the file system server 20;
[0072] Step S405, the FUSE request writing module 102 determines whether the network FUSE request to be processed includes a data request to be processed. If so, step S406 is executed;
[0073] Step S406, the FUSE request writing module 102 puts the data request to be processed into the first data buffer 1032;
[0074] Step S407, the first data buffer 1032 sends the data request to be processed to the second data buffer 202 in the file system server 20.
[0075] Note thatFigure 4 The figure shows only a specific embodiment. The execution order of steps S403 and S405 can be adjusted according to actual situations. The purposes of steps S403 to S407 are as follows: The FUSE request writing module 102 places the to-be-processed instruction request in the to-be-processed network FUSE request into the first instruction queue 1031, so that the first instruction queue 1031 sends the to-be-processed instruction request to the second instruction queue 201; and the FUSE request writing module 102 places the to-be-processed data request in the to-be-processed network FUSE request into the first data buffer 1032, so that the first data buffer 1032 sends the to-be-processed data request to the second data buffer 202.
[0076] Figure 5 It is a schematic diagram of the main steps of a request processing method based on a network file system according to another embodiment of the present invention. Figure 5 The shown request processing method is applied to the file system server 20. The main steps of this request processing method may include:
[0077] Step S501, obtain the to-be-processed FUSE request sent by the file system client 10 in the kernel space of the file system server 20;
[0078] Step S502, process the to-be-processed network FUSE request in the user space of the file system server 20 to obtain a target request processing result;
[0079] Step S503, return the target request processing result to the file system client 10.
[0080] First, the file system server 20 obtains the to-be-processed FUSE request in the kernel state sent by the file system client 10, then processes the to-be-processed FUSE request in the user space of the file system server 20 to obtain a target request processing result, and finally returns the target request processing result to the file system client 10.
[0081] Figure 1In [the above scenario], the file system server 20 may include: a communication medium 203 and a fetch request module 204, and both the communication medium 203 and the fetch request module 204 are located in the kernel space of the file system server 20. As a reference embodiment of the present invention, step S501 of fetching the to-be-processed FUSE request sent by the file system client 10 in the kernel space of the file system server 20 may include: the communication medium 203 captures the to-be-processed instruction request sent by the file system client 10 and sends the to-be-processed instruction request to the fetch request module 204; the fetch request module 204 receives the to-be-processed instruction request and determines whether the to-be-processed instruction request requires corresponding data; if so, the fetch request module 204 fetches the to-be-processed data request corresponding to the to-be-processed instruction request sent by the file system client 10, and determines the to-be-processed instruction request and the to-be-processed data request as the to-be-processed FUSE request; if not, the fetch request module 204 determines the to-be-processed instruction request as the to-be-processed FUSE request.
[0082] Since the communication medium 203 is docked with the second instruction queue 201 of the file system server 20, when the first instruction queue 1031 of the file system client 10 sends the to-be-processed instruction request to the second instruction queue 201, it will be captured by the read interface of the communication medium 203, and then the captured to-be-processed instruction request is sent to the fetch request module 204. Considering that the to-be-processed network FUSE request may not include a specific data part, for example, the read operation request does not include a data part, that is, the to-be-processed network FUSE request may not include a data request. Therefore, after receiving the to-be-processed instruction request, the fetch request module 204 needs to determine whether the received to-be-processed instruction request requires corresponding data.
[0083] (1) If the received to-be-processed instruction request requires corresponding data, then the fetch request module 204 fetches the to-be-processed data request corresponding to the to-be-processed instruction request sent by the file system client 10. Figure 1 The shown file system server 20 includes a second data buffer 202 located in the kernel space, and the second data buffer 202 can receive the data request sent by the first data buffer 1032. Therefore, the fetch request module 204 can fetch the to-be-processed data request from the second data buffer 202. In this case, the to-be-processed network FUSE request is composed of the to-be-processed instruction request and the to-be-processed data request.
[0084] (2) If the received to-be-processed instruction request does not require corresponding data, then the to-be-processed instruction request fetched by the fetch request module 204 is the to-be-processed FUSE request.
[0085] Figure 1Among them, the file system server 20 further includes a user-mode file system 205 located in the user space. The user-mode file system 205 may include: a read request module 2051, a request processing module 2052, and a file writing module 2053. In a reference embodiment of the present invention, step S502 processes a to-be-processed network FUSE request in the user space of the file system server to obtain a target request processing result, which may include: the read request module 2051 obtains the network FUSE request in the user space of the file system server 20 and sends the obtained network FUSE request to the request processing module 2052; the request processing module 2052 processes the network FUSE request obtained by the read request module 2051 to obtain a request processing result; the file writing module 2053 writes the request processing result into the storage medium.
[0086] Figure 6 It is a schematic diagram of the main process of a request processing method based on a network file system according to another embodiment of the present invention. Figure 6 The request processing method shown is applied to the file system server 20, and its main process may include:
[0087] Step S601, the communication medium 203 captures a to-be-processed instruction request sent by the file system client 10 and sends the to-be-processed instruction request to the request obtaining module 204;
[0088] Step S602, the request obtaining module 204 receives the to-be-processed instruction request and determines whether the to-be-processed instruction request requires corresponding data. If so, step S603 is executed; if not, step S605 is executed;
[0089] Step S603, the request obtaining module 204 obtains a to-be-processed data request corresponding to the to-be-processed instruction request from the second data buffer 202;
[0090] Step S604, determine the to-be-processed instruction request and the to-be-processed data request as to-be-processed FUSE requests;
[0091] Step S605, the to-be-processed instruction request obtained by the request obtaining module 204 is a to-be-processed FUSE request;
[0092] Step S606, the read request module 2051 obtains the network FUSE request in the user space of the file system server 20 and sends the obtained network FUSE request to the request processing module 2052;
[0093] Step S607, the request processing module 2052 processes the network FUSE request obtained by the read request module 2051 to obtain a request processing result;
[0094] Step S608, the file writing module 2053 writes the request processing result into the storage medium;
[0095] Step S609, the request processing module 2052 returns the target request processing result to the file system client 10.
[0096] Among them, the process in which the request processing module 2052 in step S609 returns the target request processing result to the file system client 10 has been described in detail in steps a1 to a5 above, and will not be repeated here.
[0097] According to the request processing method based on a network file system in an embodiment of the present invention, using the FUSE communication protocol as the protocol method between the file system client and the file system server, beneficial effects of convenient use for the client and simple development for the file system server are achieved, and problems that FUSE has no network access capability and the existing NFS implementation is relatively complex are solved. In addition, the FUSE request writing module is used to convert requests in the user space into requests in the kernel space, so that the file system client and the file system server can perform information interaction according to the FUSE communication protocol. Moreover, the first instruction queue uses a low-latency queue to send instruction requests, thereby improving the sending speed, and the first data buffer uses a high-throughput queue to send data requests, thereby increasing the sending bandwidth.
[0098] The above specific embodiments do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A network file system, characterized in that, Comprising: A file system client and a file system server, where information interaction is carried out between the file system client and the file system server based on the FUSE communication protocol; The file system client is used to convert the written file operation request into a network FUSE request, send the network FUSE request to the file system server, and then receive the request processing result returned by the file system server; the network FUSE request includes an instruction request and a data request; the file system client includes a sending queue; the sending queue includes a first instruction queue and a first data buffer; the first instruction queue is used to send the instruction request to a second instruction queue; the first data buffer is used to send the data request to a second data buffer; The file system server is used to obtain the network FUSE request sent by the file system client, process the network FUSE request to obtain the request processing result, and then return the request processing result to the file system client; the file system server includes a second instruction queue and a second data buffer located in the kernel space.
2. The system according to claim 1, characterized in that, The file system client further includes a virtual file system and a FUSE request writing module located in the kernel space; The virtual file system is used to receive the written file operation request and send the file operation request to the FUSE request writing module; The FUSE request writing module is used to convert the file operation request sent by the virtual file system into the network FUSE request and put the network FUSE request into the sending queue; The sending queue is used to send the network FUSE request to the file system server.
3. The system according to claim 2, characterized in that, The FUSE request writing module is further used to put the instruction request into the first instruction queue and put the data request into the first data buffer.
4. The system according to claim 3, characterized in that, The second instruction queue is used to receive the instruction request sent by the first instruction queue; The second data buffer is used to receive the data request sent by the first data buffer.
5. The system according to claim 4, characterized in that, The file system server includes a communication medium and a request obtaining module located in the kernel space; The communication medium is docked with the second instruction queue and is used to capture the instruction request in the second instruction queue; The request obtaining module is used to obtain the instruction request captured by the communication medium and obtain the data request from the second data buffer.
6. The system according to claim 1, characterized in that, The file system server includes a user-mode file system located in the user space; The user-mode file system includes: a read request module, a request processing module, and a file writing module; The read request module is used to obtain the network FUSE request in the user space of the file system server; The request processing module is used to process the network FUSE request obtained by the read request module to obtain the request processing result; The file writing module is used to write the request processing result into a storage medium.
7. A request processing method based on a network file system, applied to a file system client, characterized in that, The method includes: Receive the received pending file operation request, convert the pending file operation request into a pending network FUSE request, and send the pending network FUSE request to the file system server; the pending FUSE request includes a pending instruction request and a pending data request; the file system client includes a send queue; the send queue includes a first instruction queue and a first data buffer; the first instruction queue is used to send the instruction request to the second instruction queue; the first data buffer is used to send the data request to the second data buffer; After the file system server processes the pending network FUSE request, receive the target request processing result returned by the file system server; the file system server includes a second instruction queue and a second data buffer located in the kernel space.
8. The method according to claim 7, characterized in that, The file system client further includes a virtual file system and a FUSE request writing module located in the kernel space; and, The receiving the received pending file operation request, converting the pending file operation request into a pending network FUSE request, and sending the pending network FUSE request to the file system server includes: The virtual file system receives the received pending file operation request and sends the pending file operation request to the FUSE request writing module. The FUSE request writing module converts the pending file operation request sent by the virtual file system into the pending network FUSE request and places the pending network FUSE request in the send queue.
9. The method according to claim 8, characterized in that, Before placing the pending network FUSE request in the send queue, the method further includes: The FUSE request writing module determines whether the pending network FUSE request includes a pending instruction request. If the pending network FUSE request includes the pending instruction request, place the pending instruction request in the first instruction queue. The FUSE request writing module determines whether the pending network FUSE request includes a pending data request. If the pending network FUSE request includes the pending data request, place the pending data request in the first data buffer.
10. A request processing method based on a network file system, applied to a file system server, characterized in that, The method includes: Obtain the pending FUSE request sent by the file system client in the kernel space of the file system server; the pending FUSE request includes a pending instruction request and a pending data request; the file system client includes a send queue; the send queue includes a first instruction queue and a first data buffer; the first instruction queue is used to send the instruction request to the second instruction queue; the first data buffer is used to send the data request to the second data buffer; Process the pending network FUSE request in the user space of the file system server to obtain a target request processing result; the file system server includes a second instruction queue and a second data buffer located in the kernel space. Return the target request processing result to the file system client.
11. The method according to claim 10, characterized in that, The file system server includes a communication medium and an acquisition request module located in the kernel space; and, Acquiring, in the kernel space of the file system server, a to-be-processed FUSE request sent by a file system client includes: The communication medium captures the to-be-processed instruction request sent by the file system client and sends the to-be-processed instruction request to the acquisition request module; The acquisition request module receives the to-be-processed instruction request and determines whether the to-be-processed instruction request requires corresponding data; If so, the acquisition request module acquires the to-be-processed data request corresponding to the to-be-processed instruction request sent by the file system client, and determines the to-be-processed instruction request and the to-be-processed data request as the to-be-processed FUSE request; If not, the acquisition request module determines the to-be-processed instruction request as the to-be-processed FUSE request.
12. The method according to claim 11, characterized in that, The second instruction queue stores the to-be-processed instruction request sent by the file system client; and, the second instruction queue is docked with the communication medium so that the communication medium can capture the to-be-processed instruction request.
13. The method according to claim 11, characterized in that, The second data buffer stores the to-be-processed data request sent by the file system client; and, The acquisition request module acquiring the to-be-processed data request corresponding to the to-be-processed instruction request sent by the file system client includes: The acquisition request module acquires the to-be-processed data request from the second data buffer.
14. The method according to claim 10, characterized in that, The file system server includes a user-mode file system located in the user space, and the user-mode file system includes: a read request module, a process request module, and a file write module; and, Processing, in the user space of the file system server, the to-be-processed network FUSE request to obtain a target request processing result includes: The read request module acquires the network FUSE request in the user space of the file system server and sends the acquired network FUSE request to the process request module; The process request module processes the network FUSE request acquired by the read request module to obtain the request processing result; The file write module writes the request processing result into a storage medium.