Link flash disconnection management method, device, computer equipment and storage medium
By introducing link flash break management methods in SAS drivers, using link timer and credit value mechanism, the problem of accidentally triggering hard disk reconstruction during physical link flash break is solved, the storage performance is improved and timely in the event of link failure is achieved. Make an early warning.
Patent Information
- Application Number
- CN202410833574.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-06-26
AI Technical Summary
The prior art can easily trigger hard disk reconstruction incorrectly when physical links are flashed, resulting in degradation of storage performance.
By introducing link flash break management methods in SAS drivers, using link timers and credit value mechanisms, the hard disk offline event is reported only when the link disconnection time is greater than the preset time or the credit value is exhausted, avoiding unnecessary hard disks Refactor and resend intercepted read and write commands when link recovery.
It effectively avoids the incorrect triggering of hard disk reconstruction when physical link flash breaks, improves storage performance, ensures timely warnings when link failures, and avoids affecting storage performance.
Smart Images

Figure CN118377646B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of servers, and in particular to a method, device, computer equipment and storage medium for managing flash disconnection of a link. Background Art
[0002] In the storage software stack, the SAS (Serial Attached SCSI) protocol stack mainly includes SAS-device (SAS hard disk), SAS-Expander (SAS device expander), SAS driver, and SCSI (Small Computer System Interface) from bottom to top. When users have data to store, the data flows in the following order: user IO (Input / Output) data, storage pool management, SCSI protocol, SAS driver, SAS-Expander, and SAS hard disk.
[0003] There is a physical link between the SAS-Expander and the SAS hard disk. When the SAS hard disk is unplugged and then plugged in again, it will trigger the storage pool management module to reconstruct the SAS hard disk, resulting in a decrease in storage performance. In addition, when the physical link between the SAS-Expander and the SAS hard disk is disconnected and reconnected in a short time due to errors, poor contact, component quality, power supply ripple and other problems, the SAS-Expander and SAS hard disk physical link is not unplugged, the physical link can still be used, and does not need to be reconstructed. However, the current SAS driver will report the change of the physical link to the SCSI, thereby triggering the hard disk reconstruction, resulting in a decrease in system storage performance.
[0004] Therefore, the related technology has the problem that when the physical link is disconnected, the hard disk reconstruction will be mistakenly triggered, resulting in a decrease in storage performance. Summary of the invention
[0005] In view of this, the present invention provides a link disconnection management method, device, computer equipment and storage medium to solve the problem that when a physical link is disconnected, hard disk reconstruction may be mistakenly triggered, resulting in a decrease in storage performance.
[0006] In a first aspect, the present invention provides a method for managing a link flash disconnection, comprising:
[0007] In the case of receiving a message that a link is disconnected between the device expander and the hard disk, determining whether a target hard disk corresponding to the disconnected link is restored online, wherein the device expander is connected to a preset number of hard disks through a preset number of links, and the target hard disk is included in the preset number of hard disks;
[0008] When the target hard disk is offline, a credit value of the disconnected link is obtained, and if the credit value is not equal to a preset value, an offline time of the target hard disk is determined;
[0009] If the target hard disk is offline for less than the first preset time and is restored online, the credit value is deducted from the preset step length, and the hard disk offline event is not reported;
[0010] When the credit value is equal to the preset value, or the offline time of the target hard disk is greater than the first preset time, a hard disk offline event is reported.
[0011] The present embodiment provides a method for managing link disconnection. When a link is disconnected, the hard disk offline event is reported only when the credit value of the disconnected link is equal to a preset value, or the offline time of the target hard disk is greater than a first preset time, so as to facilitate the subsequent hard disk reconstruction of the target hard disk. When the link is disconnected with probability, the hard disk reconstruction is not triggered by mistake to avoid the degradation of storage performance, and a warning can be issued in time when the link failure is determined to avoid affecting the storage performance. The problem of hard disk reconstruction being triggered by mistake when the physical link is disconnected, resulting in the degradation of storage performance, is solved.
[0012] In some optional implementations, when receiving a message that a link is disconnected between the device expander and the hard disk, determining whether a target hard disk corresponding to the disconnected link is restored online includes:
[0013] In case of receiving the first broadcast event, determining that there is a link disconnection message between the device extender and the hard disk, wherein the first broadcast event is reported after the link is disconnected;
[0014] In the event of a disconnected link message, if a second broadcast event is received, it is determined that the target hard disk has resumed online, or, using preset instructions, the status information of the target hard disk is obtained, and it is determined whether the target hard disk has resumed online based on the status information, wherein the second broadcast event is reported after the target hard disk goes from offline to online.
[0015] In this embodiment, the first broadcast event is used to determine whether there is a broken link; the second broadcast event or preset instructions are used to determine whether the target hard disk is back online, and the online and offline status of the hard disk is determined quickly and accurately, which facilitates the subsequent management of link disconnections.
[0016] In some optional implementations, before determining whether the target hard disk corresponding to the disconnected link is restored online, the method further includes:
[0017] Generate hard disk device table;
[0018] Obtaining initial credit values of a preset number of links and hard disk addresses of a preset number of hard disks, and filling the initial credit values and hard disk addresses into table entries corresponding to the hard disks in the hard disk device table;
[0019] Obtaining a first preset time of the link;
[0020] Adding a link timer for a preset number of links, wherein the link timer is used to determine whether the offline time is greater than a first preset time;
[0021] Configure cache space, where the cache space is used to save the read and write commands of the target hard disk when the target hard disk is offline.
[0022] In this implementation, a hard disk device table is generated, a first preset time of a link is obtained, link timers are added for a preset number of links, and a cache space is configured, so as to facilitate subsequent management of link disconnections.
[0023] In some optional embodiments, the method further comprises:
[0024] When the target hard disk is offline, a link timer for disconnecting the link is started;
[0025] When the link timer reaches a first preset time, determining whether there is an offline mark in a target table entry corresponding to the target hard disk in the hard disk device table;
[0026] If so, it is determined that the offline time is greater than the first preset time.
[0027] In some optional embodiments, the method further comprises:
[0028] When the target hard disk is restored to online, determine whether the target hard disk is a new hard disk. If it is a new hard disk, execute the new hard disk initialization process; if it is not a new hard disk, determine whether the offline time consumed by the target hard disk to be restored from offline to online is greater than a first preset time;
[0029] When the offline time is greater than the first preset time, the step of reporting the hard disk offline event is executed; when the offline time of the target hard disk is less than the first preset time, the step of subtracting the preset step length from the credit value is executed, and the step of not reporting the hard disk offline event is executed.
[0030] In some optional implementations, determining whether the offline time consumed by the target hard disk to be restored from offline to online is greater than a first preset time includes:
[0031] Get the timer status of the link timer in the target hard disk;
[0032] According to the timer state, determine whether the link timer is in the initialization state, and if so, determine that the offline time is greater than a first preset time, wherein the link timer is set to the initialization state after reaching the first preset time.
[0033] In some optional embodiments, the method further comprises:
[0034] When the target hard disk is offline and the credit value is not equal to the preset value, query the target table entry of the target hard disk according to the hard disk address;
[0035] In the target table entry, fill in the offline flag of the target hard disk.
[0036] In some optional implementations, after filling in the offline mark of the target hard disk, the method further includes:
[0037] If a read or write command of the target hard disk is received, the command cache list is queried in the cache space according to the hard disk address of the target hard disk;
[0038] Write read and write commands into the command cache list;
[0039] After subtracting the preset step size from the credit value, the method further includes:
[0040] Get the read and write commands of the target hard disk in the command cache list;
[0041] Send read and write commands to the target hard disk.
[0042] In this embodiment, when the target hard disk is offline, its read and write commands are intercepted and saved in a command cache list in the cache space. When the target hard disk is back online and the preset step length is subtracted, the read and write commands are resent to the target hard disk to prevent the target hard disk from missing the read and write commands or executing the read and write commands incorrectly.
[0043] In some optional implementations, after subtracting the preset step size from the credit value, the method further includes:
[0044] If the credit value minus the preset step length equals the preset value, then obtaining the credit value exhaustion time for the credit value of the disconnected link to change from the initial credit value to the preset value;
[0045] Determining whether the credit value depletion time is less than a second preset time;
[0046] If the credit value exhaustion time is less than the second preset time, a link failure warning is reported.
[0047] In this embodiment, if the credit value exhaustion time is less than the second preset time, it means that the link where the target hard disk is located is disconnected multiple times within the second preset time, and it is determined that the disconnected link has a fault, and a link fault warning is reported to distinguish between continuous faults and discrete faults, so as to achieve accurate alarm.
[0048] In some optional implementations, obtaining the credit value exhaustion time for the credit value of the disconnected link to change from the initial credit value to the preset value includes:
[0049] In the hard disk device table, a first system time base when the credit value of the disconnected link is first modified and a second system time base when the credit value of the disconnected link becomes a preset value are obtained;
[0050] The credit value depletion time is determined according to the difference between the first system time base and the second system time base.
[0051] In some optional implementations, after determining whether the credit value depletion time is less than a second preset time, the method further includes:
[0052] If the credit value exhaustion time is greater than or equal to a second preset time, starting a link timer in the target hard disk;
[0053] When the link timer reaches a third preset time, determining whether a first broadcast event is received;
[0054] If received, the credit value will not be modified and the hard disk offline event will be reported;
[0055] If not received, the credit value is increased by a preset step size.
[0056] In this embodiment, when the credit value exhaustion time is greater than or equal to the second preset time, if the first broadcast event is not received again, the preset step length is increased for the credit value, and a mechanism for increasing the credit value is designed so that the credit value can accurately reflect the situation of the target hard disk and the disconnected link, and will not mistakenly trigger the hard disk reconstruction to avoid storage performance degradation, and can also issue a timely warning when a link failure is determined to avoid affecting storage performance.
[0057] In some optional implementations, executing a new hard disk initialization process includes:
[0058] Generate a new entry for the new hard disk in the hard disk device table;
[0059] Obtain the initial credit value of the new link corresponding to the new hard disk and the hard disk address of the new hard disk, and fill the initial credit value of the new link and the hard disk address of the new hard disk into the new table entry;
[0060] Obtaining a first preset time of a new link;
[0061] Add link timer in new hard disk;
[0062] Configure the cache space corresponding to the new hard disk.
[0063] In some optional implementations, after reporting the hard disk offline event, the method further includes:
[0064] In the cache space, a command cache list is obtained according to the hard disk address of the target hard disk, and the read and write commands of the target hard disk in the command cache list are deleted;
[0065] According to the hard disk address of the target hard disk, the target table entry corresponding to the target hard disk is obtained from the hard disk device table, and the target table entry is deleted;
[0066] Initialize the link timer in the target hard disk.
[0067] In this embodiment, after reporting the hard disk offline event, the read and write commands of the target hard disk are deleted from the command cache list, the target table entry corresponding to the target hard disk is deleted, and the link timer is initialized to facilitate subsequent hard disk reconstruction of the target hard disk.
[0068] In a second aspect, the present invention provides a link flash disconnection management device, comprising:
[0069] A first determination module is used to determine whether a target hard disk corresponding to the disconnected link is restored online when receiving a message that a link is disconnected between the device expander and the hard disk, wherein the device expander is connected to a preset number of hard disks through a preset number of links, and the target hard disk is included in the preset number of hard disks;
[0070] A first acquisition module is used to acquire a credit value of a disconnected link when the target hard disk is offline, and if the credit value is not equal to a preset value, determine the offline time of the target hard disk;
[0071] A modification module, configured to, when the offline time of the target hard disk is less than the first preset time and the target hard disk is restored online, deduct the preset step length from the credit value and not report the hard disk offline event;
[0072] The first reporting module is used to report a hard disk offline event when the credit value is equal to a preset value or the offline time of the target hard disk is greater than a first preset time.
[0073] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the link disconnection management method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0074] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the link disconnection management method of the first aspect or any corresponding embodiment thereof.
[0075] In a fifth aspect, the present invention provides a computer program product, including computer instructions, and the computer instructions are used to enable a computer to execute the link disconnection management method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0077] Figure 1 is a flow chart of data storage flow according to an embodiment of the present invention;
[0078] Figure 2 is a flowchart of a method for managing a link disconnection according to an embodiment of the present invention;
[0079] Figure 3 is a flow chart of initializing a SAS driver after a system is started according to an embodiment of the present invention;
[0080] Figure 4 is a schematic diagram of the functions of a SCSI module, a SAS driver module and a device expander according to an embodiment of the present invention;
[0081] Figure 5 is a flow chart of managing link disconnection when a target hard disk is offline according to an embodiment of the present invention;
[0082] Figure 6 is a flow chart of managing link disconnection after a target hard disk is restored online according to an embodiment of the present invention;
[0083] Figure 7 is a structural block diagram of a link flash disconnection management device according to an embodiment of the present invention;
[0084] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0085] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0086] In the storage software stack, the SAS protocol stack mainly includes SAS-device (SAS interface hard disk), SAS-Expander (SAS device expander), SAS driver, and SCSI from bottom to top. The data storage flow is shown in 1. After the storage array creates a Raid (disk array) group from SAS hard disk 1, SAS hard disk 2, SAS hard disk 3 to SAS hard disk N, when there is user IO data, the data flow is user IO data, storage pool management, SCSI protocol, SAS driver, SAS-Expander, SAS hard disk, and SAS-PHY (SAS physical link) is used between different parts to realize data transmission, and N represents multiple. Because the SAS driver and SAS-Expander generally have a wide port composed of multiple SAS-PHYs, even if there is a problem with a PHY link, IO can still be sent. Therefore, a flash disconnection of the link due to fault 1 will not affect the performance of the Raid group. This application is only for Figure 1 Fault 2 in.
[0087] When a SAS hard disk, such as SAS hard disk 1, is removed and then inserted again, the storage pool management module will be triggered to reconstruct SAS hard disk 1. At this time, the performance of the entire Raid group will be reduced for the user. In another scenario, when the SAS-PHY link between the SAS-Expander and the SAS hard disk has low-probability problems such as bit errors, poor contact, component quality, and power supply ripple, it may cause Figure 1 The SAS-PHY link between the SAS-Expander and the SAS hard disk is disconnected, that is, the SAS-PHY link is disconnected (link-down) first, and then connected (link-up). In this way, the SAS driver will report to the SCSI: "The hard disk is offline -> the hard disk is online", thereby triggering the hard disk reconstruction, resulting in the performance degradation of the entire Raid group. In fact, the hard disk is not unplugged, and the entire SAS hardware link is not unusable, so reconstruction is not required at this time. At present, the usual method is to use the firmware closest to the hardware, for example: Figure 1 In the SAS-Expander in the SAS-PHY, the link status anti-shake check is performed. However, it is difficult to select a suitable anti-shake time with the above method. A long time will cause a significant drop in performance or even zero performance. This is because the storage pool will perform concurrency on the disk when sending IO. The specific IO timeout time varies with each storage software stack. Therefore, the anti-shake time in the SAS-Expander firmware is very short, generally at the millisecond (ms) level. However, if the anti-shake time is too short, it is difficult to eliminate the above physical link disconnection, resulting in reporting offline events to the SCSI protocol and hard disk reconstruction.
[0088] Based on the above content, an embodiment of the present invention provides a method for managing link disconnection. The SAS driver adds a software timer to each SAS hard disk, which is used to set the SAS link disconnection filter time and set a credit value for each link. If the link disconnection time is less than the SAS link disconnection filter time, the hard disk offline event is not reported, and only the credit value is reduced by 1. When the credit value is exhausted or the link disconnection time is greater than the SAS link disconnection filter time, the hard disk offline event is reported. This can achieve the effect of not triggering hard disk reconstruction by mistake and causing a significant drop in performance when the link probability is disconnected, and can also issue a warning in time when the link failure is determined to avoid affecting storage performance.
[0089] According to an embodiment of the present invention, a management embodiment of link disconnection is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer device with data processing capabilities, such as a computer, a server, etc., and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0090] In this embodiment, a link disconnection management method is provided, which can be used for the above-mentioned computer device. Figure 1 is a flow chart of a method for managing link disconnection according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0091] Step S201, upon receiving a message that a link is disconnected between a device expander and a hard disk, determining whether a target hard disk corresponding to the disconnected link is restored online, wherein the device expander is connected to a preset number of hard disks via a preset number of links, and the target hard disk is included in the preset number of hard disks.
[0092] Specifically, the link flash disconnection management method is executed by the SAS driver, SAS-Expander (SAS device expander) is referred to as the device expander hereinafter, and the SAS hard disk is referred to as the hard disk hereinafter. When the link between the device expander and the hard disk is disconnected, the device expander will send a message to the SAS driver that the link between the device expander and the hard disk is disconnected.
[0093] When the SAS driver receives a message that the link between the device expander and the hard disk is disconnected, it will first determine whether the target hard disk corresponding to the disconnected link is back online. If the target hard disk is back online, it means that the link is reconnected. The target hard disk is the hard disk that has been disconnected from the device expander. The preset number means multiple, and there is no specific number limit, such as Figure 1 As shown in the figure, SAS-Expander is connected to multiple SAS hard disks.
[0094] Step S202, when the target hard disk is offline, obtain the credit value of the disconnected link, and if the credit value is not equal to a preset value, determine the offline time of the target hard disk.
[0095] Specifically, when the target hard disk is offline, the SAS driver obtains the credit value of the disconnected link and determines whether the credit value is equal to the preset value. For example, if the initial credit value of the disconnected link is 5, each time the credit value is modified, 5 is subtracted by 1, and the preset value can be 0; if the initial credit value of the disconnected link is 0, each time the credit value is modified, 0 is added by 1, and the preset value can be 5; the initial credit value and the value subtracted / added each time are set according to actual needs. If the credit value is equal to the preset value, it means that the disconnected link has been disconnected multiple times, and the target hard disk needs to be reconstructed.
[0096] If the credit value is not equal to the preset value, the SAS driver determines the offline time of the target hard disk. A link timer can be set for each link, which is started when the target hard disk is offline. When the target hard disk is restored online, the link timer data can be read to determine the offline time of the target hard disk.
[0097] Step S203, when the offline time of the target hard disk is less than the first preset time and it is restored online, the credit value is subtracted from the preset step length, and the hard disk offline event is not reported.
[0098] Specifically, the first preset time is, for example, 2 seconds, 3 seconds or other values. If the offline time of the target hard disk is less than the first preset time, and the target hard disk has been restored online, it means that the target hard disk has been restored online soon after being offline, and there is no need to reconstruct the target hard disk, and the hard disk offline event is not reported. It is only necessary to modify the credit value of the link, which is the credit value minus the preset step length. For example, if the initial credit value of the disconnected link is 5, each time the credit value is modified, 5 is subtracted from 1, and the preset step length is 1; if the initial credit value of the disconnected link is 0, each time the credit value is modified, 0 is added to 1, and the preset step length is -1; the initial credit value and the preset step length are set according to actual needs.
[0099] Step S204: When the credit value is equal to a preset value, or the offline time of the target hard disk is greater than a first preset time, a hard disk offline event is reported.
[0100] Specifically, if the credit value is equal to the preset value, it means that the link has been disconnected multiple times and the target hard disk needs to be reconstructed. If the offline time of the target hard disk is greater than the first preset time, it means that the offline time of the target hard disk is too long and the target hard disk needs to be reconstructed. When the target hard disk needs to be reconstructed, the SAS driver will report the hard disk offline event to the SCSI protocol module to facilitate the subsequent hard disk reconstruction of the target hard disk.
[0101] The present embodiment provides a method for managing link disconnection. When a link is disconnected, the hard disk offline event is reported only when the credit value of the disconnected link is equal to a preset value, or the offline time of the target hard disk is greater than a first preset time, so as to facilitate the subsequent hard disk reconstruction of the target hard disk. When the link is disconnected with probability, the hard disk reconstruction is not triggered by mistake to avoid the degradation of storage performance, and a warning can be issued in time when the link failure is determined to avoid affecting the storage performance. The problem of hard disk reconstruction being triggered by mistake when the physical link is disconnected, resulting in the degradation of storage performance, is solved.
[0102] In some optional implementations, when receiving a message that a link is disconnected between the device expander and the hard disk, determining whether a target hard disk corresponding to the disconnected link is restored online includes:
[0103] In case of receiving the first broadcast event, determining that there is a link disconnection message between the device extender and the hard disk, wherein the first broadcast event is reported after the link is disconnected;
[0104] In the event of a disconnected link message, if a second broadcast event is received, it is determined that the target hard disk has resumed online, or, using preset instructions, the status information of the target hard disk is obtained, and it is determined whether the target hard disk has resumed online based on the status information, wherein the second broadcast event is reported after the target hard disk goes from offline to online.
[0105] Specifically, the SAS protocol includes the SMP protocol (SCSI Management Protocol), which is used to manage SAS devices in the SAS domain. Using the standard process of the SMP protocol, including SAS domain broadcast, SMPDiscover, etc., the SAS driver, namely SAS-INI (SAS initiator), can sense the offline and online status of the SAS hard disk (SAS-TGT) through SAS-EXP, including:
[0106] When the link between SAS-EXP and the hard disk is disconnected (link-down), SAS-EXP reports the first broadcast event (BroadCast event, BC event) in the SAS domain. After receiving the first broadcast event, the SAS driver sends an SMP command to SAS-EXP to confirm that there is a link disconnection message between the device expander and the hard disk.
[0107] If the disconnected link between SAS-EXP and the target hard disk is reconnected (link-up) within the first preset time, SAS-EXP reports the second broadcast event in the SAS domain. If the SAS driver receives the second broadcast event, it determines that the target hard disk is back online. Alternatively, the SAS driver uses a preset instruction to initiate the SMP Discover process, obtains the status information of the target hard disk through the SMPDiscover process, and determines whether the target hard disk is back online based on the status information.
[0108] In addition, the SAS driver can monitor the link status through steps A1 to A10 and determine whether the target hard disk is back online.
[0109] Step A1, traverse the SAS-EXP of the storage server, use ls-lh / dev / bsg / expander-* to obtain the number of SAS-EXPs of the storage server.
[0110] Step A2, use smp_discover to query the obtained SAS-EXP, and obtain the id, device type, and address of the hard disk managed by the SAS-EXP.
[0111] Step A3: query the hard disk error code information, change count and negotiation rate according to the obtained ID every five minutes. The error code information can be used to determine whether the target hard disk is back online. For example, if no error code indicating that the target hard disk is offline is obtained, it means that the current target hard disk is online.
[0112] Step A4: The error code information, Change Count and negotiation rate obtained for the first time are taken as initial values. If the error code information, Change Count and negotiation rate are changed compared with the last time or the initial value, the relevant information is recorded in the log.
[0113] Step A5: If the error code information and Change Count increase for five consecutive times, an alarm is issued.
[0114] Step A6: If the negotiated rate is less than 6 Gbps for five consecutive times, an alarm is issued.
[0115] Step A7, obtain the drive letter address according to the lsscsi-gt command, obtain the ID corresponding to the drive letter according to the drive letter address, and if there is a problem with the drive letter, record the ID and other information in the log.
[0116] Through the connection relationship between SAS-EXP and SAS card and hard disk, the SAS card link is monitored, and when the SAS card or hard disk is abnormal, an alarm can be given in time, and the abnormal state of the SAS card or hard disk can be recorded in the log. The present invention can ensure that when the storage server reads and writes data abnormally, it can be processed in time, thereby improving the reliability of the storage server reading data.
[0117] In this embodiment, the first broadcast event is used to determine whether there is a broken link; the second broadcast event or preset instructions are used to determine whether the target hard disk is back online, and the online and offline status of the hard disk is determined quickly and accurately, which facilitates the subsequent management of link disconnections.
[0118] In some optional implementations, before determining whether the target hard disk corresponding to the disconnected link is restored online, the method further includes:
[0119] Generate hard disk device table;
[0120] Obtaining initial credit values of a preset number of links and hard disk addresses of a preset number of hard disks, and filling the initial credit values and hard disk addresses into table entries corresponding to the hard disks in the hard disk device table;
[0121] Obtaining a first preset time of the link;
[0122] Adding a link timer for a preset number of links, wherein the link timer is used to determine whether the offline time is greater than a first preset time;
[0123] Configure cache space, where the cache space is used to save the read and write commands of the target hard disk when the target hard disk is offline.
[0124] Specifically, after the system is started, the SAS driver, as a SAS INI, can generate a hard disk device table through the SMP protocol, as shown in Table 1. Each table entry contains the credit value and hard disk address of each link. In addition, each table entry can also include: SAS-EXP address, link identifier (EXP-PHY ID), hard disk temporary offline mark, initial credit value -1 system tick, initial credit value exhausted system tick, etc.
[0125] Table 1 Hard disk device table
[0126]
[0127] Among them, the system tick of the initial credit value -1 is empty, indicating that the credit value of the link has not been deducted; the system tick of the initial credit value is empty, indicating that the credit value of the link has not been exhausted.
[0128] The preset number means multiple, without any specific quantity limit. The preset number of hard disks / links means all hard disks / links under the SAS drive. The SAS drive obtains the initial credit value of the preset number of links, for example: the initial credit value is set to 5 for each link. The SAS drive presets the hard disk addresses of the hard disks, for example: 0x5002538b741582b3, 0x5002538b741546yu, etc. Fill the initial credit value and hard disk address into the table entry corresponding to the hard disk in the hard disk device table. When the initial credit value of the link is exhausted, if the link where the hard disk is located is disconnected again at this time, the SAS drive immediately reports the hard disk offline event to the SCSI module.
[0129] The SAS driver obtains the first preset time of the link, such as 2 seconds, 3 seconds or other values. If the offline time of the target hard disk is less than the first preset time, it means that the target hard disk will be restored online soon after being offline. There is no need to reconstruct the target hard disk, and the hard disk offline event will not be reported. Only the credit value of the link needs to be modified. It should be noted that because the upper module of the SAS driver is a SCSI module, the first preset time cannot be greater than the minimum timeout time of the SCSI module for IO.
[0130] The SAS driver adds a link timer for a preset number of links. The link timer is, for example, a software timer (timer). The SAS link flash-off filtering time is set to determine whether the offline time of the hard disk is greater than a first preset time.
[0131] As SAS-INI, the SAS driver allocates a memory pool as cache space for the hard disks that belong to the same SAS domain. It is used to cache concurrent IO commands for the hard disk when the target hard disk is offline. It can also cache commands and data.
[0132] The above process is as follows Figure 3 As shown: system startup; SAS driver loading; adding SAS device table; initializing each hard disk SAS link disconnection timer according to the hard disk SAS address; applying for memory blocks for hard disk IO cache (shared by hard disks in the same SAS-INT); initializing hard disk List header; configuring hard disk SAS link credit value; configuring hard disk SAS link disconnection filter timer; configuring hard disk SAS link fault alarm time T-fault.
[0133] After completing the above operations of generating a hard disk device table, obtaining the first preset time of the link, adding link timers for a preset number of links, and configuring cache space, the process of managing link disconnection in this solution is as follows: Figure 4 As shown:
[0134] The SAS driver module (i.e., SAS driver) contains the IO cache list of hard disk 1, the IO cache list of hard disk 2, ..., and the IO cache list of hard disk N. The above lists are all stored in the hard disk 1~N cache in the SAS driver. The SAS driver also contains hard disk 1~N timers (link timers), which are used to determine whether the offline time of the hard disk is greater than the first preset time when the corresponding link is disconnected. In addition, the SAS driver also stores the above hard disk device table. It should be noted that for the convenience of demonstration, Figure 4 The hard disk device table in Table 1 is obtained by deleting Table 1. In actual use, the two are the same, and the items in the hard disk device table can be modified according to actual needs. Expander is connected to hard disk 1 to hard disk N through a physical link (PHY). If PHY is disconnected, Expander reports a broadcast event, and the SAS driver module can determine the online status of the hard disk through the SMP-Discover command. The SAS driver module can feedback IO response / hard disk offline / hard disk online information to the SCSI module.
[0135] In this implementation, a hard disk device table is generated, a first preset time of a link is obtained, link timers are added for a preset number of links, and a cache space is configured, so as to facilitate subsequent management of link disconnections.
[0136] In some optional embodiments, the method further comprises:
[0137] When the target hard disk is offline, a link timer for disconnecting the link is started;
[0138] When the link timer reaches a first preset time, determining whether there is an offline mark in a target table entry corresponding to the target hard disk in the hard disk device table;
[0139] If so, it is determined that the offline time is greater than the first preset time.
[0140] Specifically, combined Figure 5 This embodiment is described as follows: the SAS driver receives the BC event sent by EXP and determines that the link is disconnected; the SAS driver sends an SMP command to EXP to obtain its SAS device table (i.e., hard disk device table). The SAS driver determines whether the hard disk (i.e., the target hard disk) is online. If the target hard disk is not online, i.e., the target hard disk is offline, it determines whether the credit value of the link is equal to a preset value. For example, if the preset value is 0, the SAS driver determines whether the credit value of the SAS link (i.e., the link) is 0. If the credit value is not equal to the preset value, the SAS driver starts the link timer of the hard disk SAS, i.e., the link is disconnected.
[0141] When the link timer reaches the first preset time, that is, the timing time has arrived, determine whether the hard disk is temporarily offline The mark is set, that is, determine whether there is an offline mark in the target table item corresponding to the target hard disk in the hard disk device table; if it exists, it is determined that the offline time is greater than the first preset time, and it is necessary to report the SCSI hard disk offline subsequently, that is, report the hard disk offline event; if it does not exist, the offline time is not greater than the first preset time, and reset the link timer to the initial state.
[0142] In some optional embodiments, the method further comprises:
[0143] When the target hard disk is restored to online, determine whether the target hard disk is a new hard disk. If it is a new hard disk, execute the new hard disk initialization process; if it is not a new hard disk, determine whether the offline time consumed by the target hard disk to be restored from offline to online is greater than a first preset time;
[0144] When the offline time is greater than the first preset time, the step of reporting the hard disk offline event is executed; when the offline time of the target hard disk is less than the first preset time, the step of subtracting the preset step length from the credit value is executed, and the step of not reporting the hard disk offline event is executed.
[0145] Specifically, combined Figure 6 This embodiment is described as follows: the SAS driver receives the BC event sent by EXP and determines that the link is disconnected; the SAS driver sends an SMP command to EXP to obtain its SAS device table (i.e., hard disk device table). The SAS driver determines whether the hard disk (i.e., the target hard disk) is online. If the target hard disk is back online, the SAS driver searches the hard disk device table for the entry corresponding to the hard disk temporary offline flag setting according to the hard disk address of the target hard disk. If this entry does not exist, it is determined that the target hard disk is a new hard disk. If it is a new hard disk, the new hard disk initialization process is executed.
[0146] If this entry exists, it is not a new hard disk. It is determined whether the offline time consumed by the target hard disk to recover from offline to online is greater than the first preset time. The determination method is, for example: determining the value of the link timer, determining whether the link timer is in the initialized state, etc.
[0147] When the offline time is greater than the first preset time, it means that the offline event of the target hard disk is too long, and the step of reporting the hard disk offline event is executed. When the offline time of the target hard disk is less than the first preset time, it means that the target hard disk is quickly restored online after being offline, and there is no need to reconstruct the target hard disk, and the hard disk offline event is not reported. It only needs to modify the credit value of the disconnected link, that is, the credit value minus the preset step length is executed, and the step of not reporting the hard disk offline event is executed.
[0148] In some optional implementations, determining whether the offline time consumed by the target hard disk to be restored from offline to online is greater than a first preset time includes:
[0149] Get the timer status of the link timer in the target hard disk;
[0150] According to the timer state, determine whether the link timer is in the initialization state, and if so, determine that the offline time is greater than a first preset time, wherein the link timer is set to the initialization state after reaching the first preset time.
[0151] Specifically, combined Figure 6 This embodiment is described as follows: the SAS driver determines that there is a table entry corresponding to the temporary offline mark of the hard disk, and determines that the target hard disk is online and is not a new hard disk. The SAS driver determines whether the link timer is in the initial state, and the steps include: obtaining the timer state of the link timer in the target hard disk; according to the timer state, determining whether the link timer is in the initialization state, if so, determining that the offline time is greater than the first preset time, wherein the link timer is set to the initialization state after reaching the first preset time.
[0152] It should be noted that if Figure 5 As shown, judging whether the hard disk is temporarily offline marked or not is to judge whether there is an offline mark in the target table item corresponding to the target hard disk in the hard disk device table; if not, the offline time is not greater than the first preset time, and the link timer is reset to the initial state. It can be seen that if the target hard disk is not a new hard disk and the link timer is in the initial state, it means that the target hard disk is offline for no more than the first preset time.
[0153] In some optional embodiments, the method further comprises:
[0154] When the target hard disk is offline and the credit value is not equal to the preset value, query the target table entry of the target hard disk according to the hard disk address;
[0155] In the target table entry, fill in the offline flag of the target hard disk.
[0156] Specifically, combined Figure 5 This embodiment is described as follows: when the SAS driver determines that the target hard disk is offline and the credit value is not equal to the preset value, after starting the hard disk SAS link timer, the hard disk temporary offline flag is set, and the steps include: querying the target table item of the target hard disk according to the hard disk address, wherein the hard disk address is assigned at the factory and the hard disk addresses of different hard disks are different. In the target table item, the offline flag of the target hard disk is filled in, and the offline flag is, for example, 0xAA in Table 1.
[0157] In some optional implementations, after filling in the offline mark of the target hard disk, the method further includes:
[0158] If a read or write command of the target hard disk is received, the command cache list is queried in the cache space according to the hard disk address of the target hard disk;
[0159] Write read and write commands into the command cache list;
[0160] After subtracting the preset step size from the credit value, the method further includes:
[0161] Get the read and write commands of the target hard disk in the command cache list;
[0162] Send read and write commands to the target hard disk.
[0163] Specifically, after filling in the offline mark of the target hard disk, if the SAS driver receives an IO command (read or write command) sent by the SCSI module, the SAS driver will apply for memory in the cache space, find the command cache list of the target hard disk in the cache space according to the hard disk address of the target hard disk, and write the received read or write command into the command cache list for storage. Figure 5 As shown, it is determined whether there is IO at this time. If yes, insert the IO into the hard disk cache list. If not, exit. In addition, if it is determined that the SAS link credit value is 0, directly report that the SCSI hard disk is offline.
[0164] After the SAS driver finds that the target hard disk is back online and subtracts a preset step length from the credit value, it resends the previously intercepted read and write commands to the target hard disk, the steps including: obtaining the read and write commands of the target hard disk in the command cache list; and sending the read and write commands to the target hard disk.
[0165] In this embodiment, when the target hard disk is offline, its read and write commands are intercepted and saved in a command cache list in the cache space. When the target hard disk is back online and the preset step length is subtracted, the read and write commands are resent to the target hard disk to prevent the target hard disk from missing the read and write commands or executing the read and write commands incorrectly.
[0166] In some optional implementations, after subtracting the preset step size from the credit value, the method further includes:
[0167] If the credit value minus the preset step length equals the preset value, then obtaining the credit value exhaustion time for the credit value of the disconnected link to change from the initial credit value to the preset value;
[0168] Determining whether the credit value depletion time is less than a second preset time;
[0169] If the credit value exhaustion time is less than the second preset time, a link failure warning is reported.
[0170] Specifically, the preset value is equal to 0 and the preset step size is equal to 1. Figure 6To illustrate this embodiment: After the SAS driver determines that the link timer is not in the initial state, if the credit value is not 0, the credit value is decremented by 1 and the system tick in the SAS device table (i.e., hard disk device table) is updated according to the credit value. As shown in Table 1, the hard disk address is 0x5002538b741582b3, and the recorded system tick of the initial credit value -1 is 1000. If the credit value is decremented by 1 and the credit value is equal to 0, the SAS driver will obtain the credit value exhaustion time for the credit value of the disconnected link to change from the initial credit value to the preset value. The system tick can be recorded in the hard disk device table.
[0171] The hard disk link alarm time (T-fault), that is, the second preset time, can be set when generating the hardware table, for example: 10 minutes, 15 minutes, etc.
[0172] If the credit value exhaustion time is less than the second preset time, it means that the credit value of the disconnected link is exhausted within the link alarm time, and it is determined that the disconnected link has a fault, and a link fault warning is reported.
[0173] In this embodiment, if the credit value exhaustion time is less than the second preset time, it means that the link where the target hard disk is located is disconnected multiple times within the second preset time, and it is determined that the disconnected link has a fault, and a link fault warning is reported to distinguish between continuous faults and discrete faults, so as to achieve accurate alarm.
[0174] In some optional implementations, obtaining the credit value exhaustion time for the credit value of the disconnected link to change from the initial credit value to the preset value includes:
[0175] In the hard disk device table, a first system time base when the credit value of the disconnected link is first modified and a second system time base when the credit value of the disconnected link becomes a preset value are obtained;
[0176] The credit value depletion time is determined according to the difference between the first system time base and the second system time base.
[0177] Specifically, a first system tick when the credit value of the disconnected link is modified for the first time and a second system tick when the credit value of the disconnected link becomes a preset value are obtained. The first system tick is, for example, a system tick of the initial credit value -1 in Table 1 is obtained, and the first system tick is, for example, 1000; the second system tick is, for example, a system tick of the initial credit value exhausted in Table 1 is obtained, and the second system tick is, for example, 50000.
[0178] Calculate the difference between the first system time base and the second system time base, for example: 50000-1000=49000. Calculate the credit value exhaustion time based on the correspondence and difference between the system time base and the accurate time, for example: 1 tick corresponds to 5 milliseconds, then 49000 corresponds to 245000 milliseconds, and the credit value exhaustion time is 245000 milliseconds.
[0179] In addition, after the SAS driver updates the system tick in the SAS device table (i.e., hard disk device table) according to the credit value, it resets the timer to the initial state, resets the hard disk temporary offline mark to the initial state, extracts IO commands / data from the hard disk cache list, and sends them to the target hard disk.
[0180] In some optional implementations, after determining whether the credit value depletion time is less than a second preset time, the method further includes:
[0181] If the credit value exhaustion time is greater than or equal to a second preset time, starting a link timer in the target hard disk;
[0182] When the link timer reaches a third preset time, determining whether a first broadcast event is received;
[0183] If received, the credit value will not be modified and the hard disk offline event will be reported;
[0184] If not received, the credit value is increased by a preset step size.
[0185] Specifically, combined Figure 6 To illustrate this embodiment, if the credit exhaustion time is less than the hard disk link alarm time, ie, the second preset time, the SAS starts the hard disk link alarm time timer, ie, the link timer.
[0186] The third preset time may be the same as or different from the second preset time. For example, the third preset time is 10 seconds, 15 seconds, 18 seconds, etc.
[0187] When the timing time is reached, that is, the link timer reaches the third preset time, it is determined whether there is a hard disk offline event during the period, that is, whether the first broadcast event is received again, indicating that the target hard disk is offline again during the timing period. If the first broadcast event is received again, the credit value of this hard disk link remains unchanged, and the SCSI hard disk offline event is reported. If the first broadcast event is not received, the credit value is increased by a preset step length, for example: the preset step length is 1, the credit value of the link where the target hard disk is located + 1, and the maximum credit value is the initial credit value.
[0188] In this embodiment, when the credit value exhaustion time is greater than or equal to the second preset time, if the first broadcast event is not received again, the preset step length is increased for the credit value, and a mechanism for increasing the credit value is designed so that the credit value can accurately reflect the situation of the target hard disk and the disconnected link, and will not mistakenly trigger the hard disk reconstruction to avoid storage performance degradation, and can also issue a timely warning when a link failure is determined to avoid affecting storage performance.
[0189] In some optional implementations, executing a new hard disk initialization process includes:
[0190] Generate a new entry for the new hard disk in the hard disk device table;
[0191] Obtain the initial credit value of the new link corresponding to the new hard disk and the hard disk address of the new hard disk, and fill the initial credit value of the new link and the hard disk address of the new hard disk into the new table entry;
[0192] Obtaining a first preset time of a new link;
[0193] Add link timer in new hard disk;
[0194] Configure the cache space corresponding to the new hard disk.
[0195] Specifically, when a new hard disk is connected, a new table entry for the new hard disk is generated in the hard disk device table. The SAS driver assigns an initial credit value to each PHY link between the new hard disk and the Expander for default penalty. The SAS driver determines the hard disk address of the new hard disk and fills the initial credit value of the new link and the hard disk address of the new hard disk into the new table entry.
[0196] Consistent with the above-mentioned embodiment, after the system is started, the SAS driver generates a hard disk device table for all hard disks, obtains the first preset time of the link, adds link timers for a preset number of links, and configures cache space. The SAS driver also needs to obtain the first preset time of the new link, add a link timer to the new hard disk, and configure the cache space corresponding to the new hard disk.
[0197] In addition, during system operation, if a new hard disk is inserted or an old hard disk is removed, it is necessary to continue to add or delete entries in the hard disk device table. For example, when "Hard Disk 1" is removed from the "link between SAS-EXP and SAS Hard Disk 1" and "Hard Disk 1#" is inserted, the SAS driver updates the hard disk device table and assigns an initial credit value to "Hard Disk 1#".
[0198] In some optional implementations, after reporting the hard disk offline event, the method further includes:
[0199] In the cache space, a command cache list is obtained according to the hard disk address of the target hard disk, and the read and write commands of the target hard disk in the command cache list are deleted;
[0200] According to the hard disk address of the target hard disk, the target table entry corresponding to the target hard disk is obtained from the hard disk device table, and the target table entry is deleted;
[0201] Initialize the link timer in the target hard disk.
[0202] Specifically, after reporting the hard disk offline event, the IO cache of the target hard disk is cleared in the cache space, and the steps are: querying and obtaining a command cache list according to the hard disk address of the target hard disk, and deleting the read and write commands of the target hard disk in the command cache list.
[0203] The target hard disk is cleared from the hard disk device table, and the steps are: according to the hard disk address of the target hard disk, the target table item corresponding to the target hard disk is searched in the hard disk device table, and the target table item is deleted.
[0204] Resetting the target hard disk timer is to initialize the link timer in the target hard disk.
[0205] The above content is as follows Figure 5 or Figure 6 As shown, after determining that the offline time is greater than the first preset time, the SAS driver will report that the SCSI hard disk is offline (ie, a hard disk offline event), update the hard disk device table, and delete the table entry where the hard disk is located.
[0206] In this embodiment, after reporting the hard disk offline event, the read and write commands of the target hard disk are deleted from the command cache list, the target table entry corresponding to the target hard disk is deleted, and the link timer is initialized to facilitate subsequent hard disk reconstruction of the target hard disk.
[0207] In this embodiment, a link flash management device is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0208] This embodiment provides a link disconnection management device, such as Figure 7 As shown, including:
[0209] The first determination module 701 is used to determine whether a target hard disk corresponding to the disconnected link is restored online when receiving a message that a link is disconnected between the device expander and the hard disk, wherein the device expander is connected to a preset number of hard disks through a preset number of links, and the target hard disk is included in the preset number of hard disks;
[0210] The first acquisition module 702 is used to acquire the credit value of the disconnected link when the target hard disk is offline, and if the credit value is not equal to a preset value, determine the offline time of the target hard disk;
[0211] A modification module 703 is used for, when the offline time of the target hard disk is less than the first preset time and the target hard disk is restored online, subtracting the preset step length from the credit value and not reporting the hard disk offline event;
[0212] The first reporting module 704 is used to report a hard disk offline event when the credit value is equal to a preset value or the offline time of the target hard disk is greater than a first preset time.
[0213] In some optional implementations, when receiving a message that a link is disconnected between the device extender and the hard disk, the first determining module 701 determines whether a target hard disk corresponding to the disconnected link is restored online, including:
[0214] In case of receiving the first broadcast event, determining that there is a link disconnection message between the device extender and the hard disk, wherein the first broadcast event is reported after the link is disconnected;
[0215] In the event of a disconnected link message, if a second broadcast event is received, it is determined that the target hard disk has resumed online, or, using preset instructions, the status information of the target hard disk is obtained, and it is determined whether the target hard disk has resumed online based on the status information, wherein the second broadcast event is reported after the target hard disk goes from offline to online.
[0216] In some optional implementations, before the first determining module 701 determines whether the target hard disk corresponding to the disconnected link is restored online, the method further includes:
[0217] Generate hard disk device table;
[0218] Obtaining initial credit values of a preset number of links and hard disk addresses of a preset number of hard disks, and filling the initial credit values and hard disk addresses into table entries corresponding to the hard disks in the hard disk device table;
[0219] Obtaining a first preset time of the link;
[0220] Adding a link timer for a preset number of links, wherein the link timer is used to determine whether the offline time is greater than a first preset time;
[0221] Configure cache space, where the cache space is used to save the read and write commands of the target hard disk when the target hard disk is offline.
[0222] In some optional embodiments, the device further comprises:
[0223] A start module, used for starting a link timer for disconnecting a link when a target hard disk is offline;
[0224] A first judgment module is used to judge whether there is an offline mark in the target table entry corresponding to the target hard disk in the hard disk device table when the link timer reaches a first preset time;
[0225] The second determining module is used to determine if the offline time is greater than the first preset time, if any.
[0226] In some optional embodiments, the device further comprises:
[0227] The second judgment module is used to judge whether the target hard disk is a new hard disk when the target hard disk is restored online, and if it is a new hard disk, execute the new hard disk initialization process; if it is not a new hard disk, judge whether the offline time consumed by the target hard disk to be restored from offline to online is greater than a first preset time;
[0228] The execution module is used to execute the step of reporting the hard disk offline event when the offline time is greater than the first preset time; when the offline time of the target hard disk is less than the first preset time, execute the step of subtracting the preset step length from the credit value and not reporting the hard disk offline event.
[0229] In some optional implementations, the second determination module determines whether the offline time consumed by the target hard disk to be restored from offline to online is greater than the first preset time, including:
[0230] Get the timer status of the link timer in the target hard disk;
[0231] According to the timer state, determine whether the link timer is in the initialization state, and if so, determine that the offline time is greater than a first preset time, wherein the link timer is set to the initialization state after reaching the first preset time.
[0232] In some optional embodiments, the device further comprises:
[0233] A first query module, used for querying a target table entry of a target hard disk according to a hard disk address when the target hard disk is offline and the credit value is not equal to a preset value;
[0234] The filling module is used to fill in the offline mark of the target hard disk in the target table item.
[0235] In some optional embodiments, the device further comprises:
[0236] A second query module is used to query a command cache list in the cache space according to the hard disk address of the target hard disk if a read or write command of the target hard disk is received;
[0237] The write module is used to write read and write commands into the command cache list.
[0238] In some optional embodiments, the device further comprises:
[0239] A second acquisition module is used to acquire the read and write commands of the target hard disk in the command cache list;
[0240] The sending module is used to send the read and write commands to the target hard disk.
[0241] In some optional embodiments, the device further comprises:
[0242] A third acquisition module is used to acquire the credit value exhaustion time for the credit value of the disconnected link to change from the initial credit value to the preset value if the credit value minus the preset step length is equal to the preset value;
[0243] A third judgment module, used to judge whether the credit value depletion time is less than a second preset time;
[0244] The second reporting module is used to report a link failure warning if the credit value exhaustion time is less than a second preset time.
[0245] In some optional implementations, the third acquisition module acquires the credit value exhaustion time for the credit value of the disconnected link to change from the initial credit value to the preset value, including:
[0246] In the hard disk device table, a first system time base when the credit value of the disconnected link is first modified and a second system time base when the credit value of the disconnected link becomes a preset value are obtained;
[0247] The credit value depletion time is determined according to the difference between the first system time base and the second system time base.
[0248] In some optional embodiments, the device further comprises:
[0249] A start module, configured to start a link timer in the target hard disk if the credit value exhaustion time is greater than or equal to a second preset time;
[0250] A fourth determination module, configured to determine whether a first broadcast event is received when the link timer reaches a third preset time;
[0251] A third reporting module, configured to, if received, not modify the credit value and report the hard disk offline event;
[0252] An increasing module is used to increase the credit value by a preset step if it is not received.
[0253] In some optional implementations, the second determination module executes a new hard disk initialization process, including:
[0254] Generate a new entry for the new hard disk in the hard disk device table;
[0255] Obtain the initial credit value of the new link corresponding to the new hard disk and the hard disk address of the new hard disk, and fill the initial credit value of the new link and the hard disk address of the new hard disk into the new table entry;
[0256] Obtaining a first preset time of a new link;
[0257] Add link timer in new hard disk;
[0258] Configure the cache space corresponding to the new hard disk.
[0259] In some optional embodiments, the device further comprises:
[0260] A third query module is used to query the command cache list in the cache space according to the hard disk address of the target hard disk, and delete the read and write commands of the target hard disk in the command cache list;
[0261] The fourth query module is used to query the hard disk device table to obtain the target table item corresponding to the target hard disk according to the hard disk address of the target hard disk, and delete the target table item;
[0262] The initialization processing module is used to initialize the link timer in the target hard disk.
[0263] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0264] The link disconnection management device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0265] The embodiment of the present invention also provides a computer device having the above Figure 7 The management device for link flash failure is shown.
[0266] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.
[0267] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0268] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0269] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0270] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0271] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0272] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0273] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0274] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for managing link disconnection, characterized in that: The method comprises: Obtaining initial credit values of a preset number of links, wherein the device extender is connected to a preset number of hard disks via a preset number of the links; Obtaining a first preset time of the link; Adding link timers for a preset number of the links; In case of receiving a message that a link is disconnected between the device expander and the hard disk, determining whether a target hard disk corresponding to the disconnected link is restored online, wherein the target hard disk is included in a preset number of the hard disks; The step of determining whether a target hard disk corresponding to the disconnected link is restored online when receiving a message that a link is disconnected between the device extender and the hard disk comprises: In case of receiving a first broadcast event, determining that the link disconnection message exists between the device extender and the hard disk, wherein the first broadcast event is reported after the link is disconnected; In the case where the link disconnection message exists, if a second broadcast event is received, it is determined that the target hard disk is restored online, or, using a preset instruction, the status information of the target hard disk is obtained, and whether the target hard disk is restored online is determined according to the status information, wherein the second broadcast event is reported after the target hard disk is brought online from offline; In the case where the target hard disk is offline, obtaining the credit value of the disconnected link, and if the credit value is not equal to a preset value, determining the offline time of the target hard disk, wherein the link timer is used to determine whether the offline time is greater than the first preset time; If the offline time of the target hard disk is less than the first preset time and the target hard disk is restored online, the credit value is deducted from the preset step length, and the hard disk offline event is not reported; If the credit value minus the preset step length equals the preset value, obtaining the credit value exhaustion time for the credit value of the disconnected link to change from the initial credit value to the preset value; Determining whether the credit value depletion time is less than a second preset time; If the credit value exhaustion time is less than the second preset time, reporting a link failure warning; If the credit value exhaustion time is greater than or equal to the second preset time, starting the link timer in the target hard disk; When the link timer reaches a third preset time, determining whether a first broadcast event is received; If received, the credit value is not modified, and the hard disk offline event is reported; If not received, increasing the credit value by a preset step size; When the credit value is equal to a preset value, or the offline time of the target hard disk is greater than a first preset time, reporting a hard disk offline event; In the case where the target hard disk is restored to online, determining whether the target hard disk is a new hard disk, and if so, executing a new hard disk initialization process; if not, determining whether the offline time consumed by the target hard disk to be restored from offline to online is greater than the first preset time; When the offline time is greater than the first preset time, the step of reporting the hard disk offline event is performed; when the offline time of the target hard disk is less than the first preset time, the step of subtracting the preset step length from the credit value and not reporting the hard disk offline event is performed; The determining whether the offline time consumed by the target hard disk to recover from offline to online is greater than the first preset time includes: obtaining the timer status of the link timer in the target hard disk; determining whether the link timer is in an initialization state according to the timer status, and if so, determining that the offline time is greater than the first preset time, wherein the link timer is set to the initialization state after reaching the first preset time.
2. The method according to claim 1, characterized in that: Before determining whether the target hard disk corresponding to the disconnected link is restored online, the method further includes: Generate hard disk device table; Obtaining hard disk addresses of a preset number of the hard disks, and filling the initial credit value and the hard disk address into the table entry corresponding to the hard disk in the hard disk device table; A cache space is configured, wherein the cache space is used to store read and write commands of the target hard disk when the target hard disk is offline.
3. The method according to claim 2, characterized in that The method further comprises: When the target hard disk is offline, starting the link timer of the disconnected link; When the link timer reaches the first preset time, determining whether a target table entry corresponding to the target hard disk in the hard disk device table has an offline mark; If so, it is determined that the offline time is greater than the first preset time.
4. The method according to claim 2, characterized in that: The method further comprises: When the target hard disk is offline and the credit value is not equal to the preset value, querying the target table entry of the target hard disk according to the hard disk address; In the target table entry, fill in the offline mark of the target hard disk.
5. The method according to claim 4, characterized in that After filling in the offline mark of the target hard disk, the method further includes: If the read / write command of the target hard disk is received, querying a command cache list in the cache space according to the hard disk address of the target hard disk; Writing the read and write commands into the command cache list; After the credit value is subtracted from the preset step length, the method further includes: Acquire the read and write commands of the target hard disk in the command cache list; The read and write commands are sent to the target hard disk.
6. The method according to claim 2, characterized in that The obtaining of the credit value exhaustion time for the disconnected link credit value to change from the initial credit value to the preset value includes: In the hard disk device table, a first system time base when the credit value of the disconnected link is first modified and a second system time base when the credit value of the disconnected link becomes the preset value are obtained; The credit value depletion time is determined according to a difference between the first system time base and the second system time base.
7. The method according to claim 2, characterized in that The process of executing the new hard disk initialization includes: Generate a new entry for the new hard disk in the hard disk device table; Acquire an initial credit value of a new link corresponding to the new hard disk and a hard disk address of the new hard disk, and fill the initial credit value of the new link and the hard disk address of the new hard disk into the new table entry; Acquire the first preset time of the new link; Adding the link timer in the new hard disk; The cache space corresponding to the new hard disk is configured.
8. The method according to claim 2, characterized in that: After reporting the hard disk offline event, the method further includes: In the cache space, querying and obtaining a command cache list according to the hard disk address of the target hard disk, and deleting the read and write commands of the target hard disk in the command cache list; According to the hard disk address of the target hard disk, query the hard disk device table to obtain the target table entry corresponding to the target hard disk, and delete the target table entry; Initialize the link timer in the target hard disk.
9. A link disconnection management device, characterized in that: The device comprises: Obtaining initial credit values of a preset number of links, wherein the device extender is connected to a preset number of hard disks via a preset number of the links; Obtaining a first preset time of the link; Adding link timers for a preset number of the links; A first determination module is used to determine whether a target hard disk corresponding to the disconnected link is restored online when receiving a message that a link is disconnected between the device expander and the hard disk, wherein the target hard disk is included in a preset number of the hard disks; The first determination module determines whether the target hard disk corresponding to the disconnected link is restored online when receiving a message that a link is disconnected between the device expander and the hard disk, including: In case of receiving a first broadcast event, determining that the link disconnection message exists between the device extender and the hard disk, wherein the first broadcast event is reported after the link is disconnected; In the case where the link disconnection message exists, if a second broadcast event is received, it is determined that the target hard disk is restored online, or, using a preset instruction, the status information of the target hard disk is obtained, and whether the target hard disk is restored online is determined according to the status information, wherein the second broadcast event is reported after the target hard disk is brought online from offline; A first acquisition module is used to acquire the credit value of the disconnected link when the target hard disk is offline, and if the credit value is not equal to a preset value, determine the offline time of the target hard disk, wherein the link timer is used to determine whether the offline time is greater than the first preset time; a modification module, configured to, when the offline time of the target hard disk is less than the first preset time and the target hard disk is restored online, subtract a preset step length from the credit value and not report the hard disk offline event; If the credit value minus the preset step length equals the preset value, obtaining the credit value exhaustion time for the credit value of the disconnected link to change from the initial credit value to the preset value; Determining whether the credit value depletion time is less than a second preset time; If the credit value exhaustion time is less than the second preset time, reporting a link failure warning; If the credit value exhaustion time is greater than or equal to the second preset time, starting the link timer in the target hard disk; When the link timer reaches a third preset time, determining whether a first broadcast event is received; If received, the credit value is not modified, and the hard disk offline event is reported; If not received, increasing the credit value by a preset step size; A first reporting module, configured to report a hard disk offline event when the credit value is equal to a preset value or when the offline time of the target hard disk is greater than a first preset time; In the case where the target hard disk is restored to online, determining whether the target hard disk is a new hard disk, and if so, executing a new hard disk initialization process; if not, determining whether the offline time consumed by the target hard disk to be restored from offline to online is greater than the first preset time; When the offline time is greater than the first preset time, the step of reporting the hard disk offline event is performed; when the offline time of the target hard disk is less than the first preset time, the step of subtracting the preset step length from the credit value and not reporting the hard disk offline event is performed; The determining whether the offline time consumed by the target hard disk to recover from offline to online is greater than the first preset time includes: obtaining the timer status of the link timer in the target hard disk; determining whether the link timer is in an initialization state according to the timer status, and if so, determining that the offline time is greater than the first preset time, wherein the link timer is set to the initialization state after reaching the first preset time.
10. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the link disconnection management method according to any one of claims 1 to 8 by executing the computer instructions.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the link disconnection management method according to any one of claims 1 to 8.
