CN114398318A - File operation method of user space file system and user space file system - Google Patents

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

Info

Publication number
CN114398318A
CN114398318A CN202210298128.5A CN202210298128A CN114398318A CN 114398318 A CN114398318 A CN 114398318A CN 202210298128 A CN202210298128 A CN 202210298128A CN 114398318 A CN114398318 A CN 114398318A
Authority
CN
China
Prior art keywords
file
user space
kernel
file system
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210298128.5A
Other languages
Chinese (zh)
Other versions
CN114398318B (en
Inventor
刘欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Tongxin Software Co ltd
Original Assignee
Guangdong Tongxin Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Tongxin Software Co ltd filed Critical Guangdong Tongxin Software Co ltd
Priority to CN202210298128.5A priority Critical patent/CN114398318B/en
Priority to CN202210601732.0A priority patent/CN114860670A/en
Publication of CN114398318A publication Critical patent/CN114398318A/en
Application granted granted Critical
Publication of CN114398318B publication Critical patent/CN114398318B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/188Virtual file systems

Landscapes

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

Abstract

The invention discloses a file operation method of a user space file system and the user space file system, wherein the method comprises the following steps: the virtual file system receives a file operation request for a target file in the user space file system, which is sent by an application program, and sends the file operation request to a target driving module corresponding to the user space file system; the target driving module starts an expansion filter to call a instrumentation function corresponding to the file operation request to execute corresponding file operation on the bottom file system, and performs data updating on a shared data area in the kernel according to an operation result; and the user space daemon process acquires the data updating result from the shared data area and sends the data updating result to the application program. According to the technical scheme of the invention, the data interaction frequency between the user space and the kernel can be effectively reduced, and the reduction of the system overhead is facilitated.

Description

File operation method of user space file system and user space file system
Technical Field
The present invention relates to the field of file system technologies, and in particular, to a file operating method for a user space file system, and a computing device.
Background
FUSE (file system in Userspace, user space file system) is a file system framework implemented in user space, and comprises a FUSE kernel module, a user space library Libfuse and a user program module. Based on the support of the FUSE kernel module, a developer only needs to realize specific file operation according to an interface provided by FUSE to realize a file system.
Because the main implementation code of FUSE is in user space, the kernel does not need to be recompiled, thereby bringing great convenience to developers. However, FUSEs have a large overhead in performance. The overhead and latency of the same file operations (e.g., file lookup, open, read, write, etc.) on the local system are much less than the FUSE file system, due to the mechanism of the FUSE itself.
According to the implementation scheme of the FUSE file system in the prior art, the kernel in the FUSE file system serves more as a relay role, receives the type, file name and device number of the user operation, and then sends the parameters to the FUSE Daemon to continue to execute the corresponding operation. Since the FUSE file system in many cases causes unnecessary communication between the user space and the kernel space, low throughput and high latency are caused to affect the overall performance of the FUSE file system. The root cause of this problem is that the FUSE leaves the freedom of operation in the user space, and the kernel space is completely unknown about the file operations of opening, reading, writing, etc. implemented by the FUSE Daemon. Therefore, when the user space calls a request once, the kernel is required to perform transit once, and then the user space is provided for continuing to execute specific operations. This swap-in and swap-out process results in a higher overhead for the system, and the same file operation runs longer on the FUSE than on the local file system.
For this reason, a file operation method of the user space file system is required to solve the problems in the above-mentioned solutions.
Disclosure of Invention
Therefore, the present invention provides a file operation method for a user space file system and a user space file system, so as to solve or at least alleviate the above problems.
According to an aspect of the present invention, there is provided a file operating method of a user space file system, which is executed in a computing device, where an operating system of the computing device includes a kernel and a user space arranged above the kernel, the user space runs an application program and a user space daemon, and a virtual file system and a target driver module corresponding to the user space file system are arranged in the kernel, the method includes: the virtual file system receives a file operation request of a target file in the user space file system, which is sent by the application program, and sends the file operation request to the target drive module; the target driving module starts an expansion filter to call a instrumentation function corresponding to the file operation request to execute corresponding file operation on a bottom file system, and performs data updating on a shared data area in the kernel according to an operation result; and the user space daemon process acquires a data updating result from the shared data area and sends the data updating result to the application program.
Optionally, in the file operation method of the user space file system according to the present invention, before the instrumentation function corresponding to the file operation request is called, the method includes the steps of: realizing a corresponding file operation function structure through a user space daemon process, and analyzing the file operation function structure to obtain one or more corresponding pile inserting functions; and performing instrumentation in the kernel based on the instrumentation functions, wherein each instrumentation function corresponds to one file operation.
Optionally, in the file operation method of the user space file system according to the present invention, after analyzing the file operation function structure to obtain one or more corresponding instrumentation functions, the method further includes: allocating a function number to each pile inserting function; and establishing a mapping relation between the instrumentation function and the function number in the kernel, and generating a function mapping table.
Optionally, in the file operation method of the user space file system according to the present invention, the shared data area is bound to a user space daemon.
Optionally, in the file operation method of the user space file system according to the present invention, after the extended filter is started by the target driver module, the method further includes the steps of: and creating a shared data area in the kernel, and binding the shared data area with a user space daemon process through a user space library.
Optionally, in the file operation method of the user space file system according to the present invention, 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.
Optionally, in the file operating method of the user space file system according to the present invention, the step of the user space daemon acquiring the data update result from the shared data area includes: and polling a shared data area by a user space daemon to detect whether the data of the shared data area is updated, and if so, acquiring a data updating result from the shared data area.
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 a corresponding file operation on the underlying file system, the method further includes the steps of: and sending an operation completion signal to the application program through the virtual file system.
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 a file open operation, a file read operation, a file write operation, and a file delete operation.
Optionally, in the file operation method of the user space file system according to the present invention, analyzing the file operation function structure to obtain one or more corresponding instrumentation functions includes: and calling a fuse _ main _ real function in the user space library to analyze the file operation function structure body so as to obtain one or more corresponding instrumentation functions.
Optionally, in the file operation method of the user space file system according to the present invention, the extended filter is eBPF.
According to an aspect of the present invention, there is provided a user space file system, comprising: deployed in a computing device having an operating system comprising a kernel, a user space disposed above the kernel, the user space file system comprising: an application program and a user space daemon which run in a user space; a shared data area disposed in the kernel; the virtual file system is arranged in the kernel and is suitable for receiving a file operation request for a target file sent by the application program and sending the file operation request to a target drive module in the kernel; the target driving module is arranged in the kernel and is suitable for starting the extension filter so as to call the instrumentation function corresponding to the file operation request to execute corresponding file operation on the bottom file system and update data of the shared data area in the kernel according to the operation result; the user space daemon is suitable for acquiring a data updating result from the shared data area and sending the data updating result to the application program.
According to an aspect of the invention, there is provided a computing device comprising: at least one processor; a memory storing program instructions configured to be executed by the at least one processor, the program instructions comprising instructions for performing the file manipulation method of the user space file system as described above.
According to one aspect of the present invention, there is provided a readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform a file manipulation method of a user space file system as described above.
According to the technical scheme of the invention, the file operation method of the user space file system is provided, wherein an eBPF technology is utilized to insert the operation function of the user mode into the kernel, and a shared data area for carrying out data sharing with the user space is established in the kernel, so that the operation function of the user space is directly operated in the kernel and the data is shared with the user space through the shared data area. Therefore, when the user space requests to execute the file operation, the file operation can be directly put down in the kernel and executed by calling the corresponding instrumentation function, the data of the shared data area is updated according to the operation result, and the user space can acquire the updated data only by polling the shared data area. Therefore, according to the technical scheme of the invention, when the user space file system performs file operation, frequent switching operation and data interaction frequency between the user space and the kernel can be effectively reduced, the system overhead can be reduced, and the response time when the user space file system performs file operation can be saved. And the method is suitable for some high-throughput application scenes, and can effectively improve the performance of the user space file system.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 shows a schematic diagram of a user space file system 100 according to one embodiment of the invention;
FIG. 2 shows a schematic diagram of a computing device 200, according to one embodiment of the invention;
FIG. 3 illustrates a flow diagram of a method 300 of file manipulation of a user space file system in accordance with one embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below 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 embodied 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.
FIG. 1 shows a schematic diagram of a user space file system 100, according to one embodiment of the invention.
As shown in FIG. 1, user space file system 100 is deployed in a computing device 200. An operating system runs in the computing device 200. The operating system of the computing device 200 includes a kernel 120, and a user space 110 disposed above the kernel, the user space 110 running an application 111 (i.e., a user program) and running a user space Daemon 112 (Fuse Daemon). The user space is also arranged with a user space library 115 (Libfuse).
The kernel 120 has a virtual file system 121 and one or more driver modules, where 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 Fuse Driver, and the virtual file system is vfs (virtual file system).
The kernel 120 also runs an extension filter 123, and based on the extension filter, instrumentation can be performed in the kernel so as to run an operation function specified by a user space in the kernel, thereby extending the kernel function. In one implementation, the Extended Filter 123 may be implemented as, for example, eBPF (Extended Berkeley Packet Filter). In an embodiment of the present invention, when the application 111 requests to perform a file operation on a target file in the user space file system, the virtual file system 121 in the kernel receives a file operation request for the target file in the user space file system sent by the application, searches for a 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 expansion filter 123 may be turned on by the target driver module 122.
According to an embodiment of the present invention, the kernel 120 includes a shared data area 125 for data sharing with the user space 110, and the shared data area 125 employs a Map data structure to store a mapping relationship between a file descriptor and file attribute information of each file in the user space file system. Wherein the shared data area 125 in the kernel is bound to the userspace daemon 112, so that the userspace daemon 112 is only allowed to access the shared data area 125, and other user processes in the userspace are prevented from accessing the shared data area 125.
Specifically, the target driver module 122 may create the shared data region 125 in the kernel after turning on the extended filter. Also, the shared data region 125 is bound to the user space daemon 112 via the user space library 115 so that only the user space daemon 112 is allowed to access data in the shared data region 125.
In addition, the target driver module 122 may run one or more instrumented functions implemented in the user space in the kernel 120 based on the extended filter 123 after the extended filter 123 is turned on, where each instrumented function corresponds to a function number. Specifically, as shown in fig. 1, a mapping relationship between the instrumented function and the function number may be established in the kernel 120, and a function mapping table may be generated.
In one implementation, the corresponding file operation function structure fuse _ operations may be implemented by the user space daemon 112, and the file operation function structure may be parsed to obtain the corresponding one or more instrumentation functions, and then instrumentation may be performed in the kernel based on the instrumentation functions, so as to run the instrumentation functions in the kernel. Here, the instrumentation function is used to perform file operations in the kernel on the underlying file system 130 corresponding to the user space file system. Wherein each instrumentation function corresponds to a file operation.
In this way, after the expansion filter 123 is opened by the target driver module 122, according to the file operation request sent by the application 111 in the user space, the instrumentation function corresponding to the file operation request is called to perform a corresponding file operation on the underlying file system 130, an operation result returned by the instrumentation function is obtained, and data update is performed on the shared data area 125 in the kernel according to the operation result. Here, the corresponding instrumentation function may be called to perform operations such as creating, reading, updating, or deleting on the data stored in the shared data area 125.
The userspace daemon 112 may obtain the data update results from the shared data area 125 and send the data update results to the userspace application 111. In one embodiment, the userspace daemon 112 detects whether the data in the shared data area 125 is updated by polling the shared data area 125, and if an update is found, obtains the data update result from the shared data area 125 and sends the data update result to the application 111 in userspace.
In one embodiment, the file operation may be various operations on the file, and the file operation may include, for example, one or more of a file open operation, a file read operation (reading a directory, reading file attribute information), a file write operation, and a file delete operation, but is not limited thereto. For example, when the file operation request sent by the application program is a request of a file read operation, a file read function read corresponding to the file read operation request is called to perform the corresponding file read operation on the underlying file system.
In one implementation, the user space Daemon Fuse Daemon may call a Fuse _ main _ real function in the user space library Libfuse to parse the file operation function structure to obtain the corresponding one or more instrumentation functions. Specifically, the function of Fuse _ main in Libfuse is called when Fuse Daemon is executed, and Fuse _ main calls the function of Fuse _ main _ real to perform the parsing of some parameters. Since the file operation function structure implemented for each user space file system is different, it is necessary to add an analysis to the file operation function structure in Libfuse and perform corresponding instrumentation according to the specific function implemented by the function.
In an embodiment of the present invention, a computing device is adapted to perform the file manipulation method 300 of the user space file system of the present invention, the file manipulation method 300 of the user space file system being described in greater detail below.
According to the user space file system 100 provided by the invention, when the file operation is executed, the switching operation and data interaction frequency between the user space and the kernel are less, which is beneficial to reducing the system overhead and saving the response time when the user space file system executes the file operation.
FIG. 2 shows a schematic diagram of a computing device 200, according to one embodiment of the invention.
As shown in FIG. 2, in a basic configuration 202, a computing device 200 typically includes a system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between the processor 204 and the system memory 206.
Depending on the desired configuration, the processor 204 may be any type of processing, including but not limited to: a microprocessor (UP), a microcontroller (UC), a digital information processor (DSP), or any combination thereof. The processor 204 may include one or more levels of cache, such as a level one cache 210 and a level two cache 212, a processor core 214, and registers 216. Example processor cores 214 may include Arithmetic Logic Units (ALUs), Floating Point Units (FPUs), digital signal processing cores (DSP cores), or any combination thereof. The example memory controller 218 may be used with the processor 204, or in some implementations the memory controller 218 may be an internal part of the processor 204.
Depending on the desired configuration, system memory 206 may 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 an operating system 220, one or more applications 222, and program data 224. The application 222 is actually a plurality of program instructions that direct the processor 204 to perform corresponding operations. In some embodiments, application 222 may be arranged to cause processor 204 to operate with program data 224 on an operating system.
Computing device 200 also includes storage device 232, storage device 232 including removable storage 236 and non-removable storage 238.
Computing device 200 may also include a storage interface bus 234. The storage interface bus 234 enables communication from the storage devices 232 (e.g., removable storage 236 and non-removable storage 238) to the basic configuration 202 via the bus/interface controller 230. Operating system 220, applications 222, and at least a portion of program data 224 may be stored on removable storage 236 and/or non-removable storage 238, and loaded into system memory 206 via storage interface bus 234 and executed by one or more processors 204 when computing device 200 is powered on or applications 222 are to be executed.
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 the bus/interface controller 230. The exemplary output device 242 includes an image processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 252. Example peripheral interfaces 244 can include a serial interface controller 254 and a parallel interface controller 256, which can be configured to facilitate communications with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 258. An example communication device 246 may include a network controller 260, which may be arranged to facilitate communications with one or more other computing devices 262 over a network communication link via one or more communication ports 264.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in a manner that encodes information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In an embodiment in accordance with the invention, the computing device 200 is configured to perform a file manipulation method 300 of a user space file system in accordance with the invention. The operating system of the computing device 200 includes a plurality of program instructions for executing the file operation method 300 of the user space file system according to the present invention, and these program instructions may 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 implement the direct operation of the kernel on the operation function of the user space and share data with the user space by executing the file operation method 300 of the user space file system according to the present invention, thereby reducing the switching operation and data interaction frequency between the kernel and the user space.
According to one embodiment of the present invention, as shown in fig. 1, an operating system of a computing device 200 includes a kernel 120 and a user space 110 disposed above the kernel, wherein an application 111 runs in the user space 110, and a user space Daemon 112 (Fuse Daemon) runs. The kernel has a virtual file system 121 and one or more Driver modules, where the one or more Driver modules include a target Driver module 122 (Fuse Driver) corresponding to the user space file system.
FIG. 3 illustrates a flow diagram of a method 300 of file manipulation of a user space file system in accordance with one embodiment of the present invention. The method 300 is suitable for execution in a computing device, such as the computing device 200 described above.
As shown in fig. 3, the method 300 begins at step S310.
In step S310, when the application 111 requests to execute a file operation on a target file in the user space file system, the virtual file system 121 in the kernel receives a file operation request sent by the application on the target file in the user space file system, and searches for the target driver module 122 in the kernel corresponding to the user space file system, and then the virtual file system 121 sends the file operation request to the target driver module 122 for processing.
Subsequently, in step S320, the target driver module 122 opens the extension filter 123, that is, loads the extension filter 123 on the kernel, so as to perform instrumentation in the kernel and extend the kernel function. After the extended filter 123 is turned on, a stub function corresponding to the file operation request may be called to perform a corresponding file operation on the underlying file system 130, obtain an operation result returned by the stub function, and perform data update on the shared data area 125 in the kernel according to the operation result. Here, the data stored in the shared data area 125 is created, read, updated, or deleted by calling the corresponding instrumentation function. In one embodiment, the file operation may be various operations on the file, and the file operation may include, for example, one or more of a file open operation, a file read operation (reading a directory, reading file attribute information), a file write operation, and a file delete operation, but is not limited thereto. For example, when the file operation request sent by the application program is a request of a file read operation, a file read function read corresponding to the file read operation request is called to perform the corresponding file read operation on the underlying file system.
In one implementation, the Extended Filter 123 may be implemented as, for example, eBPF (Extended Berkeley Packet Filter). The original function can be extended in the kernel to facilitate finding and running the eBPF inserted in the kernel.
After the target driver module 122 turns on the extended filter eBPF, a user-space-specified program (e.g., an operating function) can be run in the kernel 120 based on the eBPF. In an embodiment of the present invention, a corresponding file operation function structure Fuse _ operations may be implemented by a user space Daemon Fuse Daemon, and the file operation function structure is analyzed to obtain one or more corresponding instrumentation functions, and then instrumentation may be performed in the kernel 120 based on the instrumentation functions, so as to run the instrumentation functions in the kernel. Here, the instrumentation function is used to perform file operations on the underlying file system corresponding to the user space file system in the kernel. Wherein each instrumentation function corresponds to a file operation. It is understood that the function implemented by the instrumented function called in step S220 corresponds to a file operation requested by the application.
In one implementation, the user space Daemon Fuse Daemon may call a Fuse _ main _ real function in the user space library Libfuse to parse the file operation function structure to obtain the corresponding one or more instrumentation functions. Specifically, the function of Fuse _ main in Libfuse is called when Fuse Daemon is executed, and Fuse _ main calls the function of Fuse _ main _ real to perform the parsing of some parameters. Since the file operation function structure implemented for each user space file system is different, it is necessary to add parsing of the file operation function structure in Libfuse and perform corresponding instrumentation according to the specific function implemented by the function.
It should be noted that the shared data area 125 is a memory area where the kernel and the user space realize data sharing. After opening the extended filter (eBPF) by the target driver module 122, the user space is allowed to create a Map data structure-based shared data region 125 in the kernel, and the user space daemon 112 can access the shared data region 125 in the kernel.
After the shared data area 125 is created in the kernel, file metadata may be stored in the form of key-value pairs based on the Map data structure employed by the shared data area 125. Specifically, the shared data area 125 uses a Map data structure to establish and store a mapping relationship between the file descriptor and the file attribute information of each file in the user space file system, that is, the file descriptor and the file attribute information of each file in the user space file system are stored in the shared data area 125 in a manner of key-value pairs based on the Map data structure. In this way, user space daemon 112 can access the data stored based on key-value pairs in shared data area 125 through system calls. In addition, the extension filter loaded in the kernel may also access the data stored in the shared data area 125 based on the key-value pairs (by calling the corresponding instrumentation function), thereby implementing data sharing between the kernel and the user space.
In one embodiment, shared data region 125 in the kernel is bound to user space daemon 112 such that only user space daemon 112 is allowed to access shared data region 125, avoiding other user processes of the user space from accessing shared data region 125. This enables a mutual exclusion operation of accessing the shared data area 125.
Specifically, after the extended filter eBPF is turned on by the target driver module 122, the shared data area 125 may be created in the kernel. Also, the shared data area 125 is bound with 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 area 125.
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 application program of the user space. At this point, the file operation requested to be executed by the application program in the user space is completed.
In one embodiment, the userspace daemon 112 detects whether the data in the shared data area 125 is updated by polling the shared data area 125, and if an update is found, obtains the data update result from the shared data area 125 and sends the data update result to the application 111 in userspace.
In an embodiment, after the user space daemon 112 analyzes the file operation function structure in the user space library to obtain one or more instrumentation functions, it may also allocate a function number to each instrumentation function, in other words, number the one or more instrumentation functions respectively, and each instrumentation function corresponds to a function number. In this way, a mapping relationship between the instrumented function and the function number may be established in the kernel 120, and a function mapping table may be generated, as shown in fig. 1.
The file operation request sent by the application 111 includes a function number corresponding to the file operation, so that in step S220, the target driver module 122 may call an instrumentation function corresponding to the file operation request in the function mapping table based on the function number, so as to execute the file operation on the underlying file system 130 based on the instrumentation function, and obtain an operation result returned by the instrumentation function. Here, the target driver module 122 only needs to execute a remote jump function bpf _ tail _ call, and can jump to a specific instrumentation function according to the function number. In one implementation, the underlying file system 130 is, for example, a fourth generation extended file system ext 4.
Further, according to the operation result returned by the instrumentation function, the corresponding instrumentation function in the function mapping table may be continuously called to update the data of the shared data area 125 in the kernel.
In one embodiment, the target driver module 122 may send an operation completion signal to the application program via the virtual file system 121 after calling the instrumentation function to perform the corresponding file operation on the underlying file system, thereby waking the application program. Further, the application program may obtain corresponding file attribute information from the updated shared data area 125 based on the file descriptor, the file attribute information including, but not limited to, the size, address, and content information of the target file, for example.
According to the file operation method 300 of the user space file system of the present invention, the eBPF technique is used to peg the operation function of the user mode into the kernel, and a shared data area for data sharing with the user space is established in the kernel, so that the operation function of the user space is directly run in the kernel and data is shared with the user space through the shared data area. Therefore, when the user space requests to execute the file operation, the file operation can be directly put down in the kernel and executed by calling the corresponding instrumentation function, the data of the shared data area is updated according to the operation result, and the user space can acquire the updated data only by polling the shared data area. Therefore, according to the technical scheme of the invention, when the user space file system performs file operation, frequent switching operation and data interaction frequency between the user space and the kernel can be effectively reduced, the system overhead can be reduced, and the response time when the user space file system performs file operation can be saved. And the method is suitable for some high-throughput application scenes, and can effectively improve the performance of the user space file system.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, 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 invention.
In the case of program code execution on programmable computers, the mobile terminal generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the file manipulation method of the user space file system of the present invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, 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 in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.

Claims (14)

1. A file operation method of a user space file system is executed in a computing device, the operating system of the computing device comprises a kernel and a user space arranged on the kernel, the user space runs with an application program and a user space daemon, a virtual file system and a target drive module corresponding to the user space file system are arranged in the kernel, the method comprises the following steps:
the virtual file system receives a file operation request of a target file in the user space file system, which is sent by the application program, and sends the file operation request to the target drive module;
the target driving module starts an expansion filter to call a instrumentation function corresponding to the file operation request to execute corresponding file operation on a bottom file system, and performs data updating on a shared data area in the kernel according to an operation result; and
and the user space daemon process acquires a data updating result from the shared data area and sends the data updating result to the application program.
2. The method of claim 1, wherein prior to invoking the instrumentation function corresponding to the file operation request, comprising the steps of:
realizing a corresponding file operation function structure through a user space daemon process, and analyzing the file operation function structure to obtain one or more corresponding pile inserting functions;
and performing instrumentation in the kernel based on the instrumentation functions, wherein each instrumentation function corresponds to one file operation.
3. The method of claim 2, wherein after parsing the structure of file manipulation functions to obtain the corresponding one or more instrumentation functions, further comprising:
allocating a function number to each pile inserting function;
and establishing a mapping relation between the instrumentation function and the function number in the kernel, and generating a function mapping table.
4. The method of any of claims 1-3, wherein the shared data region is bound to a user space daemon.
5. The method of any one of claims 1-3, further comprising, after opening the extended filter by the target driver module, the steps of:
and creating a shared data area in the kernel, and binding the shared data area with a user space daemon process through a user space library.
6. The method of any one of claims 1-3,
the shared data area adopts a Map data structure to establish and store the mapping relation between the file descriptor and the file attribute information of each file.
7. The method of any one of claims 1-3, wherein the step of the userspace daemon obtaining data update results from the shared data region comprises:
and polling a shared data area by a user space daemon to detect whether the data of the shared data area is updated, and if so, acquiring a data updating result from the shared data area.
8. The method of any of claims 1-3, wherein after invoking an instrumentation function corresponding to the file operation request to perform the corresponding file operation on the underlying file system, further comprising the steps of:
and sending an operation completion signal to the application program through the virtual file system.
9. The method of any one of claims 1-3,
the file operation comprises one or more of a file opening operation, a file reading operation, a file writing operation and a file deleting operation.
10. The method of any of claims 2-3, wherein parsing the structure of file manipulation functions to obtain the corresponding one or more instrumented functions comprises:
and calling a fuse _ main _ real function in the user space library to analyze the file operation function structure body so as to obtain one or more corresponding instrumentation functions.
11. The method of any one of claims 1-3,
the extended filter is eBPF.
12. A user space file system deployed in a computing device having an operating system including a kernel, a user space disposed above the kernel, the user space file system comprising:
an application program and a user space daemon which run in a user space;
a shared data area disposed in the kernel;
the virtual file system is arranged in the kernel and is suitable for receiving a file operation request for a target file sent by the application program and sending the file operation request to a target drive module in the kernel;
the target driving module is arranged in the kernel and is suitable for starting the extension filter so as to call the instrumentation function corresponding to the file operation request to execute corresponding file operation on the bottom file system and update data of the shared data area in the kernel according to the operation result;
the user space daemon is suitable for acquiring a data updating result from the shared data area and sending the data updating result to the application program.
13. A computing device, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-11.
14. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-11.
CN202210298128.5A 2022-03-25 2022-03-25 File operation method of user space file system and user space file system Active CN114398318B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210298128.5A CN114398318B (en) 2022-03-25 2022-03-25 File operation method of user space file system and user space file system
CN202210601732.0A CN114860670A (en) 2022-03-25 2022-03-25 File operation method of user space file system and user space file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210298128.5A CN114398318B (en) 2022-03-25 2022-03-25 File operation method of user space file system and user space file system

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202210601732.0A Division CN114860670A (en) 2022-03-25 2022-03-25 File operation method of user space file system and user space file system

Publications (2)

Publication Number Publication Date
CN114398318A true CN114398318A (en) 2022-04-26
CN114398318B CN114398318B (en) 2022-07-08

Family

ID=81234572

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202210298128.5A Active CN114398318B (en) 2022-03-25 2022-03-25 File operation method of user space file system and user space file system
CN202210601732.0A Pending CN114860670A (en) 2022-03-25 2022-03-25 File operation method of user space file system and user space file system

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202210601732.0A Pending CN114860670A (en) 2022-03-25 2022-03-25 File operation method of user space file system and user space file system

Country Status (1)

Country Link
CN (2) CN114398318B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114780353A (en) * 2022-06-15 2022-07-22 统信软件技术有限公司 File log monitoring method and system and computing device
CN116049131A (en) * 2022-06-10 2023-05-02 荣耀终端有限公司 File management method, system, electronic equipment and storage medium
CN117349870A (en) * 2023-12-05 2024-01-05 苏州元脑智能科技有限公司 Transparent encryption and decryption computing system, method, equipment and medium based on heterogeneous computing
CN117724905A (en) * 2024-02-05 2024-03-19 成都云祺科技有限公司 Real-time copying method, system and recovery method of file system under Linux

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218228A (en) * 2013-04-10 2013-07-24 广东欧珀移动通信有限公司 Method and device for realizing NTFS (New Technology File System) on internal hard disc of Android equipment
CN105740413A (en) * 2016-01-29 2016-07-06 珠海全志科技股份有限公司 File movement method by FUSE on Linux platform
US20180307638A1 (en) * 2017-04-19 2018-10-25 Electronics And Telecommunications Research Institute System and method for supporting user-level direct memory access input/output in distributed file system environment
US20190087431A1 (en) * 2017-09-21 2019-03-21 Alibaba Group Holding Limited Systems, methods, and apparatuses for simplifying filesystem operations utilizing a key-value storage system
CN110955631A (en) * 2018-09-26 2020-04-03 上海瑾盛通信科技有限公司 File access tracking method and device, storage medium and terminal
CN112181916A (en) * 2020-09-14 2021-01-05 星辰天合(北京)数据科技有限公司 File pre-reading method and device based on user space file system FUSE, and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218228A (en) * 2013-04-10 2013-07-24 广东欧珀移动通信有限公司 Method and device for realizing NTFS (New Technology File System) on internal hard disc of Android equipment
CN105740413A (en) * 2016-01-29 2016-07-06 珠海全志科技股份有限公司 File movement method by FUSE on Linux platform
US20180307638A1 (en) * 2017-04-19 2018-10-25 Electronics And Telecommunications Research Institute System and method for supporting user-level direct memory access input/output in distributed file system environment
US20190087431A1 (en) * 2017-09-21 2019-03-21 Alibaba Group Holding Limited Systems, methods, and apparatuses for simplifying filesystem operations utilizing a key-value storage system
CN110955631A (en) * 2018-09-26 2020-04-03 上海瑾盛通信科技有限公司 File access tracking method and device, storage medium and terminal
CN112181916A (en) * 2020-09-14 2021-01-05 星辰天合(北京)数据科技有限公司 File pre-reading method and device based on user space file system FUSE, and electronic equipment

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116049131A (en) * 2022-06-10 2023-05-02 荣耀终端有限公司 File management method, system, electronic equipment and storage medium
CN116049131B (en) * 2022-06-10 2023-10-13 荣耀终端有限公司 File management method, system, electronic equipment and storage medium
CN114780353A (en) * 2022-06-15 2022-07-22 统信软件技术有限公司 File log monitoring method and system and computing device
CN114780353B (en) * 2022-06-15 2022-09-27 统信软件技术有限公司 File log monitoring method and system and computing device
CN117349870A (en) * 2023-12-05 2024-01-05 苏州元脑智能科技有限公司 Transparent encryption and decryption computing system, method, equipment and medium based on heterogeneous computing
CN117349870B (en) * 2023-12-05 2024-02-20 苏州元脑智能科技有限公司 Transparent encryption and decryption computing system, method, equipment and medium based on heterogeneous computing
CN117724905A (en) * 2024-02-05 2024-03-19 成都云祺科技有限公司 Real-time copying method, system and recovery method of file system under Linux
CN117724905B (en) * 2024-02-05 2024-04-19 成都云祺科技有限公司 Real-time copying method, system and recovery method of file system under Linux

Also Published As

Publication number Publication date
CN114860670A (en) 2022-08-05
CN114398318B (en) 2022-07-08

Similar Documents

Publication Publication Date Title
CN114398318B (en) File operation method of user space file system and user space file system
CN109445861B (en) System starting method, device, computer device and storage medium
CN111538521B (en) Intelligent contract deployment and transaction method and device
US9311126B2 (en) System and method for virtual partition monitoring
CN103365696B (en) BIOS image file acquisition methods and device
EP3518100B1 (en) Quick loading method for kernel image file, and apparatus
CN112433812B (en) Virtual machine cross-cluster migration method, system, equipment and computer medium
CN113127100B (en) Heterogeneous program execution method and device, computing device and readable storage medium
CN113568787A (en) Power failure protection method, computing device and storage medium
CN112988464A (en) Power-off protection method and computing device
JP2021140732A (en) Caching device, instruction cache, instruction processing system, data processing method, data processing apparatus, computer readable storage medium, and computer program
WO2022222351A1 (en) Method for installing operating system, and computing device
JP2008112423A (en) Cache server, network booting method and program
CN109144595B (en) Method and device for starting assembly based on plug-in framework
CN113791873B (en) Virtual machine creating method, computing device and storage medium
CN115774701A (en) Data sharing method and device, electronic equipment and storage medium
CN114879978A (en) Software package dependency processing method, computing device and readable storage medium
JP4122998B2 (en) Information processing apparatus and program control method
CN113904962B (en) Resource access method and device and computing equipment
CN115658240B (en) Multi-protocol dictionary grid solution method based on cloud-native and storage medium
CN112988260B (en) Application cold start optimization method and device, computer equipment and storage medium
WO2024146324A1 (en) Hotfix processing method and device under arm architecture, storage medium, and electronic device
JP2005202614A (en) Memory management method for dynamic conversion type emulator
CN114003281A (en) Hash value-based instruction execution method, computing device and storage medium
CN115421794A (en) System performance adjusting method and device, electronic equipment and storage medium

Legal Events

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