Data reading processing method, electronic device, and storage medium

By obtaining the execution status and failure reasons of read and write commands, and combining the threshold and historical information of the storage device to determine whether to re-execute, the problem of resource waste in data read operations is solved, and the retry success rate and resource utilization are improved.

CN120743619BActive Publication Date: 2025-12-12INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511232849.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-12-12
Estimated Expiration
2045-08-29

AI Technical Summary

Technical Problem

In existing technologies, when a data read operation fails, the number of retries is fixed and cannot be adapted to different scenarios, resulting in wasted resources.

Method used

By obtaining the execution status of the target read/write command, the number of times the command can be re-executed is determined based on the reason for failure. The re-execution threshold of the target storage device and historical failure information are combined to determine whether to re-execute. If necessary, a delay time is set to re-execute the command.

Benefits of technology

Reduce invalid retries, improve retry success rate, enhance resource utilization, and avoid resource shortages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743619B_ABST
    Figure CN120743619B_ABST
Patent Text Reader

Abstract

The application discloses a data reading processing method, an electronic device and a storage medium, relates to the technical field of data processing, and comprises the following steps: obtaining an execution state of a target read-write command; if the execution state indicates that the target read-write command fails to be executed, determining a command re-execution number of the target read-write command according to a failure cause; judging whether to re-execute the target read-write command based on a re-execution threshold value corresponding to a target storage device, the command re-execution number of the target read-write command and historical failure information; and if the judgment result is to re-execute the target read-write command, re-executing the target read-write command based on a delay duration. The method can comprehensively judge whether the target read-write command needs to be re-executed by combining the command re-execution number of the target read-write command, the re-execution threshold value corresponding to the target storage device and the historical failure information, can reduce the invalid re-execution number as much as possible, can increase the success rate of re-execution by calculating the delay duration of re-execution, and can improve resource utilization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to data reading processing methods, electronic devices, and storage media. Background Technology

[0002] In operating systems, data is stored on hard drives. Data read and write requests are typically initiated by applications. When an application issues a read or write command, the command passes through the file system, the block layer (block device layer), and the SCSI layer (Small Computer System Interface, the device driver layer in the system kernel that handles storage I / O). The SCSI layer interacts with the storage device and host adapter. If a read operation fails, the SCSI layer initiates a retry based on a preset strategy. During retrying, the operation is typically retried a fixed number of times. This can lead to situations where too many attempts are made without success, making it difficult to adapt to different scenarios and potentially wasting resources. Summary of the Invention

[0003] In view of this, the present invention provides a data reading processing method, electronic device and storage medium to at least solve the problem in the related art that the number of times commands are re-executed is difficult to match the actual scenario, resulting in resource waste.

[0004] This application provides a data reading processing method, including:

[0005] Obtain the execution status of the target read / write command, which is used to instruct the target data to be written to the target storage device;

[0006] If the execution status indicates that the target read / write command has failed to execute, then the number of times the target read / write command will be re-executed is determined based on the reason for the failure. The execution status includes the reason for the failure to execute the target read / write command.

[0007] The decision to re-execute the target read / write command is based on the re-execution threshold corresponding to the target storage device, the number of command re-executions of the target read / write command, and historical failure information. The historical failure information includes at least the total number of command processing failures of the target storage device, the number of consecutive command processing failures, and the number of command processing failures in the fixed number of command executions before executing the target read / write command.

[0008] If the determination result is to re-execute the target read / write command, then the target read / write command is re-executed based on the delay duration, which is determined based on the number of times the target read / write command is re-executed.

[0009] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for executing the computer program to implement the processing steps of any of the above-described data reading methods.

[0010] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of any of the above-described data reading processing methods.

[0011] This application combines the number of times the target read / write command is re-executed, the re-execution threshold corresponding to the target storage device, and historical failure information to comprehensively determine whether the target read / write command needs to be re-executed, thereby minimizing the number of invalid re-executions. Furthermore, by setting a delay time for re-execution, the success rate of re-execution commands is increased, thereby improving resource utilization. Attached Figure Description

[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0013] Figure 1 A schematic diagram illustrating a data reading processing method provided in an embodiment of this application;

[0014] Figure 2 A flowchart illustrating a data reading processing method provided in an embodiment of this application;

[0015] Figure 3 A schematic diagram of a data reading processing apparatus provided in an embodiment of this application;

[0016] Figure 4 A schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0019] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0020] In the operating system, all data comes from the hard drive, and all data is also stored on the hard drive, such as... Figure 1 As shown, storage I / O is initiated by the application, passing through the file system, block layer, and SCSI layer to reach the storage device or host adapter. The host adapter connects to the host via a PCIe interface and connects to the target device via a cable. The host issues I / O commands through the SCSI layer, and the I / O passes through the host adapter, backplane, and cable to reach the target device, ultimately being stored on or read from the block device medium. Due to the complexity of the topology and links, various problems inevitably arise that can lead to I / O execution failures. To maximize the chances of successful I / O execution, the SCSI layer employs an I / O error handling mechanism. In related technologies, if an I / O command execution fails, the corresponding error handling mechanism is activated to re-execute the command. The SCSI layer includes block device and host adapter drivers, which work together to complete data transmission. The block device refers to the storage device (such as a hard drive, optical disc drive, etc.) connected via the SCSI protocol, which is the actual medium for data storage or retrieval. The host adapter driver drives the host adapter, enabling it to communicate with the host via the PCIe interface and connect to the target storage device via a cable. During retrying, the process typically involves re-execution a fixed number of times. However, this can lead to situations where too many attempts are made without success, making it difficult to adapt to different scenarios and potentially wasting resources. Therefore, this invention provides a data reading processing method. The execution entity is a SCSI layer driver in a Linux operating system host (server or computer), designed for scenarios where command execution fails due to link fluctuations, device overload, or other factors during the I / O command delivery to the storage device.

[0021] The embodiments of this application provide a data reading processing method. The method is described in detail below, along with its execution flow. Figure 2 As shown, the method includes the following steps:

[0022] Step S101: Obtain the execution status of the target read / write command.

[0023] The target read / write command is used to instruct the writing of target data to the target storage device; it is an I / O command. The target read / write command is an instruction issued by the application or upper-level module to write target data to the storage device. A storage device is a hardware device in a computer system used to store data. It can include rotating and non-rotating storage devices. Specifically, rotating storage devices are based on a mechanical structure, including rotating disk platters, read / write heads, and read / write heads. Data is read and written by positioning the heads on the rotating disk surface. For example, in a traditional hard disk drive (HDD), the platters rotate at high speed, requiring the read / write head to seek, resulting in relatively high latency. Non-rotating storage devices store data based on flash memory chips, have no mechanical parts, and rely on electronic signals to complete read / write operations. Solid-state drives (SSDs), for example, typically have no mechanical parts, are based on flash memory chips, and have extremely low latency and stability.

[0024] The execution status is the feedback on the result after the target read / write command is executed, including whether the execution was successful, the number of times the target read / write command was executed, and if the execution fails, the execution status also includes the reason for the failure to execute the target read / write command.

[0025] Step S102: If the execution status indicates that the target read / write command has failed, then determine the number of times the target read / write command will be re-executed based on the reason for the failure.

[0026] The execution status includes the reasons for the failure of the target read / write command. These reasons include internal driver logic errors, temporary interruptions at the transport layer (e.g., network jitter), unexpected internal errors in the underlying driver or transport layer (e.g., insufficient memory or invalid addresses), a full device task queue, temporary insufficient internal device resources, the device actively terminating the current task, and internal device errors. If the execution result of the target read / write command is detected as a failure, the number of command re-executions is updated according to the failure reason in the execution status. Different failure reasons have corresponding handling methods for the number of command re-executions. The failure reason determines the update rules for the number of command re-executions. Some failure reasons can be included in the number of command re-executions, while others, such as a full device task queue, have a high probability of success and do not require updating the number of command re-executions.

[0027] In some optional implementations, the execution status of the target read / write command is obtained by calling the corresponding function (scsi_decide_disposition() function), and the number of command re-executions is accumulated according to the reason for failure.

[0028] Step S103: Determine whether to re-execute the target read / write command based on the re-execution threshold corresponding to the target storage device, the number of times the target read / write command has been re-executed, and historical failure information.

[0029] The historical failure information includes at least the total number of command processing failures on the target storage device, the number of consecutive command processing failures, and the number of command processing failures within a fixed number of command executions prior to executing the target read / write command. A corresponding re-execution threshold is set for different types of target storage devices, representing the maximum number of times the same target read / write command can be executed on that device; this threshold can be specifically set according to the type or characteristics of the target storage device. By comparing the re-execution threshold corresponding to the target storage device with the number of command re-executions for the target read / write command, it is determined whether the target read / write command can be re-executed. If the target read / write command can be re-executed, a further comprehensive judgment is made based on the total number of command processing failures, the number of consecutive command processing failures, and the number of command processing failures within a fixed number of command executions prior to executing the target read / write command in the historical failure information.

[0030] In some optional implementations, a block device driver is used in the SCSI layer. During the device boot initialization phase, the target storage device attributes are obtained by calling functions. The target storage device attributes include the type of the target storage device, including spinning storage devices and non-spinning storage devices. Different types of devices have corresponding re-execution thresholds. For example, the re-execution threshold for non-spinning storage devices is 3, and the re-execution threshold for spinning storage devices is 5.

[0031] Step S104: If the determination result is to re-execute the target read / write command, then re-execute the target read / write command based on the delay duration.

[0032] The latency is determined based on the number of times the target read / write command is re-executed. The latency is positively correlated with the number of executions; the more executions, the longer the latency. The specific latency can be calculated using a defined formula. If it is determined that the target read / write command needs to be re-executed, the latency is calculated based on the number of re-executions. After waiting for the specified latency, the target read / write command is sent to the processing queue for re-execution. The latency allows recovery time for storage devices or links, preventing resource strain caused by frequent command re-executions.

[0033] If the determination result is that the target read / write command does not need to be re-executed, an error message is returned, and the target read / write command is written to a preset error list for processing in the error recovery process.

[0034] In some optional implementations, after each read / write command is executed, the execution status is recorded by adding three fields: all_retries, which indicates the number of times the command has been re-executed; backoff_work, which is a work item used to re-execute the read / write command after a delay; and retry_season, which is used to record the reason for failure.

[0035] The data reading processing method provided by this invention includes obtaining the execution status of a target read / write command. If the execution status indicates that the target read / write command has failed, the number of times the target read / write command needs to be re-executed is determined based on the cause of failure. A determination is made based on the re-execution threshold corresponding to the target storage device, the number of times the target read / write command needs to be re-executed, and historical failure information. If the determination result is to re-execute the target read / write command, the target read / write command is re-executed based on the latency duration. This method comprehensively determines whether the target read / write command needs to be re-executed by combining the number of times the target read / write command needs to be re-executed, the re-execution threshold corresponding to the target storage device, and historical failure information, minimizing invalid re-executions and increasing the success rate of re-execution by calculating the re-execution latency, thereby improving resource utilization.

[0036] The embodiments of this application provide a data reading processing method. The method is described in detail below, in conjunction with its execution flow, and includes the following steps:

[0037] Step S201: Obtain the execution status of the target read / write command.

[0038] For details of step S201, please refer to step S101, which will not be repeated here.

[0039] Step S202: If the execution status indicates that the target read / write command has failed, then determine the number of times the target read / write command will be re-executed based on the reason for the failure.

[0040] Specifically, step S202 includes:

[0041] Step S2021: Based on the preset failure reason table and the failure reasons, determine whether to update the command re-execution count of the target read / write command. The preset failure reason table includes failure reasons and the handling method for the command re-execution count, which includes updating or not updating.

[0042] The preset failure reason table stores different failure reasons and corresponding handling methods for the number of command re-executions. The handling methods for the number of command re-executions include updating and not updating, which can be understood as whether to include it in the retry count. The preset failure reason table is pre-stored in the SCSI layer. By querying the preset failure reason table, it is determined whether the number of command re-executions needs to be updated for this execution failure. The preset failure reason table is shown in Table 1.

[0043] Table 1 Preset Failure Reasons Table

[0044]

[0045] Step S2022: If the processing method for the number of command re-executions is to update, then increment the number of command re-executions and generate the updated number of command re-executions.

[0046] If, after querying, the failure of this execution needs to be included in the retry count, i.e., the number of times the update command is re-executed, then the current command re-execution count is incremented by 1 to obtain the updated command re-execution count.

[0047] If the command re-execution count is not updated, there is no need to modify the original command failure count. In this case, the command re-execution count for the target read / write command remains unchanged.

[0048] Step S203: Determine whether to re-execute the target read / write command based on the re-execution threshold corresponding to the target storage device, the number of times the target read / write command has been re-executed, and historical failure information.

[0049] Specifically, step S203 includes:

[0050] Step S2031: Determine whether the number of times the target read / write command is re-executed is less than the re-execution threshold corresponding to the target storage device.

[0051] First, compare the number of times the target read / write command is re-executed with the re-execution threshold corresponding to the target storage device to determine whether the number of times the target read / write command is re-executed is less than the re-execution threshold corresponding to the target storage device.

[0052] Step S2032: If the number of times the target read / write command is re-executed is less than the re-execution threshold corresponding to the target storage device, then determine whether the historical failure information meets the command re-execution condition corresponding to the failure reason based on the failure reason.

[0053] If the number of times the target read / write command is re-executed is less than the re-execution threshold corresponding to the target storage device, it indicates that the preliminary condition for re-executing the target read / write command has been met. Next, it is necessary to determine whether the historical failure information meets the command re-execution condition corresponding to the failure reason. There is a corresponding relationship between the failure reason and the handling method of the number of command re-executions, and the handling method of the number of command re-executions has a corresponding command re-execution condition.

[0054] Further, step S2032 includes:

[0055] Step a1: Obtain the historical failure rate based on the ratio of the total number of command processing failures on the target storage device to the total number of read commands executed on the target storage device.

[0056] The total number of command processing failures on the target storage device represents the total number of times all commands failed to execute on the target storage device, while the total number of read commands executed on the target storage device represents the total number of times all commands were executed on the target storage device. The ratio of the two is used to obtain the historical failure rate.

[0057] In some optional implementations, step a1 further includes: if the total number of read commands executed by the target storage device is greater than or equal to a preset quantity threshold, calculating the product of the total number of read commands executed by the target storage device and a preset third coefficient to obtain a third product; and obtaining the historical failure rate based on the ratio of the total number of command processing failures of the target storage device to the third product.

[0058] The total number of read commands executed on the target storage device may be large. After the total number reaches a certain number, the impact of the total number of historical failures on the current target read and write commands will decrease over time. To address this, a preset number threshold (e.g., 1000) and a preset third coefficient are set. The preset third coefficient is a decay factor (e.g., 0.9).

[0059] If the total number of read commands executed by the target storage device is greater than or equal to a preset threshold, the product of the total number of read commands executed by the target storage device and a preset third coefficient is calculated to obtain the third product. The ratio of the total number of command processing failures of the target storage device to the third product is then calculated to obtain the historical failure rate.

[0060] Step a2: Based on the ratio of the number of command processing failures in the fixed number of command executions before executing the target read / write command to the fixed number of command executions before executing the target read / write command, the recent failure rate is obtained.

[0061] Define a fixed number of command executions, n, which represents the number of command operations performed before the current target read / write command (e.g., n=64). The number of command processing failures in the fixed number of command executions before the target read / write command represents the number of times the command failed to execute in those n operations. Calculate the ratio of the number of command processing failures in the fixed number of command executions before the target read / write command to the total number of fixed command executions before the target read / write command to obtain the recent failure rate.

[0062] In some alternative implementations, a data structure is designed to record SCSI command statistics.

[0063] Step a3: If the handling method for the number of command re-executions corresponding to the failure reason is update, calculate the product of the preset first coefficient and the historical failure rate to obtain the first product;

[0064] For failures that are counted in the retry count, i.e., the number of command re-executions corresponding to the failure reason, the processing method is to update and obtain the command re-execution conditions for this type, including a preset first coefficient. First, calculate the product of the preset first coefficient and the historical failure rate.

[0065] Step a4: If the recent failure rate is less than or equal to the first product, and the number of consecutive command processing failures is less than the preset first threshold, then it is determined that the updated number of command processing failures has reached the condition for re-execution of the command corresponding to the failure reason.

[0066] As an example, with a preset first coefficient of 2 and a preset first threshold of 2, the handling method for the number of command re-executions corresponding to the failure reason is to update, if the recent failure rate... If the historical failure rate is 2 times the number of consecutive command failures is less than 2, then the condition for re-executing the command is met. If this condition is not met, the target read / write command will not be re-executed.

[0067] Step a5: If the handling method for the number of command processing failures corresponding to the failure reason is not to update, calculate the product of the preset second coefficient and the historical failure rate to obtain the second product.

[0068] Step a6: If the recent failure rate is less than or equal to the second product, and the number of consecutive command processing failures is less than the preset second threshold, then it is determined that the updated number of command processing failures has reached the condition for re-execution of the command corresponding to the failure reason.

[0069] For failures that are counted in the retry count, i.e., the handling method for the command re-execution count corresponding to the failure reason is not to update, obtain the command re-execution conditions for this type, including the preset second coefficient. First, calculate the product of the preset second coefficient and the historical failure rate.

[0070] As an example, with a preset second coefficient of 5 and a preset first threshold of 5, the handling method for the number of command re-executions corresponding to the failure reason is not to update, if the recent failure rate... If the historical failure rate is 5 times the number of consecutive command failures is less than 5, then the condition for re-executing the command is met. If this condition is not met, the target read / write command will not be re-executed.

[0071] Step S2033: If the historical failure information meets the command re-execution condition corresponding to the failure reason, then it is determined to re-execute the target read / write command.

[0072] In the process of processing target read and write commands, it is checked whether the historical failure information meets the command re-execution conditions that match the failure reason. If the failure information meets the command re-execution conditions, it is determined that the target read and write command can be re-executed.

[0073] Step S204: If the determination result is to re-execute the target read / write command, then re-execute the target read / write command based on the delay duration.

[0074] In some optional implementations, before step S204, the method further includes: calculating the delay duration based on the number of command re-executions of the target read / write command;

[0075] The delay duration is calculated based on the number of times the command is re-executed, and is determined according to the following formula: Delay duration = .

[0076] Where n represents the number of times the target read / write command is re-executed.

[0077] Specifically, step S204 includes: storing the target read / write command into a command execution queue based on the delay duration. The command execution queue is used to execute the target read / write command.

[0078] Add a backoff_work item. When scheduling a backoff_work item, it is equivalent to creating a thread in the kernel. A corresponding thread is generated for each read and write command. After determining the delay duration, the thread performs delay scheduling. After waiting for the delay duration, the target read and write command is stored in the command execution queue. The command execution queue executes all read and write commands in sequence.

[0079] This application provides a data reading processing method that sets corresponding re-execution thresholds for different target storage devices, avoiding excessive retries for certain types of target storage devices and saving resources. If a target read / write command fails, the number of re-execution attempts and the re-execution conditions are determined based on the cause of the failure. A delay is calculated based on the number of re-execution attempts, and the re-execution threshold is checked against the number of re-execution attempts. If the threshold is not reached, re-execution is initially determined. Next, the historical failure information is checked to see if the re-execution conditions are met. First, the recent error rate and historical error rate are calculated based on the historical failure information. Then, the recent error rate, historical error rate, and the number of consecutive command processing failures are combined to determine if the re-execution conditions are met. If they are met, the target read / write command can be re-executed. After waiting for the delay, the target read / write command is stored in the command execution queue for re-execution. By calculating the delay, congestion caused by intensive retries can be reduced, transient errors can be prevented from spreading, the retry success rate can be increased, and recovery speed and system stability can be balanced. Since re-execution consumes system resources and affects other unexecuted commands, invalid re-execution operations must be abandoned. By combining historical failure information (historical error rate and recent error rate, and dual judgment of consecutive failures), commands that do not meet the conditions for command re-execution are identified, and commands that do not meet the conditions for command re-execution are added to the error recovery list as early as possible. In addition, by combining a decay factor (preset third coefficient) to reduce the impact of old data, this multi-judgment mechanism can minimize redundant re-execution operations, improve the success rate of re-execution, and save system resources.

[0080] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0081] Embodiments of this application also provide a data reading processing apparatus, such as... Figure 3 As shown, it includes:

[0082] The status acquisition module is used to acquire the execution status of the target read / write command, which is used to instruct the target data to be written to the target storage device.

[0083] The re-execution module is used to determine the number of times the target read / write command will be re-executed based on the reason for failure if the execution status indicates that the execution of the target read / write command has failed. The execution status includes the reason for failure in executing the target read / write command.

[0084] The execution judgment module is used to determine whether to re-execute the target read / write command based on the re-execution threshold corresponding to the target storage device, the number of command re-executions of the target read / write command, and historical failure information. The historical failure information includes at least the total number of command processing failures of the target storage device, the number of consecutive command processing failures, and the number of command processing failures in the fixed number of command executions before executing the target read / write command.

[0085] The re-execution module is used to re-execute the target read / write command based on a delay duration if the determination result is to re-execute the target read / write command. The delay duration is determined based on the number of times the target read / write command is re-executed.

[0086] In some alternative implementations, the number determination module includes:

[0087] The re-execution count unit is used to determine whether to update the command re-execution count of the target read / write command based on a preset failure reason table and the failure reasons. The preset failure reason table includes failure reasons and processing methods for the command re-execution count, and the processing methods include updating and not updating.

[0088] The increment unit is used to increment the command re-execution count if the processing method for the command re-execution count is update, thereby generating an updated command re-execution count.

[0089] In some optional implementations, the execution judgment module includes:

[0090] The first judgment unit is used to determine whether the number of times the target read / write command is re-executed is less than the re-execution threshold corresponding to the target storage device;

[0091] The condition judgment unit is used to determine whether the historical failure information meets the command re-execution condition corresponding to the failure reason if the number of command re-executions of the target read / write command is less than the re-execution threshold corresponding to the target storage device.

[0092] The re-execution unit is used to determine to re-execute the target read / write command if the historical failure information meets the command re-execution condition corresponding to the failure reason.

[0093] In some optional implementations, the condition determination unit includes:

[0094] The historical failure rate calculation subunit is used to obtain the historical failure rate based on the ratio of the total number of command processing failures of the target storage device to the total number of read commands executed by the target storage device.

[0095] The recent failure rate calculation subunit is used to obtain the recent failure rate based on the ratio of the number of command processing failures in the fixed number of command executions before executing the target read / write command to the fixed number of command executions before executing the target read / write command.

[0096] The first product calculation subunit is used to calculate the product of a preset first coefficient and the historical failure rate if the processing method for the number of times the command is re-executed corresponding to the failure reason is update, so as to obtain the first product;

[0097] The first determination subunit is configured to determine that the updated command processing failure count has reached the command re-execution condition corresponding to the failure reason if the recent failure rate is less than or equal to the first product and the number of consecutive command processing failures is less than a preset first threshold.

[0098] In some optional implementations, the condition determination unit further includes:

[0099] The second product calculation subunit is used to calculate the product of a preset second coefficient and the historical failure rate if the processing method for the number of times the command is re-executed corresponding to the failure reason is not to update, so as to obtain the second product.

[0100] The second determination subunit is used to determine that the updated command processing failure count has reached the command re-execution condition corresponding to the failure reason if the recent failure rate is less than or equal to the second product and the number of consecutive command processing failures is less than a preset second threshold.

[0101] In some optional implementations, the historical failure rate calculation subunit is further configured to calculate the product of the total number of read commands executed by the target storage device and a preset third coefficient if the total number of read commands executed by the target storage device is greater than or equal to a preset number threshold, thereby obtaining a third product;

[0102] The historical failure rate is obtained by comparing the total number of command processing failures of the target storage device with the third product.

[0103] In some alternative embodiments, the apparatus further includes:

[0104] The duration calculation module is used to calculate the delay duration based on the number of times the target read / write command is re-executed; the delay duration is determined according to the following formula:

[0105] Delay duration =

[0106] Where n represents the number of times the target read / write command is re-executed.

[0107] In some alternative implementations, the re-execution module includes:

[0108] The command storage unit is used to store the target read / write command into the command execution queue based on the delay duration, and the command execution queue is used to execute the target read / write command.

[0109] For a description of the features in the embodiment corresponding to the data reading processing device, please refer to the relevant description in the embodiment corresponding to the data reading processing method, which will not be repeated here.

[0110] Embodiments of this application also provide an electronic device, such as... Figure 4 As shown, it includes a memory 10 and a processor 20. The memory 10 stores a computer program, and the processor 20 is configured to run the computer program to perform the steps in any of the above-described data reading processing method embodiments.

[0111] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described data reading processing method embodiments when running.

[0112] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0113] The embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described data reading processing method embodiments.

[0114] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described data reading processing method embodiments.

[0115] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0116] The foregoing has provided a detailed description of the data reading processing method, electronic device, and storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to help understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A data reading processing method, characterized in that, include: Obtain the execution status of the target read / write command, which is used to instruct the target data to be written to the target storage device; If the execution status indicates that the target read / write command has failed to execute, then the number of times the target read / write command will be re-executed is determined based on the reason for the failure. The execution status includes the reason for the failure to execute the target read / write command. The decision to re-execute the target read / write command is based on the re-execution threshold corresponding to the target storage device, the number of command re-executions of the target read / write command, and historical failure information. The historical failure information includes at least the total number of command processing failures of the target storage device, the number of consecutive command processing failures, and the number of command processing failures in the fixed number of command executions before executing the target read / write command. If the determination result is to re-execute the target read / write command, then the target read / write command is re-executed based on the delay duration, which is determined based on the number of times the target read / write command is re-executed; If the execution status indicates that the target read / write command has failed, then the number of times the target read / write command will be re-executed is determined based on the reason for the failure, including: Based on a preset failure reason table and the failure reasons, it is determined whether to update the command re-execution count of the target read / write command. The preset failure reason table includes failure reasons and processing methods for the command re-execution count, including updating and not updating. If the processing method for the command re-execution count corresponding to the failure reason is to update, the command re-execution count is incremented to generate an updated command re-execution count.

2. The data reading processing method according to claim 1, characterized in that, The step of determining whether to re-execute the target read / write command based on the re-execution threshold corresponding to the target storage device, the number of command re-executions of the target read / write command, and historical failure information includes: Determine whether the number of times the target read / write command is re-executed is less than the re-execution threshold corresponding to the target storage device; If the number of times the target read / write command is re-executed is less than the re-execution threshold corresponding to the target storage device, then based on the failure reason, it is determined whether the historical failure information meets the command re-execution condition corresponding to the failure reason; If the historical failure information meets the command re-execution condition corresponding to the failure reason, then it is determined to re-execute the target read / write command.

3. The data reading processing method according to claim 2, characterized in that, The step of determining whether the historical failure information meets the command re-execution conditions corresponding to the failure reason based on the failure reason includes: The historical failure rate is obtained by comparing the total number of command processing failures on the target storage device with the total number of read commands executed on the target storage device. The recent failure rate is obtained by comparing the number of command processing failures in a fixed number of command executions before executing the target read / write command with the fixed number of command executions before executing the target read / write command. If the processing method for the number of times the command is re-executed corresponding to the failure reason is update, calculate the product of the preset first coefficient and the historical failure rate to obtain the first product; If the recent failure rate is less than or equal to the first product, and the number of consecutive command processing failures is less than a preset first threshold, then it is determined that the updated number of command processing failures has reached the command re-execution condition corresponding to the failure reason.

4. The data reading processing method according to claim 3, characterized in that, The step of determining whether the historical failure information meets the command re-execution condition corresponding to the failure reason based on the failure reason further includes: If the handling method for the number of times the command is re-executed corresponding to the failure reason is not to update, calculate the product of the preset second coefficient and the historical failure rate to obtain the second product; If the recent failure rate is less than or equal to the second product, and the number of consecutive command processing failures is less than a preset second threshold, then it is determined that the updated number of command processing failures has reached the command re-execution condition corresponding to the failure reason.

5. The data reading processing method according to claim 3, characterized in that, The historical failure rate is obtained by dividing the total number of command processing failures based on the target storage device by the total number of read commands executed on the target storage device, including: If the total number of read commands executed by the target storage device is greater than or equal to a preset threshold, calculate the product of the total number of read commands executed by the target storage device and a preset third coefficient to obtain the third product; The historical failure rate is obtained by comparing the total number of command processing failures of the target storage device with the third product.

6. The data reading processing method according to claim 1, characterized in that, Before re-executing the target read / write command based on the delay duration, the method further includes: The delay duration is calculated based on the number of times the target read / write command is re-executed; the delay duration is determined according to the following formula: Delay duration = Where n represents the number of times the target read / write command is re-executed.

7. The data reading processing method according to claim 6, characterized in that, The step of re-executing the target read / write command based on the delay duration includes: Based on the aforementioned delay duration, the target read / write command is stored in a command execution queue, which is used to execute the target read / write command.

8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the data reading processing method as described in any one of claims 1 to 7 when executing the computer program.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the steps of the data reading processing method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and equipment for calculating duration for processing read-write command by hard disk

    CN107797893A

  • Message processing method and device, equipment and storage medium

    CN115757494A