A method and apparatus for determining a lower brush data volume, and a storage device

By updating the amount of data to be flushed from the storage device and detecting the completion of the data flushing, the problem of determining the appropriate amount of data to be flushed when the motherboard experiences an abnormal power failure is solved, thus ensuring the integrity of the data flushing and the reliability of the recovery.

CN119883759BActive Publication Date: 2026-03-31HANGZHOU HIKSTORAGE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

How to determine the maximum amount of available data to be flushed to the storage device and the motherboard currently connected to it, so as to ensure that data flushing can be completed and subsequent data recovery can be supported in the event of abnormal power loss of the motherboard.

Method used

By responding to abnormal power loss of the motherboard, the amount of data to be flushed to the storage device is updated, and it is detected whether the data flushing is complete. Based on the detection results, it is determined whether the termination condition has been met. If the condition is met, the update is stopped to determine the maximum amount of data to be flushed.

Benefits of technology

Effectively determine the maximum amount of available data to be flashed that is compatible with the currently connected motherboard, ensuring the completion of data flashing and the reliability of subsequent recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883759B_ABST
    Figure CN119883759B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of data flushing quantity determination method, device and storage equipment, it is related to data processing technical field.The specific implementation scheme is: in response to the current mainboard abnormal power-off, the data flushing quantity of the storage equipment is updated;Data flushing is carried out based on the data flushing quantity obtained by updating;In response to the occurrence of specified operation, detection is carried out, and the detection result corresponding to the specified operation this time is obtained, which indicates whether the data flushing is completed;Based on the detection result corresponding to the specified operation this time and the detection result corresponding to the specified operation last time, it is determined whether the end condition for updating the data flushing quantity is reached;If the end condition is met, the largest available data flushing quantity compatible with the current mainboard is determined, and the updating of the data flushing quantity of the storage equipment for the current mainboard is stopped.It can be seen that the scheme of the application can effectively determine the largest available data flushing quantity compatible with the current mainboard.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus and storage device for determining the amount of data to be processed. Background Technology

[0002] For storage devices such as SSDs (Solid State Disks), reliable and efficient operation requires data flushing of various metadata when the installed electronic device loses power. Data flushing refers to storing data onto non-volatile storage media. The motherboard in the electronic device acts as the power supply for the storage device. In the event of an abnormal power failure of the motherboard connected to the storage device, the storage device can rely on the motherboard's backup power module to perform the data flushing. Abnormal power failures of the motherboard can be caused by sudden power outages or power supply failures.

[0003] However, the duration of power supplied to storage devices during abnormal power outages varies depending on the motherboard. If the data flushing amount for the storage device is set too large, the data may not be completely flushed before the power is lost. Conversely, if the data flushing amount is set too small, although the flushing can be completed during a power outage, only a small amount of data will be flushed, making subsequent data recovery based on the flushed data quite difficult.

[0004] It is evident that determining the maximum amount of data that can be flushed to a storage device in relation to the motherboard it is currently connected to is an urgent problem to be solved. Summary of the Invention

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

[0006] In a first aspect, this application provides a method for determining the amount of data flushed, applied to a storage device; the method includes:

[0007] In response to an abnormal power failure of the currently connected motherboard, the amount of data to be flushed to the storage device is updated;

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

[0009] In response to a specified operation, it is detected whether the first type of data volume corresponding to this specified operation is the same as the corresponding second type of data volume, and a detection result of whether the data brushing corresponding to this specified operation is completed is obtained; wherein, the specified operation is a power-on operation performed for abnormal power failure of the motherboard; the first type of data volume and the second type of data volume corresponding to any specified operation are respectively the data volume completed by data brushing after abnormal power failure of the motherboard and the brushing data volume on which the specified operation is based.

[0010] Based on the detection results corresponding to this specified operation and the detection results corresponding to the last specified operation, determine whether the termination condition for updating the data volume of the next flush is met.

[0011] 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 previous specified operation, determine the maximum available data volume that is compatible with the currently connected motherboard, and stop updating the data volume of the storage device for the currently connected motherboard.

[0012] Optionally, before updating the data volume flushed from the storage device, the method further includes:

[0013] Check whether the trigger conditions for power supply capability testing of the currently connected motherboard are met;

[0014] The update of the data volume flushed to the storage device includes:

[0015] If the triggering conditions are met, the amount of data flushed from the storage device is updated according to the update method corresponding to the triggered conditions.

[0016] Optionally, the number of triggering conditions is multiple, including a first condition, a second condition, a third condition, and a fourth condition;

[0017] The first condition includes that the currently connected motherboard has changed compared to the motherboard connected during the previous abnormal power failure; the second condition includes that the current power supply capability detection cycle is in progress; the third condition includes that the interval between the current time and the last update of the data volume exceeds a predetermined duration; the fourth condition includes that the data volume update process was not executed during the last abnormal power failure of the motherboard, and the target detection characterization data corresponding to the specified operation for the last abnormal power failure of the motherboard was not refreshed.

[0018] The method further includes:

[0019] If the termination condition is not met, the storage device is set to the current detection round for power supply capability detection.

[0020] Optionally, updating the amount of data flushed from the storage device according to the update method corresponding to the triggered conditions includes:

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

[0022] If the second condition is met, the amount of data flushed from the storage device is updated based on the number of data flushed from the most recent update of the storage device, according to the current update direction and update rules, while keeping the current update direction unchanged; the update principle is not to exceed the preset maximum threshold value of the amount of data 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 flushed to the storage device is reduced from the amount of data flushed in the most recent update, and the update direction is set to decrease.

[0025] Optionally, determining whether the termination condition for updating the data volume for the next flush is met based on the detection results corresponding to the current specified operation and the detection results corresponding to the previous specified operation includes:

[0026] If any one of the first, second, third, and fourth matching relationships is met, then the termination condition for updating the data volume of the next flush is determined to have been met.

[0027] The first matching relationship is: the detection result representation corresponding to the current specified operation is complete, the detection result representation corresponding to the previous specified operation is not complete, and the update direction when the second type of data volume corresponding to the current specified operation is updated is decreasing.

[0028] The second matching relationship is: the detection result representation corresponding to the current specified operation is incomplete, the detection result representation corresponding to the previous specified operation is complete, and the update direction when the second type of data volume corresponding to the current specified operation is updated is increasing;

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

[0030] The fourth matching relationship is: the detection result representation corresponding to the specified operation is not completed, and the second type of data volume corresponding to the specified operation is the preset minimum threshold value of the brush volume.

[0031] Optionally, determining the maximum available data volume for flashing that is compatible with the currently connected motherboard based on the second type of data volume corresponding to the current specified operation or the second type of data volume corresponding to the previous specified operation includes:

[0032] If the first or third matching relationship is met, the second type of data volume corresponding to the current specified operation is determined as the maximum available data volume for swiping that is compatible with the currently connected motherboard; if the second matching relationship is met, the second type of data volume corresponding to the previous specified operation is determined as the maximum available data volume for swiping that is compatible with the currently connected motherboard; if the fourth matching relationship is met, the minimum threshold value for swiping is determined as the maximum available data volume for swiping that is compatible with the currently connected motherboard.

[0033] Optionally, the method further includes:

[0034] In response to a specified operation, obtain the sequence of commands sent by the currently connected motherboard and / or the time interval between the sequence of commands;

[0035] Based on the command sequences sent by the currently connected motherboard and / or the time intervals between the command sequences, generate unique identification information for the currently connected motherboard.

[0036] The unique identifier information of the currently connected motherboard is compared with the target identifier information. If they are the same, it indicates that the currently connected motherboard has changed compared to the motherboard connected when the motherboard experienced an abnormal power failure. The target identifier information is the unique identifier information of the connected motherboard recorded by the storage device.

[0037] Optionally, the step of performing data refresh based on the updated refresh data volume includes:

[0038] According to the predetermined data selection rules, metadata that has the updated data size to be flushed is selected from the various metadata currently stored; wherein, the data selection rules are that data with higher importance is selected in priority over data with lower importance.

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

[0040] Secondly, this application provides a device for determining the amount of data flushed, applied to a storage device; the device includes:

[0041] The update module is used to update the amount of data to be flushed from the storage device in response to an abnormal power failure of the currently connected motherboard.

[0042] The data refresh module is used to refresh data based on the refresh data volume obtained from the update.

[0043] The detection module is used to detect whether the first type of data volume corresponding to the specified operation is the same as the corresponding second type of data volume in response to the occurrence of a specified operation, and to obtain the detection result of whether the data brushing corresponding to the specified operation is completed; wherein, the specified operation is a power-on operation performed for abnormal power failure of the motherboard; the first type of data volume and the second type of data volume corresponding to any specified operation are respectively the amount of data brushed and the amount of brushed data on which the specified operation is based after the abnormal power failure of the motherboard.

[0044] The first determining module is used to determine whether the termination condition for updating the amount of data to be flushed has been met based on the detection results corresponding to the current specified operation and the detection results corresponding to the previous specified operation.

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

[0046] Optionally, before updating the data volume flushed from the storage device, the method further includes:

[0047] Check whether the trigger conditions for power supply capability testing of the currently connected motherboard are met;

[0048] The update of the data volume flushed to the storage device includes:

[0049] If the triggering conditions are met, the amount of data flushed from the storage device is updated according to the update method corresponding to the triggered conditions.

[0050] Optionally, the number of triggering conditions is multiple, including a first condition, a second condition, a third condition, and a fourth condition;

[0051] The first condition includes that the currently connected motherboard has changed compared to the motherboard connected during the previous abnormal power failure; the second condition includes that the current power supply capability detection cycle is in progress; the third condition includes that the interval between the current time and the last update of the data volume exceeds a predetermined duration; the fourth condition includes that the data volume update process was not executed during the last abnormal power failure of the motherboard, and the target detection characterization data corresponding to the specified operation for the last abnormal power failure of the motherboard was not refreshed.

[0052] The device further includes:

[0053] The setting module is used to set the storage device to the current detection round of power supply capability detection if the termination condition is not met.

[0054] Optionally, the setting module includes:

[0055] An update unit is configured to update the amount of data flushed from the storage device to the minimum amount of data flushed if a first condition is met, and to set the update direction for the amount of data flushed to increase.

[0056] If the second condition is met, the amount of data flushed from the storage device is updated based on the number of data flushed from the most recent update of the storage device, according to the current update direction and update rules, while keeping the current update direction unchanged; the update principle is not to exceed the preset maximum threshold value of the amount of data 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 flushed to the storage device is reduced from the amount of data flushed in the most recent update, and the update direction is set to decrease.

[0059] Optionally, the first determining module includes:

[0060] The first determining unit is used to determine that the end condition for updating the data volume of the next flush is met if any one 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: the detection result representation corresponding to the current specified operation is complete, the detection result representation corresponding to the previous specified operation is not complete, and the update direction when the second type of data volume corresponding to the current specified operation is updated is decreasing.

[0062] The second matching relationship is: the detection result representation corresponding to the current specified operation is incomplete, the detection result representation corresponding to the previous specified operation is complete, and the update direction when the second type of data volume corresponding to the current specified operation is updated is increasing;

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

[0064] The fourth matching relationship is: the detection result representation corresponding to the specified operation is not completed, and the second type of data volume corresponding to the specified operation is the preset minimum threshold value of the brush volume.

[0065] Optionally, the second determining module includes:

[0066] The second determining unit is used to determine the second type of data volume corresponding to the current specified operation as the maximum available data volume adapted to the currently connected motherboard when the first matching relationship or the third matching relationship is met; when the second matching relationship is met, the second type of data volume corresponding to the previous specified operation is determined as the maximum available data volume adapted to the currently connected motherboard; when the fourth matching relationship is met, the minimum threshold value of the data volume is determined as the maximum available data volume adapted to the currently connected motherboard.

[0067] Optionally, the device further includes:

[0068] The sending module is used to obtain, in response to a specified operation, the sequence of commands sent by the currently connected motherboard and / or the time interval between the sequence of commands;

[0069] The generation module is used to generate unique identification information of the currently connected motherboard based on the command sequences sent by the currently connected motherboard and / or the time intervals between the command sequences.

[0070] The 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 motherboard experienced a previous abnormal power failure. The target identification information is the unique identification information of the connected motherboard recorded by the storage device.

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

[0072] The selection unit is used to select metadata to be flushed from various currently stored metadata that has the updated flush data size according to a predetermined data selection rule; wherein, the data selection rule is that data with higher importance is selected in priority over data with lower importance.

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

[0074] Thirdly, this application provides a storage device, comprising:

[0075] Memory, used to store computer programs;

[0076] When a processor executes a program stored in memory, it implements any of the above-described methods for determining the amount of data to be flushed.

[0077] Fourthly, embodiments of this application also provide a computer program product containing instructions that, when run on a computer, cause the computer to execute any of the above-described methods for determining the amount of data to be flushed.

[0078] Beneficial effects of the embodiments in this application:

[0079] The solution of this application involves updating the data volume of the storage device when the currently connected motherboard experiences an abnormal power loss. Based on the updated data volume, data is flushed. During a specified operation—specifically, a power-on operation performed in response to the abnormal power loss of the motherboard—the completion of the data flushing is detected, and a detection result is obtained. Based on the detection result corresponding to the current specified operation and the detection result corresponding to the previous specified operation, it is determined whether the termination condition for updating the data volume has been met. 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 previous specified operation, the maximum available data volume adapted to the currently connected motherboard is determined, and the updating of the data volume of the storage device for the currently connected motherboard is stopped. Therefore, the solution of this application, through updating the data volume after an abnormal power loss and detecting the completion of the data flushing after a specified power-on operation, can effectively determine the maximum available data volume adapted to the currently connected motherboard.

[0080] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0081] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.

[0082] Figure 1 A flowchart illustrating a method for determining the amount of data to be processed in an embodiment of this application;

[0083] Figure 2 A schematic diagram of an exemplary motherboard voltage curve provided for an embodiment of this application;

[0084] Figure 3 A schematic diagram illustrating a process for determining whether the motherboard has changed, provided as an embodiment of this application;

[0085] Figure 4A flowchart illustrating another method for determining the amount of data to be processed in this application;

[0086] Figure 5 This is a schematic diagram of a device for determining the amount of data sent to the bottom of a document, provided in an embodiment of this application.

[0087] Figure 6 This is a schematic diagram of the structure of a storage device provided in an embodiment of this application. Detailed Implementation

[0088] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.

[0089] In the technical solution of this application, the operations of 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 amount of available data to be flushed to a storage device that is compatible with the currently connected motherboard, embodiments of this application provide a method, apparatus and storage device for determining the amount of data to be flushed.

[0091] The following section first introduces a method for determining the amount of data to be brushed, provided in an embodiment of this application.

[0092] The method for determining the amount of data to be processed provided in this application is applied to a storage device. The storage device can be used as a storage module of a video processing device, a storage module of a monitoring device, or a storage module of other types of business processing devices, etc. This application does not limit the device on which the storage device is installed, i.e., the storage module of the storage device of which electronic device it is used as.

[0093] In specific applications, the storage device can be a solid-state drive (SSD), a hard disk drive (HDD), or a memory card. The SSD is a computer storage device that primarily uses flash memory as its permanent storage; it can also be referred to as a solid-state storage system or a solid-state drive.

[0094] The method for determining the amount of data flushed in this application embodiment may include:

[0095] In response to an abnormal power failure of the currently connected motherboard, the amount of data to be flushed to the storage device is updated;

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

[0097] In response to a specified operation, it is detected whether the first type of data volume corresponding to this specified operation is the same as the corresponding second type of data volume, and a detection result of whether the data brushing corresponding to this specified operation is completed is obtained; wherein, the specified operation is a power-on operation performed for abnormal power failure of the motherboard; the first type of data volume and the second type of data volume corresponding to any specified operation are respectively the data volume completed by data brushing after abnormal power failure of the motherboard and the brushing data volume on which the specified operation is based.

[0098] Based on the detection results corresponding to this specified operation and the detection results corresponding to the last specified operation, determine whether the termination condition for updating the data volume of the next flush is met.

[0099] 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 previous specified operation, determine the maximum available data volume that is compatible with the currently connected motherboard, and stop updating the data volume of the storage device for the currently connected motherboard.

[0100] The solution of this application involves updating the data volume of the storage device when the currently connected motherboard experiences an abnormal power loss. Based on the updated data volume, data is flushed. During a specified operation—specifically, a power-on operation performed in response to the abnormal power loss of the motherboard—the completion of the data flushing is detected, and a detection result is obtained. Based on the detection result corresponding to the current specified operation and the detection result corresponding to the previous specified operation, it is determined whether the termination condition for updating the data volume has been met. If the termination condition is met, the maximum available data volume adapted to the currently connected motherboard is determined based on the second type of data volume corresponding to the current specified operation or the second type of data volume corresponding to the previous specified operation. Then, for the currently connected motherboard, the updating of the data volume of the storage device is stopped. Therefore, the solution of this application, through updating the data volume after an abnormal power loss and detecting the completion of the data flushing after a specified power-on operation, can effectively determine the maximum available data volume adapted to the currently connected motherboard. The following describes a method for determining the data volume provided by an embodiment of this application in conjunction with the accompanying drawings.

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

[0102] S101, in response to an abnormal power failure of the currently connected motherboard, update the amount of data to be flushed from the storage device;

[0103] The solution proposed in this application is applied to scenarios involving abnormal power loss of the motherboard. During a normal power loss, the motherboard provides sufficient power to the storage device for a sufficient period of time, stopping power supply only after the storage device has flushed all necessary metadata. However, when an abnormal power loss occurs, the motherboard can operate using power from a backup power supply module, for example, it can supply power to the storage device. However, it is understood that the power provided by the backup power supply module is limited.

[0104] The metadata of a storage device may include data such as an L2P Table (Logical to Physical Table), Log files, and configuration parameters. The L2P Table represents the mapping relationship between the logical addresses and physical addresses of stored data and is crucial for the normal operation of the storage device. The Log records the operating 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 storage device to achieve optimal performance and reliability, such as control parameters for input / output flow control algorithms.

[0105] When the motherboard experiences an abnormal power loss, it can send a message indicating the power loss to the storage device. Upon receiving this message, the storage device can determine that the currently connected motherboard has experienced an abnormal power loss. Therefore, it can proceed with updating the data volume on the storage device.

[0106] In this application, the amount of data flushed by the storage device refers to the amount of data flushed by the storage device during an abnormal power outage.

[0107] S102, based on the updated data volume, perform data refresh;

[0108] The storage device can perform data flushing using metadata whose size matches the size of the updated flushed data. It is understood that the size of the flushed data does not exceed the size of the updated flushed data.

[0109] The process of flushing data based on the updated data volume includes:

[0110] According to the predetermined data selection rules, metadata that has the updated data size to be flushed is selected from the various metadata currently stored; wherein, the data selection rules are that data with higher importance is selected in priority over data with lower importance.

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

[0112] The various metadata currently stored are stored in a cache, and this data will be lost after the storage device is powered off. However, data stored on the non-volatile storage medium will still exist after a power outage.

[0113] Specifically, the non-volatile storage medium can be NAND (Not AND) or NOR (Not OR), etc. NAND and NOR are both storage cell types used in flash memory, and have non-volatile storage characteristics, meaning that data can remain unchanged after power is off. There are various specific types of non-volatile storage media, and this application does not limit them.

[0114] In this application, the data size can be expressed in units such as KB (kilobyte) and MB (megabyte), like 1MB of data, or in units of number of records, like 100 records. This application does not limit the unit of data size.

[0115] The predetermined data selection rule can be based on the importance of each metadata, selecting metadata with higher importance and a larger amount of updated data to be flushed down. Importance indicators can be pre-assigned to each type of metadata, so that the storage device can determine the importance of each metadata from the currently stored metadata based on its type.

[0116] Furthermore, the predetermined data selection rule can be random selection, that is, randomly selecting metadata with the updated data size from various metadata for data flushing. This application does not specifically limit the specific process by which the storage device performs data flushing based on the given data size (either updating to a new data size or using an existing data size). Any implementation method in related technologies that selects and flushes data according to a given data size can be applied to this application.

[0117] S103, in response to the occurrence of a specified operation, detect whether the first type of data volume corresponding to the specified operation is the same as the corresponding second type of data volume, and obtain the detection result of whether the data brushing corresponding to the specified operation is completed; wherein, the specified operation is a power-on operation performed for abnormal power failure of the motherboard; the first type of data volume and the second type of data volume corresponding to any specified operation are respectively the data volume completed by data brushing after abnormal power failure of the motherboard and the brushing data volume on which the specified operation is based.

[0118] The specified operation can be the first power-on operation after an abnormal power outage of the motherboard. The amount of data used for the data refresh refers to the amount of data determined during the previous power outage process, and the amount of data used for the data refresh is matched with the updated data refresh amount.

[0119] There are multiple ways to detect whether the first type of data volume corresponding to the specified operation is the same as the corresponding second type of data volume, and to obtain the detection result of whether the brushing of the characterization data corresponding to the specified operation is completed.

[0120] For example, one implementation is as follows: after the motherboard is powered on, the storage device can detect the data that was flushed during the last power failure and detect whether the amount of data that was flushed is the same as the amount of data that was flushed. If they are the same, it means that the amount of data flushed is complete. If they are different, it means that the data flushing is not complete.

[0121] For example, another implementation is as follows: After the storage device completes the data flushing, a flag indicating the completion of the flushing can be written into the storage device. Then, after the motherboard powers 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 on which it was based, and the data flushing is complete. If it does not exist, it means that the amount of data flushed is different from the amount of data on which it was based, and the data flushing is not complete. For example, when the storage device is a solid-state drive (SSD), the flag can be written to the NAND flash memory after the data flushing is completed.

[0122] S104. Based on the detection results corresponding to the current specified operation and the detection results corresponding to the previous specified operation, determine whether the termination condition for updating the data volume of the next flush has been met.

[0123] The detection result corresponding to the specified operation in this instance refers to the detection result regarding the completeness of the data flushed by the storage device during the abnormal power failure process of the motherboard to which the storage device is connected. The detection result corresponding to the previous specified operation refers to the detection result regarding the completeness of the data flushed by the storage device during an abnormal power failure process of the motherboard to which the storage device is connected, prior to the current abnormal power failure process.

[0124] It is understood that, in this application, the motherboard to which the storage device is connected can be different motherboards.

[0125] The determination of whether the termination condition for updating the data volume for the next flush is met based on the detection results corresponding to the current specified operation and the detection results corresponding to the previous specified operation may include:

[0126] If any one of the first, second, third, and fourth matching relationships is met, then the termination condition for updating the data volume of the next flush is determined to have been met.

[0127] The first matching relationship is: the detection result representation corresponding to the current specified operation is complete, the detection result representation corresponding to the previous specified operation is not complete, and the update direction when the second type of data volume corresponding to the current specified operation is updated is decreasing.

[0128] The update direction of the second type of data volume corresponding to this specified operation is a decrease, indicating that the second type of data volume corresponding to this specified operation is less than the second type of data volume corresponding to the previous specified operation. However, the detection result representation of this specified operation is complete, while the detection result representation of the previous specified operation is incomplete. This indicates that the size of the second type of data volume corresponding to the previous specified operation exceeds the maximum available data volume for swiping that matches the power supply duration of the currently connected motherboard. After swiping based on the reduced second type of data volume corresponding to this specified operation, the result is complete. This indicates that the second type of data volume corresponding to this specified operation is the maximum available data volume for swiping that matches the current power supply duration of the motherboard.

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

[0130] The update direction of the second type of data volume corresponding to the specified operation in this update is increasing, indicating that the second type of data volume corresponding to the specified operation in this update is larger than the second type of data volume corresponding to the previous specified operation. However, the characterization of the detection result corresponding to the specified operation in this update is not complete, while the characterization of the detection result corresponding to the previous specified operation is complete. This indicates that the size of the second type of data volume corresponding to the specified operation in this update exceeds the maximum available data volume that matches the power supply duration of the currently connected motherboard. After the data volume corresponding to the previous specified operation is updated based on the increased second type of data volume, the result is complete. This indicates that the second type of data volume corresponding to the previous specified operation is the maximum available data volume that matches the current power supply duration of the motherboard.

[0131] The third matching relationship is: the detection result corresponding to the specified operation is completed, and the second type of data volume corresponding to the specified operation is the preset maximum threshold value of the brush volume.

[0132] In this application, the amount of data to be flushed can be set to a range. When the amount of data to be flushed exceeds the range of this range, the amount of data to be flushed is set as a critical value. If the amount of the second type of data corresponding to the specified operation is the preset maximum critical value of the amount to be flushed, then it is no longer possible to increase the amount of data to be flushed. The amount of the second type of data corresponding to the specified operation, that is, the preset maximum critical value of the amount to be flushed, can be directly used as the maximum available amount of data to be flushed that matches the current motherboard power supply duration.

[0133] The fourth matching relationship is: the detection result representation corresponding to the specified operation is not completed, and the second type of data volume corresponding to the specified operation is the preset minimum threshold value of the brush volume.

[0134] If the second type of data volume corresponding to this specified operation is the preset minimum threshold for data downscraping, and data downscraping cannot be completed, it indicates that the motherboard's power supply capability is very poor during power loss, and even the minimum threshold for downscraping cannot support it. In this case, no update is needed; the downscraping volume can be set to the minimum threshold (even if data downscraping cannot be completed at this time), and a message indicating insufficient power supply capability of the motherboard during abnormal power loss can be sent to the user to remind them to avoid abnormal power loss. Specifically, a message indicating insufficient power supply capability of the motherboard during abnormal power loss can be sent to the motherboard connected to the storage device, so that the motherboard can send a message indicating insufficient power supply capability of the motherboard during abnormal power loss to the connected display device for display.

[0135] For example, a specific process for determining whether the end condition for updating the data volume of the storage device has been met after the storage device performs an abnormal power failure during any storage device connection includes steps 1-2.

[0136] Step 1: Regarding this abnormal power outage of the motherboard, after power-on, the storage device checks the integrity of the data flushed during the abnormal power outage. If the data is intact, record S. k-1 =1; otherwise, record S. k-1 =0. The S k-1 This refers to the data integrity identifier that is written during an abnormal power outage of the motherboard to which the storage device is connected.

[0137] Step 2: ① If m = -1 is satisfied, S k-1 =1,S k-2 If x = 0, the detection is complete; set Flag = 0 and update the result x in the fingerprint database F. The S... k-2This refers to the data integrity identifier generated during the previous abnormal power failure of the motherboard connected to the storage device. The previous abnormal power failure refers to the power failure preceding the current abnormal power failure of the motherboard connected to the storage device. m = -1 indicates that the amount of data generated during this abnormal power failure is less than the amount generated during the previous abnormal power failure. The Flag is a flag indicating whether the storage device is currently in a power supply capability detection round. If the Flag is 1, it indicates that the storage device is currently in a power supply capability detection round; if the Flag is 0, it indicates that the storage device is not currently in a power supply capability detection round. The fingerprint database stores the fingerprint information (unique identifier) ​​of the motherboards connected to the storage device, as well as the maximum usable data generation capacity for each connected motherboard.

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

[0139] ②If m=1, S k-1 =0, S k-2 If x = 1, the detection is complete. Set Flag = 0 and update the result x in the fingerprint database F.

[0140] The m=1 indicates that the amount of data refreshed during this abnormal power outage is larger than the amount of data refreshed during the previous abnormal power outage.

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

[0142] ③If m=1, S k-1 =1, and the amount of data refreshed during this abnormal power outage is the maximum threshold value for the refresh amount. Therefore, the detection is complete, Flag = 0, and the result x is updated in the fingerprint database. The result x is the maximum threshold value for the refresh amount. At this point, the current refresh amount is the maximum threshold value for the refresh amount, and the refresh is complete. The current refresh amount cannot be increased further. The maximum threshold value for the refresh amount is the maximum available data refresh amount compatible with the currently connected motherboard.

[0143] ④ If m = -1, S k-1If the value of the data is 0, and the amount of data flushed during this abnormal power outage is based on the minimum threshold value for the flush amount, then the detection is complete. Set Flag = 0, and update the result x in the fingerprint database. The result x is the minimum threshold value for the flush amount. At this point, even if the current flush amount has reached the minimum threshold value, data flushing cannot be completed, indicating that the motherboard's power supply to the storage device is insufficient during a power outage.

[0144] ⑤ In other cases, set Flag=1. If the termination condition for updating the data volume of the next flush has not been met, continue the detection.

[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 previous specified operation, determine the maximum available data volume that is compatible with the currently connected motherboard, and stop updating the data volume of the storage device for the currently connected motherboard.

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

[0147] Optionally, determining the maximum available data volume for flashing that is compatible with the currently connected motherboard based on the second type of data volume corresponding to the current specified operation or the second type of data volume corresponding to the previous specified operation includes:

[0148] If the first or third matching relationship is met, the second type of data volume corresponding to the current specified operation is determined as the maximum available data volume for swiping that is compatible with the currently connected motherboard; if the second matching relationship is met, the second type of data volume corresponding to the previous specified operation is determined as the maximum available data volume for swiping that is compatible with the currently connected motherboard; if the fourth matching relationship is met, the minimum threshold value for swiping is determined as the maximum available data volume for swiping that is compatible with the currently connected motherboard.

[0149] Specifically, if the first matching relationship is satisfied, the maximum available data volume for swiping adapted to the currently connected motherboard is the second type of data volume corresponding to the current specified operation. If the second matching relationship is satisfied, the maximum available data volume for swiping adapted to the currently connected motherboard is the second type of data volume corresponding to the last specified operation. If the third matching relationship is satisfied, the maximum available data volume for swiping adapted to the currently connected motherboard is the second type of data volume corresponding to the current specified operation, i.e., the preset maximum swiping volume threshold. If the fourth matching relationship is satisfied, the currently connected motherboard cannot provide power to the storage device; the swiping volume can be set to the minimum swiping volume threshold, and information indicating insufficient power supply capacity of the motherboard during abnormal power loss can be sent to the user.

[0150] The solution of this application involves updating the data volume of the storage device when the currently connected motherboard experiences an abnormal power loss. Based on the updated data volume, data is flushed. During a specified operation—specifically, a power-on operation performed in response to the abnormal power loss of the motherboard—the completion of the data flushing is detected, and a detection result is obtained. Based on the detection result corresponding to the current specified operation and the detection result corresponding to the previous specified operation, it is determined whether the termination condition for updating the data volume has been met. 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 previous specified operation, the maximum available data volume adapted to the currently connected motherboard is determined, and the updating of the data volume of the storage device for the currently connected motherboard is stopped. Therefore, the solution of this application, through updating the data volume after an abnormal power loss and detecting the completion of the data flushing after a specified power-on operation, can effectively determine the maximum available data volume adapted to the currently connected motherboard.

[0151] Optionally, before updating the data volume flushed from the storage device, the method further includes:

[0152] Check whether the trigger conditions for power supply capability testing of the currently connected motherboard are met;

[0153] The update of the data volume flushed to the storage device includes:

[0154] If the triggering conditions are met, the amount of data flushed from the storage device is updated according to the update method corresponding to the triggered conditions.

[0155] This application sets different update methods for the amount of data flushed to the storage device under different trigger conditions.

[0156] Optionally, the number of triggering conditions is multiple, including a first condition, a second condition, a third condition, and a fourth condition.

[0157] The first condition includes the fact that the currently connected motherboard has changed compared to the motherboard connected when the motherboard experienced an abnormal power failure.

[0158] Different motherboards have different backup power supply modules with varying power capabilities, resulting in different durations of power delivery to connected storage devices during abnormal power outages. For example... Figure 2 The image shown is a schematic diagram of an exemplary motherboard voltage curve. Figure 2 In the diagram, the horizontal axis represents time, and the vertical axis represents the supply voltage. It can be seen that, within the same timeframe, the supply voltage of motherboard B drops faster than that of motherboard A. When the supply voltage drops below the available supply voltage for the storage device, the storage device becomes inoperable. Therefore, it can be concluded that motherboard A can provide power to the storage device for a longer duration than motherboard B.

[0159] Therefore, if the motherboards connected to the storage devices are different, the maximum amount of available data that can be flushed when the storage devices perform data flushing during an abnormal power outage will also be different. Therefore, it is necessary to update the data flushing amount of the storage devices to obtain a data flushing amount that matches the power supply duration provided by the currently connected motherboard to the connected storage devices during an abnormal power outage.

[0160] The second condition includes the current testing round for power supply capacity detection.

[0161] Regarding the second condition, the aforementioned testing rounds refer to the testing process for the power supply capability of the same motherboard. After this testing process is completed, the maximum available data volume matching the power supply capability of the motherboard can be obtained. Therefore, the current testing round for power supply capability represents the current testing process for the maximum available data volume compatible with the same motherboard. This power supply capability testing refers to the testing of the power supply capability of the connected storage devices after the motherboard experiences an abnormal power loss. For clarity and layout, the method for determining the testing rounds for power supply capability testing will be described later.

[0162] The third condition includes the time interval between the current moment and the last time the data volume was updated, which exceeds the predetermined time.

[0163] To ensure the accuracy and stability of the determined amount of data flushed to the storage device, periodic checks can be performed.

[0164] The fourth condition includes: when the motherboard experienced an abnormal power failure, the data update process was not executed, and the target detection representation data corresponding to the specified operation for the previous abnormal power failure was not refreshed.

[0165] It is understandable that in this embodiment, when the motherboard experiences an abnormal power failure, a data update process is performed if the first, second, or third conditions are met. However, during the previous abnormal power failure, the data update process was not performed, and the target detection representation data corresponding to the specified operation of the previous power failure was not completely refreshed. This indicates that the first, second, or third conditions were not met during the previous power failure, therefore, no data update was necessary. The incomplete data refresh indicates that the power supply duration of the connected motherboard has decreased. This decrease in power supply duration may be due to damage to the motherboard's backup power supply module or an increase in the power load caused by an increase in the connected devices, resulting in a reduced power supply duration for the storage device. Consequently, when data was updated based on the maximum recorded available data volume during the previous abnormal power failure, the data was not completely updated. Regardless of the reason for the reduced power supply duration provided by the motherboard to the storage device, the storage device will meet the fourth condition. This means that the recorded data volume cannot match the power supply duration provided by the currently connected motherboard to the storage device. Therefore, it is necessary to update the data volume of the storage device.

[0166] Optionally, the method further includes:

[0167] If the termination condition is not met, the storage device is set to the current detection round for power supply capability detection; and,

[0168] Before updating the data volume of the storage device according to the update method corresponding to the triggered conditions, the storage device is set to the current detection round of power supply capability detection.

[0169] In this application, after updating the data volume of the storage device, although the data volume of the storage device is updated, the updated data volume may not be the maximum available data volume that matches the current power supply duration of the motherboard.

[0170] Therefore, in this 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 current power supply duration of the motherboard, and the update of the data volume of the storage device can be stopped; if the condition is not met, there is a mismatch, and the storage device can be set to the current power supply capability detection cycle, so that the second condition will be met at least during the next abnormal power outage, thereby triggering the update of the data volume.

[0171] Specifically, updating the data volume of the storage device according to the update method corresponding to the satisfied trigger conditions includes:

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

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

[0174] It is understandable that after updating according to the update method of the data volume corresponding to the first condition, the termination condition will not be met. Therefore, the storage device will be set to the current detection round of power supply capability detection. Then, the next time an abnormal power failure occurs, at least the second condition will be met, thereby triggering the update of the data volume of the storage device.

[0175] If the second condition is met, the amount of data flushed from the storage device is updated based on the number of data flushed from the most recent update of the storage device, according to the current update direction and update rules, while keeping the current update direction unchanged; the update principle is not to exceed the preset maximum threshold value of the amount of data flushed.

[0176] The current update direction refers to the update direction set by the update method corresponding to the trigger condition met during the last abnormal power outage. For example, if the trigger condition met last time was the first condition or the third condition, then the current update direction is to increase; if the trigger condition met last time was the fourth condition, then 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 is understood that if an abnormal power outage occurs within the predetermined time period and does not meet the above triggering conditions, it will not trigger an update of the data volume. Instead, the data will be updated according to the data volume obtained from the most recent update, and the update will be completed. The data volume obtained from the most recent update is the largest available data volume that is currently compatible with the motherboard determined in the previous update.

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

[0180] As can be seen from the description of the fourth condition above, if the fourth condition is met, it means that the amount of data currently recorded by the storage device is greater than the maximum available amount of data to be written to the current motherboard. Therefore, the amount of data can be reduced.

[0181] In this application, the operations of increasing and decreasing the number of data items mentioned above change the number of data items by a single unit each time. The unit may vary depending on the specific application scenario, and this application does not impose any limitations on this.

[0182] In this application, the above four conditions can be assigned priorities, with the first condition having a higher priority than the other three. In this application, after detecting whether the trigger condition for power supply capability detection of the currently connected motherboard is met, if multiple trigger conditions are met, including the first condition, the data volume of the storage device is updated according to the update method corresponding to the first condition. If multiple trigger conditions are met, but not including the first condition, the data volume of the storage device is updated according to the earliest detected trigger condition, following the time order in which the trigger conditions were detected.

[0183] For example, the update method corresponding to the triggering condition of this application can be as follows:

[0184] First, the triggering conditions may include: R1, R2, R3, and R4. Detection will be initiated and the flag word Flag = 1 when one of the following four conditions is met; otherwise, Flag = 0; wherein the definition of Flag is the same as in 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 is not yet complete, as indicated by the flag. If Flag = 1, it means the process is not yet complete and the current round is in the power supply capacity detection phase; otherwise, it means the process is complete.

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

[0188] R4: During the previous power outage, detection was not initiated, and data flushing was not completed.

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

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

[0191] ① If R = R1, test in the direction of increasing the downsweep amount: Set the downsweep data amount x = xmin , m = 1. Where x min This represents the minimum data rate, and m=1 indicates that the data rate will increase by 1 step Δx for each subsequent data rate during the detection process.

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

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

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

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

[0196] Step 2: Based on the amount of data to be flushed x, flush the data.

[0197] The solution in this embodiment sets different update methods for the amount of data to be flushed to the storage device for different triggering conditions, thereby providing support for determining the maximum amount of available data to be flushed to the storage device that is compatible with the currently connected motherboard.

[0198] Optionally, the method further includes:

[0199] In response to a specified operation, obtain the sequence of commands sent by the currently connected motherboard and / or the time interval between the sequence of commands;

[0200] Based on the command sequences sent by the currently connected motherboard and / or the time intervals between the command sequences, generate unique identification information for the currently connected motherboard.

[0201] The unique identifier information of the currently connected motherboard is compared with the target identifier information. If they are different, it indicates that the currently connected motherboard has changed compared to the motherboard connected when the motherboard experienced an abnormal power failure. The target identifier information is the unique identifier information of the connected motherboard recorded by the storage device.

[0202] After the motherboard powers on, it sends a series of command sequences to the connected storage devices. Each motherboard sends a different sequence of commands, and the time intervals between these sequences are also different. Therefore, a unique identifier for the currently connected motherboard can be generated based on the command sequences and / or the time intervals between them.

[0203] In one implementation, the sequence of commands sent by the currently connected motherboard and / or the time interval between the command sequences can be used as the unique identifier of the currently connected motherboard.

[0204] In one implementation, the command sequences sent by the currently connected motherboard and / or the time intervals between the command sequences can be used as parameters for hash calculation, and the calculated hash value can be used as the unique identifier of the currently connected motherboard.

[0205] Each time the motherboard is powered on, a unique identifier for the currently connected motherboard is generated and compared with the recorded unique identifier for the connected motherboard. If they are the same, it means that the motherboard has not been replaced; if they are different, it means that the motherboard has been replaced, and the target identifier is updated to the generated unique identifier.

[0206] A specific implementation method for determining whether the motherboard has changed, such as... Figure 3 As shown, it includes:

[0207] S301 detects power-on and calculates fingerprint information.

[0208] A power-on detection corresponds to the specified operation described above. The fingerprint information refers to the unique identification information of the motherboard.

[0209] Specifically, after power-on, the storage device can record the command sequence cmd_list and the interval time t_list of the command sequence sent by the motherboard.

[0210] Normally, after power-on, the motherboard sends relevant commands to the SSD according to its BIOS (Basic Input / Output System) settings. Different motherboards and hosts have different command sequences and time intervals between them, which can be used to generate fingerprint information.

[0211] Based on cmd_list and t_list, fingerprint information is generated using the set hash function f = h(cmd_list, t_list), where f is the fingerprint information.

[0212] S302, Check if the fingerprint information is the same as the original fingerprint information.

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

[0214] S303, determine whether the fingerprint information is in the fingerprint database.

[0215] If the fingerprint is present, it means that the fingerprint information has been recorded before. The corresponding brush amount is found in the fingerprint database as the maximum available brush data amount that is compatible with the currently connected motherboard, and it is determined that the motherboard has not been updated.

[0216] Whether the fingerprint information is in the fingerprint database indicates that the fingerprint database records the maximum amount of available data that can be used for data swiping when the motherboard corresponding to the fingerprint is used as the motherboard connected to the storage device. Therefore, the amount of data swiping can be used directly.

[0217] If not, then the motherboard has been updated.

[0218] In this application, the determination of whether the first triggering condition is met can be based on the method described in this embodiment.

[0219] Below, in conjunction with Figure 4 This application provides a detailed description of a method for determining the amount of data to be processed during a data rollover. The execution subject of this embodiment is an SSD (storage device), which belongs to the aforementioned storage devices. For example... Figure 4 As shown, a method for determining the amount of data to be flushed may include:

[0220] S401, power failure detected.

[0221] The method for detecting power failure corresponds to S101 above, and will not be elaborated further here.

[0222] S402, Check whether the detection conditions are met.

[0223] The detection conditions correspond to the triggering conditions mentioned above.

[0224] S403, flag set to 1.

[0225] The flag indicates whether the storage device is currently in a power supply capability detection round. If the flag is 1, it means that the storage device is currently in a power supply capability detection round; if the flag is not 1, it means that the storage device is not currently in a power supply capability detection round.

[0226] When the storage device is currently in the detection round of power supply capability detection, the steps of S403 can be executed.

[0227] S404, Motherboard power supply capability test.

[0228] The steps in S404 correspond to those in S102-S105 above, and will not be elaborated upon here.

[0229] This embodiment can effectively determine the maximum amount of available data that can be flushed to the storage device and is compatible with the motherboard currently connected to it.

[0230] This application also provides a device for determining the amount of data flushed, wherein the device is applied to a storage device, such as... Figure 5 As shown, the device includes:

[0231] Update module 501 is used to update the amount of data to be flushed from the storage device in response to an abnormal power failure of the currently connected motherboard.

[0232] The down-flush module 502 is used to perform data down-flush based on the down-flush data volume obtained from the update;

[0233] The detection module 503 is used to detect whether the first type of data volume corresponding to the specified operation is the same as the corresponding second type of data volume in response to the occurrence of a specified operation, and to obtain a detection result of whether the data brushing corresponding to the specified operation is completed; wherein, the specified operation is a power-on operation performed for abnormal power failure of the motherboard; the first type of data volume and the second type of data volume corresponding to any specified operation are respectively the data volume completed by data brushing after abnormal power failure of the motherboard and the brushing data volume on which the specified operation is based.

[0234] The first determining module 504 is used to determine whether the termination condition for updating the amount of data to be flushed is met based on the detection result corresponding to the current specified operation and the detection result corresponding to the previous specified operation.

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

[0236] The solution of this application involves updating the data volume of the storage device when the currently connected motherboard experiences an abnormal power loss. Based on the updated data volume, data is flushed. During a specified operation—specifically, a power-on operation performed in response to the abnormal power loss of the motherboard—the completion of the data flushing is detected, and a detection result is obtained. Based on the detection result corresponding to the current specified operation and the detection result corresponding to the previous specified operation, it is determined whether the termination condition for updating the data volume has been met. 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 previous specified operation, the maximum available data volume adapted to the currently connected motherboard is determined, and the updating of the data volume of the storage device for the currently connected motherboard is stopped. Therefore, the solution of this application, through updating the data volume after an abnormal power loss and detecting the completion of the data flushing after a specified power-on operation, can effectively determine the maximum available data volume adapted to the currently connected motherboard.

[0237] Optionally, before updating the data volume flushed from the storage device, the method further includes:

[0238] Check whether the trigger conditions for power supply capability testing of the currently connected motherboard are met;

[0239] The update of the data volume flushed to the storage device includes:

[0240] If the triggering conditions are met, the amount of data flushed from the storage device is updated according to the update method corresponding to the triggered conditions.

[0241] Optionally, the number of triggering conditions is multiple, including a first condition, a second condition, a third condition, and a fourth condition;

[0242] The first condition includes that the currently connected motherboard has changed compared to the motherboard connected during the previous abnormal power failure; the second condition includes that the current power supply capability detection cycle is in progress; the third condition includes that the interval between the current time and the last update of the data volume exceeds a predetermined duration; the fourth condition includes that the data volume update process was not executed during the last abnormal power failure of the motherboard, and the target detection characterization data corresponding to the specified operation for the last abnormal power failure of the motherboard was not refreshed.

[0243] The device further includes:

[0244] The setting module is used to set the storage device to the current detection round of power supply capability detection if the termination condition is not met.

[0245] Optionally, the setting module includes:

[0246] An update unit is configured to update the amount of data flushed from the storage device to the minimum amount of data flushed if a first condition is met, and to set the update direction for the amount of data flushed to increase.

[0247] If the second condition is met, the amount of data flushed from the storage device is updated based on the number of data flushed from the most recent update of the storage device, according to the current update direction and update rules, while keeping the current update direction unchanged; the update principle is not to exceed the preset maximum threshold value of the amount of data flushed.

[0248] 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.

[0249] If the fourth condition is met, the amount of data flushed to the storage device is reduced from the amount of data flushed in the most recent update, and the update direction is set to decrease.

[0250] Optionally, the first determining module includes:

[0251] The first determining unit is used to determine that the end condition for updating the data volume of the next flush is met if any one of the first matching relationship, the second matching relationship, the third matching relationship and the fourth matching relationship is met.

[0252] The first matching relationship is: the detection result representation corresponding to the current specified operation is complete, the detection result representation corresponding to the previous specified operation is not complete, and the update direction when the second type of data volume corresponding to the current specified operation is updated is decreasing.

[0253] The second matching relationship is: the detection result representation corresponding to the current specified operation is incomplete, the detection result representation corresponding to the previous specified operation is complete, and the update direction when the second type of data volume corresponding to the current specified operation is updated is increasing;

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

[0255] The fourth matching relationship is: the detection result representation corresponding to the specified operation is not completed, and the second type of data volume corresponding to the specified operation is the preset minimum threshold value of the brush volume.

[0256] Optionally, the second determining module includes:

[0257] The second determining unit is used to determine the second type of data volume corresponding to the current specified operation as the maximum available data volume adapted to the currently connected motherboard when the first matching relationship or the third matching relationship is met; when the second matching relationship is met, the second type of data volume corresponding to the previous specified operation is determined as the maximum available data volume adapted to the currently connected motherboard; when the fourth matching relationship is met, the minimum threshold value of the data volume is determined as the maximum available data volume adapted to the currently connected motherboard.

[0258] Optionally, the device further includes:

[0259] The sending module is used to obtain, in response to a specified operation, the sequence of commands sent by the currently connected motherboard and / or the time interval between the sequence of commands;

[0260] The generation module is used to generate unique identification information of the currently connected motherboard based on the command sequences sent by the currently connected motherboard and / or the time intervals between the command sequences.

[0261] The 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 motherboard experienced a previous abnormal power failure. The target identification information is the unique identification information of the connected motherboard recorded by the storage device.

[0262] Optionally, the down-scrolling module includes:

[0263] The selection unit is used to select metadata to be flushed from various currently stored metadata that has the updated flush data size according to a predetermined data selection rule; wherein, the data selection rule is that data with higher importance is selected in priority over data with lower importance.

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

[0265] This application also provides a storage device, such as... Figure 6 As shown, it includes:

[0266] Memory 601 is used to store computer programs;

[0267] The processor 602, when executing the program stored in the memory 601, implements any of the above-described methods for determining the amount of data to be flushed.

[0268] Furthermore, the aforementioned storage device may also include a communication bus and / or a communication interface, and the processor 602, the communication interface, and the memory 601 communicate with each other through the communication bus.

[0269] 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. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not indicate that there is only one bus or one type of bus.

[0270] The communication interface is used for communication between the aforementioned electronic devices and other devices.

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

[0272] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0273] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described methods for determining the amount of data to be refreshed.

[0274] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the brush data volume determination methods in the above embodiments.

[0275] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially 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, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.

[0276] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0277] The various embodiments in this specification are described in a related manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

[0278] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.

Claims

1. A method for determining the amount of data to be flushed, characterized in that, The application is applied to a storage device; the method comprises: In response to current connected mainboard abnormal power-off, detecting whether the trigger condition for power supply capacity detection of the current connected mainboard is met, and in the case of meeting the trigger condition, updating the data flushing amount of the storage device according to the updating mode corresponding to the met trigger condition; the number of trigger conditions is multiple, and the multiple trigger conditions include a first condition; the first condition includes that the current connected mainboard changes relative to the mainboard connected at the last time of mainboard abnormal power-off; Based on the updated data flushing amount, data flushing is performed; In response to a specified operation, detecting whether the first type of data amount corresponding to the specified operation is the same as the second type of data amount, to obtain the detection result of the specified operation corresponding to the specified operation, indicating whether the data flushing is completed; wherein the specified operation is a power-on operation for mainboard abnormal power-off; the first type of data amount and the second type of data amount corresponding to any specified operation are the data amount flushed and the data flushing amount based on the data flushing performed after the mainboard abnormal power-off corresponding to the specified operation; Based on the detection result corresponding to the specified operation and the detection result corresponding to the last specified operation, it is determined whether the end condition for updating the data flushing amount is met; If the end condition is met, based on the second type of data amount corresponding to the specified operation or the second type of data amount corresponding to the last specified operation, the largest available data flushing amount suitable for the current connected mainboard is determined, and the updating of the data flushing amount of the storage device is stopped for the current connected mainboard; Wherein, the judgment mode of the current connected mainboard changing relative to the mainboard connected at the last time of mainboard abnormal power-off includes: Comparing the unique identification information of the current connected mainboard with the target identification information, if they are not the same, it indicates that the current connected mainboard changes relative to the mainboard connected at the last time of mainboard abnormal power-off; wherein the unique identification information of the current connected mainboard is generated based on each command sequence sent by the current connected mainboard and / or the time interval between each command sequence; the target identification information is the unique identification information of the connected mainboard recorded by the storage device.

2. The method of claim 1, wherein, The multiple trigger conditions further include a second condition, a third condition and a fourth condition; The second condition includes the detection round currently in power supply capacity detection; the third condition includes that the interval between the current time and the time of the last updating of the data flushing amount exceeds a predetermined time length; the fourth condition includes that the updating process of the data flushing amount is not performed at the last time of mainboard abnormal power-off, and the target detection indicating data corresponding to the specified operation of the last mainboard abnormal power-off is not flushed; The method further comprises: In the case of not meeting the end condition, the storage device is set to the detection round currently in power supply capacity detection.

3. The method of claim 2, wherein, The updating of the data flushing amount of the storage device according to the updating mode corresponding to the met trigger condition comprises: If the first condition is met, the data flushing amount of the storage device is updated to the minimum flushing amount, and the updating direction of the data flushing amount is set to increase; If the second condition is met, the current update direction and the update rule are used to update the data amount of the next brush of the storage device based on the data amount of the next brush obtained by the last update of the storage device, and the current update direction is kept unchanged; the update rule is that the data amount of the next brush does not exceed a preset maximum critical value of the data amount of the next brush; If the third condition is met, the data amount of the next brush of the storage device is updated to the data amount of the next brush obtained by the last update of the storage device, and the update direction is set to increase; If the fourth condition is met, the data amount of the next brush of the storage device is updated by being reduced based on the data amount of the next brush obtained by the last update of the storage device, and the update direction is set to decrease.

4. The method of claim 1, wherein, The method further comprises: If any one 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 data amount of the next brush is reached; The first matching relationship is that the detection result corresponding to the current specified operation represents completion, the detection result corresponding to the last specified operation represents non-completion, and the update direction when the second type of data amount corresponding to the current specified operation is updated is decrease; The second matching relationship is that the detection result corresponding to the current specified operation represents non-completion, the detection result corresponding to the last specified operation represents completion, and the update direction when the second type of data amount corresponding to the current specified operation is updated is increase; The third matching relationship is that the detection result corresponding to the current specified operation represents completion, and the second type of data amount corresponding to the current specified operation is the preset maximum critical value of the data amount of the next brush; The fourth matching relationship is that the detection result corresponding to the current specified operation represents non-completion, and the second type of data amount corresponding to the current specified operation is the preset minimum critical value of the data amount of the next brush.

5. The method of claim 4, wherein, The method further comprises: In the case of meeting the first matching relationship or the third matching relationship, the second type of data amount corresponding to the current specified operation is determined as the maximum available data amount of the next brush compatible with the currently connected mainboard; in the case of meeting the second matching relationship, the second type of data amount corresponding to the last specified operation is determined as the maximum available data amount of the next brush compatible with the currently connected mainboard; in the case of meeting the fourth matching relationship, the minimum critical value of the data amount of the next brush is determined as the maximum available data amount of the next brush compatible with the currently connected mainboard.

6. The method of claim 1, wherein, 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; Based on each command sequence sent by the currently connected mainboard and / or the time interval between each command sequence, generating unique identification information of the currently connected mainboard; The unique identification information of the current connected mainboard is compared with target identification information, if not the same, representing that the current connected mainboard changes relative to the mainboard connected when the previous mainboard abnormally powers off; wherein the target identification information is the unique identification information of the connected mainboard recorded by the storage device.

7. The method of claim 1, wherein, The data flushing is performed based on the updated flushing data amount, including: According to a predetermined data selection rule, the metadata with the updated flushing data amount size to be flushed is selected from the currently stored various metadata; wherein the data selection rule is that the data with high importance degree is selected in priority to the data with low importance degree. The selected metadata is stored to the predetermined non-volatile storage medium to perform data flushing.

8. A downbrush data volume determination apparatus characterized by comprising: The application is applied to a storage device; the device includes: The updating module is used to detect whether the trigger condition for performing power supply capacity detection on the current connected mainboard is met in response to the abnormal power off of the current connected mainboard, and the flushing data amount of the storage device is updated according to the updating mode corresponding to the met trigger condition; the number of trigger conditions is multiple, and the multiple trigger conditions include a first condition; the first condition includes that the current connected mainboard changes relative to the mainboard connected when the previous mainboard abnormally powers off; The flushing module is used to perform data flushing based on the updated flushing data amount; The detection module is used to detect whether the first type data amount corresponding to the specified operation is the same as the second type data amount corresponding to the specified operation in response to the occurrence of the specified operation, and obtain the detection result of the specified operation corresponding to the data flushing completion indication; wherein the specified operation is the power-on operation performed for the mainboard abnormal power off; the first type data amount and the second type data amount corresponding to any specified operation are the flushed data amount and the flushing data amount based on which the data flushing is completed after the mainboard abnormal power off corresponding to the specified operation; The first determination module is used to determine whether the end condition for updating the flushing data amount is reached based on the detection result corresponding to the current specified operation and the detection result corresponding to the previous specified operation; The second determination module is used to determine the maximum available flushing data amount adapted to the current connected mainboard based on the second type data amount corresponding to the current specified operation or the second type data amount corresponding to the previous specified operation if the end condition is met, and stop updating the flushing data amount of the storage device for the current connected mainboard. The judgment mode that the current connected mainboard changes relative to the mainboard connected when the previous mainboard abnormally powers off includes: The unique identification information of the current connected mainboard is compared with target identification information, if not the same, representing that the current connected mainboard changes relative to the mainboard connected when the previous mainboard abnormally powers off; wherein the unique identification information of the current connected mainboard is generated based on each command sequence and / or the time interval between each command sequence sent by the current connected mainboard; the target identification information is the unique identification information of the connected mainboard recorded by the storage device.

9. A storage device, comprising: It includes: The memory is used to store computer programs; A processor for implementing the method of any one of claims 1-7 when executing a program stored on a memory.

Citation Information

Patent Citations

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

    CN108710583A

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

    CN111459851A