Hard disk error processing method and device, computer equipment and storage medium
By converting the information code returned by the hard disk into the target information code and executing the corresponding error handling function, the complexity and inefficiency of the error handling process in the storage system are solved, and efficient classification and processing of thousands of hard disk error codes is achieved.
Patent Information
- Application Number
- CN202411391562.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2024-12-17
AI Technical Summary
When existing storage systems handle thousands of error return codes specified in the SCSI protocol, the error handling process is complex and inefficient, making it difficult to understand and maintain.
By converting the information code returned by the hard disk into the target information code, and based on the mapping relationship of the information code and the status limit identification, an error information code is constructed, and corresponding error handling functions are obtained and executed to achieve efficient processing of hard disk errors.
It simplifies the hard disk error processing logic, improves processing efficiency, and realizes the classification and processing of thousands of hard disk error codes.
Smart Images

Figure CN119149286A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of storage devices, and in particular to a hard disk error processing method, device, computer equipment and storage medium. Background Art
[0002] The ERP (Error Return Process) error handling module is one of the most important modules in the storage system. It refers to the way the storage system handles the IO (Input / Output) after the storage system sends it to the back-end storage device and the IO is returned to the storage system with an error. SAS (Serial Attached SCSI) hard disks use the SCSI protocol, which specifies thousands of error return codes to indicate the cause of the error IO returned on the disk. As the Initiator end (IO command initiator) of the SCSI protocol, the storage system receives the IO return, parses the error code, and executes the corresponding ERP process.
[0003] Since the standard SCSI protocol has hundreds of error codes, the corresponding ERP process on the storage system is complicated, difficult to understand and maintain, and has low execution efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a hard disk error processing method, device, computer equipment and storage medium that can improve processing efficiency in response to the above technical problems.
[0005] In a first aspect, a hard disk error processing method is provided, the method comprising:
[0006] In response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request;
[0007] Determine the target state definition identifier corresponding to the first information code based on the mapping relationship between the information code and the state definition identifier;
[0008] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code, wherein the second information code is used to describe error information of the processing result;
[0009] Obtain an error processing function corresponding to the second information code, and execute the error processing function to process the hard disk error.
[0010] Optionally, in response to receiving the return information of the hard disk in response to the input / output request, before converting the return information into the first information code based on the target storage interface protocol, the method further includes:
[0011] Based on the storage system, the input and output requests issued by the host are sent to the hard disk;
[0012] In response to detecting that the hard disk has completed processing the input / output request, the processing status corresponding to the input / output request is defined as the return information and returned.
[0013] Optionally, in response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol includes:
[0014] In response to detecting that the hard disk has completed processing the input / output request, receiving return information of the hard disk in response to the input / output request;
[0015] In response to receiving the return information of the hard disk in response to the input / output request, the return information is converted into a first information code based on the small computer system interface protocol, and the first information code is used to describe the processing result corresponding to the input / output request, and the response result at least includes a processing status of normal and a processing status of abnormal.
[0016] Optionally, based on the mapping relationship between the information code and the state definition identifier, determining the target state definition identifier corresponding to the first information code includes:
[0017] Acquire a target mapping table, wherein the target mapping table includes at least a mapping relationship between an information code and a state limiting identifier;
[0018] Compare the first information code with the target information code in the target mapping table;
[0019] In response to detecting that the first information code is successfully compared with the target information code, a state definition identifier corresponding to the target information code is defined as a target state definition identifier corresponding to the first information code.
[0020] Optionally, the method for detecting the target state limiting identifier includes:
[0021] Acquire the target state definition identifier and the preset state definition identifier;
[0022] Comparing the target state definition identifier with the preset state definition identifier to obtain a comparison result;
[0023] In response to detecting that the comparison result is a failure, determining that the target state limit identifier does not meet a preset standard;
[0024] In response to detecting that the comparison result is successful, determining that the target state limit identifier meets a preset standard;
[0025] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code includes:
[0026] Acquire a third information code, where the third information code at least includes an error category and an error cause;
[0027] In response to receiving the third information code, acquiring the first information code;
[0028] In response to receiving the first information code, the second information code is constructed based on the first information code and the third information code.
[0029] Optionally, before obtaining the error handling function corresponding to the second information code and executing the error handling function to handle the hard disk error, the method further includes:
[0030] Based on the first information code, define an enumeration of target identifiers;
[0031] Constructing a first array, and based on the enumeration of the target identifiers, saving the mapping relationship between the target identifiers and the corresponding error handling functions into the first array;
[0032] A second array is constructed, and a mapping relationship between the target identifier and the corresponding second information code is saved in the second array. Meanwhile, a target identifier corresponding to the target error handling function is added at a preset row position of the second array.
[0033] Optionally, obtaining an error processing function corresponding to the second information code, and executing the error processing function to process the hard disk error includes:
[0034] Based on the second array, determining a target identifier corresponding to the second information code;
[0035] Based on the first array, determining an error handling function corresponding to the target identifier;
[0036] The error handling function is executed to handle hard disk errors.
[0037] In a second aspect, a hard disk error processing device is provided, the device comprising:
[0038] an information conversion module, configured to, upon receiving the return information of the hard disk in response to the input / output request, convert the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request;
[0039] A state-limiting identifier determining module, configured to determine a target state-limiting identifier corresponding to the first information code based on a mapping relationship between the information code and the state-limiting identifier;
[0040] A second information code generating module, configured to construct a second information code corresponding to the first information code when it is detected that the target state limiting identifier meets a preset standard, wherein the second information code is used to describe error information of the processing result;
[0041] The hard disk error processing module is used to obtain the error processing function corresponding to the second information code and execute the error processing function to process the hard disk error.
[0042] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0043] In response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request;
[0044] Determine the target state definition identifier corresponding to the first information code based on the mapping relationship between the information code and the state definition identifier;
[0045] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code, wherein the second information code is used to describe error information of the processing result;
[0046] Obtain an error processing function corresponding to the second information code, and execute the error processing function to process the hard disk error.
[0047] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0048] In response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request;
[0049] Determine the target state definition identifier corresponding to the first information code based on the mapping relationship between the information code and the state definition identifier;
[0050] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code, wherein the second information code is used to describe error information of the processing result;
[0051] Obtain an error processing function corresponding to the second information code, and execute the error processing function to process the hard disk error.
[0052] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0053] In response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request;
[0054] Determine the target state definition identifier corresponding to the first information code based on the mapping relationship between the information code and the state definition identifier;
[0055] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code, wherein the second information code is used to describe error information of the processing result;
[0056] Obtain an error processing function corresponding to the second information code, and execute the error processing function to process the hard disk error.
[0057] The above-mentioned hard disk error processing method, device, computer equipment and storage medium, the method includes: in response to receiving the return information of the hard disk in response to the input and output request, based on the target storage interface protocol, converting the return information into a first information code, the first information code is used to describe the processing result corresponding to the input and output request; based on the mapping relationship between the information code and the state limit identifier, determining the target state limit identifier corresponding to the first information code; in response to detecting that the target state limit identifier meets the preset standard, constructing a second information code corresponding to the first information code, the second information code is used to describe the error information of the processing result; obtaining the error handling function corresponding to the second information code, and executing the error handling function to handle the hard disk error. The present application realizes the general logic of classifying and handling thousands of hard disk error codes by analyzing the command error return code specified by the SCSI protocol. The processing method has clear logic and improves the processing efficiency of hard disk errors. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 A diagram of an application environment of a hard disk error handling method in an embodiment;
[0059] Figure 2 A flowchart of a hard disk error handling method in one embodiment;
[0060] Figure 3 A schematic diagram of the overall structure of a hard disk error processing method in one embodiment;
[0061] Figure 4 A schematic diagram of an error code combination of a hard disk error processing method in one embodiment;
[0062] Figure 5 is another flowchart of a hard disk error processing method in one embodiment;
[0063] Figure 6 is a structural block diagram of a hard disk error processing device in one embodiment;
[0064] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0066] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like throughout the specification should be interpreted as including rather than being exclusive or exhaustive; that is, as including but not limited to.
[0067] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.
[0068] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.
[0069] The hard disk error handling method provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the data processing platform set on the server 104 through the network, wherein the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0070] In one embodiment, Figure 2 As shown, a hard disk error processing method is provided, which is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0071] S1: In response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request.
[0072] It should be noted that input and output requests refer to IO requests; for example Figure 3 As shown, the IO request is sent from the host to the storage system, the storage system sends the IO request to the back-end storage device, and returns the processing information of the IO request to the host; the back-end storage device here refers to the hard disk connected to the back end of the storage system, and the storage system includes a hard disk ERP error processing module, which means that the storage system sends the IO request to the hard disk connected to the back end, and the hard disk processes the IO and returns an error code (i.e., the second information code), which is carried by the IO and returned to the storage system, and the storage system processes the returned error IO; the target storage interface protocol refers to the SCSI (Small Computer System Interface) protocol, which is an interface standard for connecting computers and their peripheral IO devices (such as disks, optical drives, etc.), and the largest part of the current application is on storage devices. The SCSI protocol defines a unified information interaction model and necessary command sets for data communication between computers and different devices; the SCSI protocol defines the necessary command sets for implementing the device, such as the SBC command set for implementing block devices (such as hard disks) and the SSC command set for implementing stream devices (such as tapes); the SAS protocol is a point-to-point serial SCSI technology that uses a standard SCSI instruction set and return code.
[0073] In some specific implementations, in response to receiving the return information of the hard disk in response to the input / output request, before converting the return information into the first information code based on the target storage interface protocol, the method further includes:
[0074] Based on the storage system, the input and output requests issued by the host are sent to the hard disk;
[0075] In response to detecting that the hard disk has completed processing the input / output request, the processing status corresponding to the input / output request is defined as the return information and returned, wherein the processing status corresponding to the input / output request includes processing completion and exception.
[0076] In some specific implementations, in response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol includes:
[0077] In response to detecting that the hard disk has completed processing the input / output request, receiving return information of the hard disk in response to the input / output request;
[0078] In response to receiving the return information of the hard disk in response to the input / output request, the return information is converted into a first information code based on the small computer system interface protocol, and the first information code is used to describe the processing result corresponding to the input / output request, and the response result at least includes a processing status of normal and a processing status of abnormal.
[0079] Specifically, when the target end (hard disk) completes the request (IO) processing, it will return a status response to the Initiator (storage system) to indicate the completion status of the request, including completion or exception; the SCSI protocol stipulates the use of a specific status code (Status code) and status qualifier (Status qualifier) to inform the Initiator of the processing result of the request, where the status code here is the above-mentioned first information code, and the status code specified by the SCSI protocol is shown in Table 1.
[0080] Table 1: Status codes specified by the SCSI protocol.
[0081]
[0082] In the above implementation, the return information is converted into the first information code through the SCSI protocol to facilitate the subsequent acquisition of the corresponding error handling function, enhance readability, and further improve the hard disk error handling efficiency of the storage system.
[0083] S2: Based on the mapping relationship between the information code and the state definition identifier, determine the target state definition identifier corresponding to the first information code.
[0084] It should be noted that the mapping relationship between the information code and the status qualifier is specified by the SCSI protocol, and the status qualifier refers to the status qualifier.
[0085] In some specific implementations, based on the mapping relationship between the information code and the state definition identifier, determining the target state definition identifier corresponding to the first information code includes:
[0086] Acquire a target mapping table, wherein the target mapping table includes at least a mapping relationship between an information code and a state limiting identifier;
[0087] Compare the first information code with the target information code in the target mapping table;
[0088] In response to detecting that the first information code is successfully compared with the target information code, a state definition identifier corresponding to the target information code is defined as a target state definition identifier corresponding to the first information code.
[0089] In the above implementation, the state limiting identifier corresponding to the first information code is determined based on the first information code, so as to be used for subsequently quickly determining the second information code corresponding to the first information code, thereby further improving the hard disk error processing efficiency of the storage system.
[0090] S3: In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code, wherein the second information code is used to describe error information of the processing result.
[0091] It should be noted that the second information code is the skcq code, which is composed of the sense data (third information code) and the first information code. The third information code at least includes the error category and the error cause to describe the error information of the request processing, such as sensekey, asc (additional sense code) and ascq (additional sense code qualifier). Among them, the sense key describes the category of the main error information, and asc and ascq further explain the specific error cause based on the sense key. There are many error code combinations of asc and ascq. For details, please refer to "SCSI Primary Commands" (SPC) Table 55 ASC and ASCQ assignments, such as Figure 4 As shown, the sense key specified by the SCSI protocol is shown in Table 2.
[0092] Table 2: Sense keys specified by the SCSI protocol.
[0093]
[0094]
[0095] In some specific implementations, the method for detecting the target state limiting identifier includes:
[0096] Obtain the target status qualification identifier and the preset status qualification identifier, wherein the preset status qualification identifier can be set according to actual needs. Since status code=02h is the case where most errors are returned, the preset status qualification identifier of the present application is preferably the status qualification identifier corresponding to status code=02h;
[0097] Comparing the target state definition identifier with the preset state definition identifier to obtain a comparison result;
[0098] In response to detecting that the comparison result is a failure, determining that the target state limit identifier does not meet a preset standard;
[0099] In response to detecting that the comparison result is successful, determining that the target state limit identifier meets a preset standard;
[0100] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code includes:
[0101] Acquire a third information code, where the third information code at least includes an error category and an error cause;
[0102] In response to receiving the third information code, acquiring the first information code;
[0103] In response to receiving the first information code, the second information code is constructed based on the first information code and the third information code.
[0104] Specifically, when the request is terminated with the CHECK_CONDITION (02h) status, the target (hard disk) returns SenseData to inform the initiator (storage system) of the reason for the termination of the request. The storage system determines how to further process according to the Sense data. The second information code constructed is an 8-bit hexadecimal skcq code, where s is the status code, k is the sensekey, c is asc, and q is ascq. For example, skcq = 0x02052400, status code = 0x02: CHECKCONDITION, sense key = 0x05: ILLEGAL REQUEST, asc ascq = 0x2400: INVALID FIELD INCDB (reference Figure 4 content shown).
[0105] In the above implementation, based on the first information code and the third information code, a second information code for determining an error handling function is constructed to quickly lock the corresponding error handling function, further improving the hard disk error handling efficiency of the storage system.
[0106] S4: Obtain an error processing function corresponding to the second information code, and execute the error processing function to process the hard disk error.
[0107] It should be noted that the error handling function is a function generated according to the error handling strategy. The error handling strategy may include retry, delayed retry, reinitialization of port, reset error port, reset hard disk, port isolation, hard disk isolation, etc. The error handling function may include erp_busy_function, erp_medium_function, erp_hardware_function, erp_invalid_field_function, erp_queue_full_function, erp_reset_vlun_function, etc.
[0108] In some specific implementations, before obtaining the error handling function corresponding to the second information code and executing the error handling function to handle the hard disk error, the method further includes:
[0109] Based on the first information code, an enumeration of a target identifier is defined, wherein the target identifier refers to ERP_NUM. A set of ERP_NUM enumerations is defined inside the storage system, and each ERP_NUM corresponds to a specific error handling function, specifically:
[0110] typedef enum {
[0111] ERP_NUM_BUSY=0,
[0112] ERP_NUM_MEDIUM=1,
[0113] ERP_NUM_HARDWARE_ERROR=3,
[0114] ERP_NUM_INVALID_FIELD=4,
[0115] ERP_NUM_QUEUE_FULL=5,
[0116] ERP_NUM_RESET_VLUN=6,
[0117] …
[0118] }erp_number_t;
[0119] Construct a first array, and based on the enumeration of the target identifier, save the mapping relationship between the target identifier and the corresponding error handling function to the first array, wherein the first array is used to save the mapping relationship between ERP_NUM and the specific error handling function, and the construction method thereof is:
[0120] (1) Define the data structure struct that maps ERP_NUM and erp_function:
[0121] typedef struct erp_num_struct
[0122] {
[0123] long erp_no;
[0124] bool erp_function;
[0125] …
[0126] }erp_num_entry_s;
[0127] (2) Define a mapping relationship array. The type of the elements in the array is the data structure defined in (1):
[0128] erp_num_entry_s erp_num_details_array[]=
[0129] {
[0130] {ERP_NUM_BUSY, erp_busy_function},
[0131] {ERP_NUM_MEDIUM, erp_medium_function},
[0132] {ERP_NUM_HARDWARE_ERROR, erp_hardware_function},
[0133] {ERP_NUM_INVALID_FIELD, erp_invalid_field_function},
[0134] {ERP_NUM_QUEUE_FULL, erp_queue_full_function},
[0135] {ERP_NUM_RESET_VLUN, erp_reset_vlun_function},
[0136] }
[0137] Exemplarily, when ERP_NUM is ERP_NUM_RESET_VLUN, the mapped error handling function is erp_reset_vlun_function;
[0138] Construct a second array, save the mapping relationship between the target identifier and the corresponding second information code to the second array, and at the same time, add the target identifier corresponding to the target error handling function to the preset row position of the second array, wherein the second array is a static array, which is used to save the mapping relationship between skcq and ERP_NUM. The array sets a specific mapping relationship between the specific skcq returned on the disk and the defined erp_num. The preset row position can be set according to actual needs, generally the last row position, specifically:
[0139] (1) Define the data structure struct that maps skcq and ERP_NUM:
[0140] typedef struct erp_tab_struct
[0141] {
[0142] long skcq_pattern;
[0143] long erp_no;
[0144] …
[0145] }erp_tab_entry_s;
[0146] (2) Define a mapping relationship array. The type of the elements in the array is the data structure defined in (1):
[0147] static erp_tab_entry_s erp_code_number_map_table[]=
[0148] {
[0149] {0x08ffffff,ERP_NUM_BUSY},
[0150] {0x0203ffff,ERP_NUM_MEDIUM},
[0151] {0x02000000, ERP_NUM_HARDWARE_ERROR},
[0152] {0x02052000, ERP_NUM_INVALID_FIELD},
[0153] {0x02052400,ERP_NUM_INVALID_FIELD},
[0154] {0x28ffffffff,ERP_NUM_QUEUE_FULL},
[0155] …
[0156] {0xffffffff,ERP_NUM_RESET_VLUN},
[0157] }
[0158] Among them, 0xff acts as a wildcard to ignore the value of the corresponding bit in skcq. For example, {0x08ffffff, ERP_NUM_BUSY} means that as long as status code = 0x08, no matter what value kcq is equal to, it is mapped to ERP_NUM_BUSY. The last line 0xffffffff is used for error handling. When a certain skcq returned is not hit after the previous search, the error handling corresponding to ERP_NUM_RESET_VLUN is performed on it.
[0159] In some specific implementations, obtaining the error handling function corresponding to the second information code and executing the error handling function to handle the hard disk error includes:
[0160] Based on the second array, determining a target identifier corresponding to the second information code;
[0161] Based on the first array, determining an error handling function corresponding to the target identifier;
[0162] The error handling function is executed to handle hard disk errors.
[0163] Among them, each hard disk that can be used in the storage system is bound to its own erp_code_number_map_table during the initialization phase. If the hard disk manufacturer does not implement the SCSI protocol privately, its hard disk can use the default map_table; otherwise, it is necessary to define a customized map_table for the manufacturer.
[0164] Specifically, Figure 5As shown in the figure, the overall process is: the storage system parses and returns the status code; if statuscode! = 0, the error handling process is entered; the storage system searches for the corresponding erp_code_number_map_table according to the hard disk identification number; the storage system parses skcq and searches for the mapped ERP_NUM; the storage system searches for the mapped erp_function according to ERP_NUM; and the erp_function is executed to perform the corresponding error handling.
[0165] In the above implementation, by classifying skcq, mapping a separate ERP_NUM to each type of skcq, and then mapping the error handling function through ERP_NUM, a general logic for classifying and handling errors of thousands of hard disk error codes is implemented. This processing method has clear logic and high processing efficiency.
[0166] In some embodiments, the method further comprises:
[0167] According to the data stored in the history database, the number of hard disk errors corresponding to the target input and output requests within a preset time period is obtained, wherein the preset time period may be an operation cycle of the storage system, which may be set according to actual needs, such as one month, etc.;
[0168] In response to detecting that the number of hard disk errors is greater than or equal to a first preset threshold, obtaining hard disk error processing methods and the number of times each hard disk error processing method is used, wherein the first preset threshold can be set according to actual needs, such as 10 times;
[0169] In response to detecting that the number of uses is greater than or equal to the second preset threshold and the number of target hard disk error processing methods accounts for greater than or equal to the third preset threshold, a one-to-one mapping relationship is generated and saved for the target input / output request, the hard disk error processing method, and the corresponding time period, wherein the second preset threshold and the third preset threshold can be set according to actual needs, such as the second preset threshold is 8, the third preset threshold is 80%, etc. The number of target hard disk error processing methods accounts for refers to the ratio of the number of uses of the target hard disk error processing method to all hard disk error processing methods corresponding to the target input / output request within the preset time period, such as, if the hard disk error occurs 10 times, there are 10 processing methods (which may be the same), and the number of occurrences of the target hard disk error processing method is 8, then the proportion is 80%;
[0170] In response to detecting a hard disk error corresponding to a target input / output request again in the next operation cycle, the hard disk error is processed based on an error processing function corresponding to the target hard disk error processing method, wherein the time period of the operation cycle corresponds one-to-one to the preset time period.
[0171] In the above implementation, a mapping relationship between the target input and output request, the hard disk error handling method and the corresponding time period can be constructed so that when hard disk error information is detected within this time period, the error handling function corresponding to the hard disk error handling method is directly executed, thereby further improving the hard disk error handling efficiency.
[0172] In the above-mentioned hard disk error processing method, the method includes: in response to receiving the return information of the hard disk in response to the input and output request, based on the target storage interface protocol, converting the return information into a first information code, the first information code is used to describe the processing result corresponding to the input and output request; based on the mapping relationship between the information code and the state qualification identifier, determining the target state qualification identifier corresponding to the first information code; in response to detecting that the target state qualification identifier meets the preset standard, constructing a second information code corresponding to the first information code, the second information code is used to describe the error information of the processing result; obtaining the error handling function corresponding to the second information code, and executing the error handling function to handle the hard disk error. The present application analyzes the command error return code specified by the protocol, first classifies the skcq, maps a separate ERP_NUM to each type of skcq, and then maps the error handling function through ERP_NUM to realize the general logic of classifying and handling tens of thousands of hard disk error codes. The processing method has clear logic and improves the processing efficiency of hard disk errors.
[0173] It should be understood that although Figure 2 , Figure 3 and Figure 5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , Figure 3 and Figure 5 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0174] In one embodiment, Figure 6 As shown, a hard disk error processing device is provided, comprising: an information conversion module, a state limit identification determination module, a second information code generation module and a hard disk error processing module, wherein:
[0175] an information conversion module, configured to, upon receiving the return information of the hard disk in response to the input / output request, convert the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request;
[0176] A state-limiting identifier determining module, configured to determine a target state-limiting identifier corresponding to the first information code based on a mapping relationship between the information code and the state-limiting identifier;
[0177] A second information code generating module, configured to construct a second information code corresponding to the first information code when it is detected that the target state limiting identifier meets a preset standard, wherein the second information code is used to describe error information of the processing result;
[0178] The hard disk error processing module is used to obtain the error processing function corresponding to the second information code and execute the error processing function to process the hard disk error.
[0179] As a preferred implementation, in the embodiment of the present invention, the device further includes a request processing module, and the request processing module is specifically used to:
[0180] Based on the storage system, the input and output requests issued by the host are sent to the hard disk;
[0181] In response to detecting that the hard disk has completed processing the input / output request, the processing status corresponding to the input / output request is defined as the return information and returned.
[0182] As a preferred implementation, in the embodiment of the present invention, the information conversion module is specifically used for:
[0183] In response to detecting that the hard disk has completed processing the input / output request, receiving return information of the hard disk in response to the input / output request;
[0184] In response to receiving the return information of the hard disk in response to the input / output request, the return information is converted into a first information code based on the small computer system interface protocol, and the first information code is used to describe the processing result corresponding to the input / output request, and the response result at least includes a processing status of normal and a processing status of abnormal.
[0185] As a preferred implementation, in the embodiment of the present invention, the state limit identification determination module is specifically used for:
[0186] Acquire a target mapping table, wherein the target mapping table includes at least a mapping relationship between an information code and a state limiting identifier;
[0187] Compare the first information code with the target information code in the target mapping table;
[0188] In response to detecting that the first information code is successfully compared with the target information code, a state definition identifier corresponding to the target information code is defined as a target state definition identifier corresponding to the first information code.
[0189] As a preferred implementation, in the embodiment of the present invention, the second information code generating module is specifically used for:
[0190] Acquire the target state definition identifier and the preset state definition identifier;
[0191] Comparing the target state definition identifier with the preset state definition identifier to obtain a comparison result;
[0192] In response to detecting that the comparison result is a failure, determining that the target state limit identifier does not meet a preset standard;
[0193] In response to detecting that the comparison result is successful, determining that the target state limit identifier meets a preset standard;
[0194] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code includes:
[0195] Acquire a third information code, where the third information code at least includes an error category and an error cause;
[0196] In response to receiving the third information code, acquiring the first information code;
[0197] In response to receiving the first information code, the second information code is constructed based on the first information code and the third information code.
[0198] As a preferred implementation, in the embodiment of the present invention, the device further includes an array construction module, and the array construction module is specifically used for:
[0199] Based on the first information code, define an enumeration of target identifiers;
[0200] Constructing a first array, and based on the enumeration of the target identifiers, saving the mapping relationship between the target identifiers and the corresponding error handling functions into the first array;
[0201] A second array is constructed, and a mapping relationship between the target identifier and the corresponding second information code is saved in the second array. Meanwhile, a target identifier corresponding to the target error handling function is added at a preset row position of the second array.
[0202] As a preferred implementation, in the embodiment of the present invention, the hard disk error processing module is specifically used for:
[0203] Based on the second array, determining a target identifier corresponding to the second information code;
[0204] Based on the first array, determining an error handling function corresponding to the target identifier;
[0205] The error handling function is executed to handle hard disk errors.
[0206] The specific definition of the hard disk error handling device can be found in the definition of the hard disk error handling method above, which will not be repeated here. Each module in the above hard disk error handling device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0207] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a hard disk error handling method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0208] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0209] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0210] S1: in response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request;
[0211] S2: determining a target state definition identifier corresponding to the first information code based on a mapping relationship between the information code and the state definition identifier;
[0212] S3: in response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code, wherein the second information code is used to describe error information of the processing result;
[0213] S4: Obtain an error processing function corresponding to the second information code, and execute the error processing function to process the hard disk error.
[0214] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0215] Based on the storage system, the input and output requests issued by the host are sent to the hard disk;
[0216] In response to detecting that the hard disk has completed processing the input / output request, the processing status corresponding to the input / output request is defined as the return information and returned.
[0217] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0218] In response to detecting that the hard disk has completed processing the input / output request, receiving return information of the hard disk in response to the input / output request;
[0219] In response to receiving the return information of the hard disk in response to the input / output request, the return information is converted into a first information code based on the small computer system interface protocol, and the first information code is used to describe the processing result corresponding to the input / output request, and the response result at least includes a processing status of normal and a processing status of abnormal.
[0220] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0221] Acquire a target mapping table, wherein the target mapping table includes at least a mapping relationship between an information code and a state limiting identifier;
[0222] Compare the first information code with the target information code in the target mapping table;
[0223] In response to detecting that the first information code is successfully compared with the target information code, a state definition identifier corresponding to the target information code is defined as a target state definition identifier corresponding to the first information code.
[0224] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0225] Acquire the target state definition identifier and the preset state definition identifier;
[0226] Comparing the target state definition identifier with the preset state definition identifier to obtain a comparison result;
[0227] In response to detecting that the comparison result is a failure, determining that the target state limit identifier does not meet a preset standard;
[0228] In response to detecting that the comparison result is successful, determining that the target state limit identifier meets a preset standard;
[0229] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code includes:
[0230] Acquire a third information code, where the third information code at least includes an error category and an error cause;
[0231] In response to receiving the third information code, acquiring the first information code;
[0232] In response to receiving the first information code, the second information code is constructed based on the first information code and the third information code.
[0233] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0234] Based on the first information code, define an enumeration of target identifiers;
[0235] Constructing a first array, and based on the enumeration of the target identifiers, saving the mapping relationship between the target identifiers and the corresponding error handling functions into the first array;
[0236] A second array is constructed, and a mapping relationship between the target identifier and the corresponding second information code is saved in the second array. Meanwhile, a target identifier corresponding to the target error handling function is added at a preset row position of the second array.
[0237] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0238] Based on the second array, determining a target identifier corresponding to the second information code;
[0239] Based on the first array, determining an error handling function corresponding to the target identifier;
[0240] The error handling function is executed to handle hard disk errors.
[0241] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0242] S1: in response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request;
[0243] S2: determining a target state definition identifier corresponding to the first information code based on a mapping relationship between the information code and the state definition identifier;
[0244] S3: in response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code, wherein the second information code is used to describe error information of the processing result;
[0245] S4: Obtain an error processing function corresponding to the second information code, and execute the error processing function to process the hard disk error.
[0246] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0247] Based on the storage system, the input and output requests issued by the host are sent to the hard disk;
[0248] In response to detecting that the hard disk has completed processing the input / output request, the processing status corresponding to the input / output request is defined as the return information and returned.
[0249] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0250] In response to detecting that the hard disk has completed processing the input / output request, receiving return information of the hard disk in response to the input / output request;
[0251] In response to receiving the return information of the hard disk in response to the input / output request, the return information is converted into a first information code based on the small computer system interface protocol, and the first information code is used to describe the processing result corresponding to the input / output request, and the response result at least includes a processing status of normal and a processing status of abnormal.
[0252] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0253] Acquire a target mapping table, wherein the target mapping table includes at least a mapping relationship between an information code and a state limiting identifier;
[0254] Compare the first information code with the target information code in the target mapping table;
[0255] In response to detecting that the first information code is successfully compared with the target information code, a state definition identifier corresponding to the target information code is defined as a target state definition identifier corresponding to the first information code.
[0256] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0257] Acquire the target state definition identifier and the preset state definition identifier;
[0258] Comparing the target state definition identifier with the preset state definition identifier to obtain a comparison result;
[0259] In response to detecting that the comparison result is a failure, determining that the target state limit identifier does not meet a preset standard;
[0260] In response to detecting that the comparison result is successful, determining that the target state limit identifier meets a preset standard;
[0261] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code includes:
[0262] Acquire a third information code, where the third information code at least includes an error category and an error cause;
[0263] In response to receiving the third information code, acquiring the first information code;
[0264] In response to receiving the first information code, the second information code is constructed based on the first information code and the third information code.
[0265] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0266] Based on the first information code, define an enumeration of target identifiers;
[0267] Constructing a first array, and based on the enumeration of the target identifiers, saving the mapping relationship between the target identifiers and the corresponding error handling functions into the first array;
[0268] A second array is constructed, and a mapping relationship between the target identifier and the corresponding second information code is saved in the second array. Meanwhile, a target identifier corresponding to the target error handling function is added at a preset row position of the second array.
[0269] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0270] Based on the second array, determining a target identifier corresponding to the second information code;
[0271] Based on the first array, determining an error handling function corresponding to the target identifier;
[0272] The error handling function is executed to handle hard disk errors.
[0273] In one embodiment, a computer program product is provided, the computer program product comprising a computer program, the computer program when executed by a processor implements the following steps:
[0274] S1: in response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request;
[0275] S2: determining a target state definition identifier corresponding to the first information code based on a mapping relationship between the information code and the state definition identifier;
[0276] S3: in response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code, wherein the second information code is used to describe error information of the processing result;
[0277] S4: Obtain an error processing function corresponding to the second information code, and execute the error processing function to process the hard disk error.
[0278] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0279] Based on the storage system, the input and output requests issued by the host are sent to the hard disk;
[0280] In response to detecting that the hard disk has completed processing the input / output request, the processing status corresponding to the input / output request is defined as the return information and returned.
[0281] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0282] In response to detecting that the hard disk has completed processing the input / output request, receiving return information of the hard disk in response to the input / output request;
[0283] In response to receiving the return information of the hard disk in response to the input / output request, the return information is converted into a first information code based on the small computer system interface protocol, and the first information code is used to describe the processing result corresponding to the input / output request, and the response result at least includes a processing status of normal and a processing status of abnormal.
[0284] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0285] Acquire a target mapping table, wherein the target mapping table includes at least a mapping relationship between an information code and a state limiting identifier;
[0286] Compare the first information code with the target information code in the target mapping table;
[0287] In response to detecting that the first information code is successfully compared with the target information code, a state definition identifier corresponding to the target information code is defined as a target state definition identifier corresponding to the first information code.
[0288] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0289] Acquire the target state definition identifier and the preset state definition identifier;
[0290] Comparing the target state definition identifier with the preset state definition identifier to obtain a comparison result;
[0291] In response to detecting that the comparison result is a failure, determining that the target state limit identifier does not meet a preset standard;
[0292] In response to detecting that the comparison result is successful, determining that the target state limit identifier meets a preset standard;
[0293] In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code includes:
[0294] Acquire a third information code, where the third information code at least includes an error category and an error cause;
[0295] In response to receiving the third information code, acquiring the first information code;
[0296] In response to receiving the first information code, the second information code is constructed based on the first information code and the third information code.
[0297] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0298] Based on the first information code, define an enumeration of target identifiers;
[0299] Constructing a first array, and based on the enumeration of the target identifiers, saving the mapping relationship between the target identifiers and the corresponding error handling functions into the first array;
[0300] A second array is constructed, and a mapping relationship between the target identifier and the corresponding second information code is saved in the second array. Meanwhile, a target identifier corresponding to the target error handling function is added at a preset row position of the second array.
[0301] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0302] Based on the second array, determining a target identifier corresponding to the second information code;
[0303] Based on the first array, determining an error handling function corresponding to the target identifier;
[0304] The error handling function is executed to handle hard disk errors.
[0305] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database 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. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0306] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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.
[0307] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A hard disk error processing method, characterized in that: The method comprises: In response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request; Determine the target state definition identifier corresponding to the first information code based on the mapping relationship between the information code and the state definition identifier; In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code, wherein the second information code is used to describe error information of the processing result; Obtain an error processing function corresponding to the second information code, and execute the error processing function to process the hard disk error.
2. The hard disk error handling method according to claim 1, characterized in that: In response to receiving the return information of the hard disk in response to the input / output request, before converting the return information into a first information code based on the target storage interface protocol, the method further includes: Based on the storage system, the input and output requests issued by the host are sent to the hard disk; In response to detecting that the hard disk has completed processing the input / output request, the processing status corresponding to the input / output request is defined as the return information and returned.
3. The hard disk error handling method according to claim 1 or 2, characterized in that: In response to receiving the return information of the hard disk in response to the input / output request, converting the return information into a first information code based on the target storage interface protocol includes: In response to detecting that the hard disk has completed processing the input / output request, receiving return information of the hard disk in response to the input / output request; In response to receiving the return information of the hard disk in response to the input / output request, the return information is converted into a first information code based on the small computer system interface protocol, and the first information code is used to describe the processing result corresponding to the input / output request, and the response result at least includes a processing status of normal and a processing status of abnormal.
4. The hard disk error handling method according to claim 1, characterized in that: Based on the mapping relationship between the information code and the state definition identifier, determining the target state definition identifier corresponding to the first information code includes: Acquire a target mapping table, wherein the target mapping table includes at least a mapping relationship between an information code and a state limiting identifier; Compare the first information code with the target information code in the target mapping table; In response to detecting that the first information code is successfully compared with the target information code, a state definition identifier corresponding to the target information code is defined as a target state definition identifier corresponding to the first information code.
5. The hard disk error handling method according to claim 1, characterized in that: The method for detecting the target state limiting mark includes: Acquire the target state definition identifier and the preset state definition identifier; Comparing the target state definition identifier with the preset state definition identifier to obtain a comparison result; In response to detecting that the comparison result is a failure, determining that the target state limit identifier does not meet a preset standard; In response to detecting that the comparison result is successful, determining that the target state limit identifier meets a preset standard; In response to detecting that the target state limiting identifier meets a preset standard, constructing a second information code corresponding to the first information code includes: Acquire a third information code, where the third information code at least includes an error category and an error cause; In response to receiving the third information code, acquiring the first information code; In response to receiving the first information code, the second information code is constructed based on the first information code and the third information code.
6. The hard disk error handling method according to claim 1, characterized in that: Before obtaining the error handling function corresponding to the second information code and executing the error handling function to handle the hard disk error, the method further includes: Based on the first information code, define an enumeration of target identifiers; Constructing a first array, and based on the enumeration of the target identifiers, saving the mapping relationship between the target identifiers and the corresponding error handling functions into the first array; A second array is constructed, and a mapping relationship between the target identifier and the corresponding second information code is saved in the second array. Meanwhile, a target identifier corresponding to the target error handling function is added at a preset row position of the second array.
7. The hard disk error handling method according to claim 6, characterized in that: Acquiring an error processing function corresponding to the second information code and executing the error processing function to process the hard disk error includes: Based on the second array, determining a target identifier corresponding to the second information code; Based on the first array, determining an error handling function corresponding to the target identifier; The error handling function is executed to handle hard disk errors.
8. A hard disk error processing device, characterized in that: The device comprises: an information conversion module, configured to, upon receiving the return information of the hard disk in response to the input / output request, convert the return information into a first information code based on the target storage interface protocol, wherein the first information code is used to describe the processing result corresponding to the input / output request; A state-limiting identifier determining module, configured to determine a target state-limiting identifier corresponding to the first information code based on a mapping relationship between the information code and the state-limiting identifier; A second information code generating module, configured to construct a second information code corresponding to the first information code when it is detected that the target state limiting identifier meets a preset standard, wherein the second information code is used to describe error information of the processing result; The hard disk error processing module is used to obtain the error processing function corresponding to the second information code and execute the error processing function to process the hard disk error.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and device for saving small computer system interface access error
CN102222033A
Fault-tolerant method and system based on SCSI equipment
CN105975358A
Hard disk error detection method and device, storage medium and electronic device
CN113590405A
Input and output instruction management method and device, electronic equipment and storage medium
CN117170919A
Hard disk fault management method and device, computer equipment and storage medium
CN117806915A
