Disk access method and device, electronic equipment and storage medium

By obtaining processor information and queue attributes, the command queue is dynamically created to adapt to the performance characteristics of different hard disk media, which solves the performance problem of RAID controllers when using mixed SATA and NVMe disks, and improves system response speed and data processing efficiency.

CN118778910AActive Publication Date: 2024-10-15SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD

Patent Information

Application Number
CN202411273367.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2024-10-15
Estimated Expiration
2044-09-12

AI Technical Summary

Technical Problem

When the RAID controller connects multiple hard disks with different properties, especially when slower SATA disks and faster NVMe disks are mixed, it may cause performance problems, such as a decrease in the performance of the NVMe disk and a decrease in the overall system performance. Take full advantage of the high-speed advantages of NVMe disks.

Method used

By obtaining the processor information of the host and the input and output queue attribute information of the disk array controller, create appropriate input and output command queues, and dynamically select command queues based on the performance attributes of different hard disk media to ensure efficient delivery of read and write commands and avoid The queue is blocked.

Benefits of technology

It improves the overall system response speed and data processing efficiency, ensures the performance advantages of high-speed storage devices such as NVMe disks, and reduces the waste of system resources and the negative impact of low-speed SATA disks on overall system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118778910A_ABST
    Figure CN118778910A_ABST
Patent Text Reader

Abstract

Embodiments of the invention provide a disk access method and apparatus, an electronic device and a storage medium. The method comprises the steps of obtaining processor information of a host and input and output queue attribute information supported by a disk array controller end; creating an input / output command queue according to the processor information and the input / output queue attribute information; in response to an input / output command issued by an upper-layer application of the host end, generating a read-write command and determining an input / output command queue corresponding to the input / output command; and the read-write command is sent to the disk array controller end through the input and output command queue corresponding to the input and output command so as to access the disk, so that the command queue is created according to the performance attribute characteristics of different hard disk media, and the command queue is dynamically selected after the input and output command is issued by the upper-layer application. The overall response speed and the data processing efficiency of the system are improved; and the waste of system resources and the negative influence of the low-speed SATA disk on the overall system performance are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a disk access method and device, electronic equipment, and storage medium. Background Art

[0002] As the volume of data center business increases, the amount of data that a single server needs to process is also growing. This results in the inability of a traditional single physical hard disk to meet the system's requirements in terms of reliability, performance, and capacity. To this end, RAID (Redundant Array of Independent Disks) technology came into being. It improves data reliability and performance by combining multiple independent hard disks into a single logical storage unit. Different RAID levels, such as RAID 0 and RAID 1, can provide optimization for different application scenarios based on their data protection strategies and data distribution methods.

[0003] In the related art, a RAID controller is a dedicated hardware device, usually installed on a computer motherboard or connected to an expansion slot of the motherboard. The RAID controller has its own processor, memory, and interface, which is used to manage multiple hard disks and implement RAID functions. In particular, a RAID controller based on the NVMe (Non-Volatile Memory Express) protocol communicates with the host through a command queue located in the host memory. The specific operation includes the read and write commands issued by the host being placed in the SQ (Submission Queue) queue, and then the RAID controller reads the relevant commands from the SQ queue through the PCIe (Peripheral Component Interconnect Express) Tlp (Transaction Layer Packet) message and executes them. After the execution is completed, the result is placed back in the CQ (Completion Queue) queue in the host memory through the PCIe Tlp message to complete an IO interaction.

[0004] However, although RAID controllers have greatly improved data processing efficiency, they often encounter performance issues when connecting hard disks with different properties, such as using slower SATA (Serial Advanced Technology Attachment) disks and faster NVMe disks at the same time. For example, SATA disks may fill up the SQ queue of the host memory during I / O (Input / Output) operations, causing the host to be unable to issue I / O commands to the NVMe disk, resulting in a decrease in the overall system performance and affecting the performance of NVMe, which cannot take advantage of its high speed. Summary of the invention

[0005] In view of the above problems, a disk access method and device, electronic device, and storage medium are proposed to overcome the above problems or at least partially solve the above problems, including: A disk access method, applied to a host side, comprising: Acquire processor information of the host, and send an identification command to the disk array controller to acquire input and output queue attribute information supported by the disk array controller; wherein the disk array controller is used to send the input and output queue attribute information supported by the disk array controller to the host in response to the identification command issued by the host; Creating an input / output command queue according to the processor information and the input / output queue attribute information; In response to an input / output command sent by an upper layer application on the host side, generating a read / write command and determining the input / output command queue corresponding to the input / output command; The read / write command is sent to the disk array controller end through the input / output command queue corresponding to the input / output command; wherein the disk array controller end is also used to receive the read / write command and perform disk access according to the read / write command.

[0006] Optionally, creating an input / output command queue according to the processor information and the input / output queue attribute information includes: Determine processor quantity information and input / output queue attribute type information according to the processor information and the input / output queue attribute information; The input / output command queue is created according to the processor quantity information and the input / output queue attribute type information.

[0007] Optionally, before generating a read / write command in response to an input / output command sent by an upper layer application on the host side and determining the input / output command queue corresponding to the input / output command, the method further includes: A queue mapping relationship table is created according to the processor information, the input / output queue attribute information and the input / output command queue.

[0008] Optionally, the determining the input / output command queue corresponding to the input / output command includes: The input / output command queue corresponding to the input / output command is determined according to the input / output command and the queue mapping relationship table.

[0009] Optionally, the method further includes: receiving an asynchronous event notification sent by the disk array controller end, and determining whether an input / output queue attribute change event has occurred on the disk array controller end according to the asynchronous event notification; wherein the disk array controller end is further used to send the asynchronous event notification to the host end in response to the asynchronous event occurring on the disk array controller end; If the input / output queue attribute change event occurs on the disk array controller, the step of sending an identification command to the disk array controller to obtain the input / output queue attribute information supported by the disk array controller is performed again.

[0010] Optionally, after creating the queue mapping relationship table, the process further includes: Receive the attribute information of the namespace in the disk array sent by the disk array controller; wherein the disk array controller is also used to send the attribute information of the namespace in the disk array to the host.

[0011] Optionally, determining the input / output command queue corresponding to the input / output command according to the input / output command and queue mapping relationship table includes: Determine the attribute information of the namespace accessed by the input / output command request, and determine the input / output command queue corresponding to the input / output command according to the attribute information of the namespace accessed by the input / output command request and the queue mapping relationship table.

[0012] Optionally, before obtaining the processor information of the host, the method further includes: The queue depth information and single command size information supported by the disk array controller are obtained.

[0013] Optionally, creating an input / output command queue according to the processor information and the input / output queue attribute information includes: The input / output command queue is created according to the processor information, the input / output queue attribute information, the queue depth information and the single command size information.

[0014] Optionally, after creating the input and output command queue, the process further includes: The first address information of the input and output command queue is sent to the disk array controller end; wherein the disk array controller end is also used to receive the first address information sent by the host end and save the first address information inside the disk array controller.

[0015] A disk access method, applied to a disk array controller, comprises: In response to an identification command issued by the host side, the input and output queue attribute information supported by the disk array controller side is sent to the host side; wherein the host side is used to obtain the processor information of the host, and send the identification command to the disk array controller side to obtain the input and output queue attribute information supported by the disk array controller side; and create an input and output command queue according to the processor information and the input and output queue attribute information; Receive read and write commands, and perform disk access according to the read and write commands; wherein the host end is also used to generate read and write commands and determine the input and output command queue corresponding to the input and output commands in response to the input and output commands issued by the upper-layer application of the host end; send the read and write commands to the disk array controller end through the input and output command queue corresponding to the input and output commands.

[0016] Optionally, the method further includes: In response to an asynchronous event occurring at the disk array controller end, an asynchronous event notification is sent to the host end; wherein the host end is also used to receive the asynchronous event notification sent by the disk array controller end, and determine whether an input / output queue attribute change event has occurred at the disk array controller end based on the asynchronous event notification; if the input / output queue attribute change event has occurred at the disk array controller end, the step of sending an identification command to the disk array controller end is executed again to obtain the input / output queue attribute information supported by the disk array controller end.

[0017] Optionally, before receiving the read / write command and accessing the disk according to the read / write command, the method further includes: Sending attribute information of the namespace in the disk array to the host end, wherein the host end is further used to create a queue mapping relationship table according to the processor information, the input / output queue attribute information and the input / output command queue; receiving the attribute information of the namespace in the disk array sent by the disk array controller end; determining the attribute information of the namespace accessed by the input / output command request, and determining the input / output command queue corresponding to the input / output command according to the attribute information of the namespace accessed by the input / output command request and the queue mapping relationship table.

[0018] Optionally, before sending the attribute information of the namespace in the disk array to the host, the method further includes: The namespace is created in the disk array, and attribute information corresponding to the namespace is recorded.

[0019] Optionally, after sending the input and output queue attribute information supported by the disk array controller to the host, the method further includes: Receive the first address information sent by the host end and save the first address information inside the disk array controller; wherein the host end is also used to send the first address information of the input and output command queue to the disk array controller end.

[0020] A disk access device, applied to a host side, comprising: an identification command sending module, used for acquiring the processor information of the host, and sending an identification command to the disk array controller end to acquire the input and output queue attribute information supported by the disk array controller end; wherein the disk array controller end is used for sending the input and output queue attribute information supported by the disk array controller end to the host end in response to the identification command sent by the host end; A command queue creation module, used to create an input and output command queue according to the processor information and the input and output queue attribute information; A command queue determination module, configured to generate a read / write command and determine the input / output command queue corresponding to the input / output command in response to the input / output command sent by the upper layer application of the host end; A read / write command sending module is used to send the read / write command to the disk array controller end through the input / output command queue corresponding to the input / output command; wherein the disk array controller end is also used to receive the read / write command and perform disk access according to the read / write command.

[0021] A disk access device, applied to a disk array controller, comprising: The attribute information sending module is used to send the input and output queue attribute information supported by the disk array controller to the host in response to the identification command sent by the host; wherein the host is used to obtain the processor information of the host and send the identification command to the disk array controller to obtain the input and output queue attribute information supported by the disk array controller; and create an input and output command queue according to the processor information and the input and output queue attribute information; A read / write command receiving module is used to receive read / write commands and perform disk access according to the read / write commands; wherein the host end is also used to generate read / write commands and determine the input / output command queue corresponding to the input / output command in response to the input / output commands issued by the upper-layer application of the host end; and send the read / write commands to the disk array controller end through the input / output command queue corresponding to the input / output command.

[0022] An electronic device comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the disk access method as described above when executed by the processor.

[0023] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the disk access method described above is implemented.

[0024] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the computer program implements the disk access method as described above.

[0025] The embodiments of the present invention have the following advantages: In an embodiment of the present invention, by obtaining the processor information of the host and sending an identification command to the disk array controller end, the input and output queue attribute information supported by the disk array controller end is obtained; and an input and output command queue is created according to the processor information and the input and output queue attribute information; thereby, in response to the input and output commands issued by the upper-layer application of the host end, a read and write command is generated and the input and output command queue corresponding to the input and output command is determined; and then the read and write command is sent to the disk array controller end through the input and output command queue corresponding to the input and output command for disk access, thereby creating a command queue according to the performance attribute characteristics of different hard disk media and dynamically selecting the command queue after the upper-layer application issues the input and output command, thereby improving the overall response speed and data processing efficiency of the system; avoiding the performance degradation of high-speed NVMe disks due to queue blocking; optimizing the performance coordination between different storage devices, ensuring that high-speed storage devices such as NVMe disks can give full play to their performance advantages; reducing the waste of system resources and the negative impact of low-speed SATA disks on the overall system performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0027] Figure 1 It is a schematic diagram of the structure of a RAID controller using a mixture of SATA disks and NVMe disks in the related art provided by the present invention; Figure 2 It is a schematic diagram of the command queue mechanism in the related technology provided by the present invention; Figure 3 is a flowchart of the steps of a disk access method provided by some embodiments of the present invention; Figure 4 It is a schematic diagram of the structure of a RAID controller for mixed use of SATA disks and NVMe disks provided by some embodiments of the present invention; Figure 5 is a flowchart of the steps of a disk access method provided by some embodiments of the present invention; Figure 6 is a schematic diagram of a RAID controller queue initialization process provided by some embodiments of the present invention; Figure 7 It is a schematic diagram of an asynchronous reporting process for dynamically adjusting a RAID controller queue attribute provided in some embodiments of the present invention; Figure 8 It is a schematic diagram of the interaction process between the RAID controller Namespace and the host provided in some embodiments of the present invention; Fig. 9 is a schematic diagram of the structure of a disk access device provided by some embodiments of the present invention; Fig.10 It is a structural diagram of a disk access device provided by some embodiments of the present invention. DETAILED DESCRIPTION

[0028] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] As the volume of data center business increases, the amount of data that a single server needs to process is also growing. This results in the inability of traditional single physical hard disks to meet the system's requirements in terms of reliability, performance, and capacity. As storage technology continues to develop, RAID technology has become an important means to solve this problem. RAID technology improves data reliability and performance by combining multiple independent hard disks into a single logical storage unit. Different RAID levels (such as RAID 0, RAID 1, RAID 5, RAID 6, RAID 10, etc.) have their own advantages and applicable scenarios based on different data protection strategies and data distribution methods, and are widely used in enterprise-level servers, storage systems, data centers and other environments.

[0030] A RAID controller is a dedicated hardware device that is usually installed on a computer motherboard or connected to an expansion slot on the motherboard. The RAID controller has its own processor, memory, and interface to manage multiple hard disks and implement RAID functions. The NVMe-based RAID controller communicates with the host through a command queue located in the host memory. The specific operation includes the read and write commands issued by the host being placed in the SQ queue, and then the RAID controller reads the relevant commands from the SQ queue through the PCIe Tlp message and executes them. After the execution is completed, the result is placed back into the CQ queue in the host memory through the PCIe Tlp message to complete an IO interaction.

[0031] However, when a RAID controller is connected to multiple hard disks with different attributes (such as different media), some performance issues may occur. For example, due to the slow speed of SATA disks, I / O commands may fill up the SQ queue of the host memory, resulting in the host being unable to issue I / O commands to the NVMe disk. Or, inside the RAID controller, the I / O of the SATA disk occupies too many system resources due to the slow processing speed, or even exhausts the resources, which will also affect the performance of the NVMe disk, and eventually reduce the performance of the NVMe disk to the same level as the SATA disk.

[0032] Despite these performance issues, considering the differences in performance and price between NVMe and SATA drives, most companies are still unable to completely replace SATA drives with NVMe drives. The usual practice is to apply RAID arrays composed of NVMe drives to scenarios that require high-speed IO response, and to apply RAID arrays composed of SATA drives to scenarios that require large-capacity data storage. Therefore, RAID controllers that use a mixture of SATA and NVMe drives are widely used in related technologies.

[0033] like Figure 1The figure shows the structure diagram of the RAID controller that uses a mixture of SATA disks and NVMe disks in the related technology. The RAID controller communicates with the host through the PCIe bus. The RAID controller is connected to SATA disks (i.e. HDD, mechanical hard disks) and NVMe disks (i.e. SSD, solid-state drives) using different media. Inside the RAID controller, the management functions of NVMeController (controller), Raid group, and Namespace (namespace) are implemented; when the RAID controller is initialized, the command queue SQ / CQ is created in the host memory, and the CPU is bound to the command queue SQ / CQ one by one. The internal logic organizes the connected hard disks into two RAID arrays according to different media, and creates a certain number of Namespaces on each RAID array. IO reading and writing are performed by mapping the Namespace to the host side as a block device. By Figure 1 As can be seen from the content, multiple hard disks of different media form different RAID arrays and Namespaces, but they all interact through the same set of command queues in the host memory. Since the performance of SATA disks is much lower than that of NVMe disks, the command queue may be over-occupied or even full by the SATA disk IO, which may cause the NVMe disk to have a risk of command response delay or even timeout, and reduce the performance of NVMe to the same level as SATA. The root cause of the above problems is: 1. The NVMe protocol is designed for SSDs that use Flash as storage media, pursuing high performance (i.e., high bandwidth and high IOPS (Input / Output Operations Per Second)). However, SATA disks are significantly inferior to NVMe disks in performance, and the IOPS performance of the two can differ by four orders of magnitude.

[0034] 2. The design reason of the command queue mechanism in the host NVMe driver. Although the mechanism supports up to 64K queues, the NVMe driver binds the CPU to the command queue one-to-one, so that the I / O requests of the Namespace composed of different media hard disks can be submitted to any IO queue; Figure 2 As shown in the figure, the number of host CPUs is 2, and each CPU is bound to an IO command queue. Head and tail respectively represent the starting position of the current command queue and the position of the element being processed. Max_depth represents the maximum depth of the command queue, that is, the maximum number of elements supported. In actual applications, the following situations often occur: Case 1: The upper-layer application of the host sends IO through the CPU (1), and the current IO command queue (1) contains a mixture of NVMe disk IO and SATA disk IO. Although the elements of the current IO command queue (1) are not full (tail is less than depth), when the host has high concurrent NVMe disk IO, the number of free elements in the IO command queue (1) cannot meet the concurrent requirements of the NVMe disk IO, resulting in NVMe disk IO concurrent back pressure. It is necessary to wait until there are free elements in the IO command queue (1) before continuing to send NVMe disk IO.

[0035] Case 2: The upper-layer application of the host sends IO through the CPU (2). The current IO command queue (2) is full of SATA IO (tail equals depth). When the host sends NVMe disk IO, there are no free elements in the IO command queue (2), resulting in NVMe disk IO blocking. It is necessary to wait until there are free elements in the IO command queue (2) before sending NVMe disk IO again.

[0036] From the above content, we can find that when the physical disks connected to the RAID controller are mixed with NVMe and SATA, the performance defects of the host IO will inevitably reduce the actual performance of the NVMe disk.

[0037] In the embodiment of the present invention, based on the core technical concept of creating a command queue according to the performance attribute characteristics of different hard disk media and dynamically selecting the command queue after the upper layer application issues an input and output command, the disk access method in the related art is improved. The present invention will be described in detail below with reference to the accompanying drawings: Reference Figure 3 , shows a flowchart of a disk access method provided by some embodiments of the present invention, which is applied to a host side and may specifically include the following steps: Step 301, obtaining processor information of the host, and sending an identification command to the disk array controller to obtain input and output queue attribute information supported by the disk array controller; wherein the disk array controller is used to send the input and output queue attribute information supported by the disk array controller to the host in response to the identification command issued by the host; In order to facilitate the understanding of the technical solution of the present invention, the following explanations are given for the relevant professional terms involved in the present invention: RAID: Redundant Array of Independent Disks, which is a redundant array composed of independent disks. It is composed of many independent disks, combined into a disk group with huge capacity, and uses the additive effect of data provided by individual disks to improve the performance of the entire disk system.

[0038] NVMe: Non-Volatile Memory Express, which is a non-volatile memory host controller interface specification, is a logical device interface specification. It is a bus transmission protocol specification based on the device logical interface similar to AHCI (Serial ATA Advanced Host Controller Interface) (equivalent to the application layer in the communication protocol), used to access non-volatile memory media (such as solid-state hard drives using flash memory) attached through the PCI Express (PCIe) bus, although in theory it does not necessarily require the PCIe bus protocol.

[0039] SATA: Serial Advanced Technology Attachment, also known as Serial ATA advanced host interface or advanced host controller interface, is a new hard disk interface specification jointly proposed by Intel, IBM, Maxtor and Seagate. Because it uses a serial connection, hard disks using SATA interfaces are also called serial port hard disks.

[0040] PCIe: It is the abbreviation of Peripheral Component Interconnect Express, which is a high-speed serial bus standard for connecting computer motherboards and external devices. It replaces the traditional PCI (Peripheral Component Interconnect) bus and provides higher bandwidth and lower latency.

[0041] IO: It is the abbreviation of Input / Output, that is, input and output.

[0042] IOPS: It is the abbreviation of Input / Output Per Second, which is the input and output volume (or read and write times) per second. It is one of the main indicators for measuring the performance of storage media. IOPS refers to the number of read and write requests that the system can process per second.

[0043] SQ: It is the abbreviation of Submission Queue, which is specified in the NVMe protocol. It is a queue used by the host side to store submission commands. It is generally created in the host memory. The address of the queue is notified to the device through the NVMe related registers mapped by the PCIe Bar space, so as to interact with commands between the host and the device.

[0044] CQ: It is the abbreviation of Completion Queue, which is specified in the NVMe protocol. It is a queue used by the device side to store command completion results. It is generally created in the host memory. The address of the queue is notified to the device through the NVMe related registers mapped by the PCIe Bar space, so as to interact with commands between the host and device sides.

[0045] Namespace: Namespace is specified in the NVMe protocol and is used to represent a collection of a certain number of logical blocks, which is equivalent to the concept of logical volume in storage.

[0046] AER: Asynchronous Event Request, which is an asynchronous event request command defined by the NVMe protocol. It is a mechanism for the host to register asynchronous event notifications with the storage device.

[0047] AEN: is the abbreviation of Asynchronous Event Notice, which is an asynchronous event response command defined by the NVMe protocol. It is used to notify the host of the occurrence of asynchronous events when asynchronous events occur inside the storage device. The host performs corresponding processing according to different event types.

[0048] In a specific implementation, the disk array controller end may be a RAID controller end, that is, an independent redundant array of disks controller end. The input and output queue attribute information may be determined by a hard disk medium connected to the disk array controller end. On this basis, in order to facilitate the implementation of the disk access method provided in the embodiment of the present invention, a two-dimensional array may be defined: int map[NUM_CPUS][NUM_QUEUES_ATTRS]; Specifically, the two-dimensional array can be used to save the mapping relationship between the CPU, input and output queue attributes and the input and output command queue, where NUM_CPUS can represent the number of host CPUs, NUM_QUEUES_ATTRS can represent the IO queue attributes (for example, it can be divided into NVMe attributes, SATA attributes, etc. according to different media), the one-dimensional index can represent cpuId (CPU ID), and the value range is 0-NUM_CPUS-1, the two-dimensional index can represent attrsId (attribute ID), and the value range is 0-NUM_QUEUES_ATTRS-1, and the value corresponding to the array map can represent the index of the corresponding input and output command queue under a certain CPU + a certain queue attribute.

[0049] Furthermore, the content related to the RAID controller supporting multiple IO attribute features can be added to the NVMe protocol Identify Controller data structure (CNS 01h), as shown in Table 1 below: Table 1: Example of adding content to the identification controller data structure

[0050] Furthermore, the IO attribute characteristics related to the Namespace can be added to the NVMe protocol Identify Namespace data structure (CNS 00h), as shown in Table 2 below: Table 2: Example of adding content to the identification namespace data structure

[0051] Furthermore, asynchronous event notification information of IO queue attribute changes may be added to AER (Asynchronous Event Request), as shown in Table 3 below: Table 3: Example of adding asynchronous event notification information in asynchronous event request command

[0052] Based on the above content, the host can obtain the number of processors on the host, and can send an identify command (CNS 01h) to the RAID controller to obtain controller information, that is, obtain information related to the device's ability to support multiple IO queue attributes from the 110th Byte of the Identify Controller datastructure. It can determine whether the device supports multiple IO queue attributes based on Bit0, and can obtain the type and quantity information of multiple IO queue attributes supported by the device based on Bit1~Bit7; this is used to create input and output command queues in subsequent steps.

[0053] In some embodiments of the present invention, before obtaining the processor information of the host, the method further includes: The queue depth information and single command size information supported by the disk array controller are obtained.

[0054] In actual applications, in addition to the processor information and the input and output queue attribute information supported by the disk array controller, the queue depth information and the single command size information supported by the disk array controller can also be obtained, so as to be used together for the corresponding steps of creating the input and output command queue, thereby improving the practicality of the created input and output command queue and ensuring the efficient configuration and performance maximization of the command queue; Specifically, after the host completes the allocation of the device Bar space in the initialization phase, it can read the queue supported depth (ie, queue depth information) and the size of a single command (ie, single command size information) from the configuration space capability register of the RAID controller device.

[0055] Step 302, creating an input / output command queue according to the processor information and the input / output queue attribute information; In a specific implementation, the host side can create [(CPU number)*(IO queue attribute type number)] IO command queues in the memory according to the host side's CPU number information, IO queue attribute type number information (i.e., input and output queue attribute type information), queue depth information supported by the disk array controller side, and single command size information; for example, when the host CPU number is 8 and the IO queue attribute type number is 2 (NVMe and SATA), 16 IO command queues can be created in the memory according to the host side's CPU number information, IO queue attribute type number information, queue depth information supported by the disk array controller side, and single command size information.

[0056] In some embodiments of the present invention, the step of creating an input / output command queue according to the processor information and the input / output queue attribute information includes: Determine processor quantity information and input / output queue attribute type information according to the processor information and the input / output queue attribute information; The input / output command queue is created according to the processor quantity information and the input / output queue attribute type information.

[0057] In actual applications, the host side can create [(CPU number)*(IO queue attribute type number)] IO command queues in memory based on the host side's CPU number information, IO queue attribute type number information (i.e. input and output queue attribute type information), queue depth information supported by the disk array controller side, and single command size information to ensure the integrity and rationality of the mapping relationship, thereby enhancing the system's configuration flexibility and scalability.

[0058] In some embodiments of the present invention, after creating the input and output command queue, the method further includes: The first address information of the input and output command queue is sent to the disk array controller end; wherein the disk array controller end is also used to receive the first address information sent by the host end and save the first address information inside the disk array controller.

[0059] In actual applications, after successfully creating an IO command queue, the host side can write the first address of the IO command queue in the control register of the RAID controller device configuration space; the RAID controller device side can receive the first address of the IO command queue written by the host side through an interrupt and save it inside the RAID controller device; further, the RAID controller device can initialize the initial values ​​of two registers of the IO command queue to 0. The two registers represent the index of the elements in the queue, which are called head and tail respectively, where the head is used to record the position index of the command extracted from the IO command queue by the device, and the tail is used to record the position index of the command put into the IO command queue of the RAID controller device by the host side (the host side can update the tail value after adding elements to the IO command queue, and the RAID controller device can update the head value after extracting elements from the IO command queue).

[0060] In some embodiments of the present invention, the step of creating an input / output command queue according to the processor information and the input / output queue attribute information includes: The input / output command queue is created according to the processor information, the input / output queue attribute information, the queue depth information and the single command size information.

[0061] In a specific implementation, the host side can create [(CPU number)*(IO queue attribute type number)] IO command queues in the memory according to the host side's CPU number information, IO queue attribute type number information (i.e., input and output queue attribute type information), queue depth information supported by the disk array controller side, and single command size information; for example, when the host CPU number is 8 and the IO queue attribute type number is 2 (NVMe and SATA), 16 IO command queues can be created in the memory according to the host side's CPU number information, IO queue attribute type number information, queue depth information supported by the disk array controller side, and single command size information.

[0062] Step 303, in response to the input / output command sent by the upper layer application of the host, generate a read / write command and determine the input / output command queue corresponding to the input / output command; In the specific implementation, Figure 4As shown, when the RAID controller is initialized, the host driver can obtain the RAID controller information through the identify command (that is, obtain the RAID controller's multi-IO queue attribute support capability and attribute type quantity according to the 110th byte of the Controller data structure (CNS 01h) (Bit0 represents the multi-IO queue attribute support capability (set to 1 for support, set to 0 for non-support), Bit1~Bit7 represents the number of IO queue attribute types)). When binding the IO queue, a two-dimensional array can be defined according to the number of CPUs and the number of queue attributes to save the mapping relationship between the CPU, IO queue attributes and IO command queue index. Figure 4 As can be seen from the content, the number of host CPUs is 8, and the number of IO queue attribute types is 2 (NVMe and SATA). Therefore, int map[8][2] can be defined to save the queue mapping relationship. Assuming that queue indexes 1, 3, 5, ..., 15 correspond to the SATA disk IO command queues of 8 CPUs, and queue indexes 2, 4, 6, ..., 16 correspond to the NVMe disk IO command queues of 8 CPUs, the two-dimensional array of the mapping relationship can be obtained as follows: map[8][2]={{1,2},{3,4},{5,6},{7,8},{9,10},{11,12},{13,14},{15,16}}.

[0063] Therefore, after the host successfully creates an IO queue, it can apply for a queue mapping table map according to the number of CPUs and the number of queue attributes, bind the cpuID, queue attribute ID and queue index one by one, and generate a binding relationship of the multidimensional array int map[i][j] (where i represents cpuId, j represents queue attribute id, and the value of map[i][j] represents the mapped input and output command queue id); thus, the input and output command queue corresponding to the input and output command can be directly determined according to the input and output command issued by the upper-layer application on the host side and the mapping table to realize disk access.

[0064] In some embodiments of the present invention, before generating a read / write command in response to an input / output command issued by an upper layer application on the host side and determining the input / output command queue corresponding to the input / output command, the process further includes: A queue mapping relationship table is created according to the processor information, the input / output queue attribute information and the input / output command queue.

[0065] In actual applications, after the host successfully creates an IO queue, it can apply for a queue mapping table map according to the number of CPUs and the number of queue attributes, bind the cpuID, queue attribute ID and queue index one by one, and generate a binding relationship of the multidimensional array intmap[i][j] (where i represents cpuId, j represents queue attribute id, and the value of map[i][j] represents the mapped input and output command queue id); thereby, the input and output command queue corresponding to the input and output command can be determined according to the input and output command issued by the upper-layer application on the host side and the mapping table to realize disk access.

[0066] In some embodiments of the present invention, determining the input / output command queue corresponding to the input / output command includes: The input / output command queue corresponding to the input / output command is determined according to the input / output command and the queue mapping relationship table.

[0067] In practical applications, such as Figure 4 As shown, when the RAID controller is initialized, the host driver can obtain the RAID controller information through the identify command (that is, obtain the RAID controller's multi-IO queue attribute support capability and attribute type quantity according to the 110th byte of the Controller data structure (CNS 01h) (Bit0 represents the multi-IO queue attribute support capability (set to 1 for support, set to 0 for non-support), Bit1~Bit7 represents the number of IO queue attribute types)). When binding the IO queue, a two-dimensional array can be defined according to the number of CPUs and the number of queue attributes to save the mapping relationship between the CPU, IO queue attributes and IO command queue index. Figure 4 As can be seen from the content, the number of host CPUs is 8, and the number of IO queue attribute types is 2 (NVMe and SATA). Therefore, int map[8][2] can be defined to save the queue mapping relationship. Assuming that queue indexes 1, 3, 5, ..., 15 correspond to the SATA disk IO command queues of 8 CPUs, and queue indexes 2, 4, 6, ..., 16 correspond to the NVMe disk IO queues of 8 CPUs, the two-dimensional array of the mapping relationship can be obtained as follows: map[8][2]={{1,2},{3,4},{5,6},{7,8},{9,10},{11,12},{13,14},{15,16}}.

[0068] Therefore, after the host successfully creates the IO queue, it can apply for the queue mapping table map according to the number of CPUs and the number of queue attributes, bind the cpuID, queue attribute ID and queue index one by one, and generate the binding relationship of the multidimensional array int map[i][j] (where i represents cpuId, j represents queue attribute id, and the value of map[i][j] represents the mapped input and output command queue id); thus, the input and output command queue corresponding to the input and output command can be directly determined according to the input and output command and the mapping table sent by the upper-level application on the host side to realize disk access, which helps to accurately direct the input and output commands to the appropriate command queue, thereby improving processing efficiency and system response speed.

[0069] In some embodiments of the present invention, after creating the queue mapping relationship table, the method further includes: Receive the attribute information of the namespace in the disk array sent by the disk array controller; wherein the disk array controller is also used to send the attribute information of the namespace in the disk array to the host.

[0070] In actual applications, multiple SATA disks connected to the RAID controller can be combined into a RAID array, recorded as RAID#0, and three different Namespaces can be created on RAID#0, recorded as NS#0, NS#1 and NS#2, and the IO attribute corresponding to the Namespace is marked as 1 (SATA). Multiple NVMe disks can be combined into another RAID array, recorded as RAID#1, and three different Namespaces can be created on RAID#1, recorded as NS#3, NS#4 and NS#5, and the IO attribute corresponding to the Namespace is marked as 2 (NVMe). Therefore, according to the IO attribute type, NS#0, NS#1 and NS#2 can be indirectly bound to the odd-index queue on each CPU, and NS#3, NS#4 and NS#5 can be indirectly bound to the even-index queue on each CPU; when the host performs IO reading and writing on NS#0, NS#1 and NS#2, the command interaction can be directly performed through the corresponding SATA attribute queue on the CPU, and when the host performs IO reading and writing on NS#3, NS#4 and NS#5, the command interaction can be directly performed through the corresponding NVMe attribute queue on the CPU.

[0071] On this basis, after creating the queue mapping relationship table, the disk array controller can send the attribute information of the marked namespace in the disk array (including IO queue attributes) to the host side, so as to determine the input and output command queue corresponding to the input and output command according to the attribute information of the namespace accessed by the input and output command request and the queue mapping relationship table, so as to isolate SATA and NVMe on the host IO path, ensure the performance of each, and achieve the purpose of overall IO acceleration of the RAID controller.

[0072] In some embodiments of the present invention, determining the input / output command queue corresponding to the input / output command according to the input / output command and queue mapping relationship table includes: Determine the attribute information of the namespace accessed by the input / output command request, and determine the input / output command queue corresponding to the input / output command according to the attribute information of the namespace accessed by the input / output command request and the queue mapping relationship table.

[0073] In the specific implementation, after receiving and saving the Namespace attribute information (including IO queue attributes) sent by the disk array controller, the host can generate a read / write command after receiving an IO request for the Namespace (i.e., an input / output command issued by the upper-layer application on the host), and route it to the specified IO command queue according to the IO queue attribute information of the Namespace and the queue mapping table to complete an IO interaction, further optimizing the disk read / write performance and reducing latency.

[0074] Specifically, the overall process of the host receiving and saving the Namespace attribute information sent by the disk array controller may include: After the host is initialized and the command queue mapping table is generated, the RAID controller can create a RAID array, create a Namespace on the array, mark the queue attribute corresponding to the Namespace, generate an asynchronous notification of the Namespace attribute change event and send it to the host; after the host receives AEN, it can initiate a rescan Namespace request to the RAID controller device (that is, send an Identify Active Namespace ID list request), the RAID controller device can assemble the identify command response, and send the active Namespace id list in the system to the host (the RAID controller device generates the CQE (Completion Queue Entry) of the Identify Active Namespace IDlist); the host can send an Identify Namespace data structure request to the RAID controller after updating the Namespace list saved on the local side; the RAID controller can assemble the identify command response and send the detailed information of the Namespace (including IO queue attributes) to the host (the RAID controller device generates the Identify Namespace data structure). structure's CQE); the host can then update the Namespace attribute information (including IO queue attributes) saved on the local side, wait for the IO request of the Namespace, and route it to the specified IO command queue according to the IO queue attributes to complete an IO interaction.

[0075] Step 304, sending the read / write command to the disk array controller via the input / output command queue corresponding to the input / output command; wherein the disk array controller is also used to receive the read / write command and perform disk access according to the read / write command.

[0076] In actual applications, after the host completes the binding of the CPU, IO queue attributes and the IO command queue mapping relationship, it can wait for the upper-layer application on the host to issue input and output commands, generate corresponding read and write commands, and route the read and write commands to the specified IO command queue through the binding relationship. According to the IO command queue, the read and write commands are sent to the disk array controller for disk access processing.

[0077] In some embodiments of the present invention, the method further comprises: receiving an asynchronous event notification sent by the disk array controller end, and determining whether an input / output queue attribute change event has occurred on the disk array controller end according to the asynchronous event notification; wherein the disk array controller end is further used to send the asynchronous event notification to the host end in response to the asynchronous event occurring on the disk array controller end; If the input / output queue attribute change event occurs on the disk array controller, the step of sending an identification command to the disk array controller to obtain the input / output queue attribute information supported by the disk array controller is performed again.

[0078] In the specific implementation, when the RAID controller is initialized on the host side, it can automatically send an AER (Asynchronous Event Request) command to register the asynchronous notification generated by the RAID controller for a certain event; specifically, when the IO queue attribute changes inside the RAID controller, it can first determine whether there is a blocking wait for the AER command. If there is a blocking wait for the AER command, the RAID controller can assemble the response CQE (called Asynchronous Event Notice) of the AER command according to the event type and event information, and interrupt the host to extract CQE from CQ to complete the processing of AEN. If there is no blocking wait for the AER command, the event generated this time can be directly saved in the internal event queue of the RAID controller, and AEN can be sent after the AER command is issued.

[0079] Furthermore, after receiving AEN, the host can obtain the event type Event Type and event information Event Information through Dword 0. If the Event Type is judged to be Notice and the Event Information is QueueAttribute Changed, the identify command (CNS 01h) can be sent to the RAID controller again to re-obtain the RAID controller information and obtain the device's ability to support multiple IO queue attributes from the 110th Byte of the RAID controller information Identify Controller data structure. That is, whether the RAID controller device supports multiple IO queue attributes is obtained according to Bit0, and the number of RAID controller device IO queue attribute types is obtained according to Bit1~Bit7.

[0080] Furthermore, the host side can update the queue mapping table map generated in the previous stage according to the newly acquired queue attribute information and the number of CPUs, and continue to wait for new IO to be issued after the mapping table is updated, so as to route it to the specified IO command queue for processing through the new binding relationship.

[0081] Reference Figure 5 , shows a flowchart of a disk access method provided by some embodiments of the present invention, which is applied to a disk array controller and may specifically include the following steps: Step 501, in response to an identification command issued by a host end, sending input and output queue attribute information supported by the disk array controller end to the host end; wherein the host end is used to obtain processor information of the host, and send the identification command to the disk array controller end to obtain the input and output queue attribute information supported by the disk array controller end; and create an input and output command queue according to the processor information and the input and output queue attribute information; In a specific implementation, the host can obtain the number of processors on the host, and can send an identify command (CNS 01h) to the RAID controller to obtain controller information, that is, to obtain information related to the device's ability to support multiple IO queue attributes from the 110th Byte of the Identify Controller datastructure, and can determine whether the device supports multiple IO queue attributes based on Bit0, and can obtain information on the number of types of multiple IO queue attributes supported by the device based on Bit1~Bit7; Furthermore, the host side can create [(CPU number)*(IO queue attribute type number)] IO command queues in the memory according to the host side's CPU number information, IO queue attribute type number information (i.e., input and output queue attribute type information), queue depth information supported by the disk array controller side, and single command size information; for example, when the host CPU number is 8 and the IO queue attribute type number is 2 (NVMe and SATA), 16 IO command queues can be created in the memory according to the host side's CPU number information, IO queue attribute type number information, queue depth information supported by the disk array controller side, and single command size information.

[0082] In some embodiments of the present invention, after sending the input and output queue attribute information supported by the disk array controller to the host, the method further includes: Receive the first address information sent by the host end and save the first address information inside the disk array controller; wherein the host end is also used to send the first address information of the input and output command queue to the disk array controller end.

[0083] In actual applications, after successfully creating an IO command queue, the host side can write the first address of the IO command queue in the control register of the RAID controller device configuration space; the RAID controller device side can receive the first address of the IO command queue written by the host side through an interrupt and save it inside the RAID controller device; further, the RAID controller device can initialize the initial values ​​of two registers of the IO command queue to 0. The two registers represent the index of the elements in the queue, which are called head and tail respectively, where the head is used to record the position index of the command extracted from the IO command queue by the device, and the tail is used to record the position index of the command put into the IO command queue of the RAID controller device by the host side (the host side can update the tail value after adding elements to the IO command queue, and the RAID controller device can update the head value after extracting elements from the IO command queue).

[0084] Step 502, receiving read and write commands, and performing disk access according to the read and write commands; wherein the host end is also used to generate read and write commands and determine the input and output command queue corresponding to the input and output commands in response to the input and output commands issued by the upper-layer application of the host end; and send the read and write commands to the disk array controller end through the input and output command queue corresponding to the input and output commands.

[0085] In the specific implementation, Figure 4 As shown, when the RAID controller is initialized, the host driver can obtain the RAID controller information through the identify command (that is, obtain the RAID controller's multi-IO queue attribute support capability and attribute type quantity according to the 110th byte of the Controller data structure (CNS 01h) (Bit0 represents the multi-IO queue attribute support capability (set to 1 for support, set to 0 for non-support), Bit1~Bit7 represents the number of IO queue attribute types)). When binding the IO queue, a two-dimensional array can be defined according to the number of CPUs and the number of queue attributes to save the mapping relationship between the CPU, IO queue attributes and IO command queue index. Figure 4 As can be seen from the content, the number of host CPUs is 8, and the number of IO queue attribute types is 2 (NVMe and SATA). Therefore, int map[8][2] can be defined to save the queue mapping relationship. Assuming that queue indexes 1, 3, 5, ..., 15 correspond to the SATA disk IO command queues of 8 CPUs, and queue indexes 2, 4, 6, ..., 16 correspond to the NVMe disk IO queues of 8 CPUs, the two-dimensional array of the mapping relationship can be obtained as follows: map[8][2]={{1,2},{3,4},{5,6},{7,8},{9,10},{11,12},{13,14},{15,16}}.

[0086] Therefore, after the host successfully creates an IO queue, it can apply for a queue mapping table map according to the number of CPUs and the number of queue attributes, bind the cpuID, queue attribute ID and queue index one by one, and generate a binding relationship of the multidimensional array int map[i][j] (where i represents cpuId, j represents queue attribute id, and the value of map[i][j] represents the mapped input and output command queue id); thus, the input and output command queue corresponding to the input and output command can be directly determined according to the input and output command issued by the upper-layer application on the host side and the mapping table to realize disk access.

[0087] Furthermore, after the host completes the binding of the CPU, IO queue attributes and the IO command queue mapping relationship, it can wait for the upper-layer application on the host to issue input and output commands, generate corresponding read and write commands, and route the read and write commands to the specified IO command queue through the binding relationship, and send the read and write commands to the disk array controller end for disk access processing according to the IO command queue.

[0088] In some embodiments of the present invention, the method further comprises: In response to an asynchronous event occurring at the disk array controller end, an asynchronous event notification is sent to the host end; wherein the host end is also used to receive the asynchronous event notification sent by the disk array controller end, and determine whether an input / output queue attribute change event has occurred at the disk array controller end based on the asynchronous event notification; if the input / output queue attribute change event has occurred at the disk array controller end, the step of sending an identification command to the disk array controller end is executed again to obtain the input / output queue attribute information supported by the disk array controller end.

[0089] In the specific implementation, when the RAID controller is initialized on the host side, it can automatically send an AER (Asynchronous Event Request) command to register the asynchronous notification generated by the RAID controller for a certain event; specifically, when the IO queue attribute changes inside the RAID controller, it can first determine whether there is a blocking wait for the AER command. If there is a blocking wait for the AER command, the RAID controller can assemble the response CQE (called Asynchronous Event Notice) of the AER command according to the event type and event information, and interrupt the host to extract CQE from CQ to complete the processing of AEN. If there is no blocking wait for the AER command, the event generated this time can be directly saved in the internal event queue of the RAID controller, and AEN can be sent after the AER command is issued.

[0090] Furthermore, after receiving AEN, the host can obtain the event type Event Type and event information Event Information through Dword 0. If the Event Type is judged to be Notice and the Event Information is QueueAttribute Changed, the identify command (CNS 01h) can be sent to the RAID controller again to re-obtain the RAID controller information and obtain the device's ability to support multiple IO queue attributes from the 110th Byte of the RAID controller information Identify Controller data structure. That is, whether the RAID controller device supports multiple IO queue attributes is obtained according to Bit0, and the number of RAID controller device IO queue attribute types is obtained according to Bit1~Bit7.

[0091] Furthermore, the host side can update the queue mapping table map generated in the previous stage according to the newly acquired queue attribute information and the number of CPUs, and continue to wait for new IO to be issued after the mapping table is updated, so as to route it to the specified IO command queue for processing through the new binding relationship.

[0092] In some embodiments of the present invention, before receiving the read / write command and performing disk access according to the read / write command, the method further includes: Sending attribute information of the namespace in the disk array to the host end, wherein the host end is further used to create a queue mapping relationship table according to the processor information, the input / output queue attribute information and the input / output command queue; receiving the attribute information of the namespace in the disk array sent by the disk array controller end; determining the attribute information of the namespace accessed by the input / output command request, and determining the input / output command queue corresponding to the input / output command according to the attribute information of the namespace accessed by the input / output command request and the queue mapping relationship table.

[0093] In actual applications, multiple SATA disks connected to the RAID controller can be combined into a RAID array, recorded as RAID#0, and three different Namespaces can be created on RAID#0, recorded as NS#0, NS#1 and NS#2, and the IO attribute corresponding to the Namespace is marked as 1 (SATA). Multiple NVMe disks can be combined into another RAID array, recorded as RAID#1, and three different Namespaces can be created on RAID#1, recorded as NS#3, NS#4 and NS#5, and the IO attribute corresponding to the Namespace is marked as 2 (NVMe). Therefore, according to the IO attribute type, NS#0, NS#1 and NS#2 can be indirectly bound to the odd-index queue on each CPU, and NS#3, NS#4 and NS#5 can be indirectly bound to the even-index queue on each CPU; when the host performs IO reading and writing on NS#0, NS#1 and NS#2, the command interaction can be directly performed through the corresponding SATA attribute queue on the CPU, and when the host performs IO reading and writing on NS#3, NS#4 and NS#5, the command interaction can be directly performed through the corresponding NVMe attribute queue on the CPU.

[0094] On this basis, after creating the queue mapping relationship table, the disk array controller can send the attribute information of the marked namespace in the disk array (including IO queue attributes) to the host side, so as to determine the input and output command queue corresponding to the input and output command according to the attribute information of the namespace accessed by the input and output command request and the queue mapping relationship table, so as to isolate SATA and NVMe on the host IO path, ensure the performance of each, and achieve the purpose of overall IO acceleration of the RAID controller.

[0095] Furthermore, after receiving and saving the Namespace attribute information (including IO queue attributes) sent by the disk array controller, the host can generate a read / write command after receiving an IO request for the Namespace (i.e., an input / output command issued by an upper-layer application on the host), and route it to a specified IO command queue according to the IO queue attribute information of the Namespace and the queue mapping table to complete an IO interaction, thereby further optimizing the disk read / write performance and reducing latency.

[0096] Specifically, the overall process of the host receiving and saving the Namespace attribute information sent by the disk array controller may include: After the host is initialized and the command queue mapping table is generated, the RAID controller can create a RAID array, create a Namespace on the array, mark the queue attribute corresponding to the Namespace, generate an asynchronous notification of the Namespace attribute change event and send it to the host; after receiving the AEN, the host can initiate a rescan Namespace request to the RAID controller device (that is, send an Identify Active Namespace ID list request), the RAID controller device can assemble the identify command response, and send the active Namespace id list in the system to the host (the RAID controller device generates the CQE of the Identify Active Namespace IDlist); the host can send the Identify Namespace data structure request to the RAID controller after updating the Namespace list saved on the local side; the RAID controller can assemble the identify command response and send the detailed information of the Namespace (including IO queue attributes) to the host (the RAID controller device generates the Identify Namespace data structure). structure's CQE); the host can then update the Namespace attribute information (including IO queue attributes) saved on the local side, wait for the IO request of the Namespace, and route it to the specified IO command queue according to the IO queue attributes to complete an IO interaction.

[0097] In some embodiments of the present invention, before sending the attribute information of the namespace in the disk array to the host, the method further includes: The namespace is created in the disk array, and attribute information corresponding to the namespace is recorded.

[0098] In actual applications, multiple SATA disks connected to the RAID controller can be combined into a RAID array, recorded as RAID#0, and three different Namespaces can be created on RAID#0, recorded as NS#0, NS#1 and NS#2, and the IO attribute corresponding to the Namespace is marked as 1 (SATA). Multiple NVMe disks can be combined into another RAID array, recorded as RAID#1, and three different Namespaces can be created on RAID#1, recorded as NS#3, NS#4 and NS#5, and the IO attribute corresponding to the Namespace is marked as 2 (NVMe). Therefore, according to the IO attribute type, NS#0, NS#1 and NS#2 can be indirectly bound to the odd-index queue on each CPU, and NS#3, NS#4 and NS#5 can be indirectly bound to the even-index queue on each CPU; when the host performs IO reading and writing on NS#0, NS#1 and NS#2, the command interaction can be directly performed through the corresponding SATA attribute queue on the CPU, and when the host performs IO reading and writing on NS#3, NS#4 and NS#5, the command interaction can be directly performed through the corresponding NVMe attribute queue on the CPU.

[0099] On this basis, after creating the queue mapping relationship table, the disk array controller can send the attribute information of the marked namespace in the disk array (including IO queue attributes) to the host side, so as to determine the input and output command queue corresponding to the input and output command according to the attribute information of the namespace accessed by the input and output command request and the queue mapping relationship table, so as to isolate SATA and NVMe on the host IO path, ensure the performance of each, and achieve the purpose of overall IO acceleration of the RAID controller.

[0100] The following will be combined Figure 6-Figure 8 The embodiments of the present invention are further described as follows: like Figure 6 As shown, the RAID controller queue initialization process in the embodiment of the present invention can be summarized as follows: 1. During the host initialization phase, the Bar space of the RAID controller device is allocated, and the depth supported by the queue and the size of a single command are read from the configuration space capability register of the RAID controller device; 2. The host sends an identify command (CNS 01h) to the RAID controller to obtain the controller information (IdentifyController data structure), obtain the device's ability to support multiple IO queue attributes from the 110th Byte of the Identify Controller data structure, obtain whether the device supports multiple IO queue attributes based on Bit0, and obtain the number of device multiple IO queue attributes based on Bit1~Bit7; 3. The host obtains the number of CPUs and creates [(number of CPUs)*(number of multi-IO queue attributes)] IO command queues in memory according to the number of CPUs, the number of multi-IO queue attributes, the queue depth, and the size of a single command; 4. After the host successfully creates the IO command queue, it writes the first address of the queue into the control register of the RAID controller device configuration space; 5. The RAID controller device receives the first address of the IO command queue written by the host through an interrupt and saves it inside the RAID controller device; 6. The initial values ​​of the two registers of the IO command queue of the RAID controller device are 0. The two registers represent the index of the elements in the queue, which are called head and tail respectively. The head is used to record the position index of the command extracted from the IO command queue by the RAID controller device, and the tail is used to record the position index of the command put into the IO command queue of the RAID controller device by the host (the tail value is updated after the host adds an element to the IO command queue, and the head value is updated after the RAID controller device extracts an element from the IO command queue); 7. After the host successfully creates the IO command queue, it applies for the queue mapping table map according to the number of CPUs and the number of queue attributes, binds the cpuID, queue attribute ID, and queue index one by one, and generates the binding relationship of the multidimensional array int map[i][j] (i represents cpuId, j represents queue attribute id, and map[i][j] value represents the mapped command queue id); 8. After the host completes the binding of the CPU, IO queue attributes and IO command queue mapping relationship, it waits for the upper layer to send IO, generates NVMe read and write commands, and routes them to the specified IO command queue for processing through the binding relationship.

[0101] like Figure 7 As shown, the asynchronous reporting process of the dynamic adjustment of the RAID controller queue attribute in the embodiment of the present invention can be summarized as follows: 1. When the host is initialized, the RAID controller automatically sends an AER (Asynchronous Event Request) command to register the asynchronous notification generated by the RAID controller for a certain event; 2. When the IO queue attribute changes occur inside the RAID controller, first determine whether there is a blocking wait for the AER command. If so, the RAID controller assembles the response CQE (called Asynchronous Event Notice) of the AER command based on the event type and event information, and interrupts the host to extract CQE from CQ to complete the processing of AEN. Otherwise, the event generated this time is saved in the internal event queue of the RAID controller, and AEN is sent after the AER command is issued.

[0102] 3. After receiving AEN, the host obtains the event type Event Type and event information EventInformation through Dword 0. If the Event Type is determined to be Notice and the Event Information is Queue AttributeChanged, the identify command (CNS 01h) is sent to the RAID controller again to obtain the controller information again. The ability of the RAID controller device to support multiple IO queue attributes is obtained from the 110th Byte of the controller information Identify Controller data structure. Whether the RAID controller device supports multiple IO queue attributes is obtained based on Bit0, and the number of types of the device's multiple IO queue attributes is obtained based on Bit1~Bit7.

[0103] 4. The host updates the queue mapping table map generated in the initialization phase based on the newly acquired queue attribute information and the number of CPUs. After the update is completed, it continues to wait for new IO to be issued and routes it to the specified IO command queue for processing through the new binding relationship.

[0104] like Figure 8 As shown, the interaction process between the RAID controller Namespace and the host in the embodiment of the present invention can be summarized as follows: After the host is initialized and the command queue mapping table is generated, the RAID controller can create a RAID array, create a Namespace on the array, mark the queue attribute corresponding to the Namespace, generate an asynchronous notification of the Namespace attribute change event and send it to the host; after receiving the AEN, the host can initiate a rescan Namespace request to the RAID controller device (that is, send an Identify Active Namespace ID list request), the RAID controller device can assemble the identify command response, and send the active Namespace id list in the system to the host (the RAID controller device generates the CQE of the Identify Active Namespace IDlist); the host can send the Identify Namespace data structure request to the RAID controller after updating the Namespace list saved on the local side; the RAID controller can assemble the identify command response and send the detailed information of the Namespace (including IO queue attributes) to the host (the RAID controller device generates the Identify Namespace data structure). structure's CQE); the host can then update the Namespace attribute information (including IO queue attributes) saved on the local side, wait for the IO request of the Namespace, and route it to the specified IO command queue according to the IO queue attributes to complete an IO interaction.

[0105] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0106] Reference Fig. 9 , shows a schematic diagram of the structure of a disk access device provided by some embodiments of the present invention, which is applied to a host side and may specifically include the following modules: The identification command sending module 901 is used to obtain the processor information of the host and send an identification command to the disk array controller to obtain the input and output queue attribute information supported by the disk array controller; wherein the disk array controller is used to send the input and output queue attribute information supported by the disk array controller to the host in response to the identification command sent by the host; A command queue creation module 902, used to create an input and output command queue according to the processor information and the input and output queue attribute information; A command queue determination module 903, configured to generate a read / write command and determine the input / output command queue corresponding to the input / output command in response to the input / output command sent by the upper layer application of the host end; The read / write command sending module 904 is used to send the read / write command to the disk array controller end through the input / output command queue corresponding to the input / output command; wherein the disk array controller end is also used to receive the read / write command and perform disk access according to the read / write command.

[0107] In some embodiments of the present invention, the command queue creation module 902 includes: A quantity determination submodule, used to determine processor quantity information and input / output queue attribute type information according to the processor information and the input / output queue attribute information; The command queue creates a first submodule, which is used to create the input and output command queue according to the processor quantity information and the input and output queue attribute type information.

[0108] In some embodiments of the present invention, the device further comprises: The queue mapping relationship table creation module is used to create a queue mapping relationship table according to the processor information, the input and output queue attribute information and the input and output command queue.

[0109] In some embodiments of the present invention, the command queue determination module 903 includes: The command queue determination submodule is used to determine the input / output command queue corresponding to the input / output command according to the input / output command and the queue mapping relationship table.

[0110] In some embodiments of the present invention, the device further comprises: an asynchronous event notification receiving module, configured to receive an asynchronous event notification sent by the disk array controller, and determine whether an input / output queue attribute change event has occurred on the disk array controller according to the asynchronous event notification; wherein the disk array controller is further configured to send the asynchronous event notification to the host in response to an asynchronous event occurring on the disk array controller; The identification command re-sending module is used to execute the step of sending the identification command to the disk array controller again to obtain the input and output queue attribute information supported by the disk array controller if the input and output queue attribute change event occurs on the disk array controller.

[0111] In some embodiments of the present invention, the device further comprises: The namespace attribute information receiving module is used to receive the attribute information of the namespace in the disk array sent by the disk array controller; wherein the disk array controller is also used to send the attribute information of the namespace in the disk array to the host.

[0112] In some embodiments of the present invention, the command queue determination submodule includes: The command queue determination unit is used to determine the attribute information of the namespace accessed by the input / output command request, and determine the input / output command queue corresponding to the input / output command according to the attribute information of the namespace accessed by the input / output command request and the queue mapping relationship table.

[0113] In some embodiments of the present invention, the device further comprises: The information acquisition module is used to obtain the queue depth information and single command size information supported by the disk array controller.

[0114] In some embodiments of the present invention, the command queue creation module 902 includes: The command queue creates a second submodule, which is used to create the input and output command queue according to the processor information, the input and output queue attribute information, the queue depth information and the single command size information.

[0115] In some embodiments of the present invention, the device further comprises: The first address information sending module is used to send the first address information of the input and output command queue to the disk array controller end; wherein, the disk array controller end is also used to receive the first address information sent by the host end and save the first address information inside the disk array controller.

[0116] Reference Fig.10, shows a schematic diagram of the structure of a disk access device provided by some embodiments of the present invention, which is applied to a disk array controller end and may specifically include the following modules: The attribute information sending module 1001 is used to send the input and output queue attribute information supported by the disk array controller to the host in response to the identification command sent by the host; wherein the host is used to obtain the processor information of the host and send the identification command to the disk array controller to obtain the input and output queue attribute information supported by the disk array controller; and create an input and output command queue according to the processor information and the input and output queue attribute information; The read / write command receiving module 1002 is used to receive read / write commands and perform disk access according to the read / write commands; wherein the host end is also used to generate read / write commands and determine the input / output command queue corresponding to the input / output command in response to the input / output commands issued by the upper-layer application of the host end; and send the read / write commands to the disk array controller end through the input / output command queue corresponding to the input / output command.

[0117] In some embodiments of the present invention, the device further comprises: An asynchronous event notification sending module is used to send an asynchronous event notification to the host end in response to an asynchronous event occurring at the disk array controller end; wherein the host end is also used to receive the asynchronous event notification sent by the disk array controller end, and determine whether an input / output queue attribute change event has occurred at the disk array controller end based on the asynchronous event notification; if the input / output queue attribute change event has occurred at the disk array controller end, the step of sending an identification command to the disk array controller end is executed again to obtain the input / output queue attribute information supported by the disk array controller end.

[0118] In some embodiments of the present invention, the device further comprises: The attribute information sending module is used to send the attribute information of the namespace in the disk array to the host end, wherein the host end is also used to create a queue mapping relationship table according to the processor information, the input / output queue attribute information and the input / output command queue; receive the attribute information of the namespace in the disk array sent by the disk array controller end; determine the attribute information of the namespace accessed by the input / output command request, and determine the input / output command queue corresponding to the input / output command according to the attribute information of the namespace accessed by the input / output command request and the queue mapping relationship table.

[0119] In some embodiments of the present invention, the device further comprises: The attribute information recording module is used to create the namespace in the disk array and record the attribute information corresponding to the namespace.

[0120] In some embodiments of the present invention, the device further comprises: The first address information receiving module is used to receive the first address information sent by the host end and save the first address information inside the disk array controller; wherein the host end is also used to send the first address information of the input and output command queue to the disk array controller end.

[0121] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0122] Some embodiments of the present invention further provide a computer program product, including a computer program, which implements the above transaction processing method based on a multi-core processor system when executed by a processor.

[0123] Some embodiments of the present invention further provide an electronic device, comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the disk access method as described above when executed by the processor.

[0124] Some embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the disk access method described above is implemented.

[0125] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0126] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0127] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0128] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0130] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0131] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.

[0132] The above is a detailed introduction to a disk access method and device, an electronic device, and a storage medium. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A disk access method, characterized in that: Applied to the host side, the method includes: Acquire processor information of the host, and send an identification command to the disk array controller to acquire input and output queue attribute information supported by the disk array controller; wherein the disk array controller is used to send the input and output queue attribute information supported by the disk array controller to the host in response to the identification command issued by the host; Creating an input / output command queue according to the processor information and the input / output queue attribute information; In response to an input / output command sent by an upper layer application on the host side, generating a read / write command and determining the input / output command queue corresponding to the input / output command; The read / write command is sent to the disk array controller end through the input / output command queue corresponding to the input / output command; wherein the disk array controller end is also used to receive the read / write command and perform disk access according to the read / write command.

2. The method according to claim 1, characterized in that The step of creating an input / output command queue according to the processor information and the input / output queue attribute information includes: Determine processor quantity information and input / output queue attribute type information according to the processor information and the input / output queue attribute information; The input / output command queue is created according to the processor quantity information and the input / output queue attribute type information.

3. The method according to claim 1, characterized in that Before generating a read / write command in response to an input / output command sent by the upper layer application of the host and determining the input / output command queue corresponding to the input / output command, the method further comprises: A queue mapping relationship table is created according to the processor information, the input / output queue attribute information and the input / output command queue.

4. The method according to claim 3, characterized in that The determining the input / output command queue corresponding to the input / output command comprises: The input / output command queue corresponding to the input / output command is determined according to the input / output command and the queue mapping relationship table.

5. The method according to claim 1, characterized in that The method further comprises: receiving an asynchronous event notification sent by the disk array controller end, and determining whether an input / output queue attribute change event has occurred on the disk array controller end according to the asynchronous event notification; wherein the disk array controller end is further used to send the asynchronous event notification to the host end in response to the asynchronous event occurring on the disk array controller end; If the input / output queue attribute change event occurs on the disk array controller, the step of sending an identification command to the disk array controller to obtain the input / output queue attribute information supported by the disk array controller is performed again.

6. The method according to claim 4, characterized in that After the queue mapping relationship table is created, the following steps are also included: Receive the attribute information of the namespace in the disk array sent by the disk array controller; wherein the disk array controller is also used to send the attribute information of the namespace in the disk array to the host.

7. The method according to claim 6, characterized in that The step of determining the input / output command queue corresponding to the input / output command according to the input / output command and the queue mapping relationship table includes: Determine the attribute information of the namespace accessed by the input / output command request, and determine the input / output command queue corresponding to the input / output command according to the attribute information of the namespace accessed by the input / output command request and the queue mapping relationship table.

8. The method according to claim 1, characterized in that Before obtaining the processor information of the host, the method further includes: The queue depth information and single command size information supported by the disk array controller are obtained.

9. The method according to claim 8, characterized in that The step of creating an input / output command queue according to the processor information and the input / output queue attribute information includes: The input / output command queue is created according to the processor information, the input / output queue attribute information, the queue depth information and the single command size information.

10. The method according to claim 1, characterized in that After creating the input and output command queue, the following steps are also included: The first address information of the input and output command queue is sent to the disk array controller end; wherein the disk array controller end is also used to receive the first address information sent by the host end and save the first address information inside the disk array controller.

11. A disk access method, characterized in that: Applied to a disk array controller, the method comprises: In response to an identification command issued by the host side, the input and output queue attribute information supported by the disk array controller side is sent to the host side; wherein the host side is used to obtain the processor information of the host, and send the identification command to the disk array controller side to obtain the input and output queue attribute information supported by the disk array controller side; and create an input and output command queue according to the processor information and the input and output queue attribute information; Receive read and write commands, and perform disk access according to the read and write commands; wherein the host end is also used to generate read and write commands and determine the input and output command queue corresponding to the input and output commands in response to the input and output commands issued by the upper-layer application of the host end; send the read and write commands to the disk array controller end through the input and output command queue corresponding to the input and output commands.

12. The method according to claim 11, characterized in that The method further comprises: In response to an asynchronous event occurring at the disk array controller end, an asynchronous event notification is sent to the host end; wherein the host end is also used to receive the asynchronous event notification sent by the disk array controller end, and determine whether an input / output queue attribute change event has occurred at the disk array controller end based on the asynchronous event notification; if the input / output queue attribute change event has occurred at the disk array controller end, the step of sending an identification command to the disk array controller end is executed again to obtain the input / output queue attribute information supported by the disk array controller end.

13. The method according to claim 11, characterized in that Before receiving the read / write command and performing disk access according to the read / write command, the method further includes: Sending attribute information of the namespace in the disk array to the host end, wherein the host end is further used to create a queue mapping relationship table according to the processor information, the input / output queue attribute information and the input / output command queue; receiving the attribute information of the namespace in the disk array sent by the disk array controller end; determining the attribute information of the namespace accessed by the input / output command request, and determining the input / output command queue corresponding to the input / output command according to the attribute information of the namespace accessed by the input / output command request and the queue mapping relationship table.

14. The method according to claim 13, characterized in that Before sending the attribute information of the namespace in the disk array to the host, the method further includes: The namespace is created in the disk array, and attribute information corresponding to the namespace is recorded.

15. The method according to claim 11, characterized in that After sending the input and output queue attribute information supported by the disk array controller to the host, the method further includes: Receive the first address information sent by the host end and save the first address information inside the disk array controller; wherein the host end is also used to send the first address information of the input and output command queue to the disk array controller end.

16. A disk access device, characterized in that: Applied to the host side, the device comprises: an identification command sending module, used for acquiring the processor information of the host, and sending an identification command to the disk array controller end to acquire the input and output queue attribute information supported by the disk array controller end; wherein the disk array controller end is used for sending the input and output queue attribute information supported by the disk array controller end to the host end in response to the identification command sent by the host end; A command queue creation module, used to create an input and output command queue according to the processor information and the input and output queue attribute information; A command queue determination module, configured to generate a read / write command and determine the input / output command queue corresponding to the input / output command in response to the input / output command sent by the upper layer application of the host end; A read / write command sending module is used to send the read / write command to the disk array controller end through the input / output command queue corresponding to the input / output command; wherein the disk array controller end is also used to receive the read / write command and perform disk access according to the read / write command.

17. A disk access device, characterized in that: Applied to a disk array controller, the device comprises: The attribute information sending module is used to send the input and output queue attribute information supported by the disk array controller to the host in response to the identification command sent by the host; wherein the host is used to obtain the processor information of the host and send the identification command to the disk array controller to obtain the input and output queue attribute information supported by the disk array controller; and create an input and output command queue according to the processor information and the input and output queue attribute information; A read / write command receiving module is used to receive read / write commands and perform disk access according to the read / write commands; wherein the host end is also used to generate read / write commands and determine the input / output command queue corresponding to the input / output command in response to the input / output commands issued by the upper-layer application of the host end; and send the read / write commands to the disk array controller end through the input / output command queue corresponding to the input / output command.

18. An electronic device, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the disk access method according to any one of claims 1 to 10 or claims 11 to 15 is implemented.

19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the disk access method according to any one of claims 1 to 10 or claims 11 to 15 is implemented.

20. A computer program product, characterized in that The invention comprises a computer program, which implements the disk access method according to any one of claims 1 to 10 or claims 11 to 15 when being executed by a processor.

Citation Information

Patent Citations

  • Front-end command processing method and device for improving SSD performance, computer equipment and storage medium

    CN111221476A

  • NVME communication system and method based on PCIE interface

    CN115454902A

  • RAID (redundant array of independent disks) management method and system, electronic equipment and storage medium

    CN115657961A

  • Message distribution method and device and storage medium

    CN116225742A

  • Method, system and device for accelerating execution of NVMe protocol and storage medium

    CN116382581A

Cited By

  • Disk selection method and system for RAID1 disk array read operation

    CN119415044A

  • Event notification method and device, equipment, medium and product

    CN119847792A

  • Method, device, medium and product for data processing

    CN120386750A

  • Data request processing method and device, equipment and storage medium

    CN120687041A

  • RAID controller interaction method, RAID controller, electronic equipment and storage medium

    CN122795312A