Abnormal power-off data processing method and device, equipment and medium
By obtaining the power supply voltage value and classifying the commands in the event of abnormal power outage, using the flash controller to allocate the channel path and clear processing, the data security problem in NAND Flash storage media is solved, and the reliability of data processing and system stability are improved. .
Patent Information
- Application Number
- CN202411193240.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-06
AI Technical Summary
In the event of abnormal power outage, unfinished storage operations may lead to data corruption, and the prior art is difficult to effectively protect data security in NAND Flash storage media.
By obtaining the power supply voltage value, sending an abnormal power-off signal when the power supply voltage is less than the threshold, obtaining the valid flag value of the command, classifying the data according to the flag value, and processing the data through the flash controller, including allocating the channel path and clearing Process to ensure the security and integrity of the data.
It significantly improves the data processing reliability of SSDs in abnormal power outages, shortens the power down time, reduces the risk of data loss, and enhances the robustness and stability of the system.
Smart Images

Figure CN119088302A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and medium for processing abnormal power failure data. Background Art
[0002] At present, NAND Flash is a non-volatile storage medium widely used in solid-state storage devices (SSDs). Its excellent access speed, high storage density and low unit capacity price have won wide recognition in the market. However, faced with the challenge of abnormal power outages in the power system, the data security in NAND Flash has become an issue that cannot be ignored. At the moment of abnormal power outage, unfinished storage operations may cause data corruption. Summary of the invention
[0003] In order to overcome the above technical defects, the purpose of the present application is to provide a method, device, equipment and medium for processing abnormal power-off data, the method comprising: obtaining a power supply voltage value; in response to the power supply voltage value being less than a first voltage threshold, the system sends an abnormal power-off signal, obtains the valid flag value of each command, classifies and processes the abnormal power-off data according to the valid flag value of each command, and synchronizes the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processes the abnormal power-off data through the flash memory controller; the abnormal power-off data is processed by the flash memory controller, comprising: in response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on the abnormal power-off data through the channel path type of each command; in response to the valid flag value of the command being a second preset value, the system clears the command with the valid flag value of the second preset value. The present application can greatly improve the reliability of data processing of the solid-state hard disk in the case of abnormal power failure, and bring users a more robust and secure storage experience.
[0004] The specific technical solutions provided by the embodiments of this application are as follows:
[0005] In a first aspect, the present application provides a method for processing abnormal power failure data, the method being applied to an abnormal power failure data processing system, the system comprising a flash memory controller, the method comprising:
[0006] Get the power supply voltage value;
[0007] In response to the power supply voltage value being less than a first voltage threshold, an abnormal power-off signal is sent and a valid flag value of each command is acquired;
[0008] Classify and process the abnormal power-off data according to the valid flag values of each command, synchronize the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and process the abnormal power-off data through the flash memory controller;
[0009] The processing of abnormal power-off data by the flash memory controller includes:
[0010] In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command;
[0011] In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared.
[0012] In one embodiment, obtaining the valid flag value of each command, before classifying the data according to the valid flag value of each command, includes:
[0013] Setting a valid flag value for each command, wherein the command includes a write command, a non-aligned read command, a normal read command, a voltage-adjusted read command, and an erase command;
[0014] The setting of the valid flag value of each command includes:
[0015] Setting the valid flag value of the write command and the non-aligned read command to a first preset value;
[0016] The valid flag values of the common read command, the voltage adjustment read command and the erase command are set to a second preset value.
[0017] In one embodiment, the classifying and processing the abnormal power-off data according to the valid flag value of each command includes:
[0018] When the effective flag value of the command is set to the first preset value, the command whose effective flag value is the first preset value is retained by the system in the event of abnormal power failure;
[0019] When the effective flag value of the command is set to the second preset value, the command whose effective flag value is the second preset value is cleared by the system in the event of abnormal power failure.
[0020] In one embodiment, allocating a channel path to each command by the flash memory controller includes:
[0021] When the command is a write command, a low-speed channel path is allocated to the write command;
[0022] When the command is a non-aligned read command, a high-speed channel path is allocated to the non-aligned read command.
[0023] In one embodiment, the timeout and clearing of abnormal power-off data by the channel path type of each command includes:
[0024] Performing timeout processing on abnormal power-off data through the channel path type of each command;
[0025] Clearing abnormal power-off data according to the command ID tag value type of each command;
[0026] The timeout processing of abnormal power-off data by the channel path type of each command includes:
[0027] In response to the command execution time of the high-speed channel path being greater than a first preset time value, reallocating the command from the high-speed channel path to the low-speed channel path, and processing the command through the flash memory controller;
[0028] In response to the command execution time of the low-speed channel path being greater than a first preset time value, reallocating the command from the low-speed channel path to the high-speed channel path, and processing the command through the flash memory controller;
[0029] In response to the command execution time of the high-speed channel path and the low-speed channel path being greater than a first preset time value, resetting the flash memory controller and reprocessing the unprocessed commands through the flash memory controller;
[0030] The clearing process of abnormal power-off data by using the command ID tag value type of each command includes:
[0031] Set the command ID tag value of each command;
[0032] The step of setting the command ID tag value of each command includes:
[0033] When the command is input into any channel path for processing, the command ID tag value of the command is set to a third preset value;
[0034] When the command outputs the execution result of the command after being processed by any channel path, the command ID tag value of the command is set to a fourth preset value;
[0035] In response to the command ID tag value of the command being a third preset value, the command having the command ID tag value being the third preset value is reserved by the system;
[0036] In response to the command ID tag value of the command being the fourth preset value, the command whose command ID tag value is the fourth preset value is cleared through the system.
[0037] In one embodiment, the system further includes a cache area, the flash memory controller includes a register, and before the flash memory controller processes the abnormal power-off data, the process includes:
[0038] In response to the abnormal power failure, when the data is sent to the flash memory controller and fails, the unprocessed commands are saved in the system buffer area;
[0039] Screening unprocessed commands in the buffer area;
[0040] The filtering of the unprocessed commands in the buffer area includes:
[0041] When the effective flag value of the command is set to a second preset value, the command whose effective flag value is the second preset value is cleared by the system;
[0042] The register flag value of the flash memory controller is set to a fifth preset value, and the abnormal power-off signal is synchronized to the flash memory controller.
[0043] In one embodiment, after the abnormal power-off data is processed by the flash memory controller, the following steps are included:
[0044] Record the number of normal read commands, regulated voltage read commands, and erase commands cleared through the system;
[0045] When the abnormal power-off time reaches a second preset time value, unprocessed commands in the cache area and the flash memory controller are recorded, and the abnormal power-off data is optimized according to the unprocessed commands in the cache area and the flash memory controller;
[0046] The optimizing process of abnormal power-off data according to the cache area and the unprocessed commands in the flash memory controller includes:
[0047] Writing all data processing commands into a log file, storing the log file in a non-volatile memory, and recovering unprocessed commands by checking the log file;
[0048] Reduce the amount of data synchronized to the flash controller, manage the flash controller data interaction process through a state machine, and set retry logic for abnormal power-off signals and abnormal power-off data synchronization to the flash controller;
[0049] The integrity of data transmission commands is checked through a cyclic redundancy check mechanism;
[0050] Simulate various abnormal power outage situations and perform robustness tests on the abnormal power outage data processing results according to the first time threshold cycle interval.
[0051] In a second aspect, the present application further provides an abnormal power-off data processing device, the device is applied to an abnormal power-off data processing system, the system includes a flash memory controller, and the device includes:
[0052] An acquisition module, used for acquiring a power supply voltage value;
[0053] A first processing module, configured to send an abnormal power-off signal in response to the power supply voltage value being less than a first voltage threshold, obtain a valid flag value of each command, and classify and process the abnormal power-off data according to the valid flag value of each command;
[0054] A second processing module, used for synchronizing the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processing the abnormal power-off data through the flash memory controller;
[0055] In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command;
[0056] In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared.
[0057] In a third aspect, an abnormal power failure data processing device is also provided, comprising:
[0058] one or more processors;
[0059] A storage device for storing one or more programs;
[0060] When the one or more programs are executed by the one or more processors, the one or more processors implement the abnormal power-off data processing method as described in any one of the first aspects.
[0061] In a fourth aspect, the present application further provides a computer device, the device comprising:
[0062] A memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the abnormal power failure data processing method as described in any one of the first aspects.
[0063] In a fifth aspect, the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the abnormal power-off data processing methods described in the first aspect.
[0064] In a sixth aspect, the present application further provides a computer storage medium, the medium comprising:
[0065] A computer program is stored thereon, and when the computer program is executed by a processor, the steps of any abnormal power-off data processing method described in the first aspect are implemented.
[0066] Compared with the prior art, the method described in the technical solution provided in the embodiment of the present application includes: obtaining the power supply voltage value; in response to the power supply voltage value being less than the first voltage threshold, the system sends an abnormal power-off signal, obtains the valid flag value of each command, classifies and processes the abnormal power-off data according to the valid flag value of each command, and synchronizes the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processes the abnormal power-off data through the flash memory controller; the processing of the abnormal power-off data through the flash memory controller includes: in response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clear processing on the abnormal power-off data through the channel path type of each command; in response to the valid flag value of the command being a second preset value, the system clears the command with the valid flag value of the second preset value. The present application can greatly improve the reliability of data processing of the solid-state hard disk in the case of abnormal power failure, and bring users a more robust and secure storage experience.
[0067] The technical solution system provided in the embodiment of the present application can quickly release resources and shorten the power-off time when facing an abnormal power outage, thereby reducing the risk of data loss; the technical solution of the present application not only significantly enhances the robustness of the system, but also effectively ensures the security of the data; more importantly, while ensuring that key command operations are not affected, the abnormal power outage processing process is optimized through synchronous processing of software and hardware, further improving the overall performance and stability of the system.
[0068] The technical solution provided in the embodiment of the present application adopts intelligent channel allocation logic. According to the type of command, commands with shorter execution time are intelligently allocated to the high channel first, while commands with longer execution time are automatically guided to the low channel, effectively avoiding potential blocking of fast commands on the high channel and ensuring balanced allocation and efficient utilization of system resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0070] Figure 1 A structural diagram of an abnormal power failure data processing system provided in Embodiment 1 of the present application;
[0071] Figure 2 A first flow chart of the abnormal power failure data processing method provided in the first embodiment of the present application;
[0072] Figure 3 A second flow chart of the abnormal power failure data processing method provided in the second embodiment of the present application;
[0073] Figure 4 A third flow chart of the abnormal power failure data processing method provided in the second embodiment of the present application;
[0074] Figure 5 A fourth flow chart of the abnormal power failure data processing method provided in the second embodiment of the present application;
[0075] Figure 6 A fifth flow chart of the abnormal power failure data processing method provided in the second embodiment of the present application;
[0076] Figure 7 A structural diagram of an abnormal power failure data processing device provided in Embodiment 3 of the present application;
[0077] Figure 8 The exemplary system provided for Embodiment 7 of the present application can be used to implement the various embodiments described in the present application. DETAILED DESCRIPTION
[0078] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0079] It should be noted that, unless the context clearly requires otherwise, words such as “include”, “including” and similar words throughout the specification and claims should be interpreted as including rather than exclusive or exhaustive; that is, the meaning is “including but not limited to”.
[0080] Furthermore, in the description of the present application, unless otherwise specified, “plurality” means two or more.
[0081] At the moment of abnormal power outage, unfinished storage operations may cause data corruption. In order to meet this challenge, capacitors that can store charge are configured in the power supply circuit of the solid-state drive. These capacitors can provide a short temporary power supply to the solid-state drive when an abnormal power outage occurs. Therefore, developing a system that can perform key operations to protect data security during this short temporary power supply period has become an important part of ensuring the data security of NAND Flash. The design and implementation of this system will greatly improve the data reliability of the solid-state drive in the event of an abnormal power outage, bringing users a more robust and secure storage experience.
[0082] Embodiment 1
[0083] The present application embodiment provides a method for processing abnormal power failure data, such as Figure 1 , 2 As shown, the method is applied to an abnormal power-off data processing system, the system includes a flash memory controller, and the method includes:
[0084] Get the power supply voltage value;
[0085] In response to the power supply voltage value being less than a first voltage threshold, the system sends an abnormal power-off signal, obtains valid flag values of each command, classifies and processes abnormal power-off data according to the valid flag values of each command, and synchronizes the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processes the abnormal power-off data through the flash memory controller;
[0086] The processing of abnormal power-off data by the flash memory controller includes:
[0087] In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command;
[0088] In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared by the system.
[0089] Specifically, the present application relates to a method for processing abnormal power outages of NAND. When the power supply system is abnormally powered off, the NAND storage chip can complete all necessary operations to ensure the security and integrity of the data. The system uses an interrupt processing mechanism to send an interrupt signal when it detects that the voltage is lower than a threshold, and executes a series of command processing operations.
[0090] Among them, the first voltage threshold is 3V, the first preset value is 0, and the second preset value is 1.
[0091] The NFC module (Nand flash controller), which is the core hardware processing unit, has a specially designed dual-channel (high / low) architecture. This architecture allows two independent communication paths when sending erase, write, and read commands to the NAND flash memory. Once one of the communication paths is stuck due to a fault or anomaly, the system driver will intelligently switch to another backup channel and seamlessly continue to process the remaining commands, thereby effectively avoiding system stagnation or crashes caused by a single path failure. This design not only enhances the reliability and stability of the system, but also improves the overall data processing efficiency and user experience.
[0092] It can be understood that the mechanism of the present application makes a detailed distinction between various command types in NAND flash memory operations (including but not limited to write commands that do not support suspend, write commands that support suspend, non-aligned read commands, normal read commands, adjusted voltage (Frt) read commands, and erase commands), and accordingly makes a refined control design for the high / low channel allocation of commands in the flash memory controller and the execution of flush operations.
[0093] Specifically, in order to maintain the integrity and correctness of the data, any critical commands that may directly affect the correctness of the data are marked as unaware, ensuring that these commands are not interrupted during execution, thereby ensuring the continuity and accuracy of the data; and for those non-critical ordinary commands, they are given the flexibility to be cleared so that resources can be released quickly when the system needs it, thereby improving the overall response speed.
[0094] In addition, in order to further optimize system performance and reduce mutual interference between command executions, this technical solution also adopts intelligent channel allocation logic. The system will intelligently allocate commands with shorter execution time to the high channel according to the type of command, and automatically guide commands with longer execution time to the low channel for execution, effectively avoiding the potential blocking of fast commands on the high channel by time-consuming operations, and ensuring the balanced allocation and efficient utilization of system resources.
[0095] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0096] This application can greatly improve the reliability of data processing in the event of an abnormal power outage on the solid-state drive, providing users with a more robust and secure storage experience.
[0097] The technical solution system provided in the embodiment of the present application can quickly release resources and shorten the power-off time when facing an abnormal power outage, thereby reducing the risk of data loss; the technical solution not only significantly enhances the robustness of the system, but also effectively ensures the security of the data; more importantly, while ensuring that key command operations are not affected, the abnormal power outage processing process is optimized through synchronous processing of software and hardware, further improving the overall performance and stability of the system.
[0098] The technical solution provided in the embodiment of the present application adopts intelligent channel allocation logic. According to the type of command, commands with shorter execution time are intelligently allocated to the high channel first, while commands with longer execution time are automatically guided to the low channel, effectively avoiding potential blocking of fast commands on the high channel and ensuring balanced allocation and efficient utilization of system resources.
[0099] Embodiment 2
[0100] The present application embodiment provides a method for processing abnormal power failure data, such as Figure 3 As shown, the method includes:
[0101] Step S01, obtaining a power supply voltage value;
[0102] In response to the power supply voltage value being less than the first voltage threshold, the system sends an abnormal power-off signal.
[0103] Specifically, according to the characteristics of the NAND memory chip, the present application sets reasonable voltage thresholds and time thresholds, which ensure that when the power system is abnormally powered off, the NAND memory chip can complete all necessary operations within this threshold range, thereby minimizing data loss.
[0104] The present application monitors the power supply voltage value in real time through a voltage detection circuit. When the voltage value is detected to be less than a set voltage threshold (for example, 3V), the voltage detection circuit will issue an abnormal interrupt signal to trigger subsequent processing procedures.
[0105] When the interrupt processing module receives the abnormal power-off interrupt signal sent by the voltage detection circuit, it will immediately respond to this critical event. In order to ensure the stability of the system and the integrity of the data, the interrupt processing module will first perform a series of fast and accurate judgments and operations. After confirming that the received signal is an abnormal power-off interrupt signal, the interrupt processing module will immediately mark the abnormal power-off signal as 1, indicating that the system has entered the abnormal power-off processing flow. The change of this signal is not only a clear indication of the internal state of the system, but also provides a clear trigger signal for subsequent command processing, resource release, and data protection processes.
[0106] Step S02, setting a valid flag value for each command, wherein the command includes a write command, a non-aligned read command, a normal read command, a voltage-adjusted read command, and an erase command;
[0107] The setting of the valid flag value of each command includes:
[0108] Setting the valid flag value of the write command and the non-aligned read command to a first preset value;
[0109] The valid flag values of the common read command, the voltage adjustment read command and the erase command are set to a second preset value.
[0110] Specifically, write command: Write command is crucial to data security. Therefore, regardless of whether suspend is supported (NFC is an important function when processing mixed read and write. For write commands that support suspend, if there are processable read commands at the same time, suspend writing first, and then process the write command after completing the processing of the read command, which can improve the real-time performance of the read operation), the valid flag values (Flush valid flag value) of all write commands are set to 0. This setting ensures that even in the event of an abnormal power outage, the write command will not be actively cleared by the system, thereby ensuring that the command can be sent to the NAND storage chip normally and the data is completely written. In addition, because the time required for writing is too long compared to the reading time, the NFC low channel (low-speed channel path) is selected.
[0111] Unaligned read command: Unaligned read command has high requirements on data integrity. Therefore, the Flush valid flag value of the unaligned read command is also set to 0. This setting ensures that the unaligned command will not be cleared by the system even in the case of abnormal power failure, thereby ensuring that complete data can be read; unaligned read execution time is short, and the high channel is selected.
[0112] Frt read and normal read commands: Compared with other types of commands, normal read commands have relatively low requirements on data security. Therefore, the Flush valid flag value of these commands is set to 1 so that they can be cleared by the system after an abnormal power failure, thereby releasing system resources and shortening the time required for abnormal power failure processing. Frt read and normal read commands have short execution times and select the high channel.
[0113] Erase command: The data security requirements of the erase command are relatively low. Therefore, the Flush validflag value of these commands is set to 1 so that they can be cleared by the system after an abnormal power failure, thereby freeing up system resources and shortening the time required for abnormal power failure processing; the erase command execution time is long, and the low channel is selected.
[0114] Step S03, as Figure 4 As shown, the valid flag value of each command is obtained, the abnormal power-off data is classified and processed according to the valid flag value of each command, and the abnormal power-off signal and the abnormal power-off data are synchronized to the flash memory controller.
[0115] Step S03 also includes:
[0116] Step S031, when the effective flag value of the command is set to a first preset value, the command whose effective flag value is the first preset value is retained by the system during abnormal power failure;
[0117] When the effective flag value of the command is set to the second preset value, the command whose effective flag value is the second preset value is cleared by the system in the event of abnormal power failure.
[0118] Specifically, during command processing, the command is marked according to the command classification processing mechanism, and the interrupt signal is detected in real time; if the interrupt signal is 1, the command in the buff is checked. For commands with a Flush valid flag value of 1 (i.e., Frt read, normal read command, and erase command), the system clears it from the buff and records the interrupt time. At the same time, the system sets the NFC flush register to 1 and synchronizes the interrupt signal to the flash controller.
[0119] It can be understood that the command processing module performs the following operations for FTL commands through the command classification processing mechanism: marking the valid flag value that can be cleared (Flush), setting the corresponding valid flag value to 0 for write operations and non-aligned read operations; for other types of commands, the valid flag value is set to 1; then, the module will convert these FTL commands into NFC commands, send the read command from the high channel to the NFC module, and send the erase command from the low channel to the NFC module for further processing.
[0120] Step S04, in response to the abnormal power-off data being sent to the flash memory controller failing, saving the unprocessed commands to the system cache area;
[0121] Screening unprocessed commands in the buffer area;
[0122] The filtering of the unprocessed commands in the buffer area includes:
[0123] When the effective flag value of the command is set to a second preset value, the command whose effective flag value is the second preset value is cleared by the system;
[0124] The register flag value of the flash memory controller is set to a fifth preset value, and the abnormal power-off signal is synchronized to the flash memory controller.
[0125] Specifically, when the NFC module cannot respond to these commands immediately due to high load, the command sending will fail. At this time, the system will start the automatic caching mechanism to temporarily store these unprocessed commands in the system cache area; in addition, the system will continue to monitor the status of the abnormal interrupt signal. Once the value of the abnormal interrupt signal is detected to be 1, the system will filter and process the commands in the cache according to the current value of "Flush valid flag": clear all commands with the value of "Flush validflag" being 1, and at the same time set the NFC module high / low channel register flag value to 1 (the fifth preset value) to ensure that the abnormal interrupt signal can be sensed and processed synchronously by the NFC module in a timely manner.
[0126] Step S05: Processing the abnormal power-off data by the flash memory controller.
[0127] Specifically, the NFC module is an indispensable part of the system and is specifically responsible for performing read, write and erase operations of the NAND memory. During normal operation, it can accurately perform read, write and erase operations of the NAND according to system instructions to ensure data integrity and system reliability. However, when the system detects a potential risk of abnormal power failure, the NFC module will take special measures to ensure data security and system stability.
[0128] Specifically, when the flush register flag value of the NFC module is set to 1 by the system, it indicates that the system has started the exception handling process. The NFC module will immediately respond to this signal and start its flush function execution module. During the flush process, the NFC module identifies and clears specific commands with a valid tag value of 1 in the internal buffer, while retaining and continuing to execute other normal commands (write commands, unaligned read commands).
[0129] Here, while ensuring that key command operations are not affected, the abnormal power outage processing process is optimized through synchronous processing of software and hardware, further improving the overall performance and stability of the system and improving the efficiency of abnormal power outage data processing.
[0130] Step S05 also includes:
[0131] Step S051, in response to the valid flag value of the command being a first preset value, allocating a channel path to each command through the flash memory controller, and performing timeout and clearing processing on abnormal power-off data according to the channel path type of each command;
[0132] like Figure 5 As shown, in response to the effective flag value of the command being the second preset value, the command whose effective flag value is the second preset value is cleared by the system.
[0133] Specifically, when the NFC module flush register flag value is set to 1, the NFC module executes the flush function, that is, the command with the Flush valid flag value of 1 is cleared in the command entering the NFC module, thereby reducing the power-off time, and the cleared command immediately returns the flush flag.
[0134] Step S052, when the command is a write command, a low-speed channel path is allocated to the write command;
[0135] When the command is a non-aligned read command, a high-speed channel path is allocated to the non-aligned read command.
[0136] Step S053, as Figure 6 As shown, timeout processing is performed on abnormal power-off data through the channel path type of each command;
[0137] Clearing abnormal power-off data according to the command ID tag value type of each command;
[0138] The timeout processing of abnormal power-off data by the channel path type of each command includes:
[0139] In response to the command execution time of the high-speed channel path being greater than a first preset time value, reallocating the command from the high-speed channel path to the low-speed channel path, and processing the command through the flash memory controller;
[0140] In response to the command execution time of the low-speed channel path being greater than a first preset time value, reallocating the command from the low-speed channel path to the high-speed channel path, and processing the command through the flash memory controller;
[0141] In response to the command execution time of the high-speed channel path and the low-speed channel path being greater than a first preset time value, resetting the flash memory controller and reprocessing the unprocessed commands through the flash memory controller;
[0142] The clearing process of abnormal power-off data by using the command ID tag value type of each command includes:
[0143] Set the command ID tag value of each command;
[0144] The step of setting the command ID tag value of each command includes:
[0145] When the command is input into any channel path for processing, the command ID tag value of the command is set to a third preset value;
[0146] When the command outputs the execution result of the command after being processed by any channel path, the command ID tag value of the command is set to a fourth preset value;
[0147] In response to the command ID tag value of the command being a third preset value (1), the command whose command ID tag value is the third preset value is reserved by the system;
[0148] In response to the command ID tag value of the command being the fourth preset value (0), the command whose command ID tag value is the fourth preset value is cleared by the system.
[0149] Specifically, abnormal power failure processing: In the event of an abnormal power failure, the system only performs special processing on commands that do not support flush operations (write, unaligned read) to ensure the consistency and integrity of key data.
[0150] The first preset time value may be 5 ms, the third preset value may be 1, and the fourth preset value may be 0.
[0151] It is understandable that during the command processing, an efficient exception management mechanism is adopted for the commands of the high channel and the low channel: First, the commands of these two channels are placed in the controller list in an orderly manner. When encountering an abnormal situation, that is, the command of a certain channel fails to be successfully executed for a long time, the system will adopt the following strategy:
[0152] If the command in the high channel fails to be executed successfully for a long time, the command will be rerouted to the low channel and executed through the NFC module. This step is to use the backup channel to try to complete the operation and improve the success rate of command execution.
[0153] If the command in the low channel also fails to execute for a long time, the system will try to reroute the command to the High channel and execute it again through the NFC module to deal with possible temporary failures.
[0154] If the commands of both high and low channels are not successfully executed for a long time, the system will perform an NFC reset operation to restore the normal state of the NFC device. After the reset is completed, all pending commands will be resent to the NFC module to try to restore the operation.
[0155] Here, in order to avoid repeated processing of commands and error feedback, the system uses a command ID array to track each command in exception processing. When a command is sent to any channel path, its command ID is recorded in the array and marked as "processing" (for example, the command ID tag value is 1); once a channel path returns the execution result of the command, the system will check the command ID tag value of the command ID: if the command ID tag value is "processing" (that is, 1), then its command ID tag value will be changed to "processed" (for example, to 0), and the result will be returned to the FTL layer.
[0156] If the same command ID is received again in the future and the command ID tag value is "processed" (i.e. 0), the system will delete the command from the array to avoid unnecessary resource usage.
[0157] This design ensures the uniqueness of command processing and accurate feedback of results, while improving the stability and reliability of the system.
[0158] Step S06, recording the number of normal read commands, voltage adjustment read commands and erase commands cleared by the system;
[0159] When the abnormal power-off time reaches a second preset time value (10ms, set according to the capacitor parameter), the unprocessed commands in the cache area and the flash memory controller are recorded, and the abnormal power-off data is optimized according to the unprocessed commands in the cache area and the flash memory controller;
[0160] The optimizing process of abnormal power-off data according to the cache area and the unprocessed commands in the flash memory controller includes:
[0161] Writing all data processing commands into a log file, storing the log file in a non-volatile memory, and recovering unprocessed commands by checking the log file;
[0162] Reduce the amount of data synchronized to the flash controller, manage the flash controller data interaction process through a state machine, and set retry logic for abnormal power-off signals and abnormal power-off data synchronization to the flash controller;
[0163] The integrity of data transmission commands is checked through a cyclic redundancy check mechanism;
[0164] Simulate various abnormal power outage situations and perform robustness tests on the abnormal power outage data processing results according to the first time threshold cycle interval.
[0165] Specifically, by detecting the flush flag value and recording the number of commands cleared, after an abnormal power failure occurs, once the preset time threshold is reached, the system will immediately capture and record the commands that have not yet been executed in the buffer, while ensuring that the commands that have not yet been processed in the NFC module are also fully recorded, thereby providing key data support for subsequent system analysis and performance optimization.
[0166] The optimizing process of abnormal power-off data according to the cache area and the unprocessed commands in the flash memory controller includes:
[0167] Ensure that all data operations are completed through transactions. The operations performed in the transaction are either completed in full or no part is performed. This approach ensures that data consistency and integrity can be guaranteed even in unexpected situations such as power outages.
[0168] Before performing critical operations, log files should be written and stored in non-volatile memory. Once the system is restored, unfinished transactions can be recovered or the status of completed transactions can be confirmed by checking the logs.
[0169] Minimize the amount of data in NFC module interactions to reduce the risk of data transmission interruption due to power outages.
[0170] A state machine is used to manage the various steps in the NFC interaction process, and even if power is lost at some stage, it can be restored from the most recently saved state.
[0171] Design retry logic for NFC module operations so that communication can be automatically retried if it fails.
[0172] Add power-off protection circuits at the hardware level, such as using an uninterruptible power supply or battery backup to prevent the impact of sudden power outages.
[0173] Use a cyclic redundancy check (CRC) or other error detection mechanism to verify the integrity of the data.
[0174] Develop a recovery strategy that automatically identifies and repairs corrupted data when the system restarts.
[0175] Regular robustness testing is performed to simulate various abnormal situations (including power outages) to ensure that the system can respond and recover correctly.
[0176] Through the comprehensive application of the above methods, the negative impact of abnormal power outages can be reduced to a great extent, and the stability and reliability of the system can be improved.
[0177] This application proposes a command classification processing mechanism, which makes a detailed distinction between the various command types in NAND flash memory operations, and accordingly makes a refined control design for the high / low channel allocation of commands in NFC and the execution of flush operations. This classification processing method can ensure that critical data operations (such as write commands and unaligned read commands) can be executed normally in the event of an abnormal power outage, while optimizing the processing flow of non-critical commands and improving the overall performance and stability of the system;
[0178] This mechanism also uses intelligent channel allocation logic. The system will intelligently allocate commands with shorter execution time to the high channel based on the type of command, and automatically guide commands with longer execution time to the low channel for execution, effectively avoiding the potential blocking of fast commands on the high channel by these time-consuming operations, and ensuring the balanced allocation and efficient use of system resources.
[0179] In the case of abnormal power failure, the system can process the cached commands according to the valid flag value of "Flush valid flag". In particular, for non-critical commands (such as other read commands and erase commands), the system can not only clear them from the driver cache and synchronously execute the flush function to the NFC module, but also clear them from the high / low channel cache of the hardware, thereby reducing the power-off time and optimizing the abnormal power failure processing process;
[0180] During the command processing, an efficient exception management mechanism is adopted for the commands of the high channel and the low channel. When encountering an abnormal situation, that is, the command of a certain channel fails to be successfully executed for a long time, it can be executed through another channel, thereby improving the stability and reliability of the system. By means of array marking, the uniqueness of command processing and accurate feedback of results are ensured.
[0181] This application also has a recording function, which can record the number of commands that have been cleared, and when the preset time threshold is reached after an abnormal power failure event occurs, record the commands that have not been executed in the buffer and the NFC module. These records provide key data support for subsequent system analysis and performance optimization.
[0182] In addition, the method for abnormal power failure data processing includes:
[0183] Single-bit errors that occur during data reading are detected by building error correction codes into NAND flash memory;
[0184] Add extra redundant information when writing data to recover data after power failure;
[0185] Use wear leveling and bad block management techniques to evenly distribute data across healthy blocks;
[0186] Integrate supercapacitors or small batteries inside the device to provide power when data processing is abnormally powered off;
[0187] Establish a mapping relationship between logical addresses and physical addresses at the FTL layer to recover data after an abnormal power outage;
[0188] Use the fsck tool to regularly check the health status of the file system and repair damaged data;
[0189] Use redundant array technology to provide additional data protection for abnormal power failures; regularly back up important data;
[0190] Backup storage devices with built-in power-off protection mechanisms;
[0191] A power supply monitoring circuit is provided, and when the power supply monitoring circuit detects that a power outage is imminent, the abnormal power outage data is restored through the controller;
[0192] In the case of data corruption caused by power outage, if there is not enough redundant data or power outage protection mechanism, professional data recovery services are required to recover the data. In actual applications, these methods are usually used in combination to achieve the best data protection effect.
[0193] The method for abnormal power failure data processing provided in the embodiment of the present application can also be improved and optimized without departing from the technical solution of the present application, and these improvements and optimizations should also be regarded as the protection scope of the present application.
[0194] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0195] The technical solution system provided in the embodiment of the present application can quickly release resources and shorten the power-off time when facing an abnormal power outage, thereby reducing the risk of data loss; the technical solution not only significantly enhances the robustness of the system, but also effectively ensures the security of the data; more importantly, while ensuring that key command operations are not affected, the abnormal power outage processing process is optimized through synchronous processing of software and hardware, further improving the overall performance and stability of the system and improving the efficiency of abnormal power outage data processing.
[0196] The technical solution provided in the embodiment of the present application adopts intelligent channel allocation logic. According to the type of command, commands with shorter execution time are intelligently allocated to the high channel first, while commands with longer execution time are automatically guided to the low channel, effectively avoiding potential blocking of fast commands on the high channel and ensuring balanced allocation and efficient utilization of system resources.
[0197] Embodiment 3
[0198] The present application provides an abnormal power failure data processing device, such as Figure 7 As shown, the device includes a setting module, an acquisition module, a first processing module, a cache processing module, a second processing module, and a recording module.
[0199] In this embodiment, the acquisition module is used to obtain the power supply voltage value;
[0200] A first processing module, configured to respond to the power supply voltage value being less than a first voltage threshold, and the system sending an abnormal power-off signal, obtaining a valid flag value of each command, and classifying and processing the abnormal power-off data according to the valid flag value of each command;
[0201] A second processing module, used for synchronizing the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processing the abnormal power-off data through the flash memory controller;
[0202] In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command;
[0203] In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared by the system.
[0204] In one of the embodiments, a setting module is used to set a valid flag value for each command, wherein the command includes a write command, a non-aligned read command, a normal read command, a voltage adjustment read command, and an erase command;
[0205] The setting of the valid flag value of each command includes:
[0206] Setting the valid flag value of the write command and the non-aligned read command to a first preset value;
[0207] The valid flag values of the common read command, the voltage adjustment read command and the erase command are set to a second preset value.
[0208] In one of the embodiments, the first processing module is used to, when the effective flag value of the command is set to the first preset value, reserve the command with the effective flag value of the first preset value through the system in the event of abnormal power failure;
[0209] When the effective flag value of the command is set to the second preset value, the command whose effective flag value is the second preset value is cleared by the system in the event of abnormal power failure.
[0210] In one embodiment, the second processing module is used to allocate a low-speed channel path to the write command when the command is a write command;
[0211] When the command is a non-aligned read command, a high-speed channel path is allocated to the non-aligned read command.
[0212] In one of the embodiments, the second processing module is used to perform timeout processing on abnormal power-off data through the channel path type of each command;
[0213] Clearing abnormal power-off data according to the command ID tag value type of each command;
[0214] The timeout processing of abnormal power-off data by the channel path type of each command includes:
[0215] In response to the command execution time of the high-speed channel path being greater than a first preset time value, reallocating the command from the high-speed channel path to the low-speed channel path, and processing the command through the flash memory controller;
[0216] In response to the command execution time of the low-speed channel path being greater than a first preset time value, reallocating the command from the low-speed channel path to the high-speed channel path, and processing the command through the flash memory controller;
[0217] In response to the command execution time of the high-speed channel path and the low-speed channel path being greater than a first preset time value, resetting the flash memory controller and reprocessing the unprocessed commands through the flash memory controller;
[0218] The clearing process of abnormal power-off data by using the command ID tag value type of each command includes:
[0219] Set the command ID tag value of each command;
[0220] The step of setting the command ID tag value of each command includes:
[0221] When the command is input into any channel path for processing, the command ID tag value of the command is set to a third preset value;
[0222] When the command outputs the execution result of the command after being processed by any channel path, the command ID tag value of the command is set to a fourth preset value;
[0223] In response to the command ID tag value of the command being a third preset value, the command having the command ID tag value being the third preset value is reserved by the system;
[0224] In response to the command ID tag value of the command being the fourth preset value, the command whose command ID tag value is the fourth preset value is cleared through the system.
[0225] In one of the embodiments, the cache processing module is used to save the unprocessed commands to the system cache area in response to the abnormal power failure data being sent to the flash memory controller failing;
[0226] Screening unprocessed commands in the buffer area;
[0227] The filtering of the unprocessed commands in the buffer area includes:
[0228] When the effective flag value of the command is set to a second preset value, the command whose effective flag value is the second preset value is cleared by the system;
[0229] The register flag value of the flash memory controller is set to a fifth preset value, and the abnormal power-off signal is synchronized to the flash memory controller.
[0230] In one of the embodiments, a recording module is used to record the number of normal read commands, regulated voltage read commands, and erase commands cleared by the system;
[0231] When the abnormal power-off time reaches a second preset time value, unprocessed commands in the cache area and the flash memory controller are recorded, and the abnormal power-off data is optimized according to the unprocessed commands in the cache area and the flash memory controller;
[0232] The optimizing process of abnormal power-off data according to the cache area and the unprocessed commands in the flash memory controller includes:
[0233] Writing all data processing commands into a log file, storing the log file in a non-volatile memory, and recovering unprocessed commands by checking the log file;
[0234] Reduce the amount of data synchronized to the flash controller, manage the flash controller data interaction process through a state machine, and set retry logic for abnormal power-off signals and abnormal power-off data synchronization to the flash controller;
[0235] The integrity of data transmission commands is checked through a cyclic redundancy check mechanism;
[0236] Simulate various abnormal power outage situations and perform robustness tests on the abnormal power outage data processing results according to the first time threshold cycle interval.
[0237] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0238] This application can greatly improve the reliability of data processing in the event of an abnormal power outage on the solid-state drive, providing users with a more robust and secure storage experience.
[0239] The technical solution system provided in the embodiment of the present application can quickly release resources and shorten the power-off time when facing an abnormal power outage, thereby reducing the risk of data loss; the technical solution not only significantly enhances the robustness of the system, but also effectively ensures the security of the data; more importantly, while ensuring that key command operations are not affected, the abnormal power outage processing process is optimized through synchronous processing of software and hardware, further improving the overall performance and stability of the system.
[0240] The technical solution provided in the embodiment of the present application adopts intelligent channel allocation logic. According to the type of command, commands with shorter execution time are intelligently allocated to the high channel first, while commands with longer execution time are automatically guided to the low channel, effectively avoiding potential blocking of fast commands on the high channel and ensuring balanced allocation and efficient utilization of system resources.
[0241] Embodiment 4
[0242] The present invention also provides an abnormal power failure data processing device, comprising:
[0243] one or more processors;
[0244] A storage device for storing one or more programs;
[0245] When the one or more programs are executed by the one or more processors, the one or more processors execute the abnormal power-off data processing method described below:
[0246] Get the power supply voltage value;
[0247] In response to the power supply voltage value being less than a first voltage threshold, the system sends an abnormal power-off signal, obtains valid flag values of each command, classifies and processes abnormal power-off data according to the valid flag values of each command, and synchronizes the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processes the abnormal power-off data through the flash memory controller;
[0248] The processing of abnormal power-off data by the flash memory controller includes:
[0249] In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command;
[0250] In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared by the system.
[0251] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0252] This application can greatly improve the reliability of data processing in the event of an abnormal power outage on the solid-state drive, providing users with a more robust and secure storage experience.
[0253] The technical solution system provided in the embodiment of the present application can quickly release resources and shorten the power-off time when facing an abnormal power outage, thereby reducing the risk of data loss; the technical solution not only significantly enhances the robustness of the system, but also effectively ensures the security of the data; more importantly, while ensuring that key command operations are not affected, the abnormal power outage processing process is optimized through synchronous processing of software and hardware, further improving the overall performance and stability of the system.
[0254] Embodiment 5
[0255] The present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following abnormal power-off data processing method can be executed:
[0256] Get the power supply voltage value;
[0257] In response to the power supply voltage value being less than a first voltage threshold, the system sends an abnormal power-off signal, obtains valid flag values of each command, classifies and processes abnormal power-off data according to the valid flag values of each command, and synchronizes the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processes the abnormal power-off data through the flash memory controller;
[0258] The processing of abnormal power-off data by the flash memory controller includes:
[0259] In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command;
[0260] In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared by the system.
[0261] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0262] This application can greatly improve the reliability of data processing in the event of an abnormal power outage on the solid-state drive, providing users with a more robust and secure storage experience.
[0263] The technical solution system provided in the embodiment of the present application can quickly release resources and shorten the power-off time when facing an abnormal power outage, thereby reducing the risk of data loss; the technical solution not only significantly enhances the robustness of the system, but also effectively ensures the security of the data; more importantly, while ensuring that key command operations are not affected, the abnormal power outage processing process is optimized through synchronous processing of software and hardware, further improving the overall performance and stability of the system.
[0264] Embodiment 6
[0265] The present application also provides a computer program product, including a computer program, which, when executed by a processor, can implement the following abnormal power-off data processing method:
[0266] Get the power supply voltage value;
[0267] In response to the power supply voltage value being less than a first voltage threshold, the system sends an abnormal power-off signal, obtains valid flag values of each command, classifies and processes abnormal power-off data according to the valid flag values of each command, and synchronizes the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processes the abnormal power-off data through the flash memory controller;
[0268] The processing of abnormal power-off data by the flash memory controller includes:
[0269] In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command;
[0270] In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared by the system.
[0271] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0272] This application can greatly improve the reliability of data processing in the event of an abnormal power outage on the solid-state drive, providing users with a more robust and secure storage experience.
[0273] The technical solution system provided in the embodiment of the present application can quickly release resources and shorten the power-off time when facing an abnormal power outage, thereby reducing the risk of data loss; the technical solution not only significantly enhances the robustness of the system, but also effectively ensures the security of the data; more importantly, while ensuring that key command operations are not affected, the abnormal power outage processing process is optimized through synchronous processing of software and hardware, further improving the overall performance and stability of the system.
[0274] Embodiment 7
[0275] The present application provides a computer storage medium, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0276] Get the power supply voltage value;
[0277] In response to the power supply voltage value being less than a first voltage threshold, the system sends an abnormal power-off signal, obtains valid flag values of each command, classifies and processes abnormal power-off data according to the valid flag values of each command, and synchronizes the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processes the abnormal power-off data through the flash memory controller;
[0278] The processing of abnormal power-off data by the flash memory controller includes:
[0279] In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command;
[0280] In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared by the system.
[0281] In one embodiment, obtaining the valid flag value of each command, before classifying the data according to the valid flag value of each command, includes:
[0282] Setting a valid flag value for each command, wherein the command includes a write command, a non-aligned read command, a normal read command, a voltage-adjusted read command, and an erase command;
[0283] The setting of the valid flag value of each command includes:
[0284] Setting the valid flag value of the write command and the non-aligned read command to a first preset value;
[0285] The valid flag values of the common read command, the voltage adjustment read command and the erase command are set to a second preset value.
[0286] In one embodiment, the classifying and processing the abnormal power-off data according to the valid flag value of each command includes:
[0287] When the effective flag value of the command is set to the first preset value, the command whose effective flag value is the first preset value is retained by the system in the event of abnormal power failure;
[0288] When the effective flag value of the command is set to the second preset value, the command whose effective flag value is the second preset value is cleared by the system in the event of abnormal power failure.
[0289] In one embodiment, allocating a channel path to each command by the flash memory controller includes:
[0290] When the command is a write command, a low-speed channel path is allocated to the write command;
[0291] When the command is a non-aligned read command, a high-speed channel path is allocated to the non-aligned read command.
[0292] In one embodiment, the timeout and clearing of abnormal power-off data by the channel path type of each command includes:
[0293] Performing timeout processing on abnormal power-off data through the channel path type of each command;
[0294] Clearing abnormal power-off data according to the command ID tag value type of each command;
[0295] The timeout processing of abnormal power-off data by the channel path type of each command includes:
[0296] In response to the command execution time of the high-speed channel path being greater than a first preset time value, reallocating the command from the high-speed channel path to the low-speed channel path, and processing the command through the flash memory controller;
[0297] In response to the command execution time of the low-speed channel path being greater than a first preset time value, reallocating the command from the low-speed channel path to the high-speed channel path, and processing the command through the flash memory controller;
[0298] In response to the command execution time of the high-speed channel path and the low-speed channel path being greater than a first preset time value, resetting the flash memory controller and reprocessing the unprocessed commands through the flash memory controller;
[0299] The clearing process of abnormal power-off data by using the command ID tag value type of each command includes:
[0300] Set the command ID tag value of each command;
[0301] The step of setting the command ID tag value of each command includes:
[0302] When the command is input into any channel path for processing, the command ID tag value of the command is set to a third preset value;
[0303] When the command outputs the execution result of the command after being processed by any channel path, the command ID tag value of the command is set to a fourth preset value;
[0304] In response to the command ID tag value of the command being a third preset value, the command having the command ID tag value being the third preset value is reserved by the system;
[0305] In response to the command ID tag value of the command being the fourth preset value, the command whose command ID tag value is the fourth preset value is cleared through the system.
[0306] In one embodiment, the system further includes a cache area, the flash memory controller includes a register, and before the flash memory controller processes the abnormal power-off data, the process includes:
[0307] In response to the abnormal power failure, when the data is sent to the flash memory controller and fails, the unprocessed commands are saved in the system buffer area;
[0308] Screening unprocessed commands in the buffer area;
[0309] The filtering of the unprocessed commands in the buffer area includes:
[0310] When the effective flag value of the command is set to a second preset value, the command whose effective flag value is the second preset value is cleared by the system;
[0311] The register flag value of the flash memory controller is set to a fifth preset value, and the abnormal power-off signal is synchronized to the flash memory controller.
[0312] In one embodiment, after the abnormal power-off data is processed by the flash memory controller, the following steps are included:
[0313] Record the number of normal read commands, regulated voltage read commands, and erase commands cleared through the system;
[0314] When the abnormal power-off time reaches a second preset time value, unprocessed commands in the cache area and the flash memory controller are recorded, and the abnormal power-off data is optimized according to the unprocessed commands in the cache area and the flash memory controller;
[0315] The optimizing process of abnormal power-off data according to the cache area and the unprocessed commands in the flash memory controller includes:
[0316] Writing all data processing commands into a log file, storing the log file in a non-volatile memory, and recovering unprocessed commands by checking the log file;
[0317] Reduce the amount of data synchronized to the flash controller, manage the flash controller data interaction process through a state machine, and set retry logic for abnormal power-off signals and abnormal power-off data synchronization to the flash controller;
[0318] The integrity of data transmission commands is checked through a cyclic redundancy check mechanism;
[0319] Simulate various abnormal power outage situations and perform robustness tests on the abnormal power outage data processing results according to the first time threshold cycle interval.
[0320] This application can greatly improve the reliability of data processing in the event of an abnormal power outage on the solid-state drive, providing users with a more robust and secure storage experience.
[0321] Figure 8 An exemplary system provided for Embodiment 7 of the present application that can be used to implement various embodiments described in the present application;
[0322] like Figure 8 As shown, in some embodiments, the system can be used as any of the above-mentioned devices for abnormal power failure data processing in each of the embodiments. In some embodiments, the system may include one or more computer-readable media (e.g., system memory or NVM / storage device) having results and one or more processors (e.g., (one or more) processors) coupled to the one or more computer-readable media and configured to execute the results to implement the module to perform the actions described in this application.
[0323] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0324] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0325] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for processing abnormal power failure data, characterized in that: The method is applied to an abnormal power-off data processing system, the system comprising a flash memory controller, and the method comprises: Get the power supply voltage value; In response to the power supply voltage value being less than a first voltage threshold, an abnormal power-off signal is sent and a valid flag value of each command is acquired; Classify and process the abnormal power-off data according to the valid flag values of each command, synchronize the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and process the abnormal power-off data through the flash memory controller; The processing of abnormal power-off data by the flash memory controller includes: In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command; In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared.
2. The abnormal power failure data processing method according to claim 1, characterized in that: The obtaining of the valid flag value of each command and before classifying and processing the data according to the valid flag value of each command comprises: Setting a valid flag value for each command, wherein the command includes a write command, a non-aligned read command, a normal read command, a voltage-adjusted read command, and an erase command; The setting of the valid flag value of each command includes: Setting the valid flag value of the write command and the non-aligned read command to a first preset value; The valid flag values of the common read command, the voltage adjustment read command and the erase command are set to a second preset value.
3. The abnormal power failure data processing method according to claim 1, characterized in that: The classifying and processing the abnormal power-off data according to the valid flag values of the respective commands includes: When the effective flag value of the command is set to the first preset value, the command whose effective flag value is the first preset value is retained by the system in the event of abnormal power failure; When the effective flag value of the command is set to the second preset value, the command whose effective flag value is the second preset value is cleared by the system in the event of abnormal power failure.
4. The abnormal power failure data processing method according to claim 2, characterized in that: The allocating a channel path to each command by the flash memory controller includes: When the command is a write command, a low-speed channel path is allocated to the write command; When the command is a non-aligned read command, a high-speed channel path is allocated to the non-aligned read command.
5. The abnormal power failure data processing method according to claim 4, characterized in that: The timeout and clearing processing of abnormal power-off data by the channel path type of each command includes: Performing timeout processing on abnormal power-off data through the channel path type of each command; Clearing abnormal power-off data according to the command ID tag value type of each command; The timeout processing of abnormal power-off data by the channel path type of each command includes: In response to the command execution time of the high-speed channel path being greater than a first preset time value, reallocating the command from the high-speed channel path to the low-speed channel path, and processing the command through the flash memory controller; In response to the command execution time of the low-speed channel path being greater than a first preset time value, reallocating the command from the low-speed channel path to the high-speed channel path, and processing the command through the flash memory controller; In response to the command execution time of the high-speed channel path and the low-speed channel path being greater than a first preset time value, resetting the flash memory controller and reprocessing the unprocessed commands through the flash memory controller; The clearing process of abnormal power-off data by using the command ID tag value type of each command includes: Set the command ID tag value of each command; The step of setting the command ID tag value of each command includes: When the command is input into any channel path for processing, the command ID tag value of the command is set to a third preset value; When the command outputs the execution result of the command after being processed by any channel path, the command ID tag value of the command is set to a fourth preset value; In response to the command ID tag value of the command being a third preset value, the command having the command ID tag value being the third preset value is reserved by the system; In response to the command ID tag value of the command being the fourth preset value, the command whose command ID tag value is the fourth preset value is cleared through the system.
6. The abnormal power failure data processing method according to claim 1, characterized in that: The system further includes a cache area, the flash memory controller includes a register, and before the flash memory controller processes the abnormal power-off data, the method includes: In response to the abnormal power failure, when the data is sent to the flash memory controller and fails, the unprocessed commands are saved in the system buffer area; Screening unprocessed commands in the buffer area; The filtering of the unprocessed commands in the buffer area includes: When the effective flag value of the command is set to a second preset value, the command whose effective flag value is the second preset value is cleared by the system; The register flag value of the flash memory controller is set to a fifth preset value, and the abnormal power-off signal is synchronized to the flash memory controller.
7. The abnormal power failure data processing method according to claim 1, characterized in that: After the abnormal power-off data is processed by the flash memory controller, the method includes: Record the number of normal read commands, regulated voltage read commands, and erase commands cleared through the system; When the abnormal power-off time reaches a second preset time value, unprocessed commands in the cache area and the flash memory controller are recorded, and the abnormal power-off data is optimized according to the unprocessed commands in the cache area and the flash memory controller; The optimizing process of abnormal power-off data according to the cache area and the unprocessed commands in the flash memory controller includes: Writing all data processing commands into a log file, storing the log file in a non-volatile memory, and recovering unprocessed commands by checking the log file; Reduce the amount of data synchronized to the flash controller, manage the flash controller data interaction process through a state machine, and set retry logic for abnormal power-off signals and abnormal power-off data synchronization to the flash controller; The integrity of data transmission commands is checked through a cyclic redundancy check mechanism; Simulate various abnormal power outage situations and perform robustness tests on the abnormal power outage data processing results according to the first time threshold cycle interval.
8. An abnormal power failure data processing device, characterized in that: The device is applied to an abnormal power-off data processing system, the system includes a flash memory controller, and the device includes: An acquisition module, used for acquiring a power supply voltage value; A first processing module, configured to send an abnormal power-off signal and obtain valid flag values of each command in response to the power supply voltage value being less than a first voltage threshold, and classify and process the abnormal power-off data according to the valid flag values of each command; A second processing module, used for synchronizing the abnormal power-off signal and the abnormal power-off data to the flash memory controller, and processing the abnormal power-off data through the flash memory controller; In response to the valid flag value of the command being a first preset value, the flash memory controller allocates a channel path to each command, and performs timeout and clearing processing on abnormal power-off data according to the channel path type of each command; In response to the valid flag value of the command being a second preset value, the command whose valid flag value is the second preset value is cleared.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the abnormal power failure data processing method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the abnormal power failure data processing method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Memory control method and storage device
CN122111905A
Memory control method and storage device
CN122111905B
