Method and apparatus for optimizing file access speed of cloud application
By using the OverlayFS file system or sdcardfs file system mounting method in cloud applications, the switching between kernel state and user state is reduced, the problem of poor file access performance of cloud applications is solved, and faster file access speed is achieved.
Patent Information
- Application Number
- CN202510829238.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-06-20
AI Technical Summary
When cloud applications access files, the frequent switching between kernel mode and user mode results in poor file access performance, especially when there are many directory levels.
Use the OverlayFS file system, treat the host directory and container directory as the lower layer and upper layer respectively, and mount them through the merge layer to reduce the number of directory levels processed by the fuse file system or use the kernel-state sdcardfs file system to reduce the number of switches between user state and kernel state.
It improves the file access performance of cloud applications, reduces the number of switches between kernel mode and user mode, and increases file access speed.
Smart Images

Figure CN120336270B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud applications, and in particular to a method and device for optimizing file access speed of cloud applications. Background Art
[0002] Cloud applications (such as cloud games and cloud phones) are an emerging online application model. They place application running, rendering, and processing processes on remote cloud servers and transmit application images to user devices, allowing users to enjoy high-quality application experience on various devices without the need for high-performance hardware support.
[0003] With the development of cloud applications, mainstream companies are using containerization solutions to run Android systems and place applications in containers on cloud servers. In this solution, application data can be stored on a storage server, and by mounting the NFS network file system and using the OverlayFS file system, multiple containers can share the same application data and save their respective modifications to the application data. Alternatively, application data can be pre-placed on the host and the OverlayFS file system can be used to allow multiple containers to share the same application data and save their respective modifications to the application data, thereby saving cloud server storage space and speeding up the startup and operation of cloud applications. Commonly used file systems in the Android system include fuse and sdcardfs. The fuse file system supports data isolation between containers, while the sdcardfs file system does not. Therefore, containerization solutions generally use the fuse file system together with the OverlayFS file system. When a cloud application accesses a file in a container, the kernel's VFS file system routes the file operation request to the path under the fuse file system's mount point based on the application's permissions, and then forwards the file operation request to the fuse file system's kernel module. The kernel module passes these requests to the user-mode daemon through the character device / dev / fuse. The user-mode daemon continuously monitors the / dev / fuse device, reads file operation requests passed by the kernel module through the / dev / fuse device, converts the path in the request into the underlying actual storage path, performs file operations on the underlying actual storage path, and returns the results to the kernel through the / dev / fuse device, and finally returns them to the cloud application. During this process, the user-mode daemon needs to handle the permission verification and path conversion of each directory after the mount point layer by layer. The processing of each directory layer will trigger the switch between kernel mode and user mode. Especially when the file directory has many levels, the entire process requires frequent switching between kernel mode and user mode, resulting in poor file access performance.
[0004] Therefore, how to provide a scheme for optimizing the file access speed of a cloud application to improve the performance of the cloud application in accessing files becomes a technical problem to be solved.
[0005] The scheme in the background art is the technical concept of the applicant and does not constitute an acknowledgement of the prior art. SUMMARY
[0006] In view of the technical problems in the prior art, the embodiments of the present application provide a method and device for optimizing the file access speed of a cloud application.
[0007] In a first aspect, the embodiments of the present application provide a method for optimizing the file access speed of a cloud application, applied to a cloud server, comprising:
[0008] S10, when a fuse file system is used in a containerization scheme, taking a first directory in a host or a second directory in a container of the host as a lower layer of an OverlayFS file system, taking a third directory in the container as an upper layer of the OverlayFS file system, taking a fourth directory as a merge layer of the OverlayFS file system, and mounting the lower layer and the upper layer to the merge layer, wherein the data in the first directory is the same as the data in an external storage directory of a cloud application, the second directory is a mounting directory of the external storage directory of the cloud application in the container in a storage server, the fourth directory is a mounting point subdirectory of the fuse file system, and the bottommost directory of the fourth directory is a cloud application package name directory or a directory after the cloud application package name directory; or
[0009] S11, when an sdcardfs file system is used in a containerization scheme, taking a first directory in a host or a second directory in a container of the host as a lower layer of an OverlayFS file system, taking a fifth directory in the container as an upper layer of the OverlayFS file system, taking a sixth directory as a merge layer of the OverlayFS file system, and mounting the lower layer and the upper layer to the merge layer, wherein the data in the first directory is the same as the data in an external storage directory of a cloud application, the second directory is a mounting directory of the external storage directory of the cloud application in the container in a storage server, the sixth directory is a directory in which a cloud application package name is located or a directory after the directory in which the cloud application package name is located under a real storage directory of user media files in an Android system, the container stores an identifier of the container, a package name of the cloud application, and a user identifier UID of the cloud application when the cloud application is installed, and the sdcardfs file system does not contain a verification logic for a file system to which a path of a file accessed by the cloud application is located under a real storage directory of user media files in an Android system and a file system to which a corresponding path of the file is located.
[0010] In a second aspect, an embodiment of the present application further provides a device for optimizing file access speed of cloud applications, which is applied to a cloud server and includes:
[0011] A first mounting unit is used to, when the containerization solution adopts the fuse file system, use the first directory in the host host or the second directory in the container of the host host as the lower layer of the OverlayFS file system, use the third directory in the container as the upper layer of the OverlayFS file system, use the fourth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer, wherein the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mount directory of the external storage directory of the cloud application in the storage server in the container, the fourth directory is the mount point subdirectory of the fuse file system, and the bottom directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or
[0012] The second mounting unit is used to use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, the fifth directory in the container as the upper layer of the OverlayFS file system, and the sixth directory as the merge layer of the OverlayFS file system when the containerization solution adopts the sdcardfs file system, wherein the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mount directory of the external storage directory of the cloud application in the storage server in the container, and the sixth directory is the directory where the cloud application package name is located under the real storage directory of the user media files in the Android system or a directory after the directory where the cloud application package name is located. When the cloud application is installed in the container, the container identifier, the cloud application package name, and the cloud application user identifier UID are stored. The sdcardfs file system does not include verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system to which the corresponding path of the file accessed by the cloud application under the real storage directory belongs.
[0013] In summary, the method and device for optimizing the file access speed of cloud applications provided in the embodiments of the present application include two solutions: Solution 1 uses the fuse file system to mount the mount point subdirectory of the fuse file system as the OverlayFS file system, and the bottom directory of the mount point subdirectory of the fuse file system is the cloud application package name directory or a directory after the cloud application package name directory. In this way, when the cloud application accesses a file, the fuse file system is no longer used starting from the corresponding position of the mount point subdirectory of the fuse file system in the file path, but the OverlayFS file system is used. That is to say, compared with the existing solution using the fuse file system, Solution 1 reduces the number of directory levels processed by the fuse file system, thereby reducing the number of switches between kernel mode and user mode, thereby improving the performance of cloud application access to files; Solution 2 uses the sdcardfs file system, and the sdcardfs file system is implemented in kernel mode. Compared with the fuse file system, it can reduce the overhead of switching between user mode and kernel mode. Therefore, compared with the existing solution using the fuse file system, Solution 2 can also improve the performance of cloud application access to files. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A flowchart of an embodiment of a method for optimizing file access speed of cloud applications provided in an embodiment of the present application;
[0015] Figure 2 A schematic diagram of a structure of an embodiment of an apparatus for optimizing file access speed for cloud applications provided in an embodiment of the present application. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, 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. It should be understood that the drawings in the present application only serve the purpose of illustration and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowcharts can be implemented out of sequence, and steps without logical context can be reversed or implemented simultaneously. In addition, those skilled in the art, under the guidance of the contents of this application, can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.
[0017] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0018] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0019] Reference Figure 1 As shown, an embodiment of the present application provides a flow chart of a method for optimizing file access speed of cloud applications. The method, applied to a cloud server, includes:
[0020] S10. When the containerization solution adopts the fuse file system, the first directory in the host or the second directory in the container of the host is used as the lower layer of the OverlayFS file system, the third directory in the container is used as the upper layer of the OverlayFS file system, and the fourth directory is used as the merge layer of the OverlayFS file system. The lower layer and the upper layer are mounted to the merge layer, wherein the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mount directory of the external storage directory of the cloud application in the storage server in the container, the fourth directory is the mount point subdirectory of the fuse file system, and the bottom directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or
[0021] S11, when the containerization scheme adopts the sdcardfs file system, taking a first directory in a host host or a second directory in a container of the host host as a lower layer of an OverlayFS file system, taking a fifth directory in the container as an upper layer of the OverlayFS file system, taking a sixth directory as a merge layer of the OverlayFS file system, and mounting the lower layer and the upper layer to the merge layer, wherein data in the first directory is the same as data in an external storage directory of a cloud application, the second directory is a mounting directory of the external storage directory of the cloud application in the container in a storage server, and the sixth directory is a directory under a real storage directory of a user media file in an Android system or a directory after a directory of a package name of the cloud application in the Android system, and the container stores an identifier of the container, a package name of the cloud application, and a user identifier UID of the cloud application when the cloud application is installed in the container.
[0022] It should be noted that in step S10, when the containerization scheme uses the fuse file system, the fourth directory is used as the merge layer of the OverlayFS file system, the fourth directory is a mount point subdirectory of the fuse file system, and the bottommost directory of the fourth directory is a cloud application package name directory or a directory after the cloud application package name directory. When the cloud application accesses the file in the external storage directory, the fuse file system is still used before the position corresponding to the fourth directory in the path converted by the access path, and the fuse file system is no longer used from the position corresponding to the fourth directory, but the OverlayFS file system is used. For example, assuming that the current user is a primary user, the soft link / sdcard used to provide a unified external storage access interface points to the user's storage root directory / storage / emulated, and the directories / mnt / runtime / default / emulated, / mnt / runtime / read / emulated, and / mnt / runtime / write / emulated are mount points of the fuse file system. The system will mount the corresponding fuse file system mount point to the / storage / emulated directory through binding mounting according to the permission of the cloud application. The directory / mnt / runtime / default / emulated is a default mount point, which is used when the cloud application has no read and write permissions. The directories / mnt / runtime / read / emulated and / mnt / runtime / write / emulated are used when the cloud application has read and write permissions, respectively.Assume that a cloud application with write permission wants to access the file / sdcard / Android / data / com.xxx.xxx / files / resourse / a.txt, and the fourth directory is / mnt / runtime / write / emulated / 0 / Android / data / com.xxx.xxx, where com.xxx.xxx is the cloud application package name directory. The VFS file system will parse the symbolic link / sdcard, determine the directory / storage / emulated pointed to by / sdcard, redirect the directory / storage / emulated to the mount point / mnt / runtime / write / emulated according to the cloud application permission, convert the path / sdcard / Android / data / com.xxx.xxx / files / resourse / a.txt to the path / mnt / runtime / write / emulated / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt, and convert the file operation request (the file operation request carries the path / mnt / runtime / write / emulated / 0 / An The kernel module for the fuse file system (the relative path of "droid / data / com.xxx.xxx / files / resourse / a.txt" relative to the mount point / mnt / runtime / write / emulated, / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt) is then passed to the kernel module for the fuse file system. The kernel module then encapsulates the file operation request into a message and passes it to the user-mode daemon via the character device / dev / fuse. The user-mode daemon then performs permission checks on the 0, Android, and data directories within / mnt / runtime / write / emulated (to determine whether the cloud application has access to the corresponding directories) and performs path translation (for example, converting the directory / mnt / runtime / write / emulated / 0 / Android to / data / media / 0 / Android). Subsequent directories (com.xxx.xxx, files, and resourse) no longer use the fuse file system, but instead use the OverlayFS file system. This ultimately accesses files in the lower and upper layers, with file writes handled by the upper layer. The third directory is a specified directory, which can be empty.
[0023] In step S11, for example, assuming that the current user is the primary user, the soft link / sdcard used to provide a unified external storage access interface points to the user's storage root directory / storage / emulated, and the directories / mnt / runtime / default / emulated, / mnt / runtime / read / emulated, and / mnt / runtime / write / emulated are mount points of the sdcardfs file system. The system will mount the corresponding mount points to / storage / emulated through bind mount according to the permissions of the cloud application: the directory / mnt / runtime / default / emulated is the default mount point, which is used when the cloud application has no read and write permissions; while / mnt / runtime / read / emulated and / mnt / runtime / write / emulated are used when the cloud application has read and write permissions, respectively.In the previous example, when the cloud application accesses the file / sdcard / Android / data / com.xxx.xxx / files / resourse / a.txt, the VFS file system will parse the symbolic link / sdcard, determine the directory / storage / emulated pointed to by / sdcard, redirect the directory / storage / emulated to the mount point / mnt / runtime / write / emulated according to the cloud application permissions, convert the path / sdcard / Android / data / com.xxx.xxx / files / resourse / a.txt to the path / mnt / runtime / write / emulated / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt, and convert the file operation request (the file operation request carries the path / mnt / runtime / write / emulated / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt relative to the mount point / mnt The sdcardfs file system (the relative path / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt, which is the relative path of / 0 / Android / data / com.xxx.xxx / files / resourse / t / runtime / write / emulated) is passed to the sdcardfs file system. The sdcardfs file system (the user-mode daemon mounts / data / media / on / mnt / runtime / default / emulated during initialization, and / mnt / runtime / default / emulated on / mnt / runtime / read / emulated and / mnt / runtime / write / emulated) determines the target path / data / media / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt based on / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt and accesses the file corresponding to the target path. Ultimately, the file in the lower and upper layers is accessed, while file writing is handled in the upper layer. / data / media / 0 is the actual storage directory for user media files in the Android system. The sixth directory can be / data / media / 0 / Android / data / com.xxx.xxx. The fifth directory is a designated directory and may be an empty directory. The third directory may be the same as or different from the fifth directory.Since the sdcardfs file system does not support data isolation between containers, in this embodiment, the container identifier, the cloud application package name, and the cloud application user identifier UID are stored when the cloud application is installed in the container. In this way, even if the same cloud application is installed in different containers on the host, the data of each cloud application can be isolated through the container identifier. In addition, it should be noted that when the containerization solution adopts the sdcardfs file system, if the actual storage directory of the user media files in the Android system and the corresponding path of the file accessed by the cloud application under the actual storage directory belong to different file systems, the sdcardfs file system will report an error. In the S11 scheme, the real storage directory of user media files in the Android system (refer to the / data / media / 0 directory in the aforementioned example) belongs to the f2fs file system, and the corresponding path of the file path accessed by the cloud application under the real storage directory (refer to the / data / media / 0 / Android / data / com.xxx.xxx / files / resourse / a.txt path in the aforementioned example) belongs to the OverlayFS file system. The two are different. In order to avoid errors in the sdcardfs file system, it is necessary to modify the logic of the sdcardfs file system and remove the above-mentioned verification logic to support the OverlayFS file system. In other words, the sdcardfs file system in step S11 is a modified sdcardfs file system, and its logic does not have verification logic for the file system to which the real storage directory of user media files in the Android system belongs and the file system to which the path of the file accessed by the cloud application belongs to the corresponding path under the real storage directory.
[0024] For the first directory, you can install the cloud application on the host, and then download the files in the external storage directory (sdcard directory) in the data directory of the cloud application on the storage server to the host. The downloaded directory is the first directory; or you can mount the external storage directory (sdcard directory) in the data directory of the cloud application on the storage server to the host, and obtain the first directory by copying the files in the mounted directory to a new directory. It should be noted that this embodiment is aimed at files under the external storage directory (sdcard directory) in the data directory of the cloud application, and for the app directory (i.e., APK installation directory) in the data directory of the cloud application, the source data directory can be mounted into the container (for example, the app directory in the data directory of the cloud application in the storage server is mounted into the container, or after the cloud application is installed in the host, the files in the app directory in the data directory of the cloud application in the storage server are downloaded to the host, and the downloaded directory is mounted into the container, etc.), or the app directory in the data directory of the cloud application in the storage server can be mounted into the container, and the mounted directory is used as the lower layer, other specified directories are used as the upper layer, the app directory that the cloud application in the container accesses by default is used as the merge layer, and the lower layer and the upper layer are mounted into the merge layer; or after the cloud application is installed in the host, the files in the app directory in the data directory of the cloud application in the storage server are downloaded to the host, and Use the download directory as the lower layer, other specified directories as the upper layer, and the app directory that is accessed by default by the cloud application in the container as the merge layer, and mount the lower layer and the upper layer to the merge layer; for the data directory in the cloud application's data directory (i.e., the internal data directory), you can mount the data directory in the cloud application's data directory in the storage server into the container, and use the mounted directory as the lower layer, other specified directories as the upper layer, and the data directory that is accessed by default by the cloud application in the container as the merge layer, and mount the lower layer and the upper layer to the merge layer; or after installing the cloud application in the host, download the files in the data directory in the cloud application's data directory in the storage server to the host, and use the download directory as the lower layer, other specified directories as the upper layer, and the data directory that is accessed by default by the cloud application in the container as the merge layer, and mount the lower layer and the upper layer to the merge layer.
[0025] The method for optimizing the file access speed of cloud applications provided in an embodiment of the present application includes two schemes: Scheme 1 uses the fuse file system to mount the mount point subdirectory of the fuse file system as the OverlayFS file system, and the bottom directory of the mount point subdirectory of the fuse file system is the cloud application package name directory or a directory after the cloud application package name directory. In this way, when the cloud application accesses a file, the fuse file system is no longer used starting from the corresponding position of the mount point subdirectory of the fuse file system in the file path, but the OverlayFS file system is used. That is to say, compared with the existing scheme using the fuse file system, Scheme 1 reduces the number of directory levels processed by the fuse file system, thereby reducing the number of switching times between kernel mode and user mode, thereby improving the performance of cloud application access to files; Scheme 2 uses the sdcardfs file system, and the sdcardfs file system is implemented in kernel mode. Compared with the fuse file system, it can reduce the overhead of switching between user mode and kernel mode. Therefore, compared with the existing scheme using the fuse file system, Scheme 2 can also improve the performance of cloud application access to files.
[0026] Based on the aforementioned method embodiment, the owner of the files in the first directory or the external storage directory is a designated user identifier.
[0027] In this embodiment, it should be noted that in order for the cloud application to successfully access files, the owner of the files in the first directory or the external storage directory of the cloud application can be set to a specified user ID (the user ID is the UID of the specified cloud application and can be set as needed). In addition, the file permissions of the files in the first directory or the external storage directory of the cloud application can also be set to 0777.
[0028] Based on the above method embodiment, before step S11, the following steps may be further included:
[0029] Removed the verification logic in the sdcardfs file system for the file system to which the actual storage directory for user media files in the Android system belongs and the file system to which the corresponding path under the actual storage directory for files accessed by cloud applications belongs.
[0030] Based on the aforementioned method embodiment, the identifier of the container may include the process ID of the initialization process of the container.
[0031] Based on the aforementioned method embodiment, when the cloud application is installed in the container, the process ID of the container's initialization process can be obtained through the package_details_appid_store function of the kernel layer, the process ID of the initialization process is used as the container's identifier, the container's identifier and the package name of the cloud application are used as the key, the user identifier UID of the cloud application is used as the value, and the key and value are stored in a linked list.
[0032] In this embodiment, it should be noted that the processing logic of the package_details_appid_store function can be modified so that the package_details_appid_store function obtains the process ID of the container's initialization process, uses the process ID of the initialization process as the container's identifier, uses the container's identifier and the package name of the cloud application as the key, uses the user identifier UID of the cloud application as the value, and stores the key and the value in the linked list hashtable_entry. Obtaining the process ID of the container's initialization process includes: obtaining the namespace pid_ns of the current process in the macro current, obtaining the namespace level ns_level based on the namespace pid_ns, and if it is determined that the namespace level ns_level is greater than 0, indicating that the current process is in a container environment, then obtaining the process ID of the container's initialization process through the child_reaper member of the namespace pid_ns.
[0033] Reference Figure 2 FIG. 1 is a schematic diagram of a structure of a device for optimizing file access speed of cloud applications provided by an embodiment of the present application. The device is applied to a cloud server and includes:
[0034] The first mounting unit 20 is used to, when the containerization solution adopts the fuse file system, use the first directory in the host host or the second directory in the container of the host host as the lower layer of the OverlayFS file system, use the third directory in the container as the upper layer of the OverlayFS file system, use the fourth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer, wherein the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mount directory of the external storage directory of the cloud application in the storage server in the container, the fourth directory is the mount point subdirectory of the fuse file system, and the bottom directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or
[0035] The second mounting unit is used to use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, the fifth directory in the container as the upper layer of the OverlayFS file system, and the sixth directory as the merge layer of the OverlayFS file system when the containerization solution adopts the sdcardfs file system, wherein the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mount directory of the external storage directory of the cloud application in the storage server in the container, and the sixth directory is the directory where the cloud application package name is located under the real storage directory of the user media files in the Android system or a directory after the directory where the cloud application package name is located. When the cloud application is installed in the container, the container identifier, the cloud application package name, and the cloud application user identifier UID are stored. The sdcardfs file system does not include verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system to which the corresponding path of the file accessed by the cloud application under the real storage directory belongs.
[0036] The device for optimizing the file access speed of cloud applications provided in an embodiment of the present application includes two schemes: Scheme 1 uses the fuse file system to mount the mount point subdirectory of the fuse file system as the OverlayFS file system, and the bottom directory of the mount point subdirectory of the fuse file system is the cloud application package name directory or a directory after the cloud application package name directory. In this way, when the cloud application accesses a file, the fuse file system is no longer used starting from the corresponding position of the mount point subdirectory of the fuse file system in the file path, but the OverlayFS file system is used. That is to say, compared with the existing scheme using the fuse file system, Scheme 1 reduces the number of directory levels processed by the fuse file system, thereby reducing the number of switching times between kernel mode and user mode, thereby improving the performance of cloud application access to files; Scheme 2 uses the sdcardfs file system, and the sdcardfs file system is implemented in kernel mode. Compared with the fuse file system, it can reduce the overhead of switching between user mode and kernel mode. Therefore, compared with the existing scheme using the fuse file system, Scheme 2 can also improve the performance of cloud application access to files.
[0037] Based on the aforementioned device embodiment, the owner of the files in the first directory or the external storage directory is a designated user identifier.
[0038] Based on the aforementioned device embodiment, the second mounting unit may also be used for:
[0039] Removed the verification logic in the sdcardfs file system for the file system to which the actual storage directory for user media files in the Android system belongs and the file system to which the corresponding path under the actual storage directory for files accessed by cloud applications belongs.
[0040] Based on the aforementioned device embodiment, the identifier of the container may include a process ID of the initialization process of the container.
[0041] Based on the aforementioned device embodiment, when a cloud application is installed in a container, the process ID of the container's initialization process can be obtained through the package_details_appid_store function of the kernel layer, the process ID of the initialization process is used as the container's identifier, the container's identifier and the package name of the cloud application are used as the key, the user identifier UID of the cloud application is used as the value, and the key and value are stored in a linked list.
[0042] The device for optimizing the file access speed of cloud applications provided in the embodiment of the present application has an implementation process that is consistent with the method for optimizing the file access speed of cloud applications provided in the embodiment of the present application, and the effect that can be achieved is also the same as the method for optimizing the file access speed of cloud applications provided in the embodiment of the present application, and will not be repeated here.
[0043] The above are only specific embodiments of the present application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A method for optimizing file access speed of cloud applications, applied to a cloud server, characterized in that: include: S10. When the containerization solution adopts the fuse file system, the first directory in the host or the second directory in the container of the host is used as the lower layer of the OverlayFS file system, the third directory in the container is used as the upper layer of the OverlayFS file system, and the fourth directory is used as the merge layer of the OverlayFS file system. The lower layer and the upper layer are mounted to the merge layer, wherein the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mount directory of the external storage directory of the cloud application in the storage server in the container, the fourth directory is the mount point subdirectory of the fuse file system, and the bottom directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or S11. When the containerization solution adopts the sdcardfs file system, the first directory in the host or the second directory in the container of the host is used as the lower layer of the OverlayFS file system, the fifth directory in the container is used as the upper layer of the OverlayFS file system, and the sixth directory is used as the merge layer of the OverlayFS file system. The lower layer and the upper layer are mounted to the merge layer, wherein the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mount directory of the external storage directory of the cloud application in the storage server in the container, and the sixth directory is the directory where the cloud application package name is located under the real storage directory of the user media files in the Android system, or a directory after the directory where the cloud application package name is located. When the cloud application is installed in the container, the container identifier, the cloud application package name, and the cloud application user identifier UID are stored. The sdcardfs file system does not include verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system to which the corresponding path of the file accessed by the cloud application under the real storage directory belongs.
2. The method according to claim 1, wherein The owner of the files in the first directory or the external storage directory is the specified user ID.
3. The method according to claim 1, wherein Before step S11, the method further includes: Removed the verification logic in the sdcardfs file system for the file system to which the actual storage directory for user media files in the Android system belongs and the file system to which the corresponding path under the actual storage directory for files accessed by cloud applications belongs.
4. The method according to claim 1, wherein The container's identifier includes the process ID of the container's initialization process.
5. The method according to claim 4, wherein When the cloud application is installed in the container, the process ID of the container's initialization process is obtained through the package_details_appid_store function of the kernel layer. The process ID of the initialization process is used as the container's identifier, the container's identifier and the package name of the cloud application are used as the key, the user identifier UID of the cloud application is used as the value, and the key and value are stored in a linked list.
6. A device for optimizing file access speed of cloud applications, applied to a cloud server, characterized in that: include: A first mounting unit is used to, when the containerization solution adopts the fuse file system, use the first directory in the host host or the second directory in the container of the host host as the lower layer of the OverlayFS file system, use the third directory in the container as the upper layer of the OverlayFS file system, use the fourth directory as the merge layer of the OverlayFS file system, and mount the lower layer and the upper layer to the merge layer, wherein the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mount directory of the external storage directory of the cloud application in the storage server in the container, the fourth directory is the mount point subdirectory of the fuse file system, and the bottom directory of the fourth directory is the cloud application package name directory or a directory after the cloud application package name directory; or The second mounting unit is used to use the first directory in the host or the second directory in the container of the host as the lower layer of the OverlayFS file system, the fifth directory in the container as the upper layer of the OverlayFS file system, and the sixth directory as the merge layer of the OverlayFS file system when the containerization solution adopts the sdcardfs file system, wherein the data in the first directory is the same as the data in the external storage directory of the cloud application, the second directory is the mount directory of the external storage directory of the cloud application in the storage server in the container, and the sixth directory is the directory where the cloud application package name is located under the real storage directory of the user media files in the Android system or a directory after the directory where the cloud application package name is located. When the cloud application is installed in the container, the container identifier, the cloud application package name, and the cloud application user identifier UID are stored. The sdcardfs file system does not include verification logic for the file system to which the real storage directory of the user media files in the Android system belongs and the file system to which the corresponding path of the file accessed by the cloud application under the real storage directory belongs.
7. The device according to claim 6, characterized in that The owner of the files in the first directory or the external storage directory is the specified user ID.
8. The device according to claim 6, wherein The second mounting unit is further configured to: Removed the verification logic in the sdcardfs file system for the file system to which the actual storage directory for user media files in the Android system belongs and the file system to which the corresponding path under the actual storage directory for files accessed by cloud applications belongs.
9. The device according to claim 6, wherein The container's identifier includes the process ID of the container's initialization process.
10. The device according to claim 9, wherein When the cloud application is installed in the container, the process ID of the container's initialization process is obtained through the package_details_appid_store function of the kernel layer. The process ID of the initialization process is used as the container's identifier, the container's identifier and the package name of the cloud application are used as the key, the user identifier UID of the cloud application is used as the value, and the key and value are stored in a linked list.
Citation Information
Patent Citations
Shared file operation method and device for Linux compatible Android system
CN113986858A
Optimization method and device for copy-on-write mechanism of file system
CN119293009A
Method and device for optimizing starting speed of cloud application
CN119376819A