Method and device for determining downflash data volume and storage equipment

By updating and detecting the amount of down-brushing data after abnormal power-off of the motherboard, the problem of down-brushing data adapted to the storage device and the motherboard is solved, and the integrity and reliability of down-brushing data is achieved.

CN119883759AActive Publication Date: 2025-04-25HANGZHOU HIKSTORAGE TECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411945431.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-25
Estimated Expiration
2044-12-25

AI Technical Summary

Technical Problem

How to determine the maximum available data available for the storage device to match the current motherboard, so as to avoid the problem of power loss if the data is not brushed.

Method used

By updating the down-brushing data volume of the storage device in response to abnormal power failure of the motherboard, brushing data based on the updating down-brushing data volume obtained, and detecting whether the down-brushing data volume is completed after a specified operation (such as power-up operation), and determining whether the end condition for updating the down-brushing data volume is reached to determine the adapted down-brushing data volume.

Benefits of technology

The maximum available data available for brushing is effectively determined to match the storage device with the currently connected motherboard to ensure the integrity and reliability of brushing data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883759A_ABST
    Figure CN119883759A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method and a device for determining downflash data volume and storage equipment, and relates to the technical field of data processing. According to the specific implementation scheme, the method comprises the following steps: in response to abnormal power failure of a currently connected mainboard, updating the downflash data volume of the storage equipment; performing data downbrushing based on the updated downbrushing data volume; in response to the specified operation, performing detection to obtain a detection result which represents whether the downward brushing of the data corresponding to the specified operation is completed or not; based on the detection result corresponding to the current specified operation and the detection result corresponding to the last specified operation, determining whether an end condition for updating the downswipe data volume is reached or not; and if the end condition is met, determining the maximum available downflash data volume matched with the currently connected mainboard, and stopping updating the downflash data volume of the storage device for the currently connected mainboard. Therefore, according to the scheme of the invention, the maximum available downflash data volume matched with the currently connected mainboard can be effectively determined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device and storage device for determining the amount of data to be refreshed. Background Art

[0002] For storage devices such as SSD (Solid State Disk), in order to operate reliably and efficiently, it is necessary to flush data for various metadata when the electronic device on which it is installed loses power. The so-called data flushing refers to storing data in a non-volatile storage medium, where the motherboard in the electronic device serves as the power supply end of the storage device. In the event of an abnormal power failure of the motherboard to which the storage device is connected, the storage device can rely on the motherboard's backup power supply module to supply power for data flushing. The abnormal power failure of the motherboard may be caused by sudden power outages and power supply damage.

[0003] However, different motherboards have different power supply durations for storage devices when power is off abnormally. If the amount of data to be flushed for the storage device is set too large, the power may be cut off before the data is flushed. If the amount of data to be flushed is set too small, although the refresh can be completed when the power is off, only a small amount of data is refreshed, which makes it difficult to recover the data based on the flushed data.

[0004] It can be seen that how to determine the maximum available amount of data to be flushed that is compatible with the storage device and the currently connected mainboard is an issue that needs to be solved urgently. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a method, device and storage device for determining the amount of data to be flushed, so as to determine the maximum amount of data available to be flushed that is compatible with the storage device and the currently connected motherboard. The specific technical solution is as follows:

[0006] In a first aspect, the present application provides a method for determining the amount of data to be flushed, which is applied to a storage device; the method comprises:

[0007] In response to abnormal power failure of the currently connected mainboard, updating the amount of data to be flushed down the storage device;

[0008] Based on the updated refresh data volume, data is refreshed;

[0009] In response to a designated operation, whether the first type of data volume corresponding to the designated operation is the same as the second type of data volume corresponding to the designated operation is detected, and a detection result indicating whether data flushing corresponding to the designated operation is completed is obtained; wherein the designated operation is a power-on operation performed in response to an abnormal power failure of the mainboard; the first type of data volume and the second type of data volume corresponding to any designated operation are respectively the volume of data flushed after the mainboard targeted by the designated operation is powered off abnormally and the volume of data flushed based thereon;

[0010] Based on the detection result corresponding to the current specified operation and the detection result corresponding to the last specified operation, determining whether the end condition for updating the amount of data to be refreshed is met;

[0011] If the termination condition is met, based on the second type of data volume corresponding to this specified operation or the second type of data volume corresponding to the last specified operation, determine the maximum available flush data volume that is compatible with the currently connected motherboard, and stop updating the flush data volume of the storage device for the currently connected motherboard.

[0012] Optionally, before updating the amount of data to be flushed to the storage device, the method further includes:

[0013] Detect whether the triggering conditions for power supply capability detection of the currently connected motherboard are met;

[0014] The updating of the amount of data to be flushed to the storage device includes:

[0015] When the trigger condition is met, the amount of data to be flushed to the storage device is updated according to the update method corresponding to the satisfied trigger condition.

[0016] Optionally, there are multiple trigger conditions, and the multiple trigger conditions include a first condition, a second condition, a third condition and a fourth condition;

[0017] The first condition includes that the currently connected mainboard has changed relative to the mainboard connected when the mainboard was powered off abnormally last time; the second condition includes that the current detection round is in power supply capacity detection; the third condition includes that the interval between the current time and the time when the amount of data was last updated exceeds a predetermined time length; the fourth condition includes that when the mainboard was powered off abnormally last time, the update process of the amount of data was not executed, and the target detection characterization data corresponding to the specified operation of the last abnormal power off of the mainboard was not refreshed;

[0018] The method further comprises:

[0019] When the termination condition is not met, the storage device is set to be currently in a detection round of power supply capability detection.

[0020] Optionally, updating the amount of data to be flushed from the storage device according to the update method corresponding to the satisfied trigger condition includes:

[0021] If the first condition is met, the amount of data flushed from the storage device is updated to a minimum amount of data flushed, and the update direction of the amount of data flushed is set to increase;

[0022] If the second condition is met, the amount of data to be flushed from the storage device is updated based on the amount of data to be flushed from the most recent update of the storage device in accordance with the current update direction and update rules, while keeping the current update direction unchanged; the update principle is that the amount of data to be flushed does not exceed a preset maximum critical value of the amount of data to be flushed;

[0023] If the third condition is met, the amount of data flushed from the storage device is updated to the amount of data flushed from the most recent update of the storage device, and the update direction is set to increase;

[0024] If the fourth condition is met, the amount of data to be flushed from the storage device is reduced based on the amount of data to be flushed from the storage device obtained by the most recent update, and the update direction is set to decrease.

[0025] Optionally, the determining whether an end condition for updating the amount of data to be refreshed is met based on the detection result corresponding to the current designated operation and the detection result corresponding to the last designated operation includes:

[0026] If any of the first matching relationship, the second matching relationship, the third matching relationship and the fourth matching relationship is met, it is determined that the end condition for updating the amount of data to be refreshed is met;

[0027] The first matching relationship is that the detection result representation corresponding to the current designated operation is completed, the detection result representation corresponding to the previous designated operation is not completed, and the update direction of the second type of data volume corresponding to the current designated operation when being updated is to decrease;

[0028] The second matching relationship is: the detection result corresponding to the current designated operation is characterized as incomplete, the detection result corresponding to the previous designated operation is characterized as completed, and the update direction of the second type of data volume corresponding to the current designated operation when being updated is increasing;

[0029] The third matching relationship is: the detection result corresponding to the current designated operation is characterized to be completed, and the second type of data volume corresponding to the current designated operation is the preset maximum critical value of the down-brush volume;

[0030] The fourth matching relationship is: the detection result corresponding to the current designated operation is characterized as incomplete, and the second type of data volume corresponding to the current designated operation is a preset minimum critical value of the down-brush volume.

[0031] Optionally, determining the maximum available amount of data to be flushed that is compatible with the currently connected mainboard based on the amount of second-category data corresponding to the current designated operation or the amount of second-category data corresponding to the last designated operation includes:

[0032] When the first matching relationship or the third matching relationship is met, the second type of data volume corresponding to the current specified operation is determined as the maximum available down-flash data volume that is compatible with the currently connected motherboard; when the second matching relationship is met, the second type of data volume corresponding to the last specified operation is determined as the maximum available down-flash data volume that is compatible with the currently connected motherboard; when the fourth matching relationship is met, the minimum critical value of the down-flash volume is determined as the maximum available down-flash data volume that is compatible with the currently connected motherboard.

[0033] Optionally, the method further includes:

[0034] In response to the specified operation, obtaining each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence;

[0035] Generate unique identification information of the currently connected mainboard based on each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence;

[0036] The unique identification information of the currently connected motherboard is compared with the target identification information. If they are the same, it indicates that the currently connected motherboard has changed compared to the motherboard connected when the previous motherboard was abnormally powered off; wherein, the target identification information is the unique identification information of the connected motherboard recorded by the storage device.

[0037] Optionally, the step of performing data flushing based on the updated flushing data amount includes:

[0038] According to a predetermined data selection rule, metadata to be refreshed having an updated refresh data amount is selected from various metadata currently stored; wherein the data selection rule is that data with a high degree of importance is selected in priority to data with a low degree of importance;

[0039] The selected metadata is stored in a predetermined non-volatile storage medium for data flushing.

[0040] In a second aspect, the present application provides a device for determining the amount of data to be flushed, which is applied to a storage device; the device comprises:

[0041] An update module, configured to update the amount of data to be flushed from the storage device in response to an abnormal power failure of a currently connected mainboard;

[0042] A refresh module, used for refreshing data based on the updated refresh data volume;

[0043] A detection module, configured to detect, in response to a specified operation, whether the first type of data volume corresponding to the specified operation is the same as the second type of data volume corresponding to the specified operation, and obtain a detection result indicating whether data flushing corresponding to the specified operation is completed; wherein the specified operation is a power-on operation performed in response to an abnormal power failure of the mainboard; the first type of data volume and the second type of data volume corresponding to any specified operation are respectively the volume of data flushed after the mainboard for which the specified operation is performed is abnormally powered off and the amount of data flushed based thereon;

[0044] A first determination module, used to determine whether an end condition for updating the amount of data to be refreshed is met based on a detection result corresponding to the current designated operation and a detection result corresponding to the last designated operation;

[0045] The second determination module is used to determine the maximum available flush data volume compatible with the currently connected mainboard based on the second type of data volume corresponding to the current specified operation or the second type of data volume corresponding to the last specified operation if the termination condition is met, and stop updating the flush data volume of the storage device for the currently connected mainboard.

[0046] Optionally, before updating the amount of data to be flushed to the storage device, the method further includes:

[0047] Detect whether the triggering conditions for power supply capability detection of the currently connected motherboard are met;

[0048] The updating of the amount of data to be flushed to the storage device includes:

[0049] When the trigger condition is met, the amount of data to be flushed to the storage device is updated according to the update method corresponding to the satisfied trigger condition.

[0050] Optionally, there are multiple trigger conditions, and the multiple trigger conditions include a first condition, a second condition, a third condition and a fourth condition;

[0051] The first condition includes that the currently connected mainboard has changed relative to the mainboard connected when the mainboard was powered off abnormally last time; the second condition includes that the current detection round is in power supply capacity detection; the third condition includes that the interval between the current time and the time when the amount of data was last updated exceeds a predetermined time length; the fourth condition includes that when the mainboard was powered off abnormally last time, the update process of the amount of data was not executed, and the target detection characterization data corresponding to the specified operation of the last abnormal power off of the mainboard was not refreshed;

[0052] The device also includes:

[0053] The setting module is used to set the storage device to be currently in a detection round of power supply capability detection when the end condition is not met.

[0054] Optionally, the setting module includes:

[0055] an updating unit, configured to update the amount of data to be flushed to the storage device to be the minimum amount of data to be flushed, and to set the updating direction of the amount of data to be increased if the first condition is met;

[0056] If the second condition is met, the amount of data to be flushed from the storage device is updated based on the amount of data to be flushed from the most recent update of the storage device in accordance with the current update direction and update rules, while keeping the current update direction unchanged; the update principle is that the amount of data to be flushed does not exceed a preset maximum critical value of the amount of data to be flushed;

[0057] If the third condition is met, the amount of data flushed from the storage device is updated to the amount of data flushed from the most recent update of the storage device, and the update direction is set to increase;

[0058] If the fourth condition is met, the amount of data to be flushed from the storage device is reduced based on the amount of data to be flushed from the storage device obtained by the most recent update, and the update direction is set to decrease.

[0059] Optionally, the first determining module includes:

[0060] A first determining unit, configured to determine that an end condition for updating the amount of data to be refreshed is met if any of the first matching relationship, the second matching relationship, the third matching relationship, and the fourth matching relationship is met;

[0061] The first matching relationship is that the detection result representation corresponding to the current designated operation is completed, the detection result representation corresponding to the previous designated operation is not completed, and the update direction of the second type of data volume corresponding to the current designated operation when being updated is to decrease;

[0062] The second matching relationship is: the detection result corresponding to the current designated operation is characterized as incomplete, the detection result corresponding to the previous designated operation is characterized as completed, and the update direction of the second type of data volume corresponding to the current designated operation when being updated is increasing;

[0063] The third matching relationship is: the detection result corresponding to the current designated operation is characterized as completed, the detection result corresponding to the previous designated operation is characterized as completed, and the second type of data volume corresponding to the current designated operation is the preset maximum critical value of the down-brush volume;

[0064] The fourth matching relationship is: the detection result corresponding to the current designated operation is characterized as incomplete, and the second type of data volume corresponding to the current designated operation is a preset minimum critical value of the down-brush volume.

[0065] Optionally, the second determining module includes:

[0066] The second determination unit is used to, when the first matching relationship or the third matching relationship is met, determine the second type of data volume corresponding to the current specified operation as the maximum available down-flush data volume adapted to the currently connected motherboard; when the second matching relationship is met, determine the second type of data volume corresponding to the last specified operation as the maximum available down-flush data volume adapted to the currently connected motherboard; when the fourth matching relationship is met, determine the minimum critical value of the down-flush volume as the maximum available down-flush data volume adapted to the currently connected motherboard.

[0067] Optionally, the device further comprises:

[0068] A sending module, used for obtaining, in response to a specified operation, each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence;

[0069] A generating module, used for generating unique identification information of the currently connected mainboard based on each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence;

[0070] A comparison module is used to compare the unique identification information of the currently connected motherboard with the target identification information. If they are the same, it indicates that the currently connected motherboard has changed compared to the motherboard connected when the previous motherboard was abnormally powered off; wherein, the target identification information is the unique identification information of the connected motherboard recorded by the storage device.

[0071] Optionally, the down-brush module includes:

[0072] A selection unit, configured to select metadata to be refreshed with an updated refresh data amount from various metadata currently stored according to a predetermined data selection rule; wherein the data selection rule is that data with a high degree of importance is selected in priority to data with a low degree of importance;

[0073] The flushing unit is used to store the selected metadata in a predetermined non-volatile storage medium to perform data flushing.

[0074] In a third aspect, the present application provides a storage device, including:

[0075] Memory, used to store computer programs;

[0076] The processor is used to implement any of the above-mentioned methods for determining the amount of data to be refreshed when executing the program stored in the memory.

[0077] In a fourth aspect, an embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the above-described methods for determining the amount of data to be refreshed.

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

[0079] In the solution of the present application, when the currently connected mainboard loses power abnormally, the storage device updates the amount of data to be flushed down the storage device, and performs data flushing based on the amount of data to be flushed down obtained by the update, and when a specified operation occurs, that is, when a power-on operation is performed for the abnormal power failure of the mainboard, it detects whether the data flushing is completed, obtains a detection result, and determines whether the end condition for updating the amount of data to be flushed down is met based on the detection result corresponding to the current specified operation and the detection result corresponding to the last specified operation; if the end condition is met, the maximum amount of data to be flushed down that is compatible with the currently connected mainboard is determined based on the amount of data of the second category corresponding to the current specified operation or the amount of data of the second category corresponding to the last specified operation, and stops updating the amount of data to be flushed down the storage device for the currently connected mainboard. It can be seen that the solution of the present application can effectively determine the maximum amount of data to be flushed down that is compatible with the currently connected mainboard by updating the amount of data to be flushed down after the abnormal power failure and detecting whether the data flushing is completed after the specified power-on operation.

[0080] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0082] Figure 1 A flowchart of a method for determining the amount of data to be refreshed provided in an embodiment of the present application;

[0083] Figure 2 A schematic diagram of an exemplary motherboard voltage curve provided in an embodiment of the present application;

[0084] Figure 3 A schematic diagram of a process for determining whether a mainboard has changed provided in an embodiment of the present application;

[0085] Figure 4A flowchart of another method for determining the amount of data to be refreshed provided by the present application;

[0086] Figure 5 A schematic diagram of the structure of a device for determining the amount of data to be refreshed provided in an embodiment of the present application;

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

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

[0089] In the technical solution of this application, the operations involved in obtaining, storing, using, processing, transmitting, providing and disclosing user personal information are all carried out with the user's authorization.

[0090] In order to determine the maximum available amount of data to be flushed that is compatible with a storage device and a currently connected mainboard, an embodiment of the present application provides a method, an apparatus, and a storage device for determining the amount of data to be flushed.

[0091] The following first introduces a method for determining the amount of data to be refreshed provided in an embodiment of the present application.

[0092] A method for determining the amount of data to be refreshed provided in an embodiment of the present application is applied to a storage device; the storage device can be used as a storage module of a video processing device, as a storage module of a monitoring device, or as a storage module of various other types of business processing devices, etc. The present application does not limit the device in which the storage device is installed, that is, the storage module of the storage device as a storage device of a certain electronic device.

[0093] In addition, in specific applications, the storage device may be a solid state drive, a mechanical hard drive, a memory card, etc. The solid state drive is a computer storage device that mainly uses flash memory as a permanent memory, and may also be referred to as a solid state storage system or a solid state drive.

[0094] Among them, a method for determining the amount of data to be refreshed provided in an embodiment of the present application may include:

[0095] In response to abnormal power failure of the currently connected mainboard, updating the amount of data to be flushed down the storage device;

[0096] Based on the updated refresh data volume, data is refreshed;

[0097] In response to a designated operation, whether the first type of data volume corresponding to the designated operation is the same as the second type of data volume corresponding to the designated operation is detected, and a detection result indicating whether data flushing corresponding to the designated operation is completed is obtained; wherein the designated operation is a power-on operation performed in response to an abnormal power failure of the mainboard; the first type of data volume and the second type of data volume corresponding to any designated operation are respectively the volume of data flushed after the mainboard targeted by the designated operation is powered off abnormally and the volume of data flushed based thereon;

[0098] Based on the detection result corresponding to the current specified operation and the detection result corresponding to the last specified operation, determining whether the end condition for updating the amount of data to be refreshed is met;

[0099] If the termination condition is met, based on the second type of data volume corresponding to this specified operation or the second type of data volume corresponding to the last specified operation, determine the maximum available flush data volume that is compatible with the currently connected motherboard, and stop updating the flush data volume of the storage device for the currently connected motherboard.

[0100] In the scheme of the present application, when the currently connected mainboard loses power abnormally, the storage device updates the amount of data to be flushed down by the storage device, and performs data flushing based on the amount of data to be flushed down obtained by the update. When a specified operation occurs, that is, when a power-on operation is performed for the abnormal power failure of the mainboard, it is detected whether the data flushing is completed, and a detection result is obtained. Based on the detection result corresponding to the current specified operation and the detection result corresponding to the last specified operation, it is determined whether the end condition for updating the amount of data to be flushed down is met; if the end condition is met, based on the amount of second-class data corresponding to the current specified operation or the amount of second-class data corresponding to the last specified operation, the maximum amount of data to be flushed down that is compatible with the currently connected mainboard is determined, and the update of the amount of data to be flushed down by the storage device is stopped for the currently connected mainboard. It can be seen that the scheme of the present application can effectively determine the maximum amount of data to be flushed down that is compatible with the currently connected mainboard by updating the amount of data to be flushed down after the abnormal power failure and detecting whether the data flushing is completed after the specified power-on operation. In the following, a method for determining the amount of data to be flushed down provided by an embodiment of the present application is introduced in conjunction with the accompanying drawings.

[0101] like Figure 1 As shown, a method for determining the amount of data to be flushed provided in an embodiment of the present application is applied to a storage device; the method includes:

[0102] S101, in response to abnormal power failure of a currently connected mainboard, updating the amount of data to be flushed down the storage device;

[0103] The solution of the present application is applied to the scenario of abnormal power failure of the mainboard. In the case of normal power failure, the mainboard will provide sufficient power supply time for the storage device, and will stop supplying power to the storage device only after the storage device has flushed the data of various metadata required to be stored. When the mainboard has abnormal power failure, the mainboard can work with the power provided by the backup power supply module, for example, it can supply power to the storage device, but it is understandable that the power provided by the backup power supply module is limited.

[0104] The metadata of the storage device may include data such as L2P Table (Logical to Physical Table), Log (log file) and configuration parameters. L2P Table is used to characterize the mapping relationship between the logical address and the physical address of the stored data, which is crucial to the normal operation of the storage device. Log is used to record the working status of the storage device over a period of time, facilitating functions such as status monitoring and data recovery. Configuration parameters refer to parameter values ​​that enable the performance and reliability of the storage device to reach a better level, such as the control parameters of the input and output flow control algorithm.

[0105] When an abnormal power failure occurs on the mainboard, the mainboard may send a message indicating the abnormal power failure to the storage device. After the storage device receives the message, it may determine that the mainboard currently connected has abnormal power failure. Thus, the step of updating the amount of data to be flushed to the storage device may be executed.

[0106] In the present application, the amount of data flushed by the storage device refers to the amount of data flushed by the storage device when power is abnormally cut off.

[0107] S102, performing data refresh based on the updated refresh data amount;

[0108] The storage device may perform data flushing with metadata whose data volume matches the updated flushed data volume. It is understandable that the data volume of the flushed data does not exceed the updated flushed data volume.

[0109] The step of performing data flushing based on the updated flushing data amount includes:

[0110] According to a predetermined data selection rule, metadata to be refreshed having an updated refresh data amount is selected from various metadata currently stored; wherein the data selection rule is that data with a high degree of importance is selected in priority to data with a low degree of importance;

[0111] The selected metadata is stored in a predetermined non-volatile storage medium for data flushing.

[0112] The various metadata currently stored are stored in the cache, and after the storage device is powered off, this part of the data will disappear. However, the data stored in the non-volatile storage medium still exists after the power is off.

[0113] Specifically, the non-volatile storage medium may be NAND (Not AND, a non-volatile memory) and NOR (Not OR, a non-volatile memory), etc. NAND and NOR are both types of storage units used for flash memory, and have non-volatile storage characteristics, that is, data can remain unchanged after power failure. There are many specific types of non-volatile storage media, and this application does not limit this.

[0114] In the present application, the data volume may be expressed in units such as KB (Kilobyte) and MB (megabyte), such as 1MB of data, or in units of entries, such as 100 entries of data. The present application does not limit the unit of data volume.

[0115] The predetermined data selection rule may be to select metadata with high importance and updated data size for refreshing according to the importance of each metadata. Importance indexes may be assigned to each type of metadata in advance, so that the storage device may determine the importance of each metadata from various metadata currently stored based on the type of each metadata.

[0116] In addition, the predetermined data selection rule may be a random selection, that is, randomly selecting metadata with an updated amount of data to be flushed from various metadata for flushing. The present application does not specifically limit the specific process of the storage device flushing data according to the given amount of data to be flushed (updated to obtain a new amount of data to be flushed or the existing amount of data to be flushed). Any implementation method of data selection and flushing according to a given amount of data to be flushed in the related art can be applied to the present application.

[0117] S103, in response to the occurrence of a designated operation, detecting whether the first type of data volume corresponding to the designated operation is the same as the second type of data volume corresponding to the designated operation, and obtaining a detection result indicating whether the data flushing corresponding to the designated operation is completed; wherein the designated operation is a power-on operation performed in response to an abnormal power failure of the mainboard; the first type of data volume and the second type of data volume corresponding to any designated operation are respectively the volume of data flushed after the mainboard for which the designated operation is performed is abnormally powered off and the amount of data flushed based on the data flushing;

[0118] The designated operation may be the first power-on operation after the abnormal power failure of the mainboard. The amount of down-flush data based on refers to the amount of data used for down-flush determined during the last power failure process, and the amount of down-flush data based on matches the amount of down-flush data obtained by the update.

[0119] There are many ways to implement the detection of whether the amount of first-category data corresponding to the current designated operation is the same as the amount of second-category data corresponding to the current designated operation, and to obtain the detection result of whether the characterization data flushing corresponding to the current designated operation is completed.

[0120] Exemplarily, one implementation method is: after the mainboard is powered on, the storage device can detect the data refreshed during the last power outage to detect whether the amount of data refreshed is the same as the amount of data refreshed. If they are the same, it means that the amount of data refreshed is completed; if they are different, it means that the data refresh is not completed.

[0121] Exemplarily, another implementation is: after the storage device completes data flushing, a flag indicating that the flushing is completed can be written into the storage device, so that after the mainboard is powered on, the storage device can detect whether the flag exists. If it exists, it means that the amount of data flushed is the same as the amount of data based on which it is flushed, and the amount of data flushed is completed. If it does not exist, it means that the amount of data flushed is different from the amount of data based on which it is flushed, indicating that the data flushing is not completed. Exemplarily, when the storage device is a solid-state drive, the flag can be written into NAND after the data flushing is completed.

[0122] S104: Based on the detection result corresponding to the current designated operation and the detection result corresponding to the previous designated operation, determine whether an end condition for updating the amount of data to be refreshed is met.

[0123] The test result corresponding to the current specified operation is the test result of whether the amount of data flushed by the storage device is complete during the abnormal power failure of the mainboard to which the storage device is connected. The test result corresponding to the previous specified operation is the test result of whether the amount of data flushed by the storage device is complete during the abnormal power failure of the mainboard to which the storage device is connected before the abnormal power failure of the mainboard to which the storage device is connected.

[0124] It is understandable that, in the present application, the mainboard to which the storage device is connected may be a different mainboard.

[0125] The determining whether the end condition for updating the amount of data to be refreshed is met based on the detection result corresponding to the current designated operation and the detection result corresponding to the previous designated operation may include:

[0126] If any of the first matching relationship, the second matching relationship, the third matching relationship and the fourth matching relationship is met, it is determined that the end condition for updating the amount of data to be refreshed is met;

[0127] The first matching relationship is that the detection result representation corresponding to the current designated operation is completed, the detection result representation corresponding to the previous designated operation is not completed, and the update direction of the second type of data volume corresponding to the current designated operation when being updated is to decrease;

[0128] The update direction of the second category data amount corresponding to the current specified operation is decrease when it is updated, indicating that the second category data amount corresponding to the current specified operation is less than the second category data amount corresponding to the last specified operation, but the detection result representation corresponding to the current specified operation is completed, and the detection result representation corresponding to the last specified operation is not completed, indicating that the size of the second category data amount corresponding to the last specified operation exceeds the maximum available refresh data amount that matches the power supply duration of the currently connected motherboard, and after refreshing based on the reduced second category data amount corresponding to the current specified operation, the result is completion, indicating that the second category data amount corresponding to the current specified operation is the maximum available refresh data amount that matches the current power supply duration of the motherboard.

[0129] The second matching relationship is: the detection result corresponding to the current specified operation is characterized as incomplete, the detection result corresponding to the previous specified operation is characterized as completed, and the update direction of the second type of data volume corresponding to the current specified operation when being updated is increasing.

[0130] The update direction of the second category data amount corresponding to the current specified operation is increasing when it is updated, indicating that the second category data amount corresponding to the current specified operation is larger than the second category data amount corresponding to the last specified operation, but the detection result representation corresponding to the current specified operation is not completed, and the detection result representation corresponding to the last specified operation is completed, indicating that the size of the second category data amount corresponding to the current specified operation exceeds the maximum available refresh data amount that matches the power supply duration of the currently connected motherboard, and after refreshing based on the increased second category data amount corresponding to the last specified operation, the result is completed, indicating that the second category data amount corresponding to the last specified operation is the maximum available refresh data amount that matches the current power supply duration of the motherboard.

[0131] The third matching relationship is: the detection result corresponding to the current designated operation is characterized to be complete, and the second category data volume corresponding to the current designated operation is a preset maximum critical value of the down-brush volume.

[0132] In this application, the amount of data to be refreshed can be set with an interval. When the amount of data to be refreshed exceeds the range of the interval, the amount of data to be refreshed is set to a critical value. If the amount of data of the second category corresponding to the current specified operation is the preset maximum critical value of the amount of data to be refreshed, the operation of increasing the amount of data to be refreshed can no longer be performed. The amount of data of the second category corresponding to the current specified operation, that is, the preset maximum critical value of the amount of data to be refreshed, can be directly used as the maximum available amount of data to be refreshed that matches the current power supply duration of the motherboard.

[0133] The fourth matching relationship is: the detection result corresponding to the current designated operation is characterized as incomplete, and the second type of data volume corresponding to the current designated operation is a preset minimum critical value of the down-brush volume.

[0134] When the second type of data volume corresponding to the specified operation is the preset minimum critical value of the down-swiping volume, the data cannot be flushed, indicating that the power supply capacity of the mainboard is very poor when the power is off, and even the minimum critical value of the down-swiping volume cannot be supported. At this time, there is no need to update, and the down-swiping volume can be set to the minimum critical value of the down-swiping volume (even if the data down-swiping cannot be completed at this time), and the user can be sent information indicating that the mainboard has insufficient power supply capacity during abnormal power failure to remind the user to avoid abnormal power failure. Specifically, the mainboard connected to the storage device can be sent information indicating that the mainboard has insufficient power supply capacity during abnormal power failure, so that the mainboard sends information indicating that the mainboard has insufficient power supply capacity during abnormal power failure to the connected display device for display.

[0135] Exemplarily, a specific method of determining whether an end condition for updating the amount of data to be flushed is reached after the storage device executes an update of the amount of data to be flushed of the storage device in a process in which a mainboard to which the storage device is connected is abnormally powered off comprises steps 1 and 2;

[0136] Step 1: After powering on, the storage device checks the integrity of the data that was flushed during the abnormal power failure. If the data is complete, record it in S k-1 =1; otherwise, record S k-1 = 0. k-1 Refers to the data integrity indicator that is refreshed during an abnormal power failure of the mainboard to which the storage device is connected.

[0137] Step 2: ① If m=-1, S k-1 =1, S k-2 = 0, the detection is completed, set Flag = 0, and update the result x to the fingerprint library F. k-2Refers to the identification of the integrity of the data flushed during the last abnormal power failure of the mainboard connected to the storage device; the last abnormal power failure of the mainboard connected to the storage device refers to the previous abnormal power failure of the mainboard connected to the storage device. The m=-1 indicates that the amount of data flushed during the abnormal power failure is reduced compared with the amount of data flushed during the last abnormal power failure. The Flag is a flag used to indicate whether the storage device is currently in a detection round of power supply capacity detection. If the Flag is 1, it means that the storage device is currently in a detection round of power supply capacity detection, and if the Flag is 0, it means that the storage device is not currently in a detection round of power supply capacity detection. The fingerprint library is used to store the fingerprint information of the mainboard connected to the storage device, that is, the unique identification information, and the maximum amount of available flushed data determined for the connected mainboard.

[0138] If m=-1, S k-1 =1, S k-2 =0, the result x is the amount of refresh data updated during the abnormal power failure.

[0139] ②If m=1, S k-1 =0, S k-2 =1, the detection is completed, set Flag=0, and update the result x to the fingerprint library F.

[0140] The m=1 indicates that the amount of data based on which data is refreshed during this abnormal power failure is increased compared to the amount of data based on which data is refreshed during the previous abnormal power failure.

[0141] If m=1, S k-1 =0, S k-2 =1, the result x is the amount of refresh data updated during the last abnormal power failure.

[0142] ③If m=1, S k-1 =1, and the amount of data to be flushed during the abnormal power failure is the maximum critical value of the flushing amount, then the detection is completed, Flag=0 is set, and the result x is updated to the fingerprint library, and the result x is the maximum critical value of the flushing amount. At this time, the current flushing amount is the maximum critical value of the flushing amount, and the flushing is completed. The current flushing amount can no longer be increased. The maximum critical value of the flushing amount is the maximum available flushing data amount that is compatible with the currently connected motherboard.

[0143] ④If m=-1, S k-1= 0, and the amount of data to be flushed during the abnormal power failure is the minimum critical value of the flushing amount, then the detection is completed, Flag = 0 is set, and the result x is updated to the fingerprint library, and the result x is the minimum critical value of the flushing amount. At this time, even if the current flushing amount has reached the minimum critical value of the flushing amount, the data flushing cannot be completed, indicating that the motherboard is insufficient to provide power to the storage device during power failure.

[0144] ⑤ In other cases, set Flag = 1, the end condition for updating the amount of data to be refreshed has not been met, and continue to detect.

[0145] S105, if the termination condition is met, based on the second type of data volume corresponding to the current specified operation or the second type of data volume corresponding to the last specified operation, determine the maximum available flush data volume compatible with the currently connected motherboard, and stop updating the flush data volume of the storage device for the currently connected motherboard.

[0146] If the termination condition is met, the maximum available flush data volume compatible with the currently connected mainboard can be determined, so that the updating of the flush data volume of the storage device can be stopped for the currently connected mainboard.

[0147] Optionally, determining the maximum available amount of data to be flushed that is compatible with the currently connected mainboard based on the amount of second-category data corresponding to the current designated operation or the amount of second-category data corresponding to the last designated operation includes:

[0148] When the first matching relationship or the third matching relationship is met, the second type of data volume corresponding to the current specified operation is determined as the maximum available down-flash data volume that is compatible with the currently connected motherboard; when the second matching relationship is met, the second type of data volume corresponding to the last specified operation is determined as the maximum available down-flash data volume that is compatible with the currently connected motherboard; when the fourth matching relationship is met, the minimum critical value of the down-flash volume is determined as the maximum available down-flash data volume that is compatible with the currently connected motherboard.

[0149] Specifically, if the first matching relationship is satisfied, the maximum available amount of data to be refreshed that is compatible with the currently connected motherboard is the amount of data of the second category corresponding to the current specified operation. If the second matching relationship is satisfied, the maximum available amount of data to be refreshed that is compatible with the currently connected motherboard is the amount of data of the second category corresponding to the last specified operation. If the third matching relationship is satisfied, the maximum available amount of data to be refreshed that is compatible with the currently connected motherboard is the amount of data of the second category corresponding to the current specified operation, that is, the preset maximum critical value of the refresh amount; if the fourth matching relationship is satisfied, the currently connected motherboard cannot provide power supply for the storage device; the refresh amount can be set to the minimum critical value of the refresh amount, and information indicating that the motherboard has insufficient power supply capacity in the event of an abnormal power failure can be sent to the user.

[0150] In the solution of the present application, when the currently connected mainboard loses power abnormally, the storage device updates the amount of data to be flushed down the storage device, and performs data flushing based on the amount of data to be flushed down obtained by the update, and when a specified operation occurs, that is, when a power-on operation is performed for the abnormal power failure of the mainboard, it detects whether the data flushing is completed, obtains a detection result, and determines whether the end condition for updating the amount of data to be flushed down is met based on the detection result corresponding to the current specified operation and the detection result corresponding to the last specified operation; if the end condition is met, the maximum amount of data to be flushed down that is compatible with the currently connected mainboard is determined based on the amount of data of the second category corresponding to the current specified operation or the amount of data of the second category corresponding to the last specified operation, and stops updating the amount of data to be flushed down the storage device for the currently connected mainboard. It can be seen that the solution of the present application can effectively determine the maximum amount of data to be flushed down that is compatible with the currently connected mainboard by updating the amount of data to be flushed down after the abnormal power failure and detecting whether the data flushing is completed after the specified power-on operation.

[0151] Optionally, before updating the amount of data to be flushed to the storage device, the method further includes:

[0152] Detect whether the triggering conditions for power supply capability detection of the currently connected motherboard are met;

[0153] The updating of the amount of data to be flushed to the storage device includes:

[0154] When the trigger condition is met, the amount of data to be flushed to the storage device is updated according to the update method corresponding to the satisfied trigger condition.

[0155] In the present application, different trigger conditions are provided with different updating methods of the amount of data to be flushed from the storage device.

[0156] Optionally, there are multiple trigger conditions, and the multiple trigger conditions include a first condition, a second condition, a third condition and a fourth condition.

[0157] The first condition includes that the currently connected mainboard has changed relative to the mainboard connected when the mainboard was powered off abnormally the last time.

[0158] The backup power supply modules of different motherboards have different power supply capabilities, so different motherboards provide different power supply durations for connected storage devices when power is off abnormally. Figure 2 , which is a schematic diagram of an exemplary motherboard voltage curve. Figure 2 In the figure, the horizontal axis represents time and the vertical axis represents the power supply voltage. It can be seen that at the same time, the power supply voltage of motherboard B drops faster than that of motherboard A, and when the power supply voltage drops below the available power supply voltage of the storage device, the storage device cannot work. Therefore, it can be seen that motherboard A can provide power supply to the storage device for a longer time than motherboard B.

[0159] Therefore, if the storage device is connected to different mainboards, then when the storage device flushes data during an abnormal power outage, the maximum available amount of data that can be flushed will also be different. Therefore, the amount of data flushed to the storage device needs to be updated to obtain a data flush amount that matches the power supply duration provided by the currently connected mainboard to the connected storage device during an abnormal power outage.

[0160] The second condition includes that the current detection round is a detection round of power supply capability detection.

[0161] For the second condition, the above detection round refers to the detection process for the power supply capacity detection of the same motherboard. After the completion of the detection process, the maximum available amount of data to be flushed that matches the power supply capacity of the motherboard can be obtained. It can be seen that the current detection round in the power supply capacity detection represents the current detection process of the maximum available amount of data to be flushed that is compatible with the same motherboard; the power supply capacity detection refers to the detection of the power supply capacity of the connected storage device after the motherboard loses power abnormally. In order to make the solution and layout clear, the method of determining the detection round in the power supply capacity detection will be introduced later.

[0162] The third condition includes that the interval between the current time and the time when the refresh data amount was last updated exceeds a predetermined time period.

[0163] In order to ensure the accuracy and stability of the amount of data to be flushed from the storage device, detection may be performed periodically.

[0164] The fourth condition includes: when the mainboard is powered off abnormally last time, the updating process of the amount of data to be flushed is not performed, and the target detection characterization data corresponding to the specified operation of the last abnormal power failure of the mainboard is not refreshed;

[0165] It is understandable that in the scheme of this embodiment, when the mainboard loses power abnormally, the process of updating the amount of data to be flushed is performed when the first condition, the second condition or the third condition mentioned above are met. However, when the mainboard lost power abnormally last time, the process of updating the amount of data to be flushed was not performed, and the target detection characterization data corresponding to the specified operation of the last abnormal power failure of the mainboard was not refreshed. This indicates that the first condition, the second condition or the third condition mentioned above were not met during the last power failure, so there is no need to update the amount of data to be flushed. The failure to refresh the data indicates that the power supply time of the connected mainboard has been reduced. The reduction in the power supply time of the mainboard may be due to damage to the backup power supply module of the mainboard or an increase in the number of devices connected to the mainboard, which increases the power supply load and reduces the power supply time provided to the storage device. Therefore, when the data is flushed based on the maximum available amount of data to be flushed recorded at the last abnormal power failure of the mainboard, the data is not completely flushed. Regardless of the reason that causes the reduction in the power supply duration provided by the mainboard to the storage device, the storage device will satisfy the fourth condition, which means that the recorded amount of data refreshed cannot match the power supply duration provided by the currently connected mainboard to the storage device. Therefore, it is necessary to execute an operation to update the amount of data refreshed by the storage device.

[0166] Optionally, the method further includes:

[0167] If the termination condition is not met, setting the storage device to be currently in a detection round of power supply capability detection; and,

[0168] According to the updating method corresponding to the satisfied trigger condition, before updating the amount of data to be flushed down the storage device, the storage device is set to be in a detection round of power supply capability detection.

[0169] In the present application, after the storage device's flush data volume is updated, although the storage device's flush data volume is updated, the updated flush data volume is not necessarily the maximum available flush data volume that matches the current motherboard's power supply duration.

[0170] Therefore, in the present application, after each update of the data volume, if the termination condition is met, it indicates that the updated data volume is the maximum available data volume that matches the power supply duration of the current motherboard, and the update of the data volume of the storage device can be stopped; if it is not met, it is not matched, and the storage device can be set to be in the detection round of power supply capacity detection, so that, at the next abnormal power failure, at least the second condition will be met, thereby triggering the update of the data volume.

[0171] Specifically, updating the amount of data to be flushed from the storage device according to the update method corresponding to the satisfied trigger condition includes:

[0172] If the first condition is met, the amount of data flushed by the storage device is updated to a minimum amount of data flushed, and the update direction of the amount of data flushed is set to increase.

[0173] If the first condition is met, it indicates that the mainboard to which the storage device is connected has changed. Therefore, the amount of data to be flushed of the storage device can be updated to the minimum amount, and the update direction of the amount of data to be flushed can be set to increase.

[0174] It can be understood that after updating the update method of the data volume corresponding to the first condition, the end condition will inevitably not be met. Therefore, the storage device will be set to be in the detection round of power supply capacity detection. Then, the next time an abnormal power outage occurs, at least the second condition will be met, thereby triggering an update of the data volume of the storage device.

[0175] If the second condition is met, the amount of data to be flushed from the storage device is updated based on the amount of data to be flushed from the most recent update of the storage device in accordance with the current update direction and update rules, while keeping the current update direction unchanged; the update principle is that the amount of data to be flushed does not exceed a preset maximum critical value of the amount of data to be flushed;

[0176] The current update direction refers to the update direction set by the update mode corresponding to the trigger condition met during the last abnormal power failure. For example, if the last trigger condition met was the first condition or the third condition, the current update direction is to increase; if the last trigger condition met was the fourth condition, the current update direction is to decrease.

[0177] If the third condition is met, the amount of data flushed from the storage device is updated to the amount of data flushed from the most recent update of the storage device, and the update direction is set to increase;

[0178] Regarding the third condition, it can be understood that if an abnormal power failure occurs within the predetermined time period and the above triggering conditions are not met, the update of the down-brush data volume will not be triggered, and the down-brush data volume obtained in the most recent update will be used for down-brush data, and all down-brush data will be completed. The down-brush data volume obtained in the most recent update is the maximum available down-brush data volume determined last time and compatible with the currently connected motherboard.

[0179] If the fourth condition is met, the amount of data to be flushed from the storage device is reduced based on the amount of data to be flushed from the storage device obtained by the most recent update, and the update direction is set to decrease.

[0180] According to the description of the fourth condition, if the fourth condition is met, it means that the amount of data currently recorded by the storage device is larger than the maximum available amount of data compatible with the current motherboard. Therefore, the amount of data can be changed in a decreasing direction.

[0181] In this application, the above operations of increasing and decreasing the number of refreshes are each to change the unit data volume. In different scenarios of specific applications, the unit is different, and this application does not limit this.

[0182] In the present application, the above four conditions can be set with priorities, and the priority of the first condition is higher than the other three conditions. In the present application, after detecting whether the trigger conditions for power supply capacity detection of the currently connected motherboard are met, if there are multiple trigger conditions met and the first condition is included, the amount of data flushed to the storage device is updated according to the update method corresponding to the first condition; if there are multiple trigger conditions met and the first condition is not included, the amount of data flushed to the storage device is updated according to the time sequence of the detection of the trigger conditions and the update method corresponding to the earliest detected trigger condition.

[0183] Exemplarily, the update method corresponding to the trigger condition of the present application may be as follows:

[0184] First, the trigger conditions may include: R1, R2, R3 and R4. When one of the following four conditions is met, detection is started and the flag word Flag=1 is set; otherwise, Flag=0 is set; wherein the definition of the Flag is the same as the above embodiment.

[0185] R1: The motherboard corresponding to the SSD has changed, for example, the user has replaced the motherboard.

[0186] R2: The current round of detection process has not been completed, which is judged by the flag word Flag. If Flag = 1, it means it is not completed and the current detection round is the power supply capability detection; otherwise, it means it has been completed.

[0187] R3: The time difference between the current time and the last detection exceeds the threshold T.

[0188] R4: During the last power-off process, detection was not started and data flushing was not completed.

[0189] Secondly, the update method is specifically as follows:

[0190] Step 1: Determine the reason R for starting the current round of detection and set the refresh parameters.

[0191] ① If R = R1, test in the direction of increasing the amount of down-sweep: Set the amount of down-sweep data x = xmin , m = 1. Where x min Indicates the minimum refresh amount, and m=1 means that the amount of data refreshed each time in the subsequent detection process will increase by 1 step Δx.

[0192] ② If R = R2, test in the previously set down refresh direction: set the down refresh data volume x = x′ + m·Δx. If x exceeds the range [x min ,x max ], and take the boundary value closest to x. Where x′ is the amount of data refreshed last time.

[0193] ③ If R=R3, test in the direction of increasing the refresh amount: set the refresh data amount x=x′, m=1.

[0194] ④ If R = R4, test in the direction of reducing the amount of down-sweep: set the amount of down-sweep data x = x′ + m·Δx. m = -1 means that the amount of down-sweep data will be reduced by 1 step Δx each time in the subsequent detection process, and m = -1 when calculating the amount of down-sweep data in this step.

[0196] The size of the step can be determined according to the specific application scenario, and this application does not limit this.

[0197] Step 2: Refresh data based on the refresh data volume x.

[0198] The solution of this embodiment provides different ways of updating the amount of data to be flushed from the storage device according to different trigger conditions, thereby providing support for determining the maximum amount of data to be flushed that is compatible with the storage device and the mainboard currently connected thereto.

[0199] Optionally, the method further includes:

[0200] In response to the specified operation, obtaining each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence;

[0201] Generate unique identification information of the currently connected mainboard based on each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence;

[0202] The unique identification information of the currently connected motherboard is compared with the target identification information. If they are different, it indicates that the currently connected motherboard has changed compared to the motherboard connected when the previous motherboard was abnormally powered off; wherein the target identification information is the unique identification information of the connected motherboard recorded by the storage device.

[0203] After the mainboard is powered on, it will send various command sequences to the connected storage devices. The various command sequences sent by each mainboard and the time intervals between the command sequences sent are different. Therefore, the unique identification information of the currently connected mainboard can be generated based on the various command sequences sent by the currently connected mainboard and / or the time intervals between the command sequences.

[0204] In one implementation, each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence can be directly used as the unique identification information of the currently connected mainboard.

[0205] In one implementation, each command sequence sent by the currently connected mainboard and / or the time intervals between each command sequence may be used as parameters to perform hash calculation, and the calculated hash value may be used as the unique identification information of the currently connected mainboard.

[0206] Every time the mainboard is powered on, unique identification information of the currently connected mainboard can be generated and compared with the recorded unique identification information of the connected mainboard. If they are the same, it means that the mainboard has not been replaced. If they are different, it means that the mainboard has been replaced, and the target identification information is updated to the generated unique identification information.

[0207] A specific implementation method for determining whether the motherboard has changed is as follows: Figure 3 As shown, including:

[0208] S301, detecting power-on and calculating fingerprint information.

[0209] Detecting power-on corresponds to the above-mentioned response to the specified operation. The fingerprint information refers to the unique identification information of the mainboard.

[0210] Specifically, after power-on, the storage device may record the command sequence cmd_list sent by the mainboard and the interval time t_list of the command sequence.

[0211] Usually after power-on, the motherboard will send relevant commands to the SSD according to its BIOS (Basic Input / Output System) settings. The command sequence sent and the time interval between command sequences are different for different motherboards and hosts, so they can be used to generate fingerprint information.

[0212] According to cmd_list and t_list, the fingerprint information is generated according to the set Hash function f=h(cmd_list, t_list), where f is the fingerprint information.

[0213] S302, checking whether the fingerprint information is the same as the original fingerprint information.

[0214] If they are the same, it is determined that the mainboard has not been replaced; if they are not the same, S303 is executed.

[0215] S303: Determine whether the fingerprint information is in the fingerprint database.

[0216] If yes, it means that the fingerprint information has been recorded before, and the corresponding flushing amount of the fingerprint information is found from the fingerprint database as the maximum available flushing data amount adapted to the currently connected mainboard, and it is determined that the mainboard has not been updated.

[0217] Whether the fingerprint information is in the fingerprint database indicates that the fingerprint database records the maximum available flush data volume that is compatible when the motherboard corresponding to the fingerprint is used as the motherboard connected to the storage device. Therefore, the flush data volume can be directly used.

[0218] If not, make sure the motherboard has an update.

[0219] In the present application, the above determination of whether the first trigger condition is met may be determined based on the method of this embodiment.

[0220] Next, combine Figure 4 , a method for determining the amount of data to be flushed is specifically introduced in the present application. The execution subject of this embodiment is an SSD (storage device), and the SSD belongs to the above-mentioned storage device. Figure 4 As shown, a method for determining the amount of data to be refreshed may include:

[0221] S401, power failure is detected.

[0222] The implementation method of detecting power failure corresponds to the above S101 and will not be described in detail here.

[0223] S402, detecting whether a detection condition is met.

[0224] The detection condition corresponds to the trigger condition mentioned above.

[0225] S403, flag is set to 1.

[0226] The flag is used to indicate whether the storage device is currently in a detection round of power supply capability detection. If the flag is 1, it means that the storage device is currently in a detection round of power supply capability detection, and if the flag is not 1, it means that the storage device is not currently in a detection round of power supply capability detection.

[0227] When the storage device is currently in a detection round of power supply capability detection, the step S403 may be executed.

[0228] S404, mainboard power supply capability detection.

[0229] The step of S404 corresponds to the above-mentioned S102-S105, and will not be described in detail here.

[0230] This embodiment can effectively determine the maximum available amount of data to be flushed that is compatible with the mainboard to which the storage device is currently connected, with respect to the storage device.

[0231] The present application also provides a device for determining the amount of data to be flushed, and the device is applied to a storage device, such as Figure 5 As shown, the device comprises:

[0232] An updating module 501 is used to update the amount of data to be flushed down the storage device in response to abnormal power failure of the currently connected mainboard;

[0233] A refresh module 502, configured to perform data refresh based on the updated refresh data volume;

[0234] The detection module 503 is used for detecting, in response to a specified operation, whether the first type of data volume corresponding to the specified operation is the same as the second type of data volume corresponding to the specified operation, and obtaining a detection result indicating whether the data flushing corresponding to the specified operation is completed; wherein the specified operation is a power-on operation performed in response to an abnormal power failure of the mainboard; the first type of data volume and the second type of data volume corresponding to any specified operation are respectively the volume of data flushed after the mainboard for which the specified operation is performed is abnormally powered off and the amount of data flushed based on which the data is flushed;

[0235] A first determination module 504 is used to determine whether an end condition for updating the amount of data to be refreshed is met based on the detection result corresponding to the current designated operation and the detection result corresponding to the last designated operation;

[0236] The second determination module 505 is used to determine the maximum available flush data volume compatible with the currently connected mainboard based on the second type of data volume corresponding to the current specified operation or the second type of data volume corresponding to the last specified operation if the termination condition is met, and stop updating the flush data volume of the storage device for the currently connected mainboard.

[0237] In the solution of the present application, when the currently connected mainboard loses power abnormally, the storage device updates the amount of data to be flushed down the storage device, and performs data flushing based on the amount of data to be flushed down obtained by the update, and when a specified operation occurs, that is, when a power-on operation is performed for the abnormal power failure of the mainboard, it detects whether the data flushing is completed, obtains a detection result, and determines whether the end condition for updating the amount of data to be flushed down is met based on the detection result corresponding to the current specified operation and the detection result corresponding to the last specified operation; if the end condition is met, the maximum amount of data to be flushed down that is compatible with the currently connected mainboard is determined based on the amount of data of the second category corresponding to the current specified operation or the amount of data of the second category corresponding to the last specified operation, and stops updating the amount of data to be flushed down the storage device for the currently connected mainboard. It can be seen that the solution of the present application can effectively determine the maximum amount of data to be flushed down that is compatible with the currently connected mainboard by updating the amount of data to be flushed down after the abnormal power failure and detecting whether the data flushing is completed after the specified power-on operation.

[0238] Optionally, before updating the amount of data to be flushed to the storage device, the method further includes:

[0239] Detect whether the triggering conditions for power supply capability detection of the currently connected motherboard are met;

[0240] The updating of the amount of data to be flushed to the storage device includes:

[0241] When the trigger condition is met, the amount of data to be flushed to the storage device is updated according to the update method corresponding to the satisfied trigger condition.

[0242] Optionally, there are multiple trigger conditions, and the multiple trigger conditions include a first condition, a second condition, a third condition and a fourth condition;

[0243] The first condition includes that the currently connected mainboard has changed relative to the mainboard connected when the mainboard was powered off abnormally last time; the second condition includes that the current detection round is in power supply capacity detection; the third condition includes that the interval between the current time and the time when the amount of data was last updated exceeds a predetermined time length; the fourth condition includes that when the mainboard was powered off abnormally last time, the update process of the amount of data was not executed, and the target detection characterization data corresponding to the specified operation of the last abnormal power off of the mainboard was not refreshed;

[0244] The device also includes:

[0245] The setting module is used to set the storage device to be currently in a detection round of power supply capability detection when the end condition is not met.

[0246] Optionally, the setting module includes:

[0247] an updating unit, configured to update the amount of data to be flushed to the storage device to be the minimum amount of data to be flushed, and to set the updating direction of the amount of data to be increased if the first condition is met;

[0248] If the second condition is met, the amount of data to be flushed from the storage device is updated based on the amount of data to be flushed from the most recent update of the storage device in accordance with the current update direction and update rules, while keeping the current update direction unchanged; the update principle is that the amount of data to be flushed does not exceed a preset maximum critical value of the amount of data to be flushed;

[0249] If the third condition is met, the amount of data flushed from the storage device is updated to the amount of data flushed from the most recent update of the storage device, and the update direction is set to increase;

[0250] If the fourth condition is met, the amount of data to be flushed from the storage device is reduced based on the amount of data to be flushed from the storage device obtained by the most recent update, and the update direction is set to decrease.

[0251] Optionally, the first determining module includes:

[0252] A first determining unit, configured to determine that an end condition for updating the amount of data to be refreshed is met if any of the first matching relationship, the second matching relationship, the third matching relationship, and the fourth matching relationship is met;

[0253] The first matching relationship is that the detection result representation corresponding to the current designated operation is completed, the detection result representation corresponding to the previous designated operation is not completed, and the update direction of the second type of data volume corresponding to the current designated operation when being updated is to decrease;

[0254] The second matching relationship is: the detection result corresponding to the current designated operation is characterized as incomplete, the detection result corresponding to the previous designated operation is characterized as completed, and the update direction of the second type of data volume corresponding to the current designated operation when being updated is increasing;

[0255] The third matching relationship is: the detection result corresponding to the current designated operation is characterized as completed, the detection result corresponding to the previous designated operation is characterized as completed, and the second type of data volume corresponding to the current designated operation is the preset maximum critical value of the down-brush volume;

[0256] The fourth matching relationship is: the detection result corresponding to the current designated operation is characterized as incomplete, and the second type of data volume corresponding to the current designated operation is a preset minimum critical value of the down-brush volume.

[0257] Optionally, the second determining module includes:

[0258] The second determination unit is used to, when the first matching relationship or the third matching relationship is met, determine the second type of data volume corresponding to the current specified operation as the maximum available down-flush data volume adapted to the currently connected motherboard; when the second matching relationship is met, determine the second type of data volume corresponding to the last specified operation as the maximum available down-flush data volume adapted to the currently connected motherboard; when the fourth matching relationship is met, determine the minimum critical value of the down-flush volume as the maximum available down-flush data volume adapted to the currently connected motherboard.

[0259] Optionally, the device further comprises:

[0260] A sending module, used for obtaining, in response to a specified operation, each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence;

[0261] A generating module, used for generating unique identification information of the currently connected mainboard based on each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence;

[0262] A comparison module is used to compare the unique identification information of the currently connected motherboard with the target identification information. If they are the same, it indicates that the currently connected motherboard has changed compared to the motherboard connected when the previous motherboard was abnormally powered off; wherein, the target identification information is the unique identification information of the connected motherboard recorded by the storage device.

[0263] Optionally, the down brush module includes:

[0264] A selection unit, configured to select metadata to be refreshed with an updated refresh data amount from various metadata currently stored according to a predetermined data selection rule; wherein the data selection rule is that data with a high degree of importance is selected in priority to data with a low degree of importance;

[0265] The flushing unit is used to store the selected metadata in a predetermined non-volatile storage medium to perform data flushing.

[0266] The present application also provides a storage device, such as Figure 6 As shown, including:

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

[0268] The processor 602 is used to implement any of the above-mentioned methods for determining the amount of data to be refreshed when executing the program stored in the memory 601.

[0269] Furthermore, the storage 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.

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

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

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

[0273] 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, discrete hardware components.

[0274] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for determining the amount of refresh data are implemented.

[0275] 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 of the methods for determining the amount of refresh data in the above embodiments.

[0276] 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 may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may 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 may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may 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 integrated. The available medium may 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 hard disk (SSD), etc.

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

[0278] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0279] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A method for determining the amount of data to be refreshed, characterized in that: Applied to a storage device; the method comprises: In response to abnormal power failure of the currently connected mainboard, updating the amount of data to be flushed down the storage device; Based on the updated refresh data volume, data is refreshed; In response to a designated operation, whether the first type of data volume corresponding to the designated operation is the same as the second type of data volume corresponding to the designated operation is detected, and a detection result indicating whether data flushing corresponding to the designated operation is completed is obtained; wherein the designated operation is a power-on operation performed in response to an abnormal power failure of the mainboard; the first type of data volume and the second type of data volume corresponding to any designated operation are respectively the volume of data flushed after the mainboard targeted by the designated operation is powered off abnormally and the volume of data flushed based thereon; Based on the detection result corresponding to the current specified operation and the detection result corresponding to the last specified operation, determining whether the end condition for updating the amount of data to be refreshed is met; If the termination condition is met, based on the second type of data volume corresponding to this specified operation or the second type of data volume corresponding to the last specified operation, determine the maximum available flush data volume that is compatible with the currently connected motherboard, and stop updating the flush data volume of the storage device for the currently connected motherboard.

2. The method according to claim 1, characterized in that Before updating the amount of data to be flushed to the storage device, the method further includes: Detect whether the triggering conditions for power supply capability detection of the currently connected motherboard are met; The updating of the amount of data to be flushed to the storage device includes: When the trigger condition is met, the amount of data to be flushed to the storage device is updated according to the update method corresponding to the satisfied trigger condition.

3. The method according to claim 2, characterized in that The number of the trigger conditions is multiple, and the multiple trigger conditions include a first condition, a second condition, a third condition and a fourth condition; The first condition includes that the currently connected mainboard has changed relative to the mainboard connected when the mainboard was powered off abnormally last time; the second condition includes that the current detection round is in power supply capacity detection; the third condition includes that the interval between the current time and the time when the amount of data was last updated exceeds a predetermined time length; the fourth condition includes that when the mainboard was powered off abnormally last time, the update process of the amount of data was not executed, and the target detection characterization data corresponding to the specified operation of the last abnormal power off of the mainboard was not refreshed; The method further comprises: When the termination condition is not met, the storage device is set to be currently in a detection round of power supply capability detection.

4. The method according to claim 3, characterized in that The updating of the amount of data to be flushed from the storage device according to the updating method corresponding to the satisfied trigger condition includes: If the first condition is met, the amount of data flushed from the storage device is updated to a minimum amount of data flushed, and the update direction of the amount of data flushed is set to increase; If the second condition is met, the amount of data to be flushed from the storage device is updated based on the amount of data to be flushed from the most recent update of the storage device in accordance with the current update direction and update rules, while keeping the current update direction unchanged; the update principle is that the amount of data to be flushed does not exceed a preset maximum critical value of the amount of data to be flushed; If the third condition is met, the amount of data flushed from the storage device is updated to the amount of data flushed from the most recent update of the storage device, and the update direction is set to increase; If the fourth condition is met, the amount of data to be flushed from the storage device is reduced based on the amount of data to be flushed from the storage device obtained by the most recent update, and the update direction is set to decrease.

5. The method according to claim 1, characterized in that The determining whether the end condition for updating the amount of data to be refreshed is met based on the detection result corresponding to the current designated operation and the detection result corresponding to the last designated operation includes: If any of the first matching relationship, the second matching relationship, the third matching relationship and the fourth matching relationship is met, it is determined that the end condition for updating the amount of data to be refreshed is met; The first matching relationship is that the detection result representation corresponding to the current designated operation is completed, the detection result representation corresponding to the previous designated operation is not completed, and the update direction of the second type of data volume corresponding to the current designated operation when being updated is to decrease; The second matching relationship is: the detection result corresponding to the current designated operation is characterized as incomplete, the detection result corresponding to the previous designated operation is characterized as completed, and the update direction of the second type of data volume corresponding to the current designated operation when being updated is increasing; The third matching relationship is: the detection result corresponding to the current designated operation is characterized to be completed, and the second type of data volume corresponding to the current designated operation is the preset maximum critical value of the down-brush volume; The fourth matching relationship is: the detection result corresponding to the current designated operation is characterized as incomplete, and the second type of data volume corresponding to the current designated operation is a preset minimum critical value of the down-brush volume.

6. The method according to claim 5, characterized in that The determining of the maximum available amount of data to be refreshed that is compatible with the currently connected mainboard based on the amount of second-category data corresponding to the current designated operation or the amount of second-category data corresponding to the last designated operation includes: When the first matching relationship or the third matching relationship is met, the second type of data volume corresponding to the current specified operation is determined as the maximum available down-flash data volume that is compatible with the currently connected motherboard; when the second matching relationship is met, the second type of data volume corresponding to the last specified operation is determined as the maximum available down-flash data volume that is compatible with the currently connected motherboard; when the fourth matching relationship is met, the minimum critical value of the down-flash volume is determined as the maximum available down-flash data volume that is compatible with the currently connected motherboard.

7. The method according to claim 3, characterized in that The method further comprises: In response to the specified operation, obtaining each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence; Generate unique identification information of the currently connected mainboard based on each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence; The unique identification information of the currently connected motherboard is compared with the target identification information. If they are the same, it indicates that the currently connected motherboard has changed compared to the motherboard connected when the previous motherboard was abnormally powered off; wherein, the target identification information is the unique identification information of the connected motherboard recorded by the storage device.

8. The method according to claim 1, characterized in that The step of performing data flushing based on the updated flushing data amount includes: According to a predetermined data selection rule, metadata to be refreshed having an updated refresh data amount is selected from various metadata currently stored; wherein the data selection rule is that data with a high degree of importance is selected in priority to data with a low degree of importance; The selected metadata is stored in a predetermined non-volatile storage medium for data flushing.

9. A device for determining the amount of data to be refreshed, characterized in that: Applicable to a storage device; the device comprises: An update module, configured to update the amount of data to be flushed from the storage device in response to an abnormal power failure of a currently connected mainboard; A refresh module, used for refreshing data based on the updated refresh data volume; A detection module, configured to detect, in response to a specified operation, whether the first type of data volume corresponding to the specified operation is the same as the second type of data volume corresponding to the specified operation, and obtain a detection result indicating whether data flushing corresponding to the specified operation is completed; wherein the specified operation is a power-on operation performed in response to an abnormal power failure of the mainboard; the first type of data volume and the second type of data volume corresponding to any specified operation are respectively the volume of data flushed after the mainboard for which the specified operation is performed is abnormally powered off and the amount of data flushed based thereon; A first determination module, used to determine whether an end condition for updating the amount of data to be refreshed is met based on a detection result corresponding to the current designated operation and a detection result corresponding to the last designated operation; The second determination module is used to determine the maximum available flush data volume compatible with the currently connected mainboard based on the second type of data volume corresponding to the current specified operation or the second type of data volume corresponding to the last specified operation if the termination condition is met, and stop updating the flush data volume of the storage device for the currently connected mainboard.

10. A storage device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-8 when executing a program stored in a memory.

Citation Information

Patent Citations

  • Method and apparatus for managing SSD write cache area, computer equipment and medium

    CN108710583A

  • Method and device for protecting the abnormal power-down of solid-state hard disk

    CN109062825A

  • Background data refresh using a system timestamp in storage devices

    CN110045915A

  • Cache storage space adjusting method and device, electronic equipment and storage medium

    CN111459851A

  • Writing method and device based on file system, computer equipment and storage medium

    CN113467698A