Data read / write method, system, and apparatus, computing device, and storage medium

By adopting a layered architecture of asynchronous I/O layer and driver layer, user-mode data read and write requests are directly sent to the driver layer, which solves the problems of data read and write efficiency and stability between virtual machine and physical device, and realizes efficient and reliable I/O operation.

WO2026144711A1PCT designated stage Publication Date: 2026-07-09CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD +1

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
Filing Date
2025-11-28
Publication Date
2026-07-09

AI Technical Summary

Technical Problem

In existing technologies, the efficiency and response speed of data read/write operations between virtual machines and physical devices cannot meet the needs of high-performance computing and big data applications, and there are performance and stability issues caused by multiple context switches and data copies.

Method used

A layered architecture of asynchronous I/O layer and driver layer is adopted. The asynchronous I/O layer receives user space data read and write requests and stores them in the request queue. Pass-through requests are sent directly to the driver layer, reducing context switching and data copying. The driver layer parses the requests and sends them to the target processing device for processing.

Benefits of technology

It improves the efficiency and response speed of I/O operations, reduces system complexity and instability risks, enhances system reliability and overall performance, optimizes I/O request scheduling, and reduces disk seek time and latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025138355_09072026_PF_FP_ABST
    Figure CN2025138355_09072026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a data read / write method, system, and apparatus, a computing device, and a storage medium. The data read / write method comprises: receiving, by means of an asynchronous I / O layer, a data read / write request sent from a user space, and storing the data read / write request in a request queue; when the asynchronous I / O layer determines that the data read / write request is of a pass-through type, sending the data read / write request to a driver layer; and parsing the data read / write request by means of the driver layer, and sending request information of the data read / write request to a target processing end device for read / write processing. The data read / write request sent from the user space is received by means of the asynchronous I / O layer, and is sent to the driver layer after the data read / write request is determined to be of the pass-through type, thereby reducing context switching and data copying overhead, and improving the processing efficiency of I / O operations. The request is parsed at the driver layer and sent to the processing end device for read / write processing, thereby optimizing the scheduling of I / O tasks, reducing disk addressing time and I / O latency, and improving overall performance and system stability.
Need to check novelty before this filing date? Find Prior Art

Description

Data read / write methods, systems, devices, computing equipment, and storage media

[0001] This disclosure claims priority to Chinese Patent Application No. 202411996717.6, filed with the China Patent Office on December 31, 2024, entitled “Data Reading and Writing Method and System, Apparatus, Computing Device and Storage Medium”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This disclosure relates to the field of computer technology, and in particular to a data reading and writing method. Background Technology

[0003] In recent years, with the development of virtualization technology and high-performance storage devices, Virtual Transport Network (Virtio) has enabled efficient communication between virtual machines and physical devices. It features low latency and high performance and has been widely used in network systems with device virtualization.

[0004] Virtual machine read and write operations (I / O operations) are one of the key factors in system performance. Currently, to enable communication between virtual machines and physical devices, read and write operations are typically performed through the Virtual File System (VFS) and the Block Layer. These intermediate layers are responsible for managing and scheduling read and write requests to ensure the correct transmission of data.

[0005] However, with the widespread adoption of high-performance computing and big data applications, higher demands are being placed on the efficiency and response speed of virtual machine read and write operations. Methods that manage and schedule read and write requests through an intermediate layer, involving multiple context switches and data copies, no longer meet current performance and flexibility requirements. Therefore, a storage access solution with better performance, higher reliability, and greater flexibility is urgently needed. Summary of the Invention

[0006] In view of this, embodiments of this disclosure provide a data read / write method. One or more embodiments of this disclosure also relate to a data read / write apparatus, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.

[0007] One embodiment of this disclosure provides a data read / write method applied in kernel mode, the kernel mode including an asynchronous I / O layer and a driver layer, the asynchronous I / O layer including a request queue; the method includes:

[0008] The asynchronous I / O layer receives data read / write requests sent by user space and stores the data read / write requests in the request queue.

[0009] If the asynchronous I / O layer determines that the data read / write request is a pass-through type, the data read / write request is sent to the driver layer;

[0010] The driver layer parses the data read / write request and sends the request information to the target processing device for read / write processing.

[0011] The asynchronous I / O layer receives data read / write requests from user space and stores these requests in a request queue. Once the asynchronous I / O layer determines that a request is a pass-through type, it directly sends the request to the driver layer. This significantly reduces the number of context switches from user space to kernel space and the overhead of data copying, improving the efficiency and response speed of I / O operations. It also reduces the involvement of intermediate layers, simplifies system complexity, reduces the risk of system instability, and improves system reliability and stability. The driver layer parses the requests and sends the request information to the processing device for read / write processing, optimizing the scheduling of I / O requests, reducing disk seek time and I / O latency, and improving the overall performance of the system. Attached Figure Description

[0012] Figure 1 is a flowchart of a data read / write request processing method in the prior art;

[0013] Figure 2 is a schematic diagram of a block data read / write request encapsulation structure in the prior art;

[0014] Figure 3 is an execution flowchart of a data read / write system provided in an embodiment of this disclosure;

[0015] Figure 4 is a flowchart of a data read / write method provided in an embodiment of this disclosure;

[0016] Figure 5 is a schematic diagram of the target data format of a virtio_blk driver layer request in the prior art;

[0017] Figure 6 is a schematic diagram of the structure of a user-space specified read / write buffer with continuous and discrete address and length information in the prior art;

[0018] Figure 7 is a schematic diagram of a request information format in which the user-space specified read / write buffer is of continuous and discrete types, according to an embodiment of this disclosure;

[0019] Figure 8 is a schematic diagram of the structural framework of a data read / write method provided in an embodiment of this disclosure;

[0020] Figure 9 is a schematic diagram of a physical address format conversion provided in an embodiment of this disclosure;

[0021] Figure 10 is a flowchart of a data read / write method according to an embodiment of this disclosure;

[0022] Figure 11 is a schematic diagram of a data read / write device provided in an embodiment of this disclosure;

[0023] Figure 12 is a structural block diagram of a computing device provided in an embodiment of this disclosure. Detailed Implementation

[0024] Numerous specific details are set forth in the following description to provide a full understanding of this disclosure. However, this disclosure can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this disclosure. Therefore, this disclosure is not limited to the specific implementations disclosed below.

[0025] The terminology used in one or more embodiments of this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this disclosure. The singular forms “a,” “the,” and “the” as used in one or more embodiments of this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this disclosure refers to and includes any or all possible combinations of one or more associated listed items.

[0026] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this disclosure, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this disclosure, and similarly, second may also be referred to as first. Depending on the context, the word “if” as used herein may be interpreted as “when”, “in response to a determination”, or “when…”.

[0027] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this disclosure are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0028] First, the terms and concepts involved in one or more embodiments of this disclosure will be explained.

[0029] User-space devices refer to devices or applications that run in user space, executing in the user mode of the operating system. User-space devices typically include various applications, libraries, and services that directly interact with the user or process user data, such as common browsers, text editors, and media players.

[0030] Kernel-space devices refer to device drivers or system services that run in kernel space, executing in the operating system's kernel mode. Kernel-space devices directly manage hardware resources, handle system-level tasks, and provide core system functions such as hard drive drivers, network drivers, and file system drivers.

[0031] virtio_blk: The virtio block device driver (virtio-blk) is a block device driver based on the Virtio standard, used to efficiently handle disk I / O requests in virtualized environments.

[0032] io_uring: An I / O circular queue (Input / Output User Ring, or io_uring for short) is a new type of asynchronous I / O framework that optimizes I / O operation performance by efficiently transferring information between user space and kernel space using a circular queue.

[0033] Polling Mechanism: The polling mechanism is a mechanism that actively queries the completion status of I / O requests, allowing user-mode applications to actively check whether I / O operations are completed, rather than waiting for interrupt notifications. This can improve the resource utilization and I / O throughput of the central processor.

[0034] Referring to Figures 1 and 2, Figure 1 shows a flowchart of a data read / write request processing method, and Figure 2 shows a schematic diagram of a block data read / write request encapsulation structure. Currently, the typical data read / write access process through a virtual block device is shown in Figure 1: The user-space program initiates a data read / write request through a system call, transmitting file information, the address and length of the buffer requested by the user-space, to the kernel space; the virtual file system layer in the kernel space encapsulates the data read / write request. This virtual file system layer includes a file system (e.g., an ext4 file system or an XFS file system) for file management. The encapsulation structure of the data read / write request in the virtual file system layer is shown in Figure 2: the file address information, starting sector information, read / write size, etc., are encapsulated into a block device read / write request. Each block device read / write request... The process involves using a block device read / write request pointer to point to the next block device read / write request. The read / write buffer array consists of the memory page where the buffer is located, the offset within the page, and the length. After receiving the encapsulated block device read / write request, it is sent to the block layer for processing. The block layer extracts data read / write requests from the block I / O request list, encapsulates the device read / write requests into a request structure of a specific format, and forms a request structure queue. This queue is then sent to the underlying device. The block I / O request list is a data structure used to manage and temporarily store block I / O requests. The virtual block device driver can write the received request structure into the virtual queue.

[0035] However, in the above scheme, data read / write requests from user-space programs need to be sent through the virtual file system layer, block layer, and virtual block device driver layer. Furthermore, the block layer requires integration and formation of request structure queues. Therefore, the format requirements for data read / write requests from user-space programs are stringent; they must conform to the requirements of each layer in kernel space to perform data read / write operations. This limits support for more custom requests and results in poor scalability. Additionally, the processing of multiple intermediate layers involves multiple context switches and data copies, causing additional performance overhead and reducing overall system stability.

[0036] To address the aforementioned problems, this disclosure provides a data reading and writing method, and also relates to a data reading and writing device, a data reading and writing system, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.

[0037] Referring to Figure 3, which illustrates an execution flowchart of a data read / write system according to an embodiment of the present disclosure, the data read / write system 300 includes:

[0038] User-mode device 302, kernel-mode device and multiple processing terminal devices, the kernel-mode device includes asynchronous I / O layer 304 and driver layer 306, the asynchronous I / O layer includes request ring queue;

[0039] User-mode device 302 is used to send data read / write requests to kernel-mode devices;

[0040] The asynchronous I / O layer 304 is used to store data read / write requests in the request ring queue, and send the data read / write request to the driver layer when it is determined that the data read / write request is a pass-through type.

[0041] Driver layer 306 is used to parse data read / write requests and send the request information of data read / write requests to the target processing device among multiple processing devices;

[0042] The target processing device 308 is used for reading and writing based on request information.

[0043] The data read / write system provided in this embodiment uses a layered architecture and asynchronous processing to store data read / write requests sent by user-mode devices into a request ring queue via an asynchronous I / O layer, and directly send pass-through data read / write requests to the driver layer, reducing context switching overhead and data copying frequency. After parsing, the driver layer sends the request information corresponding to the data read / write request to the target processing device for processing, thereby improving the throughput and response speed of data read / write processing.

[0044] Corresponding to the aforementioned data read / write system, one embodiment of this disclosure provides a data read / write method. Referring to Figure 4, Figure 4 shows a flowchart of a data read / write method according to an embodiment of this disclosure. This method is applied to a kernel-mode device, which includes an asynchronous I / O layer and a driver layer. The asynchronous I / O layer includes a request queue. The method includes:

[0045] Step 402: Receive data read / write requests sent by user space through the asynchronous I / O layer and store the data read / write requests in the request queue.

[0046] User space is the collective term for the memory area where ordinary applications run. Each user space process has its own independent user space. These processes can only access the memory area allocated to them and cannot directly access the memory of other processes or critical system data.

[0047] User-space devices refer to devices or applications that run in user space, executing in the user mode of the operating system. User-space devices typically include various applications, libraries, and services that directly interact with the user or process user data, such as common browsers, text editors, and media players.

[0048] Kernel space is the collective term for the operating system kernel and its drivers, containing all the code and data structures related to core functions such as hardware interaction, process scheduling, and memory management.

[0049] Kernel space devices refer to device drivers or system services that run in kernel space, executing in the operating system's kernel mode. Kernel space devices directly manage hardware resources, handle system-level tasks, and provide core system functions such as hard drive drivers, network drivers, and file system drivers.

[0050] An asynchronous I / O layer is a mechanism that allows user-space applications to initiate I / O operations in a non-blocking manner. It achieves efficient I / O processing by submitting I / O requests to the kernel and notifying the user-space application upon completion of the request. Examples include the Portable Operating System Interface Asynchronous I / O layer (POSIX AIO) and the io_uring layer.

[0051] The driver layer is part of the operating system kernel and is responsible for managing and controlling hardware devices. For storage devices, the driver layer is responsible for handling I / O requests and sending them to the actual hardware devices, such as the virtio block device driver (virtio_blk) and the virtio graphics device driver (virtio_gpu).

[0052] A request queue is a data structure used by the operating system or applications to temporarily store and manage I / O requests. Its function is to collect I / O requests from user-space applications and pass these requests sequentially to the appropriate drivers for processing. Request queues can include types such as linear request queues and circular request queues.

[0053] A request ring queue (SQ) is a circular buffer, a fixed-size data structure whose ends are connected to form a ring. The main function of a circular buffer is to efficiently manage data flow by reusing used space, avoiding the frequent memory allocation and deallocation operations found in traditional linear buffers.

[0054] User-mode applications can place I / O requests into the request ring queue. Kernel mode will then retrieve the I / O requests from the request ring queue and process them.

[0055] Data read / write requests refer to I / O operation requests initiated by applications or services running in user space to the kernel. These requests typically involve reading or writing resources such as files, networks, and storage devices. User-space applications can submit these requests through system calls or asynchronous I / O mechanisms. Data read / write requests include file read / write requests, network read / write requests, and storage device read / write requests.

[0056] The kernel mode includes an asynchronous I / O layer and a driver layer. The asynchronous I / O layer is located on the side of the kernel mode closer to the user mode. The request ring queue is located in the asynchronous I / O layer. The asynchronous I / O layer receives data read / write requests sent by the user mode through the request ring queue and sends the data read / write requests to the driver layer through the request ring queue. The driver layer is located between the asynchronous I / O layer and the processing end. The driver layer receives data read / write requests sent by the asynchronous I / O layer and sends the data read / write requests to the processing end.

[0057] Specifically, user space sends data read / write requests to kernel space. These requests include data read / write operations required by applications running in user space. After receiving the data read / write request, kernel space stores it in the request ring queue in the asynchronous I / O layer.

[0058] Optionally, data read / write requests can be stored in the request ring queue as Submission Queue Entry (SQE). A SQE is an entry in the request ring queue that represents a specific data read / write request. Each SQE contains all the necessary information for the corresponding data read / write request, such as operation type, operation priority, start address of the read / write operation, buffer address, and length.

[0059] For example, the application of this data read / write method in a data storage scenario is further illustrated. A logging application A runs in user space and needs to write 512 bytes of log data to a file named logfile.txt in the user space file management system. This corresponds to writing from sector 1048576 (i.e., 2^20) in kernel space. A data write request X is generated and sent from user space to kernel space. When the kernel space receives the data write request X, it initializes the SQ queue in the io_uring layer and stores the data write request X in the SQ in the form of SQE. The information in SQE includes: operation type [W] (W refers to the write operation WRITE), operation priority [1] (the priority can be set to 5 levels from high to low, corresponding to 1-5), read / write start position [1048576] (meaning writing starts from sector 1048576), buffer address [0x7f8a4c001000], buffer length [512 bytes], etc.

[0060] In the steps of this embodiment, non-blocking asynchronous I / O operations are achieved by passing data read / write requests generated in user space to kernel space and managing and processing them through a request queue, thus providing a data foundation for subsequent processing of I / O requests.

[0061] Step 404: If the asynchronous I / O layer determines that the data read / write request is of the pass-through type, the data read / write request is sent to the driver layer.

[0062] Pass-through data read / write requests refer to data read / write requests that can be directly passed to the driver layer. These requests do not need to be processed by intermediate kernel layers (such as the Block layer, VFS layer, etc.) and are communicated directly between the user-mode application and the kernel-mode driver.

[0063] Once the asynchronous I / O layer confirms that a data read / write request is a pass-through type, it can directly send the request to the driver layer. Specifically, the asynchronous I / O layer confirms that a data read / write request is a pass-through type by determining whether the opcode used to specify the operation type in the data read / write request contains a specific operation handle. If the opcode in the data read / write request contains a specific operation handle (e.g., .uring_cmd), then the operation type of the data read / write request is determined to be a pass-through type; if the opcode in the data read / write request only contains general operation handles (e.g., write, read), then the operation type of the data read / write request is determined to be a non-pass-through type.

[0064] For pass-through data read / write requests, if their operators contain specific operation handles (e.g., .uring_cmd), it indicates that the hardware device (such as certain advanced storage devices or network interface cards) or driver device (e.g., the virtio_blk driver under the io_uring framework) of the data read / write system supports handling pass-through data read / write requests. Therefore, the data read / write request can be directly sent to the driver layer for processing. By bypassing the intermediate layer's processing, this data read / write system reduces context switching, lowers latency, and improves concurrency.

[0065] For non-pass-through data read / write requests, if the operators only include general operation handles (such as write and read), it means that the data read / write system calls follow the standard path and does not support processing pass-through data read / write requests. It can only support general processing operations (such as writing data (write) or reading data (read)) to ensure the system's compatibility and stability.

[0066] For example, let's further illustrate this by taking the application of this data read / write method in a data storage scenario. Continuing with the above log recording application A as an example: the asynchronous I / O layer io_uring parses the SQE corresponding to the data write request X in the SQ queue, obtains the file operator [passthrough], then determines that the data write request X is of the passthrough type, and directly sends the data write request X to the driver layer.

[0067] In the steps of this embodiment, by directly passing data read and write operations to the driver layer through the asynchronous I / O layer, the processing overhead of the kernel intermediate layer is reduced, thereby reducing data copying and context switching, reducing the latency of I / O operations, and improving the overall I / O throughput. At the same time, it provides a data foundation for the driver layer to parse data read and write requests.

[0068] Step 406: The driver layer parses the data read / write request and sends the request information to the target processing device for read / write processing.

[0069] The processing device refers to the physical or virtual storage device that actually performs data read / write operations. This device can be various types of storage media, depending on the system configuration and application scenario, such as hard disk drives (HDDs), solid-state drives (SSDs), and network storage devices. The target processing device refers to the processing device that handles the data read / write request.

[0070] Data read / write requests can include information such as operation type, operation priority, start position of read / write address, buffer address and length. After parsing the data read / write request to obtain the above information, the driver layer can convert it based on this information to obtain request information, and send it to the target processing device for read / write processing in the form of request information.

[0071] For example, the application of this data read / write method in a data storage scenario is further illustrated. Taking the above log recording application A as an example: the driver layer virtio_blk parses the SQE of the data write request X to obtain information such as operation type [W], operation priority [1], read / write start position [1048576], buffer address [0x7f8a4c001000], and buffer length [512 bytes]. Based on this information, the buffer address [0x7f8a4c001000] is converted into the actual physical address [0x123456789000] to obtain the request information X corresponding to the data write request X, and then sent to the target processing device SSD.

[0072] In this embodiment, by receiving data read / write requests sent from user space and storing these requests in a request queue, the asynchronous I / O layer determines that the request is a pass-through type and directly sends the request to the driver layer. This significantly reduces the number of context switches from user space to kernel space and the data copy overhead, improving the efficiency and response speed of I / O operations. It also reduces the involvement of intermediate layers, simplifies system complexity, reduces the risk of system instability, and improves system reliability and stability. The driver layer parses the requests and sends the request information to the processing device for read / write processing. The multi-queue architecture allows multiple I / O requests to be processed in parallel, further improving the processing efficiency of I / O operations. At the same time, it optimizes the scheduling of I / O requests, reduces disk seek time and I / O latency, and improves overall performance.

[0073] In one optional embodiment of this disclosure, receiving a data read / write request sent from user space and storing the data read / write request in a request queue includes:

[0074] Receive data read / write requests sent from user space, wherein the data read / write requests are encapsulated with request header information;

[0075] Data read and write requests are stored in the request queue.

[0076] The request header is part of each data read / write request, containing metadata and control information about the request. It reflects the specific attributes and control parameters of the data read / write request and guides the kernel-mode device on how to process it, ensuring correct parsing, execution, and result feedback. The request header includes the read / write type (type), read / write priority (ioprio), and read / write start position (sector). The request header can be configured by the user in user space or automatically generated by applications running in user space; this disclosure does not impose specific limitations on this.

[0077] Upon receiving a data read / write request from user space, the data read / write request, including the request header information, can be written into the request queue.

[0078] For example, the application of this data read / write method in a data storage scenario is further illustrated. Taking the above-mentioned log recording application A as an example, the log recording application runs in user space and needs to write 512 bytes of log data to a file named logfile.txt in the user space file management system. Then, the corresponding kernel space starts writing from sector 1048576. A data write request X is generated and sent from user space to kernel space device. When the kernel space device receives the data write request X, the data write request X includes request header information: read / write type [W], read / write priority ioprio [1] and starting position sector [1048576]. The data write request X can then be stored in SQ in the form of SQE.

[0079] In this embodiment of the disclosure, by encapsulating data read / write requests into a structure containing request header information and storing it in a request queue, since the request header information includes detailed metadata and control information (such as read / write type, priority ioprio, and starting position sector) for each data read / write request, the kernel-mode device can directly parse the request without additional queries or calculations. This reduces context switching and additional system calls caused by the lack of necessary information, thereby achieving efficient, concurrent, and flexible I / O operations. It not only reduces the overhead of system calls but also improves I / O performance and application maintainability.

[0080] In one optional embodiment of this disclosure, the data read / write request is parsed by the driver layer, and the request information of the data read / write request is sent to the target processing terminal device for read / write processing, including:

[0081] The driver layer parses the data read / write request and obtains the request header information;

[0082] Determine the address and length information of the data buffer requested by the user.

[0083] Based on the request header information, address information, and length information, obtain the request information for data read / write requests;

[0084] The request information is sent to the target processing device for read and write processing.

[0085] A data buffer is a memory area in a computer system used for temporary data storage. A user-space allocated data buffer refers to a memory area allocated by a user-space application for read or write operations. This memory area resides in user space memory and is managed by the user-space application itself. Data buffers can be categorized according to read / write type, such as input buffers, output buffers, and double buffers.

[0086] The address information of the data buffer refers to the starting address of the data buffer in memory. This address is usually a pointer pointing to the first byte of the buffer. The length information of the data buffer refers to the size of the data buffer, that is, the amount of data that the data buffer can hold, usually in bytes. The length information of the data buffer ensures that read and write operations do not exceed the boundaries of the buffer, thereby avoiding memory access errors. For example, if logging application A needs to write 512 bytes of log data to the storage system, then logging application A will request a data buffer with a length of 512 bytes, and the starting address of the buffer is [0x7f8a4c001000].

[0087] During the process of sending read / write requests to the target processing device, the driver layer needs to parse the read / write requests and convert them into request information in the target data format. The target data format is usually determined by the driver program on the device's driver layer. For example, the virtio_blk block device driver needs to communicate with block devices in a virtualization environment that is compatible with the virtio standard, so it needs to use request information in the virtio command format.

[0088] Referring to Figure 5, which illustrates a target data format for a virtio_blk driver layer request, the target data format includes three parts: request header information, address-related information of the read / write buffer, and return value field information. In traditional file system-based, block-level access, user-mode access requests are converted into this format.

[0089] By converting the request header information, address information, and length information included in the data read / write request, the request information in the target format can be obtained, and the request information can be sent to the target processing device for read / write processing.

[0090] For example, the application of this data read / write method in a data storage scenario is further illustrated. Taking the above-mentioned log recording application A as an example, the data write request X is converted into request information X through the virtio_blk driver layer. It is necessary to determine the address information and length information of the data buffer according to the data buffer applied by the log recording application A, where the address information is [0x7f8a4c001000] and the length information is [512 bytes]. The request header information is obtained by parsing the data write request X: read / write type [W], read / write priority ioprio [1] and starting position sector [0]. Based on the address information [0x7f8a4c001000], the length information [512 bytes], and the read / write type [W], read / write priority ioprio [1] and starting position sector [0] included in the request header information, the request information X that conforms to the virtio command format can be obtained. The request information X is then sent to the target processing device SSD for read / write processing.

[0091] In this embodiment, the driver layer parses and converts the data read / write requests sent by the user space into a specific command format required by the driver program in the kernel space device. Combined with the address and length information of the data buffer requested by the user space, the data read / write requests can be directly sent to the target processing device for processing, thereby improving the performance and efficiency of I / O operations, reducing system overhead, and ensuring accurate data transmission.

[0092] In one optional embodiment of this disclosure, obtaining request information for a data read / write request based on request header information, address information, and length information includes: converting the address information of the data buffer into physical address information; and encapsulating the request header information, physical address information, and length information to obtain the request information for the data read / write request.

[0093] Physical address information refers to the address in actual memory, which is the address directly accessed by hardware devices. The address of a data buffer allocated in user mode is usually a virtual address, which is the address seen by user-mode applications. Each user-mode application has its own virtual address space, and these virtual addresses are allocated by the operating system.

[0094] During data read / write operations, communication is required between the user-mode application and the kernel-mode hardware device. Since the kernel-mode device needs to read the actual physical address for data transmission, the address information of the data buffer must be converted into physical address information. However, the length of the data buffer is determined by the data length corresponding to the read / write request; therefore, the length information remains unchanged between the virtual and physical addresses, and no conversion of the length information is necessary.

[0095] The conversion of virtual addresses to physical addresses can be performed based on the mapping relationship between virtual addresses and physical addresses, such as through page tables, memory-mapped files (mmap), etc. The specific conversion method can be determined according to the actual application scenario or requirements, and this disclosure does not make specific limitations on this.

[0096] After obtaining the converted physical address information, the request header information, physical address information and length information can be encapsulated to obtain the data read and write request information. This request information conforms to the target format requirements of the driver layer and can be directly read by the target processing device, so that it can be sent to the target processing device for read and write processing.

[0097] For example, the application of this data read / write method in a data storage scenario will be used to further illustrate the method. Taking the above log recording application A as an example, after obtaining the address information [0x7f8a4c001000], length information [512 bytes], and the request header information including the read / write type [W], read / write priority ioprio [1], and starting position sector [0], the address information [0x7f8a4c001000] can be converted to obtain the physical address information [0x123456789000]. The read / write type [W], read / write priority ioprio [1], and starting position sector [0], physical address information [0x123456789000], and length information [512 bytes] included in the request header information are encapsulated to obtain the request information X corresponding to the data write request X.

[0098] In this embodiment, by converting the address information of the data buffer requested by user mode into actual physical address information, and combining it with request header information and length information to encapsulate it into request information conforming to the target format of the driver layer, efficient data transmission is achieved. At the same time, the communication overhead between user mode and kernel mode is reduced, ensuring that hardware devices can directly access the correct physical address for read and write operations, thereby improving the efficiency and performance of I / O operations, while ensuring the accuracy and integrity of data.

[0099] In one optional embodiment of this disclosure, the request information further includes a flag bit, which is used to mark the type of data read / write request; encapsulating the request header information, physical address information and length information to obtain the request information of the data read / write request includes: when the data read / write request is a single request, encapsulating the request header information, physical address information of the data buffer and length information, and setting the flag bit to a non-vector type read / write request to obtain the request information of the data read / write request;

[0100] When the data read / write request is a request sequence, the request header information, the physical address information and length information of each data buffer are encapsulated, and the flag is set to the vector type read / write request to obtain the request information of the data read / write request.

[0101] Data read / write requests sent from user space can be categorized into non-vector read / write requests and vector read / write requests based on the number of requests included in the request.

[0102] Specifically, a data read / write request can process the data of a single request, or it can process the data of multiple requests arranged in sequence.

[0103] When processing read and write operations on a single request, the data buffer address requested by the user space is contiguous, meaning that the read / write address of the data being read / written is a contiguous memory region. This type of request is suitable when the data is already concentrated in a contiguous memory area.

[0104] When reading and writing multiple data items arranged in a sequence, the buffer address requested by the user is discrete, meaning that the multiple data items to be read and written are distributed in multiple non-contiguous memory regions. Each memory region can be called a "vector". This type of request is usually used when data needs to be read or written from multiple different locations.

[0105] Referring to Figure 6, Figure 6 shows a schematic diagram of the structure of a user-space specified read / write buffer with continuous and discrete address and length information, as shown in Figure 6:

[0106] When the user-defined read / write buffer is contiguous, the address-related information of the read / write buffer includes address information and length information. The address information is the address where the data to be written to the file or the address where the data content to be read from the file is stored, and the length information is the length of the data to be written / read. When the user-defined read / write buffer is discrete, the address-related information of the read / write buffer includes a starting address pointer and length information. The starting address pointer points to the starting address, which is represented by a read / write buffer array. The read / write buffer array includes multiple discrete buffer addresses and length information. The length information is used to indicate the number of buffers.

[0107] If it is determined that the data read / write request is a non-vector type request, the continuous address information corresponding to the data buffer can be converted into physical address information, and the physical address information, length information and request header information can be encapsulated. At the same time, the flag is set to non-vector type read / write request to obtain the request information of the data read / write request.

[0108] If it is determined that the data read / write request is a vector-based request, the discrete address information of multiple data buffers represented by vectors can be converted into multiple physical address information. The physical address information and corresponding length information of each data buffer are then concatenated to obtain physical address information and length information represented by vectors. The physical address information, length information and request header information are then encapsulated in vector form, and a flag is set to the vector-based read / write request type to obtain the request information of the data read / write request.

[0109] That is, referring to Figure 7, Figure 7 shows a schematic diagram of a request information format in which the user-space specified read / write buffer is of continuous and discrete types according to an embodiment of the present disclosure, as shown in Figure 7:

[0110] When the user-space specified read / write buffer is continuous, the request information format includes operation request header information, address information, length information, and flag bits. The request header information includes operation type, operation priority, and starting address information. The address information is the address where the data to be written to the file or the address where the data to be read from the file is stored. The length information is the length of the data to be written / read. A flag bit of 0 indicates non-vector read / write. When the user-space specified read / write buffer is discrete, the request information format includes operation request header information, address information, length information, and flag bits. The request header information includes operation type, operation priority, and starting address information. The address information points to the starting address and is represented by a read / write buffer array. The read / write buffer array includes multiple discrete buffer addresses and length information. The length information indicates the number of buffers. A flag bit of 1 indicates vector read / write.

[0111] For example, when the read / write buffer specified in user space is contiguous, taking the logging application A mentioned above as an example, it needs to write log data to a disk file. This log data is stored in a contiguous memory region in the data buffer: Region: 0x7f8a4c001000-0x7f8a4c001fff (4096 bytes).

[0112] In this scenario, logging application A can use a non-vector class request to write data from this contiguous memory region to a disk file.

[0113] For example, in the case where the read / write buffer specified in user space is contiguous, taking the logging application A mentioned above as an example, it needs to write log data to disk files, and this log data is distributed in three different memory areas:

[0114] Region 1: 0x7f8a4c001000-0x7f8a4c001200 (512 bytes)

[0115] Region 2: 0x7f8a4c002000-0x7f8a4c002200 (512 bytes)

[0116] Region 3: 0x7f8a4c003000-0x7f8a4c003200 (512 bytes)

[0117] In this scenario, logging application A can use vector class requests to write data from these three regions to a disk file in a single data read / write request.

[0118] If it is determined that the data read / write request is a vector-based request, the discrete address information of multiple data buffers represented by vectors can be converted into multiple physical address information. The physical address information and corresponding length information of each data buffer are then concatenated to obtain physical address information and length information represented by vectors. The physical address information, length information and request header information are then encapsulated in vector form, and a flag is set to the vector-based read / write request type to obtain the request information of the data read / write request.

[0119] In this embodiment of the disclosure, efficient data transmission is achieved by distinguishing between non-vector and vector data read / write requests and setting corresponding flag bits in the request information. For a single data read / write request, non-vector request information is used to process the data in the contiguous memory region. For multiple data read / write requests, vector request information is used to process the data in the discrete memory region. This reduces the number of system calls, improves the efficiency and performance of I / O operations, simplifies data processing logic, and ensures the accuracy and integrity of data transmission.

[0120] In one optional embodiment of this disclosure, after obtaining the request information of the data read / write request based on the request header information, address information, and length information, the method further includes: storing the request information in the core request queue based on the correspondence between the data read / write request and the request information; and allocating the request information from the core request queue to the hardware request queue corresponding to each processing device based on the device information of each processing device.

[0121] Sending the request information to the target processing device for read / write processing includes: sending the request information to the target processing device for read / write processing through the hardware request queue corresponding to the target processing device.

[0122] The core request queue (Context, CTX) is a centralized request queue used to store and manage all submitted data read and write requests and their corresponding request information. All data read and write requests are first stored in CTX to ensure the orderliness and traceability of the requests.

[0123] Optionally, CTX can be bound to the Central Processing Unit (CPU) to ensure that data read and write requests can be executed on the same CPU, reducing the overhead of cross-core communication and cache inconsistency issues.

[0124] The Hardware Request Queue (HCTX) is a specific hardware request queue corresponding to each processing device (such as an SSD or network interface device). It is used to directly interact with the hardware and perform actual read and write operations. Request information in the HCTX can be directly sent to the target processing device for read and write processing, reducing the overhead of the intermediate layer. At the same time, each HCTX can store multiple request information, and multiple HCTXs can work in parallel, further improving the system's parallel processing capability and throughput.

[0125] The device information for each processing device includes the device type, current load, and performance parameters. When allocating request information, CTX can comprehensively consider the needs of the request information and the device information. For example, if a request is for writing data and has a high priority, CTX will allocate the request information to the HCTX corresponding to the processing device that is a storage device with a low current load and high performance parameters, and the processing device will then process the request information.

[0126] After obtaining the request information corresponding to the data read / write request at the driver layer, the request information can be stored in the core request queue. The core request queue can manage multiple hardware request queues. Based on the device information of each processing device, it can be determined which processing device is suitable to handle the request information. That is, the request information can be allocated to the hardware request queue corresponding to the processing device, and all the request information included in the queue can be sent to the corresponding processing device for read / write processing through the hardware request queue.

[0127] For example, let's further illustrate this using the application of this data read / write method in a data storage scenario. Continuing with the log recording application A as an example, if the data write request X sent by the log recording application A corresponds to the request information X, then the request information X is stored in the core request queue bound to the central processor. Since request information X is a data write request, it has a high priority. The core request queue will then determine, based on the request information from each processing device, that the processing device SSD-1's device type is a storage device, its current load is low, and its performance parameters are high. Therefore, it will allocate request information X to the hardware request queue corresponding to processing device SSD-1, and send request information X to processing device SSD-1 through the hardware request queue to complete the data write processing.

[0128] In this embodiment of the disclosure, by combining a centralized management core request queue and a specific hardware request queue, and using an intelligent allocation strategy based on device information, cross-core communication overhead and cache inconsistency issues are reduced, achieving efficient, flexible and optimized data read and write request processing, and significantly improving the system's concurrent processing capability, throughput and overall performance.

[0129] In one optional embodiment of this disclosure, the asynchronous I / O layer determines that the data read / write request is a pass-through type by: reading the operator of the data read / write request; and determining that the data read / write request is a pass-through type if the operator of the data read / write request includes a specific handle.

[0130] An operation code (opcode) for a data read / write request is an operation code or handle used to specify a particular file operation type. It can be a function name, macro definition, or other form of identifier used to tell the operating system or driver the specific operation to be performed. Depending on the use case or purpose, there can be various types of operators, such as read operators, write operators, file operators, and special operators.

[0131] A handle is an identifier used to reference resources or objects in a system. Its purpose is to allow applications to access these resources indirectly without directly managing the underlying implementation details. Depending on the use case or purpose, handles can be of various types, such as device handles, event handles, and special handles.

[0132] A specific handle can be a special handle used to identify a resource with specific attributes or functions. In this embodiment of the disclosure, the specific handle is the ".uring_cmd" handle.

[0133] The .uring_cmd handle is a specific handle used to identify passthrough type commands. It allows user-space applications to send commands directly to device drivers through the io_uring framework without going through the generic block layer or other intermediate layers.

[0134] Optionally, the specific handle for the data read / write request can be provided by the character device interface that sends the data read / write request.

[0135] A character device interface refers to the interface in an operating system used to communicate with character devices. Character devices are typically read and written as byte streams. The character device interface provides functions and methods that allow user-mode applications to interact with these devices.

[0136] Specifically, the character device interface can be added during driver initialization. Users can provide user-mode devices (such as character devices) to call the character device interface and send data read / write requests directly to the driver layer through the asynchronous I / O layer. In this case, the data read / write requests sent through the character device interface will be given a specific handle (e.g.) to identify the data read / write request as a pass-through type.

[0137] In this embodiment of the disclosure, the asynchronous I / O layer identifies whether the data read / write request is a pass-through type by recognizing whether the operator of the data read / write request contains a specific handle. This accurately and efficiently completes the determination of the data read / write request type, enabling the user-mode application to communicate directly and efficiently with the device driver. By bypassing the general block layer and other intermediate layers, it significantly reduces the latency of I / O operations and the consumption of system resources, thereby improving the overall performance and response speed of the system.

[0138] In one optional embodiment of this disclosure, the asynchronous I / O layer further includes a result queue; after the driver layer parses the data read / write request and sends the request information of the data read / write request to the processing device for read / write processing, it further includes: receiving the data read / write result fed back by the target processing device; the driver layer stores the data read / write result into the result queue of the asynchronous I / O layer, and the data read / write result in the result queue is used to feed back to the user space.

[0139] A completion queue is a data structure used to store the results of completed I / O requests. Its function is to store the processing results (such as read data, write status, etc.) from the operating system or driver after the I / O request has been processed, so that other applications can retrieve these results from it.

[0140] The Completion Ring Queue (CQ) is used to store the results of completed data read and write operations. These results are ultimately used to provide feedback to user-space applications.

[0141] Optionally, the data read / write results corresponding to the data read / write request can be stored in the CQ as Completion Queue Entry (CQE). A CQE is an entry in the result ring queue, representing the result information after a specific I / O operation is completed. Each CQE contains processing result data about that data read / write operation, helping user-space applications understand the execution status of the request.

[0142] Data read / write results refer to the information returned to the driver layer by the processing device (such as hardware storage devices or virtualization devices) after completing a data read / write request submitted by user space. These results contain specific information about the operation status and returned data, informing the user-space application of the execution status of the request. Data read / write results may include: Operation Status, Error Code, Returned Data, etc. Specifically:

[0143] Operation status: Success: indicates that the data read / write operation was completed successfully; Failure: indicates that the data read / write operation failed to complete successfully, and may be accompanied by a specific error code or reason.

[0144] Error codes: If the operation status is failed, an error code will be provided to help diagnose the problem. Common error codes include: EIO: Input / output error; ENOSPC: Insufficient disk space; ETIMEDOUT: Operation timeout; EACCES: Insufficient permissions; EINVAL: Invalid parameter.

[0145] Returned data: For data read operations, the return value is the target data read from the target processing device; for data write operations, the return value is an acknowledgment that the target data has been successfully written to the target physical address.

[0146] After receiving the data read / write results returned by the target processing device, the driver layer writes the data read / write results into the result ring queue of the asynchronous I / O layer and feeds them back to the user space through the result ring queue.

[0147] Optionally, for data write operations, the feedback information includes: operation status and confirmation information; for data read operations, the feedback information includes: operation status and target data.

[0148] For example, let's take the application of this data read / write method in a data storage scenario as an example to further illustrate the concept. Using the log recording application A as an example, when log recording application A writes 512 bytes of log data to a file named logfile.txt in the user-space file management system, the corresponding kernel space starts writing from sector 1048576, generating a data write request X and corresponding request information X. After the virtio_blk driver layer sends the request information X to the target processing device SSD, the target processing device reads the request information X and obtains the request header information including the read / write type [W], read / write priority ioprio [1], and starting position sector [1048576]. The address information [0x123456789000] and length information [512 bytes] are used to write the log data to be written to the corresponding sector 1048576. Then, the data read / write result X corresponding to the data write request X is fed back: operation status [Success], and the data [successful write confirmation information] is returned. After receiving the data read / write result X, the virtio_blk driver layer writes the data read / write result X into the CQ of the io_uring layer in the form of CQE. Then, the logging application A can receive the data read / write result X about the data write request X through CQ.

[0149] For example, let's further illustrate this using the application of this data read / write method in a data reading scenario. Continuing with the example of the logging application A described above, if a user reads 4096 bytes of historical log data Y from a file named history_logfile.txt in the user-space file management system via the logging application A running in user space, then the corresponding kernel-space read operation starts from sector 2097152 (i.e., 2^21). The logging application A then sends a data read request Y and requests a data buffer of length [4096 bytes]. The vitrio_blk driver layer, after converting the data read request Y into corresponding request information Y, sends the request information Y to the target processing device SSD. The SSD of the processing device reads the historical data Y from the corresponding sector 2097152 according to the physical address information included in the request information Y, and then returns the data read / write result Y: operation status [Success], returned data [historical log data Y]. After receiving the data read / write result Y, the virtio_blk driver layer writes the data read / write result Y into the CQ of the io_uring layer in the form of CQE, and writes the historical data Y into the requested data buffer. Then the log recording application A can receive the data read / write result Y about the data read request Y through CQ.

[0150] In this embodiment of the disclosure, by introducing a Result Ring Queue (CQ) and a Completion Event Entry (CQE) in the asynchronous I / O layer, an efficient and reliable data read and write operation feedback mechanism is achieved, ensuring that each data read and write request can receive accurate result feedback. This simplifies the management and processing logic of operation results in user-mode applications, thereby significantly improving the system's performance, reliability, and user experience.

[0151] In one optional embodiment of this disclosure, before the data read / write results are stored in the result queue of the asynchronous I / O layer via the driver layer, the method further includes: receiving a result query request sent by the user space; and determining the completed target request information based on the result query request.

[0152] The driver layer stores the data read / write results into the result queue of the asynchronous I / O layer, including: the driver layer stores the data read / write results corresponding to the target request information into the result queue of the asynchronous I / O layer.

[0153] After sending a data read / write request, user-space applications can proactively send result query requests to check whether the data read / write request has been completed, instead of waiting for an interrupt. That is, user-space proactively sending result query requests can be seen as a proactive polling mechanism. Through this mechanism, user-space applications can choose when to query the status of which requests based on actual needs, rather than relying on fixed interrupts or timers. This allows them to know as quickly as possible whether certain critical operations have been completed, avoiding the extra waiting time incurred due to interrupts and improving the processing efficiency of data read / write tasks.

[0154] Optionally, active polling can be performed through the poll mechanism of the io_uring layer. The poll mechanism allows user-space applications to actively query the result queue for completed data read / write operations by calling the polling interface of io_uring.

[0155] Optionally, the completion status of data read / write operations can be checked by polling the request information included in `virtio_blk`. Request information is queued in the virtualization queue description table (VRFD table) within the virtualization queue, awaiting processing. Each VRFD contains multiple descriptors, each pointing to a memory region used to store request or response data. Descriptors are linked together in a linked list to form a descriptor chain. The completion status of the request is determined by querying the descriptor chain in the VRFD to find the corresponding `status` field; that is, the operation status of the request is determined as either "Success" or "Failure". The `status` field indicates the completion status or result of the I / O request and is updated by the host machine and notified to the virtual machine (Guest).

[0156] For example, let's further illustrate the application of this data read / write method in a data writing and reading scenario. Continuing with the example of the logging application A, the logging application A needs to: write 512 bytes of log data X to a file named logfile.txt in the storage system; read 4096 bytes of historical log data Y from a file named history_logfile.txt in the storage system; and write 2048 bytes of configuration update data Z to a file named config_update.txt in the storage system. For these three data read / write tasks, the logging application A sends three data read / write requests through the io_uring layer: data read / write request X, data read / write request Y, and data read / write request Z to the virtio_blk driver layer. The virtio_blk driver layer transforms the data read / write requests X, Y, and Z to obtain the corresponding request information X and request information Y. The kernel device receives the data read / write results X and Z, respectively, and sends them to the target processing device SSD for data read / write processing. It then returns the data read / write results X: Operation Status [Success], and the data [Successful Write Confirmation], and the data read / write results Y: Operation Status [Success], and the data [Historical Log Data Y]. The kernel device actively sends result query requests. Upon receiving the result query request, the kernel device determines that the completed target request information is request information X and request information Y, and the incomplete request information is request information Z. It then stores the data read / write results X: Operation Status [Success], and the data [Successful Write Confirmation], and the data read / write results Y: Operation Status [Success], and the data [Historical Log Data Y] corresponding to the completed request information X and request information Y into the result ring queue of the io_uring layer.

[0157] In this embodiment of the disclosure, the active polling mechanism is implemented by sending a result query request from the user space to query whether the data read and write results are completed. This enables the user-space application to flexibly and timely query the completion status of the data read and write requests, avoiding the delay caused by relying on interrupts, thereby significantly improving the processing efficiency of data read and write tasks and the overall performance of the system.

[0158] The following description, in conjunction with Figures 8 to 10, uses the application of the data read / write method provided in this disclosure in the vitrio_blk driver under the io_uring framework as an example to further illustrate the data read / write method. Figure 8 shows a schematic structural framework diagram of a data read / write method provided in an embodiment of this disclosure; Figure 9 shows a schematic diagram of a physical address format conversion provided in an embodiment of this disclosure; and Figure 10 shows a flowchart of the processing procedure of a data read / write method provided in an embodiment of this disclosure.

[0159] As shown in Figure 8: An application running on a user-mode device sends data read / write requests via a character device. The kernel-mode device receives these requests and stores them in a request ring queue. The io_uring layer detects the data read / write requests in the request ring queue. If a .uring_cmd handle is detected, the request type is determined to be pass-through. The request is then sent to the virtio_blk driver layer as a request queue entry (SQE). The virtio_blk driver layer constructs request information conforming to the target format for the data read / write request and converts the address information included in the request to obtain physical address information. The physical address information and the physical address information included in the data read / write request are then compared with the physical address information in the request. The length information and request header information are encapsulated together in the request information; the request information is stored in the core request queue, and based on the device information of each processing device, the request information is allocated to the hardware request queue corresponding to the target processing device. The request information encapsulated in the request information structure is sent to the target processing device through the hardware request queue. The target processing device manages the request information through the virtualized queue description table in the virtual queue; after receiving the request information, the target processing device completes the read and write operations and returns the data read and write results; it receives the result query request sent by the user space device, confirms the completed target request information, stores the data read and write results corresponding to the completed target request information in the result ring queue, and feeds back the data read and write results to the user space device through the result ring queue.

[0160] As shown in Figure 9: The virtio-blk driver conforms to the virtio framework. The virtio framework has a common descriptor convention, namely the virtual queue descriptor structure. Each virtio device has one or more virtual queue descriptor tables used to store descriptor information for information exchange between the driver layer (e.g., the virtio-blk driver) and various processing devices. The virtual queue descriptor structure includes information such as the address, length, operation information, and index corresponding to the read / write operations in the request information. The address and length information have been described in detail previously and will not be repeated here. The operation information refers to the operation mode of the data read / write operations included in the request information; for example, R represents Read, W represents Write, and NXT represents Next. The index information is the pointer to the next request information after the current request information is completed. Specifically, the first line of the virtual queue descriptor structure includes the virtual block device request header information of the request information, the last line includes the status field of the request information, and the middle lines include the address information corresponding to each data read and write operation. By converting the address information corresponding to each data read and write operation in the virtual queue descriptor table, address-related information that conforms to the data format required by the virtio framework is obtained.

[0161] As shown in Figure 10, corresponding to the structural framework diagram of the data read / write method described in Figure 8, the data read / write method includes the following steps:

[0162] Step 1002: Receive data read / write requests sent by user space through the asynchronous I / O layer, and store the data read / write requests in the request ring queue;

[0163] Step 1004: The io_uring layer detects data read / write requests in the request ring queue. If a .uring_cmd handle is detected, the type of the data read / write request is determined to be a pass-through type, and the data read / write request is sent to the virtio_blk driver layer.

[0164] Step 1006: The virtio_blk driver layer constructs request information conforming to the target format for the data read / write request, converts the address information included in the data read / write request to obtain the physical address information, encapsulates the physical address information together with the length information and request header information included in the data read / write request into the request information, and specifies the type of the flag bit;

[0165] Step 1008: Store the request information in the core request queue, and based on the device information of each processing device, allocate the request information to the hardware request queue corresponding to the target processing device, and send the request information to the target processing device through the hardware request queue;

[0166] Step 1010: After receiving the request information, the target processing device completes the read / write operation and returns the data read / write result;

[0167] Step 1012: Receive the result query request sent by the user space, confirm the completed target request information, store the data read / write results corresponding to the completed target request information into the result ring queue, and feed back the data read / write results to the user space through the result ring queue.

[0168] In this embodiment of the disclosure, through efficient pass-through request processing, intelligent request information construction and transformation, optimized request allocation and execution, and proactive polling result feedback mechanism, the overall performance, concurrent processing capability and response speed of data read and write operations are significantly improved. At the same time, the overhead of intermediate layer processing and the latency of cross-core communication are reduced, ensuring the efficiency and stability of the system when processing a large number of data read and write requests and improving the user experience.

[0169] Corresponding to the above method embodiments, this disclosure also provides a data read / write device embodiment. Figure 11 shows a schematic diagram of the structure of a data read / write device provided in one embodiment of this disclosure. As shown in Figure 11, the device includes:

[0170] The receiving module 1102 is configured to receive data read / write requests sent by the user space through the asynchronous I / O layer and store the data read / write requests in the request queue;

[0171] The sending module 1104 is configured to send the data read / write request to the driver layer when the asynchronous I / O layer determines that the data read / write request is of the pass-through type.

[0172] The processing module 1106 is configured to parse data read / write requests through the driver layer and send the request information of the data read / write requests to the target processing terminal device for read / write processing.

[0173] Optionally, the receiving module 1102 receives data read / write requests sent by the user space and stores the data read / write requests in a request queue. The receiving module 1102 is further configured to receive data read / write requests sent by the user space, wherein the data read / write requests are encapsulated with request header information.

[0174] Data read and write requests are stored in the request queue.

[0175] Optionally, the processing module 1106 is further configured to: parse the data read / write request through the driver layer to obtain request header information; determine the address and length information of the data buffer requested by the user mode; obtain the request information of the data read / write request based on the request header information, address information, and length information; and send the request information to the target processing terminal device for read / write processing.

[0176] Optionally, the processing module 1106 is further configured to: convert the address information of the data buffer into physical address information; encapsulate the request header information, physical address information and length information to obtain the request information of the data read / write request.

[0177] Optionally, the request information also includes a flag bit, which is used to mark the type of data read / write request; the processing module 1106 is further configured to: when the data read / write request is a single request, encapsulate the request header information, the physical address information and length information of the data buffer, and set the flag bit to a non-vector type read / write request to obtain the request information of the data read / write request; when the data read / write request is a request sequence, encapsulate the request header information, the physical address information and length information of each data buffer, and set the flag bit to a vector type read / write request to obtain the request information of the data read / write request.

[0178] Optionally, the processing module 1106 further includes: an allocation unit, configured to store the request information into a core request queue based on the correspondence between data read / write requests and request information; allocate the request information from the core request queue to the hardware request queue corresponding to each processing device based on the device information of each processing device; and send the request information to the target processing device for read / write processing through the hardware request queue corresponding to the target processing device.

[0179] Optionally, the sending module 1104 is further configured to: read the operator of the data read / write request; and determine that the data read / write request is a pass-through type if the operator of the data read / write request includes a specific handle.

[0180] Optionally, the asynchronous I / O layer also includes a result queue; the data read / write device further includes: a feedback unit configured to receive data read / write results fed back by the target processing terminal device; the data read / write results are stored in the result queue of the asynchronous I / O layer via the driver layer, and the data read / write results in the result queue are used to provide feedback to the user space.

[0181] Optionally, the feedback unit is further configured to: receive a result query request sent by the user space; determine the completed target request information based on the result query request; and store the data read / write results corresponding to the target request information into the result queue of the asynchronous I / O layer via the driver layer.

[0182] The above is an illustrative scheme of a data read / write device according to this embodiment. It should be noted that the technical solution of this data read / write device and the technical solution of the data read / write method described above belong to the same concept. For details not described in detail in the technical solution of the data read / write device, please refer to the description of the technical solution of the data read / write method described above.

[0183] Referring to Figure 12, Figure 12 shows a structural block diagram of a computing device 1200 according to an embodiment of the present disclosure. The components of the computing device 1200 include, but are not limited to, a memory 1210 and a processor 1220. The processor 1220 is connected to the memory 1210 via a bus 1230, and a database 1250 is used to store data.

[0184] The computing device 1200 also includes an access device 1240, which enables the computing device 1200 to communicate via one or more networks 1260. Examples of such networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 1240 may include one or more of any type of wired or wireless network interface (e.g., a network interface controller (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.

[0185] In one embodiment of this disclosure, the aforementioned components of the computing device 1200, as well as other components not shown in FIG. 12, may also be connected to each other, for example, via a bus. It should be understood that the computing device block diagram shown in FIG. 12 is merely for illustrative purposes and is not intended to limit the scope of this disclosure. Those skilled in the art can add or replace other components as needed.

[0186] The computing device 1200 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 1200 can also be a mobile or stationary server.

[0187] The processor 1220 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above-described data read / write method.

[0188] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the data read and write method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the data read and write method described above.

[0189] An embodiment of this disclosure also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the above-described data read / write method.

[0190] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the data read and write method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the data read and write method described above.

[0191] An embodiment of this disclosure also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described data read / write method.

[0192] The above is an illustrative scheme of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the data read and write method described above belong to the same concept. For details not described in detail in the technical solution of the computer program, please refer to the description of the technical solution of the data read and write method described above.

[0193] The foregoing has described specific embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0194] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0195] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this disclosure are not limited to the described order of actions, because according to the embodiments of this disclosure, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this disclosure.

[0196] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0197] The preferred embodiments disclosed above are merely illustrative of this disclosure. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments of this disclosure. These embodiments are selected and specifically described in this disclosure to better explain the principles and practical applications of the embodiments of this disclosure, thereby enabling those skilled in the art to better understand and utilize this disclosure. This disclosure is limited only by the claims and their full scope and equivalents.

Claims

1. A data read / write method applied in kernel mode, the kernel mode including an asynchronous I / O layer and a driver layer, the asynchronous I / O layer including a request queue; the method includes: The asynchronous I / O layer receives data read / write requests sent by the user space and stores the data read / write requests in the request queue. If the asynchronous I / O layer determines that the data read / write request is a pass-through type, the data read / write request is sent to the driver layer; The driver layer parses the data read / write request and sends the request information to the target processing device for read / write processing.

2. The method according to claim 1, wherein receiving a data read / write request sent by the user space and storing the data read / write request in the request queue comprises: Receive data read / write requests sent from user space, wherein the data read / write requests are encapsulated with request header information; The data read / write requests are stored in the request queue.

3. The method according to claim 2, wherein parsing the data read / write request by the driver layer and sending the request information of the data read / write request to the target processing terminal device for read / write processing includes: The driver layer parses the data read / write request to obtain the request header information; Determine the address and length information of the data buffer requested by the user mode; Based on the request header information, the address information, and the length information, the request information for the data read / write request is obtained; The request information is sent to the target processing device for read / write processing.

4. The method according to claim 3, wherein obtaining the request information of the data read / write request based on the request header information, the address information, and the length information includes: Convert the address information of the data buffer into physical address information; The request header information, the physical address information, and the length information are encapsulated to obtain the request information for the data read / write request.

5. The method according to claim 4, wherein the request information further includes a flag bit, the flag bit being used to mark the type of the data read / write request; the step of encapsulating the request header information, the physical address information, and the length information to obtain the request information of the data read / write request includes: When the data read / write request is a single request, the request header information, the physical address information and length information of the data buffer are encapsulated, and the flag is set to a non-vector type read / write request to obtain the request information of the data read / write request. When the data read / write request is a request sequence, the request header information, the physical address information and length information of each data buffer are encapsulated, and the flag is set to a vector-type read / write request type to obtain the request information of the data read / write request.

6. The method according to any one of claims 3-5, further comprising, after obtaining the request information of the data read / write request based on the request header information, the address information, and the length information: Based on the correspondence between the data read / write request and the request information, the request information is stored in the core request queue; Based on the device information of each processing terminal device, the request information is allocated from the core request queue to the hardware request queue corresponding to each processing terminal device. Sending the request information to the target processing device for read / write processing includes: The request information is sent to the target processing device for read / write processing via the hardware request queue corresponding to the target processing device.

7. The method according to any one of claims 1-6, further comprising, before sending the data read / write request to the driver layer when the asynchronous I / O layer determines that the data read / write request is of the pass-through type: The operator for reading the data read / write request; If the operator of the data read / write request includes a specific handle, the data read / write request is determined to be of the pass-through type.

8. The method according to any one of claims 1-7, wherein the asynchronous I / O layer further includes a result queue; after the driver layer parses the data read / write request and sends the request information of the data read / write request to the target processing device for read / write processing, the method further includes: Receive the data read / write results fed back by the target processing terminal device; The driver layer stores the data read / write results into the result queue of the asynchronous I / O layer, and the data read / write results in the result queue are used to provide feedback to the user space.

9. The method according to claim 8, further comprising, before storing the data read / write result into the result queue of the asynchronous I / O layer via the driver layer: Receive the result query request sent by the user; Based on the result query request, the completed target request information is determined; The process of storing the data read / write results into the result queue of the asynchronous I / O layer via the driver layer includes: The driver layer stores the data read / write results corresponding to the target request information into the result queue of the asynchronous I / O layer.

10. The method according to any one of claims 1-9, wherein, Before receiving data read / write requests sent from user space through the asynchronous I / O layer, the following steps are also included: Initialize the communication mechanism between the asynchronous I / O layer and the driver layer; The communication mechanism includes at least one circular buffer for storing request queues and result queues, ensuring efficient data exchange and minimizing context switching.

11. The method according to claim 1, wherein, The request information also includes device-specific parameters, which are adjusted according to the target processing device type, including: Before sending the request information to the target processing device, the request information is optimized according to the device's specific parameters to match the performance characteristics of the target processing device.

12. The method according to any one of claims 3-6, wherein, After determining the address and length information of the data buffer requested by the user mode, the process also includes: Verify the validity of the address information and the length information; If the address information or the length information is invalid, an error message is returned to the user space, and further processing of the data read / write request is prevented.

13. The method according to any one of claims 1-12, wherein, The kernel-mode device further includes a scheduler module; the method further includes: The scheduler module dynamically adjusts the priority of data read / write requests based on the current system load. The data read and write requests in the request queue are sorted and processed based on the adjusted priority order.

14. The method according to claim 8, wherein, The data read / write results fed back to the user space include detailed performance metrics; The performance metrics include at least: response time, throughput, and whether the predetermined quality of service (QoS) standard is met.

15. The method according to any one of claims 1-14, wherein, After storing the data read / write request in the request queue, the method further includes: Monitor the fill status of the request queue; When the request queue approaches its capacity limit, an expansion mechanism is automatically triggered to increase the capacity of the request queue, ensuring the stability and efficiency of the system.

16. A data read / write device, applied in kernel mode, the kernel mode including an asynchronous I / O layer and a driver layer, the asynchronous I / O layer including a request queue; the device includes: The receiving module is configured to receive data read / write requests sent by the user space through the asynchronous I / O layer, and store the data read / write requests in the request queue; The sending module is configured to send the data read / write request to the driver layer when the asynchronous I / O layer determines that the data read / write request is a pass-through type. The processing module is configured to parse the data read / write request through the driver layer and send the request information of the data read / write request to the target processing terminal device for read / write processing.

17. A data read / write system, comprising user mode, kernel mode and multiple processing terminal devices, wherein the kernel mode includes an asynchronous I / O layer and a driver layer, and the asynchronous I / O layer includes a request queue; The user space is used to send data read / write requests to the kernel space; The asynchronous I / O layer is used to store the data read / write request into the request queue, and when it is determined that the data read / write request is a pass-through type, send the data read / write request to the driver layer; The driver layer is used to parse the data read / write request and send the request information of the data read / write request to the target processing device among the plurality of processing devices; The target processing terminal device is used to perform read and write processing based on the request information.

18. A computing device, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the data read / write method according to any one of claims 1 to 15.

19. A computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the data read / write method according to any one of claims 1 to 15.

20. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the data read / write method according to any one of claims 1 to 15.