Input / output instruction management method and device, electronic equipment and storage medium

By mapping error handling codes and historical records, device paths are determined, solving the problem of low path selection efficiency in storage systems and improving IO processing efficiency.

CN117170919BActive Publication Date: 2026-06-26INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2023-08-28
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing storage systems suffer from inefficient path selection when handling error I/O returned by backend storage devices, resulting in low error handling efficiency.

Method used

Error codes are mapped to error handling codes, recorded in a history table, and generated by combining protocol link type information and local port location information. The device path is determined, the retry path is determined, the appropriate device path is selected, and the IO is resent.

Benefits of technology

It improves the efficiency of I/O processing and reduces the possibility of I/O errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117170919B_ABST
    Figure CN117170919B_ABST
Patent Text Reader

Abstract

The application provides an input / output instruction management method and device, electronic equipment and a storage medium, which are applied to a storage hardware device. The method comprises the following steps: in response to receiving an input / output instruction issued by a host, sending the input / output instruction to a back-end storage device, and returning response information of the back-end storage device to the host; in response to receiving an error code of the input / output instruction returned by the back-end storage device, mapping the error code into an error processing code and recording the error processing code in a history record table corresponding to the input / output instruction; in response to receiving the error processing code, performing error processing on the input / output instruction according to the error processing code; in response to completing the error processing, obtaining a device path corresponding to the history record table and the back-end storage device; and determining a retry path according to the history record table and the device path and resending the input / output instruction to the back-end storage device according to the retry path. A new retry path is selected through historical error records and influence factors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of storage system technology, and in particular to a method, apparatus, electronic device, and storage medium for managing input / output instructions. Background Technology

[0002] The ERP error handling module is one of the most important modules in storage hardware. It refers to how the storage system handles I / O (Input / Output) after it sends it to the backend storage device and an error is returned to the storage system. Common error handling methods include retries, delayed retries, port reinitialization, resetting the erroneous port, and device reset. Regardless of the method, unless the I / O error is returned to the host, it must eventually be retried. Therefore, when the backend storage device has multiple paths, choosing the retried path becomes an unavoidable problem. Most current systems either choose the original path or simply use a round-robin algorithm. However, if the error is due to a path problem, this path selection method significantly reduces the efficiency of error handling. Summary of the Invention

[0003] Therefore, it is necessary to provide a method, apparatus, electronic device, and storage medium for managing input / output commands that can automatically find the appropriate device path for issuing input / output commands, in order to address the above-mentioned technical problems.

[0004] Firstly, a method for managing input / output instructions is provided, applied to a storage hardware device, the method comprising:

[0005] In response to receiving an input / output command from the host, the system sends the input / output command to the backend storage device and returns the response information of the backend storage device to the host.

[0006] In response to receiving an error code from the input / output instruction returned by the backend storage device, the error code is mapped to an error handling code and the error handling code is recorded in the history table corresponding to the input / output instruction;

[0007] In response to receiving the error handling code, the input / output instruction is processed for errors according to the error handling code;

[0008] In response to the completion of error handling, obtain the historical record table and the device path corresponding to the backend storage device;

[0009] Based on the historical record table and the device path, the retry path corresponding to the input / output command is determined, and the input / output command is resent to the backend storage device according to the retry path.

[0010] In one embodiment, the step of performing error processing on the input / output instructions according to the error processing code includes:

[0011] Call the error handling function corresponding to the error handling code;

[0012] The error handling function executes an error handling strategy, which includes one or more of the following: retry, delayed retry, port reinitialization, error port reset, and device reset.

[0013] In one embodiment, the process of receiving input / output instructions from the host includes:

[0014] In response to receiving login information reported by the device port of the backend storage device, determine the device path corresponding to the device port;

[0015] The bitmap information of the device path is generated based on the protocol link type information, local port location information, and backend device port information corresponding to the login information.

[0016] In one embodiment, determining the retry path corresponding to the input / output command based on the history table and the device path includes:

[0017] Create an impact factor mask table and determine the error impact factor mask value based on the impact factor mask table and the error handling code;

[0018] Traverse the device paths and determine whether a target path exists in the device paths;

[0019] If not, the retry path is determined from the device paths according to the polling strategy;

[0020] If so, the retry path is determined based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value.

[0021] In one embodiment, determining the retry path based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value includes:

[0022] Traverse the history record table and determine whether multiple history paths exist in the history record table;

[0023] If so, then generate a historical bitmap union based on the historical bitmap information of the multiple historical paths.

[0024] The retry path is determined based on the historical bitmap union, the target bitmap information, and the error impact factor mask value;

[0025] If not, the retry path is determined based on the historical bitmap information of a historical path, the target bitmap information, and the error impact factor mask value.

[0026] In one embodiment, determining the retry path based on the historical bitmap union, the target bitmap information, and the error impact factor mask value includes:

[0027] Generate a historical mask value based on the union of the historical bitmaps and the error impact factor mask value;

[0028] Generate a target mask value based on the target bitmap information and the error impact factor mask value;

[0029] Determine whether the target mask value and the historical mask value are not equal;

[0030] If so, then the target path is determined to be the retry path;

[0031] If not, determine from the device path whether there are other target paths.

[0032] In one embodiment, a method for managing input / output instructions is also provided, applied to a backend storage device, the method comprising:

[0033] Receive input / output commands sent by storage hardware devices;

[0034] In response to successful execution of the input / output instruction, response information is generated based on the input / output instruction and sent to the storage hardware device;

[0035] In response to a failure to execute the input / output instruction, an error code for the input / output instruction is generated and sent to the storage hardware device.

[0036] On the other hand, an input / output instruction management device is provided, applied to a storage hardware device, the device comprising:

[0037] The sending module is used to respond to the input / output command received from the host, send the input / output command to the back-end storage device, and return the response information of the back-end storage device to the host;

[0038] The mapping module is used to map the error code into an error handling code and record the error handling code in the history table corresponding to the input / output instruction in response to receiving the error code of the input / output instruction returned by the back-end storage device;

[0039] The processing module is configured to, in response to receiving the error handling code, perform error handling on the input / output instruction according to the error handling code;

[0040] The acquisition module is used to acquire the historical record table and the device path corresponding to the backend storage device in response to the completion of error handling;

[0041] The determination module is used to determine the retry path corresponding to the input / output command based on the historical record table and the device path, and to resend the input / output command to the backend storage device according to the retry path.

[0042] In one embodiment, the processing module performs error processing on the input / output instructions according to the error handling code, including:

[0043] Call the error handling function corresponding to the error handling code;

[0044] The error handling function executes an error handling strategy, which includes one or more of the following: retry, delayed retry, port reinitialization, error port reset, and device reset.

[0045] In one embodiment, the sending module includes the following steps before receiving input / output instructions from the host:

[0046] In response to receiving login information reported by the device port of the backend storage device, determine the device path corresponding to the device port;

[0047] The bitmap information of the device path is generated based on the protocol link type information, local port location information, and backend device port information corresponding to the login information.

[0048] In one embodiment, the determining module determines the retry path corresponding to the input / output command based on the history table and the device path, including:

[0049] Create an impact factor mask table and determine the error impact factor mask value based on the impact factor mask table and the error handling code;

[0050] Traverse the device paths and determine whether a target path exists in the device paths;

[0051] If not, the retry path is determined from the device paths according to the polling strategy;

[0052] If so, the retry path is determined based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value.

[0053] In one embodiment, the determining module determines the retry path based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value, including:

[0054] Traverse the history record table and determine whether multiple history paths exist in the history record table;

[0055] If so, then generate a historical bitmap union based on the historical bitmap information of the multiple historical paths.

[0056] The retry path is determined based on the historical bitmap union, the target bitmap information, and the error impact factor mask value;

[0057] If not, the retry path is determined based on the historical bitmap information of a historical path, the target bitmap information, and the error impact factor mask value.

[0058] In one embodiment, the determining module determines the retry path based on the historical bitmap union, the target bitmap information, and the error impact factor mask value, including:

[0059] Generate a historical mask value based on the union of the historical bitmaps and the error impact factor mask value;

[0060] Generate a target mask value based on the target bitmap information and the error impact factor mask value;

[0061] Determine whether the target mask value and the historical mask value are not equal;

[0062] If so, then the target path is determined to be the retry path;

[0063] If not, determine from the device path whether there are other target paths.

[0064] In one embodiment, an input / output instruction management device is also provided, applied to a back-end storage device, the device comprising:

[0065] The receiving module is used to receive input / output commands sent by the storage hardware device;

[0066] The first generation module is configured to, in response to the successful execution of the input / output instruction, generate response information based on the input / output instruction and send the response information to the storage hardware device;

[0067] The second generation module is configured to generate an error code for the input / output instruction and send the error code to the storage hardware device in response to the failure to execute the input / output instruction.

[0068] In another aspect, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0069] In response to receiving an input / output command from the host, the system sends the input / output command to the backend storage device and returns the response information of the backend storage device to the host.

[0070] In response to receiving an error code from the input / output instruction returned by the backend storage device, the error code is mapped to an error handling code and the error handling code is recorded in the history table corresponding to the input / output instruction;

[0071] In response to receiving the error handling code, the input / output instruction is processed for errors according to the error handling code;

[0072] In response to the completion of error handling, obtain the historical record table and the device path corresponding to the backend storage device;

[0073] Based on the historical record table and the device path, the retry path corresponding to the input / output command is determined, and the input / output command is resent to the backend storage device according to the retry path.

[0074] In one embodiment, the processor performs the following steps when executing the computer program:

[0075] The step of performing error handling on the input / output instructions according to the error handling code includes:

[0076] Call the error handling function corresponding to the error handling code;

[0077] The error handling function executes an error handling strategy, which includes one or more of the following: retry, delayed retry, port reinitialization, error port reset, and device reset.

[0078] In one embodiment, the processor performs the following steps when executing the computer program:

[0079] The process of receiving input / output commands from the host includes:

[0080] In response to receiving login information reported by the device port of the backend storage device, determine the device path corresponding to the device port;

[0081] The bitmap information of the device path is generated based on the protocol link type information, local port location information, and backend device port information corresponding to the login information.

[0082] In one embodiment, the processor performs the following steps when executing the computer program:

[0083] Determining the retry path corresponding to the input / output command based on the historical record table and the device path includes:

[0084] Create an impact factor mask table and determine the error impact factor mask value based on the impact factor mask table and the error handling code;

[0085] Traverse the device paths and determine whether a target path exists in the device paths;

[0086] If not, the retry path is determined from the device paths according to the polling strategy;

[0087] If so, the retry path is determined based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value.

[0088] In one embodiment, the processor performs the following steps when executing the computer program:

[0089] Determining the retry path based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value includes:

[0090] Traverse the history record table and determine whether multiple history paths exist in the history record table;

[0091] If so, then generate a historical bitmap union based on the historical bitmap information of the multiple historical paths.

[0092] The retry path is determined based on the historical bitmap union, the target bitmap information, and the error impact factor mask value;

[0093] If not, the retry path is determined based on the historical bitmap information of a historical path, the target bitmap information, and the error impact factor mask value.

[0094] In one embodiment, the processor performs the following steps when executing the computer program:

[0095] Determining the retry path based on the historical bitmap union, the target bitmap information, and the error impact factor mask value includes:

[0096] Generate a historical mask value based on the union of the historical bitmaps and the error impact factor mask value;

[0097] Generate a target mask value based on the target bitmap information and the error impact factor mask value;

[0098] Determine whether the target mask value and the historical mask value are not equal;

[0099] If so, then the target path is determined to be the retry path;

[0100] If not, determine from the device path whether there are other target paths.

[0101] In one embodiment, the processor performs the following steps when executing the computer program:

[0102] Receive input / output commands sent by storage hardware devices;

[0103] In response to successful execution of the input / output instruction, response information is generated based on the input / output instruction and sent to the storage hardware device;

[0104] In response to a failure to execute the input / output instruction, an error code for the input / output instruction is generated and sent to the storage hardware device.

[0105] In another aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0106] In response to receiving an input / output command from the host, the system sends the input / output command to the backend storage device and returns the response information of the backend storage device to the host.

[0107] In response to receiving an error code from the input / output instruction returned by the backend storage device, the error code is mapped to an error handling code and the error handling code is recorded in the history table corresponding to the input / output instruction;

[0108] In response to receiving the error handling code, the input / output instruction is processed for errors according to the error handling code;

[0109] In response to the completion of error handling, obtain the historical record table and the device path corresponding to the backend storage device;

[0110] Based on the historical record table and the device path, the retry path corresponding to the input / output command is determined, and the input / output command is resent to the backend storage device according to the retry path.

[0111] In one embodiment, the computer program performs the following steps when executed by a processor:

[0112] The step of performing error handling on the input / output instructions according to the error handling code includes:

[0113] Call the error handling function corresponding to the error handling code;

[0114] The error handling function executes an error handling strategy, which includes one or more of the following: retry, delayed retry, port reinitialization, error port reset, and device reset.

[0115] In one embodiment, the computer program performs the following steps when executed by a processor:

[0116] The process of receiving input / output commands from the host includes:

[0117] In response to receiving login information reported by the device port of the backend storage device, determine the device path corresponding to the device port;

[0118] The bitmap information of the device path is generated based on the protocol link type information, local port location information, and backend device port information corresponding to the login information.

[0119] In one embodiment, the computer program performs the following steps when executed by a processor:

[0120] Determining the retry path corresponding to the input / output command based on the historical record table and the device path includes:

[0121] Create an impact factor mask table and determine the error impact factor mask value based on the impact factor mask table and the error handling code;

[0122] Traverse the device paths and determine whether a target path exists in the device paths;

[0123] If not, the retry path is determined from the device paths according to the polling strategy;

[0124] If so, the retry path is determined based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value.

[0125] In one embodiment, the computer program performs the following steps when executed by a processor:

[0126] Determining the retry path based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value includes:

[0127] Traverse the history record table and determine whether multiple history paths exist in the history record table;

[0128] If so, then generate a historical bitmap union based on the historical bitmap information of the multiple historical paths.

[0129] The retry path is determined based on the historical bitmap union, the target bitmap information, and the error impact factor mask value;

[0130] If not, the retry path is determined based on the historical bitmap information of a historical path, the target bitmap information, and the error impact factor mask value.

[0131] In one embodiment, the computer program performs the following steps when executed by a processor:

[0132] Determining the retry path based on the historical bitmap union, the target bitmap information, and the error impact factor mask value includes:

[0133] Generate a historical mask value based on the union of the historical bitmaps and the error impact factor mask value;

[0134] Generate a target mask value based on the target bitmap information and the error impact factor mask value;

[0135] Determine whether the target mask value and the historical mask value are not equal;

[0136] If so, then the target path is determined to be the retry path;

[0137] If not, determine from the device path whether there are other target paths.

[0138] In one embodiment, the computer program performs the following steps when executed by a processor:

[0139] Receive input / output commands sent by storage hardware devices;

[0140] In response to successful execution of the input / output instruction, response information is generated based on the input / output instruction and sent to the storage hardware device;

[0141] In response to a failure to execute the input / output instruction, an error code for the input / output instruction is generated and sent to the storage hardware device.

[0142] The aforementioned input / output instruction management method, apparatus, electronic device, and storage medium, in response to receiving an input / output instruction from a host, send the input / output instruction to a backend storage device and return response information from the backend storage device to the host; in response to receiving an error code from the backend storage device for the input / output instruction, map the error code to an error handling code and record the error handling code in a history table corresponding to the input / output instruction; in response to receiving the error handling code, perform error handling on the input / output instruction according to the error handling code; in response to obtaining the history table and the device path corresponding to the backend storage device, determine the retry path corresponding to the input / output instruction, and resend the input / output instruction to the backend storage device according to the retry path. By classifying the wide range of causes of IO instruction errors, when an IO error occurs, based on the round-robin path selection algorithm, the historical error record of the IO is combined with the impact factor of the IO error and the impact factor of the current error to recalculate the retry path, reducing the possibility of the IO being returned as an error again and improving the efficiency of IO processing. Attached Figure Description

[0143] Figure 1 System topology diagram for the management system of input / output commands;

[0144] Figure 2 A flowchart illustrating a method for managing input / output commands applied to storage hardware devices;

[0145] Figure 3 A schematic diagram illustrating the steps of a method for managing input / output instructions applied to storage hardware devices;

[0146] Figure 4 An example diagram of an influence factor mask table used in a method for managing input / output instructions applied to storage hardware devices;

[0147] Figure 5 A schematic diagram of a device for managing input / output instructions applied to storage hardware devices;

[0148] Figure 6 This is an internal structural diagram of a computer device in an embodiment of the present invention. Detailed Implementation

[0149] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0150] This application provides, as follows Figure 1The system topology diagram shown is for the management system of input / output commands. The storage system of the storage hardware device will first discover the back-end storage device (hard disk, heterogeneous storage device, etc.). When the back-end system disk or heterogeneous storage system is successfully connected to the back-end storage device, each connection (port) reports a login information. In the end, the storage hardware device will have multiple device paths to reach the back-end storage device.

[0151] In addition, this application provides, as follows Figure 2 The flowchart illustrates a method for managing input / output commands applied to storage hardware devices. In response to receiving an I / O request from the host to retrieve response information from the backend storage device, the host sends the I / O to the backend storage device. In response to receiving an error code from the backend storage device, the error code is mapped to an error handling code, and the I / O is processed according to the error handling code. Then, an error impact factor mask value is determined based on an impact factor mask table and the error handling code. Next, the device paths are traversed to determine if a target path exists within the device paths. If not, a retry path is determined from the device paths according to a polling strategy, and the process continues through the retry path. The backend storage device sends the IO; if so, the historical record table is traversed and it is determined whether there are multiple historical paths in the historical record table. If so, a historical mask value is generated based on the union of multiple historical bitmap information and the error impact factor mask value; if not, a historical mask value is generated based on this historical bitmap information and the error impact factor mask value; then, a target mask value is generated based on the target bitmap information and the error impact factor mask value, and it is determined whether the target mask value and the historical mask value are equal. If so, it is further determined whether there are other target paths in the device path; if not, the target path is determined as a retry path and the IO is sent to the backend storage device through the retry path.

[0152] In one embodiment, such as Figure 3 As shown, the present invention provides a method for managing input / output instructions, applied to a storage hardware device, the method comprising:

[0153] S301. In response to receiving an input / output instruction from the host, the system sends the input / output instruction to the back-end storage device and returns the response information of the back-end storage device to the host.

[0154] S302. In response to receiving an error code from the input / output instruction returned by the backend storage device, the error code is mapped to an error handling code and the error handling code is recorded in the history table corresponding to the input / output instruction;

[0155] S303. In response to receiving the error handling code, perform error handling on the input / output instruction according to the error handling code;

[0156] S304. In response to the completion of error handling, obtain the historical record table and the device path corresponding to the backend storage device;

[0157] S305. Determine the retry path corresponding to the input / output command based on the historical record table and the device path, and resend the input / output command to the backend storage device according to the retry path.

[0158] Specifically, the host sends I / O (Input / Output) commands to the storage hardware device. Upon receiving the I / O, the storage hardware device first randomly selects a device path using a polling strategy to distribute the I / O. If the I / O is successfully distributed, the backend storage device returns a response to the storage hardware device, which then returns the response to the host. If the I / O fails to distribute, the backend storage device returns an error code. When an error code is received, the storage hardware device performs error handling for that I / O, and then uses historical error records and error impact factors to find a suitable device path to continue distributing the command until successful.

[0159] In one embodiment, the step of performing error processing on the input / output instructions according to the error processing code includes:

[0160] Call the error handling function corresponding to the error handling code;

[0161] The error handling function executes an error handling strategy, which includes one or more of the following: retry, delayed retry, port reinitialization, error port reset, and device reset.

[0162] Specifically, backend storage devices return different error codes to identify different errors. `scsiskcq` is the error code returned by the SCSI protocol (Small Computer System Interface, a data transmission protocol), where `skcq` refers to the status, key, code, and qualifier values. `NVMe sc` and `sct` are error codes returned by the NVMe protocol (Num Express, a communication protocol), where `sc` refers to the status code and `sct` refers to the status code type. The storage system of the storage hardware device assigns a corresponding `ERP_NUM` (error handling code) to each type of error code. `ERP_NUM` represents `HINT_ANY`, `HINT_DOMAIN`, `HINT_INITIATOR`, and `HINT_TARGET`. `HINT_ANY` indicates that the error is unrelated to known influencing factors, and other routing strategies, such as round-robin routing, are used. `HINT_DOMAIN` indicates that the IO error is related to the domain (link), suggesting a fault in the backend storage device itself, such as disk media error or disk timeout.

[0163] HINT_INITIATOR indicates an I / O error related to the initiator (local port), suggesting a problem with the link between the storage system and the backend storage device, such as an unstable SAS cable connection. HINT_TARGET indicates an I / O error related to the target (backend port), indicating that the backend storage device is not ready. Each ERP_NUM corresponds to an error handling function. Calling the error handling function executes the corresponding error handling strategy. Common error handling strategies include retries, delayed retries, port reinitialization, resetting the faulty port, and resetting the device. For example, the error handling function corresponding to HINT_TARGET executes the error handling strategy of resetting the backend storage device; the error handling function corresponding to HINT_INITIATOR executes the error handling strategy of reinitializing the port or resetting the faulty port; and the error handling function corresponding to HINT_DOMAIN executes the error handling strategy of retrying or delayed retries. By classifying different error codes and mapping them to corresponding error handling codes, and then calling the corresponding error handling functions to execute the error handling strategies, the efficiency of I / O handling when I / O errors occur is improved.

[0164] In one embodiment, the process of receiving input / output instructions from the host includes:

[0165] In response to receiving login information reported by the device port of the backend storage device, determine the device path corresponding to the device port;

[0166] The bitmap information of the device path is generated based on the protocol link type information, local port location information, and backend device port information corresponding to the login information.

[0167] Specifically, after discovering a backend storage device, the backend storage device reports login information. At this time, the storage hardware device binds the reported login to a device path channel. Each backend storage device reports multiple logins, corresponding to multiple channels. For example, it iterates through all channels of the backend storage device (this can be understood as follows: if the backend storage device is a hard drive, each hard drive has two disk ports and reports two logins to the storage system, each login corresponding to one channel, for a total of 2 channels; if the backend storage device is heterogeneous storage, each heterogeneous storage device reports a maximum of 16 logins, corresponding to 16 channels, depending on the topology connection). That is, different backend storage devices correspond to different numbers of device paths. Then, based on the protocol link type information of the reported login (related to the domain factor), the local port location information used by the reported login (related to the initiator factor), and the backend device port information associated with the login (related to the target factor), a domain_initiator_channel_bitmap information is generated. The `login->domain_id` (protocol link type information) is the ID corresponding to the link type. Different link types have different ID values; for example, FC links, NVMe links, and SAS links have IDs of 1, 2, and 3 respectively. `login->location_id` (local port location information) is the location ID of the physical port used by the storage node to connect to the backend storage device. For example, the four ports on a SAS card have location IDs of 0, 1, 2, and 3 respectively. `login->channel_id` (backend device port information) is the port ID of the backend device used to issue I / O; for example, a dual-port disk has channel IDs of 0 and 1. Then, bitmap information is generated through bitwise operations. Specifically, 1 is left-shifted by the corresponding ID number to form a 32-bit bitmap, i.e., `domain_initiator_channel_bitmap = (1 < ... )`. <login->domain_id)<<24|

[0168] (1< <login->location_id)<<16|(1< <login->(channel_id). Then, the 32-bit bitmap information is represented in hexadecimal as 0xDDIITTTT. For example: using a SAS cable to connect a dual-port disk to the first port of the SAS card, and using the disk's channel 1 to issue I / O, SASdomain_id = 3, location_id = 1, channel_id = 1, then the bitmap is calculated as follows:

[0169] domain_initiator_channel_bitmap=(1<<3)<<24|(1<<1)<<16|1<<1

[0170] =100000000000000000000000000b|

[0171] 10000000000000000b|

[0172] 10b

[0173] =100000000100000000000000010b

[0174] =0x03010001 can be understood as follows: the first two hexadecimal digits represent the domain, the middle two digits represent the initiator, and the last four digits represent the target. The calculated bitmap information clarifies the impact factor at each point in each device path, and using this bitmap information can reduce the possibility of errors occurring again when issuing I / O through retry paths.

[0175] In one embodiment, determining the retry path corresponding to the input / output command based on the history table and the device path includes:

[0176] Create an impact factor mask table and determine the error impact factor mask value based on the impact factor mask table and the error handling code;

[0177] Traverse the device paths and determine whether a target path exists in the device paths;

[0178] If not, the retry path is determined from the device paths according to the polling strategy;

[0179] If so, the retry path is determined based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value.

[0180] Specifically, such as Figure 4 As shown, the created impact factor mask table contains four types of impact factor masks. The mask (impact factor mask value) for HINT_ANY is set to 0xffffffff; the mask for HINT_DOMAIN is set to 0x00ffffff; the mask for HINT_INITIATOR is set to 0xff00ffff; and the mask for HINT_TARGET is set to 0xffff0000. When the error handling code for this IO is HINT_DOMAIN, the hint_mask (error impact factor mask value) for this IO is determined to be "0x00ffffff". Next, the device paths are traversed to determine if a target path exists. The target path refers to a device path that has not yet been identified as an error path (the backend storage device returns an error code when the IO is issued through this path) during the current IO issuance process. If not, a retry path is arbitrarily selected from multiple device paths using a round-robin strategy. In extreme cases, the device paths between the storage hardware device and the backend storage device are all error paths. In this case, a retry path can only be arbitrarily determined using a round-robin strategy to successfully issue the IO. If the target path exists, the target bitmap information, historical record table, and error impact factor mask value of the target path are used to determine the retry path.

[0181] In one embodiment, determining the retry path based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value includes:

[0182] Traverse the history record table and determine whether multiple history paths exist in the history record table;

[0183] If so, then a historical bitmap union is generated based on the historical bitmap information of the multiple historical paths.

[0184] The retry path is determined based on the historical bitmap union, the target bitmap information, and the error impact factor mask value;

[0185] If not, the retry path is determined based on the historical bitmap information of a historical path, the target bitmap information, and the error impact factor mask value.

[0186] Specifically, the history table records all historical paths when this IO was issued. If the history table contains only one historical path and its corresponding error handling code, it indicates that this is the first time the backend storage device has returned an error code for this IO. In this case, the retry path is determined based on the historical bitmap information, target bitmap information, and error impact factor mask value of this historical path. The specific historical bitmap information is the bitmap information of a certain device path that has been calculated above. If the history table contains multiple historical paths and their corresponding error handling codes, it indicates that this IO has been attempted to be issued to the backend storage device multiple times. In this case, a "|" (meaning bitwise OR, bitwise OR) operation is required. Bitwise OR operators (a type of binary operator) are used to perform operations. Then, a union of historical bitmaps is generated based on multiple historical bitmap information, i.e., history_bitmap|=erp_history_table{i}.domain_initiator_channel_bitmap, where i is the number of historical paths. Then, the retry path is determined based on the union of historical bitmaps, the target bitmap information, and the error impact factor mask value. That is, regardless of whether the IO has only been issued once or has been issued multiple times, the possibility of successfully issuing the IO through the retry path is increased by using the variable of the union of historical bitmaps or historical bitmap information.

[0187] In one embodiment, determining the retry path based on the historical bitmap union, the target bitmap information, and the error impact factor mask value includes:

[0188] Generate a historical mask value based on the union of the historical bitmaps and the error impact factor mask value;

[0189] Generate a target mask value based on the target bitmap information and the error impact factor mask value;

[0190] Determine whether the target mask value and the historical mask value are not equal;

[0191] If so, then the target path is determined to be the retry path;

[0192] If not, determine from the device path whether there are other target paths.

[0193] Specifically, the "|" operation is used to perform a bitwise OR operation on the union of the historical bitmap and the hint_mask to generate the corresponding historical mask value (history_bitmap|hint_mask); the target bitmap information and the hint_mask are also bitwise ORed to generate the corresponding target mask value (channel_bitmap|hint_mask). That is, if history_bitmap|hint_mask != channel_bitmap|hint_mask (not equal), then the target path is determined to be the retry path for this IO. Because they are not equal, it means that if this IO is retransmitted through this retransmission path that has never been used to transmit the IO, the backend storage device will not return the same error code as before. In other words, retransmitting the IO through this retransmission path increases the probability that the backend storage device will not return an error code, and even if a new error code is returned, it will be different from the previously returned error code. If they are equal, then it continues to determine whether there is a new target path from the device paths. If not, a retry path is randomly determined through a round-robin strategy.

[0194] In one embodiment, the present invention also provides a method for managing input / output instructions, applied to a backend storage device, the method comprising:

[0195] Receive input / output commands sent by storage hardware devices;

[0196] In response to successful execution of the input / output instruction, response information is generated based on the input / output instruction and sent to the storage hardware device;

[0197] In response to a failure to execute the input / output instruction, an error code for the input / output instruction is generated and sent to the storage hardware device.

[0198] Specifically, when the backend storage device receives an I / O from the storage system of the storage hardware device, if the backend storage device executes the I / O successfully, it generates a response (response information) corresponding to the I / O and returns the response to the storage hardware device; if the backend storage device fails to execute the I / O successfully due to some of the reasons mentioned above, such as port abnormality or the backend storage device itself not being ready, it generates an error code for the I / O based on these reasons and returns it to the storage hardware device.

[0199] The proposed solution has the following beneficial effects:

[0200] 1) By classifying the wide range of causes of IO instruction errors, when an IO error occurs, the historical error record of the IO is combined with the impact factor of the IO error and the impact factor of the current error based on the round robin path selection algorithm, and the retry path is recalculated, which reduces the possibility of the IO being returned as an error again.

[0201] 2) By mapping error codes to error handling codes and calling error handling functions based on the error handling codes, the efficiency of I / O processing is improved.

[0202] It should be understood that, although Figure 3 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 3 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0203] In one embodiment, such as Figure 5 As shown, an input / output instruction management device is also provided, applied to a storage hardware device, the device comprising:

[0204] The sending module 501 is used to send the input / output instruction to the back-end storage device in response to receiving the input / output instruction from the host, and to return the response information of the back-end storage device to the host;

[0205] Mapping module 502 is used to map the error code into an error handling code and record the error handling code in the history table corresponding to the input / output instruction in response to receiving the error code of the input / output instruction returned by the back-end storage device;

[0206] Processing module 503 is configured to, in response to receiving the error handling code, perform error handling on the input / output instruction according to the error handling code;

[0207] The acquisition module 504 is used to acquire the historical record table and the device path corresponding to the backend storage device in response to the completion of error handling;

[0208] The determination module 505 is used to determine the retry path corresponding to the input / output instruction based on the historical record table and the device path, and to resend the input / output instruction to the backend storage device according to the retry path.

[0209] In one embodiment, the processing module performs error processing on the input / output instructions according to the error handling code, including:

[0210] Call the error handling function corresponding to the error handling code;

[0211] The error handling function executes an error handling strategy, which includes one or more of the following: retry, delayed retry, port reinitialization, error port reset, and device reset.

[0212] In one embodiment, the sending module includes the following steps before receiving input / output instructions from the host:

[0213] In response to receiving login information reported by the device port of the backend storage device, determine the device path corresponding to the device port;

[0214] The bitmap information of the device path is generated based on the protocol link type information, local port location information, and backend device port information corresponding to the login information.

[0215] In one embodiment, the determining module determines the retry path corresponding to the input / output command based on the historical record table and the device path, including:

[0216] Create an impact factor mask table and determine the error impact factor mask value based on the impact factor mask table and the error handling code;

[0217] Traverse the device paths and determine whether a target path exists in the device paths;

[0218] If not, the retry path is determined from the device paths according to the polling strategy;

[0219] If so, the retry path is determined based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value.

[0220] In one embodiment, the determining module determines the retry path based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value, including:

[0221] Traverse the history record table and determine whether multiple history paths exist in the history record table;

[0222] If so, then generate a historical bitmap union based on the historical bitmap information of the multiple historical paths.

[0223] The retry path is determined based on the historical bitmap union, the target bitmap information, and the error impact factor mask value;

[0224] If not, the retry path is determined based on the historical bitmap information of a historical path, the target bitmap information, and the error impact factor mask value.

[0225] In one embodiment, the determining module determines the retry path based on the historical bitmap union, the target bitmap information, and the error impact factor mask value, including:

[0226] Generate a historical mask value based on the union of the historical bitmaps and the error impact factor mask value;

[0227] Generate a target mask value based on the target bitmap information and the error impact factor mask value;

[0228] Determine whether the target mask value and the historical mask value are not equal;

[0229] If so, then the target path is determined to be the retry path;

[0230] If not, determine from the device path whether there are other target paths.

[0231] In one embodiment, an input / output instruction management device is also provided, applied to a back-end storage device, the device comprising:

[0232] The receiving module is used to receive input / output commands sent by the storage hardware device;

[0233] The first generation module is configured to, in response to the successful execution of the input / output instruction, generate response information based on the input / output instruction and send the response information to the storage hardware device;

[0234] The second generation module is configured to generate an error code for the input / output instruction and send the error code to the storage hardware device in response to the failure to execute the input / output instruction.

[0235] Specific limitations regarding the input / output instruction management device can be found in the above description of the input / output instruction management method, and will not be repeated here. Each module in the aforementioned input / output instruction management device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the computer device's memory, so that the processor can call and execute the operations corresponding to each module.

[0236] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements an alarm information processing method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0237] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0238] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0239] In response to receiving an input / output command from the host, the system sends the input / output command to the backend storage device and returns the response information of the backend storage device to the host.

[0240] In response to receiving an error code from the input / output instruction returned by the backend storage device, the error code is mapped to an error handling code and the error handling code is recorded in the history table corresponding to the input / output instruction;

[0241] In response to receiving the error handling code, the input / output instruction is processed for errors according to the error handling code;

[0242] In response to the completion of error handling, obtain the historical record table and the device path corresponding to the backend storage device;

[0243] Based on the historical record table and the device path, the retry path corresponding to the input / output command is determined, and the input / output command is resent to the backend storage device according to the retry path.

[0244] In one embodiment, the processor performs the following steps when executing the computer program:

[0245] The step of performing error handling on the input / output instructions according to the error handling code includes:

[0246] Call the error handling function corresponding to the error handling code;

[0247] The error handling function executes an error handling strategy, which includes one or more of the following: retry, delayed retry, port reinitialization, error port reset, and device reset.

[0248] In one embodiment, the processor performs the following steps when executing the computer program:

[0249] The process of receiving input / output commands from the host includes:

[0250] In response to receiving login information reported by the device port of the backend storage device, determine the device path corresponding to the device port;

[0251] The bitmap information of the device path is generated based on the protocol link type information, local port location information, and backend device port information corresponding to the login information.

[0252] In one embodiment, the processor performs the following steps when executing the computer program:

[0253] Determining the retry path corresponding to the input / output command based on the historical record table and the device path includes:

[0254] Create an impact factor mask table and determine the error impact factor mask value based on the impact factor mask table and the error handling code;

[0255] Traverse the device paths and determine whether a target path exists in the device paths;

[0256] If not, the retry path is determined from the device paths according to the polling strategy;

[0257] If so, the retry path is determined based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value.

[0258] In one embodiment, the processor performs the following steps when executing the computer program:

[0259] Determining the retry path based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value includes:

[0260] Traverse the history record table and determine whether multiple history paths exist in the history record table;

[0261] If so, then generate a historical bitmap union based on the historical bitmap information of the multiple historical paths.

[0262] The retry path is determined based on the historical bitmap union, the target bitmap information, and the error impact factor mask value;

[0263] If not, the retry path is determined based on the historical bitmap information of a historical path, the target bitmap information, and the error impact factor mask value.

[0264] In one embodiment, the processor performs the following steps when executing the computer program:

[0265] Determining the retry path based on the historical bitmap union, the target bitmap information, and the error impact factor mask value includes:

[0266] Generate a historical mask value based on the union of the historical bitmaps and the error impact factor mask value;

[0267] Generate a target mask value based on the target bitmap information and the error impact factor mask value;

[0268] Determine whether the target mask value and the historical mask value are not equal;

[0269] If so, then the target path is determined to be the retry path;

[0270] If not, determine from the device path whether there are other target paths.

[0271] In one embodiment, the processor performs the following steps when executing the computer program:

[0272] Receive input / output commands sent by storage hardware devices;

[0273] In response to successful execution of the input / output instruction, response information is generated based on the input / output instruction and sent to the storage hardware device;

[0274] In response to a failure to execute the input / output instruction, an error code for the input / output instruction is generated and sent to the storage hardware device.

[0275] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0276] In response to receiving an input / output command from the host, the system sends the input / output command to the backend storage device and returns the response information of the backend storage device to the host.

[0277] In response to receiving an error code from the input / output instruction returned by the backend storage device, the error code is mapped to an error handling code and the error handling code is recorded in the history table corresponding to the input / output instruction;

[0278] In response to receiving the error handling code, the input / output instruction is processed for errors according to the error handling code;

[0279] In response to the completion of error handling, obtain the historical record table and the device path corresponding to the backend storage device;

[0280] Based on the historical record table and the device path, the retry path corresponding to the input / output command is determined, and the input / output command is resent to the backend storage device according to the retry path.

[0281] In one embodiment, the computer program performs the following steps when executed by a processor:

[0282] The step of performing error handling on the input / output instructions according to the error handling code includes:

[0283] Call the error handling function corresponding to the error handling code;

[0284] The error handling function executes an error handling strategy, which includes one or more of the following: retry, delayed retry, port reinitialization, error port reset, and device reset.

[0285] In one embodiment, the computer program performs the following steps when executed by a processor:

[0286] The process of receiving input / output commands from the host includes:

[0287] In response to receiving login information reported by the device port of the backend storage device, determine the device path corresponding to the device port;

[0288] The bitmap information of the device path is generated based on the protocol link type information, local port location information, and backend device port information corresponding to the login information.

[0289] In one embodiment, the computer program performs the following steps when executed by a processor:

[0290] Determining the retry path corresponding to the input / output command based on the historical record table and the device path includes:

[0291] Create an impact factor mask table and determine the error impact factor mask value based on the impact factor mask table and the error handling code;

[0292] Traverse the device paths and determine whether a target path exists in the device paths;

[0293] If not, the retry path is determined from the device paths according to the polling strategy;

[0294] If so, the retry path is determined based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value.

[0295] In one embodiment, the computer program performs the following steps when executed by a processor:

[0296] Determining the retry path based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value includes:

[0297] Traverse the history record table and determine whether multiple history paths exist in the history record table;

[0298] If so, then generate a historical bitmap union based on the historical bitmap information of the multiple historical paths.

[0299] The retry path is determined based on the historical bitmap union, the target bitmap information, and the error impact factor mask value;

[0300] If not, the retry path is determined based on the historical bitmap information of a historical path, the target bitmap information, and the error impact factor mask value.

[0301] In one embodiment, the computer program performs the following steps when executed by a processor:

[0302] Determining the retry path based on the historical bitmap union, the target bitmap information, and the error impact factor mask value includes:

[0303] Generate a historical mask value based on the union of the historical bitmaps and the error impact factor mask value;

[0304] Generate a target mask value based on the target bitmap information and the error impact factor mask value;

[0305] Determine whether the target mask value and the historical mask value are not equal;

[0306] If so, then the target path is determined to be the retry path;

[0307] If not, determine from the device path whether there are other target paths.

[0308] In one embodiment, the computer program performs the following steps when executed by a processor:

[0309] Receive input / output commands sent by storage hardware devices;

[0310] In response to successful execution of the input / output instruction, response information is generated based on the input / output instruction and sent to the storage hardware device;

[0311] In response to a failure to execute the input / output instruction, an error code for the input / output instruction is generated and sent to the storage hardware device.

[0312] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0313] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0314] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for managing input / output instructions, applied to a storage hardware device, the method comprising: In response to receiving an input / output command from the host, the system sends the input / output command to the backend storage device and returns the response information of the backend storage device to the host. In response to receiving an error code from the input / output instruction returned by the backend storage device, the error code is mapped to an error handling code and the error handling code is recorded in the history table corresponding to the input / output instruction; In response to receiving the error handling code, the input / output instruction is processed for errors according to the error handling code; In response to the completion of error handling, obtain the historical record table and the device path corresponding to the backend storage device; Based on the historical record table and the device path, determine the retry path corresponding to the input / output command and resend the input / output command to the backend storage device according to the retry path; The step of determining the retry path corresponding to the input / output command based on the historical record table and the device path includes: Create an impact factor mask table and determine the error impact factor mask value based on the impact factor mask table and the error handling code; Traverse the device paths and determine whether a target path exists in the device paths; If not, the retry path is determined from the device paths according to the polling strategy; If so, the retry path is determined based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value; Determining the retry path based on the target bitmap information of the target path, the historical record table, and the error impact factor mask value includes: Traverse the history record table and determine whether multiple history paths exist in the history record table; If so, then a historical bitmap union is generated based on the historical bitmap information of the multiple historical paths. The retry path is determined based on the historical bitmap union, the target bitmap information, and the error impact factor mask value; If not, the retry path is determined based on the historical bitmap information of a historical path, the target bitmap information, and the error impact factor mask value.

2. The method according to claim 1, characterized in that, The step of performing error handling on the input / output instructions according to the error handling code includes: Call the error handling function corresponding to the error handling code; The error handling function executes an error handling strategy, which includes one or more of the following: retry, delayed retry, port reinitialization, error port reset, and device reset.

3. The method according to claim 1, characterized in that, The process of receiving input / output commands from the host includes: In response to receiving login information reported by the device port of the backend storage device, determine the device path corresponding to the device port; The bitmap information of the device path is generated based on the protocol link type information, local port location information, and backend device port information corresponding to the login information.

4. The method according to claim 1, characterized in that, Determining the retry path based on the historical bitmap union, the target bitmap information, and the error impact factor mask value includes: Generate a historical mask value based on the union of the historical bitmaps and the error impact factor mask value; Generate a target mask value based on the target bitmap information and the error impact factor mask value; Determine whether the target mask value and the historical mask value are not equal; If so, then the target path is determined to be the retry path; If not, determine from the device path whether there are other target paths.

5. The method according to any one of claims 1-4, applied to a back-end storage device, the method comprising: Receive input / output commands sent by storage hardware devices; In response to successful execution of the input / output instruction, response information is generated based on the input / output instruction and sent to the storage hardware device; In response to a failure to execute the input / output instruction, an error code for the input / output instruction is generated and sent to the storage hardware device.

6. A management device for implementing input / output instructions of the method of claim 1, applied to a storage hardware device, the device comprising: The sending module is used to respond to the input / output command received from the host, send the input / output command to the back-end storage device, and return the response information of the back-end storage device to the host; The mapping module is used to map the error code into an error handling code and record the error handling code in the history table corresponding to the input / output instruction in response to receiving the error code of the input / output instruction returned by the back-end storage device; The processing module is configured to, in response to receiving the error handling code, perform error handling on the input / output instruction according to the error handling code; The acquisition module is used to acquire the historical record table and the device path corresponding to the backend storage device in response to the completion of error handling; The determination module is used to determine the retry path corresponding to the input / output command based on the historical record table and the device path, and to resend the input / output command to the backend storage device according to the retry path.

7. An electronic device, characterized in that, include: One or more processors; And a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the method as described in any one of claims 1 to 5.

8. A computer storage medium, characterized in that, It stores a computer program, which, when executed by a processor, implements the method as described in any one of claims 1 to 5.