Cross-device data access method and device, electronic device and storage medium

By pre-cacheting data in the cache space and using the eBPF module to truncate operation requests, the problem of inefficiency and time-delay in cross-device data access is solved, and efficient cross-device data access is achieved, and the read and write experience of close to local files is achieved.

CN119232751AActive Publication Date: 2024-12-31GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310802796.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2024-12-31
Estimated Expiration
2043-06-30

AI Technical Summary

Technical Problem

The prior art has problems of inefficiency and time-delay in cross-device data access, especially when processing large files, traditional solutions require multiple copies and synchronization, resulting in cumbersome and time-consuming operations.

Method used

By pre-cacheting data in the cache space and using the eBPF module to truncate operation requests in the kernel space, FUSE Driver can directly obtain results from the cache space, reducing the number of interactions between user state and kernel state, and using sliding window algorithm and LRU algorithm to eliminate it Cache data to improve data access efficiency.

Benefits of technology

It reduces the delay of data access across devices, improves data access efficiency, is close to the reading and writing experience of local files, and reduces the number of switching and data copying times between user and kernel states.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119232751A_ABST
    Figure CN119232751A_ABST
Patent Text Reader

Abstract

The invention provides a cross-device data access method and device, electronic equipment and a storage medium, and relates to the technical field of data processing. The cross-device data access method comprises the following steps: acquiring an operation request generated by an application program, and forwarding the operation request to a kernel driver of a network file system through a virtual file system in response to the operation request; calling the eBPF module through the kernel driver of the network file system to execute a target operation on the cache space to obtain a first target operation result; the cache space is used for caching data read from other electronic equipment or data written into other electronic equipment; and feeding back the first target operation result to the application program through the virtual file system. According to the method, the cross-device data access efficiency is improved, and the time delay is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a cross-device data access method, apparatus, electronic device, and storage medium. Background Art

[0002] Nowadays, most people have more than one electronic device, and different files may be stored on different electronic devices, such as work files stored on computers, downloaded materials stored on pads, and photos stored on mobile phones or car devices. In some scenarios, users want to be able to access photos taken by cameras or cars on their computers. In other scenarios, users want to be able to access work files on their computers on pads. It can be seen that cross-device data access has become a hot demand among people. Summary of the invention

[0003] The embodiments of the present application are dedicated to providing a cross-device data access method, apparatus, electronic device, and storage medium, which are introduced below from the following aspects.

[0004] In a first aspect, a cross-device data access method is provided, which is applied to an electronic device, wherein the operating system of the electronic device includes a user space and a kernel space, wherein the user space is arranged with an application and a FUSE network file system, and the kernel space is arranged with a virtual file system, a network file system kernel driver and an eBPF module, and the FUSE network file system and the eBPF module share a cache space, and the method includes: obtaining an operation request generated by the application, and forwarding the operation request to the network file system kernel driver through the virtual file system in response to the operation request; calling the eBPF module through the network file system kernel driver to perform a target operation on the cache space and obtain a first target operation result; the cache space is used to cache data read from other electronic devices or data written to other electronic devices; and the first target operation result is fed back to the application through the virtual file system.

[0005] In one of the embodiments, after calling the eBPF module through the network file system kernel driver to perform the target operation on the cache space, the method also includes, if the target operation fails, sending an operation request to the FUSE network file system through the network file system kernel driver; performing the target operation on the target electronic device associated with the operation request through the FUSE network file system to obtain a first target operation result; updating the first target operation result to the cache space through the FUSE network file system, and feeding back the first target operation result to the network file system kernel driver, and feeding back the first target operation result to the application through the virtual file system.

[0006] In one embodiment, the operation request is a read operation request, the target operation is a read operation, and the eBPF module is called through the network file system kernel driver to perform the target operation on the cache space to obtain a first target operation result, including: calling the eBPF module through the network file system kernel driver to search for the first target data corresponding to the read operation request in the cache space; if the first target data is found, reading the first target data and determining the first target operation result based on the read first target data.

[0007] In one of the embodiments, the method further includes: if the first target data is not found, feeding back a target operation failure to the network file system kernel driver.

[0008] In one of the embodiments, the operation request is a write operation request, the target operation is a write operation, and the eBPF module is called through the network file system kernel driver to perform the target operation on the cache space to obtain a first target operation result, including: calling the eBPF module through the network file system kernel driver to update the second target data corresponding to the write operation request in the cache space; and feeding back an operation success message as the first target operation result to the network file system kernel driver.

[0009] In one of the embodiments, the method further includes: when the size of the second target data in the cache space exceeds a preset threshold, writing the second target data to the corresponding target electronic device through the FUSE network file system.

[0010] In one of the embodiments, the method further includes: eliminating cached data in the cache space by using a sliding window algorithm and / or a LRU algorithm.

[0011] In a second aspect, a cross-device data access device is provided, which is applied to an electronic device. The operating system of the electronic device includes a user space and a kernel space. The user space is arranged with an application and a FUSE network file system, and the kernel space is arranged with a virtual file system, a network file system kernel driver and an eBPF module. The FUSE network file system and the eBPF module share a cache space. The device includes: an acquisition module, which is used to obtain an operation request generated by the application, and forward the operation request to the network file system kernel driver through the virtual file system in response to the operation request; an access module, which is used to call the eBPF module through the network file system kernel driver to perform a target operation on the cache space and obtain a first target operation result; the cache space is used to cache data read from other electronic devices or data written to other electronic devices; a feedback module, which is used to feed back the first target operation result to the application through the virtual file system.

[0012] According to a third aspect, an electronic device is provided, wherein an operating system of the electronic device includes a user space and a kernel space, wherein the user space is provided with an application program and a FUSE network file system, wherein the kernel space is provided with a virtual file system, a network file system kernel driver, and an eBPF module, wherein the FUSE network file system shares a cache space with the eBPF module, wherein the electronic device also includes a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements any one of the methods of the first aspect when executing the computer program.

[0013] According to a fourth aspect, a computer storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the method according to any one of the above-mentioned first aspects is implemented.

[0014] The cross-device data access method provided by the present application pre-caches the data in the cache space, and then intercepts the operation request in the kernel space through the eBPF module, so that the operation request does not need to reach the FUSE network file system. In this way, the FUSE Driver can directly obtain the first target operation result from the cache space through the eBPF module and return it to the APP. The number of interactions between the FUSE Driver in the kernel space and the FUSE network file system in the user space for an operation request is reduced, which helps to reduce the multiple switches between the user state and the kernel state and the repeated copying of data between the user state and the kernel state, thereby improving the efficiency of cross-device access to data and reducing latency. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A schematic diagram showing the interconnection of multiple electronic devices.

[0016] Figure 2 A schematic diagram of the architecture of a user-mode file system is shown.

[0017] Figure 3 An architectural diagram of a user-mode file system provided in an embodiment of the present application is shown.

[0018] Figure 4 A flow chart of a cross-device data access method provided by an embodiment of the present application is shown.

[0019] Figure 5 A flow chart showing another cross-device data access method.

[0020] Figure 6 A logical diagram of a user-mode file system is shown.

[0021] Figure 7 A working logic diagram of a FUSE Driver processing a read operation request is shown.

[0022] Figure 8A schematic diagram showing a data elimination mechanism for a cache space.

[0023] Fig. 9 A working logic diagram of a FUSE Driver processing a write operation request is shown.

[0024] Fig.10 A logical diagram of a user-mode file system is shown.

[0025] Fig.11 A logical diagram of another user-mode file system is shown.

[0026] Fig.12 A block diagram of a cross-device data access apparatus is shown.

[0027] Fig.13 A block diagram of an electronic device is shown. DETAILED DESCRIPTION

[0028] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0029] In modern life, electronic devices play an increasingly important role in people's lives. Through electronic devices, data can be read and written, added / deleted, modified, etc. In addition, most people now have more than one electronic device, and different files may be stored on different electronic devices, such as work files stored on computers, downloaded materials on Pads, and photos taken on mobile phones or car devices.

[0030] In some scenarios, users may need to process data stored on multiple different electronic devices. In traditional solutions, users generally enable different electronic devices and process the data stored on them through each electronic device. Or users manually copy the data on different electronic devices and concentrate them on one electronic device for processing. Obviously, both methods are very inconvenient and inefficient.

[0031] Based on this, people have proposed the idea of ​​cross-device data access. Cross-device data access means that electronic devices have the ability to access and edit data between different devices. For example, a computer can directly access and edit data on a mobile phone / tablet. Or a computer can directly access data on other computers, thereby achieving efficient office work.

[0032] Among them, achieving cross-device data access generally needs to meet the following requirements: first, an electronic device can access and edit files saved on other electronic devices. Second, an electronic device can save files on other electronic devices locally. Third, an electronic device can directly add files to other electronic devices.

[0033] The above three requirements are essentially file directory operations and file read and write operations on other electronic devices through the network by local electronic devices. Obviously, users want all operations to be fast and seamless, just like local operations. So how to improve the file read and write speed to get close to the local file read and write experience is the most critical issue.

[0034] At present, the traditional solution proposes an implementation method, in which the local electronic device copies the original file that the user wants to access from other electronic devices to the local device, and the user directly operates the copied file. If any modification occurs, the modified file is synchronized back to the original electronic device.

[0035] This implementation is simple. You only need to copy the file, and all subsequent operations are no different from operating local files. However, the implementation of this solution includes multiple steps such as copying the original file, editing the file, copying the modified file and overwriting the original file, which is relatively cumbersome. In addition, when processing large files with large data volumes, copying the original file is very time-consuming. Even if a small modification is made to the file, the entire large file needs to be copied and transmitted twice over the network, which is very inefficient.

[0036] Based on this, the traditional solution also proposes an implementation method, that is, the local electronic device mounts the files and directories shared by other electronic devices to the local through the Network File System (NFS), allowing users to access the shared files of other devices just like accessing local files.

[0037] Among them, this implementation method mounts the shared files and directories of other electronic devices to the local electronic device through the network file system, and then the local electronic device performs cross-device reading and writing based on the network file system, so that users can operate the shared files of other electronic devices just like operating local files. However, cross-device reading and writing often have the problem of extended time.

[0038] In order to better improve the time delay problem of cross-device reading and writing, the embodiments of the present application provide a cross-device data access method, apparatus, electronic device, and storage medium. The cross-device data access method can improve the speed of accessing data on other electronic devices and reduce latency while meeting the user's usage needs.

[0039] The following describes the application scenarios and the file system in user space (FUSE) involved in the embodiments of the present application.

[0040] The technical solution provided by the embodiment of the present application can be applied to various cross-device data access and editing scenarios, and is the cornerstone of distributed data / file management. Figure 1 As shown, Figure 1 A schematic diagram of the interconnection of multiple electronic devices is shown, wherein four electronic devices such as a computer, a mobile phone, a car device and a tablet pad are shown as examples, wherein each electronic device is connected to the other three electronic devices through a network.

[0041] Taking a computer as a local electronic device, and a mobile phone, a car device, and a pad as other electronic devices, the FUSE network file system is installed and enabled on both the local electronic device and the other electronic devices. The local electronic device obtains the IP address and shared folder path of the other electronic device, and uses a command to mount the IP address and shared folder path of the other electronic device to the local electronic device, so as to connect to the shared folder of the other electronic device. In this way, the local electronic device can use commands to access the shared folder of other electronic devices.

[0042] It should be noted that Figure 1 The several electronic devices shown can all be used as local electronic devices and are not limited to the above examples. Figure 1 The several types shown in the figure may also include, for example, servers, cloud servers, server clusters, wearable devices, scanners, routers, smart home devices, etc.

[0043] In the embodiment of the present application, the operating system of the local electronic device includes a user space and a kernel space. Among them, the core of the operating system is the kernel. In order to protect the security of the kernel of the operating system, the existing operating system generally prohibits user processes from directly operating the kernel. Instead, the operating system divides the virtual address space into two parts, one for the user space and the other for the kernel space. Among them, the user space is used by each process, and the kernel space is used by the kernel.

[0044] like Figure 2 As shown, Figure 2A schematic diagram of the architecture of a user-mode file system is shown. In the embodiment of the present application, the user-mode file system is distributed in the user space and kernel space of the operating system of the electronic device. Among them, the user space is arranged with an application (Application, APP) and a FUSE network file system, and the kernel space is arranged with a virtual file system (Virtual File Systems, VFS) and a network file system kernel driver (FUSE Driver). Among them, when the process runs in the user space, it is in the user state, and the executed code is subject to many checks by the central processing unit (central processing unit, CPU), and they can only access the virtual addresses of the pages accessible in the user state specified in the page table entries that map other address spaces. When the process runs in the kernel space, it is in the kernel state, at which time the CPU can execute any instruction, and the running code is not subject to any restrictions, and can freely access any valid address.

[0045] The user-mode file system FUSE provides users with a set of application program interfaces (APIs), allowing users to implement their own file systems in user mode.

[0046] Combine the following Figure 2 The following describes the implementation process of cross-device data access, taking reading a block of data in a file as an example:

[0047] 1) The local electronic device mounts the shared files and directories of other electronic devices to the local device based on the user-mode file system, for example, the mount directory is / mnt / device2 / files, where device2 represents electronic device 2. Multiple other electronic devices can be mounted on one local electronic device.

[0048] 2) The application program interface of the user space application APP receives a read request to read a block of data from the file in / mnt / device2 / files. This read request is forwarded by the kernel space VFS to the kernel space FUSEDriver, and finally the read request is sent to the user space FUSE network file system.

[0049] 3) The FUSE network file system processes this read request and actually reads the corresponding data from other electronic devices across devices through network communication.

[0050] 4) The FUSE network file system returns the read data to the FUSE Driver in the kernel space, and finally returns it to the APP in the user space through the VFS in the kernel space, completing the file data read process.

[0051] pass Figure 2 As can be seen from the above process, there are four switches between user space and kernel space in this process. For applications with high throughput, high concurrency, and low latency requirements, such overhead is unbearable.

[0052] On this basis, please refer to Figure 3 , Figure 3 FIG. 1 shows an architecture diagram of a user-mode file system provided by an embodiment of the present application. Figure 3 As shown, in the embodiment of the present application, an eBPF module is also arranged in the kernel space, and the eBPF module is connected to the network file system kernel driver for being called by the network file system kernel driver. Among them, the eBPF module is used to run a hook function based on eBPF (extended Berkeley Packet Filter).

[0053] Among them, a hook function is a function that is automatically executed when a specific event occurs, and is usually used to perform some specific operations in different stages of program operation. In the embodiment of the present application, when the network file system kernel driver receives an operation request, the hook function of the eBPF module is triggered to run, thereby performing the target operation.

[0054] In the embodiment of the present application, a cache space is also configured, and the FUSE network file system and the eBPF module can share the cache space in a memory sharing manner, and the cache space is used to cache data read from other electronic devices or cache data written to other electronic devices. Among them, the FUSE network file system and / or the eBPF module can store data in the cache space, and the eBPF module can also search for data from the cache space. The FUSE network file system can also delete data in the cache space based on preset rules.

[0055] Combine the following Figure 3 and Figure 4 The implementation process of the cross-device data access method provided in the embodiment of the present application is described. Figure 4 A flow chart of a cross-device data access method provided in an embodiment of the present application is shown. The method is applied to the above-mentioned electronic device, which is a local electronic device, and includes steps 401 to 403.

[0056] Step 401 : obtaining an operation request generated by an application program, and forwarding the operation request to a network file system kernel driver through a virtual file system in response to the operation request.

[0057] Step 402: Call the eBPF module through the network file system kernel driver to perform a target operation on the cache space and obtain a first target operation result.

[0058] Step 403: Feedback the first target operation result to the application program through the virtual file system.

[0059] In the embodiment of the present application, the application APP runs in the user space of the operating system of the electronic device. The APP generates an operation request in response to the user operation and sends the operation request to the virtual file system VFS in the kernel space. VFS is a programming interface provided by the operating system kernel for the application, and the interface is used to forward data. In the embodiment of the present application, VFS can forward the operation request to the network file system kernel driver FUSE Driver.

[0060] The operation request is a cross-device data access request, which is used to instruct an electronic device to access data of another electronic device. The types of the operation request may include a read operation type and a write operation type.

[0061] It should be noted that one operation request is only used to indicate access to one other electronic device, and one operation request can indicate access to multiple data on one other electronic device.

[0062] In the embodiment of the present application, after receiving the operation request, the FUSE Driver calls the eBPF module. The hook function is implemented by calling the eBPF module to run the eBPF program. In the embodiment of the present application, the process of the hook function processing the operation request is the process of performing the target operation on the cache space.

[0063] In some implementations, the target operation may include multiple operations on different data.

[0064] In an embodiment of the present application, the cache space is a storage space specifically allocated for the user-mode file system, which is used to cache data read from other electronic devices or written to other electronic devices. Executing a target operation on the cache space, for example, performs a read operation or a write operation on the data cached in the cache space.

[0065] In the embodiment of the present application, after the target operation is completed, the first target operation result can be obtained. The FUSE Driver can feed back the first target operation result to the APP in the user space through the VFS.

[0066] Combination Figure 3 and Figure 4 It can be seen that in the embodiment of the present application, by pre-caching data in the cache space and then intercepting the operation request in the kernel space through the eBPF module, the operation request does not need to reach the FUSE network file system. In this way, the FUSE Driver can directly obtain the first target operation result from the cache space through the eBPF module and return it to the APP. Figure 2 The data processing flow reduces the number of interactions between the FUSEDriver in the kernel space and the FUSE network file system in the user space for an operation request, which helps to reduce the multiple switches between user mode and kernel mode and the repeated copying of data between user mode and kernel mode, thereby improving the efficiency of cross-device data access and reducing latency.

[0067] In actual applications, due to the influence of various factors, the process of executing the target operation on the cache space may result in different results such as success or failure. For the case of successful execution, the first target operation result can be directly obtained, which will not be described in detail here. Figure 5 and Figure 6 To explain, Figure 5 A flowchart showing another cross-device data access method is shown. Figure 6 A logic diagram of a user-mode file system is shown. The method includes steps 501 to 503.

[0068] Step 501, when the target operation fails, an operation request is sent to the FUSE network file system through the network file system kernel driver.

[0069] Step 502: Execute a target operation on a target electronic device associated with the operation request through the FUSE network file system to obtain a first target operation result.

[0070] Step 503: update the first target operation result to the cache space through the FUSE network file system, feed back the first target operation result to the network file system kernel driver, and feed back the first target operation result to the application through the virtual file system.

[0071] In the embodiment of the present application, when the eBPF module does not find the required data in the cache space, or the cache space is full and the eBPF module cannot write data, the target operation fails to be executed on the cache space. The eBPF module will feed back the execution status to the FUSE Driver, and the FUSE Driver determines the subsequent operation logic based on the execution feedback.

[0072] In the embodiment of the present application, when the FUSE Driver determines based on the execution feedback that the target operation fails, such as Figure 6 As shown by the dotted arrow in the middle, the FUSE Driver can send the operation request to the FUSE network file system in the user space.

[0073] After the FUSE network file system receives the operation request, it determines the target electronic device based on the device information associated with the operation request, where the target electronic device is one of multiple other electronic devices mounted on the local electronic device. The target operation is then performed on the target electronic device through the FUSE network file system, thereby obtaining a first target operation result.

[0074] On the one hand, the FUSE network file system can return the first target operation result obtained after cross-device data access to the FUSE Driver in the kernel space, which is sent to the VFS by the FUSE Driver, and then forwarded to the APP by the VFS, so that the user can obtain the first target operation result through the APP.

[0075] On the other hand, the FUSE network file system can also update the first target operation result to the cache space. In this way, when the APP continuously sends operation requests for the same data, the data can be directly accessed from the cache space based on the content disclosed in steps 401 to 403, thereby improving data access efficiency.

[0076] In an embodiment of the present application, when the target operation fails to be executed in the cache space, the target operation is executed on the target electronic device across devices through the FUSE network file system. On the one hand, it helps to reduce the number of times the target operation is executed across devices, and on the other hand, it helps to reduce the number of switching between user mode and kernel mode, thereby minimizing latency and improving efficiency.

[0077] Based on the above embodiments, Figure 7 The process of implementing cross-device data reading by the cross-device data access method provided in the embodiment of the present application is described, wherein the operation request is a read operation request and the target operation is a read operation. Figure 7 A schematic diagram of the working logic of a FUSE Driver processing a read operation request is shown. The process includes steps 701 to 704.

[0078] Step 701: FUSE Driver receives a read operation request forwarded by VFS.

[0079] The read operation request is associated with the identifier of the data that the user needs to read.

[0080] Step 702: Call the eBPF module through the network file system kernel driver to search the cache space for the first target data corresponding to the read operation request.

[0081] In the embodiment of the present application, the data that the user needs to read is defined as the first target data.

[0082] The eBPF module is called to perform a target operation on the cache space, that is, the eBPF module is called to search for the first target data in the cache space by running the read hook function of the eBPF program.

[0083] Step 703, determine whether to return data, if so, return the first target data to the VFS.

[0084] If the first target data is found, the first target data is read, and the first target operation result is determined based on the read first target data.

[0085] In the embodiment of the present application, the first target operation result includes the first target data. The eBPF module may return the first target data to the FUSE Driver, and the FUSE Driver may send the first target operation result including the first target data to the VFS, and finally the VFS sends the first target operation result to the APP.

[0086] Step 704: If not, read the first target data across devices through the FUSE network file system, and return the first target data to the VFS.

[0087] In an embodiment of the present application, if the first target data is not found in the cache space, the target operation failure is fed back to the FUSE Driver. In this case, a read operation request is sent to the FUSE network file system through the FUSE Driver. In response to the read operation request, the target operation is performed on the target electronic device associated with the read operation request through the FUSE network file system, that is, the first target data is read from the target electronic device.

[0088] In one implementation, the FUSE network file system caches the first target data at the same time, and returns the first target operation result including the first target data to the FUSE Driver.

[0089] In another implementation, the FUSE network file system caches several data after the first target data, such as the data of several pages after the read request data, and updates them to the cache space. Finally, the first target operation result including the first target data is returned to the FUSEDriver. In this way, by pre-caching the data that the user has not accessed, it is convenient to directly obtain it from the cache space to the APP when the user accesses it later, which helps to improve data access efficiency.

[0090] The cross-device data access method provided in the embodiment of the present application achieves the purpose of obtaining cross-device data access from the local file system through data pre-caching and intercepting read operation requests based on the eBPF module, thereby helping to avoid multiple kernel state and user state switching and multiple user state and kernel state data copying. The performance of cross-device data reading is improved, and the user experience in the cross-device data access scenario is improved.

[0091] Since the cache space needs to occupy memory, the cache space cannot be infinite. In this case, it is inevitable to consider the situation where the cache space is full. Based on the above embodiment, the embodiment of the present application provides a data management mechanism for the cache space. Figure 8 Provide explanation. Figure 8 A schematic diagram showing a data elimination mechanism for a cache space.

[0092] like Figure 8 As shown, cache space is added in the FUSE network file system to cache data currently being read across devices (hereinafter referred to as files for ease of description), and the maximum value that can be cached for each file and the maximum value of data for all cached files are set.

[0093] For example, if the page size is set to 4KB, the maximum cacheable size of a file is (page size*N), and N is set to 1024. If the maximum size of all cached files is set to 40MB, 10 files can be cached at the same time, reaching a maximum cacheable size of 4MB for each file.

[0094] When the cache size of a single file reaches 4M, if the subsequent data of the file is to be cached, the sliding window method is used to eliminate the low-order pages. The sliding window mechanism is used to manage the maximum cache data size of a single file. Figure 8 As shown in the figure, when page (2+N) needs to be cached, page 1 is eliminated through the sliding window.

[0095] When the total size of all cached files reaches the maximum value of cacheable data, if a new file needs to be cached, the LRU (Least Recently Used) algorithm is used to eliminate an already cached file.

[0096] The embodiment of the present application performs elimination management on the data in the cache space through the sliding window algorithm and the LRU algorithm, which can make the cache space more effective and help improve the efficiency of cross-device data access.

[0097] Based on the above embodiments, Figures 9 to 11The process of implementing cross-device data writing by the cross-device data access method provided in the embodiment of the present application is described, wherein the operation request is a write operation request and the target operation is a write operation. Fig. 9 A schematic diagram of the working logic of a FUSE Driver processing a write operation request is shown. Fig.10 shows a logical diagram of a user-mode file system, Fig.11 The logical diagram of another user-mode file system is shown. The process includes steps 901 to 902.

[0098] Step 901: Call the eBPF module through the network file system kernel driver to update the second target data corresponding to the write operation request in the cache space.

[0099] In the embodiment of the present application, data written by a user into other electronic devices through a local electronic device is defined as second target data, wherein the second target data is associated with an identifier of the target electronic device to be written and a data identifier.

[0100] like Fig.10 As shown, when the FUSE Driver receives a write operation request, the eBPF module is called to run the eBPF program to implement the hook function. In the embodiment of the present application, the hook function may include a read hook function and a write hook function. When the target operation is a read operation, the eBPF read hook function is run. When the target operation is a write operation, the eBPF write hook function is run.

[0101] In the embodiment of the present application, the second target data can be updated to the cache space by running the write hook function of eBPF. When the user writes to the same file multiple times, by caching the second target data, the user can write or modify the cached second target data multiple times, which can avoid frequent cross-device writing and save resources.

[0102] In some implementations, the cache space includes a read data cache space and a write data cache space, wherein the read data cache space is used to cache first target data corresponding to a read operation, and the write data cache space is used to cache second target data corresponding to a write operation.

[0103] In the embodiment of the present application, a plurality of second target data may be cached in the cache space, and the plurality of second target data may correspond to the same other electronic device or to different other electronic devices.

[0104] In practical applications, the cache space is not infinite, so after being cached, the second target data needs to be written to the final location as soon as possible, that is, the target electronic device corresponding to the second target data. Fig.11As shown by the dashed line in the embodiment of the present application, the FUSE network file system writes the second target data cached in the cache space to the corresponding target electronic device across devices. The FUSE network file system can obtain feedback information from the target electronic device.

[0105] Optionally, the FUSE network file system can send feedback information to the FUSE Driver, which is eventually fed back to the APP by the VFS.

[0106] In one implementation, when the size of the second target data in the cache space exceeds a preset threshold, the second target data is written to the corresponding target electronic device through the FUSE network file system.

[0107] In another implementation, the second target data is periodically written to the corresponding target electronic device through the FUSE network file system.

[0108] Step 902: Feedback the operation success message as the first target operation result to the network file system kernel driver.

[0109] In the embodiment of the present application, after the second target data is successfully updated in the cache space, the eBPF module can feedback an operation success message to the network file system kernel driver, and use the operation success message as the first target operation result. Finally, the VFS sends the first target operation result to the APP.

[0110] The embodiment of the present application improves the write performance of the FUSE network file system through the eBPF program. The write request of the FUSE network file system is truncated in the kernel, and the written data content is written into the cache. After the user-state FUSE network file system caches a certain size of file data, it is written across the end to other devices at one time.

[0111] Combination of the above Figures 1 to 11 , describes the method embodiment of the present application in detail, and the following is combined with Fig.12 , describes the device embodiment of the present application in detail. It should be understood that the description of the method embodiment corresponds to the description of the device embodiment, so the parts not described in detail can refer to the previous method embodiment.

[0112] The present application embodiment provides a cross-device data access device, such as Fig.12 As shown, Fig.12A block diagram of a cross-device data access device is shown. The device is applied to an electronic device, the operating system of the electronic device includes a user space and a kernel space, the user space is arranged with an application and a FUSE network file system, the kernel space is arranged with a virtual file system, a network file system kernel driver and an eBPF module, the FUSE network file system and the eBPF module share a cache space, and the device includes: an acquisition module 1201, which is used to acquire an operation request generated by an application, and forward the operation request to the network file system kernel driver through the virtual file system in response to the operation request; an access module 1202, which is used to call the eBPF module through the network file system kernel driver to perform a target operation on the cache space and acquire a first target operation result; the cache space is used to cache data read from other electronic devices or data written to other electronic devices; a feedback module 1203, which is used to feed back the first target operation result to the application through the virtual file system.

[0113] In one of the embodiments, the access module 1202 is also used to: in the event that the target operation fails, send an operation request to the FUSE network file system through the network file system kernel driver; perform the target operation on the target electronic device associated with the operation request through the FUSE network file system to obtain a first target operation result; update the first target operation result to the cache space through the FUSE network file system, and feed back the first target operation result to the network file system kernel driver, and feed back the first target operation result to the application through the virtual file system.

[0114] In one embodiment, the operation request is a read operation request, the target operation is a read operation, and the access module 1202 is further used to: call the eBPF module through the network file system kernel driver to search for the first target data corresponding to the read operation request in the cache space; if the first target data is found, read the first target data and determine the first target operation result based on the read first target data.

[0115] In one embodiment, the access module 1202 is further configured to: if the first target data is not found, feedback a target operation failure to the network file system kernel driver.

[0116] In one embodiment, the operation request is a write operation request, the target operation is a write operation, and the access module 1202 is further used to: call the eBPF module through the network file system kernel driver to update the second target data corresponding to the write operation request in the cache space; and feed back the operation success message as the first target operation result to the network file system kernel driver.

[0117] In one of the embodiments, the access module 1202 is further used to: when the size of the second target data in the cache space exceeds a preset threshold, write the second target data to the corresponding target electronic device through the FUSE network file system.

[0118] In one embodiment, the access module 1202 is further configured to eliminate cached data in the cache space by using a sliding window algorithm and / or a LRU algorithm.

[0119] For the specific definition of the cross-device data access device, please refer to the definition of the cross-device data access method above, which will not be repeated here. Each module in the above-mentioned cross-device data access device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations of the above modules.

[0120] Fig.13 A block diagram of an electronic device is shown. Fig.13 The electronic device 1300 shown may include: a memory 1310, a processor 1320, and an input / output interface 1330. The memory 1310, the processor 1320, and the input / output interface 1330 are connected via an internal connection path, the memory 1310 is used to store instructions, and the processor 1320 is used to execute the instructions stored in the memory 1310 to control the input / output interface 1330 to receive input data and information, and output data such as operation results.

[0121] The electronic device may further include a baseband, a radio frequency integrated circuit (RFIC), a radio frequency front end (RFFE) device, and an antenna (ANT), which may be coupled via various interconnection buses or other electrical connection methods. The electronic device may implement the cross-device data access method disclosed in any of the above embodiments.

[0122] It should be understood that in the embodiment of the present application, the processor 1320 can adopt a general central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs to implement the technical solution provided in the embodiment of the present application.

[0123] The memory 1310 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1320. A portion of the processor 1320 may also include a nonvolatile random access memory. For example, the processor 1320 may also store information on the device type.

[0124] In the implementation process, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor 1320 or an instruction in the form of software. The cross-device data access method disclosed in the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in the processor for execution. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1310, and the processor 1320 reads the information in the memory 1310 and completes the steps of the above method in combination with its hardware. To avoid repetition, it is not described in detail here.

[0125] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0126] In one embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the cross-device data access method described in the above embodiment is implemented. The implementation process can refer to the contents disclosed in the above embodiment, and will not be repeated here.

[0127] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A cross-device data access method, characterized in that: Applied to an electronic device, the operating system of the electronic device includes a user space and a kernel space, the user space is arranged with an application and a FUSE network file system, the kernel space is arranged with a virtual file system, a network file system kernel driver and an eBPF module, the FUSE network file system shares a cache space with the eBPF module, and the method includes: Acquire an operation request generated by the application, and forward the operation request to the network file system kernel driver through the virtual file system in response to the operation request; Calling the eBPF module through the network file system kernel driver to perform a target operation on the cache space to obtain a first target operation result; the cache space is used to cache data read from other electronic devices or data written to other electronic devices; The first target operation result is fed back to the application program through the virtual file system.

2. The method according to claim 1, characterized in that After calling the eBPF module through the network file system kernel driver to perform the target operation on the cache space, the method further includes: In the case where the target operation fails, sending the operation request to the FUSE network file system through the network file system kernel driver; Execute the target operation on the target electronic device associated with the operation request through the FUSE network file system to obtain the first target operation result; The first target operation result is updated to the cache space through the FUSE network file system, the first target operation result is fed back to the network file system kernel driver, and the first target operation result is fed back to the application through the virtual file system.

3. The method according to claim 1, characterized in that The operation request is a read operation request, the target operation is a read operation, and calling the eBPF module through the network file system kernel driver to perform the target operation on the cache space to obtain a first target operation result includes: Calling the eBPF module through the network file system kernel driver to search the cache space for the first target data corresponding to the read operation request; If the first target data is found, the first target data is read and the first target operation result is determined based on the read first target data.

4. The method according to claim 3, characterized in that The method further comprises: If the first target data is not found, a target operation failure is fed back to the network file system kernel driver.

5. The method according to claim 1, characterized in that: The operation request is a write operation request, the target operation is a write operation, and calling the eBPF module through the network file system kernel driver to perform the target operation on the cache space to obtain a first target operation result includes: Calling the eBPF module through the network file system kernel driver to update the second target data corresponding to the write operation request in the cache space; The operation success message is fed back to the network file system kernel driver as the first target operation result.

6. The method according to claim 5, characterized in that The method further comprises: When the size of the second target data in the cache space exceeds a preset threshold, the second target data is written to the corresponding target electronic device through the FUSE network file system.

7. The method according to claim 2, characterized in that The method further comprises: The cached data in the cache space is eliminated by a sliding window algorithm and / or a LRU algorithm.

8. A cross-device data access device, characterized in that: Applied to an electronic device, the operating system of the electronic device includes a user space and a kernel space, the user space is arranged with an application and a FUSE network file system, the kernel space is arranged with a virtual file system, a network file system kernel driver and an eBPF module, the FUSE network file system shares a cache space with the eBPF module, and the device includes: an acquisition module, configured to acquire an operation request generated by the application, and forward the operation request to the network file system kernel driver through the virtual file system in response to the operation request; An access module, configured to call the eBPF module through the network file system kernel driver to perform a target operation on the cache space and obtain a first target operation result; the cache space is used to cache data read from other electronic devices or data written to other electronic devices; A feedback module is used to feed back the first target operation result to the application program through the virtual file system.

9. An electronic device, characterized in that: The operating system of the electronic device includes a user space and a kernel space, the user space is arranged with an application and a FUSE network file system, the kernel space is arranged with a virtual file system, a network file system kernel driver and an eBPF module, the FUSE network file system shares a cache space with the eBPF module, the electronic device also includes a memory and a processor, the memory stores a computer program, and the processor implements any one of claims 1 to 7 when executing the computer program.

10. A computer storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • File cache efficiency tracking method and device, storage medium and terminal

    CN110955486A

  • Method, electronic device and computer program product for storage management

    CN114371811A

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

    CN114860670A