File operation method of user space file system and user space file system

By instrumenting user-space operation functions in the kernel and establishing a shared data region, the high performance overhead of the FUSE file system is solved, enabling more efficient file operations that are suitable for high-throughput applications.

CN114860670BActive Publication Date: 2026-01-13GUANGDONG TONGXIN SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210601732.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-25
Publication Date
2026-01-13
Estimated Expiration
2042-03-25

AI Technical Summary

Technical Problem

The FUSE file system suffers from high performance overhead and latency due to frequent communication between user space and kernel space, thus affecting overall performance.

Method used

By instrumenting user-space operation functions in the kernel and using eBPF technology to establish a shared data region, file operations can be performed directly in the kernel, reducing the switching and data interaction between user space and the kernel.

Benefits of technology

It effectively reduces system overhead, saves response time, and improves the performance of the user space file system, making it suitable for high-throughput application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114860670B_ABST
    Figure CN114860670B_ABST
Patent Text Reader

Abstract

The application discloses a file operation method of a user space file system and the user space file system, and the method comprises the following steps: a virtual file system receives a file operation request for a target file in the user space file system sent by an application program, and sends the file operation request to a target drive module corresponding to the user space file system; the target drive module starts an extended filter, so as to call a plug-in function corresponding to the file operation request to perform corresponding file operation on an underlying file system, and update shared data areas in a kernel according to an operation result; and a user space daemon obtains a data update result from the shared data areas, and sends the data update result to the application program. According to the technical scheme of the application, the data interaction frequency between the user space and the kernel can be effectively reduced, and the system overhead is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of invention patent application 2022102981285, filed on March 25, 2022. Technical Field

[0002] This invention relates to the field of file system technology, and in particular to a file operation method for a user-space file system, a user-space file system, and a computing device. Background Technology

[0003] FUSE (Filesystem in Userspace) is a file system framework implemented in user space, which includes the FUSE kernel module, the user-space library Libfuse, and user program modules. Based on the support of the FUSE kernel module, developers only need to implement specific file operations according to the interfaces provided by FUSE to implement a file system.

[0004] Because the main implementation code of FUSE resides in user space, it does not require recompiling the kernel, thus offering numerous conveniences to developers. However, FUSE incurs significant performance overhead. The same file operations (such as file search, open, read, and write operations) have far less overhead and latency on the local system than the FUSE file system, due to the inherent mechanism of FUSE itself.

[0005] In existing FUSE file system implementations, the kernel primarily acts as an intermediary, receiving the user's operation type, filename, and device number, and then sending these parameters to FuseDaemon for execution. Because FUSE file system often causes unnecessary communication between user space and kernel space, it results in low throughput and high latency, impacting overall performance. The root cause of this problem is that FUSE leaves operational freedom to user space, while the kernel space is completely unaware of the file operations (open, read, write, etc.) implemented by FuseDaemon. Therefore, each time a request is loaded into user space, it needs to be relayed through the kernel before being provided to user space for execution. This swapping process incurs significant system overhead; the same file operations take longer to run on FUSE than on the local file system.

[0006] Therefore, a file operation method for a user-space file system is needed to solve the problems existing in the above solutions. Summary of the Invention

[0007] Therefore, the present invention provides a file operation method for a user-space file system and a user-space file system to solve or at least alleviate the problems mentioned above.

[0008] According to one aspect of the present invention, a file operation method for a user-space file system is provided, executed in a computing device. The operating system of the computing device includes a kernel and a user space arranged on top of the kernel. The user space runs an application and a user space daemon. The kernel contains a virtual file system and a target driver module corresponding to the user-space file system. The method includes the steps of: the virtual file system receiving a file operation request for a target file in the user-space file system sent by the application, and sending the file operation request to the target driver module; the target driver module enabling an extended filter to call an instrumentation function corresponding to the file operation request to perform corresponding file operations on the underlying file system, and updating data in a shared data area in the kernel according to the operation result; and the user space daemon obtaining the data update result from the shared data area and sending the data update result to the application.

[0009] Optionally, in the file operation method of the user-space file system according to the present invention, before calling the instrumentation function corresponding to the file operation request, the method includes the steps of: implementing the corresponding file operation function structure through the user-space daemon process, and parsing the file operation function structure to obtain one or more corresponding instrumentation functions; and performing instrumentation in the kernel based on the instrumentation functions, wherein each instrumentation function corresponds to a file operation.

[0010] Optionally, in the file operation method of the user-space file system according to the present invention, after parsing the file operation function structure to obtain one or more corresponding instrumentation functions, the method further includes the steps of: assigning a function number to each instrumentation function; establishing a mapping relationship between the instrumentation function and the function number in the kernel, and generating a function mapping table.

[0011] Optionally, in the file operation method of the user space file system according to the present invention, the shared data area is bound to the user space daemon.

[0012] Optionally, in the file operation method of the user space file system according to the present invention, after enabling the extended filter through the target driver module, the method further includes the step of: creating a shared data region in the kernel and binding the shared data region to the user space daemon via the user space library.

[0013] Optionally, in the file operation method of the user space file system according to the present invention, the shared data area uses a Map data structure to establish and store the mapping relationship between the file descriptor and file attribute information of each file.

[0014] Optionally, in the file operation method of the user space file system according to the present invention, the step of the user space daemon obtaining data update results from the shared data area includes: the user space daemon polling the shared data area to detect whether the data in the shared data area has been updated; if so, obtaining the data update results from the shared data area.

[0015] Optionally, in the file operation method of the user space file system according to the present invention, after calling the instrumentation function corresponding to the file operation request to perform the corresponding file operation on the underlying file system, the method further includes the step of sending an operation completion signal to the application via the virtual file system.

[0016] Optionally, in the file operation method of the user space file system according to the present invention, the file operation includes one or more of the following: file open operation, file read operation, file write operation, and file delete operation.

[0017] Optionally, in the file operation method of the user-space file system according to the present invention, parsing the file operation function structure to obtain one or more corresponding instrumentation functions includes: calling the fuse_main_real function in the user-space library to parse the file operation function structure to obtain one or more corresponding instrumentation functions.

[0018] Optionally, in the file operation method of the user-space file system according to the present invention, the extended filter is eBPF.

[0019] According to one aspect of the present invention, a user-space file system is provided, comprising: a computing device deployed in a computing device, the operating system of the computing device including a kernel and a user space arranged on top of the kernel, the user-space file system including: an application running in user space and a user-space daemon; a shared data region arranged in the kernel; a virtual file system arranged in the kernel, adapted to receive a file operation request for a target file sent by the application and send the file operation request to a target driver module in the kernel; a target driver module arranged in the kernel, adapted to enable an extended filter to call an instrumentation function corresponding to the file operation request to perform corresponding file operations on the underlying file system, and update the data in the shared data region in the kernel according to the operation result; wherein, the user-space daemon is adapted to obtain the data update result from the shared data region and send the data update result to the application.

[0020] According to one aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions including instructions for performing file operation methods of a user-space file system as described above.

[0021] According to one aspect of the present invention, a readable storage medium storing program instructions is provided, which, when read and executed by a computing device, causes the computing device to perform the file operation method of the user-space file system as described above.

[0022] According to the technical solution of the present invention, a file operation method for a user-space file system is provided. This method utilizes eBPF technology to instrument user-space operation functions into the kernel, and establishes a shared data region in the kernel for data sharing with user space. This allows user-space operation functions to be run directly in the kernel and data to be shared with user space via the shared data region. Thus, when user space requests a file operation, the file operation is directly delegated to the kernel, and the corresponding instrumented function is called for execution. The data in the shared data region is updated based on the operation result, and user space only needs to poll the shared data region to obtain the updated data. Therefore, according to the technical solution of the present invention, when performing file operations in the user-space file system, the frequency of frequent switching operations and data interaction between user space and the kernel can be effectively reduced, which helps to reduce system overhead and save response time when performing file operations in the user-space file system. Furthermore, it is suitable for some high-throughput application scenarios and can effectively improve the performance of the user-space file system.

[0023] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0024] To achieve the foregoing and related objectives, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings. These aspects indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The foregoing and other objectives, features, and advantages of this disclosure will become more apparent from the following detailed description, taken in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.

[0025] Figure 1 A schematic diagram of a user space file system 100 according to an embodiment of the present invention is shown;

[0026] Figure 2 A schematic diagram of a computing device 200 according to an embodiment of the present invention is shown;

[0027] Figure 3 A flowchart of a file operation method 300 for a user-space file system according to an embodiment of the present invention is shown. Detailed Implementation

[0028] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0029] Figure 1 A schematic diagram of a user space file system 100 according to an embodiment of the present invention is shown.

[0030] like Figure 1 As shown, a user-space file system 100 is deployed in a computing device 200. The computing device 200 runs an operating system. The operating system of the computing device 200 includes a kernel 120 and a user space 110 located on top of the kernel. The user space 110 runs applications 111 (i.e., user programs) and a user space daemon 112 (FuseDaemon). The user space also contains a user space library 115 (Libfuse).

[0031] The kernel 120 contains a virtual file system 121 and one or more driver modules, wherein the one or more driver modules include a target driver module 122 corresponding to the user-space file system. Here, the target driver module 122 corresponding to the user-space file system is the Fuse Driver, and the virtual file system is the VFS (Virtual Filesystem).

[0032] Kernel 120 also runs an extended filter 123. Based on this extended filter, instrumentation can be performed in the kernel to run user-space specified operation functions, extending kernel functionality. In one implementation, the extended filter 123 can be implemented as an eBPF (Extended Berkeley Packet Filter). In one embodiment of the invention, when application 111 requests to perform file operations on a target file in the user-space file system, the virtual file system 121 in the kernel receives the file operation request from the application, locates the target driver module 122 in the kernel corresponding to the user-space file system, and sends the file operation request to the target driver module 122 for processing. The extended filter 123 can be enabled through the target driver module 122.

[0033] According to one embodiment of the present invention, the kernel 120 includes a shared data region 125 for data sharing with user space 110. The shared data region 125 uses a Map data structure to store the mapping relationship between file descriptors and file attribute information of each file in the user space file system. The shared data region 125 in the kernel is bound to the user space daemon 112 so that only the user space daemon 112 is allowed to access the shared data region 125, preventing other user processes in user space from accessing it.

[0034] Specifically, after enabling the extended filter, the target driver module 122 can create a shared data region 125 in the kernel. Furthermore, it binds the shared data region 125 to the user space daemon 112 via the user space library 115, so that only the user space daemon 112 is allowed to access the data in the shared data region 125.

[0035] Furthermore, after enabling the extended filter 123, the target driver module 122 can run one or more instrumentation functions implemented in user space within the kernel 120 based on the extended filter 123, where each instrumentation function corresponds to a function number. Specifically, as follows... Figure 1 As shown, a mapping relationship between instrumentation functions and function numbers can be established in kernel 120 to generate a function mapping table.

[0036] In one implementation, the user-space daemon 112 can implement the corresponding file operation function structure `fuse_operations`, and parse the file operation function structure to obtain one or more corresponding instrumentation functions. Then, instrumentation can be performed in the kernel based on these instrumentation functions so that they can run within the kernel. Here, the instrumentation functions are used to perform file operations on the underlying file system 130 corresponding to the user-space file system within the kernel. Each instrumentation function corresponds to one type of file operation.

[0037] Thus, after enabling the extended filter 123 through the target driver module 122, the instrumentation function corresponding to the file operation request sent by the user-space application 111 can be called to perform corresponding file operations on the underlying file system 130, obtain the operation result returned by the instrumentation function, and update the data in the shared data area 125 in the kernel according to the operation result. Here, the corresponding instrumentation function can be called to perform operations such as creating, reading, updating, or deleting data stored in the shared data area 125.

[0038] User space daemon 112 can obtain data update results from shared data area 125 and send the data update results to user space application 111. In one embodiment, user space daemon 112 polls shared data area 125 to detect whether the data in shared data area 125 has been updated. If an update is found, it obtains the data update result from shared data area 125 and sends the data update result to user space application 111.

[0039] In one embodiment, file operations can be various operations on a file, such as one or more of file open operations, file read operations (reading directories, reading file attribute information), file write operations, and file delete operations, but are not limited to these. For example, when an application sends a file operation request that is a file read operation request, the file read function corresponding to the file read operation request is called to perform the corresponding file read operation on the underlying file system.

[0040] In one implementation, the user-space daemon, Fuse Daemon, can call the `fuse_main_real` function in the user-space library Libfuse to parse the file operation function structure to obtain one or more corresponding instrumented functions. Specifically, when Fuse Daemon is executed, it calls the `fuse_main` function in Libfuse, which in turn calls the `fuse_main_real` function to parse some parameters. Since the file operation function structure is different for each user-space file system, it is necessary to add parsing to the file operation function structure in Libfuse to perform corresponding instrumentation based on the specific functionality of the function implementation.

[0041] In embodiments of the present invention, a computing device is adapted to execute the file operation method 300 of the user-space file system of the present invention, which will be described in detail below.

[0042] According to the user space file system 100 provided by the present invention, the frequency of switching operations and data interaction between user space and kernel is less when performing file operations, which helps to reduce system overhead and save response time when performing file operations in user space file system.

[0043] Figure 2 A schematic diagram of a computing device 200 according to an embodiment of the present invention is shown.

[0044] like Figure 2 As shown, in basic configuration 202, computing device 200 typically includes system memory 206 and one or more processors 204. Memory bus 208 can be used for communication between processor 204 and system memory 206.

[0045] Depending on the desired configuration, processor 204 can be any type of processor, including but not limited to: microprocessor (UP), microcontroller (UC), digital information processor (DSP), or any combination thereof. Processor 204 may include one or more levels of cache such as L1 cache 210 and L2 cache 212, processor core 214, and registers 216. Example processor core 214 may include an arithmetic logic unit (ALU), floating-point unit (FPU), digital signal processing core (DSP core), or any combination thereof. Example memory controller 218 may be used with processor 204, or in some implementations, memory controller 218 may be an internal part of processor 204.

[0046] Depending on the desired configuration, system memory 206 can be any type of memory, including but not limited to volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 206 may include operating system 220, one or more applications 222, and program data 224. Application 222 is actually a set of program instructions that instruct processor 204 to perform corresponding operations. In some embodiments, application 222 may be arranged to cause processor 204 to operate using program data 224 on the operating system.

[0047] The computing device 200 also includes a storage device 232, which includes a removable storage device 236 and a non-removable storage device 238.

[0048] The computing device 200 may also include a storage interface bus 234. The storage interface bus 234 enables communication from storage devices 232 (e.g., removable storage 236 and non-removable storage 238) to the basic configuration 202 via the bus / interface controller 230. At least a portion of the operating system 220, applications 222, and program data 224 may be stored on the removable storage 236 and / or the non-removable storage 238, and loaded into system memory 206 via the storage interface bus 234 when the computing device 200 is powered on or when the application 222 is to be executed, and executed by one or more processors 204.

[0049] The computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via a bus / interface controller 230. Example output devices 242 include an image processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices such as displays or speakers via one or more A / V ports 252. Example peripheral interfaces 244 may include a serial interface controller 254 and a parallel interface controller 256, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboards, mice, pens, voice input devices, touch input devices) or other peripherals (e.g., printers, scanners, etc.) via one or more I / O ports 258. Example communication devices 246 may include a network controller 260, which may be arranged to facilitate communication with one or more other computing devices 262 via a network communication link through one or more communication ports 264.

[0050] A network communication link can be an example of a communication medium. A communication medium can typically be embodied in a modulated data signal, such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A “modulated data signal” can be a signal in which one or more of its data sets, or changes thereof, can be encoded as information within the signal. As a non-limiting example, a communication medium can include wired media such as wired networks or leased lines, and various wireless media such as voice, radio frequency (RF), microwave, infrared (IR), or other wireless media. The term “computer-readable medium” as used herein can include both storage media and communication media.

[0051] In an embodiment of the present invention, computing device 200 is configured to execute a file operation method 300 of the user-space file system according to the present invention. The operating system of computing device 200 includes multiple program instructions for executing the file operation method 300 of the user-space file system according to the present invention. These program instructions can instruct the processor to execute the file operation method 300 of the user-space file system according to the present invention, so that the computing device can directly run user-space operation functions in the kernel and share data with user space by executing the file operation method 300 of the user-space file system according to the present invention, thereby reducing the frequency of switching operations and data interaction between the kernel and user space.

[0052] According to one embodiment of the present invention, such as Figure 1 As shown, the operating system of computing device 200 includes a kernel 120 and a user space 110 arranged on top of the kernel. Applications 111 and a user space daemon 112 (Fuse Daemon) run in the user space 110. The kernel contains a virtual file system 121 and one or more driver modules, wherein the one or more driver modules include a target driver module 122 (FuseDriver) corresponding to the user space file system.

[0053] Figure 3 A flowchart of a file operation method 300 for a user-space file system according to an embodiment of the present invention is shown. Method 300 is adapted to be executed in a computing device (e.g., the aforementioned computing device 200).

[0054] like Figure 3 As shown, method 300 begins with step S310.

[0055] In step S310, when application 111 requests to perform file operations on a target file in the user space file system, the virtual file system 121 in the kernel receives the file operation request sent by the application to the target file in the user space file system, and finds the target driver module 122 in the kernel corresponding to the user space file system. Then, the virtual file system 121 sends the file operation request to the target driver module 122 for processing.

[0056] Subsequently, in step S320, the target driver module 122 enables the extended filter 123, that is, loads the extended filter 123 into the kernel for instrumentation within the kernel to extend kernel functionality. After enabling the extended filter 123, the instrumentation function corresponding to the file operation request can be called to perform the corresponding file operation on the underlying file system 130, obtain the operation result returned by the instrumentation function, and update the data in the shared data area 125 in the kernel according to the operation result. Here, the corresponding instrumentation function is called to perform operations such as creation, reading, updating, or deletion on the data stored in the shared data area 125. In one embodiment, the file operation can be various operations on a file, such as one or more of file open operations, file read operations (reading directories, reading file attribute information), file write operations, and file delete operations, but is not limited to these. For example, when the file operation request sent by the application is a file read operation request, the file read function corresponding to the file read operation request is called to perform the corresponding file read operation on the underlying file system.

[0057] In one implementation, the extended filter 123 can be implemented as an eBPF (Extended Berkeley Packet Filter). Existing functions in the kernel can be extended to facilitate finding and running the eBPF inserted into the kernel.

[0058] After the target driver module 122 enables the extended filter eBPF, user-space specified programs (e.g., operation functions) can be run in the kernel 120 based on eBPF. In one embodiment of the present invention, the corresponding file operation function structure fuse_operations can be implemented through the user-space daemon Fuse Daemon, and the file operation function structure can be parsed to obtain one or more corresponding instrumentation functions. Subsequently, instrumentation can be performed in the kernel 120 based on the instrumentation functions so that the instrumentation functions can be run in the kernel. Here, the instrumentation functions are used to perform file operations on the underlying file system corresponding to the user-space file system in the kernel. Each instrumentation function corresponds to a file operation. It can be understood that the function implemented by the instrumentation function called in step S220 corresponds to the file operation requested by the application.

[0059] In one implementation, the user-space daemon, Fuse Daemon, can call the `fuse_main_real` function in the user-space library Libfuse to parse the file operation function structure to obtain one or more corresponding instrumented functions. Specifically, when Fuse Daemon is executed, it calls the `fuse_main` function in Libfuse, which in turn calls the `fuse_main_real` function to parse some parameters. Since the file operation function structure is different for each user-space file system, it is necessary to add parsing functionality to the file operation function structure in Libfuse and perform corresponding instrumentation based on the specific features of each function implementation.

[0060] It should be noted that the shared data region 125 is a memory region where the kernel and user space share data. After enabling the extended filter (eBPF) through the target driver module 122, user space is allowed to create the shared data region 125 based on the Map data structure in the kernel, and the user space daemon 112 can access the shared data region 125 in the kernel.

[0061] After creating shared data region 125 in the kernel, file metadata can be stored in key-value pairs based on the Map data structure used in shared data region 125. Specifically, shared data region 125 uses a Map data structure to establish and store the mapping relationship between file descriptors and file attribute information of each file in the user-space file system. That is, the file descriptors and file attribute information of each file in the user-space file system are associated and stored in shared data region 125 in key-value pairs based on the Map data structure. In this way, user-space daemon 112 can access the data stored in shared data region 125 based on key-value pairs through system calls. In addition, extended filters loaded in the kernel can also access the data stored in shared data region 125 based on key-value pairs (by calling the corresponding instrumentation function), thereby realizing data sharing between the kernel and user space.

[0062] In one embodiment, a shared data region 125 in the kernel is bound to a user-space daemon 112, allowing only the user-space daemon 112 to access the shared data region 125 and preventing other user processes in user space from accessing it. This achieves mutual exclusion for accessing the shared data region 125.

[0063] Specifically, after enabling the extended filter eBPF through the target driver module 122, a shared data region 125 can be created in the kernel. Furthermore, the shared data region 125 is bound to the user space daemon 112 via the user space library 115 (Libfuse) so that only the user space daemon 112 is allowed to access the data in the shared data region 125.

[0064] Finally, in step S330, the user space daemon 112 obtains the data update result from the shared data area 125 and sends the data update result to the user space application. This completes the file operation requested by the user space application.

[0065] In one embodiment, the user space daemon 112 polls the shared data area 125 to detect whether the data in the shared data area 125 has been updated. If an update is found, the daemon obtains the data update result from the shared data area 125 and sends the data update result to the user space application 111.

[0066] In one embodiment, after the user-space daemon 112 parses the file operation function structure in the user-space library to obtain one or more instrumentation functions, it can assign a function number to each instrumentation function. In other words, it assigns a number to each of the one or more instrumentation functions, with each instrumentation function corresponding to a function number. This allows the kernel 120 to establish a mapping relationship between instrumentation functions and function numbers, generating a function mapping table, such as... Figure 1 As shown.

[0067] The file operation request sent by application 111 includes a function number corresponding to the file operation. Thus, in step S220, the target driver module 122 can call the instrumentation function corresponding to the file operation request in the function mapping table based on the function number, so as to perform file operations on the underlying file system 130 based on the instrumentation function and obtain the operation result returned by the instrumentation function. Here, the target driver module 122 only needs to execute a remote jump function bpf_tail_call, which can jump to the specific instrumentation function based on the function number. In one implementation, the underlying file system 130 is, for example, a fourth-generation extended file system ext4.

[0068] Furthermore, based on the operation result returned by the instrumentation function, the corresponding instrumentation function in the function mapping table can be called to update the data in the shared data region 125 in the kernel.

[0069] In one embodiment, after the target driver module 122 performs corresponding file operations on the underlying file system by calling the instrumentation function, it can send an operation completion signal to the application via the virtual file system 121, thereby waking up the application. Then, the application can obtain the corresponding file attribute information from the updated shared data area 125 based on the file descriptor. The file attribute information includes, but is not limited to, the size, address, and content information of the target file.

[0070] According to the file operation method 300 of the user-space file system of the present invention, user-space operation functions are instrumented into the kernel using eBPF technology, and a shared data region is established in the kernel for data sharing with user space. This allows user-space operation functions to be run directly in the kernel and data to be shared with user space via the shared data region. Thus, when user space requests a file operation, the file operation is directly delegated to the kernel, and the corresponding instrumented function is called for execution. The data in the shared data region is updated based on the operation result, and user space only needs to poll the shared data region to obtain the updated data. Therefore, according to the technical solution of the present invention, when performing file operations in the user-space file system, the frequency of frequent switching operations and data interaction between user space and kernel can be effectively reduced, which helps to reduce system overhead and save response time when performing file operations in the user-space file system. Furthermore, it is suitable for some high-throughput application scenarios and can effectively improve the performance of the user-space file system.

[0071] The various techniques described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, USB flash drive, floppy disk, CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into and executed by a machine such as a computer, the machine becomes an apparatus for practicing the present invention.

[0072] When the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a processor-readable storage medium (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store program code; the processor is configured to execute the file operation method of the user-space file system of the present invention according to instructions in the program code stored in the memory.

[0073] By way of example, and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer-readable instructions, data structures, program modules, or other data. Communication media generally embodies computer-readable instructions, data structures, program modules, or other data in the form of modulated data signals such as carrier waves or other transmission mechanisms, and includes any information delivery medium. Any combination of the above is also included within the scope of readable media.

[0074] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with the examples of this invention. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the invention.

[0075] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0076] Similarly, it should be understood that, in order to streamline this disclosure and aid in understanding one or more aspects of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the above description of exemplary embodiments of the invention. However, this method of disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of the invention.

[0077] Those skilled in the art will understand that modules, units, or components of the devices disclosed in the examples herein can be arranged in the devices described in this embodiment, or alternatively, can be located in one or more devices different from the devices in this example. The modules in the foregoing examples can be combined into a single module or, in addition, can be divided into multiple sub-modules.

[0078] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0079] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features but not others included in other embodiments, combinations of features from different embodiments are intended to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.

[0080] Furthermore, some of the embodiments described herein are methods or combinations of method elements that can be implemented by a processor of a computer system or by other means of performing the functions. Therefore, a processor having the necessary instructions for implementing the methods or method elements forms means for implementing the methods or method elements. Furthermore, the elements described herein in the apparatus embodiments are examples of means for implementing the functions performed by elements for the purposes of carrying out the invention.

[0081] As used herein, unless otherwise specified, the use of ordinal numbers such as “first,” “second,” “third,” etc., to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects being described must have a given order in time, space, ordering, or any other manner.

[0082] Although the invention has been described with respect to a limited number of embodiments, those skilled in the art will understand from the foregoing description that other embodiments are conceivable within the scope of the invention described herein. Furthermore, it should be noted that the language used in this specification has been chosen primarily for readability and edibility purposes, and not for the purpose of interpreting or limiting the subject matter of the invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the invention is illustrative rather than restrictive, and the scope of the invention is defined by the appended claims.

Claims

1. A method for file operation of a user space file system, executed in a computing device, an operating system of the computing device comprising a kernel, a user space arranged above the kernel, the user space running with an application program, a user space daemon, the kernel having a virtual file system and a target driver module corresponding to the user space file system arranged therein, the method comprising the steps of: parsing a file operation function structure to obtain one or more plug-in functions corresponding to a file operation request; the file operation comprising one or more of a file opening operation, a file reading operation, a file writing operation, and a file deleting operation; the virtual file system receiving the file operation request for a target file in the user space file system sent by the application program and sending the file operation request to the target driver module; the target driver module starting an extension filter, plugging in the one or more plug-in functions in the kernel, creating a shared data area in the kernel, binding the shared data area with the user space daemon via a user space library, invoking the plug-in functions corresponding to the file operation request to perform corresponding file operations on an underlying file system, and obtaining operation results returned by the plug-in functions, and updating the shared data area in the kernel according to the operation results; and the user space daemon polling the shared data area to detect whether data of the shared data area is updated, if yes, obtaining data update results from the shared data area, and sending the data update results to the application program. A corresponding file operation function structure is implemented by a user space daemon, and the file operation function structure is parsed to obtain one or more corresponding plug-in functions, wherein After the parsing of the file operation function structure to obtain the one or more plug-in functions, the method further comprises the steps of: assigning a function number to each plug-in function; and establishing a mapping relationship between the plug-in functions and the function numbers in the kernel to generate a function mapping table. 3.The method of claim 1, wherein the shared data area adopts a Map data structure to establish and store a mapping relationship between a file descriptor and file attribute information of each file. After the invocation of the plug-in functions corresponding to the file operation request to perform corresponding file operations on the underlying file system, the method further comprises the step of: sending an operation completion signal to the application program via the virtual file system. The parsing of the file operation function structure to obtain the one or more plug-in functions comprises: invoking a fuse_main_real function in the user space library to parse the file operation function structure to obtain the one or more plug-in functions.

2. The method of claim 1, wherein, 6.The method of any one of claims 1-3, wherein the extension filter is an eBPF. 7.A user space file system deployed in a computing device, an operating system of the computing device comprising a kernel, a user space arranged above the kernel, the user space file system comprising: ​ ​ ​ 4. The method of any one of claims 1-3, wherein, ​ ​ 5. The method of any one of claims 1-3, wherein, ​ ​ ​ ​ ​ an application program running in a user space, a user space daemon adapted to implement a corresponding file operation function structure and parse the file operation function structure to obtain one or more plug-in functions corresponding to the file operation function structure, wherein each plug-in function corresponds to a file operation, and the file operation includes one or more of a file opening operation, a file reading operation, a file writing operation, and a file deleting operation; a shared data region arranged in the kernel; a virtual file system arranged in the kernel and adapted to receive a file operation request for a target file sent by the application program and send the file operation request to a target driver module in the kernel; the target driver module arranged in the kernel and adapted to start an extension filter to plug in the kernel based on the one or more plug-in functions, create a shared data region in the kernel, bind the shared data region with the user space daemon via a user space library, call a plug-in function corresponding to the file operation request to perform a corresponding file operation on an underlying file system, and obtain an operation result returned by the plug-in function and update the shared data region in the kernel based on the operation result; wherein the user space daemon is adapted to poll the shared data region to detect whether data of the shared data region is updated, and if so, obtain a data update result from the shared data region and send the data update result to the application program.

8. A computing device comprising: at least one processor; and a memory storing program instructions configured to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any one of claims 1-6.

9. A readable storage medium storing program instructions, which when read and executed by a computing device, cause the computing device to perform the method of any one of claims 1-6. ​