Read-write command processing method and product

By building a request resource pool and response resource pool in the NVMe protocol, and processing read and write commands and responses in the sliding window, the IO inefficiency caused by uneven allocation of IO queue resource in the NVMe protocol is solved, and more efficient IO processing is achieved.

CN119960827APending Publication Date: 2025-05-09SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510030969.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

In the NVMe protocol, each IO queue needs to allocate resources separately, resulting in unbalanced resource use and reduced IO efficiency.

Method used

By building a request resource pool and a response resource pool, the host's read and write command queue and response queue are pooled and processed in the first sliding window in the request resource pool and the second sliding window in the response resource pool.

Benefits of technology

It effectively improves IO efficiency and avoids the resource inequality caused by allocating resources to each queue separately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119960827A_ABST
    Figure CN119960827A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a read-write command processing method and product, and the method comprises the steps: obtaining any read-write command in a plurality of read-write command queues of any host of storage equipment, and adding the read-write command in a request resource pool; processing any read-write command in the request resource pool according to a first sliding window in the request resource pool, and adding a command response corresponding to any read-write command into a response resource pool; and processing any command response in the response resource pool according to a second sliding window in the response resource pool. The embodiment of the invention aims to improve the IO efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of data processing, and in particular, to a method and product for processing read and write commands. Background Art

[0002] With the development of information technologies such as artificial intelligence, the Internet of Things, and cloud computing, more and more intelligent hardware has emerged. The amount of business data related to intelligent hardware has also increased exponentially, and the storage performance requirements for data center servers have become increasingly higher. In order to improve performance, researchers have designed many high-performance storage protocols such as the NVMe (Non Volatile Memory Host Controller Interface Specification) protocol.

[0003] At present, the common NVMe protocol implementation method is to develop NVMe software on the host side and the device side respectively. The host-side NVMe software creates a set of management command submission / response queues and configures the queue addresses to the device registers. Then, the IO (Input / Output) queue creation command is written to the management command submission queue, and the IO command submission / response queue address is notified to the device-side NVMe software. After that, the host-side NVMe software sends IO commands (such as data reading and writing) to the device through the IO command submission / response queue, and the device NVMe software transfers data between the host and the device according to the IO command content.

[0004] However, in this process, the NVMe protocol needs to allocate resources separately for each IO queue. In the actual process, the operation status of each IO queue is uncertain, and the resource usage is also different. Therefore, some queues may have sufficient resources while others may have insufficient resources, resulting in reduced IO efficiency. Summary of the invention

[0005] The embodiments of the present application provide a method and product for processing read and write commands, aiming to improve IO efficiency.

[0006] In a first aspect, an embodiment of the present application provides a method for processing a read / write command, which is applied to a storage device, and the method includes: Obtain any read / write command from a plurality of read / write command queues of any host of the storage device, and add the command to the request resource pool; According to the first sliding window in the request resource pool, any read or write command in the request resource pool is processed, and a command response corresponding to any read or write command is added to the response resource pool; Any command response in the response resource pool is processed according to the second sliding window in the response resource pool.

[0007] Optionally, the method further comprises: Constructing the request resource pool, wherein the request resource pool is used to store read and write commands in all read and write command queues of any host of the storage device; Constructing the response resource pool, wherein the response resource pool is used to store command responses in all response queues; The request resource pool and the response resource pool are both configured as a ring buffer, which stores the read and write commands or command responses in sequence according to the time sequence of the read and write commands or command responses.

[0008] Optionally, processing any read or write command in the request resource pool according to the first sliding window in the request resource pool includes: In the request resource pool, sliding a first sliding window in the direction of the time sequence of the read and write commands; In the current first sliding window, a first processing strategy is executed to process multiple read and write commands in the current first sliding window.

[0009] Optionally, executing a first processing strategy includes: Processing the multiple read and write commands in the current first sliding window in sequence by polling according to the time sequence of the read and write commands; In the process of polling processing, when the first read-write command in the current first sliding window is successfully processed, the blocking flag of the first sliding window is set to a non-blocking state, the polling process for the current first sliding window is ended, and the current first sliding window is slid by a unit length in the direction of the time sequence of the read-write commands, and the current first sliding window is updated, and the unit length is the size of a read-write command; When the first read / write command in the current first sliding window is not successfully processed, the blocking flag of the first sliding window is set to a blocking state, and any read / write command of the current first sliding window is continuously polled and processed.

[0010] Optionally, continuing to poll and process any read and write command of the current first sliding window includes: Determine whether any read or write command has a completion flag; When the read / write command has a completion mark, polling is performed on the next read / write command; When the read / write command does not have a completion flag, processing the read / write command; If the read / write command is processed, a completion mark is added to the read / write command, and the next read / write command is processed in a polling manner; If the read / write command is not processed completely, the next read / write command will be processed in a polling manner.

[0011] Optionally, executing the first processing strategy further includes: During the polling process, if any read / write command except the first read / write command in the current first sliding window is processed, the first read / write command in the current first sliding window is reprocessed; If the first read / write command in the current first sliding window has not been processed, the first read / write command in the current first sliding window is moved to the last position of the current first sliding window, and the current first sliding window is slid by a unit length along the time sequence of the commands.

[0012] Optionally, processing any command response in the response resource pool according to the second sliding window in the response resource pool includes: In the response resource pool, sliding a second sliding window in the direction of the time sequence of the command responses; In the current second sliding window, multiple command responses in the current second sliding window are processed in sequence by polling according to the time sequence of the command responses; In the process of polling processing, when the first command response in the current second sliding window is successfully processed, the blocking flag of the second sliding window is set to a non-blocking state, the polling process for the current second sliding window is ended, and the current second sliding window is slid by a unit length in the direction of the time sequence of the command responses, and the current second sliding window is updated, where the unit length is the size of a command response; When the first command response in the current second sliding window is not successfully processed, setting the blocking flag of the second sliding window to a blocking state, and continuing to poll and process any command response in the current second sliding window; For any command response, if the command response does not have a completion mark, process the command response, add a completion mark to the command response after the command response is processed, and poll for the next command response; if the command response is not processed, poll for the next command response; If the command response has a completion flag, poll and process the next command response; If during the polling process, any command response in the current second sliding window except the first command response is processed, the first command response in the current second sliding window is reprocessed; If the first command response in the current second sliding window has not been processed, the first command response in the current second sliding window is moved to the last position of the current second sliding window, and the current second sliding window is slid by a unit length along the chronological order of the command responses.

[0013] In a second aspect, an embodiment of the present application provides a computer device, comprising: at least one processor, and a memory, wherein the memory stores a computer program that can be run on the processor, wherein when the processor executes the computer program, a method for processing read and write commands described in the first aspect of the embodiment is executed.

[0014] In a third aspect, an embodiment of the present application provides a non-volatile readable storage medium, wherein the non-volatile readable storage medium stores a computer program, wherein when the computer program is executed by a processor, a method for processing read and write commands described in the first aspect of the embodiment is performed.

[0015] In a fourth aspect, an embodiment of the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements a method for processing read and write commands described in the first aspect of the embodiment.

[0016] Beneficial effects: In the method provided in this embodiment, the storage device obtains any read / write command from multiple read / write command queues of any host of the storage device and adds it to a request resource pool; according to a first sliding window in the request resource pool, any read / write command in the request resource pool is processed, and a command response corresponding to any read / write command is added to a response resource pool; according to a second sliding window in the response resource pool, any command response in the response resource pool is processed.

[0017] By pooling the read and write commands in the host's read and write command queue and storing them in the request resource pool, and pooling the command responses in the response queue and storing them in the response resource pool, and then processing any read and write command and any command response through the first sliding window in the request resource pool and the second sliding window in the response resource pool respectively, the IO efficiency can be effectively improved compared to the current NVMe protocol in which resources are allocated separately to each IO queue and the IO efficiency is low due to uneven resource allocation. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art.

[0019] Figure 1A flowchart showing a method for processing read and write commands provided in an embodiment of the present application is shown; Figure 2 A schematic diagram of queue pooling provided in an embodiment of the present application is shown; Figure 3 A schematic diagram showing the steps of a first processing strategy provided by an embodiment of the present application is shown; Figure 4 A schematic diagram of a request resource pool provided in an embodiment of the present application is shown; Figure 5 A processing flow chart of a read / write command or a command response provided by an embodiment of the present application is shown; Figure 6 A functional module diagram of a read-write command processing device provided in an embodiment of the present application is shown; Figure 7 A schematic diagram of a computer device provided in an embodiment of the present application is shown; Figure 8 A schematic diagram of a non-volatile readable storage medium provided in an embodiment of the present application is shown; Fig. 9 A schematic diagram of a computer program product provided by an embodiment of the present application is shown. DETAILED DESCRIPTION

[0020] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0021] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, each embodiment of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in each embodiment of the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not constitute any limitation, and the various embodiments can be combined with each other and referenced to each other without contradiction.

[0022] Queue: A read-write separated data storage structure, where reading and writing can be performed simultaneously; PCIe: A hardware interface between a host and a peripheral device. It implements data exchange between the host and the peripheral device through the PCIe bus protocol and the host PCIe implemented inside the PCIe hardware link. It has features such as high-speed transmission, link abnormality recovery, and power consumption management.

[0023] NVMe: Non-Volatile Memory Express, a host software application layer protocol running on top of the hardware PCIe protocol, defines a set of management and IO request / response queue interfaces, which enables the host to submit IO request commands to the device and process IO responses in a highly concurrent and asynchronous manner.

[0024] With the development of information technologies such as artificial intelligence, the Internet of Things, and cloud computing, more and more intelligent hardware has emerged. The amount of business data related to intelligent hardware has also increased exponentially, and the storage performance requirements for data center servers have become increasingly higher. In order to improve performance, researchers have designed many high-performance storage protocols such as the NVMe protocol based on PCIe links.

[0025] At present, the common implementation method of NVMe protocol is to develop NVMe software on the host side and the device side respectively. The host-side NVMe software creates a set of management command submission / response queues and configures the queue addresses to the device registers. Then, the IO command submission / response queue addresses are notified to the device-side NVMe software by writing a "create IO queue" command to the management command submission queue. After that, the host-side NVMe software sends IO commands (such as data reading and writing) to the device through the IO command submission / response queue, and the device NVMe software transfers data between the host and the device according to the IO command content.

[0026] However, in this process, the NVMe protocol needs to allocate resources separately for each IO queue. In the actual process, the operation status of each IO queue is uncertain, and the resource usage is also different. Therefore, some queues may have sufficient resources while others may have insufficient resources, resulting in reduced IO efficiency.

[0027] In order to solve the problem of reduced IO efficiency caused by uneven allocation of queue resources, this embodiment provides a method for processing read and write commands.

[0028] Reference Figure 1 , shows a flowchart of a method for processing a read and write command provided in an embodiment of the present application, the method is applied to a storage device, and the method may include the following steps: S101: Obtain any read / write command from a plurality of read / write command queues of any host of the storage device, and add the command to a request resource pool.

[0029] When the storage device interacts with the host based on the NVMe protocol, the host will issue IO commands through the read and write command queues, and the storage device will write the command responses of the IO commands in the response queues. Multiple groups of read and write command queues (SubmissionQueue, SQ) and response queues (CompletionQueue, CQ) can be set. For example, a core of the host can be set with a group of SQ and CQ or multiple SQs and CQs, or multiple SQs and one CQ.

[0030] In this embodiment, two resource pools are constructed on the storage device side, namely a request resource pool and a response resource pool. The request resource pool is used to store the read and write commands in all read and write command queues of any host of the storage device; the response resource pool is used to store the command responses in all response queues.

[0031] That is, resources are no longer allocated separately for each SQ and each CQ. Instead, all read and write command queues are pooled into a request resource pool, and all response queues are pooled into a command response resource pool. This avoids allocating resources to each queue separately. Due to different queue operating conditions, some queues have sufficient resources while others are insufficient. By pooling the read and write command queues and response queues, multiple resources can be concentrated for more efficient allocation and use.

[0032] Reference Figure 2 , showing a schematic diagram of queue pooling provided by an embodiment of the present application. In a feasible implementation, it is assumed that there are currently four read-write command queues A, B, C, and D, each with a queue depth of 8. Before pooling, each queue contains three read-write commands that need to be processed. The read-write requests in the read-write command queue A are recorded as A1, A2, and A3, the read-write requests in the read-write command queue B are recorded as B1, B2, and B3, the read-write requests in the read-write command queue C are recorded as C1, C2, and C3, and the read-write requests in the read-write command queue D are recorded as D1, D2, and D3.

[0033] After the pooling operation, the read and write commands in the four read and write command queues can be placed in the request resource pool, and the request resource pool and the response resource pool are both configured as a ring buffer to store the read and write commands or command responses in the chronological order of the read and write commands or command responses.

[0034] A ring buffer is a circular buffer. The ring buffer has a fixed size and is defined as a ring. New data will overwrite old data, reducing memory copies and improving program performance. The read and write commands or command responses written to the request resource pool and the response resource pool can be stored in chronological order. For example, in order of chronological order, the read and write commands in the request resource pool are A1, A2, B1, A3, B2, C1, B3, C2, C3, D1, D2, and D3.

[0035] S102: Process any read or write command in the request resource pool according to the first sliding window in the request resource pool, and add a command response corresponding to any read or write command to the response resource pool.

[0036] Sliding window is a technology used to manage and process data streams. It defines a fixed-size window on the data stream to achieve efficient data processing, transmission control and resource management. Specifically, a fixed-size window is slid over the data to process the data. The window will move forward over time or as data is processed, gradually covering the entire data stream. It can limit the amount of data processed simultaneously, thereby controlling resource consumption and improving processing efficiency.

[0037] Specifically, a plurality of read and write commands enter the request resource pool in chronological order, and then exit the pool in sequence according to the first sliding window.

[0038] In a feasible implementation, the process of processing any read and write command in the request resource pool according to the first sliding window in the request resource pool includes: in the request resource pool, sliding the first sliding window in the direction of the chronological order of the read and write commands; in the current first sliding window, executing the first processing strategy to process multiple read and write commands in the current first sliding window.

[0039] Since multiple read and write commands enter the request resource pool in chronological order, in order to facilitate the principle of early processing of read and write commands that enter the request resource pool early, the sliding direction of the first sliding window is also the direction of the chronological order of the read and write commands.

[0040] Reference Figure 3 , shows a schematic diagram of the steps of the first processing strategy provided by an embodiment of the present application. Specifically, the process of executing the first processing strategy includes the following steps: A1: Processing the multiple read and write commands in the current first sliding window in sequence by polling according to the time sequence of the read and write commands.

[0041] The first sliding window may include a plurality of read and write commands to be processed. The length of the first sliding window may be customized according to the requirements of the actual application, and is not limited in this embodiment.

[0042] In the first sliding window, the direction of polling and processing the multiple read and write commands is also along the time sequence of the read and write commands.

[0043] A2: During the polling process, when the first read-write command in the current first sliding window is successfully processed, the blocking flag of the first sliding window is set to a non-blocking state, the polling process for the current first sliding window is ended, and the current first sliding window is slid by a unit length in the direction of the chronological order of the read-write commands, and the current first sliding window is updated, where the unit length is the size of a read-write command.

[0044] When polling starts, the first read and write command of the current first sliding window is processed.

[0045] If the first read / write command is successfully processed, it indicates that there is no congestion in the processing of the read / write command, and the blocking flag of the first sliding window is set to a non-blocking state. For example, a block_flag bit can be set as a blocking flag, and block_flag=0 indicates a non-blocking state.

[0046] Then slide the current first sliding window. The current first sliding window can be slid by a unit length in the direction of the time sequence of the read and write commands to obtain an updated current first sliding window. For example, slide a unit length according to the size of the read and write commands, such as 16 bytes or 64 bytes.

[0047] A3: When the first read / write command in the current first sliding window is not successfully processed, the blocking flag of the first sliding window is set to a blocking state, and any read / write command of the current first sliding window is continuously polled and processed.

[0048] If the first read / write command fails to be processed due to resource limitations, such as insufficient memory or other locking conditions, the blocking flag of the first sliding window is set to a blocking state, that is, block_flag=1 indicates a blocking state.

[0049] In order to avoid delay or waste of processing resources caused by continuously waiting for the first read / write command to be processed, other read / write commands in the current first sliding window are continuously polled and processed.

[0050] Reference Figure 4, showing a schematic diagram of the request resource pool provided in an embodiment of the present application, the current first sliding window in the request resource pool includes 6 read and write commands, namely A1, A2, B1, A3, B2, and C1. If A1 processing fails, block_flag=1, and polling processing of A2, B1, A3, B2, and C1 begins.

[0051] A4: Determine whether any read-write command has a completion mark; when the read-write command has a completion mark, poll and process the next read-write command; when the read-write command does not have a completion mark, process the read-write command. If the read-write command is processed, add a completion mark to the read-write command, poll and process the next read-write command, and if the read-write command is not processed, poll and process the next read-write command.

[0052] like Figure 4 Specifically, during the process of processing A2, if it is determined that A2 does not have a completion flag, A2 is processed, and if A2 is processed successfully, a completion flag is set for A2, such as using 0xffffffff, and then B1 is processed continuously.

[0053] During the process of processing B1, it is determined that B1 does not have a completion mark, and B1 is processed. However, if the processing of B1 fails, A3 is continued to be processed.

[0054] During the process of processing A3, it is detected that A3 has a completion mark, and then the processing of B2 continues.

[0055] Assume that after the first polling, the read and write commands that have not been processed in the current first sliding window include: A1, B1, B2, C1.

[0056] Then continue the second polling, process the read and write commands in the first sliding window in sequence, if the first read and write command A1 can be processed and completed at this time, block_flag=0, and end the polling process for the current first sliding window, and slide the current first sliding window.

[0057] If the first read / write command A1 is still not processed at this time, block_flag=1, and then it is determined that A2 has a completion mark, and B1 is processed continuously, and the polling is repeated in this way.

[0058] A5: During the polling process, if any read / write command except the first read / write command in the current first sliding window has been processed, the first read / write command in the current first sliding window is reprocessed.

[0059] If, during the continuous polling process, any read / write command except the first read / write command in the current first sliding window is processed completely, for example, only read / write command A1 is not completed in the current first sliding window, then A1 is processed again.

[0060] A6: If the first read / write command in the current first sliding window has not been processed, the first read / write command in the current first sliding window is moved to the last position of the current first sliding window, and the current first sliding window is slid by a unit length along the time sequence of the commands.

[0061] If the first read-write command in the current first sliding window has not been processed, that is, the read-write command A1 still fails to be processed, in order to avoid further waiting, the read-write command A1 can be directly migrated to the last position of the current first sliding window, that is, the processed C1 is replaced with A1, and the current first sliding window is slid by a unit length along the chronological order of the commands. At this time, the read-write commands included in the first sliding window include: A2, B1, A3, B2, A1, B3.

[0062] The current first sliding window is polled, and because A2, B1, A3, and B2 have been processed in the previous first sliding window, after sliding the first sliding window four times in a row, A1 becomes the first read and write command in the current first sliding window, and the first processing strategy continues to be executed for the current first sliding window.

[0063] S103: Process any command response in the response resource pool according to the second sliding window in the response resource pool.

[0064] Based on a principle similar to that of processing read and write commands according to a first sliding window in a request resource pool, in a process of processing any command response in the response resource pool according to a second sliding window in the response resource pool, in the response resource pool, the second sliding window is slid in the direction of the chronological order of the command responses, and in the current second sliding window, multiple command responses in the current second sliding window are polled and processed in sequence in the direction of the chronological order of the command responses.

[0065] During the polling process, when the first command response in the current second sliding window is successfully processed, the blocking flag of the second sliding window is set to a non-blocking state, the polling process for the current second sliding window is ended, and the current second sliding window is slid by a unit length in the direction of the chronological order of the command responses, and the current second sliding window is updated, where the unit length is the size of a command response.

[0066] When the first command response in the current second sliding window is not successfully processed, the blocking flag of the second sliding window is set to a blocking state, and any command response of the current second sliding window is continuously polled and processed.

[0067] For any command response, if the command response does not have a completion mark, process the command response, add a completion mark to the command response after processing the command response, and poll for the next command response; if the command response is not processed, poll for the next command response.

[0068] If the command response has a completion mark, poll the next command response; if during the polling process, any command response except the first command response in the current second sliding window has been processed, reprocess the first command response in the current second sliding window.

[0069] If the first command response in the current second sliding window has not been processed, the first command response in the current second sliding window is moved to the last position of the current second sliding window, and the current second sliding window is slid by a unit length along the chronological order of the command responses.

[0070] Reference Figure 5 , shows a processing flow chart of a read / write command or command response provided by an embodiment of the present application. By way of example, for a first sliding window or a second sliding window, the read / write command or command response is taken as an element, and the processing process for the element in any sliding window includes: S1: Determine whether the sliding window includes an element; If the element is not included, execute step S2; If the element is included, execute step S3.

[0071] S2: Slide the sliding window by a unit length.

[0072] S3: Poll to get an element in chronological order.

[0073] S4: Determine whether the element has a completion mark.

[0074] If there is a completion mark, execute S5; If there is no completion flag, execute S6.

[0075] S5: Get the next element.

[0076] S6: Process the element.

[0077] S7: Determine whether the element is processed successfully.

[0078] If the element is not processed successfully, execute step S8.

[0079] If the element is processed successfully, step S9 is executed.

[0080] S8: Determine whether the element is the first element of the sliding window.

[0081] If the element is not the first element of the sliding window, execute step S5; If the element is the first element of the sliding window, execute step S10.

[0082] S9: Determine whether the element is the first element of the sliding window.

[0083] If the element is not the first element of the sliding window, execute step S5; If the element is the first element of the sliding window, execute step S11.

[0084] S10: The blocking flag is set to a blocking state.

[0085] Then execute step S5.

[0086] S11: The blocking flag is set to a non-blocking state.

[0087] Then execute step S5.

[0088] This method pools the read and write commands in the host's read and write command queue and stores them in the request resource pool, and pools the command responses in the response queue and stores them in the response resource pool, and then processes any read and write command and any command response through a first sliding window in the request resource pool and a second sliding window in the response resource pool, respectively. Compared with the current NVMe protocol that allocates resources separately to each IO queue and causes low IO efficiency due to uneven resource allocation, this method can effectively improve IO efficiency.

[0089] Moreover, the first sliding window and the second sliding window can improve the speed of processing read and write commands and command responses, allowing storage devices to process these commands in batches, thereby improving the efficiency of I / O operations and greatly improving the data access speed of NVMe. By utilizing the high bandwidth and low latency advantages of PCI Express, the sliding window enables the NVMe protocol to support high-performance, high-bandwidth and low-latency storage solutions to meet the needs of modern computing-intensive environments, such as graphics editing software, cloud computing environments, firmware and large databases.

[0090] Reference Figure 6 , shows a functional module diagram of a read-write command processing device provided in an embodiment of the present application, which is applied to a storage device, and the device includes: The acquisition module 100 is used to acquire any read / write command from a plurality of read / write command queues of any host of the storage device, and add the command to the request resource pool; A first processing module 200 is used to process any read or write command in the request resource pool according to the first sliding window in the request resource pool, and add a command response corresponding to any read or write command to the response resource pool; The second processing module 300 is used to process any command response in the response resource pool according to the second sliding window in the response resource pool.

[0091] Optionally, the device further comprises a building module for: Constructing the request resource pool, wherein the request resource pool is used to store read and write commands in all read and write command queues of any host of the storage device; Constructing the response resource pool, wherein the response resource pool is used to store command responses in all response queues; The request resource pool and the response resource pool are both configured as a ring buffer, which stores the read and write commands or command responses in sequence according to the time sequence of the read and write commands or command responses.

[0092] Optionally, the first processing module includes: A sliding unit, configured to slide a first sliding window in the request resource pool in a direction of a time sequence of read and write commands; The first processing unit is used to execute a first processing strategy in a current first sliding window to process multiple read and write commands in the current first sliding window.

[0093] Optionally, the first processing unit is used to: Processing the multiple read and write commands in the current first sliding window in sequence by polling according to the time sequence of the read and write commands; In the process of polling processing, when the first read-write command in the current first sliding window is successfully processed, the blocking flag of the first sliding window is set to a non-blocking state, the polling process for the current first sliding window is ended, and the current first sliding window is slid by a unit length in the direction of the time sequence of the read-write commands, and the current first sliding window is updated, and the unit length is the size of a read-write command; When the first read / write command in the current first sliding window is not successfully processed, the blocking flag of the first sliding window is set to a blocking state, and any read / write command of the current first sliding window is continuously polled and processed.

[0094] Optionally, the first processing unit is used to: Determine whether any read or write command has a completion flag; When the read / write command has a completion mark, polling is performed on the next read / write command; When the read / write command does not have a completion flag, processing the read / write command; If the read / write command is processed, a completion mark is added to the read / write command, and the next read / write command is processed in a polling manner; If the read / write command is not processed completely, the next read / write command will be processed in a polling manner.

[0095] Optionally, the first processing unit is used to: During the polling process, if any read / write command except the first read / write command in the current first sliding window is processed, the first read / write command in the current first sliding window is reprocessed; If the first read / write command in the current first sliding window has not been processed, the first read / write command in the current first sliding window is moved to the last position of the current first sliding window, and the current first sliding window is slid by a unit length along the time sequence of the commands.

[0096] Optionally, the second processing module includes a second processing unit, configured to: In the response resource pool, sliding a second sliding window in the direction of the time sequence of the command responses; In the current second sliding window, multiple command responses in the current second sliding window are processed in sequence by polling according to the time sequence of the command responses; In the process of polling processing, when the first command response in the current second sliding window is successfully processed, the blocking flag of the second sliding window is set to a non-blocking state, the polling process for the current second sliding window is ended, and the current second sliding window is slid by a unit length in the direction of the time sequence of the command responses, and the current second sliding window is updated, where the unit length is the size of a command response; When the first command response in the current second sliding window is not successfully processed, setting the blocking flag of the second sliding window to a blocking state, and continuing to poll and process any command response in the current second sliding window; For any command response, if the command response does not have a completion mark, process the command response, add a completion mark to the command response after the command response is processed, and poll for the next command response; if the command response is not processed, poll for the next command response; If the command response has a completion flag, poll and process the next command response; If during the polling process, any command response in the current second sliding window except the first command response is processed, the first command response in the current second sliding window is reprocessed; If the first command response in the current second sliding window has not been processed, the first command response in the current second sliding window is moved to the last position of the current second sliding window, and the current second sliding window is slid by a unit length along the chronological order of the command responses.

[0097] Reference Figure 7 , shows a schematic diagram of a computer device provided in an embodiment of the present application, including: at least one processor 701, and a memory 702, wherein the memory 702 stores a computer program that can be run on the processor 701, wherein the processor 701 executes a method for processing read and write commands described in the embodiment when executing the computer program.

[0098] Reference Figure 8 , showing a schematic diagram of a non-volatile readable storage medium provided in an embodiment of the present application, wherein the non-volatile readable storage medium 800 stores a computer program 801, wherein the computer program 801, when executed by a processor, executes a method for processing read and write commands described in an embodiment.

[0099] Reference Fig. 9 , showing a schematic diagram of a computer program product provided in an embodiment of the present application, wherein the computer program product 900 includes a computer program / instruction 901, which, when executed by a processor, implements a method for processing read and write commands described in an embodiment.

[0100] 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.

[0101] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt 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 code.

[0102] The embodiments of the present application 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 application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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.

[0103] 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.

[0104] 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 A step that specifies a function in one or more boxes.

[0105] Although the preferred embodiments of the present application 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 application.

[0106] 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 "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0107] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for processing a read and write command, characterized in that: Applied to a storage device, the method comprises: Obtain any read / write command from a plurality of read / write command queues of any host of the storage device, and add the command to the request resource pool; According to the first sliding window in the request resource pool, any read or write command in the request resource pool is processed, and a command response corresponding to any read or write command is added to the response resource pool; Any command response in the response resource pool is processed according to the second sliding window in the response resource pool.

2. The processing method according to claim 1, characterized in that: The method further comprises: Constructing the request resource pool, wherein the request resource pool is used to store read and write commands in all read and write command queues of any host of the storage device; Constructing the response resource pool, wherein the response resource pool is used to store command responses in all response queues; The request resource pool and the response resource pool are both configured as a ring buffer, which stores the read and write commands or command responses in sequence according to the time sequence of the read and write commands or command responses.

3. The processing method according to claim 1 or 2, characterized in that: Processing any read or write command in the request resource pool according to the first sliding window in the request resource pool includes: In the request resource pool, sliding a first sliding window in the direction of the time sequence of the read and write commands; In the current first sliding window, a first processing strategy is executed to process multiple read and write commands in the current first sliding window.

4. The processing method according to claim 3, characterized in that: Execute a first processing strategy, including: Processing the multiple read and write commands in the current first sliding window in sequence by polling according to the time sequence of the read and write commands; In the process of polling processing, when the first read-write command in the current first sliding window is successfully processed, the blocking flag of the first sliding window is set to a non-blocking state, the polling process for the current first sliding window is ended, and the current first sliding window is slid by a unit length in the direction of the time sequence of the read-write commands, and the current first sliding window is updated, and the unit length is the size of a read-write command; When the first read / write command in the current first sliding window is not successfully processed, the blocking flag of the first sliding window is set to a blocking state, and any read / write command of the current first sliding window is continuously polled and processed.

5. The processing method according to claim 4, characterized in that: Continuing to poll and process any read and write command of the current first sliding window includes: Determine whether any read or write command has a completion flag; When the read / write command has a completion mark, polling is performed on the next read / write command; When the read / write command does not have a completion flag, processing the read / write command; If the read / write command is processed, a completion mark is added to the read / write command, and the next read / write command is processed in a polling manner; If the read / write command is not processed completely, the next read / write command will be processed in a polling manner.

6. The processing method according to claim 5, characterized in that: Executing the first processing strategy also includes: During the polling process, if any read / write command except the first read / write command in the current first sliding window is processed, the first read / write command in the current first sliding window is reprocessed; If the first read / write command in the current first sliding window has not been processed, the first read / write command in the current first sliding window is moved to the last position of the current first sliding window, and the current first sliding window is slid by a unit length along the time sequence of the commands.

7. The method according to claim 1 or 2, characterized in that: Processing any command response in the response resource pool according to the second sliding window in the response resource pool includes: In the response resource pool, sliding a second sliding window in the direction of the time sequence of the command responses; In the current second sliding window, multiple command responses in the current second sliding window are processed in sequence by polling according to the time sequence of the command responses; In the process of polling processing, when the first command response in the current second sliding window is successfully processed, the blocking flag of the second sliding window is set to a non-blocking state, the polling process for the current second sliding window is ended, and the current second sliding window is slid by a unit length in the direction of the time sequence of the command responses, and the current second sliding window is updated, where the unit length is the size of a command response; When the first command response in the current second sliding window is not successfully processed, setting the blocking flag of the second sliding window to a blocking state, and continuing to poll and process any command response in the current second sliding window; For any command response, if the command response does not have a completion mark, process the command response, add a completion mark to the command response after the command response is processed, and poll for the next command response; if the command response is not processed, poll for the next command response; If the command response has a completion flag, poll and process the next command response; If during the polling process, any command response in the current second sliding window except the first command response is processed, the first command response in the current second sliding window is reprocessed; If the first command response in the current second sliding window has not been processed, the first command response in the current second sliding window is moved to the last position of the current second sliding window, and the current second sliding window is slid by a unit length along the chronological order of the command responses.

8. A computer device, characterized in that: include: At least one processor, and a memory, wherein the memory stores a computer program that can be run on the processor, wherein when the processor executes the computer program, the method for processing a read and write command as described in any one of claims 1 to 7 is executed.

9. A non-volatile readable storage medium, characterized in that: The non-volatile readable storage medium stores a computer program, wherein the computer program, when executed by a processor, executes a method for processing a read or write command as described in any one of claims 1 to 7.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, a method for processing a read and write command as described in any one of claims 1 to 7 is implemented.