Read and write request processing method, device, storage device, program product and medium

By controlling the number of read and write requests within the storage device by queuing and parallel processing of read and write requests within the storage device, the problem of internal read and write requests interfering with external requests is solved, and the service quality of the storage device is improved.

CN118732957BActive Publication Date: 2024-12-20INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411207136.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-20
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

The processing of internal read and write requests in the storage device interferes with external read and write requests, resulting in a degradation of the quality of storage services.

Method used

The control queue is used to control the number of internal read and write requests queuing and parallel processing. By receiving internal read and write requests and adding them to the control queue of the corresponding physical hard disk, the concurrency amount is limited and the external request processing is avoided.

Benefits of technology

It effectively avoids interference with the processing of internal read and write requests on external read and write requests, and improves the quality of storage service of storage devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118732957B_ABST
    Figure CN118732957B_ABST
Patent Text Reader

Abstract

The present invention provides a read / write request processing method, device, storage device, program product and medium, which relate to the field of storage devices. The method is applied to storage devices, including: receiving internal read / write requests generated inside the storage device; adding the internal read / write requests to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write requests; obtaining a number of pending read / write requests corresponding to the maximum concurrency preset in the control queue from the control queue each time the internal read / write request processing operation is triggered, and sending the pending read / write requests to the corresponding physical hard disk for processing; the internal read / write requests generated inside the storage device can be queued and controlled and the number of concurrent processing can be controlled through the control queue, so as to effectively avoid the processing of internal read / write requests interfering with the processing of external read / write requests, and improve the storage business service quality of the storage device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage, and in particular to a read / write request processing method, device, storage device, program product and medium. Background Art

[0002] In the storage field, the host device can send read and write requests to the storage device to read or write data from the physical hard disk managed by the storage device. The read and write requests sent by the host device can be called external read and write requests. In addition, in order to better manage storage services, the storage device can also send read and write requests generated for internal management purposes to the physical hard disk. For example, in scenarios such as physical hard disk status inspection and performance statistics data query, the storage device can send internal read and write requests to the physical hard disk. The read and write requests issued by the storage device itself can be called internal read and write requests. The internal read and write request also needs to be processed on the disk; and the original storage device will directly send as many internal read and write requests to the physical hard disk as it generates internal read and write requests, which can easily cause the physical hard disk's processing of internal read and write requests to interfere with its processing of external read and write requests, thereby affecting the storage service quality of the storage device. Summary of the invention

[0003] The purpose of the present invention is to provide a read / write request processing method, apparatus, storage device, program product and medium, which can control the queuing and parallel processing quantity of the read / write requests generated inside the storage device by controlling the queue, effectively avoid the processing of internal read / write requests interfering with the processing of external read / write requests, and improve the storage business service quality of the storage device.

[0004] In order to solve the above technical problems, the present invention provides a read / write request processing method, which is applied to a storage device, and the method comprises:

[0005] Receiving an internal read / write request generated within the storage device;

[0006] Adding the internal read / write request to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request;

[0007] Each time an internal read / write request processing operation is triggered, a number of pending internal read / write requests corresponding to the maximum concurrency preset for the control queue is obtained from the control queue, and the pending internal read / write requests are sent to the corresponding physical hard disk for processing.

[0008] Optionally, the control queue includes a waiting queue and an execution queue;

[0009] Adding the internal read / write request to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request includes:

[0010] Adding the internal read / write request to a waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read / write request;

[0011] When it is determined that the execution queue corresponding to the physical hard disk is empty, the internal read and write requests in the waiting queue are moved to the execution queue;

[0012] When it is determined that all internal read and write requests in the execution queue of the physical hard disk have been processed, the execution queue is cleared, and the internal read and write requests in the waiting queue are moved to the execution queue.

[0013] Optionally, the queue depth value of the execution queue is the maximum concurrency;

[0014] Each time an internal read / write request processing operation is triggered, a number of pending internal read / write requests corresponding to the maximum concurrency preset by the control queue is obtained from the control queue, and the pending internal read / write requests are sent to the corresponding physical hard disk for processing, including:

[0015] Each time the internal read / write request is written to the execution queue, determining to trigger the internal read / write request processing operation, and treating all the internal read / write requests in the execution queue as internal read / write requests to be processed;

[0016] The pending internal read and write request is sent to the corresponding physical hard disk for processing.

[0017] Optionally, the control queue includes a read request control queue that only stores internal read requests and a write request control queue that only stores internal write requests, the read request control queue includes a read request waiting queue and a read request waiting queue, and the write request control queue includes a write request waiting queue and a write request waiting queue.

[0018] Optionally, the read request waiting queue includes a user read request waiting queue and a common read request waiting queue;

[0019] Adding the internal read / write request to a waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read / write request includes:

[0020] Determining a method for generating the internal read request;

[0021] If the generation mode is manually triggered by the user, the internal read request is added to the user read request waiting queue;

[0022] If the generation mode is automatically triggered by the system, the internal read request is added to the common read request waiting queue.

[0023] Optionally, moving the internal read / write request in the waiting queue to the execution queue includes:

[0024] Determine whether the user read request waiting queue is empty;

[0025] If the user read request waiting queue is not empty, moving the internal read request in the user read request waiting queue to the read request execution queue;

[0026] If the user read request waiting queue is empty, the internal read requests in the common read request waiting queue are moved to the read request execution queue.

[0027] Optionally, it also includes:

[0028] Recording the waiting time of each internal read request in the user read request waiting queue;

[0029] When it is determined that the waiting time of the internal read request reaches a first preset time, the internal read request is removed from the user read request waiting queue, and an alarm message indicating that the internal read request has timed out is output.

[0030] Optionally, it also includes:

[0031] Recording the waiting time of each write request in the internal write request waiting queue;

[0032] When it is determined that the waiting time of the internal write request reaches a second preset time, the storage device is restarted.

[0033] Optionally, adding the internal read / write request to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request includes:

[0034] Adding the internal read / write request to the memory area corresponding to the physical hard disk in the memory according to the physical hard disk information included in the internal read / write request;

[0035] Adding the memory block address storing the internal read / write request to the control queue corresponding to the physical hard disk in the memory;

[0036] Obtaining from the control queue a number of pending internal read and write requests corresponding to a maximum concurrency preset for the control queue, including:

[0037] A number of to-be-read memory block addresses corresponding to the maximum concurrency preset for the control queue is obtained from the control queue, and the to-be-processed internal read / write requests are obtained from the memory according to the to-be-read memory block addresses.

[0038] Optionally, adding the internal read / write request to a memory area corresponding to the physical hard disk in the memory includes:

[0039] Writing the request information in the internal read / write request into a preset structure to obtain a request information structure;

[0040] The request information structure is added to a memory area corresponding to the physical hard disk in the memory.

[0041] Optionally, each time an internal read / write request processing operation is triggered, a number of pending internal read / write requests corresponding to a preset maximum concurrency of the control queue is obtained from the control queue, and the pending internal read / write requests are sent to a corresponding physical hard disk for processing, including:

[0042] The central processing unit core corresponding to the physical hard disk is called to obtain a number of pending internal read and write requests corresponding to the maximum concurrency preset for the control queue from the control queue each time an internal read and write request processing operation is triggered, and the pending internal read and write requests are sent to the corresponding physical hard disk for processing; all physical hard disks in the storage device are evenly distributed to each central processing unit core.

[0043] Optionally, the calling of the central processing unit core corresponding to the physical hard disk, each time triggering an internal read / write request processing operation, obtains from the control queue a number of pending internal read / write requests corresponding to a preset maximum concurrency of the control queue, and sends the pending internal read / write requests to the corresponding physical hard disk for processing, including:

[0044] Controlling the CPU core corresponding to the physical hard disk to perform thread switching, so as to switch the currently working thread in the CPU core from a service thread to an internal dedicated thread;

[0045] The internal dedicated thread is used to execute the steps of obtaining a number of pending internal read / write requests corresponding to the maximum concurrency preset by the control queue from the control queue each time an internal read / write request processing operation is triggered, and sending the pending internal read / write requests to the corresponding physical hard disk for processing;

[0046] When it is determined that all pending internal read and write requests have been processed, the central processing unit core corresponding to the physical hard disk is controlled to perform thread switching to switch the currently working thread in the central processing unit core from the internal dedicated thread to the service thread.

[0047] Optionally, after sending the to-be-processed internal read / write request to the corresponding physical hard disk for processing, the method further includes:

[0048] Receiving the processing result returned by the physical hard disk;

[0049] If it is determined that the processing result includes abnormal information, an alarm message including the abnormal information is output, and the processing of the pending internal read and write request is completed.

[0050] The present invention also provides a read / write request processing device, which is applied to a storage device, and the device comprises:

[0051] A receiving module, used for receiving an internal read / write request generated inside the storage device;

[0052] A queue scheduling module, used for adding the internal read / write request to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request;

[0053] The request sending module is used to obtain the number of pending internal read and write requests corresponding to the maximum concurrency preset by the control queue from the control queue each time the internal read and write request processing operation is triggered, and send the pending internal read and write requests to the corresponding physical hard disk for processing.

[0054] The present invention also provides a storage device, comprising:

[0055] Program memory, used to store computer programs;

[0056] A processor, configured to implement the read and write request processing method as described above when executing the computer program;

[0057] The physical hard disk is used to process the internal read and write requests sent by the processor.

[0058] The present invention also provides a computer program product, including a computer program or instructions, which implement the steps of the read / write request processing method as described above when executed by a processor.

[0059] The present invention also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are loaded and executed by a processor, the read-write request processing method as described above is implemented.

[0060] The present invention provides a read / write request processing method, which is applied to a storage device, and the method comprises: receiving an internal read / write request generated inside the storage device; adding the internal read / write request to a control queue corresponding to the corresponding physical hard disk in a memory space according to the physical hard disk information in the internal read / write request; obtaining a number of to-be-processed internal read / write requests corresponding to the maximum concurrency preset for the control queue from the control queue each time an internal read / write request processing operation is triggered, and sending the to-be-processed internal read / write requests to the corresponding physical hard disk for processing.

[0061] The beneficial effect of the present invention is that after receiving an internal read / write request generated inside a storage device, the storage device does not immediately send the internal read / write request to a physical hard disk for processing, but instead may first add the internal read / write request to a control queue corresponding to the corresponding physical hard disk in a memory space according to the physical hard disk information in the internal read / write request, so as to queue the internal read / write request; subsequently, each time the storage device triggers an internal read / write request processing operation, it obtains from the control queue a number of pending internal read / write requests corresponding to the maximum concurrency preset for the control queue, and sends the pending internal read / write requests to the corresponding physical hard disk for processing, that is, the control queue may also be used to effectively control the number of internal read / write requests that can be processed simultaneously, thereby effectively avoiding interference of the processing of internal read / write requests with the processing of external read / write requests, thereby improving the storage business service quality of the storage device.

[0062] The present invention also provides a read / write request processing device, a storage device, a computer program product, and a computer-readable storage medium, which have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0064] Figure 1 A flowchart of a method for processing an internal read / write request provided by an embodiment of the present invention;

[0065] Figure 2 A flowchart of another read / write request processing method provided by an embodiment of the present invention;

[0066] Figure 3 A structural block diagram of a read / write request processing device provided by an embodiment of the present invention;

[0067] Figure 4 A structural block diagram of a storage device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0068] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of 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.

[0069] In the storage field, the host device can send read and write requests to the storage device to read or write data from the physical hard disk managed by the storage device. The read and write requests sent by the host device can be called external read and write requests. In addition, in order to better manage storage services, the storage device can also send read and write requests generated for internal management purposes to the physical hard disk. For example, in scenarios such as physical hard disk status check and performance statistics data query, the storage device can send internal read and write requests to the physical hard disk. The read and write requests issued by the storage device itself can be called internal read and write requests. The internal read and write request also needs to be processed on the disk; and the original storage device will directly send as many internal read and write requests to the physical hard disk as it generates internal read and write requests, which can easily cause the physical hard disk's processing of internal read and write requests to interfere with its processing of external read and write requests, thereby affecting the storage service quality of the storage device.

[0070] In view of this, in order to solve the technical problem of how to avoid the processing of internal read and write requests interfering with the processing of external read and write requests, the present invention can provide a read and write request processing method, which can use a control queue to manage the queues and the number of parallel processing of read and write requests generated inside the storage device, effectively avoid the processing of internal read and write requests interfering with the processing of external read and write requests, and improve the storage business service quality of the storage device.

[0071] For easier understanding, please refer to Figure 1 , Figure 1 A flowchart of an internal read / write request processing method provided by an embodiment of the present invention. The method is applied to a storage device and can be specifically executed by a central processing unit of the storage device. The method may include:

[0072] S101: Receive an internal read / write request generated inside the storage device.

[0073] It is understandable that the internal read / write request (IO request, Input / Output) may specifically include an internal read request (read) and an internal write request (write). It should also be pointed out that in this embodiment, the internal read / write requests generated by the storage device can be divided into two categories. One category is manually triggered by the user, that is, the user manually performs a certain operation in the storage device, and the operation triggers the generation of the internal read / write request. For example, the user manually performs a query operation in the storage device, and the query operation will trigger the generation of an internal read / write request for data query. The other category is automatically triggered by the storage device, that is, the storage device automatically and autonomously performs a certain operation, and the operation triggers the generation of the internal read / write request. For example, when the storage device automatically performs a physical hard disk working status detection, the automatically performed detection operation will trigger the generation of an internal read / write request for querying the working status of the physical hard disk. The above two types of internal read / write requests are both internal read / write requests generated inside the storage device, and this embodiment needs to avoid interfering with the processing of external read / write requests.

[0074] In addition, the above two types of internal read and write requests may also have different processing priorities. For example, in order to improve the user experience and give the user the impression that the storage device responds quickly, the processing order of the internal read and write requests manually triggered by the user may take precedence over the processing order of the internal read and write requests automatically triggered by the storage device. The specific request processing order can be set according to actual application requirements.

[0075] S102: Add the internal read / write request to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request.

[0076] In this embodiment, in order to prevent the physical hard disk from interfering with its processing of external read and write requests due to the processing of internal read and write requests, thereby causing the physical hard disk to slow down and become unresponsive, the storage device will not immediately send the internal read and write request to the physical hard disk after receiving it, but will first cache and queue it. To this end, this embodiment can set a corresponding control queue for each physical hard disk in the memory space of the storage device, and can add the internal read and write request to the control queue of the corresponding physical hard disk for queuing and waiting according to the physical hard disk information in the above-mentioned internal read and write request. It can be seen that the above-mentioned queuing and waiting imposes a first round of restrictions on the processing of internal read and write requests, which can avoid the problem of physical hard disk slowing down and becoming unresponsive that may be caused by the related technology directly sending the internal read and write request to the physical hard disk for processing. In addition, since each physical hard disk is provided with a corresponding control queue, the internal read and write requests to be sent to each physical hard disk can be individually controlled and scheduled, thereby improving the precision of control and scheduling.

[0077] It should be noted that this embodiment does not limit specific physical hard disk information, for example, it may be a physical hard disk identifier (hard disk ID).

[0078] It should also be noted that the present embodiment does not limit the queue structure (such as queue depth) of the control queue, which can be set according to actual application requirements. In addition, the control queue may contain only one queue structure or multiple queue structures with different functions. In the case where the control queue may contain multiple queue structures, for example, it may contain a waiting queue and an execution queue, wherein the waiting queue is used to store the internal read and write requests waiting in the queue, and the execution queue is used to store the internal read and write requests to be sent to the corresponding physical hard disk for processing in this round. In the process of storing and scheduling internal read and write requests, the storage device may first add the internal read and write request to the waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read and write request. Subsequently, when the storage device detects that the execution queue of the physical hard disk is empty, the internal read and write request in the waiting queue may be moved to the execution queue; and when the storage device detects that all the internal read and write requests stored in the execution queue of the physical hard disk are completed by the physical hard disk, the internal read and write requests in the execution queue may be cleared, and a new batch of internal read and write requests may be moved from the corresponding waiting queue to the execution queue. In this way, the two functions of internal read and write request waiting and internal read and write request sending and execution can be assigned to two queue structures for execution, thereby laying the foundation for queue function expansion.

[0079] Based on this, the control queue includes a waiting queue and an execution queue; adding the internal read / write request to the control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request may include:

[0080] Step 11: Add the internal read / write request to a waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read / write request.

[0081] Step 12: When it is determined that the execution queue corresponding to the physical hard disk is empty, the internal read and write requests in the waiting queue are moved to the execution queue.

[0082] Step 13: When it is determined that all internal read and write requests in the execution queue of the physical hard disk have been processed, the execution queue is cleared, and the internal read and write requests in the waiting queue are moved to the execution queue.

[0083] This embodiment also does not limit the queue structure (such as queue depth) of the waiting queue and the execution queue, and can be set according to actual application requirements.

[0084] In addition, the waiting queue may also contain multiple queue structures. As mentioned above, the processing priority of the internal read and write requests generated by manual triggering by the user can be higher than the internal read and write requests generated by automatic triggering by the device. To this end, a user waiting queue and a common waiting queue can be set in the waiting queue. The user waiting queue stores the internal read and write requests generated by manual triggering by the user, and the common waiting queue is used to store the internal read and write requests generated by automatic triggering by the device. When moving the internal read and write requests to the execution queue, it can be determined whether the user waiting queue is empty. If the user waiting queue is not empty, the internal read and write requests in the user waiting queue are moved to the execution queue; if the user waiting queue is empty, the internal read and write requests in the common waiting queue are moved to the execution queue, thereby optimizing the processing order of the internal read and write requests.

[0085] In addition, the control queue can also be divided into a read request control queue and a write request control queue, wherein the read request control queue only stores internal read requests, and the write request control queue only stores internal write requests, thereby realizing separate control of internal read requests and internal write requests. The read request control queue may further include a read request waiting queue and a read request waiting queue, and the write request control queue may further include a write request waiting queue and a write request waiting queue. In this way, internal read requests and internal write requests can be processed separately to improve processing efficiency. The functions and structures of the read request waiting queue and the write request waiting queue are the same as those of the above-mentioned waiting queues, and the functions and structures of the read request execution queue and the write request execution queue are the same as those of the above-mentioned execution queues, and reference may be made to the above-mentioned embodiments.

[0086] S103. Each time an internal read / write request processing operation is triggered, a number of pending internal read / write requests corresponding to the maximum concurrency preset for the control queue is obtained from the control queue, and the pending internal read / write requests are sent to the corresponding physical hard disk for processing.

[0087] In this embodiment, the control queue is also preset with a maximum concurrency, and the maximum concurrency is used to limit the maximum number of internal read and write requests that can be issued to the physical hard disk each time. In the actual scheduling process, each time the internal read and write request processing operation is triggered, the storage device can obtain the number of pending internal read and write requests corresponding to the maximum concurrency preset by the control queue from the control queue, and send the pending internal read and write requests to the corresponding physical hard disk for processing. Among them, triggering the internal read and write request processing operation means that a new batch of internal read and write requests needs to be sent to the physical hard disk; the pending internal read and write requests represent the internal read and write requests that need to be processed by the physical hard disk in this round. In other words, the control queue can also limit the maximum number of internal read and write requests that the physical hard disk can process simultaneously, thereby avoiding the situation where the physical hard disk processes too many internal read and write requests at the same time, affecting its processing of external read and write requests issued by the host.

[0088] It should be noted that this embodiment does not limit the triggering method of the internal read / write request processing operation, for example, it can be triggered periodically, or it can be triggered when it is determined that the previous batch of internal read / write requests have been processed by the physical hard disk, and it can be set according to actual application requirements. In this embodiment, in order to improve processing efficiency, the storage device can trigger the above-mentioned internal read / write request processing operation when it is determined that the previous batch of internal read / write requests have been processed by the physical hard disk.

[0089] This embodiment also does not limit the specific value of the maximum concurrency, which can be set according to actual application requirements, but its value should be a positive integer not less than 1. It can be understood that the smaller the value of the maximum concurrency, the smaller the pressure on the physical hard disk to process internal read and write requests, and the smaller the interference to its processing of external read and write requests; the larger the value of the maximum concurrency, the greater the pressure on the physical hard disk to process internal read and write requests, and the greater the interference to its processing of external read and write requests. For this reason, the maximum concurrency can also be a value that is dynamically adjusted with the external read and write request amount. Specifically, this embodiment can detect the number of external read and write requests issued by the host device received by the storage device in real time or periodically, and determine the current maximum concurrency based on the number of external read and write requests. The method of determining the current maximum concurrency based on the number of external read and write requests can adopt function transformation, step level determination, etc.

[0090] It should also be noted that this embodiment does not limit how to obtain the number of pending internal read and write requests corresponding to the maximum concurrency preset for the control queue from the control queue. For example, only the number of pending internal read and write requests corresponding to the maximum concurrency preset for the control queue is obtained from the control queue; for another example, if the control queue contains a waiting queue and an execution queue, the number of pending internal read and write requests corresponding to the maximum concurrency can be obtained from the execution queue; for another example, the queue depth of the control queue can be exactly the maximum concurrency, and then all internal read and write requests in the execution queue can be used as pending internal read and write requests, and all internal read and write requests in the execution queue can be sent to the physical hard disk for processing. In this embodiment, in order to improve processing efficiency, the queue depth value of the above-mentioned execution queue can be exactly the maximum concurrency. In addition, when it is determined that a new batch of internal read and write requests have been written to the execution queue, it can be determined to trigger the above-mentioned internal read and write request processing operation.

[0091] Based on this, the queue depth value of the execution queue is the maximum concurrency; each time the internal read / write request processing operation is triggered, the number of pending internal read / write requests corresponding to the maximum concurrency preset for the control queue is obtained from the control queue, and the pending internal read / write requests are sent to the corresponding physical hard disk for processing, which may include:

[0092] Step 21: each time the internal read / write request is written to the execution queue, determining to trigger the internal read / write request processing operation, and treating all the internal read / write requests in the execution queue as internal read / write requests to be processed;

[0093] Step 22: Send the pending internal read / write request to the corresponding physical hard disk for processing.

[0094] Based on the above embodiment, after receiving the internal read and write request generated inside the storage device, the storage device will not immediately send the internal read and write request to the physical hard disk for processing, but may first add the internal read and write request to the control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read and write request, so as to queue the internal read and write request; then, each time the storage device triggers the internal read and write request processing operation, it obtains the number of pending internal read and write requests corresponding to the maximum concurrency preset in the control queue from the control queue, and sends the pending internal read and write requests to the corresponding physical hard disk for processing, that is, the control queue can also be used to effectively control the number of internal read and write requests that can be processed simultaneously, thereby effectively avoiding the processing of internal read and write requests from interfering with the processing of external read and write requests, thereby improving the storage business service quality of the storage device.

[0095] Based on the above embodiment, as described above, the control queue can be divided into a read request control queue for storing internal read requests separately and a write request control queue for storing internal write requests separately, and the read request control queue can include a read request waiting queue and a read request execution queue, and the write request control queue can include a write request waiting queue and a write request execution queue. The specific process of the storage device performing internal read request scheduling based on the read request control queue will be first introduced below. In one possible scenario, the method may also include:

[0096] S201: Receive an internal read request generated inside the storage device.

[0097] S202: Add the internal read request to a read request waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read request.

[0098] As described above, internal read and write requests can be specifically divided into internal read and write requests generated by manual triggering by the user and internal read and write requests generated by automatic triggering by the system. Furthermore, for internal read requests, they can be divided into internal read requests generated by manual triggering by the user and internal read requests generated by automatic triggering by the system, and the processing priorities of these two types of internal read requests can be different. For this reason, the read request waiting queue in this embodiment can be divided into a user read request waiting queue and a common read request waiting queue. These two types of read request waiting queues can be used to store internal read requests generated by different trigger generation methods, so as to sequentially dispatch the internal read requests in each read request waiting queue to the read request execution queue for disk processing.

[0099] Based on this, the read request waiting queue includes a user read request waiting queue and a common read request waiting queue; adding the internal read / write request to the waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read / write request may include:

[0100] Step 31: Determine a method for generating the internal read request;

[0101] Step 32: If the generation mode is manually triggered by the user, the internal read request is added to the user read request waiting queue;

[0102] Step 33: If the generation mode is automatically triggered by the system, the internal read request is added to the common read request waiting queue.

[0103] It should be noted that this embodiment does not limit how to determine the method for generating the internal read request, which can be determined specifically according to the type of operation that triggers the generation of the internal read request. For example, a list can be set to determine a part of the operations as user manual operation types and another part of the operations as system automatic operation types, so that the method for generating the internal read request can be determined by the list.

[0104] Furthermore, since the physical hard disk may be stuck or respond slowly, it is difficult to process the internal read request in the user read request waiting queue in time, and since the processing result is usually not returned to the user before the internal read request is processed, the user will be forced to wait for the internal read request processing result for a long time, which may easily give the user the impression that the device is running slowly and stuck. In order to improve the user experience, for the internal read requests in the user read request waiting queue, this embodiment can also record the waiting time of each internal read request and determine whether the waiting time reaches the first preset time. If the first preset time is not reached, the scheduling can continue; if the first preset time is reached, the corresponding internal read request can be directly removed from the user read request waiting queue, and an alarm message indicating that the internal read request has timed out can be output, so that the user can understand the execution status of the read operation initiated by the user in a timely manner.

[0105] Based on this, the method may further include:

[0106] Step 41: Record the waiting time of each internal read request in the user read request waiting queue;

[0107] Step 42: When it is determined that the waiting time of the internal read request reaches a first preset time, the internal read request is removed from the user read request waiting queue, and an alarm message indicating that the read request has timed out is output.

[0108] It should be noted that the present embodiment does not limit the specific value of the first preset time length, and can be set according to actual application requirements. For example, the first preset time length can be 1 second.

[0109] S203: When it is determined that the read request execution queue corresponding to the physical hard disk is empty, the internal read requests in the read request waiting queue are moved to the read request execution queue.

[0110] S204: When it is determined that all internal read requests in the read request execution queue of the physical hard disk have been processed, clear the read request execution queue, and move the internal read requests in the read request waiting queue to the read request execution queue.

[0111] Steps S203 and S204 mainly explain when to move the internal read request from the read request waiting queue to the read request execution queue. As for the scheduling order of each read request waiting queue, in order to ensure that the internal read request generated by the user's manual triggering is processed first, this embodiment can determine whether the user read request waiting queue is empty. If the user read request waiting queue is not empty, the internal read request therein can be moved to the read request designated queue first; if the user read request waiting queue is empty, the internal read request in the ordinary user read request waiting queue can be moved to the read request designated queue.

[0112] Based on this, moving the internal read / write requests in the waiting queue to the execution queue may include:

[0113] Step 51: Determine whether the user read request waiting queue is empty; if so, proceed to step 53; if not, proceed to step 52.

[0114] Step 52: If the user read request waiting queue is not empty, move the read requests in the user read request waiting queue to the read request execution queue.

[0115] Step 53: If the user read request waiting queue is empty, the internal read and write requests in the common read request waiting queue are moved to the read request execution queue.

[0116] S205. Each time the internal read request is written to the read request execution queue, determine to trigger an internal read request processing operation, and treat all internal read requests in the read request execution queue as pending internal read requests; the queue depth value of the read request execution queue is the maximum concurrency.

[0117] S206: Send the pending internal read request to the corresponding physical hard disk for processing.

[0118] In this embodiment, triggering the internal read request processing operation means that a new batch of internal read requests needs to be sent to the physical hard disk for execution. In addition, the queue depth value of the read request execution queue represents the maximum concurrency of the internal read requests, so when it is determined that a new batch of internal read requests are written into the read request execution queue, this embodiment can directly send all the internal read requests in the read request execution queue to the corresponding physical hard disk for execution.

[0119] Based on the above embodiment, the specific process of the storage device performing internal write request scheduling based on the write request control queue will be introduced below. In a possible situation, the method may also include:

[0120] S301: Receive an internal write request generated inside the storage device.

[0121] S302: Add the internal write request to a write request waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal write request.

[0122] In this embodiment, since internal write requests are generally initiated by the storage device rather than the user, it is not necessary to set multiple write request waiting queues with different functions according to the trigger generation method of the internal write requests. Instead, only one write request waiting queue is set to queue all internal write requests.

[0123] Furthermore, when the physical hard disk is stuck for a long time and has a low response speed, each internal write request in the write request waiting queue will have a problem of too long waiting time. At this time, the storage device can generally be restarted to reset the device. Therefore, this embodiment can also record the waiting time of each internal write request in the write request waiting queue, and determine whether the waiting time reaches a second preset time. If the second preset time is not reached, the scheduling can continue; if the second preset time has been reached, it means that the physical hard disk is faulty, and the storage device can be restarted to reset the device.

[0124] Based on this, the method may further include:

[0125] Step 61: Record the waiting time of each internal write request in the write request waiting queue.

[0126] Step 62: When it is determined that the waiting time of the internal write request reaches a second preset time, restart the storage device.

[0127] It should be noted that the present embodiment does not limit the specific value of the second preset time length, and can be set according to actual application requirements. Compared with the first preset time length, the second preset time length can be set to a larger value, for example, 360 seconds.

[0128] S303: When it is determined that the write request execution queue corresponding to the physical hard disk is empty, the internal write request in the write request waiting queue is moved to the write request execution queue.

[0129] S304: When it is determined that all internal write requests in the write request execution queue of the physical hard disk have been processed, clear the write request execution queue, and move the internal write requests in the write request waiting queue to the write request execution queue.

[0130] S305. Each time the internal write request is written to the write request execution queue, determine to trigger an internal write request processing operation, and treat all internal write requests in the write request execution queue as to-be-processed internal write requests; the queue depth value of the write request execution queue is the maximum concurrency.

[0131] S306: Send the pending internal write request to the corresponding physical hard disk for processing.

[0132] In this embodiment, triggering the internal write request processing operation means that a new batch of internal write requests needs to be sent to the physical hard disk for execution. In addition, the queue depth value of the write request execution queue represents the maximum concurrency of the internal read requests, so when it is determined that a new batch of internal read requests are written to the write request execution queue, this embodiment can directly send all the internal read requests in the write request execution queue to the corresponding physical hard disk for execution.

[0133] Based on the above embodiment, the specific form of setting the control queue in the memory space of the storage device is introduced below. In one possible case, adding the internal read / write request to the control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request may include:

[0134] S401. Add the internal read / write request to a memory area corresponding to the physical hard disk in the memory according to the physical hard disk information included in the internal read / write request.

[0135] S402: Add the memory block address storing the internal read / write request to the control queue corresponding to the physical hard disk in the memory.

[0136] In this embodiment, each physical hard disk can be allocated a memory area in the storage device memory for storing the internal read and write request to be sent to the physical hard disk. The memory area can be divided into multiple memory blocks, and each memory block stores an internal read and write request. Furthermore, the control queue can be a linked list for storing memory block addresses. After an internal read and write request is written into the memory area, the memory block address storing the internal read and write request can be written into the control queue for queuing and waiting. When the internal read and write request needs to be sent to the physical hard disk for processing, the memory block address can be taken out from the control queue, and the internal read and write request can be taken out from the memory device according to the memory block address, and then the internal read and write request can be sent to the physical hard disk for processing.

[0137] Furthermore, in order to standardize the storage format of internal read and write requests in the memory area, this embodiment may preset a structure that specifies how to store various request information in the internal read and write request (such as hard disk ID, starting LBA address, ending LBA address, read and write type, request arrival time, request submission time. LBA, Logical Block Address, logical block address). Furthermore, after receiving the internal read and write request, the request information contained therein may be written into the above-mentioned preset structure to obtain a request information structure, and the request information structure is written into the memory area corresponding to the corresponding physical hard disk in the memory.

[0138] Based on this, adding the internal read / write request to the memory area corresponding to the physical hard disk in the memory may include:

[0139] Step 71: writing the request information in the internal read / write request into a preset structure to obtain a request information structure;

[0140] Step 72: Add the request information structure to the memory area corresponding to the physical hard disk in the memory.

[0141] It should be noted that this embodiment does not limit the specific form of the above-mentioned preset structure, which can be set according to actual application requirements.

[0142] Further, obtaining from the control queue a number of to-be-processed internal read and write requests corresponding to the maximum concurrency preset for the control queue may include:

[0143] S501. Obtain from the control queue a number of to-be-read memory block addresses corresponding to a preset maximum concurrency of the control queue, and obtain from the memory the to-be-executed internal read / write requests according to the to-be-read memory block addresses.

[0144] As described above, when the internal read / write request in the control queue needs to be sent to the physical hard disk for processing, the memory block address can be taken out from the control queue, and the internal read / write request can be taken out from the memory device according to the memory block address, and then the internal read / write request can be sent to the physical hard disk for processing.

[0145] Based on the above embodiments, in order to improve the scheduling performance of the storage device central processor for each internal read and write request, this embodiment can also evenly distribute all physical hard disks in the storage device to each central processor core, so as to utilize different central processor cores to schedule the control queues of different physical hard disks, thereby improving the overall processing efficiency of the system.

[0146] Based on this, each time the internal read / write request processing operation is triggered, a number of pending internal read / write requests corresponding to the maximum concurrency preset by the control queue is obtained from the control queue, and the pending internal read / write requests are sent to the corresponding physical hard disk for processing, which may include:

[0147] S601. Call the central processing unit core corresponding to the physical hard disk to obtain the number of pending internal read and write requests corresponding to the maximum concurrency preset by the control queue from the control queue each time an internal read and write request processing operation is triggered, and send the pending internal read and write requests to the corresponding physical hard disk for processing; all physical hard disks in the storage device are evenly distributed to each central processing unit core.

[0148] Furthermore, to facilitate management and avoid locking the control queue due to executing tasks in different threads, when sending internal read and write commands to a specified disk, it is necessary to bind it to the thread corresponding to the disk for processing. After the internal read and write command is completed, it is switched to the original thread for processing and the result is notified to the upper layer.

[0149] Based on this, the calling of the central processing unit core corresponding to the physical hard disk obtains a number of pending internal read and write requests corresponding to the maximum concurrency preset by the control queue from the control queue each time an internal read and write request processing operation is triggered, and sends the pending internal read and write requests to the corresponding physical hard disk for processing, including:

[0150] Step 81: Control the CPU core corresponding to the physical hard disk to perform thread switching, so as to switch the currently working thread in the CPU core from a service thread to an internal dedicated thread;

[0151] Step 82: using the internal dedicated thread to execute, each time an internal read / write request processing operation is triggered, obtaining from the control queue a number of pending internal read / write requests corresponding to the maximum concurrency preset by the control queue, and sending the pending internal read / write requests to the corresponding physical hard disk for processing;

[0152] Step 83: When it is determined that all pending internal read and write requests have been processed, control the CPU core corresponding to the physical hard disk to perform thread switching to switch the currently working thread in the CPU core from the internal dedicated thread to the service thread.

[0153] Based on the above embodiment, if there is an exception in the physical hard disk's processing of the pending internal read / write request, in order to avoid interference to the physical hard disk caused by repeated processing of the pending internal read / write request, the processing of the pending internal read / write request can be stopped and the corresponding exception information can be output.

[0154] In a possible scenario, after sending the to-be-processed internal read / write request to the corresponding physical hard disk for processing, the following may also be included:

[0155] S701: Receive a processing result returned by the physical hard disk.

[0156] S702: If it is determined that the processing result includes exception information, output warning information including the exception information, and complete the processing of the pending internal read / write request.

[0157] Based on the above embodiment, the above read and write request processing method is fully introduced below based on specific examples. Figure 2 , Figure 2A flowchart of another read-write request processing method provided by an embodiment of the present invention, as shown in the figure, after the storage device generates an internal read-write request, it will first apply for memory resources from the memory, and put the hard disk ID corresponding to the internal read-write request and the hard disk area (start and end LBA) that needs to be read and written into the applied memory resources. Then, the storage device selects the CPU core resource (CPU resources are evenly distributed on all hard disks) according to the hard disk ID, and then processes the internal read-write request on the CPU core. Each hard disk is provided with a corresponding control queue. A control queue includes a waiting queue and an execution queue. After the internal read-write request arrives at the control queue of the corresponding hard disk, the storage device chooses to discard the internal read-write request, put it into the waiting queue for waiting, or put the internal read-write request into the execution queue and send it to the hard disk for execution according to the business rules.

[0158] 1. Queue control of internal read and write requests:

[0159] (1) This solution processes internal read requests and write requests separately.

[0160] (2) Read request processing: The generation of internal read and write requests in storage is divided into user operation generation and storage management generation. In order to prevent the impact on business read and write requests, it is currently tentatively determined that only one read request can be submitted to the IO stack at the same time, that is, the read request execution queue can only have one read request, and the queue depth is 1. Other read requests are waiting in the read request waiting queue. Because it is a user operation, this operation has the highest priority. In order to give priority to the read requests of user queries, the read request waiting queue is divided into a user read request waiting queue and a general read request waiting queue. When the read request in the execution queue is executed, it is removed from the read request execution queue. First, the user read request waiting queue is traversed. If there is no read request waiting to be executed in the read request waiting queue, the first read request traversed is removed from the waiting queue, placed in the read request execution queue, and submitted to the IO stack for disk processing. Among them, the physical hard disk processes the read and write requests in the IO stack.

[0161] Write request processing: Write requests are only generated inside the storage device, so write requests have no priority. There is only one write request waiting queue and one write request execution queue. Similar to read request processing, if there is a write request waiting to be executed in the write request waiting queue, the first write request traversed is removed from the write request waiting queue, put into the write request execution queue, and submitted to the IO stack for disk processing. A read request and a write request can be submitted to the IO stack at the same time.

[0162] 2. Memory resource management for internal read and write requests:

[0163] A new structure is defined on the storage device to process internal read and write requests, record the hard disk ID, the starting LBA address (start_lba), the ending LBA address (end_lba), and is divided into read requests and write requests, request arrival time, and request submission time. Each structure corresponds to a memory resource. Each memory resource corresponds to a read request or a write request. The life cycle of the memory resource is from the generation of the read and write request to the completion of the request execution.

[0164] Write Request: Write requests are only generated internally by the storage device.

[0165] Read request: There are two sources of read requests: user query operations and storage device internal generation.

[0166] Each hard disk allocates 100 memory resources for read / write requests.

[0167] 3. Internal read and write request timeout processing:

[0168] Read request timeout processing: Query tasks are divided into user query operations and those generated internally by storage devices. User query operations require timely responses, so if a read request in the user read request waiting queue waits for more than 1 second, it is directly removed from the user read request waiting queue and a timeout is returned to the user. The response requirements for read requests generated internally by storage devices are lower. If it is in the ordinary read request waiting queue, no timeout detection is performed.

[0169] Write request timeout processing: Compared with read requests, the number of write requests is small and they are not discarded. If the execution time exceeds 360s, it means that there is a serious problem inside the storage system. Restart the node directly.

[0170] The time when the read / write request is generated is stored in the memory resource and recorded as the request arrival time of the internal read / write request. The time when the request is written to the disk is also stored in the memory resource and recorded as the request submission time of the internal read / write request.

[0171] 4. Exception handling of internal read and write requests:

[0172] There are two types of exceptions: (1) The read request times out in the waiting queue and is discarded. (2) When the hard disk fails or an error occurs within the storage system, the read request fails to be written to the disk and an error is returned.

[0173] (1) The read request times out in the waiting queue and is discarded. A timeout error code (timeout error code) is directly returned to the upper layer module (user or storage internal task), indicating to the upper layer that the underlying IO stack is busy or the query task is too heavy.

[0174] (2) The disk fails, and the hard disk or storage system returns an error code to the upper module. For read / write requests, there are three error codes (plio_rc) returned by the read / write request stack to the storage system:

[0175] offline: indicates that the internal hard disk is offline and an internal hard disk offline alarm needs to be displayed to the user.

[0176] medium: indicates a medium error. There may be a bad block in the internal hard disk, so no more retries are made. If it is a read request, the data read by the read request is considered invalid, and the data at this point is 0. If it is a write request, no more processing is done, and the upper-layer module is notified that the data in the write request was not successfully written.

[0177] failed: indicates other types of errors. Same as medium processing, no more retries. If it is a read request, the data read by the read request is considered invalid, and the data at this point is 0. If it is a write request, no more processing is done, and the upper-layer module is notified that the data of the write request was not successfully written.

[0178] 5. Thread scheduling for internal read and write requests:

[0179] If read requests / write requests are executed on any thread, it will be inconvenient to manage, difficult to locate storage system failures, and may even affect storage performance as a whole.

[0180] Read request: To facilitate management and avoid locking the waiting queue / execution queue due to executing tasks in different threads, when sending a read request to a specified hard disk, it needs to be bound to the thread corresponding to the hard disk for processing. After the read request is completed, it switches to the original thread for processing and notifies the upper layer of the result.

[0181] Write request: To facilitate management and avoid locking the waiting queue / execution queue due to executing tasks in different threads, when sending a write request to a specified hard disk, it is also bound to the thread corresponding to the hard disk for processing. After the write request is completed, it switches to the original thread for processing and notifies the upper layer of the result.

[0182] The beneficial effects brought about by the present invention are: the present invention improves the original method of managing internal read and write requests of the storage system, avoids the situation where the business read and write request performance fluctuates, decreases or even drops to zero due to the occasional triggering of internal read and write requests, improves the user experience of using the storage system, and at the same time adds memory resource management and processor resource management to reduce the probability of storage system failure.

[0183] The following is an introduction to the read and write request processing apparatus, storage device, computer program product, and computer-readable storage medium provided in an embodiment of the present invention. The read and write request processing apparatus, storage device, computer program product, and computer-readable storage medium described below can be referenced to the read and write request processing method described above.

[0184] Please refer to Figure 3 , Figure 3 This is a structural block diagram of a read / write request processing device provided by an embodiment of the present invention. The device is applied to a storage device and may include:

[0185] A receiving module 301 is used to receive an internal read / write request generated inside the storage device;

[0186] A queue scheduling module 302, configured to add the internal read / write request to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request;

[0187] The request sending module 303 is used to obtain the number of pending internal read and write requests corresponding to the maximum concurrency preset by the control queue from the control queue each time the internal read and write request processing operation is triggered, and send the pending internal read and write requests to the corresponding physical hard disk for processing.

[0188] Optionally, the control queue includes a waiting queue and an execution queue;

[0189] The queue scheduling module 302 may include:

[0190] A waiting queue scheduling submodule, used for adding the internal read / write request to the waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read / write request;

[0191] A first execution queue scheduling submodule, configured to move the internal read and write requests in the waiting queue to the execution queue when it is determined that the execution queue corresponding to the physical hard disk is empty;

[0192] The second execution queue scheduling submodule is used to clear the execution queue and move the internal read and write requests in the waiting queue to the execution queue when it is determined that all internal read and write requests in the execution queue of the physical hard disk have been processed.

[0193] Optionally, the queue depth value of the execution queue is the maximum concurrency;

[0194] The request sending module 303 may include:

[0195] A submodule is provided, which is used to determine to trigger the internal read / write request processing operation each time the internal read / write request is written to the execution queue, and to use all the internal read / write requests in the execution queue as the internal read / write requests to be processed;

[0196] The sending submodule is used to send the pending internal read and write request to the corresponding physical hard disk for processing.

[0197] Optionally, the control queue includes a read request control queue that only stores internal read requests and a write request control queue that only stores internal write requests, the read request control queue includes a read request waiting queue and a read request waiting queue, and the write request control queue includes a write request waiting queue and a write request waiting queue.

[0198] Optionally, the read request waiting queue includes a user read request waiting queue and a common read request waiting queue;

[0199] The waiting queue scheduling submodule may include:

[0200] A generation mode determination unit, used to determine a generation mode of the internal read request;

[0201] A user read request waiting queue adding unit, configured to add the internal read request to the user read request waiting queue if the generation mode is manually triggered by the user;

[0202] The common read request waiting queue adding unit is used to add the internal read request to the common read request waiting queue if the generation mode is automatically triggered by the system.

[0203] Optionally, both the first execution queue scheduling submodule and the second execution queue scheduling submodule include an execution queue scheduling unit, and the execution queue scheduling unit is used to:

[0204] Determine whether the user read request waiting queue is empty;

[0205] If the user read request waiting queue is not empty, moving the internal read request in the user read request waiting queue to the read request execution queue;

[0206] If the user read request waiting queue is empty, the internal read requests in the common read request waiting queue are moved to the read request execution queue.

[0207] Optionally, the waiting queue scheduling submodule may further include:

[0208] A user read request timing unit, used to record the waiting time of each internal read request in the user read request waiting queue;

[0209] The user read request removing unit is used to remove the internal read request from the user read request waiting queue when it is determined that the waiting time of the internal read request reaches a first preset time, and output an alarm message indicating that the internal read request has timed out.

[0210] Optionally, the waiting queue scheduling submodule may further include:

[0211] A write request timing unit, used to record the waiting time of each internal write request in the write request waiting queue;

[0212] A restart control unit is used to restart the storage device when it is determined that the waiting time of the internal write request reaches a second preset time.

[0213] Optionally, the queue scheduling module 302 includes:

[0214] A memory writing submodule, used for adding the internal read / write request to the memory area corresponding to the physical hard disk in the memory according to the physical hard disk information contained in the internal read / write request;

[0215] A control queue adding submodule, used for adding the memory block address storing the internal read and write request to the control queue corresponding to the physical hard disk in the memory;

[0216] The request sending module 303 includes:

[0217] The acquisition submodule is used to acquire from the control queue a number of memory block addresses to be read corresponding to the maximum concurrency preset by the control queue, and acquire from the memory the internal read and write requests to be processed according to the memory block addresses to be read.

[0218] Optionally, the memory writing submodule includes:

[0219] A structure filling unit, used for writing the request information in the internal read / write request into a preset structure to obtain a request information structure;

[0220] An adding unit is used to add the request information structure to a memory area corresponding to the physical hard disk in the memory.

[0221] Optionally, the request sending module 303 may be used to:

[0222] The central processing unit core corresponding to the physical hard disk is called to obtain a number of pending internal read and write requests corresponding to the maximum concurrency preset for the control queue from the control queue each time an internal read and write request processing operation is triggered, and the pending internal read and write requests are sent to the corresponding physical hard disk for processing; all physical hard disks in the storage device are evenly distributed to each central processing unit core.

[0223] Optionally, the request sending module 303 may include:

[0224] A first thread switching submodule is used to control the CPU core corresponding to the physical hard disk to perform thread switching, so as to switch the currently working thread in the CPU core from a service thread to an internal dedicated thread;

[0225] a processing submodule, configured to utilize the internal dedicated thread to execute the steps of obtaining, from the control queue, a number of pending internal read / write requests corresponding to the maximum concurrency preset by the control queue each time an internal read / write request processing operation is triggered, and sending the pending internal read / write requests to the corresponding physical hard disk for processing;

[0226] The second thread switching submodule is used to control the central processing unit core corresponding to the physical hard disk to perform thread switching when it is determined that all the pending internal read and write requests have been processed, so as to switch the currently working thread in the central processing unit core from the internal dedicated thread to the business thread.

[0227] Optionally, the device may further include:

[0228] A processing result receiving module, used for receiving the processing result returned by the physical hard disk;

[0229] The exception processing module is used to output warning information containing the exception information if it is determined that the processing result contains exception information, and complete the processing of the pending internal read and write request.

[0230] Please refer to Figure 4 , Figure 4 This is a structural block diagram of a storage device provided in an embodiment of the present invention. The embodiment of the present invention provides a storage device 40, including a processor 41, a program memory 42, and a physical hard disk 43; wherein the program memory 42 is used to store computer programs; the processor 41 is used to execute the read and write request processing method provided in the aforementioned embodiment when executing the computer program; the physical hard disk 43 is used to process internal read and write requests issued by the processor 41.

[0231] For the specific process of the above-mentioned read and write request processing method, reference may be made to the corresponding contents provided in the aforementioned embodiments, which will not be described in detail here.

[0232] Furthermore, the program memory 42 as a carrier for storing resources may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the storage method may be temporary storage or permanent storage.

[0233] In addition, the storage device 40 also includes a power supply 44, a communication interface 45, an input / output interface 46 and a communication bus 47; wherein the power supply 44 is used to provide working voltage for each hardware device on the storage device 40; the communication interface 45 can create a data transmission channel between the storage device 40 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present invention, and is not specifically limited here; the input / output interface 46 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0234] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the read / write request processing method described in the above embodiment is implemented.

[0235] Since the embodiments of the computer program product part correspond to the embodiments of the read / write request processing method part, please refer to the description of the embodiments of the read / write request processing method part for the embodiments of the computer program product part, which will not be repeated here.

[0236] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the read-write request processing method described in the above embodiment is implemented.

[0237] Since the embodiments of the computer-readable storage medium part correspond to the embodiments of the read / write request processing method part, please refer to the description of the embodiments of the read / write request processing method part for the embodiments of the storage medium part, which will not be repeated here.

[0238] The various embodiments in the 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 referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0239] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0240] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0241] The above is a detailed introduction to the read and write request processing method, device, storage device, program product and medium provided by the present invention. Specific examples are used herein 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. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the present invention.

Claims

1. A method for processing a read / write request, characterized in that: Applied to a storage device, the method comprises: Receiving an internal read / write request generated within the storage device; According to the physical hard disk information in the internal read / write request, the internal read / write request is added to the control queue corresponding to the corresponding physical hard disk in the memory space; wherein the control queue includes a waiting queue and an execution queue; Each time an internal read / write request processing operation is triggered, a number of pending internal read / write requests corresponding to the maximum concurrency preset in the control queue is obtained from the control queue, and the pending internal read / write requests are sent to the corresponding physical hard disk for processing; wherein the storage device detects the number of external read / write requests sent by the host device and receives the number of external read / write requests, and determines the current maximum concurrency according to the number of external read / write requests; Adding the internal read / write request to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request includes: Adding the internal read / write request to a waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read / write request; When it is determined that the execution queue corresponding to the physical hard disk is empty, the internal read and write requests in the waiting queue are moved to the execution queue; When it is determined that all internal read and write requests in the execution queue of the physical hard disk have been processed, the execution queue is cleared, and the internal read and write requests in the waiting queue are moved to the execution queue.

2. The method for processing read and write requests according to claim 1, characterized in that: The queue depth value of the execution queue is the maximum concurrency; Each time an internal read / write request processing operation is triggered, a number of pending internal read / write requests corresponding to the maximum concurrency preset by the control queue is obtained from the control queue, and the pending internal read / write requests are sent to the corresponding physical hard disk for processing, including: Each time the internal read / write request is written to the execution queue, determining to trigger the internal read / write request processing operation, and treating all the internal read / write requests in the execution queue as the internal read / write requests to be processed; The pending internal read and write request is sent to the corresponding physical hard disk for processing.

3. The read / write request processing method according to claim 1 or 2, characterized in that: The control queue includes a read request control queue that only stores internal read requests and a write request control queue that only stores internal write requests. The read request control queue includes a read request waiting queue and a read request waiting queue, and the write request control queue includes a write request waiting queue and a write request waiting queue.

4. The method for processing read and write requests according to claim 3, characterized in that: The read request waiting queue includes a user read request waiting queue and a common read request waiting queue; Adding the internal read / write request to a waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read / write request includes: Determining a method for generating the internal read request; If the generation mode is manually triggered by the user, the internal read request is added to the user read request waiting queue; If the generation mode is automatically triggered by the system, the internal read request is added to the common read request waiting queue.

5. The method for processing read and write requests according to claim 4, characterized in that: Moving the internal read / write request in the waiting queue to the execution queue includes: Determine whether the user read request waiting queue is empty; If the user read request waiting queue is not empty, moving the internal read request in the user read request waiting queue to the read request execution queue; If the user read request waiting queue is empty, the internal read requests in the common read request waiting queue are moved to the read request execution queue.

6. The method for processing read and write requests according to claim 4, characterized in that: Also includes: Recording the waiting time of each internal read request in the user read request waiting queue; When it is determined that the waiting time of the internal read request reaches a first preset time, the internal read request is removed from the user read request waiting queue, and an alarm message indicating that the internal read request has timed out is output.

7. The method for processing read and write requests according to claim 3, characterized in that: Also includes: Recording the waiting time of each internal write request in the write request waiting queue; When it is determined that the waiting time of the internal write request reaches a second preset time, the storage device is restarted.

8. The method for processing read and write requests according to claim 1, characterized in that: Adding the internal read / write request to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request includes: Adding the internal read / write request to the memory area corresponding to the physical hard disk in the memory according to the physical hard disk information included in the internal read / write request; Adding the memory block address storing the internal read / write request to the control queue corresponding to the physical hard disk in the memory; Obtaining from the control queue a number of pending internal read and write requests corresponding to a maximum concurrency preset for the control queue, including: A number of to-be-read memory block addresses corresponding to the maximum concurrency preset for the control queue is obtained from the control queue, and the to-be-processed internal read / write requests are obtained from the memory according to the to-be-read memory block addresses.

9. The method for processing read and write requests according to claim 8, characterized in that: Adding the internal read / write request to a memory area corresponding to the physical hard disk in the memory includes: Writing the request information in the internal read / write request into a preset structure to obtain a request information structure; The request information structure is added to a memory area corresponding to the physical hard disk in the memory.

10. The method for processing read and write requests according to claim 1, characterized in that: Each time an internal read / write request processing operation is triggered, a number of pending internal read / write requests corresponding to the maximum concurrency preset by the control queue is obtained from the control queue, and the pending internal read / write requests are sent to the corresponding physical hard disk for processing, including: The central processing unit core corresponding to the physical hard disk is called to obtain a number of pending internal read and write requests corresponding to the maximum concurrency preset for the control queue from the control queue each time an internal read and write request processing operation is triggered, and the pending internal read and write requests are sent to the corresponding physical hard disk for processing; all physical hard disks in the storage device are evenly distributed to each central processing unit core.

11. The method for processing read and write requests according to claim 10, characterized in that: The method further comprises: calling a central processing unit core corresponding to the physical hard disk to obtain a number of pending internal read / write requests corresponding to a preset maximum concurrency of the control queue from the control queue each time an internal read / write request processing operation is triggered, and sending the pending internal read / write requests to the corresponding physical hard disk for processing, including: Controlling the CPU core corresponding to the physical hard disk to perform thread switching, so as to switch the currently working thread in the CPU core from a service thread to an internal dedicated thread; The internal dedicated thread is used to execute the steps of obtaining a number of pending internal read / write requests corresponding to the maximum concurrency preset by the control queue from the control queue each time an internal read / write request processing operation is triggered, and sending the pending internal read / write requests to the corresponding physical hard disk for processing; When it is determined that all pending internal read and write requests have been processed, the central processing unit core corresponding to the physical hard disk is controlled to perform thread switching to switch the currently working thread in the central processing unit core from the internal dedicated thread to the service thread.

12. The method for processing read and write requests according to claim 1, characterized in that: After sending the pending internal read / write request to the corresponding physical hard disk for processing, the method further includes: Receiving the processing result returned by the physical hard disk; If it is determined that the processing result includes abnormal information, an alarm message including the abnormal information is output, and the processing of the pending internal read / write request is completed.

13. A read / write request processing device, characterized in that: Applied to a storage device, the device comprises: A receiving module, used for receiving an internal read / write request generated inside the storage device; A queue scheduling module, used for adding the internal read / write request to a control queue corresponding to the corresponding physical hard disk in the memory space according to the physical hard disk information in the internal read / write request; wherein the control queue includes a waiting queue and an execution queue; A request sending module is used to obtain the number of pending internal read and write requests corresponding to the maximum concurrency preset by the control queue from the control queue each time the internal read and write request processing operation is triggered, and send the pending internal read and write requests to the corresponding physical hard disk for processing; wherein the storage device detects the number of external read and write requests sent by the host device and receives it, and determines the current maximum concurrency according to the number of external read and write requests; Queue scheduling module, including: A waiting queue scheduling submodule, used for adding the internal read / write request to the waiting queue of the corresponding physical hard disk according to the physical hard disk information in the internal read / write request; A first execution queue scheduling submodule, configured to move the internal read and write requests in the waiting queue to the execution queue when it is determined that the execution queue corresponding to the physical hard disk is empty; The second execution queue scheduling submodule is used to clear the execution queue and move the internal read and write requests in the waiting queue to the execution queue when it is determined that all internal read and write requests in the execution queue of the physical hard disk have been processed.

14. A storage device, characterized in that: include: Program memory, used to store computer programs; A processor, configured to implement the read / write request processing method according to any one of claims 1 to 12 when executing the computer program; The physical hard disk is used to process the internal read and write requests sent by the processor.

15. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the read / write request processing method according to any one of claims 1 to 12 are implemented.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by the processor, the read-write request processing method according to any one of claims 1 to 12 is implemented.