A data processing method and apparatus
By directly interfacing with the virtual file system through the container interface layer, intercepting and parsing data processing requests, the overhead and latency issues caused by kernel access in Docker containers are resolved, enabling efficient data processing in full user space.
Patent Information
- Application Number
- CN202210527954.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-16
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-05-16
AI Technical Summary
In Docker containers, existing technologies suffer from kernel access overhead and latency issues during data processing, especially when Guest I/O submissions require kernel access to the file system, leading to increased overhead such as data copying and context switching.
By directly interfacing with the virtual file system through the container interface layer, data processing requests are intercepted and parsed, and sent directly to the virtual file system, avoiding kernel access and enabling full-user-space data processing.
It reduces resource overhead and processing latency, improves data processing efficiency, and reduces kernel access overhead and latency.
Smart Images

Figure CN114911574B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, more particularly, to a data processing method and device. BACKGROUND
[0002] Docker container is an open source application container engine, which allows developers to package their applications and dependent packages into a portable container, and then publish them on any server with Docker engine installed, for example, including any popular Linux machine or Windows machine, and also can realize virtualization. Containers are completely using sandbox mechanism, and there is no interface between each other, which can be easily run on machines and data centers.
[0003] The vhostuser scheme of the storage performance development kit (SPKD) is the latest evolution scheme at present, and through the polling mode driver in the user mode, a full user mode and end-to-end I / O stack can be realized. In virtualization, the virtual machine exit (VM_EXIT) is a relatively large overhead, and the vhost user scheme can eliminate the VM_EXIT overhead when the guest I / O is submitted, and through the user mode I / O polling, the central processing unit (CPU) context overhead can be reduced. However, when the guest I / O is submitted, the kernel needs to access the file system, and there are still overheads such as data copying and context switching, and there are also problems such as long path and increased delay. SUMMARY
[0004] Therefore, the present application provides the following technical solutions:
[0005] A data processing method applied to a container interface layer, the container interface layer being directly connected to a virtual file system, the virtual file system being a file system in the user mode corresponding to a storage disk of a container, and the method comprising:
[0006] In response to receiving a data processing request, the data processing request is parsed to obtain a parsing result;
[0007] Based on the parsing result, the data processing request is sent to the virtual file system, so that the virtual file system performs a processing operation matched with the data processing request in the storage disk corresponding to the container.
[0008] Optionally, based on the parsing result, the data processing request is sent to the virtual file system, comprising:
[0009] If the analysis result is a transparent directory for a storage disk file system, send the data processing request to the virtual file system;
[0010] If the analysis result is analysis information for configuration information acquisition of a container process, send the data processing request to an operating system to enable the operating system to perform an operation matched with the data processing request.
[0011] Optionally, the sending of the data processing request to the virtual file system comprises:
[0012] Obtaining configuration information of the container interface layer;
[0013] Based on the configuration information of the container interface layer, sending the data processing request to a virtual file system.
[0014] A data processing method applied to a virtual file system, an interface of the virtual file system being connected with a container interface layer, the virtual file system being capable of mapping a processing operation to a storage disk corresponding to a container, the method comprising:
[0015] In response to receiving a data processing request, determining a target operation corresponding to the data processing request;
[0016] Based on the target operation and initial file index information corresponding to a storage disk, determining target file index information;
[0017] Based on the target file index information, performing the target operation on the storage disk.
[0018] Optionally, the target operation comprises a file creation operation, wherein the determining of the target file index information based on the target operation and initial file index information corresponding to a storage disk comprises:
[0019] Based on the file creation operation, determining path information of a file to be created;
[0020] Based on the path information of the file to be created and initial file index information corresponding to the storage disk, determining target file index information, the target file index information comprising storage block information of the file to be created in the storage disk and index level node information.
[0021] Optionally, the target operation comprises a file writing operation, wherein the determining of the target file index information based on the target operation and initial file index information corresponding to a storage disk comprises:
[0022] Based on the file writing operation, determining a writing path corresponding to a file to be written;
[0023] determining a storage block to be written based on the write path and initial file index information corresponding to the storage disk;
[0024] if a storage size of the storage block to be written meets a size of the file to be written, determining index information corresponding to the storage block as target file index information;
[0025] if the size of the storage block to be written does not meet the size of the file to be written, determining index information of a target storage block in the storage disk that meets the file to be written as the target file index information.
[0026] Optionally, the target operation includes a read file operation, and the determining of the target file index information based on the target operation and initial file index information corresponding to the storage disk includes:
[0027] determining path information of a read file based on the read file operation;
[0028] determining target file index information based on the path information of the read file and initial file index information corresponding to the storage disk.
[0029] Optionally, the performing of the target operation on the storage disk based on the target file index information includes:
[0030] obtaining attribute information of the storage disk;
[0031] determining connection configuration information of the storage disk and the virtual file system based on the attribute information;
[0032] performing the target operation on the storage disk based on the connection configuration information and the target file index information.
[0033] A data processing apparatus applied to a container interface layer, the container interface layer being directly connected to a virtual file system, the virtual file system being a user-mode file system corresponding to a storage disk of a container, and the apparatus comprising:
[0034] a parsing unit configured to, in response to receiving a data processing request, parse the data processing request to obtain a parsing result;
[0035] a sending unit configured to, based on the parsing result, send the data processing request to the virtual file system, so that the virtual file system performs a processing operation matched with the data processing request in a storage disk corresponding to a container.
[0036] A data processing apparatus applied to a virtual file system, an interface of the virtual file system being connected to a container interface layer, and the virtual file system being capable of mapping a processing operation to a storage disk corresponding to a container, and the apparatus comprising:
[0037] a first determining unit, configured to determine a target operation corresponding to the data processing request in response to receiving the data processing request;
[0038] a second determining unit, configured to determine target file index information based on the target operation and initial file index information corresponding to the storage disk;
[0039] an operating unit, configured to perform the target operation on the storage disk based on the target file index information.
[0040] According to the technical solution described above, the present application discloses a data processing method and device, which connects a virtual file system to a container. When a container interface layer receives a data processor request, the data processing request is analyzed and sent to the virtual file system. The target operation corresponding to the data processing request and the target file index information are determined through the virtual file system. The virtual file system performs the target operation on the storage disk based on the target file index information. The processing operation can be mapped to the storage disk corresponding to the container through the virtual file system. Full user mode access can be realized. The kernel overhead is eliminated in the data processing request process, and the resource overhead and processing delay are reduced. BRIEF DESCRIPTION OF DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of the provided drawings.
[0042] Figure 1 A flowchart of a data processing method applied to a container interface layer is provided for the embodiments of the present application.
[0043] Figure 2 A flowchart of a data processing method applied to a virtual file system is provided for the embodiments of the present application.
[0044] Figure 3 A schematic diagram of an application scenario is provided for the embodiments of the present application.
[0045] Figure 4 A structural schematic diagram of a data processing device applied to a container interface layer is provided for the embodiments of the present application.
[0046] Figure 5 A structural schematic diagram of a data processing device applied to a virtual file system is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0047] With reference to the drawings and the embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0048] Docker container is an open source application container engine, which can package applications and dependent packages in a unified manner into a portable container, and then publish to any server installed with docker engine (including popular Linux machines, windows machines), and also can realize virtualization. The data processing method provided in the embodiments of the present application realizes the user mode virtual file system, connects the virtual file system to the Docker container, converts the file system request of the container into a block request in the user mode, and sends the request to the storage server through the related interface, so that the storage server performs the operation corresponding to the request on the storage disk.
[0049] In order to realize the connection between the container and the virtual file system, a container interface layer is generated in the embodiments of the present application, so that the container interface layer is connected with the API (Application Programming Interface, application programming interface) layer of the virtual file system, the original data processor request of the container for the storage disk is intercepted and sent subsequently.
[0050] Referring to Figure 1 A flowchart of a data processing method applied to a container interface layer is provided in the embodiments of the present application, and the container interface layer is directly connected with a virtual file system. The virtual file system is a user mode file system corresponding to the storage disk of the container, and also can be a user mode file system corresponding to the storage server of the container. Specifically, the method can include the following steps:
[0051] S101, in response to receiving a data processing request, analyzing the data processing request to obtain an analysis result.
[0052] The data processing request is a file request accessed by the Docker container, for example, one of a new file request, a write file request or a read file request for the storage disk corresponding to the Docker container.
[0053] In the embodiment of the present application, after the container receives the data processing request, instead of accessing the kernel-mode file system through the kernel via the operating system and then accessing the storage disk, the container interface layer intercepts and analyzes the data processing request. If the data processing request is a file operation request for the storage disk corresponding to the container, the data processing request is directly transmitted to the virtual file system without passing through the kernel file system.
[0054] In the analysis of the request field in the data processing request, it is determined whether the data processing request is a transparent directory or configuration information of an operation process, so as to obtain an analysis result, and facilitate subsequent sending of the data processing request based on the analysis result.
[0055] S102, based on the analysis result, the data processing request is sent to the virtual file system, so that the virtual file system executes a processing operation matched with the data processing request in the storage disk corresponding to the container.
[0056] Based on the analysis result, it is determined whether the data processing request is a file request accessed by the Docker container. If so, the data processing request is sent to the virtual file system. If not, the data processing request can be processed according to the pre-set operation process.
[0057] In an embodiment, based on the analysis result, the data processing request is sent to the virtual file system, including: if the analysis result is a transparent directory for the storage disk file system, the data processing request is sent to the virtual file system; if the analysis result is analysis information for configuration information acquisition of the container process, the data processing request is sent to the operating system, so that the operating system executes an operation matched with the data processing request.
[0058] The transparent directory refers to a file request for the storage disk, that is, the directory structure of the original file index of the storage disk needs to be changed by the operation corresponding to the data processing request. If the analysis result is analysis information for configuration information acquisition of the container process, it means that the configuration information required during normal operation of the container or execution of some container processes of the container, such as interface configuration information, operation flow configuration information, and communication configuration information.
[0059] Specifically, the file rule manager can be accessed through the container interface layer to analyze the data processing request based on the rule information stored in the file rule manager. Since the data processing request intercepted by the container interface layer is a file operation request for accessing the Docker container, the file can be a transparent directory or some file information required for running the Docker container. In order to realize the access of the full-user-mode file system, the container interface layer mainly intercepts the transparent directory, and therefore the file rule manager can mainly configure a custom rule based on the actual application scenario, which is used to determine whether the data processing request is sent to the virtual file system, i.e., whether the data processing request is forwarded according to the operation or directly transmitted according to the original operation process based on the rule information in the file rule manager. The original operation process refers to processing the data processing request through the operating system, i.e., accessing the kernel-mode file system through the operating system, and then operating the storage disk by the kernel-mode file system.
[0060] In an implementation manner of the embodiment of the present application, the data processing request can be sent according to the feature information of the container interface layer to ensure the sending efficiency and accuracy of the data processing request. Specifically, sending the data processing request to the virtual file system includes: obtaining configuration information of the container interface layer; and sending the data processing request to the virtual file system based on the configuration information of the container interface layer.
[0061] The configuration information of the container interface layer includes functional configuration information of the container interface layer that can be connected to the virtual file system interface layer, such as mounting configuration information and interface parameter configuration information. Specifically, the container interface layer can be connected to the virtual file system through a dynamic library or an independent process. For example, the Docker process can be connected by modifying the environment variable of the interface layer (such as modifying the environment variable through the LD_PERLOAD method), the data processing request is filtered, if it is a specified transparent directory, it is forwarded to the interface layer of the virtual file system, otherwise it is directly operated according to the original configuration rule. The memory image of the file of the Docker container process can also be obtained, the import interface of the kernel-mode file system is obtained, and the import interface of the kernel-mode file system is modified to the interface information of the container interface layer. The file system operation of the Docker container can also be taken over by the interface process to be transferred to the container interface layer. Therefore, the container interface layer can send the data processing request to the virtual file system based on the above configuration information.
[0062] In the embodiment of the present application, the data processing request can be intercepted and analyzed by the container interface layer, and the data processing request can be sent to the user-mode virtual file system based on the analysis result, without passing through the kernel-mode file system to access the corresponding storage server or storage disk, thereby reducing the overhead and delay.
[0063] In order to better connect the storage server or the storage disk through the virtual file system, the operation corresponding to the virtual file system can be configured, and the operation of the storage disk through the block interface by the virtual file system is completed.
[0064] Specifically, referring to Figure 2 A flowchart of a data processing method applied to a virtual file system is provided in the embodiment of the present application, wherein the interface of the virtual file system is connected with the container interface layer, the virtual file system can map the processing operation to the storage disk corresponding to the container, and specifically, the method can include the following steps:
[0065] S201, in response to receiving a data processing request, determining a target operation corresponding to the data processing request.
[0066] The data processing request can be parsed through the API layer of the virtual file system to obtain the processing requirement information of the data processing request for the file, and the target operation is determined according to the processing requirement information. The target operation can include a file creation operation, an opening operation, a directory update operation, a file reading operation or a file writing operation for the disk or the storage disk.
[0067] S202, determining target index information based on the target operation and the initial file index information corresponding to the storage disk.
[0068] The initial file index information corresponding to the storage disk can represent the structure information of the original file in the storage disk, such as the hierarchical structure, the dependent structure or the space information of the space of the original file. The target operation can be an operation for a file. If it is a file creation operation, the position information of the newly created file in the storage disk can be determined, and then the target file index information is determined according to the position information and the initial file index information. The position of the newly created file can be determined through the target file index information, so as to facilitate the subsequent operation of the storage disk.
[0069] S103, performing the target operation on the storage disk based on the target file index information.
[0070] Based on the determined target file index information, the operation area corresponding to the data processing request in the storage disk is determined, and the file creation or writing is performed in the operation area. The file reading can also be performed on the file in the operation area.
[0071] In the embodiment of the present application, the virtual file system is connected with the container, the virtual block device is converted into a file system interface service, the file system request of the upper layer is converted into a corresponding block interface of the lower layer, the user state access is realized, and the overhead and delay are reduced.
[0072] The data processing method applied to the virtual file system in the embodiments of the present application is described below with different target operations.
[0073] In an embodiment, the target operation includes a create file operation, wherein the target file index information is determined based on the target operation and the initial file index information corresponding to the storage disk, including:
[0074] The path information of the created file is determined based on the create file operation.
[0075] The target file index information is determined based on the path information of the created file and the initial file index information corresponding to the storage disk, wherein the target index information includes the storage block information of the file to be created in the storage disk and the index level node information.
[0076] Based on the path information of the created file and the initial file index information corresponding to the storage disk, the location where the newly created file is stored can be determined, and the related information of the parent directory or the subdirectory corresponding to the modified initial file index information.
[0077] In another embodiment, the target operation includes a write file operation, and the target file index information is determined based on the target operation and the initial file index information corresponding to the storage disk, including: determining the write path corresponding to the file to be written based on the write file operation; determining the storage block to be written based on the write path and the initial file index information corresponding to the storage disk; if the storage size of the storage block to be written meets the size of the file to be written, the index information corresponding to the storage block is determined as the target file index information; if the size of the storage block to be written does not meet the size of the file to be written, the index information of the target storage block in the storage disk that meets the file to be written is determined as the target file index information.
[0078] The size of the file to be written and the corresponding write path can be analyzed by the processing module in the virtual file system, so as to further determine whether the size of the storage block corresponding to the write path meets the size of the file to be written, if it meets, it is directly written, if it does not meet, the corresponding storage area needs to be determined, and the target file index information is obtained by updating the file index information. The storage space allocation is realized through the virtual file system, and further the file metadata and data can be organized, managed and recycled.
[0079] In another embodiment, the target operation operation includes a read file operation, and the target index information is determined based on the target operation and the initial file index information corresponding to the storage disk, including: determining path information of the read file based on the read file operation; and determining the target file index information based on the path information of the read file and the initial file index information corresponding to the storage disk. The target file index information includes whether the read file changes the initial file index information, and if yes, the initial file index information is updated to obtain the target file index information. If not, only the index information in the initial file index information is marked, such as changing from an unread state to a read state.
[0080] Since the storage disk corresponding to the container can be a local storage disk or a network storage disk, the interface layer corresponding to the virtual file system can also connect a local storage disk and can also be a network storage disk. Therefore, when the storage disk is operated through the virtual file system, the corresponding interface needs to be called according to the characteristics of the storage disk corresponding thereto, such as whether it is a local interface or a network interface. Specifically, the target operation is performed on the storage disk based on the file index information, including: obtaining attribute information of the storage disk, determining connection configuration information of the storage disk and the virtual file system based on the attribute information; and performing the target operation on the storage disk based on the connection configuration information and the target file index information.
[0081] The attribute information of the storage disk can include size information, interface configuration information and location information of the storage disk. For example, according to the interface configuration information, it can be determined whether the storage disk is a local storage disk or a network storage disk. When there are different attributes, the virtual file operating system can also perform the target operation corresponding thereto based on different interfaces or processing processes, such as a network storage disk, which can be accessed by the virtual file system through a network interface layer.
[0082] In order to realize the processing flow of the container interface layer and the virtual file system, the main service module connecting the container interface layer and the virtual file system can also be included in the embodiment of the present application, which is a process entity supporting the running of each module, running in a user state, and can also be a component, directly built-in and distributed in a software process of a virtualized storage and a distributed storage.
[0083] Correspondingly, the interface layer in the virtual file system corresponds to a block storage module, which can be a client. Specifically, the block storage client is used to connect a logical volume of a network storage, which can be a private interface or a user-mode client of a vhost (virtual host). The client is used to connect a local vhost target as needed and abstract the module into a block device in memory to provide block device-related interfaces. The client can also be a user-mode client of NVMe-oF (NVMe over Fabric). The client is used to connect a remote NVMe-oF target as needed and abstract the module into a block device in memory to provide block device-related interfaces and provide block service interfaces, including capacity, read, and write operations, and the like.
[0084] Correspondingly, a communication module is arranged on an execution subject of the virtual file system, such as a server. The communication module is used to connect the virtual file system and the container interface layer and other parts. When they are in the same process, they can be directly called by functions. When they are not in the same process, they can interact with each other through shared memory.
[0085] In the embodiments of the present application, the virtual file system can include a virtual file system API layer, which mainly determines a target operation corresponding to a data processing request. The target operation includes file creation, file opening, file index directory updating, reading a file, or writing a file. The virtual file system can also include a file system space allocator, which is used to organize, manage, and recycle file metadata and data. It can also include a file system index, which is used to index the structure of a file. B-tree and hash value can be used to implement file retrieval, enumeration, opening, and other operations as well as mapping from a required file descriptor to a file path.
[0086] Referring to Figure 3 A scenario application schematic diagram is provided for the embodiments of the present application. In the application scenario, an application program (APP) is included, which is an application program in a container. When the application program in the container operates a file system, a request is converted into a user-mode block request, which is an access request or an operation request for a certain storage block area in a storage disk. The block request can be directly connected to the storage disk through an interface of the storage disk to perform related operations on the storage disk. Correspondingly, to execute the application program, a container, a virtual file system, and an interface corresponding to a storage disk are required. In the Figure 3 The left side is a storage disk, which is a network storage disk, such as a storage area network (SAN) connected to a network interface (NIC). The storage disk is accessed in the storage area network. In the Figure 3The right storage disk is a local storage disk connected to the current storage disk (e.g., NVMe, non-volatile memory storage disk) through a local storage interface. The local virtual storage volume or remote NVMe-oF server is connected to the Docker container through the container interface layer and the virtual file system, so that the application in the container does not need to pass through the host kernel when operating the file system, thereby reducing the overhead and delay.
[0087] Taking the file creation process as an example, when a user creates a file in a Docker container, the Docker process performs a creation operation according to the user request in the original corresponding file system API layer. In the embodiment of the present application, the container interface layer intercepts the creation operation of the Docker process, and according to the file rule, if it is not a directory, it is passed according to the original logic, otherwise it is passed to the virtual file system layer. The container interface layer and the virtual file system can also include an inter-process communication module, which is used to realize the communication between the Docker process and the corresponding module process. The virtual file system creates a file index according to the file path, and when creating the index, it includes allocating a corresponding logical block through a space allocator, and writing the index information to the logical block of the lower block storage logic. The index of the file system includes the traditional index information, and also includes the KV (Key-Value) record of the KV system. The logical block can be a disk sector, and the file node is created through the index method, and the directory table of the parent directory can also be modified. The modification of the created logical block and the modification of the corresponding parent directory table are written to the lower block storage device through the block storage protocol. The lower block storage device is a logical user-mode block storage, which can be a private read-write interface or a Nvme-of user-mode client. If it is a private read-write interface, the block storage write interface is directly called for writing; if it is a Nvme-of network user-mode client, it also includes writing data to the remote Nvme-of server through remote operation. At the same time, it can also be a local storage disk, and if it is a local storage disk, it also includes writing to the local disk through the user-mode driver of the local storage disk; it can also be a vhost client, and the vhost interface is used to write to the vhost server. After writing is completed, the memory file system index is established to correspond the file descriptor to the file path.
[0088] Correspondingly, the file writing process includes: before writing a file in the Docker container, the user needs to create or open an existing file, and the creation process is as described above; when opening the file, the Docker process sends a request to the interface layer of the application to determine whether the directory is a transparent directory, and if so, the opening operation is performed through the virtual file system, and the file index is established. The user performs a write operation on the file in the container, and the Docker container sends a request to the container interface layer through the API layer according to the user's request. Since the read-write file interface itself only has a file descriptor, but no file name or path, it is necessary to query according to the above index to obtain the file path when the file is created or opened, and use the path and the rule manager to determine whether to be transparent to the file system. If the write request is passed to the virtual file system layer, if the write position exceeds the file size, the file expansion operation may also be performed, and the logical space is allocated to the file through the file space allocator. When the write operation is performed, the offset and length of the write operation are converted into the logical block address of the block storage, the requested data buffer is written to the converted logical block address through the interface of the lower layer block storage, and the subsequent write process is the same as the file creation process in the above example.
[0089] Correspondingly, the embodiments of the application can also be applied in the application scenario of network storage, using the vhost interface as the storage volume export protocol, deploying a dual-node hyper-converged, that is, each server is both a storage server and a computing node of the Docker container, and the storage medium uses a local NVMe disk.
[0090] In this application scenario, the storage process logically divides the local node and the remote node NVMe disk in a software-defined storage manner, creates a logical volume in the form of a copy, and exports it through a block interface. The block interface includes basic block access commands, such as reading, writing, and obtaining capacity. The virtual file system is used to organize the block storage in the form of a file, as described above, and converts the file operation request into a block operation request. The container attachment module uses a dynamic library (.so) manner. The upper layer of the module is used to interface with the Docker container, and the lower layer interfaces with the logical volume interface of the storage process. When starting the Docker container, it is attached to the Docker container by modifying the environment variable, and all file system APIs are intercepted, including opening, creating, writing, reading, etc. Since the Docker process also needs to access the system and some files itself, rules need to be added. When the directory and file of the operation belong to a transparent directory, the file system API request is forwarded to the virtual file system, otherwise it is directly executed in the original execution manner. The communication between the above three modules can be API direct call (same process), or inter-process communication through shared memory.
[0091] When the user accesses the transparent file directory using the Docker container, the actual operation is the directory of the virtual file system, such as creating a file, that is, creating a file index (such as inode) in the virtual file system and writing to the logical volume. When writing a file, the traditional writing method is to call the file system (vfs) module of the Linux system kernel through an API, and a series of conversions are performed to finally write data to the local machine through the network interface. In the embodiment of the application, the file system writing operation is directly performed on the logical volume through the virtual file system operation, so as to be directly written to the local NVMe disk. The local NVMe disk can be written through the user mode technology of SPDK (Storage performance development kit, an application software acceleration library for using NVMe SSD as a backend storage), without passing through the kernel, thereby greatly reducing the overhead.
[0092] Referring to Figure 4 A structural schematic diagram of a data processing apparatus applied to a container interface layer is provided in the embodiment of the application. The apparatus comprises:
[0093] The parsing unit 401 is configured to parse the data processing request to obtain a parsing result in response to receiving the data processing request.
[0094] The sending unit 402 is configured to send the data processing request to the virtual file system based on the parsing result, so that the virtual file system performs a processing operation matched with the data processing request in the storage disk corresponding to the container.
[0095] In an embodiment, the sending unit comprises:
[0096] The first sub-sending unit is configured to send the data processing request to the virtual file system if the parsing result is a transparent directory of the storage disk file system.
[0097] The second sub-sending unit is configured to send the data processing request to the operating system if the parsing result is parsed information of configuration information acquisition of the container process, so that the operating system performs an operation matched with the data processing request.
[0098] Optionally, the sending unit is specifically configured to:
[0099] Obtain the configuration information of the container interface layer.
[0100] Send the data processing request to the virtual file system based on the configuration information of the container interface layer.
[0101] Referring to Figure 5In the embodiments of the present application, a data processing device applied to a virtual file system is also provided, which can include:
[0102] A first determining unit 501 is configured to determine a target operation corresponding to a data processing request in response to receiving the data processing request;
[0103] A second determining unit 502 is configured to determine target file index information based on the target operation and initial file index information corresponding to a storage disk;
[0104] An operation unit 503 is configured to perform the target operation on the storage disk based on the target file index information.
[0105] In an embodiment, when the target operation in the first determining unit includes a file creation operation, the second determining unit is specifically configured to:
[0106] determine path information of a file to be created based on the file creation operation;
[0107] determine target file index information based on the path information of the file to be created and initial file index information corresponding to the storage disk, the target file index information including storage block information of the file to be created in the storage disk and index level node information.
[0108] In an embodiment, when the target operation in the first determining unit includes a file writing operation, the second determining unit is specifically configured to:
[0109] determine a writing path corresponding to a file to be written based on the file writing operation;
[0110] determine a storage block to be written based on the writing path and initial file index information corresponding to the storage disk;
[0111] if a storage size of the storage block to be written meets a size of the file to be written, determine index information corresponding to the storage block as the target file index information;
[0112] if the size of the storage block to be written does not meet the size of the file to be written, determine index information of a target storage block in the storage disk that meets the file to be written as the target file index information.
[0113] In another embodiment, when the target operation in the first determining unit includes a file reading operation, the second determining unit is specifically configured to:
[0114] determine path information of a file to be read based on the file reading operation;
[0115] Determine target file index information based on the path information of the read file and initial file index information corresponding to the storage disk.
[0116] In an embodiment, the operation unit is specifically configured to:
[0117] Obtain attribute information of the storage disk.
[0118] Determine connection configuration information of the storage disk and the virtual file system based on the attribute information.
[0119] Perform the target operation on the storage disk based on the connection configuration information and the target file index information.
[0120] It should be noted that the specific implementation of each unit and sub-unit in the present embodiment can refer to the corresponding content in the foregoing, which will not be described in detail here.
[0121] In another embodiment of the present application, a readable storage medium is also provided, which stores a computer program. When the computer program is executed by a processor, each step of the data processing method according to any one of the above embodiments is implemented.
[0122] In another embodiment of the present application, an electronic device is also provided, which can include:
[0123] A memory is configured to store an application program and data generated by running of the application program.
[0124] A processor is configured to execute the application program to implement the data processing method according to any one of the above embodiments.
[0125] It should be noted that the specific implementation of the processor in the present embodiment can refer to the corresponding content in the foregoing, which will not be described in detail here.
[0126] The embodiments in the present specification are described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same or similar parts of each embodiment can be referred to each other. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the related parts can be referred to the method part.
[0127] Those skilled in the art will further appreciate that the units and algorithms described in connection with the examples disclosed herein can be embodied directly in hardware, in software, or in a combination of the two. For the sake of brevity, descriptions of these alternatives are not provided herein. Those skilled in the art will understand that the functions explained herein below can be implemented in software in combination with the underlying computer hardware, for example, implemented in a combination of software and hardware and / or in software as methods and / or instructions and / or data.
[0128] The steps of a method or algorithm described in connection with the examples disclosed herein can be embodied directly in hardware, in software, or in a combination of the two. Software
[0129] The above description discloses only specific embodiments of the application. The application is not limited to these embodiments. Many variations that will be obvious to those having ordinary skill in the art are possible and encompassed by the scope of the appended claims. Therefore, the scope of the application is not to be determined by the foregoing description but only by a set of claims.
Claims
1. A data processing method applied to a container interface layer, wherein the container interface layer is directly connected to a virtual file system, the virtual file system being a user-mode file system corresponding to the container's storage disk, the method comprising: In response to the container receiving a data processing request, the data processing request is intercepted and parsed to obtain the parsing result; Based on the parsing result, the data processing request is sent to the virtual file system, so that the virtual file system performs a processing operation matching the data processing request in the storage disk corresponding to the container; wherein, if the parsing result is a pass-through directory for the storage disk file system, without going through the kernel-mode file system, the data processing request is sent directly to the virtual file system.
2. The method according to claim 1, wherein sending the data processing request to the virtual file system based on the parsing result further comprises: If the parsing result is parsing information obtained from the configuration information of the container process, the data processing request is sent to the operating system so that the operating system performs an operation that matches the data processing request.
3. The method according to claim 1, wherein sending the data processing request to the virtual file system comprises: Obtain the configuration information of the container interface layer; Based on the configuration information of the container interface layer, the data processing request is sent to the virtual file system.
4. A data processing method applied to a virtual file system, wherein the interface of the virtual file system is connected to a container interface layer, and the virtual file system is capable of mapping processing operations to the storage disk corresponding to the container, the method comprising: In response to receiving a data processing request, determine the target operation corresponding to the data processing request; The data processing request is intercepted and parsed by the container interface layer, and the parsing result is a transparent directory for the storage disk file system, which is a data processing request sent directly to the virtual file system without going through the kernel-mode file system. Based on the target operation and the initial file index information corresponding to the storage disk, the target file index information is determined; Based on the target file index information, the target operation is performed on the storage disk.
5. The method according to claim 4, wherein the target operation includes a file creation operation, wherein, The step of determining the target file index information based on the target operation and the initial file index information corresponding to the storage disk includes: Based on the file creation operation, determine the path information of the created file; Based on the path information of the file to be created and the initial file index information corresponding to the storage disk, the target file index information is determined. The target file index information includes the storage block information of the file to be created in the storage disk, as well as the index level node information.
6. The method according to claim 4, wherein the target operation includes a file write operation, wherein, The step of determining the target file index information based on the target operation and the initial file index information corresponding to the storage disk includes: Based on the file writing operation, determine the write path corresponding to the file to be written; Based on the write path and the initial file index information corresponding to the storage disk, the storage block to be written is determined; If the storage size of the storage block to be written meets the size of the file to be written, the index information corresponding to the storage block is determined as the target file index information; If the size of the storage block to be written does not meet the size of the file to be written, the index information of the target storage block in the storage disk that meets the size of the file to be written is determined as the target file index information.
7. The method according to claim 4, wherein the target operation includes a file reading operation, wherein, The step of determining the target file index information based on the target operation and the initial file index information corresponding to the storage disk includes: Based on the file reading operation, determine the path information of the file to be read; Based on the path information of the file to be read and the initial file index information corresponding to the storage disk, the target file index information is determined.
8. The method according to claim 4, wherein performing the target operation on the storage disk based on the target file index information comprises: Obtain the attribute information of the storage disk; Based on the attribute information, the connection configuration information between the storage disk and the virtual file system is determined; Based on the connection configuration information and the target file index information, the target operation is performed on the storage disk.
9. A data processing apparatus applied to a container interface layer, the container interface layer being directly connected to a virtual file system, the virtual file system being a user-mode file system corresponding to the container's storage disk, the apparatus comprising: The parsing unit is used to intercept and parse the data processing request received by the container in response to the data processing request, and obtain the parsing result; The sending unit is configured to send the data processing request to the virtual file system based on the parsing result, so that the virtual file system performs a processing operation matching the data processing request in the storage disk corresponding to the container; wherein, if the parsing result is a pass-through directory for the storage disk file system, the data processing request is sent directly to the virtual file system without going through the kernel-mode file system.
10. A data processing apparatus applied to a virtual file system, wherein the interface of the virtual file system is connected to a container interface layer, and the virtual file system is capable of mapping processing operations to a storage disk corresponding to the container, the apparatus comprising: The first determining unit is configured to determine the target operation corresponding to the data processing request in response to receiving the data processing request. The data processing request is intercepted and parsed by the container interface layer, and the parsing result is a transparent directory for the storage disk file system, which is a data processing request sent directly to the virtual file system without going through the kernel-mode file system. The second determining unit is used to determine the target file index information based on the target operation and the initial file index information corresponding to the storage disk; An operation unit is used to perform the target operation on the storage disk based on the target file index information.
Citation Information
Patent Citations
Virtualization method and apparatus, and computer device
CN105190545A
Small file storage optimization system based on virtual file system in KUBERNETES user mode application
CN111475469A