Power-down analysis method and system for power-down analysis system
By recording data streams during power outages using a pluggable and reusable second storage device, the problem of troubleshooting file system inconsistencies during power outages in embedded products is solved, enabling efficient and low-cost power outage analysis.
Patent Information
- Application Number
- CN202410597729.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-05-14
AI Technical Summary
In embedded products, file system inconsistencies caused by power outages are difficult to troubleshoot. Existing technical solutions increase hardware costs and complexity, and have low analysis efficiency.
A pluggable and reusable second storage device is used to record data streams during power outages. Through data acquisition, filtering, processing, and hierarchical classification and integration, the location of abnormal power outage data can be located, reducing hardware costs and improving analysis efficiency.
It can quickly and effectively locate abnormal data due to power failure, reduce the cost of power failure analysis, improve the analysis efficiency in power failure scenarios, and is suitable for power failure analysis of different storage devices.
Smart Images

Figure CN118609632B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer storage technology, and in particular to a power-down analysis method and a power-down analysis system. Background Technology
[0002] In embedded products, the main storage devices used are relatively inexpensive non-volatile storage such as NOR Flash, NAND Flash, and eMMC. Furthermore, hardware-based power-down analysis devices are too expensive to be widely adopted in embedded scenarios. These storage devices or their driver processing logic often experience abnormal conditions such as power outages, and after a restart following a power outage, the file system will show inconsistencies compared to before the power outage.
[0003] In related technologies, two main solutions address power loss issues. One solution involves using large capacitors and power loss detection devices to ensure power supply during power outages, guaranteeing accurate data storage. However, this increases hardware costs and design complexity, and it cannot track data inconsistencies caused by malfunctions of the large capacitors and power loss detection devices. The other approach is to back up the file system data log. After a power outage, the file system state is restored using the initial backup data or recorded data streams, thus protecting file system data consistency. However, this solution also increases hardware costs and design complexity, and it is difficult to troubleshoot anomalies in the underlying storage device during power outages. Therefore, in embedded products, troubleshooting file system inconsistencies caused by power outages is currently very difficult. It is hard to determine whether the problem originates in the file system or the underlying storage, and it is difficult to pinpoint the problem. Analysis requires significant resources and manpower, and the efficiency of troubleshooting power-loss anomalies is low. Summary of the Invention
[0004] This application aims to address at least one of the technical problems existing in the prior art.
[0005] Therefore, this application proposes a power failure analysis method and a power failure analysis system, which can record the data stream of power failure scenarios through a pluggable and reusable second storage device, quickly and effectively locate the location of abnormal power failure data, improve the efficiency of power failure analysis in power failure scenarios, and reduce the cost of power failure analysis.
[0006] In a first aspect, embodiments of this application provide a power-loss analysis method for a power-loss analysis system, the power-loss analysis system comprising: a pluggable first storage device and a second storage device; the first storage device comprising: a first storage medium and a data processing module; the data processing module comprising: a data acquisition module, a data filtering module, and a dispatch processing module; the second storage device comprising a second storage medium;
[0007] The method includes:
[0008] When the second storage device is connected to the first storage device which has lost power, the first storage device collects initial first power failure scenario data through the data acquisition module; the first power failure scenario data is filtered by the data filtering module based on preset filtering rules to obtain filtered second power failure scenario data; the second power failure scenario data is processed by the dispatch processing module to obtain a target data stream, and the target data stream is preferentially dispatched to the second storage device.
[0009] The second storage device performs hierarchical classification and integration of the target data stream according to a preset data format to obtain a power failure scenario data stream; and records the power failure scenario data stream in the second storage medium;
[0010] After power is restored and restarted, the second storage device retrieves the normal working data before the power failure from the first storage medium according to the address and length of the power failure scenario data stream; compares and analyzes the normal working data with the power failure scenario data stream to locate the location of the abnormal power failure data and complete the power failure analysis.
[0011] According to some embodiments of this application, the first storage device includes: a file system; the file system includes a storage block module and a storage driver module; the data acquisition module includes: a kernel tracing unit, a log cache unit, and a system data acquisition unit;
[0012] The first power failure scenario data includes: specific event data, log information, file system metadata, and file system data; the first storage device collects initial first power failure scenario data through the data acquisition module, including:
[0013] The kernel tracing unit collects specific event data from the storage block module and the storage driver module of the file system.
[0014] Log information from the first storage device is collected through the log caching unit;
[0015] The system data acquisition unit collects file system metadata and file system data.
[0016] According to some embodiments of this application, the step of filtering the first power failure scenario data based on preset filtering rules by the data filtering module to obtain the filtered second power failure scenario data includes:
[0017] The data filtering module determines the file system metadata and the file system data from the first power failure scenario data;
[0018] The file system operations in the file system metadata and the file system data are filtered to obtain the second power failure scenario data; wherein, the second power failure scenario data includes the filtered file system metadata and the file system data.
[0019] According to some embodiments of this application, the distribution processing module includes: an integration unit, a compression unit, and a first distribution unit;
[0020] The step of processing the second power failure scenario data through the dispatching processing module to obtain the target data stream includes:
[0021] The integration unit performs data integration processing on the second power failure scenario data to obtain the integrated initial data stream;
[0022] The compression unit compares the data volume of the integrated initial data stream with a preset data volume threshold to determine the target data stream; and sends the target data stream to the first dispatch unit.
[0023] The target data stream is preferentially sent to the second storage device through the first dispatch unit.
[0024] According to some embodiments of this application, determining the target data stream by comparing the data volume of the integrated initial data stream with a preset data volume threshold includes:
[0025] When the amount of data is greater than or equal to a preset data volume threshold, the integrated initial data stream is compressed to obtain the target data stream.
[0026] When the amount of data is less than the preset data amount threshold, the integrated initial data stream is determined as the target data stream.
[0027] According to some embodiments of this application, the power failure analysis system further includes: a pluggable connection module; the first storage device and the second storage device are connected via the pluggable connection module;
[0028] After completing the power-down analysis, the power-down analysis method further includes:
[0029] When the power failure analysis of the first storage device is completed and it is necessary to analyze the third storage device under the power failure scenario, the connection between the first storage device and the second storage device is disconnected by disconnecting the pluggable connection module.
[0030] The second storage device clears the power failure scenario data stream of the first storage device stored in the second storage medium; and connects to the third storage device through the pluggable connection module to perform power failure analysis on the third storage device.
[0031] Secondly, this application provides a power failure analysis system, including: a pluggable first storage device and a second storage device; the first storage device includes: a first storage medium and a data processing module; the data processing module includes: a data acquisition module, a data filtering module and a dispatch processing module; the second storage device includes a second storage medium;
[0032] The second storage device is used to connect to the first storage device when it is powered off in a power failure scenario;
[0033] The data acquisition module is used to: acquire initial data for the first power outage scenario;
[0034] The data filtering module is used to: filter the first power failure scenario data based on preset filtering rules to obtain the filtered second power failure scenario data; the dispatching processing module is used to: process the second power failure scenario data to obtain a target data stream, and dispatch the target data stream to the second storage device first.
[0035] The second storage device is used to: classify and integrate the target data stream according to a preset data format to obtain a power failure scenario data stream; record the power failure scenario data stream in the second storage medium; after power restoration and restart, retrieve the normal working data before the power failure from the first storage medium according to the address and length of the power failure scenario data stream; compare and analyze the normal working data with the power failure scenario data stream to locate the location of the abnormal power failure data and complete the power failure analysis.
[0036] According to some embodiments of this application, the first storage device includes: a file system; the file system includes a storage block module and a storage driver module; the data acquisition module includes: a kernel tracing unit, a log cache unit, and a system data acquisition unit; the first power failure scenario data includes: specific event data, log information, file system metadata, and file system data;
[0037] The kernel tracing unit is used to collect specific event data of the storage block module and the storage driver module of the file system;
[0038] The log caching unit is used to collect log information from the first storage device;
[0039] The system data acquisition unit is used to collect file system metadata and file system data.
[0040] According to some embodiments of this application, the distribution processing module includes: an integration unit, a compression unit, and a first distribution unit;
[0041] The integration unit is used to perform data integration processing on the second power failure scenario data to obtain an integrated initial data stream;
[0042] The compression unit is used to determine the target data stream by comparing the data volume of the integrated initial data stream with a preset data volume threshold; and to send the target data stream to the first dispatch unit.
[0043] The first dispatch unit is used to preferentially send the target data stream to the second storage device.
[0044] According to some embodiments of this application, the power failure analysis system further includes: a pluggable connection module; the first storage device and the second storage device are connected through the pluggable connection module; the pluggable connection module includes: a pluggable interface disposed on the second storage device; the pluggable interface is used for mating connection with the pluggable bus of the storage device under test in a power failure scenario.
[0045] This application embodiment includes: In a power failure analysis system, under a power failure scenario, when a first storage device experiences an abnormal power failure, a second storage device is connected to the power-failed first storage device; when the second storage device is connected to the power-failed first storage device, firstly, the first storage device collects initial first power failure scenario data through a data acquisition module; then, a data filtering module filters the first power failure scenario data based on preset filtering rules to obtain filtered second power failure scenario data; subsequently, a dispatch processing module processes the second power failure scenario data to obtain a target data stream, and prioritizes dispatching the target data stream to the second storage device; then, the second storage device performs hierarchical classification and integration of the target data stream according to a preset data format to obtain a power failure scenario data stream; and records the power failure scenario data stream in the second storage medium; thereby providing a basis for subsequent... This provides a data foundation for continued power-down analysis and debugging. After power restoration and restart, the second storage device retrieves the normal operating data from the first storage medium based on the address and length of the power-down scenario data stream. The normal operating data is compared and analyzed with the power-down scenario data stream to locate the location of abnormal power-down data, thus completing the power-down analysis. In this way, by using a pluggable and reusable second storage device to record the power-down scenario data stream of the first storage device after a power outage, and comparing and analyzing the power-down scenario data stream with the normal operating data, the location of abnormal power-down data can be quickly and effectively located, improving the efficiency of power-down anomaly analysis and debugging. Furthermore, the pluggable and reusable second storage device is highly versatile and can perform power-down analysis on different storage devices that have experienced power outages. Compared to non-pluggable embedded power-down analysis mechanisms, this saves hardware design and power-down analysis costs. In other words, this embodiment of the application can use a pluggable and reusable second storage device to record the power-down scenario data stream, quickly and effectively locate the location of abnormal power-down data, improve the efficiency of power-down analysis in power-down scenarios, and reduce power-down analysis costs. Attached Figure Description
[0046] Figure 1 This is a schematic diagram of the system architecture of a power-down analysis system for performing a power-down analysis method according to an embodiment of this application;
[0047] Figure 2 This is a schematic diagram of the structure of the first and second storage devices in a power failure analysis system provided in one embodiment of this application;
[0048] Figure 3 This is a schematic diagram of the specific structure of the data processing module in the first storage device provided in one embodiment of this application;
[0049] Figure 4 This is a schematic diagram of data flow within an embodiment of this application;
[0050] Figure 5This is a flowchart illustrating a power-down analysis method provided in one embodiment of this application;
[0051] Figure 6 This is a schematic diagram of the data format of a power-down scenario data stream stored in a second storage medium, provided in one embodiment of this application. Detailed Implementation
[0052] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0053] In the description of this invention, "several" means one or more, "multiple" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.
[0054] In the description of this invention, unless otherwise explicitly defined, terms such as "set up," "install," and "connect" should be interpreted broadly, and those skilled in the art can reasonably determine the specific meaning of the above terms in this invention in conjunction with the specific content of the technical solution.
[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0056] First, let me explain some of the terms used in this application:
[0057] File System: A file system is an essential component of an operating system. Currently, most file systems use traditional storage media such as hard drives, floppy disks, and optical discs. Data storage in any file system can be divided into two parts: the metadata area and the data storage area. The data storage area stores user-written data, while the metadata area manages the space allocation and control of the storage media (hard drives, floppy disks, optical discs, etc.), manages file attributes, and manages the file hierarchy.
[0058] Power failure: During the process of adding, deleting, and modifying files in the file system, multiple operations are required. These operations may target the data storage area or the metadata area. These different operations may be interrupted, which is called an abnormal power failure. An abnormal power failure may cause inconsistencies and errors in the file system.
[0059] Ftrace is a powerful tracing tool in the Linux kernel that can trace kernel function calls. Ftrace can dynamically trace function calls, execution times, and call relationships within the kernel without modifying the kernel source code. It is primarily used for performance analysis, debugging, and system optimization. Ftrace has three main functions: first, real-time tracing, which displays the call and execution status of kernel functions in real time; second, flexible filtering, allowing users to filter tracing information as needed, such as tracing only calls to specific modules or functions; and third, providing rich detailed information about function calls, including call time, duration, caller, and callee.
[0060] Logbuf is a buffer in the Linux kernel used to temporarily store kernel log information. When the kernel generates log information, this information is first written to Logbuf, and then the kernel's logging system periodically outputs this information to the system's log files. Logbuf buffers logs, temporarily storing kernel-generated log information for later processing; it also protects log data: in the event of a system crash, the log information in Logbuf can be used to analyze the problem, and because the data is stored in kernel space, it is not easily corrupted.
[0061] This application provides a power failure analysis method and system. The method includes: when a second storage device is connected to a first storage device that has lost power, the first storage device collects initial first power failure scenario data; filters the first power failure scenario data based on preset filtering rules to obtain second power failure scenario data; processes the second power failure scenario data to obtain a target data stream, and prioritizes dispatching the target data stream to the second storage device; the second storage device performs hierarchical classification and integration of the target data stream according to a preset data format to obtain and record the power failure scenario data stream, and after power restoration and restart, retrieves normal working data before the power failure from the first storage medium based on the power failure scenario data stream; compares and analyzes the normal working data and the power failure scenario data stream to locate the location of abnormal power failure data and complete the power failure analysis. This method can improve the efficiency of power failure analysis in power failure scenarios and reduce the cost of power failure analysis.
[0062] The embodiments of this application will be further described below with reference to the accompanying drawings.
[0063] like Figure 1As shown, this application provides a power failure analysis system 100, including: a pluggable first storage device 110 and a second storage device 120; the first storage device 110 includes: a first storage medium 111 and a data processing module 112; the data processing module 112 includes: a data acquisition module 1121, a data filtering module 1122 and a dispatch processing module 1123; the second storage device 120 includes a second storage medium 121; wherein, the second storage device 120 is used to connect to the power-failed first storage device 110 in a power failure scenario.
[0064] The data acquisition module 1121 is used to: acquire initial first power failure scenario data for the first storage device 110 that has lost power. Then, the first power failure scenario data is sent to the data filtering module 1122.
[0065] The data filtering module 1122 is used to: filter the first power failure scenario data based on preset filtering rules to obtain the filtered second power failure scenario data; and then send the filtered second power failure scenario data to the dispatch processing module 1123.
[0066] The dispatch processing module 1123 is used to: process the data of the second power failure scenario to obtain the target data stream, and dispatch the target data stream to the second storage device 120 with priority.
[0067] The second storage device 120 is also used to: perform hierarchical classification and integration of the target data stream according to a preset data format to obtain a power failure scenario data stream; record the power failure scenario data stream in the second storage medium 121; after power restoration and restart, retrieve the normal working data before power failure from the first storage medium 111 according to the address and length of the power failure scenario data stream; compare and analyze the normal working data with the power failure scenario data stream to locate the location of the abnormal power failure data and complete the power failure analysis.
[0068] Understandably, the data acquisition module 1121 can choose to record information such as Linux-supported Ftrace and kernel printing to the second storage medium according to the actual situation, or it can choose to record the debugging node information of each driver and record the data stored in the first storage medium.
[0069] According to some embodiments of this application, such as Figure 2 As shown, the power failure analysis system 100 further includes: a pluggable connection module 130; the first storage device 110 and the second storage device 120 are connected via the pluggable connection module 130; the pluggable connection module 130 includes: a pluggable interface 122 disposed on the second storage device 120; the pluggable interface 122 is used to connect to the pluggable bus of the storage device under test in a power failure scenario (e.g., ... Figure 2 The pluggable bus 113 of the first storage device 110 shown is matched and connected.
[0070] Understandably, power is required for both the first storage device 110 and the second storage device 120 to ensure their normal operation. The first storage device 110 includes a first power module 114, which provides power to the first storage device 110 and its data processing module 112, ensuring normal operation. The second storage device 120 includes a second power module 123, which provides power to the second storage device 120 and its second storage medium 121, ensuring normal operation.
[0071] It is understandable that the first storage device 110 is a normal mass production solution. The mass production hardware solution only needs to ensure that it has a power supply (i.e., the first power module 114), supports pluggable buses (such as USB and SD), and the first storage medium 111. The first storage medium 111 is the storage medium actually used in mass production. The software part of the first storage device 110 needs to support the data processing module 112 to perform data dispatching tasks on the second storage medium 121.
[0072] Understandably, the second storage device 120 needs to support an independent power supply (i.e., the second power module 123) to ensure the normal operation of the second storage medium 121, and to support pluggable interfaces such as USB / SD.
[0073] Understandably, the second storage device 120 is not required in the actual mass production solution. The second storage device 120 can be dynamically plugged in when the first storage device 110 needs to be debugged and troubleshooted. After the power failure analysis of the first storage device 110 is completed, the second storage device 120 is unplugged and the power failure scenario data stream of the first storage device 110 stored in the second storage medium 121 is cleared, so as to reuse the second storage medium 121. Subsequently, the second storage device 120 is connected to another power failure third storage device, and the second storage medium 121 is reused to perform power failure analysis on the third storage device.
[0074] According to some embodiments of this application, such as Figure 3 As shown, the data processing module 112 also includes: a file system 1124; the file system 1124 includes a storage block module and a storage driver module; the data acquisition module 1121 includes: a kernel tracing unit, a log cache unit, and a system data acquisition unit; the first power failure scenario data includes: specific event data, log information, file system metadata, and file system data.
[0075] Specifically, the kernel tracing unit is used to collect specific event data from the file system's storage block module and storage driver module.
[0076] Specifically, the log caching unit is used to collect log information from the first storage device.
[0077] Specifically, the system data acquisition unit is used to collect file system metadata and file system data.
[0078] It's important to note that the kernel tracing unit refers to Ftrace, and the log buffer unit refers to Logbuf. Ftrace is primarily used to trace and analyze kernel function calls, while Logbuf is used to store and manage kernel log information. Although both are related to system behavior tracing, they provide different tracing mechanisms.
[0079] According to some embodiments of this application, such as Figure 3 As shown, the dispatch processing module 1123 includes: an integration unit, a compression unit, and a first dispatch unit.
[0080] Specifically, the integration unit is used to integrate the data from the second power failure scenario to obtain the integrated initial data stream.
[0081] Specifically, the compression unit is used to determine the target data stream by comparing the data volume of the integrated initial data stream with a preset data volume threshold; and to send the target data stream to the first dispatch unit.
[0082] Specifically, the first dispatch unit is used to preferentially send the target data stream to the second storage device.
[0083] In one embodiment, the dispatch processing module 1123 further includes a second dispatch unit for receiving file system metadata and file system data sent via a pass-through method, and dispatching the file system metadata and file system data to the first storage medium, thereby ensuring that the workflow of the first storage device is not affected.
[0084] Combination Figure 4 This section provides further explanation of the data flow process in the data processing module. Figure 4 The solid lines represent the data flow at each level; the dashed lines represent the process of Ftrace / logbuf collecting key runtime information. The storage block module includes a first storage block unit and a second storage block unit; the storage driver module includes a first driver unit and a second driver unit; the first driver unit is communicatively connected to the first storage block unit, and the second driver unit is communicatively connected to the second storage block unit.
[0085] Ftrace can collect specific events from the file system's main storage block device and main storage driver; logbuf can collect log information. Ftrace and logbuf pass through each other to send the collected data to the dispatch processing module.
[0086] After the system data acquisition unit collects the file system metadata and file system data, the workflow of the file system on the first storage is also to pass through the file system metadata and file system data to the second dispatch unit (i.e., primary storage dispatch) to the first storage medium in a pass-through mode, so as to ensure that the workflow of the first storage device is not affected.
[0087] The dispatch processing module performs operations such as compression (optional) on the received data, and then directly records it to the first dispatch unit (i.e., the priority dispatch storage device). In use, the first dispatch unit is generally matched with the second storage device.
[0088] In scenarios where file system data verification is required on the primary storage, the data filtering module uses file system filtering operations to select and remove the necessary operation steps from the file system metadata and file system data, such as read, write, and erase behaviors.
[0089] The dispatch processing module integrates the received data, combining it into a data stream based on data operations, addresses, and data content. It also calculates and records the MD5 hash value of the data stream. After configuring and selecting data compression (optional), the data is sent to the first dispatch unit. The first dispatch unit then stores and records the data to the second storage device. When the same file system record needs to be dispatched to both the first and second dispatch units simultaneously, priority is given to dispatching data to the first dispatch unit first. However, priority is not required to write data to disk on the storage device. Dispatch by the second dispatch unit is performed in parallel. This leverages the performance difference between the two storage devices to ensure that the data stream recorded on the second and first storage devices is similar, without affecting data recording on the first storage medium.
[0090] It is important to emphasize that since the performance of the second storage device is far superior to that of the first storage device, and the second storage medium does not need to ensure that the data is written to disk before distributing the data to the first storage medium, all the operations here are pure software behaviors in the CPU->DDR process. These latency are negligible relative to the data recording performance of the first storage device and are not calculated.
[0091] The power failure analysis system 100 of this application embodiment can use a pluggable and reusable second storage device to record the data stream of the power failure scenario, quickly and effectively locate the location of the abnormal power failure data, improve the power failure analysis efficiency in the power failure scenario, and reduce the power failure analysis cost.
[0092] Furthermore, it should be emphasized that the pluggable and reusable second storage device provided in this application embodiment can be used on all Linux-based embedded platforms with pluggable interfaces.
[0093] It is understandable that non-pluggable hardware solutions in the prior art would significantly increase hardware design costs. In contrast, the second storage device provided in this application embodiment is pluggable, which can be reused in different mass production solutions without increasing the cost of the embedded solution. The prior art has the problem of not being able to reproduce mass production problems and not being able to provide more efficient material verification and debugging methods. The pluggable second storage device in this application embodiment can (1) reduce the verification cycle of flash used in embedded products such as NOR, NAND and eMMC, improve the efficiency of file system power failure scenario logic problem analysis; and improve the efficiency of troubleshooting file system data inconsistency types in mass production problems in embedded products, and increase the debugging methods for power failure scenario problems.
[0094] Those skilled in the art will understand that the system structure shown in the figures does not constitute a limitation on the embodiments of this application, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0095] It will be understood by those skilled in the art that the system architecture and application scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. It is known by those skilled in the art that with the evolution of system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0096] Based on the above system structure, various embodiments of the power failure analysis method of the power failure analysis system of this application are proposed below.
[0097] Firstly, such as Figure 5 As shown, this power-down analysis method can be applied to, for example... Figure 1 In the system framework shown, the power-down analysis system includes: a pluggable first storage device and a second storage device; the first storage device includes: a first storage medium and a data processing module; the data processing module includes: a data acquisition module, a data filtering module, and a dispatch processing module; the second storage device includes a second storage medium. This power-down analysis method may include, but is not limited to, steps S110 to S130.
[0098] Step S110: When the second storage device is connected to the first storage device that has lost power, the first storage device collects initial first power failure scenario data through the data acquisition module; the first power failure scenario data is filtered by the data filtering module based on preset filtering rules to obtain filtered second power failure scenario data; the second power failure scenario data is processed by the dispatch processing module to obtain the target data stream, and the target data stream is dispatched to the second storage device first.
[0099] Step S120: The second storage device performs hierarchical classification and integration of the target data stream according to the preset data format to obtain the power failure scenario data stream; and records the power failure scenario data stream in the second storage medium.
[0100] Step S130: After power restoration and restart, the second storage device retrieves the normal working data before the power failure from the first storage medium according to the address and length of the power failure scenario data stream; compares and analyzes the normal working data with the power failure scenario data stream to locate the location of the abnormal power failure data and complete the power failure analysis.
[0101] Specifically, the data for the first power outage scenario includes, but is not limited to: specific event data, log information, file system metadata, and file system data.
[0102] Understandably, when file system consistency issues arise due to power outages, a second, constantly powered storage device can be inserted before system startup to reproduce the problem (or, during material verification, the second storage medium can be directly inserted to verify the material's power-loss stability). During this process, data of interest can be written to the second storage device, recording the specific data flow during the power outage scenario. This allows for a quick differentiation between issues caused by power outages affecting the flash, flash driver, or file system logic, providing a low-cost power outage analysis method.
[0103] Understandably, a file system without logging functionality can write log content to the second storage device during the material verification phase. Furthermore, it leverages the performance difference and dispatch priority between the first and second storage devices to ensure the second storage device can completely record the solution file system data, and ensures the logs on the first storage device are correct and valid. It also integrates the file system pathways, recording the working status of the file system, block devices, and underlying storage through events such as Ftrace, enabling snapshots of the system during power outages.
[0104] Through steps S110 to S130, in the power failure analysis system, under a power failure scenario, when the first storage device experiences an abnormal power failure, the second storage device is connected to the first storage device that has lost power. When the second storage device is connected to the first storage device that has lost power, firstly, the first storage device collects initial first power failure scenario data through a data acquisition module; then, the first power failure scenario data is filtered based on preset filtering rules by a data filtering module to obtain filtered second power failure scenario data; subsequently, the second power failure scenario data is processed by a dispatch processing module to obtain a target data stream, and the target data stream is preferentially dispatched to the second storage device; then, the second storage device performs hierarchical classification and integration of the target data stream according to a preset data format to obtain a power failure scenario data stream; and the power failure scenario data stream is recorded in the second storage medium. This provides a data foundation for subsequent power-down analysis and debugging. After power restoration, the second storage device retrieves the normal operating data from the first storage medium based on the address and length of the power-down scenario data stream. The normal operating data is compared and analyzed with the power-down scenario data stream to locate the abnormal power-down data, thus completing the power-down analysis. In this way, by using a pluggable and reusable second storage device to record the power-down scenario data stream from the first storage device, and comparing and analyzing the power-down scenario data stream with the normal operating data, the location of abnormal power-down data can be quickly and effectively located, improving the efficiency of power-down anomaly analysis and debugging. Furthermore, the pluggable and reusable second storage device is highly versatile and can perform power-down analysis on different storage devices that have experienced power failures. Compared to non-pluggable embedded power-down analysis mechanisms, this saves hardware design and power-down analysis costs. In other words, this embodiment of the application can use a pluggable and reusable second storage device to record the power-down scenario data stream, quickly and effectively locating the location of abnormal power-down data, improving the efficiency of power-down analysis in power-down scenarios, and reducing power-down analysis costs.
[0105] According to some embodiments of this application, the first storage device includes: a file system; the file system includes a storage block module and a storage driver module; the data acquisition module includes: a kernel tracing unit, a log cache unit, and a system data acquisition unit; further describing step S110, wherein the first storage device acquires initial first power failure scenario data through the data acquisition module, including but not limited to:
[0106] The kernel tracing unit collects specific event data from the file system's storage block module and storage driver module.
[0107] Log information from the first storage device is collected through the log caching unit;
[0108] The system data acquisition unit collects file system metadata and file system data.
[0109] In this way, the first power failure scenario data was initially collected through the first storage device, laying the data foundation for subsequent processing.
[0110] According to some embodiments of this application, step S110 is further described, in which the data filtering module filters the first power failure scenario data based on preset filtering rules to obtain the filtered second power failure scenario data, including but not limited to steps S210 to S220.
[0111] Step S210: The data filtering module determines the file system metadata and file system data from the data of the first power failure scenario;
[0112] Step S220: Filter the file system operations in the file system metadata and file system data to obtain the second power failure scenario data; wherein, the second power failure scenario data includes the filtered file system metadata and file system data.
[0113] Specifically, in scenarios where file system data of the first storage device needs to be verified, the data filtering module performs file system operation filtering on file system metadata and file system data, selects the operation steps that need to be filtered, such as read, write, and erase behaviors, and filters the operation steps.
[0114] Through steps S210 to S220, the data filtering module filters the collected file system metadata and file system data according to data characteristics, thereby reducing the amount of data that the second storage medium needs to record, which helps to improve data analysis efficiency.
[0115] According to some embodiments of this application, the dispatch processing module includes: an integration unit, a compression unit, and a first dispatch unit. Further explanation of step S110: the dispatch processing module processes the second power failure scenario data to obtain a target data stream, including but not limited to steps S310 to S320.
[0116] Step S310: The data of the second power failure scenario is integrated and processed by the integration unit to obtain the integrated initial data stream.
[0117] Step S320: The compression unit compares the data volume of the integrated initial data stream with a preset data volume threshold to determine the target data stream; and sends the target data stream to the first dispatch unit.
[0118] Step S330: Send the target data stream to the second storage device preferentially through the first dispatch unit.
[0119] To further explain step S310, specifically, the integration unit integrates data operations, addresses, and data content into a data stream, and adds the calculation and recording of the MD5 value of the data stream.
[0120] According to some embodiments of this application, step S320, which determines the target data stream by comparing the data volume of the integrated initial data stream with a preset data volume threshold, includes: when the data volume is greater than or equal to the preset data volume threshold, compressing the integrated initial data stream to obtain the target data stream; when the data volume is less than the preset data volume threshold, determining the integrated initial data stream as the target data stream. Thus, compression processing can be optionally performed based on the data volume of the integrated initial data stream to facilitate recording smaller data volumes to the second storage device.
[0121] Through steps S310 to S320, the dispatch processing module implements optional compression operations, prioritizing the sending of the target data stream to the second storage device so that the second storage device can record the target data stream for subsequent storage and power-down analysis.
[0122] In some embodiments, the dispatch processing module further includes: a second dispatch unit; the second dispatch unit is used to receive file system metadata and file system data sent via a pass-through method, and dispatch the file system metadata and file system data to the first storage medium, thereby ensuring that the workflow of the first storage device is not affected.
[0123] In some embodiments, the dispatch processing module can determine whether to compress data and distinguish whether the data is dispatched to the first storage medium or to the second storage medium for recording. Specifically, the dispatch processing module writes data configured with Ftrace / logbuf, etc., to the second storage medium, and normally writes file system data and metadata to the first storage medium. If the backup of the first storage medium data is configured, the module simultaneously backs up the corresponding behavior of the first storage medium to the second storage medium.
[0124] According to some embodiments of this application, after step S110, the second storage device integrates and processes the received target data stream to obtain a power failure scenario data stream, and records the power failure scenario data stream in the second storage medium to lay a data foundation for data comparison and power failure analysis.
[0125] Specifically, step S120, which involves hierarchical classification and integration of the target data stream, includes: directly storing data collected by units such as Ftrace and Logbuf in the data section; and integrating file system metadata and file system data collected by the system data acquisition unit according to the method of operation + address + length + actual data; thus obtaining the power failure scenario data stream. The data format of the power failure scenario data stream is as follows: Figure 6As shown, the data format includes a header and a data portion. The header includes information such as a data stream identifier (magic), a type field, a compression field, and a length field. The data stream identifier (magic) is typically a special number or string used as a file or data stream identifier. The compression field indicates whether the data has been compressed, as well as the compression algorithm used and related compression parameters.
[0126] After the classification and integration in step S120, a power failure scenario data stream that can be used for power failure analysis is obtained, laying the data foundation for the power failure analysis in step S130.
[0127] Specifically, in step S130, after the first storage device restarts following a power outage, the second storage device can compare the abnormal data in the power outage data stream with the normal data from before the power outage, based on the address and length; it can then locate the inconsistencies and effectively pinpoint the problematic data. It should be noted that this location method can be verified through a data comparison module or through manual comparison.
[0128] According to some embodiments of this application, the power-down analysis system further includes: a pluggable connection module; the first storage device and the second storage device are connected via the pluggable connection module. After completing the power-down analysis, the power-down analysis method further includes:
[0129] When the power failure analysis of the first storage device is completed and the analysis of the third storage device under the power failure scenario is required, the connection between the first storage device and the second storage device is disconnected by disconnecting the pluggable connection module; the second storage device clears the power failure scenario data stream of the first storage device stored in the second storage medium; and the third storage device is connected through the pluggable connection module to perform power failure analysis on the third storage device.
[0130] It should be noted that the second storage device can only support power failure verification of one storage device at a time. When it is needed to perform verification on the second storage device, all data on the second storage device must be cleared first.
[0131] Understandably, after the second storage device completes the power-loss analysis of the first storage device following the power failure, the second storage device is disconnected. When it is necessary to perform power-loss analysis on the second storage device and another power-loss-affected third storage device, all power-loss scenario data streams from the first storage device stored on the second storage medium must be cleared to facilitate reuse of the second storage medium. Then, the second storage device is connected to the power-loss-affected third storage device to perform power-loss analysis on the third storage device.
[0132] Thus, the pluggable and reusable second storage device serves as an embedded pluggable power-down scenario data recording device, recording power-down scenario data of the storage device. The embodiments of this application provide an efficient means of debugging mass production problems and verifying materials in power-down scenarios without affecting mass production costs through the pluggable and reusable second storage device.
[0133] In summary, the power-down analysis system and method of this application have at least the following beneficial effects:
[0134] First, the second storage device can be used as a pluggable data storage device for power-down scenarios, and can be applied to power-down devices of different solutions for power-down analysis and debugging. It does not need to be fixed to the hardware solution, nor does it introduce complex hardware design to the power-down device, thus ensuring the low cost of the hardware solution.
[0135] Secondly, the second storage device can select different data streams (such as driver processing logic data, kernel-provided debugging information such as Ftrace, and file system processing logic machine data) for storage, which can better locate the problematic data in the flash hardware, driver logic, or system logic.
[0136] Third, the power failure analysis method filters and compresses recorded data, enabling the selection of key data for recording, reducing the amount of data recorded on the second storage device, and ensuring the data transmission efficiency of the second storage.
[0137] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the power-down analysis method described above.
[0138] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0139] The above provides a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.
Claims
1. A power failure analysis method for a power failure analysis system, characterized in that, The power failure analysis system includes: a pluggable first storage device and a second storage device; the first storage device includes: a first storage medium and a data processing module; the data processing module includes: a data acquisition module, a data filtering module and a dispatch processing module; the second storage device includes a second storage medium. The power failure analysis method includes: When the second storage device is connected to the first storage device which has lost power, the first storage device collects initial first power failure scenario data through the data acquisition module; the first power failure scenario data is filtered by the data filtering module based on preset filtering rules to obtain filtered second power failure scenario data; the second power failure scenario data is processed by the dispatch processing module to obtain a target data stream, and the target data stream is preferentially dispatched to the second storage device. The second storage device performs hierarchical classification and integration of the target data stream according to a preset data format to obtain a power failure scenario data stream; and records the power failure scenario data stream in the second storage medium; After power is restored and restarted, the second storage device retrieves the normal working data before the power failure from the first storage medium according to the address and length of the power failure scenario data stream; compares and analyzes the normal working data with the power failure scenario data stream to locate the location of the abnormal power failure data and complete the power failure analysis.
2. The power failure analysis method according to claim 1, characterized in that, The first storage device includes: a file system; the file system includes a storage block module and a storage driver module; the data acquisition module includes: a kernel tracing unit, a log cache unit, and a system data acquisition unit; The first power failure scenario data includes: specific event data, log information, file system metadata, and file system data; the first storage device collects initial first power failure scenario data through the data acquisition module, including: The kernel tracing unit collects specific event data from the storage block module and the storage driver module of the file system. Log information from the first storage device is collected through the log caching unit; The system data acquisition unit collects file system metadata and file system data.
3. The power failure analysis method according to claim 2, characterized in that, The step of filtering the first power failure scenario data based on preset filtering rules by the data filtering module to obtain the filtered second power failure scenario data includes: The data filtering module determines the file system metadata and the file system data from the first power failure scenario data; The file system operations in the file system metadata and the file system data are filtered to obtain the second power failure scenario data; wherein, the second power failure scenario data includes the filtered file system metadata and the file system data.
4. The power failure analysis method according to claim 1, characterized in that, The distribution processing module includes: an integration unit, a compression unit, and a first distribution unit; The step of processing the second power failure scenario data through the dispatching processing module to obtain the target data stream includes: The integration unit performs data integration processing on the second power failure scenario data to obtain the integrated initial data stream; The compression unit compares the data volume of the integrated initial data stream with a preset data volume threshold to determine the target data stream; and sends the target data stream to the first dispatch unit. The target data stream is preferentially sent to the second storage device through the first dispatch unit.
5. The power failure analysis method according to claim 4, characterized in that, The step of determining the target data stream by comparing the data volume of the integrated initial data stream with a preset data volume threshold includes: When the amount of data is greater than or equal to a preset data volume threshold, the integrated initial data stream is compressed to obtain the target data stream. When the amount of data is less than the preset data amount threshold, the integrated initial data stream is determined as the target data stream.
6. The power failure analysis method according to claim 1, characterized in that, The power failure analysis system further includes: a pluggable connection module; the first storage device and the second storage device are connected via the pluggable connection module; After completing the power-down analysis, the power-down analysis method further includes: When the power failure analysis of the first storage device is completed and it is necessary to analyze the third storage device under the power failure scenario, the connection between the first storage device and the second storage device is disconnected by disconnecting the pluggable connection module. The second storage device clears the power failure scenario data stream of the first storage device stored in the second storage medium; and connects to the third storage device through the pluggable connection module to perform power failure analysis on the third storage device.
7. A power failure analysis system, characterized in that, include: A pluggable first storage device and a second storage device; The first storage device includes: a first storage medium and a data processing module; the data processing module includes: a data acquisition module, a data filtering module, and a dispatch processing module; the second storage device includes a second storage medium; The second storage device is used to connect to the first storage device when it is powered off in a power failure scenario; The data acquisition module is used to: acquire initial data for the first power outage scenario; The data filtering module is used to: filter the first power failure scenario data based on preset filtering rules to obtain the filtered second power failure scenario data; the dispatching processing module is used to: process the second power failure scenario data to obtain a target data stream, and dispatch the target data stream to the second storage device first. The second storage device is used to: classify and integrate the target data stream according to a preset data format to obtain a power failure scenario data stream; record the power failure scenario data stream in the second storage medium; after power restoration and restart, retrieve the normal working data before the power failure from the first storage medium according to the address and length of the power failure scenario data stream; compare and analyze the normal working data with the power failure scenario data stream to locate the location of the abnormal power failure data and complete the power failure analysis.
8. The power failure analysis system according to claim 7, characterized in that, The first storage device includes a file system; the file system includes a storage block module and a storage driver module; the data acquisition module includes a kernel tracing unit, a log cache unit, and a system data acquisition unit; the first power failure scenario data includes specific event data, log information, file system metadata, and file system data; The kernel tracing unit is used to collect specific event data of the storage block module and the storage driver module of the file system; The log caching unit is used to collect log information from the first storage device; The system data acquisition unit is used to collect file system metadata and file system data.
9. The power failure analysis system according to claim 7, characterized in that, The distribution processing module includes: an integration unit, a compression unit, and a first distribution unit; The integration unit is used to perform data integration processing on the second power failure scenario data to obtain an integrated initial data stream; The compression unit is used to determine the target data stream by comparing the data volume of the integrated initial data stream with a preset data volume threshold; and to send the target data stream to the first dispatch unit. The first dispatch unit is used to preferentially send the target data stream to the second storage device.
10. The power failure analysis system according to claim 7, characterized in that, The power failure analysis system further includes: a pluggable connection module; the first storage device and the second storage device are connected through the pluggable connection module; the pluggable connection module includes: a pluggable interface disposed on the second storage device; the pluggable interface is used to match and connect with the pluggable bus of the storage device under test in a power failure scenario.
Citation Information
Patent Citations
Power failure safeguard method and device for nonvolatile memory
CN106933706A
Data recording system for collecting and storing input data
CN113257317A