A method and related apparatus for power down handling of a raid card

CN115904231BActive Publication Date: 2026-09-15XFUSION DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211397682.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-09
Publication Date
2026-09-15
Estimated Expiration
2042-11-09

AI Technical Summary

Technical Problem

在目前的整机掉电处理方式中,会存在因RAID卡备电失败而导致缓存数据丢失的风险

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115904231B_ABST
    Figure CN115904231B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a RAID card power-off processing method and related device, applied to a redundant array of independent disks (RAID) card, and the RAID card is arranged in an electronic device. The method comprises: receiving a whole machine backup power instruction, the whole machine backup power instruction being used to indicate that the electronic device enters a whole machine backup power state; in response to the whole machine backup power instruction, identifying a write cache mode of a virtual disk group (VD) managed by the RAID card; if there is a target VD with a write back mode, switching the write cache mode of the target VD to a write through mode, and performing disk writing processing on write data related to the target VD in a double rate cache. It can be seen that in the method, the RAID card can know that the electronic device enters the whole machine backup power state, so that the cache data of the RAID card is written to the disk when the electronic device enters the whole machine backup power state, thereby reducing the risk of cache data loss caused by backup power failure after the RAID card enters the backup power state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computing device technology, and in particular to a method and apparatus for handling power loss of a RAID card. Background Technology

[0002] The big data industry is booming, with data volumes increasing rapidly across various sectors (such as the internet, finance, and logistics). This has led to a year-on-year increase in demand for servers. Servers support the core business operations of numerous clients, and with a massive number of servers running concurrently on the network, a sudden power outage can directly damage client businesses. Therefore, servers are typically equipped with backup power supplies to maintain normal business operations during power outages.

[0003] However, when the server enters a full-system power standby state, the Redundant Arrays of Independent Disks (RAID) card will maintain its previous operating mode and state until the server's power standby ends. Once the server's power standby ends, since the server has no power input, it cannot supply power to the RAID card. At this point, the RAID card will enter a standby state for appropriate power loss protection. In the current system-wide power loss handling method, there is a risk of data loss due to RAID card power standby failure. Summary of the Invention

[0004] This application provides a method and related apparatus for handling power loss of a RAID card, which can reduce the risk of RAID card power failure to a certain extent, thereby reducing the risk of cached data loss.

[0005] In a first aspect, embodiments of this application provide a RAID card power-down handling method. This method is applied to a redundant disk array (RAID) card, which is located in an electronic device. The method includes:

[0006] Receive the whole machine backup power command, which indicates that the electronic equipment has entered the whole machine backup power state;

[0007] In response to the system's backup power command, the write cache mode of the virtual disk group managed by the RAID card is identified;

[0008] If a target virtual disk group exists with write-back mode, then switch the write cache mode of the target virtual disk group to write-through mode;

[0009] Write data related to the target virtual disk group in the Double Rate Cache (DDR) is written to disk.

[0010] As can be seen, in this embodiment, the RAID card, by receiving a power-back command, can detect that the electronic device has entered a power-back state. Therefore, when the electronic device enters this state, the RAID card performs power-down caching on the virtual disk group (Virtual Drive, VD) managed by the RAID card. This avoids the risk of data loss due to RAID card power-back failure after the power-back process has concluded.

[0011] In one embodiment, identifying the write caching mode of the virtual disk group managed by the RAID card includes:

[0012] Invoke the view command, which is used to view the write cache mode of the virtual disk group managed by the RAID card;

[0013] Output the write cache mode of the virtual disk group managed by the RAID card.

[0014] In this technical solution, the RAID card can output the write cache mode of the VD managed by the RAID card by calling the view command, so that the user can clearly know the write cache mode of each VD managed by the RAID card.

[0015] In one embodiment, the method further includes:

[0016] Once it is confirmed that the write operation of data in the DDR cache has been completed, the RAID card is powered down.

[0017] This technical solution ensures that the RAID card performs power-down caching on all write data before entering the power-down state, thereby preventing data loss.

[0018] In one embodiment, the method further includes:

[0019] If there is no target virtual disk group with write-back mode in write cache mode, and / or the write data in DDR cache has been written to disk, then the RAID card will be controlled to enter the power-down state after the entire electronic device has completed its backup power supply.

[0020] In this technical solution, the RAID card can follow the electronic device into a power-down state after the entire electronic device has completed its power-up process, without needing to enter the power-up process itself, thereby shortening the overall power-up time of the electronic device.

[0021] In one embodiment, the method further includes:

[0022] If it is determined that there is no write data in the RAID card's DDR cache, then the write data in the DDR cache has been successfully written to disk.

[0023] In this technical solution, the RAID card can accurately determine whether the write data in the DDR cache has been completely written to disk by checking if there is still write data in the DDR cache. This avoids the risk of data loss in the DDR cache due to misjudging that the write data in the DDR cache has been completely written to disk and then controlling the RAID card to enter the power-down state.

[0024] In one embodiment, the system backup power command is generated when the host detects that the function of sending system backup power commands to the RAID card has been enabled, and the function of sending system backup power commands to the RAID card can be configured through a user interface.

[0025] In one embodiment, the backup power command is generated when the electronic device detects that it is powered by a backup power source, or when the power outage time specified in the power outage schedule arrives, or when a power outage operation is received.

[0026] In one embodiment, the method further includes:

[0027] If there is no write data in the DDR cache, a power failure notification is sent to the host side of the electronic device, and the connection with the motherboard power supply is disconnected. The power failure notification is used to trigger the host side of the electronic device to control the motherboard power supply to the RAID card after a preset time.

[0028] If the motherboard power is detected after a preset time, it is determined whether the supercapacitor is in an abnormal state.

[0029] If it is determined that the supercapacitor is in an abnormal state, then the supercapacitor is subjected to abnormal handling, which is used to resolve the abnormal state of the supercapacitor.

[0030] Secondly, embodiments of this application provide a RAID card power-down processing device, which is applied to a redundant disk array (RAID) card. The RAID card is disposed in an electronic device, and the device includes:

[0031] The receiving unit is used to receive the backup power command of the whole machine, which is used to indicate that the electronic equipment has entered the backup power state.

[0032] The processing unit is used to respond to the power backup command of the whole machine and identify the write cache mode of the virtual disk group managed by the RAID card;

[0033] The processing unit is also configured to switch the write cache mode of the target virtual disk group to write-through mode if there is a target virtual disk group whose write cache mode is write-back mode.

[0034] The processing unit is also used to write write data related to the target virtual disk group in the double-rate cache (DDR cache) to disk.

[0035] In this regard, the optional implementation of the RAID card power-down handling device can be found in the relevant content of the first aspect above, and will not be described in detail here.

[0036] Thirdly, this application provides a RAID card, which includes: a command recognition module, a virtual disk group control module, and a double-rate cache module; wherein, the command recognition module is used to recognize commands from the host side of the electronic device, the virtual disk group control module is used to control or change the write cache mode of the virtual disk group managed by the RAID card, and the double-rate cache (DDR Cache) module is used to write the data in the double-rate cache to disk.

[0037] Fourthly, embodiments of this application provide an electronic device, which includes: a host side and a redundant disk array (RAID) card. The host side is used to send a backup power command to the redundant disk array (RAID) card via a RAID card driver. The RAID card is used to execute the method described in the first aspect above.

[0038] Fifthly, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program including program instructions that, when executed by a redundant disk array (RAID) card, implement the method described in the first aspect above.

[0039] Sixthly, this application also provides a computer program product that, when executed by a redundant disk array (RAID) card, implements the method described in the first aspect above. Attached Figure Description

[0040] Figure 1 This is a system architecture diagram of a RAID card power-loss handling provided in an embodiment of this application;

[0041] Figure 2 This is a schematic diagram illustrating the interaction between the host side and the RAID card firmware provided in an embodiment of this application;

[0042] Figure 3 This is a flowchart illustrating a RAID card power-loss handling method provided in an embodiment of this application;

[0043] Figure 4 This is a flowchart illustrating another RAID card power-loss handling method provided in an embodiment of this application;

[0044] Figure 5This is a flowchart illustrating another RAID card power-loss handling method provided in the embodiments of this application;

[0045] Figure 6 This is a schematic diagram of a RAID card power-loss handling device provided in an embodiment of this application;

[0046] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0047] Figure 8 This is a schematic diagram of the structure of a RAID card provided in an embodiment of this application. Detailed Implementation

[0048] To facilitate understanding of the embodiments provided in this application, some concepts involved in the embodiments of this application will first be explained. These concepts include, but are not limited to, the following.

[0049] 1. Redundant Arrays of Independent Disks (RAID)

[0050] RAID stands for RAID, which stands for Redundant Array of Independent Disks. It is a large-capacity disk system composed of multiple independent disks, leveraging the additive effect of data delivery from multiple disks to improve the overall performance of the disk system. In other words, RAID can achieve better storage performance and higher reliability than a single disk.

[0051] 2. Virtual Drive (VD)

[0052] VD refers to a RAID array created by combining multiple physical disks using a RAID card. Compared to a single physical disk, VD offers greater capacity, higher security, and data redundancy.

[0053] 3. Host side

[0054] In this application, the host side is used to send commands to the RAID card; that is, for the RAID card, the host side is the source of commands sent to the RAID card. For example, the host side sends a power-off command to the RAID card. In one embodiment, the host side can refer to the operating system (OS) or the central processing unit (CPU).

[0055] 4. Write Back (WB)

[0056] WB mode means that write data sent from the host to the VD must pass through the RAID card's Double Data Rate (DDR) cache. Once the data is written to the DDR cache, it can be returned to the host without waiting for it to be written to disk. Therefore, this mode requires a supercapacitor to protect the write data in the DDR cache, preventing data loss in the event of a power failure of the RAID card.

[0057] 5. Write Through (WT)

[0058] WT mode means that write data sent from the host to the VD does not need to pass through the RAID card's DDR cache. The data is directly written to the disk and then returned to the host. In other words, the data is safely written to the disk and then returned to the host. Since there is no write data in the DDR cache in this mode, there is no need for a supercapacitor to protect the write data in the DDR cache from power loss.

[0059] This application provides a method and related apparatus for handling power loss in a RAID card, which can prevent the RAID card from entering the backup power process, thereby reducing the risk of RAID card backup power failure and consequently reducing the risk of data loss. Please refer to... Figure 1 , Figure 1 This is a system architecture diagram for RAID card power-loss handling provided in an embodiment of this application. Figure 1 As shown, the system includes a main power supply 101, a backup power supply 102, electronic devices 103, a host side 104, a CPU 1041, a RAID card 105, and a RAID card FW 1051. The main power supply 101 supplies power to the electronic devices 103 to maintain their normal operation. The backup power supply 102 is a backup power supply provided by the user for the electronic devices 103. When the electronic devices 103 experience a power failure, the system switches from the main power supply 101 to the backup power supply 102 to supply power, enabling the electronic devices to enter a backup power state and completing the backup power process.

[0060] like Figure 1As shown, when electronic device 103 experiences a power failure, it can switch from main power supply 101 to backup power supply 102, entering a full-system backup power state. This full-system backup power state refers to the state in which the electronic device maintains normal operation while the backup power supply is activated. At this time, CPU 1041 sends a full-system backup power command to RAID card FW 1051 via the RAID card driver. Upon receiving the full-system backup power command, RAID card FW 1051 can perform data caching and disk write operations on RAID card 105. Therefore, by adopting this solution, the RAID card can detect when the electronic device enters the full-system backup power state, and thus perform data caching and disk write operations on the RAID card when the electronic device enters this state. This reduces the risk of data loss due to RAID card backup failure after entering the backup power state.

[0061] In one embodiment, the interaction between the host-side 104 and the RAID card FW 1051 can be seen in [reference needed]. Figure 2 ,like Figure 2 As shown, the host side may include a backup power module 201, and the RAID card FW may include a command recognition module 202, a VD control module 203, and a DDR cache module 204.

[0062] Among them, the whole machine backup power module 201 is responsible for the whole machine backup power of electronic equipment. When the electronic equipment experiences an abnormal power failure, it sends a whole machine backup power command to the RAID card FW.

[0063] The command identification module 202 is used to identify the type of commands received by the RAID card from the host side. In one embodiment, if the command identification module 202 identifies that the RAID card FW has received a power backup command, the relevant actions are executed through the VD control module 203.

[0064] VD control module 203 is used to control or change the write cache (or write cache) mode of all VDs managed by the RAID card. In one embodiment, if a target VD has a write cache (or write cache) mode in WB mode, the RAID card FW can switch the write cache mode of the target VD to WT mode through VD control module 203.

[0065] The DDR Cache module 204 is used to write the data in the DDR Cache to disk. In one embodiment, when the RAID card FW receives a power-on command from the host side, it can initiate the data writing operation through the DDR Cache module 204, that is, write all the data in the DDR Cache to the hard disk (strip).

[0066] It should be noted that the electronic device mentioned in this application can be a server. The server can be a standalone physical server, a server cluster consisting of multiple physical servers, or a distributed system. This application does not impose any special restrictions on the specific type of server.

[0067] It is understood that the system architecture described in the embodiments of this application is for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and does not constitute a limitation on the technical solutions provided in the embodiments of this application. Those skilled in the art will know that with the evolution of system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.

[0068] The following describes the RAID card power-off handling method provided in the embodiments of this application with reference to the accompanying drawings.

[0069] Please see Figure 3 , Figure 3 This is a flowchart illustrating a RAID card power-loss handling method provided in an embodiment of this application. The method is applied to a RAID card, which is installed in an electronic device and connected to the host side of the electronic device. Figure 3 As shown, the method may include, but is not limited to, the following steps:

[0070] S301. Receive the whole machine backup power command, which is used to instruct the electronic device to enter the whole machine backup power state.

[0071] In one embodiment, the system backup power command is sent from the host side of the electronic device to the RAID card via the RAID card driver when the electronic device enters the system backup power state. It can be understood that the process of the host side of the electronic device sending the system backup power command to the RAID card via the RAID card driver can be achieved through… Figure 2 The backup power module 201 of the whole machine is executed.

[0072] Understandably, for a RAID card, the host is the source of commands issued to the RAID card. In one embodiment, the host can be the operating system (OS) or the CPU in the electronic device.

[0073] In one embodiment, the backup power command is generated when the electronic device detects that it is powered by a backup power source, or when the power outage time specified in the power outage schedule arrives, or when a power outage operation is received. For example, if the power outage schedule specifies that the electronic device will be powered down at 12:15, then the electronic device will generate a backup power command at 12:15.

[0074] In one embodiment, the electronic device enters the backup power state when it switches from the main power supply to the backup power supply after a power outage. This power outage can be an abnormal power outage, such as when the load on the electronic device increases during operation and the power required by the load exceeds the power supply's capacity, causing an abnormal power outage. Alternatively, the electronic device can actively shut down; for example, if it receives a power-off command, it enters the power-down state in response.

[0075] In one embodiment, the RAID card can also receive a first command from the host side. Optionally, the RAID card can... Figure 2 The command recognition module 202 identifies whether the first instruction is a backup power instruction for the whole machine. If so, it executes step S302.

[0076] It should be noted that, typically, electronic device hardware and RAID cards are logically two independent entities (often from different manufacturers). Therefore, electronic device hardware usually does not interfere with the internal settings of the RAID card. The internal settings of the RAID card are typically user-defined. However, in this application, when the electronic device enters a standby power state, the host side can send a standby power command to the RAID card via the RAID card driver, causing the RAID card to perform relevant operations upon receiving the command. Thus, this application links the electronic device hardware and the internal settings of the RAID card, allowing the behavior of the RAID card to be directly triggered at the electronic device level.

[0077] S302: In response to the backup power command of the whole machine, identify the write cache mode of the virtual disk group managed by the redundant disk array RAID card.

[0078] In one embodiment, identifying the write cache mode of the VDs managed by the RAID card primarily relies on using the command-line interface or application program interface (API) integrated with the RAID card's firmware and tools to invoke a viewing command. This viewing command is used to view the write cache mode of the virtual disk group (VD) managed by the redundant disk array (RAID) card and output the identification result. This identification result may include the write cache mode of each VD, such as WB mode or WT mode. It is understood that this viewing command can be stored in the RAID card, such as in the RAID card's hard drive (or VD, etc.) or cache (or DDR cache, etc.), or it can be stored in the electronic device's memory, from which the RAID card retrieves the viewing command.

[0079] In one embodiment, for example, assuming the RAID card is an xxRAID card, the write cache mode of each VD managed by the xxRAID card can be viewed by calling a command such as "xxxxxx / cx / vall show all". Here, the xxxxxx tool is a publicly released command-line tool for the xxRAID card, which can be used to perform related operations or processing on the xxRAID card.

[0080] S303. If there is a target virtual disk group with write cache mode set to write-back mode, then switch the write cache mode of the target virtual disk group to write-through mode.

[0081] The target virtual disk group (VD) is any one of the at least one VD managed by the RAID card.

[0082] The reason for switching the write cache mode of the target virtual disk group (VD) to WT mode if there is a target virtual disk group with write cache mode set to write-back mode is as follows: In WB mode, if the RAID card enters the power-back process, a supercapacitor is needed to protect the write data in the DDR cache from power loss. When the server goes down, it cannot supply power to the RAID card. At this time, if the target VD's write cache mode is still in WB mode, there is a possibility of data loss due to the lack of supercapacitor protection for the write data in the DDR cache. In WT mode, write data does not need to go through the RAID card's DDR cache and can be directly written to disk, thereby reducing the risk of data loss due to RAID card power-back failure after the RAID card enters the power-back process.

[0083] S304. Write the write data related to the target virtual disk group in the RAID card's Double Rate Cache (DDR Cache) to disk.

[0084] In one embodiment, when the write cache mode of the target virtual disk group VD is WB mode, the RAID card can write the write data related to the target virtual disk group VD in the DDR cache to disk after switching the write cache mode of the target virtual disk group VD to WT mode. This avoids the possibility of data loss. For example, assuming that the write cache modes of both target virtual disk group 1 and target virtual disk group 2 are write-through mode, the RAID card can write the write data related to target virtual disk group 1 and target virtual disk group 2 in the DDR cache to disk after switching the write cache modes of both target virtual disk group 1 and target virtual disk group 2 to write-through mode.

[0085] In another embodiment, the RAID card can also simultaneously switch the write cache mode of the target virtual disk group to write-through mode and write the write data related to the target virtual disk group VD in the DDR cache to disk. For example, assuming that the write cache modes of both target virtual disk group 1 and target virtual disk group 2 are in write-through mode, the RAID card can switch the write cache mode of target virtual disk group 1 to write-through mode and write the write data related to target virtual disk group 1 in the DDR cache to disk, and then switch the write cache mode of target virtual disk group 2 to write-through mode and write the write data related to target virtual disk group 2 in the DDR cache to disk.

[0086] In one embodiment, the RAID card can perform steps S301 to S304 via the RAID card FW.

[0087] As can be seen, in this embodiment of the application, the RAID card can detect when the electronic device enters the standby power state. When the electronic device enters the standby power state, the RAID card performs cached data write-to-disk processing, thereby reducing the risk of cached data loss due to RAID card power failure or other situations after the RAID card enters the standby power process.

[0088] Please see Figure 4 , Figure 4 This is a flowchart illustrating another RAID card power-loss handling method provided in an embodiment of this application. The method is applied to a RAID card, which is installed in an electronic device and connected to the host side of the electronic device. Figure 3 Compared to the method shown, Figure 4 The method shown also illustrates how to control the RAID card to enter a power-down state. For example... Figure 4 As shown, the power-loss handling method for this RAID card may include, but is not limited to, the following steps:

[0089] S401. Receive the whole machine backup power command, which is used to instruct the electronic device to enter the whole machine backup power state.

[0090] In one embodiment, the relevant description of step S401 can be found in the description of step S301 above, and will not be repeated here.

[0091] S402: In response to the power backup command of the whole machine, identify the write cache mode of the virtual disk group VD managed by the redundant disk array RAID card.

[0092] In one embodiment, the relevant description of step S402 can be found in the description of step S302 above, and will not be repeated here.

[0093] S403. Determine the write cache mode of the target virtual disk group VD; if the write cache mode of the target virtual disk group VD is WB mode, then execute step S404a; if the write cache mode of the target virtual disk group VD is WT mode, then execute step S404b.

[0094] The target virtual disk group (VD) can be any one of the VDs managed by the RAID card.

[0095] S404a. Switch the write cache mode of the target virtual disk group VD to WT mode, and execute steps S405 to S406.

[0096] It is understandable that steps S403 and S404a can be achieved through... Figure 2 The VD control module 203 in the middle is executed.

[0097] S404b: Maintain the write cache mode of the target virtual disk group VD in WT mode, and execute step S406.

[0098] As can be seen from steps S404a and S404b, switching the write cache mode of VD to WT mode mainly applies to VDs whose original write cache mode was WB mode. For VDs whose original write cache mode was WT mode, it is only necessary to maintain WT mode.

[0099] S405: Write the write data related to the target virtual disk group VD in the double-rate cache (DDR Cache) to disk.

[0100] In one embodiment, when the write cache mode of the target virtual disk group VD is in WB mode, the RAID card can write the write data related to the target virtual disk group VD in the DDR cache to disk after switching the write cache mode of the target virtual disk group VD to WT mode. This avoids the possibility of data loss.

[0101] It is understandable that step S405 can be achieved through... Figure 2 The DDR Cache module 204 in the middle is executed.

[0102] S406. If there is no target virtual disk group with write-back mode in write cache mode, and / or the write data in DDR Cache has been written to disk, then after the electronic device is powered on, control the RAID card to enter the power-down state.

[0103] In this embodiment, there are no target virtual disk groups with write-back cache mode under the RAID card, meaning that the write cache mode of all virtual disk groups (VDs) managed by the RAID card is write-through (WT) mode. In one embodiment, the RAID card can periodically check whether all VDs are in WT mode after executing S404a, S404b, or S405 for a certain period (or target duration). If so, the RAID card can be controlled to enter a power-down state after the entire electronic device has completed its power-up process; otherwise, the RAID card's power-down processing is considered incomplete. In another embodiment, the write cache mode of the virtual disk groups (VDs) managed by the RAID card is not all in WT mode. For example, if one or more VDs managed by the RAID card have a write cache mode of WB mode, it indicates that there is still data being written through the DDR cache. In this case, if the RAID card's power-down processing is determined to be complete, data loss will occur. In this situation, steps S404a and S405 are executed on the VDs that are not in WB mode (e.g., the target VDs). In one embodiment, the RAID card can determine whether the write cache mode of the VD managed by the RAID card is WT mode through the RAID card FW.

[0104] In one embodiment, if the RAID card determines that there is no write data in the DDR cache, it determines that the write data in the DDR cache has been written to disk. The RAID card can check whether there is still write data in the DDR cache after executing S405 for a certain period of time (or the target duration) or periodically. If not, it can determine that the write data in the DDR cache has been written to disk, and thus, after the electronic device's power-off process is completed, the RAID card can be controlled to enter the power-down state; if yes, it can be considered that the RAID card's power-down process is not yet complete. For example, if there is still write data in the RAID card's DDR cache, it means that the write data in the DDR cache has not been completely written to disk. In this case, if it is determined that the RAID card's power-down process is complete, the write data in the DDR cache will be lost. In this situation, the RAID card can execute the above step S405. In one embodiment, the RAID card can determine whether there is no write data in the RAID card's DDR cache through the RAID card's firmware.

[0105] After the entire electronic device has completed its power backup, the RAID card is controlled to enter a power-down state. In other words, after the entire electronic device has completed its power backup, the RAID card can also enter a completely power-down state along with the electronic device. This shortens the overall power backup time of the electronic device.

[0106] As can be seen, by adopting the embodiments of this application, on the one hand, when the entire electronic device finishes its power backup, since all VD's write cache mode has been switched to WT mode, there is no data in the RAID card's DDR cache. Therefore, the RAID card does not need to enter the power backup state, avoiding the RAID card from performing the corresponding power-down protection process (i.e., copying the data in the DDR cache to the Nand Flash). This reduces the possibility of power-down protection failure and data loss due to RAID card hardware or software failure. On the other hand, if the entire electronic device finishes its power backup, the RAID card can enter the power-down state along with the electronic device, thereby reducing the overall power backup time of the electronic device.

[0107] Furthermore, since there is no data in the DDR cache of a RAID card, there is no need for a supercapacitor to protect the data in the DDR cache from power loss. Therefore, RAID cards do not need to be equipped with supercapacitors, and even RAID cards do not need to be equipped with backup power modules, thereby saving costs.

[0108] Please see Figure 5 , Figure 5 This is a flowchart illustrating another RAID card power-loss handling method provided in an embodiment of this application. Figure 3 and Figure 4 Compared to the method shown, Figure 5 The method shown also includes the function of determining whether the electronic device has enabled the sending of a full-system power standby command to the RAID card, wherein the full-system power standby command is used to indicate that the electronic device has entered a full-system power standby state. For example... Figure 5 As shown, the method includes, but is not limited to, the following steps:

[0109] S501, Electronic equipment enters standby power state.

[0110] In one embodiment, when the electronic device loses power, it can switch from the main power supply to the backup power supply and enter the backup power state.

[0111] In one embodiment, the power outage of an electronic device can be an abnormal power outage, such as when the load on the electronic device continuously increases during operation, and if the power of the load exceeds the power of the power supply, the electronic device will experience an abnormal power outage. The power outage can also be a deliberate power outage, such as when the electronic device receives a power-off command and enters a power-off state in response to the command.

[0112] S502. The electronic device determines whether the function of sending the whole machine backup power command to the RAID card has been enabled. If yes, then proceed to step S503a; if no, then proceed to step S503b.

[0113] In one embodiment, the function of sending a system-wide power standby command to the RAID card can be enabled by default on the host side of the electronic device. In this embodiment, after the host side detects that the electronic device has entered the system-wide power standby state, it can send a system-wide power standby command to the RAID card by default to notify the RAID card that the electronic device has entered the system-wide power standby state.

[0114] In another embodiment, the function of sending a system-wide power backup command to the RAID card can be configured by the user through a user interface. In this embodiment, the electronic device can provide a human-machine interface for the user to enable or disable the function of sending a system-wide power backup command to the RAID card. In this embodiment, after detecting that the function of sending a system-wide power backup command to the RAID card is enabled, the host side can send a system-wide power backup command to the RAID card.

[0115] In other words, the system backup power command is generated when the host side of the electronic device detects that the function of sending system backup power commands to RAID has been enabled. The function of sending system backup power commands to RAID can be configured through a user interface.

[0116] S503a. The electronic device determines whether a backup power command for the entire machine has been sent from the host side to the RAID card. If yes, then proceed to step S504a; otherwise, proceed to step S503b.

[0117] When an electronic device enters the standby power state, if a standby power command is sent from the host to the RAID card, the RAID card will respond to the standby power command and enter the process of power failure caching for the virtual disk group VD it manages. In this case, the following steps S504a to S507a can be executed.

[0118] The S504a RAID card responds to the system's backup power command by identifying the write cache mode of the VD managed by the RAID card.

[0119] S505a. If the RAID card determines that there is a target VD in the VD it manages with the write cache mode set to WB mode, then the write cache mode of the target VD will be switched to WB mode.

[0120] The S506a RAID card writes the data related to the target VD in the DDR cache to disk.

[0121] Among these, data writing to disk means safely writing the data in the DDR cache to the hard drive (strip).

[0122] S507a: If it is determined that the write data in the DDR cache has been completed, the RAID card controls the RAID card to enter the power-down state.

[0123] When an electronic device enters the backup power state, if the host does not send a backup power command to the RAID card, the RAID card will maintain its previous working mode and state until the backup power of the electronic device ends. In other words, if the RAID card does not receive a backup power command, the following steps S503b to S504b can be executed.

[0124] S503b: After the entire electronic device has completed its power backup, the RAID card enters the power backup state.

[0125] When the electronic device's backup power is exhausted, it will enter a fully powered-down state. At this time, the electronic device has no power input and therefore cannot supply power to the RAID card, so the RAID card will enter a backup power state.

[0126] The S504b RAID card copies data from the DDR cache to the Nand non-volatile flash memory (NAND Flash).

[0127] In one embodiment, step S504b can also be referred to as the RAID card performing a power-loss protection process.

[0128] In one embodiment, if no write data is present in the DDR cache, the RAID card can send a power-off notification to the host side of the electronic device and disconnect from the motherboard power supply. The power-off notification triggers the host side of the electronic device to control the motherboard power supply to the RAID card after a preset time. If the motherboard power supply is detected after the preset time, it is determined whether the supercapacitor is in an abnormal state. If the supercapacitor is determined to be in an abnormal state, abnormal handling is performed on the supercapacitor to resolve the abnormal state. Optionally, the supercapacitor being in an abnormal state may be, but is not limited to, insufficient power in the supercapacitor. Optionally, abnormal handling of the supercapacitor may be, but is not limited to, supplying power to the supercapacitor through the motherboard power supply. This ensures that the supercapacitor remains in a normal state, so that after the next power backup of the entire electronic device, the RAID card can smoothly enter the backup power state and execute the power-down protection process, thereby avoiding the possibility that the RAID card cannot execute the power-down protection process due to supercapacitor abnormality, and thus preventing data loss in the DDR cache.

[0129] S505b, RAID card control RAID card enters power-down state.

[0130] The RAID card entering the power-down state means that the RAID card's backup power has ended.

[0131] S506b: If the electronic device is powered on again, the RAID card enters the power-on state.

[0132] It is understandable that after an electronic device is powered on again, its various components are supplied with power. These components include, but are not limited to, RAID cards.

[0133] In one embodiment, when the RAID card is powered back on, the RAID card firmware (FW) starts running. Here, FW refers to the software running on the electronic device, used to control the normal operation of the electronic device.

[0134] In one embodiment, when the RAID card powers on (or is powered back on), it can receive a first instruction to view and output the RAID card log. This allows the user to determine from the RAID card log whether data still exists in the RAID card's DDR cache. This avoids the possibility that data in the RAID card's DDR cache might not be written to disk after the electronic device is powered on if the RAID card or hard drive has been manually replaced after the device has been powered off, thus reducing the risk of data loss.

[0135] The S507b and RAID card charge the supercapacitor and wait for it to finish charging.

[0136] The reason why the RAID card charges the supercapacitor is that when the write cache mode of the VD managed by the RAID card is WB mode, the write data sent from the host to the VD needs to go through the DDR cache. At this time, the supercapacitor is needed to protect the write data in the DDR cache from power loss to avoid data loss.

[0137] S508: When the RAID card detects that the supercapacitor has finished charging, it copies the data in the Nand Flash back to the DDR Cache and performs data write-to-disk processing on the data in the DDR Cache.

[0138] In this embodiment, if the electronic device determines that it has enabled the function of sending a full-system power-backup command to the RAID card, and has already sent the full-system power-backup command to the RAID card through the host side, then the RAID card can respond to the full-system power-backup command by performing a power-down process on the virtual disk group (VD) it manages. If the electronic device determines that it has not enabled the function of sending a full-system power-backup command to the RAID card, then the RAID card can enter the power-backup process after the electronic device's full-system power-backup is completed, and perform the corresponding power-down protection. Therefore, by adopting this embodiment, data loss can be effectively avoided.

[0139] Corresponding to the methods provided in the above embodiments, this application also provides corresponding apparatus, including units for performing the corresponding methods in the above embodiments. The units may be software, hardware, or a combination of software and hardware.

[0140] Please see Figure 6 , Figure 6 This is a schematic diagram of a RAID card power-loss handling device provided in an embodiment of this application. Figure 6 As shown, the device may include a receiving unit 601 and a processing unit 602.

[0141] The receiving unit 601 is used to receive a backup power command for the whole machine, which indicates that the electronic device has entered the backup power state.

[0142] The processing unit 602 is used to respond to the power backup command of the whole machine and identify the write cache mode of the virtual disk group managed by the RAID card;

[0143] If there is a target virtual disk group with write-back WB mode, then switch the write cache mode of the target virtual disk group to write-through mode.

[0144] Write data related to the target virtual disk group in the Double Rate Cache (DDR) is written to disk.

[0145] In one embodiment, when the processing unit 602 identifies the write cache mode of the virtual disk group managed by the RAID card, it specifically performs the following:

[0146] Invoke the view command, which is used to view the write cache mode of the virtual disk group managed by the RAID card;

[0147] Output the write cache mode of the virtual disk group managed by the RAID card.

[0148] In one embodiment, the processing unit 602 is further configured to:

[0149] Once it is confirmed that the write operation of data in the DDR cache has been completed, the RAID card is powered down.

[0150] In one embodiment, the processing unit 602 is further configured to:

[0151] If there is no target virtual disk group with write-back mode in write cache mode, and / or the write data in DDR cache has been written to disk, then the RAID card will be controlled to enter the power-down state after the entire electronic device has completed its backup power supply.

[0152] In one embodiment, the processing unit 602 is further configured to:

[0153] If it is determined that there is no data to be written in the DDR cache, then the write-to-disk processing of the data in the DDR cache is complete.

[0154] In one embodiment, the system backup power command is generated when the host detects that the function of sending system backup power commands to the RAID card has been enabled, and the function of sending system backup power commands to the RAID card can be configured through a user interface.

[0155] In one embodiment, the backup power command is generated when the electronic device detects that it is powered by a backup power source, or when the power outage time specified in the power outage schedule arrives, or when a power outage operation is received.

[0156] In one embodiment, the processing unit 602 is further configured to:

[0157] If there is no write data in the DDR cache, a power failure notification is sent to the host side of the electronic device, and the connection with the motherboard power supply is disconnected. The power failure notification is used to trigger the host side of the electronic device to control the motherboard power supply to the RAID card after a preset time.

[0158] If the motherboard power is detected after a preset time, it is determined whether the supercapacitor is in an abnormal state.

[0159] If it is determined that the supercapacitor is in an abnormal state, then the supercapacitor is subjected to abnormal handling, which is used to resolve the abnormal state of the supercapacitor.

[0160] It is understood that the specific implementation of each unit in the RAID card power-down processing device provided in this application embodiment and the beneficial effects that can be achieved can be referred to the description of the aforementioned RAID card power-down processing method embodiment, and will not be repeated here.

[0161] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. For example... Figure 7 As shown, the electronic device may include a host side 701 and a redundant disk array RAID card 702, wherein the host side 701 can send a backup power command to the redundant disk array RAID card 702 through the RAID card driver.

[0162] Alternatively, the host side can refer to the operating system (OS) or the central processing unit (CPU).

[0163] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a RAID card provided in an embodiment of this application. Figure 7 As shown, the RAID card may include, but is not limited to, a processor 801, a cache 802, and a supercapacitor 803.

[0164] The cache 802 includes a cache memory for storing write data when the write cache mode of the target virtual disk group managed by the RAID card is WB mode.

[0165] The supercapacitor 803 is used to protect the data in the cache from power loss when the write cache mode of the target virtual disk group managed by the RAID card is in WB mode.

[0166] Processor 801 is used to perform the operations in the above-described RAID card power-down handling method, for example:

[0167] Receive the whole machine backup power command, which indicates that the electronic equipment has entered the whole machine backup power state;

[0168] In response to the system's backup power command, the write cache mode of the virtual disk group managed by the RAID card is identified;

[0169] If a target virtual disk group exists with write-back mode, then switch the write cache mode of the target virtual disk group to write-through mode;

[0170] Write data related to the target virtual disk group in the Double Rate Cache (DDR) is written to disk.

[0171] In one embodiment, when the processor 801 identifies the write cache mode of the virtual disk group managed by the RAID card, it specifically performs the following:

[0172] Invoke the view command, which is used to view the write cache mode of the virtual disk group managed by the RAID card;

[0173] Outputs the write cache mode of the virtual disk group (VD) managed by the RAID card.

[0174] In one embodiment, processor 801 is also used to perform:

[0175] Once it is confirmed that the write operation of data in the DDR cache has been completed, the RAID card is powered down.

[0176] In one embodiment, processor 801 is also used to perform:

[0177] If there is no target virtual disk group with write-back mode in write cache mode, and / or the write data in DDR cache has been written to disk, then the RAID card will be controlled to enter the power-down state after the entire electronic device has completed its backup power supply.

[0178] In one embodiment, processor 801 is also configured to perform:

[0179] If it is determined that there is no data to be written in the DDR cache, then the write-to-disk processing of the data in the DDR cache is complete.

[0180] In one embodiment, the system backup power command is generated when the host detects that the function of sending system backup power commands to the RAID has been enabled, and the function of sending system backup power commands to the RAID can be configured through a user interface.

[0181] In one embodiment, the backup power command is generated when the electronic device detects that it is powered by a backup power source, or when the power outage time specified in the power outage schedule arrives, or when a power outage operation is received.

[0182] In one embodiment, processor 801 is also configured to perform:

[0183] If there is no write data in the DDR cache, a power failure notification is sent to the host side of the electronic device, and the connection with the motherboard power supply is disconnected. The power failure notification is used to trigger the host side of the electronic device to control the motherboard power supply to the RAID card after a preset time.

[0184] If the motherboard power is detected after a preset time, it is determined whether the supercapacitor is in an abnormal state.

[0185] If it is determined that the supercapacitor is in an abnormal state, then the supercapacitor is subjected to abnormal handling, which is used to resolve the abnormal state of the supercapacitor.

[0186] It is understood that the specific implementation of the processor 801 and the beneficial effects it can achieve can be referred to the description of the aforementioned RAID card power failure handling method embodiment, and will not be repeated here.

[0187] This application also provides a computer-readable storage medium having a computer program stored thereon, the computer program including program instructions that, when executed by an electronic device, implement the functions of any of the above method embodiments.

[0188] The aforementioned computer-readable storage media include, but are not limited to, flash memory, hard disk, and solid-state drive.

[0189] This application also provides a computer program product that, when executed by an electronic device, implements the functions of any of the above method embodiments.

[0190] Those skilled in the art will also understand that the various illustrative logical blocks and steps listed in the embodiments of this application can be implemented by electronic hardware, computer software, or a combination of both. Whether such functionality is implemented through hardware or software depends on the specific application and the overall system design requirements. Those skilled in the art can use various methods to implement the described functionality for corresponding applications, but such implementation should not be construed as exceeding the scope of protection of the embodiments of this application.

[0191] The solutions described in this application can be implemented in various ways. For example, these technologies can be implemented in hardware, software, or a combination of hardware. For hardware implementation, the units used to execute these technologies can be implemented in one or more general-purpose processors, digital signal processors (DSPs), digital signal processing devices, application-specific integrated circuits (ASICs), programmable logic devices, field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination thereof. The general-purpose processor can be a microprocessor; alternatively, it can be any conventional processor, controller, microcontroller, or state machine. The processor can also be implemented through a combination of computing devices, such as a digital signal processor and a microprocessor, multiple microprocessors, one or more microprocessors combined with a digital signal processor, or any other similar configuration.

[0192] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on an electronic device, all or part of the processes or functions described in the embodiments of this application are generated. The electronic device can be an electronic device or electronic apparatus that implements any of the above embodiments. For example, the electronic apparatus can be a RAID card. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another.

[0193] In this application, the use of singular pronouns to denote "one or more" rather than "one and only one," unless otherwise specified. In this application, unless otherwise specified, "at least one" is intended to mean "one or more," and "more than" is intended to mean "two or more."

[0194] In addition, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that there can be three kinds of relationships. For example, A and / or B can represent three cases: A exists alone, A and B exist simultaneously, and B exists alone. A can be singular or plural, and B can be singular or plural.

[0195] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0196] The same or similar parts between the various embodiments in this application can be referred to mutually. In the various embodiments of this application, and in the various implementation methods / methods / implementations within each embodiment, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments and between the various implementation methods / methods / implementations within each embodiment are consistent and can be mutually referenced. The technical features in different embodiments and the various implementation methods / methods / implementations within each embodiment can be combined according to their inherent logical relationships to form new embodiments, implementation methods, methods, or implementation approaches. The above-described embodiments of this application do not constitute a limitation on the scope of protection of this application.

Claims

1. A method for handling power loss of a RAID card, characterized in that, The method is applied to a redundant disk array (RAID) card, which is installed in an electronic device. The method includes: Receive a backup power command for the entire device, the backup power command being used to instruct the electronic device to enter the backup power state; In response to the power backup command of the whole machine, the write cache mode of the virtual disk group managed by the RAID card is identified; If there is a target virtual disk group with write-back mode, then switch the write cache mode of the target virtual disk group to write-through mode; Write the data related to the target virtual disk group in the RAID card's double-rate cache (DDR cache) to disk; Specifically, the electronic device determines whether the function of sending the whole machine backup power command to the RAID card has been enabled. If yes, the RAID card will enter the power-down state along with the electronic device after the data writing process in the DDR Cache is completed. If no, the RAID card will maintain its previous working mode and state after the electronic device enters the whole machine backup power state, and the RAID will enter the backup power state after the electronic device enters the power-down state.

2. The method as described in claim 1, characterized in that, The identification of the write cache mode of the virtual disk group managed by the RAID card includes: Invoke a view command, which is used to view the write cache mode of the virtual disk group managed by the RAID card; Output the write cache mode of the virtual disk group managed by the RAID card.

3. The method as described in claim 1 or 2, characterized in that, The method further includes: If it is determined that the write data in the DDR cache has been successfully written to disk, then the RAID card is controlled to enter the power-down state.

4. The method as described in claim 1 or 2, characterized in that, The method further includes: If there is no target virtual disk group with write-back mode in write cache mode, and / or the write data in the DDR Cache has been written to disk, then after the electronic device has completed its power-on backup, the RAID card is controlled to enter the power-down state.

5. The method as described in claim 3, characterized in that, The method further includes: If it is determined that there is no write data in the DDR cache of the RAID card, then the write data in the DDR cache has been successfully written to disk.

6. The method as described in claim 1, characterized in that, The backup power command is generated when the host side of the electronic device detects that the function of sending backup power commands to the RAID card has been enabled. The function of sending backup power commands to the RAID card can be set through a user interface.

7. The method as described in claim 1, characterized in that, The backup power command is generated when the electronic device detects that it is powered by a backup power source, or when the power outage time specified in the power outage schedule arrives, or when a power outage operation is received.

8. The method as described in claim 1, characterized in that, The method further includes: If there is no write data in the DDR Cache, a power failure notification is sent to the host side of the electronic device, and the connection with the motherboard power supply is disconnected. The power failure notification is used to trigger the host side of the electronic device to control the motherboard power supply to the RAID card after a preset time. If the motherboard power supply is detected after the preset time, it is determined whether the supercapacitor is in an abnormal state. If it is determined that the supercapacitor is in an abnormal state, then the supercapacitor is subjected to abnormal handling, which is used to resolve the abnormal state of the supercapacitor.

9. A RAID card, characterized in that, The RAID card is used to execute the RAID card power-off processing method as described in any one of claims 1 to 8, comprising: a command recognition module, a virtual disk group control module, and a double-rate cache (DDRCache) module. The command recognition module is used to recognize commands from the host side of the electronic device. The virtual disk group control module is used to control or change the write cache mode of the virtual disk group managed by the RAID card. The double-rate cache module is used to write the data in the double-rate cache to disk.

10. An electronic device, characterized in that, The system includes a host side and a redundant disk array (RAID) card. The host side is used to send a system backup power command to the redundant disk array (RAID) card via a RAID card driver. The redundant disk array (RAID) card is used to perform the method described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Storage control unit and data management method

    CN101241477A

  • Drive Array Policy Control

    CN106201332A