Power failure processing method and device, electronic equipment and storage medium

By writing the volatile storage unit data to the non-volatile storage unit and running the system firmware in the case of a fake power outage, a hot boot of the solid-state drive is achieved, solving the problem of long boot time caused by a fake power outage and improving system stability and business continuity.

CN120653487APending Publication Date: 2025-09-16HANGZHOU HIKSTORAGE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510637632.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-16
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

In the case of a false power failure, the solid-state drive needs to disconnect the link layer connection with the host and go through a complete power-on process, resulting in a long startup time and an inability to resume normal operation in time.

Method used

By writing the data in the volatile storage unit to the non-volatile storage unit when a drop in the external power supply voltage is detected, and running the system firmware of the non-volatile storage unit for initialization when the voltage recovers, a hot start of the storage device is achieved and the link layer connection status is maintained.

Benefits of technology

This shortens the startup time of storage devices, avoids data loss, improves system stability and business continuity, and reduces the frequent execution of power-on processes for hosts and storage devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653487A_ABST
    Figure CN120653487A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a power failure processing method and device, electronic equipment and a storage medium, and relates to the technical field of storage equipment data management. The method is applied to a controller in the storage device, the storage device further comprises a power supply unit, a volatile storage unit and a non-volatile storage unit, and the method comprises the following steps: controlling the power supply unit to supply power to hardware in the storage device when detecting that the power supply voltage of an external power supply is reduced to be below a preset power supply threshold value, writing the data to be backed up in the current volatile storage unit into the non-volatile storage unit; under the condition that the power supply unit is in the power supply state, when it is detected that the power supply voltage of the external power supply rises to a preset power supply threshold value, the power supply unit is controlled to stop supplying power to hardware in the storage device, and system firmware stored in the nonvolatile storage unit is operated so as to initialize software of the storage device; and finishing the hot start of the storage equipment. In this way, the unavailable duration of the storage device after false power failure can be shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of storage device data management, and in particular to a power failure processing method, device, electronic device, and storage medium. Background Art

[0002] Solid-state drives (SSDs) are widely used in various fields due to their powerful read and write capabilities. SSDs require power from the host computer to maintain normal operation. In some application scenarios, the host computer may terminate the SSD's power supply without prior notification (this is called an abnormal power outage). In the event of an abnormal power outage, power may be restored quickly, such as due to voltage fluctuations in the host's power supply circuit. This situation is also called a false power outage.

[0003] In one implementation, to address a false power outage, the SSD first disconnects the link layer connection with the host and then re-executes the complete power-on process. This power-on process requires restoring the link layer connection with the host, which requires initializing the SSD's hardware. Furthermore, the SSD's software also needs to be initialized, resulting in a lengthy power-on process and rendering the SSD unusable for an extended period of time. Summary of the Invention

[0004] The purpose of the embodiments of the present application is to provide a power failure processing method, device, electronic device, and storage medium to shorten the duration of unavailability of a storage device after a false power failure. The specific technical solution is as follows:

[0005] In a first aspect of an embodiment of the present application, a power failure processing method is provided, which is applied to a controller in a storage device, wherein the storage device further includes: a power supply unit, a volatile storage unit, and a non-volatile storage unit. The method includes:

[0006] When it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, the power supply unit is controlled to supply power to the hardware in the storage device and the data to be backed up currently in the volatile storage unit is written into the non-volatile storage unit;

[0007] When the power supply unit is in a power supply state, when it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold, the power supply unit is controlled to stop supplying power to the hardware in the storage device, and the system firmware stored in the non-volatile storage unit is run to initialize the software of the storage device and complete the hot start of the storage device.

[0008] In some embodiments, the method further comprises:

[0009] During the period when the power supply unit supplies power to the hardware in the storage device, receiving instructions sent by the host through the link layer connection between the storage device and the host, and storing the received instructions in a preset command cache queue;

[0010] After the hot start of the storage device is completed, the instructions stored in the command cache queue are executed.

[0011] In some embodiments, before running the system firmware stored in the non-volatile storage unit, the method further includes:

[0012] When the power supply unit is in a power supply state, when it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold, jumping to a first designated storage location in the volatile storage unit where no data is currently stored;

[0013] The running of the system firmware stored in the non-volatile storage unit includes:

[0014] After the jump is completed, the system firmware stored in the non-volatile storage unit is loaded and run.

[0015] In some embodiments, the method further comprises:

[0016] When it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, recording a designated identifier at a second designated storage location in the volatile storage unit;

[0017] The step of running the system firmware stored in the non-volatile storage unit to initialize the software of the storage device and complete the hot start of the storage device includes:

[0018] The system firmware stored in the non-volatile storage unit is run to initialize the software of the storage device and complete the hot start of the storage device when it is detected that the designated identifier is recorded at the second designated storage location in the volatile storage unit.

[0019] In some embodiments, the method further comprises:

[0020] When it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold and the power supply unit is not currently in a power supply state, the system firmware stored in the non-volatile storage unit is run to initialize the software and hardware of the storage device to complete the cold start of the storage device.

[0021] In some embodiments, when it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, controlling the power supply unit to power the hardware in the storage device and writing the data to be backed up currently in the volatile storage unit into the non-volatile storage unit includes:

[0022] In the absence of a power-off command from the host, when it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, controlling the power supply unit to supply power to the hardware in the storage device and writing the data to be backed up currently in the volatile storage unit into the non-volatile storage unit;

[0023] The method further comprises:

[0024] When receiving a power-off instruction sent by the host, writing the data currently stored in the volatile storage unit into the non-volatile storage unit;

[0025] A response signal to the power-off instruction is sent to the host, so that the host stops supplying power and disconnects the link layer connection between the host and the storage device.

[0026] In some embodiments, the data to be backed up includes at least one of the following: cache data, and a logical address to physical address mapping L2P table.

[0027] According to a second aspect of an embodiment of the present application, a power failure processing device is provided, which is applied to a controller in a storage device, wherein the storage device further includes: a power supply unit, a volatile storage unit, and a non-volatile storage unit, and the device includes:

[0028] a power-off control module configured to control the power supply unit to supply power to the hardware in the storage device and write the data to be backed up currently in the volatile storage unit into the non-volatile storage unit when detecting that the power supply voltage of the external power supply drops below a preset power supply threshold;

[0029] A hot boot control module is used to control the power supply unit to stop supplying power to the hardware in the storage device and to run the system firmware stored in the non-volatile storage unit when it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold value when the power supply unit is in the power supply state, so as to initialize the software of the storage device and complete the hot boot of the storage device.

[0030] In some embodiments, the apparatus further comprises:

[0031] an instruction acquisition module, configured to receive instructions sent by the host through a link layer connection between the storage device and the host while the power supply unit is supplying power to the hardware in the storage device, and store the received instructions in a preset command cache queue;

[0032] An instruction execution module is used to execute the instructions stored in the command cache queue after completing the hot start of the storage device.

[0033] In some embodiments, the apparatus further comprises:

[0034] a jump module, configured to, before running the system firmware stored in the non-volatile storage unit, jump to a first designated storage location in the volatile storage unit where no data is currently stored when detecting that the power supply voltage of the external power supply rises to the preset power supply threshold while the power supply unit is in a power supply state;

[0035] The hot start control module is specifically used to:

[0036] After the jump is completed, the system firmware stored in the non-volatile storage unit is loaded and run.

[0037] In some embodiments, the apparatus further comprises:

[0038] an identification recording module, configured to record a designated identification at a second designated storage location in the volatile storage unit when detecting that the supply voltage of the external power supply drops below a preset power supply threshold;

[0039] The hot start control module is specifically used to:

[0040] The system firmware stored in the non-volatile storage unit is run to initialize the software of the storage device and complete the hot start of the storage device when it is detected that the designated identifier is recorded at the second designated storage location in the volatile storage unit.

[0041] In some embodiments, the apparatus further comprises:

[0042] The cold start control module is used to run the system firmware stored in the non-volatile storage unit to initialize the software and hardware of the storage device and complete the cold start of the storage device when it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold and the power supply unit is not currently in a power supply state.

[0043] In some embodiments, the power-off control module is specifically configured to:

[0044] In the absence of a power-off command from the host, when it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, controlling the power supply unit to supply power to the hardware in the storage device and writing the data to be backed up currently in the volatile storage unit into the non-volatile storage unit;

[0045] The device further comprises:

[0046] a writing module, configured to write the data currently stored in the volatile storage unit into the non-volatile storage unit upon receiving a power-off instruction sent by the host;

[0047] A response signal sending module is used to send a response signal to the host in response to the power-off instruction, so that the host stops supplying power and disconnects the link layer connection between the host and the storage device.

[0048] In some embodiments, the data to be backed up includes at least one of the following: cache data, and a logical address to physical address mapping L2P table.

[0049] According to a third aspect of the embodiments of the present application, an electronic device is provided, including:

[0050] Memory for storing computer programs;

[0051] The processor is configured to implement any of the above-mentioned power-off processing methods when executing a program stored in the memory.

[0052] In another aspect of the embodiments of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the above-mentioned power-off processing methods is implemented.

[0053] In another aspect of the embodiments of the present application, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned power-off processing methods.

[0054] Beneficial effects of the embodiments of the present application:

[0055] In a power outage handling method provided by an embodiment of the present application, a controller within a storage device detects that the voltage of an external power supply has dropped below a preset power threshold, indicating a power outage. Accordingly, the storage device can control its internal power supply unit to power the hardware within the storage device and write the data to be backed up in the volatile storage unit to the non-volatile storage unit. This prevents data loss in the volatile storage unit due to a power outage. If the power supply unit detects that the voltage of the external power supply has risen to a preset power threshold while the power supply unit is still powered, this indicates that the external power supply has resumed supplying power to the storage device before the power supply unit is depleted. Accordingly, after the external power supply is restored, the storage device can control its internal power supply unit to stop supplying power to the hardware within the storage device. Furthermore, the controller can execute system firmware stored in the non-volatile storage unit. It is understood that while the power supply unit within the storage device is providing power, the power supply unit can maintain the operating status of the hardware within the storage device, meaning that the link layer between the storage device and the host remains connected. Therefore, the controller does not need to initialize the hardware within the storage device or restore the link layer connection with the host. In other words, initializing the software of the storage device can complete the startup of the storage device, that is, completing the warm start of the storage device. In this way, the power-on process of the storage device can be simplified, and the startup time of the storage device can be shortened, thereby shortening the unavailable time of the storage device after the fake power failure.

[0056] Of course, it is not necessary to achieve all the advantages described above at the same time when implementing any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0058] Figure 1 A schematic diagram of the structure of a storage device provided in an embodiment of the present application;

[0059] Figure 2 A first flow chart of the power failure processing method provided in an embodiment of the present application;

[0060] Figure 3 A second flow chart of the power failure processing method provided in an embodiment of the present application;

[0061] Figure 4 A schematic diagram of voltage changes of various hardware components when power is restored after a power outage, provided in an embodiment of the present application;

[0062] Figure 5 A structural diagram of a power failure processing device provided in an embodiment of the present application;

[0063] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0064] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field based on this application are within the scope of protection of this application.

[0065] In one implementation, in the event of a false power outage, the SSD first disconnects the link layer connection with the host and then re-executes the complete power-on process. This power-on process requires restoring the link layer connection with the host, which means initializing the SSD's hardware. Furthermore, the SSD's software also needs to be initialized, resulting in a lengthy power-on process and rendering the SSD unusable for an extended period of time.

[0066] The present invention provides a method for handling power failures, which is applied to a controller within a storage device. The storage device may be a solid-state drive (SSD) or other electronic device for storing data. A solid-state drive (SSD) is a hard drive made from an array of solid-state electronic memory chips.

[0067] See also Figure 1 , Figure 1 The storage device 100 includes a controller 110 , a power supply unit 120 , a volatile storage unit 130 , and a non-volatile storage unit 140 .

[0068] The controller 110 (also referred to as a control unit) is a central processing unit (CPU);

[0069] The volatile memory unit 130 and the non-volatile memory unit 140 together constitute a memory unit in the memory device 100 .

[0070] The volatile storage unit 130 is a dynamic random access memory (DRAM) chip. The DRAM chip is used to temporarily store intermediate data generated by the storage device 100 during the operation process, as well as data interacting with other devices outside the storage device 100. The DRAM chip stores data based on the charge and discharge characteristics of the capacitor, but due to the leakage of the capacitor, the stored charge will slowly drain away over time, resulting in data loss. Therefore, it is necessary to refresh the DRAM chip regularly to avoid the loss of data stored in the DRAM chip. It is understandable that after the volatile storage unit 130 is powered off, the data recorded in the volatile storage unit 130 will be lost.

[0071] The non-volatile memory unit 140 is a flash memory chip (FLASH). For example, the FLASH chip can be a NAND flash memory chip. The non-volatile memory unit 140 can retain stored data even after power is turned off.

[0072] The power supply unit 120 may be any electronic component having energy storage and energy supply functions.

[0073] In one implementation, the power supply unit 120 may be composed of a capacitor. While the external power supply is supplying power to the storage device, the capacitor may be charged to store a certain amount of electrical energy. Subsequently, when the external power supply stops supplying power to the storage device, the capacitor discharges to supply power to the storage device.

[0074] It is understandable that the power supply unit can only store a limited amount of electrical energy. Therefore, it is difficult for the power supply unit to maintain the operating status of the hardware within the storage device for a long time relying on the stored electrical energy. For example, under normal circumstances, the continuous power supply duration of the power supply unit within the storage device is generally more than 50ms (milliseconds).

[0075] The hardware in the storage device may include the aforementioned: controller 110 , volatile storage unit 130 , non-volatile storage unit 140 , data transmission interface, etc.

[0076] See also Figure 2 , Figure 2 This is a flowchart of a first method for handling power failures provided in an embodiment of the present application, the method comprising the following steps:

[0077] S101: When it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, the power supply unit is controlled to supply power to the hardware in the storage device and write the data to be backed up in the current volatile storage unit into the non-volatile storage unit.

[0078] S102: When the power supply unit is in a power supply state, when it is detected that the power supply voltage of the external power supply rises to a preset power supply threshold, the power supply unit is controlled to stop supplying power to the hardware in the storage device, and to run the system firmware stored in the non-volatile storage unit to initialize the software of the storage device and complete the hot start of the storage device.

[0079] In a power outage handling method provided by an embodiment of the present application, a controller within a storage device detects that the voltage of an external power supply has dropped below a preset power threshold, indicating a power outage. Accordingly, the storage device can control its internal power supply unit to power the hardware within the storage device and write the data to be backed up in the volatile storage unit to the non-volatile storage unit. This prevents data loss in the volatile storage unit due to a power outage. If the power supply unit detects that the voltage of the external power supply has risen to a preset power threshold while the power supply unit is still powered, this indicates that the external power supply has resumed supplying power to the storage device before the power supply unit is depleted. Accordingly, after the external power supply is restored, the storage device can control its internal power supply unit to stop supplying power to the hardware within the storage device. Furthermore, the controller can execute system firmware stored in the non-volatile storage unit. It is understood that while the power supply unit within the storage device is providing power, the power supply unit can maintain the operating status of the hardware within the storage device, meaning that the link layer between the storage device and the host remains connected. Therefore, the controller does not need to initialize the hardware within the storage device or restore the link layer connection with the host. In other words, initializing the software of the storage device can complete the startup of the storage device, that is, completing the warm start of the storage device. In this way, the power-on process of the storage device can be simplified, and the startup time of the storage device can be shortened, thereby shortening the unavailable time of the storage device after the fake power failure.

[0080] For step S101, the external power source refers to an electronic device currently supplying power to the storage device. Accordingly, the external power source can supply power to the storage device through a power input interface of the storage device.

[0081] For example, the external power supply can be a host that currently needs to exchange data with the storage device. The host can provide power to the storage device through a physical connection between its own power output interface and the power input interface of the storage device.

[0082] The controller can detect the voltage input to the power input interface in real time using a voltage detection circuit within the storage device. The voltage detection circuit can be an analog-to-digital converter (ADC) circuit. The power supply voltage required by the storage device (referred to as the normal power supply voltage) is typically fixed. For example, the normal power supply voltage can be 5V (volts).

[0083] It is understandable that, due to the influence of power supply stability, the actual voltage received by the storage device generally remains within a specified range around the rated output voltage of the external power supply. The rated output voltage of the external power supply is consistent with the normal supply voltage required by the storage device. Fluctuations in the external power supply voltage within this range generally do not affect the operating status of the hardware within the storage device.

[0084] In one implementation, the preset power supply threshold may be the minimum value within a specified range. Specifically, the preset power supply threshold is the minimum voltage output by the external power supply during normal power supply. Accordingly, if the external power supply voltage falls below the preset power supply threshold, it indicates that the external power supply may be unable to properly power the storage device.

[0085] The designated range may be determined by a technician based on the rated output voltage of the external power supply. For example, if the rated output voltage of the external power supply is 5V, the designated range may be 4.5V to 5.5V.

[0086] In another implementation, the preset power supply threshold represents the minimum power supply voltage required to maintain the storage device in an operational state. For example, if the minimum power supply voltage required to maintain the storage device in an operational state is lower than the normal power supply voltage, and the normal power supply voltage is 5V, the preset power supply threshold may be 4V. Accordingly, if the external power supply voltage is lower than the preset power supply threshold, it indicates that the storage device cannot maintain an operational state with the external power supply voltage.

[0087] In one implementation, the voltage detection circuit may generate an interrupt signal (referred to as a first interrupt signal) when detecting that the supply voltage of the external power supply has dropped below a preset supply threshold. Accordingly, the controller may determine, based on the received first interrupt signal, that the supply voltage of the external power supply has dropped below the preset supply threshold.

[0088] When the power supply voltage of the external power supply is detected to drop below a preset power supply threshold, the controller can control the power supply unit to supply power. At this time, the power supply unit starts to supply power to the hardware in the storage device, that is, the power supply unit maintains the working state of the hardware in the storage device.

[0089] In actual application scenarios, the host (external power supply) may terminate power to the storage device without prior notification (this is called an abnormal power outage). For example, poor hardware circuit design of the host may cause problems such as insufficient output power or large output voltage ripple, which may cause such abnormal power outages.

[0090] The external power source stops supplying power to the storage device, that is, stops supplying power to the volatile storage unit in the storage device. Accordingly, the data recorded in the volatile storage unit will be lost.

[0091] To prevent data loss in the volatile storage unit due to power outages, the controller can write the backup data currently in the volatile storage unit to the non-volatile storage unit when it detects that the external power supply voltage has dropped below a preset threshold. At this point, the power supply unit within the storage device provides power to the controller, volatile storage unit, and non-volatile storage unit.

[0092] In some embodiments, the data to be backed up includes at least one of the following: cache data, and a logical address to physical address mapping table.

[0093] In the embodiment of the present application, cache data refers to data stored in a cache memory that is frequently used by the controller or that needs to frequently interact with the host.

[0094] Among them, the storage device usually uses the storage space in the DRAM chip as a cache memory (Cache Memory) to achieve fast access by the controller.

[0095] The logical address to physical address mapping table (L2P) is used to record the mapping relationship between the logical address of the host and the physical address of the flash memory chip.

[0096] Based on the above processing, the cached data contains data that is frequently used by the controller or needs to frequently interact with the host. If the cached data is lost, it may cause problems such as incomplete data reading and write errors. Writing the cached data to the non-volatile storage unit can continue to read and write this part of the cached data after the power supply to the storage device is restored, thereby ensuring the integrity and availability of the data.

[0097] The L2P table records the mapping between the host's logical addresses and the flash memory chip's physical addresses. If the L2P table stored in the volatile storage unit is lost, the storage device will be unable to correctly locate the data storage location after power is restored, resulting in data read or write failures. Writing the L2P table to the non-volatile storage unit allows the data to be accurately located and managed based on the L2P table's contents after power is restored, thus avoiding data unavailability caused by the loss of the L2P table.

[0098] The controller controls the power supply unit to supply power to the hardware in the storage device, writes the data to be backed up in the current volatile storage unit into the non-volatile storage unit, and the subsequent hot start process can be called a processing flow for fake power failure.

[0099] Accordingly, when it is detected that the power supply voltage of the external power supply drops below the preset power supply threshold, the controller may execute step S101 once to ensure the integrity and correctness of the data stored in the storage device.

[0100] In one implementation, after the power supply unit starts to supply power to the hardware in the storage device, the controller can detect the voltage input to the power input interface in real time through the voltage detection circuit in the storage device until it detects that the power supply voltage of the external power supply rises to a preset power supply threshold; or until the power of the power supply unit in the storage device is exhausted.

[0101] Regarding step S102, when the power supply unit is in the power supply state, the power supply unit in the storage device supplies power to the controller, volatile storage unit, non-volatile storage unit and other hardware. Accordingly, during the period when the power supply unit supplies power, the hardware in the storage device is in an operating state.

[0102] When the power supply unit is in the power supply state, the controller detects that the power supply voltage of the external power source has increased to a preset power supply threshold, indicating that the external power source has resumed powering the storage device before the power supply unit in the storage device is exhausted. Accordingly, the controller can control the power supply unit to stop supplying power.

[0103] In one implementation, the voltage detection circuit may generate an interrupt signal (referred to as a second interrupt signal) when detecting that the supply voltage of the external power supply has increased to a preset supply threshold. Accordingly, the controller may determine, based on the received second interrupt signal, that the supply voltage of the external power supply has increased to the preset supply threshold.

[0104] When the external power supply voltage is detected to have reached a preset threshold, the storage device's controller must perform a power-up process. Since the storage device's hardware remains operational while the power supply unit is providing power, the controller does not need to reinitialize the storage device's hardware; it only needs to initialize the storage device's software. Accordingly, the controller can execute the system firmware stored in the non-volatile storage unit to initialize the storage device's software.

[0105] The process in which the controller skips initializing the storage device's hardware and runs the system firmware stored in the non-volatile storage unit to initialize the storage device's software can be called a hot boot (or hot restart). During the hot boot process, the power supply unit in the external power supply provides power to the controller, volatile storage unit, and non-volatile storage unit.

[0106] System firmware is a software program that runs on the storage device's controller. By running system firmware, the storage device's controller can interpret and execute commands sent by the host, and perform operations such as reading, writing, deleting, and encrypting data.

[0107] In one implementation, the controller may locate and read data of the system firmware in the non-volatile storage unit, load the read data into an instruction tightly coupled memory (ITCM) in the controller, and run the loaded system firmware.

[0108] In some embodiments, before the step of executing the system firmware stored in the non-volatile storage unit, the method further includes:

[0109] When the power supply unit is in a power supply state, when it is detected that the power supply voltage of the external power source rises to a preset power supply threshold, the memory jumps to a first designated storage location in the volatile storage unit where no data is currently stored.

[0110] The steps of running the system firmware stored in the non-volatile storage unit include:

[0111] After the jump is completed, the system firmware stored in the non-volatile storage unit is loaded and run.

[0112] In an embodiment of the present application, while the power supply unit is supplying power, the controller is still running the system firmware that was loaded and run during the last complete power-on process or the last hot start step (which can be called the system firmware currently to be refreshed).

[0113] When the controller needs to initialize the software of the storage device, it needs to refresh the currently running system firmware. It is understandable that since the code space within the controller is limited, if the system firmware currently to be refreshed continues to occupy the controller's code space, it may cause the data of the historical system firmware (the system firmware currently to be refreshed) to conflict with the data of the newly running system firmware. Therefore, it is necessary to control the system firmware currently to be refreshed to jump to the storage space in the volatile storage unit that currently does not store data (i.e., the storage space indicated by the first designated storage location).

[0114] After the jump is completed, the controller can run the system firmware stored in the non-volatile storage unit to initialize the software of the storage device and complete the hot start of the storage device.

[0115] Based on the above process, during a hot boot, the controller can redirect the system firmware currently being updated to a first designated storage location in the volatile storage unit where no data is currently stored. After the redirect is complete, the system firmware is loaded and executed. This prevents the system firmware currently being updated from occupying the controller's code space and interfering with the initialization of the software in the storage device, thus avoiding data processing errors.

[0116] In some embodiments, the method further comprises:

[0117] Step 1: While the power supply unit is supplying power to the hardware in the storage device, a command sent by the host is received through the link layer connection between the storage device and the host, and the received command is stored in a preset command cache queue.

[0118] Step 2: After the hot start of the storage device is completed, the instructions stored in the command cache queue are executed.

[0119] In the embodiment of the present application, the hardware within the storage device is in operation while the power supply unit is providing power. That is, the link layer between the storage device and the host remains connected until the power supply unit within the storage device is depleted. Therefore, the controller can receive commands sent by the host through the link layer connection between the storage device and the host, and store the received commands in a preset command cache queue.

[0120] For example, the command sent by the host may include at least one of the following: a data read command, a data write command, a storage space query command, etc.

[0121] The preset command cache queue can be stored in a storage space in the controller, wherein the storage space in the controller is a volatile storage space.

[0122] Accordingly, after completing the hot start of the storage device, the controller may execute the instructions stored in the command cache queue through the system firmware.

[0123] Based on the above processing, the power supply unit can be used to maintain the link layer connection between the storage device and the host for a certain period of time when the external power supply is unable to supply power, so as to receive instructions sent by the host and store them in a preset command cache queue. Subsequently, after the external power supply resumes supplying power to the storage device, the instructions stored in the command cache queue are executed. During the above hot start process, since the link layer connection between the storage device and the host is not disconnected, the host can send instructions to the storage device normally, thus achieving the host's unawareness.

[0124] Furthermore, the hot start process does not require the storage device to be powered on again, eliminating the need for the host and storage device to frequently execute their respective power-on and power-off procedures, thus improving the stability of the entire host and storage system. User service requests are also not interrupted, thus ensuring service continuity. During the hot start, I / O (input / output) data requests (commands) sent by the host can be resumed after external power is restored, preventing the host from being unable to read or write data to the storage device or even failing to recognize the disk.

[0125] In addition, the storage device can store the received instructions in a command cache queue, so that after the external power supply is restored to the storage device, the corresponding instructions can be processed immediately to avoid data errors and ensure data correctness.

[0126] In some embodiments, the method further comprises:

[0127] When it is detected that the supply voltage of the external power source drops below a preset power supply threshold, a designated identifier is recorded at a second designated storage location in the volatile storage unit.

[0128] The above-mentioned step of running the system firmware stored in the non-volatile storage unit to initialize the software of the storage device and complete the hot start of the storage device includes:

[0129] The system firmware stored in the non-volatile storage unit is run to initialize the software of the storage device and complete the hot start of the storage device when it is detected that the designated identifier is recorded at the second designated storage location in the volatile storage unit.

[0130] In an embodiment of the present application, when it is detected that the supply voltage of the external power supply drops below a preset power supply threshold, the controller may record a designated identifier (which may be referred to as a hot start flag) at a second designated storage location in the volatile storage unit.

[0131] It is understandable that the power supply unit starts to supply power when it detects that the power supply voltage of the external power supply drops below a preset power supply threshold. If the power of the power supply unit in the storage device is exhausted and the external power supply does not resume power supply to the storage device, the data in the volatile storage unit will also be lost.

[0132] When the power supply unit is in a power supply state, the controller detects that the power supply voltage of the external power supply has increased to a preset power supply threshold, indicating that the external power supply has resumed supplying power to the storage device before the power supply unit in the storage device is exhausted. At this time, the designated identifier is recorded at the second designated storage location in the volatile storage unit. Accordingly, the controller can perform a hot boot.

[0133] Based on the above processing, the characteristic of the volatile storage unit that data becomes volatile upon power failure can be exploited. After the external power supply to the storage device stops, a designated flag instructing the controller to perform a hot boot can be written into the volatile storage unit. Accordingly, when the external power supply to the storage device resumes, the designated flag is recorded at the second designated storage location in the volatile storage unit, indicating that the hot boot conditions are met. The controller can then determine to perform a hot boot based on the recorded flag.

[0134] In some embodiments, see Figure 3 , Figure 3 A flowchart of another power-off processing method provided in an embodiment of the present application.

[0135] exist Figure 2 Based on this, the method also includes:

[0136] S103: When it is detected that the power supply voltage of the external power supply rises to a preset power supply threshold and the current power supply unit is not in a power supply state, the system firmware stored in the non-volatile storage unit is run to initialize the software and hardware of the storage device to complete the cold start of the storage device.

[0137] In this embodiment of the present application, when it is detected that the external power supply voltage has risen to a preset power supply threshold and the power supply unit is not currently in a power supply state, this indicates that no power supply was available to power the hardware within the storage device before the external power supply began to power the storage device. Accordingly, when the external power supply begins to power the storage device, the controller must initialize the hardware and software within the storage device, restore the link layer connection with the host, and complete a cold start of the storage device.

[0138] The controller's initialization of the storage device's hardware includes hardware reset, initialization of the storage units, and hardware circuit self-tests. For example, a hardware reset clears or sets the registers in the controller chip to their default values. A hardware circuit self-test checks whether the hardware circuits are functioning properly and whether the storage units are damaged.

[0139] It is understandable that there is at least one of the following two situations, which requires the controller to perform the cold start processing flow when detecting that the supply voltage of the external power supply increases to a preset power supply threshold:

[0140] Scenario 1: The host sends a power-off command to the storage device, while maintaining power to the storage device. The storage device executes the power-off process and, upon completion, sends a signal to the host indicating the completion of the process (i.e., a response signal to the power-off command). Upon receiving this response signal, the host can stop powering the storage device and disconnect the link layer connection between the storage device and the host. At this point, the storage device will not utilize its internal power supply module for power.

[0141] Case 2: The host terminates power to the SSD without prior notification. In response, the storage device controller, upon detecting that the external power supply voltage has dropped below a preset threshold, controls the power supply unit to continue supplying power until the power supply unit within the storage device is depleted. This situation is a true abnormal power outage.

[0142] Based on the above processing, during the cold start process, the controller can initialize the software and hardware of the storage device to complete the cold start of the storage device.

[0143] As can be seen, the processing methods based on the above embodiment can effectively distinguish between false power outages and true abnormal power outages, and adopt different methods to handle each. This allows a non-sensing warm restart mechanism to be used in the event of a false power outage, without resetting the hardware, that is, without having to reinitialize the storage device hardware. In addition, retaining the command cache queue solves the problem of disk recognition failure or I / O interruption in the event of a long-term voltage drop, improving the robustness of the storage device to host voltage jitter.

[0144] In some embodiments, step S101 includes:

[0145] When no power-off command is received from the host, and when it is detected that the supply voltage of the external power supply drops below the preset power supply threshold, the power supply unit is controlled to power the hardware in the storage device and write the data to be backed up in the current volatile storage unit to the non-volatile storage unit.

[0146] The method also includes:

[0147] Step 1: When a power-off command is received from the host, the data currently stored in the volatile storage unit is written into the non-volatile storage unit.

[0148] Step 2: Send a response signal to the host in response to the power-off command, so that the host stops supplying power and disconnects the link layer connection between the host and the storage device.

[0149] In an embodiment of the present application, if the storage device detects that the supply voltage of the external power supply has dropped below a preset power supply threshold without receiving a power-off command from the host, that is, the host terminates the power supply to the storage device without prior notification (i.e., an abnormal power outage). In this case, the drop in the supply voltage of the external power supply below the preset power supply threshold may be caused by voltage jitter in the host power supply circuit. Accordingly, the controller in the storage device can execute the above-mentioned processing flow for false power outages once to shorten the duration of unavailability of the storage device after the false power outage.

[0150] If the storage device receives a power-off command from the host, it can execute a normal power-off procedure. Specifically, it writes all data currently stored in the volatile storage unit to the non-volatile storage unit. After the normal power-off procedure is complete, the storage device can send a response signal to the host in response to the power-off command. Upon receiving this response signal, the host can stop powering the storage device and disconnect the link layer connection between the storage device and the host. During a normal power-off procedure, the storage device does not utilize its internal power supply module.

[0151] Based on the above processing, the storage device can perform a normal power-off process in conjunction with the power-off command sent by the host. Since the host still powers the storage device during a normal power-off process, the storage device can write all data currently stored in the volatile storage unit to the non-volatile storage unit, thereby ensuring data integrity as much as possible.

[0152] In one implementation, in the event of a power outage due to voltage jitter in an external power supply, additional hardware circuits can be added to the storage device to detect the instantaneous low voltage caused by the jitter, thereby preventing the controller from directly disconnecting the link layer connection with the host when the instantaneous low voltage is detected.

[0153] For example, a filter capacitor and an energy storage capacitor can be added to the power input interface of the storage device to prevent transient impacts of the supply voltage of the external power supply.

[0154] Alternatively, a pulse width comparison circuit can be added to the storage device's power input interface to compare the duration of the low-voltage signal with a preset power-off time (e.g., 500µs) to distinguish between jitter and a true power-off. Thus, if voltage jitter occurs within the preset power-off time, it can be determined that the external power supply voltage is jittering and the signal is ignored. Otherwise, it is determined to be a true power-off, triggering the power-off process.

[0155] Compared to the aforementioned hardware approach, the power-loss handling method provided in this embodiment eliminates the need for additional hardware circuitry in the storage device, thus avoiding increased hardware costs. By dynamically handling power supply voltage jitter at the software level, the reliability and robustness of the storage device are improved while maintaining compatibility with hardware jitter filtering, making it suitable for enterprise-level high-stability scenarios.

[0156] When power outage occurs due to power supply jitter, the internal power supply unit is used for power supply, and abnormal power loss detection (Power Loss Detect, PLD) is implemented in combination with the internal power supply to perform abnormal power loss protection (Power Loss Protect, PLP). Moreover, the power loss processing method provided in the embodiment of the present application supports the external power supply voltage jitter time up to the continuous power supply time of the internal power supply unit, which can significantly improve the enhanced de-jitter time. That is, it avoids the storage device from frequently executing the power-off process and the above-mentioned cold start processing process due to jitter. In this way, the problem of business interruption caused by long-term voltage jitter in actual application can be effectively solved.

[0157] See also Figure 4 , Figure 4 A schematic diagram of the voltage changes of various hardware when power is restored after a power outage is provided in an embodiment of the present application.

[0158] Figure 4 In the graph, the horizontal axis represents time, and the vertical axis represents voltage. VIN represents the supply voltage of the external power supply. The supply voltage of the external power supply begins to decrease at time t0 and drops to a preset power supply threshold at time t1. That is, at time t1, the controller detects that the supply voltage of the external power supply has dropped below the preset power supply threshold and controls the power supply unit to power the hardware in the storage device and write the data to be backed up in the volatile storage unit to the non-volatile storage unit.

[0159] Different hardware in the storage device may require different power supply voltages. For example, the power supply voltage required by the volatile storage unit may be 1.2V, and the power supply voltage required by the non-volatile storage unit may be 1.5V.

[0160] The external power supply voltage begins to rise at time t2, reaches a preset power supply threshold at time t3, and then reaches the normal power supply voltage at time t4. That is, at time t3, while the power supply unit is in the power supply state, the controller detects that the external power supply voltage has risen to the preset power supply threshold. Accordingly, the controller can control the power supply unit to stop supplying power to the hardware within the storage device and run the system firmware stored in the non-volatile storage unit to initialize the storage device software and complete a hot boot of the storage device. Accordingly, between time t1 and time t4, the power supply unit voltage continues to decrease.

[0161] Based on the same inventive concept, an embodiment of the present application provides a power failure processing device, which is applied to a controller in a storage device, wherein the storage device further includes: a power supply unit, a volatile storage unit, and a non-volatile storage unit. Figure 5 , Figure 5 This is a structural diagram of a power failure processing device provided in an embodiment of the present application, the device comprising:

[0162] a power-off control module 501 configured to control the power supply unit to supply power to the hardware in the storage device and write the data to be backed up currently in the volatile storage unit into the non-volatile storage unit when detecting that the power supply voltage of the external power supply drops below a preset power supply threshold;

[0163] The hot start control module 502 is used to control the power supply unit to stop supplying power to the hardware in the storage device and run the system firmware stored in the non-volatile storage unit when it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold value when the power supply unit is in the power supply state, so as to initialize the software of the storage device and complete the hot start of the storage device.

[0164] In some embodiments, the apparatus further comprises:

[0165] an instruction acquisition module, configured to receive instructions sent by the host through a link layer connection between the storage device and the host while the power supply unit is supplying power to the hardware in the storage device, and store the received instructions in a preset command cache queue;

[0166] An instruction execution module is used to execute the instructions stored in the command cache queue after completing the hot start of the storage device.

[0167] In some embodiments, the apparatus further comprises:

[0168] a jump module, configured to, before running the system firmware stored in the non-volatile storage unit, jump to a first designated storage location in the volatile storage unit where no data is currently stored when detecting that the power supply voltage of the external power supply rises to the preset power supply threshold while the power supply unit is in a power supply state;

[0169] The hot start control module 502 is specifically configured to:

[0170] After the jump is completed, the system firmware stored in the non-volatile storage unit is loaded and run.

[0171] In some embodiments, the apparatus further comprises:

[0172] an identification recording module, configured to record a designated identification at a second designated storage location in the volatile storage unit when detecting that the supply voltage of the external power supply drops below a preset power supply threshold;

[0173] The hot start control module 502 is specifically configured to:

[0174] The system firmware stored in the non-volatile storage unit is run to initialize the software of the storage device and complete the hot start of the storage device when it is detected that the designated identifier is recorded at the second designated storage location in the volatile storage unit.

[0175] In some embodiments, the apparatus further comprises:

[0176] The cold start control module is used to run the system firmware stored in the non-volatile storage unit to initialize the software and hardware of the storage device and complete the cold start of the storage device when it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold and the power supply unit is not currently in a power supply state.

[0177] In some embodiments, the power-off control module 501 is specifically configured to:

[0178] In the absence of a power-off command from the host, when it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, controlling the power supply unit to supply power to the hardware in the storage device and writing the data to be backed up currently in the volatile storage unit into the non-volatile storage unit;

[0179] The device further comprises:

[0180] a writing module, configured to write the data currently stored in the volatile storage unit into the non-volatile storage unit upon receiving a power-off instruction sent by the host;

[0181] A response signal sending module is used to send a response signal to the host in response to the power-off instruction, so that the host stops supplying power and disconnects the link layer connection between the host and the storage device.

[0182] In some embodiments, the data to be backed up includes at least one of the following: cache data, and a logical address to physical address mapping L2P table.

[0183] The present application also provides an electronic device, such as Figure 6 Shown, including:

[0184] Memory 601, used for storing computer programs;

[0185] The processor 602 is configured to implement the steps of the above-mentioned power-off processing method when executing the program stored in the memory 601 .

[0186] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 602, the communication interface, and the memory 601 communicate with each other via the communication bus.

[0187] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0188] The communication interface is used for communication between the above electronic device and other devices.

[0189] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0190] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0191] In another embodiment provided by the present application, a computer-readable storage medium is further provided, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the steps of any of the above-mentioned power-off processing methods are implemented.

[0192] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any power-off processing method in the above embodiments.

[0193] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state drive (SSD).

[0194] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0195] Each embodiment in this specification is described in a related manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences between the other embodiments. In particular, the device, electronic device, and computer-readable storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For related portions, reference can be made to the descriptions of the method embodiments.

[0196] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application are included in the scope of protection of the present application.

Claims

1. A power failure processing method, characterized in that: A controller applied to a storage device, wherein the storage device further comprises: a power supply unit, a volatile storage unit, and a non-volatile storage unit, wherein the method comprises: When it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, the power supply unit is controlled to supply power to the hardware in the storage device and the data to be backed up currently in the volatile storage unit is written into the non-volatile storage unit; When the power supply unit is in a power supply state, when it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold, the power supply unit is controlled to stop supplying power to the hardware in the storage device, and the system firmware stored in the non-volatile storage unit is run to initialize the software of the storage device and complete the hot start of the storage device.

2. The method according to claim 1, characterized in that The method further comprises: During the period when the power supply unit supplies power to the hardware in the storage device, receiving instructions sent by the host through the link layer connection between the storage device and the host, and storing the received instructions in a preset command cache queue; After the hot start of the storage device is completed, the instructions stored in the command cache queue are executed.

3. The method according to claim 1, characterized in that Before running the system firmware stored in the non-volatile storage unit, the method further includes: When the power supply unit is in a power supply state, when it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold, jumping to a first designated storage location in the volatile storage unit where no data is currently stored; The running of the system firmware stored in the non-volatile storage unit includes: After the jump is completed, the system firmware stored in the non-volatile storage unit is loaded and run.

4. The method according to claim 1, wherein The method further comprises: When it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, recording a designated identifier at a second designated storage location in the volatile storage unit; The step of running the system firmware stored in the non-volatile storage unit to initialize the software of the storage device and complete the hot start of the storage device includes: The system firmware stored in the non-volatile storage unit is run to initialize the software of the storage device and complete the hot start of the storage device when it is detected that the designated identifier is recorded at the second designated storage location in the volatile storage unit.

5. The method according to claim 1, characterized in that The method further comprises: When it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold and the power supply unit is not currently in a power supply state, the system firmware stored in the non-volatile storage unit is run to initialize the software and hardware of the storage device to complete the cold start of the storage device.

6. The method according to claim 1, characterized in that When it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, the power supply unit is controlled to supply power to the hardware in the storage device, and the data to be backed up in the volatile storage unit is written into the non-volatile storage unit, including: In the absence of a power-off command from the host, when it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, controlling the power supply unit to supply power to the hardware in the storage device and writing the data to be backed up currently in the volatile storage unit into the non-volatile storage unit; The method further comprises: When receiving a power-off instruction sent by the host, writing the data currently stored in the volatile storage unit into the non-volatile storage unit; A response signal to the power-off instruction is sent to the host, so that the host stops supplying power and disconnects the link layer connection between the host and the storage device.

7. The method according to any one of claims 1 to 6, characterized in that The data to be backed up includes at least one of the following: cache data, and a logical address to physical address mapping L2P table.

8. A power failure processing device, characterized in that: A controller applied to a storage device, wherein the storage device further comprises: a power supply unit, a volatile storage unit, and a non-volatile storage unit, wherein the device comprises: a power-off control module configured to control the power supply unit to supply power to the hardware in the storage device and write the data to be backed up currently in the volatile storage unit into the non-volatile storage unit when detecting that the power supply voltage of the external power supply drops below a preset power supply threshold; A hot boot control module is used to control the power supply unit to stop supplying power to the hardware in the storage device and to run the system firmware stored in the non-volatile storage unit when it is detected that the power supply voltage of the external power supply rises to the preset power supply threshold value when the power supply unit is in the power supply state, so as to initialize the software of the storage device and complete the hot boot of the storage device.

9. The device according to claim 8, characterized in that The device further comprises: an instruction acquisition module, configured to receive instructions sent by the host through a link layer connection between the storage device and the host while the power supply unit is supplying power to the hardware in the storage device, and store the received instructions in a preset command cache queue; An instruction execution module, configured to execute instructions stored in the command cache queue after completing a hot start of the storage device; and / or, The device further comprises: a jump module, configured to, before running the system firmware stored in the non-volatile storage unit, jump to a first designated storage location in the volatile storage unit where no data is currently stored when detecting that the power supply voltage of the external power supply rises to the preset power supply threshold while the power supply unit is in a power supply state; The hot start control module is specifically used to: After the jump is completed, the system firmware stored in the non-volatile storage unit is loaded and run; and / or, The device further comprises: an identification recording module, configured to record a designated identification at a second designated storage location in the volatile storage unit when detecting that the supply voltage of the external power supply drops below a preset power supply threshold; The hot start control module is specifically used to: running the system firmware stored in the non-volatile storage unit to initialize the software of the storage device and complete a hot boot of the storage device when detecting that the designated identifier is recorded at the second designated storage location in the volatile storage unit; and / or, The device further comprises: a cold start control module, configured to, when detecting that the power supply voltage of the external power supply rises to the preset power supply threshold and the power supply unit is not currently in a power supply state, run the system firmware stored in the non-volatile storage unit to initialize the software and hardware of the storage device and complete a cold start of the storage device; and / or, The power-off control module is specifically configured to: In the absence of a power-off command from the host, when it is detected that the power supply voltage of the external power supply drops below a preset power supply threshold, controlling the power supply unit to supply power to the hardware in the storage device and writing the data to be backed up currently in the volatile storage unit into the non-volatile storage unit; The device further comprises: a writing module, configured to write the data currently stored in the volatile storage unit into the non-volatile storage unit upon receiving a power-off instruction sent by the host; a response signal sending module, configured to send a response signal to the host in response to the power-off instruction, so that the host stops supplying power and disconnects the link layer connection between the host and the storage device; and / or, The data to be backed up includes at least one of the following: cache data, and a logical address to physical address mapping L2P table.

10. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the method according to any one of claims 1 to 7 when executing a program stored in a memory.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.