A disc discarding reason determining method, device and medium
By storing the SSD's core flag information and capacitor operating time information in NOR FLASH, the problem of being unable to accurately locate the cause of disk loss during abnormal SSD power failure is solved. This allows accurate positioning and differentiation between software and hardware issues, improving product R&D efficiency.
Patent Information
- Application Number
- CN202211521534.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-11-30
AI Technical Summary
When existing solid-state drives (SSDs) experience abnormal power failures, it's impossible to accurately locate the cause of the drive loss. This is especially true when the controller core is deadlocked or the capacitor power supply time is insufficient. Consequently, the cause of the drive loss cannot be accurately analyzed through operation logs.
A preset space is set in the NOR FLASH of the solid-state drive to store the flag information of each core and the capacitor working time information. This information can be used to determine the cause of disk loss in the event of an abnormal power outage, including the flag information at the time of power interruption and termination, as well as the record of capacitor working time.
It can accurately locate the cause of disk loss when the SSD powers off abnormally, distinguish between software and hardware problems, improve product development efficiency, and avoid the unfavorable situation where hardware problems need to be located by software personnel, and software problems need to be located by hardware personnel.
Smart Images

Figure CN115904787B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer storage, in particular to a disk loss reason determination method and device and medium. BACKGROUND
[0002] With the rapid development of information technology, data generation and storage are problems faced by current computer field personnel. Solid state disk (SSD) has characteristics such as high bandwidth and low latency, and is widely used in various industries. The existing positioning scheme for locating the abnormal power-off fault of the SSD is to locate through the running log of the SSD. The running log of the SSD is generally stored on the NAND FLASH and the NOR FLASH; when the SSD abnormally powers off, the interrupt pin of the SSD controller is triggered, at which time the power supply of the SSD is switched from the host power supply to the internal capacitor power supply of the SSD. Generally, the capacitor can support 40-80ms of power supply time, and the power-off process of the SSD must be completed within this time, otherwise the SSD will hang up.
[0003] However, since the controller of the SSD is multicore, different physical cores run different software modules. When the core responsible for the log module is deadlocked due to software problems, or the capacitor power supply only lasts for 10ms or less, both of the above two cases can cause the SSD to fail to power off and lose the disk, resulting in the SSD being unable to be used normally; at this time, the specific reason for the SSD to fail to power off and lose the disk cannot be accurately located according to the running log of the SSD.
[0004] In view of the above problems, how to accurately locate the reason for the disk loss when the SSD abnormally powers off is a problem to be solved by those skilled in the art. SUMMARY
[0005] The purpose of the present application is to provide a disk loss reason determination method, device and medium to accurately locate the reason for the disk loss when the SSD abnormally powers off.
[0006] To solve the above technical problems, the present application provides a disk loss reason determination method, comprising:
[0007] When the solid state disk abnormally powers off and then powers on again, if it is determined that the power-on state of the solid state disk is a disk loss state, it is judged whether the disk loss reason can be determined according to the running log of the solid state disk;
[0008] If not, the flag bit information stored by the NORFLASH when the solid state disk abnormally powers off is obtained; wherein the flag bit information contains the flag information of each core in the solid state disk controller when abnormally powering off and the capacitor working time information of the capacitor;
[0009] determine the disc loss reason according to the flag information.
[0010] Preferably, before the abnormal power-off of the solid state disk, further comprising:
[0011] setting a preset space in the NOR FLASH, and setting an abnormal power-off cutoff time;
[0012] allocating a storage space to each of the cores of the solid state disk controller in the preset space, for each of the cores to store the flag information at the time of abnormal power-off interruption and the flag information at the time of abnormal power-off cutoff in the corresponding storage space;
[0013] setting a capacitor working time storage space in the preset space, for storing the capacitor working time information of the capacitor at the time of abnormal power-off of the solid state disk in the capacitor working time storage space.
[0014] Preferably, the storage space includes a first storage space and a second storage space, and when the solid state disk is abnormally powered off, the NOR FLASH stores the flag information, including:
[0015] storing the flag information at the time of abnormal power-off interruption through the first storage space corresponding to each of the cores respectively;
[0016] storing the flag information at the time of abnormal power-off cutoff through the second storage space corresponding to each of the cores respectively based on the abnormal power-off cutoff time;
[0017] storing the capacitor working time information of the capacitor in the capacitor working time storage space.
[0018] Preferably, the storing the flag information at the time of abnormal power-off interruption through the first storage space corresponding to each of the cores respectively includes:
[0019] starting a timer corresponding to each of the cores respectively, and applying a lock to each of the cores respectively; wherein the lock represents that only one core can operate the NOR FLASH at the same time;
[0020] judging whether each of the cores has applied for the lock respectively;
[0021] if yes, writing the flag information at the time of abnormal power-off interruption into the first storage space corresponding to the core, and releasing the lock;
[0022] if no, adding the core to a waiting queue, and returning to the step of applying a lock to each of the cores respectively.
[0023] Preferably, the storing the flag information at the abnormal power-off cut-off time in the second storage space corresponding to each of the cores comprises:
[0024] When it is determined that the abnormal power-off cut-off time is reached according to the corresponding timer, respectively, the application of the lock by each of the cores is performed;
[0025] It is determined whether the lock is applied by each of the cores, respectively;
[0026] If yes, the flag information at the abnormal power-off cut-off time is written into the second storage space corresponding to the core, and the lock is released;
[0027] If no, the core is added to the waiting queue, and the step of performing the application of the lock by each of the cores is returned to.
[0028] Preferably, the storing the capacitor working time information of the capacitor in the capacitor working time storage space comprises:
[0029] A preset core is selected from each of the cores of the solid state disk controller;
[0030] A capacitor power timer of the preset core is started;
[0031] The capacitor working time information is written into the capacitor working time storage space by the capacitor power timer at a preset period.
[0032] Preferably, the determining the disk loss reason according to the flag information comprises:
[0033] It is determined whether an abnormal power-off interrupt is triggered by each of the cores according to the flag information at the abnormal power-off interrupt in each of the first storage spaces;
[0034] If it is determined that there is a core that does not trigger an abnormal power-off interrupt, it is determined that the disk loss reason is a fault of the solid state disk controller;
[0035] If it is determined that each of the cores triggers an abnormal power-off interrupt, it is determined whether the flag information at the abnormal power-off cut-off time is written into the second storage space corresponding to each of the cores, respectively;
[0036] If there is at least one core that writes the flag information at the abnormal power-off cut-off time into the second storage space corresponding to the core, it is determined that the disk loss reason is a software fault in the core;
[0037] If the flag information at the abnormal power-off cut-off time is not written into the second storage space corresponding to each of the cores, the capacitor working time information stored in the capacitor working time storage space is obtained.
[0038] If the capacitor working time information does not correspond to the abnormal power-off cutoff time, it is determined that the disk loss reason is the capacitor and hardware failure.
[0039] Preferably, when the solid state disk is powered on again after abnormal power-off, if it is determined that the power-on state of the solid state disk is the normal state, the method further comprises:
[0040] erasing the flag bit information stored in the NOR FLASH.
[0041] Preferably, after it is determined that the power-on state of the solid state disk is the disk loss state, the method further comprises:
[0042] If the solid state disk is powered off abnormally again, the NOR FLASH retains the flag bit information stored when the solid state disk is powered off abnormally for the first time.
[0043] To solve the above technical problems, the application further provides a disk loss reason determination device, comprising:
[0044] a judging module, configured to, when the solid state disk is powered on again after abnormal power-off, if it is determined that the power-on state of the solid state disk is the disk loss state, judge whether the disk loss reason can be determined according to the running log of the solid state disk; if not, trigger the obtaining module;
[0045] the obtaining module, configured to obtain flag bit information stored by the NOR FLASH when the solid state disk is powered off abnormally; wherein the flag bit information comprises flag information of each core in the solid state disk controller when powered off abnormally and capacitor working time information of the capacitor;
[0046] a determining module, configured to determine the disk loss reason according to the flag bit information.
[0047] To solve the above technical problems, the application further provides another disk loss reason determination device, comprising:
[0048] a memory, configured to store a computer program;
[0049] a processor, configured to execute the computer program to realize the steps of the above-mentioned disk loss reason determination method.
[0050] To solve the above technical problems, the application further provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the steps of the above-mentioned disk loss reason determination method.
[0051] The disc loss reason determination method provided in the application, when the solid state disk is powered on again after abnormal power-off, if it is determined that the power-on state of the solid state disk is a disc loss state, it is judged whether the disc loss reason can be determined according to the running log of the solid state disk; if not, the flag bit information stored by the NOR FLASH when the solid state disk is abnormally powered off is obtained; wherein the flag bit information contains the flag information of each core in the solid state disk controller when abnormally powered off and the capacitor working time information of the capacitor; the disc loss reason is determined according to the flag bit information. It can be seen that the above scheme determines the disc loss reason through the flag bit information stored by the NOR FLASH when abnormally powered off in the case of SSD disc loss, which makes up for the defect that the disc loss reason cannot be located through the running log; it can let the technical personnel distinguish whether the disc loss is caused by software problem or hardware problem, and realize accurate positioning of the disc loss reason when the SSD is abnormally powered off. On this basis, the specific problem is located by the technical personnel, avoiding the unfavorable situation that the hardware problem is located by the software personnel and the software problem is located by the hardware personnel, and improving the product development efficiency.
[0052] In addition, the application embodiment also provides a disc loss reason determination device and medium, and the effects are the same as above. BRIEF DESCRIPTION OF DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the application, the drawings needed in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0054] Figure 1 A flow chart of a disc loss reason determination method provided in the application embodiment;
[0055] Figure 2 A schematic diagram of a disc loss reason determination device provided in the application embodiment;
[0056] Figure 3 A schematic diagram of another disc loss reason determination device provided in the application embodiment. DETAILED DESCRIPTION
[0057] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only some embodiments of the application, not all embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the application.
[0058] The core of the application is to provide a disc loss reason determination method, device and medium.
[0059] In order to make the person skilled in the art better understand the scheme of the present application, the present application is further described in detail below in combination with the drawings and specific embodiments.
[0060] In order to be able to provide a supplement for the problem that the reason for the loss of the disk cannot be located through the running log in the case of the loss of the disk of the solid state disk, and to enable the technical personnel to distinguish whether the loss of the disk is caused by a software problem or a hardware problem, the embodiment of the present application provides a method for determining the reason for the loss of the disk. Figure 1 The flow chart of the method for determining the reason for the loss of the disk provided by the embodiment of the present application is shown in FIG. 1. Figure 1 As shown in the figure, the method comprises the following steps.
[0061] S10: When the solid state disk is powered on again after abnormal power-off, if it is determined that the power-on state of the solid state disk is a loss-of-disk state, it is judged whether the reason for the loss of the disk can be determined according to the running log of the solid state disk. If not, step S11 is entered.
[0062] It can be understood that when the solid state disk is powered on again after abnormal power-off, the power-on state of the solid state disk at this time needs to be determined first. The power-on state includes a normal state and a loss-of-disk state. If the power-on state of the solid state disk is the normal state, the solid state disk can be directly used; if the power-on state of the solid state disk is the loss-of-disk state, the reason for the loss of the disk needs to be determined in order to repair the solid state disk.
[0063] The running log of the solid state disk records various information in the working process of the solid state disk, which is generally stored in the NAND FLASH (a kind of non-volatile flash memory medium, which can be rewritten and is prone to data loss for a long time) of the solid state disk. When the solid state disk is in the loss-of-disk state, if the information recorded in the exported running log is comprehensive, the reason for the loss of the disk can be analyzed through the running log; when there is no relevant information of the last power-off recorded in the exported running log, it indicates that the loss of the disk may be caused by the log module or other reasons, so the reason for the loss of the disk cannot be determined through the running log at this time.
[0064] S11: Obtain the flag bit information stored by the NOR FLASH when the solid state disk is abnormally powered off.
[0065] The flag bit information contains the flag information of each core in the solid state disk controller when it is abnormally powered off and the capacitor working time information of the capacitor.
[0066] S12: Determine the reason for the loss of the disk according to the flag bit information.
[0067] Therefore, when the reason for the loss of the disk of the solid state disk cannot be determined according to the running log, the reason for the loss of the disk needs to be determined through other ways. Specifically, the flag bit information stored by the NOR FLASH when the solid state disk is abnormally powered off is obtained, and the reason for the loss of the disk is determined according to the flag bit information.
[0068] The NOR FLASH is a non-volatile flash medium, which cannot be overwritten and must be erased before writing, and is very stable. In the embodiment, the NOR FLASH stores flag information stored when the solid state disk is abnormally powered off, which includes flag information of each core in the solid state disk controller when the solid state disk is abnormally powered off and capacitor working time information of the capacitor. Since the solid state disk controller is multi-core, different software modules run on different cores, and therefore, whether the problem is of the solid state disk controller or the software module can be checked according to the flag information of each core when the solid state disk is abnormally powered off; meanwhile, the capacitor in the solid state disk is used to support the solid state disk to complete the entire abnormal power-off process after the solid state disk is abnormally powered off, and therefore, whether the problem is of the capacitor and the hardware circuit can be checked according to the capacitor working time information of the capacitor.
[0069] It should be noted that the specific way of storing the flag information in the NOR FLASH in the embodiment is not limited, and the specific process of determining the disk loss reason according to the flag is not limited, and is determined according to the specific implementation condition.
[0070] In the embodiment, when the solid state disk is powered on again after being abnormally powered off, if it is determined that the power-on state of the solid state disk is a disk loss state, whether the disk loss reason can be determined according to the running log of the solid state disk is determined; if not, the flag information stored by the NOR FLASH when the solid state disk is abnormally powered off is obtained; wherein the flag information includes flag information of each core in the solid state disk controller when the solid state disk is abnormally powered off and capacitor working time information of the capacitor; and the disk loss reason is determined according to the flag information. It can be known that in the case of the disk loss of the SSD, the flag information stored by the NOR FLASH when the solid state disk is abnormally powered off is used to determine the disk loss reason, which makes up for the defect that the disk loss reason cannot be located by the running log; the technical personnel can distinguish whether the disk loss is caused by the software problem or the hardware problem, and the disk loss reason when the SSD is abnormally powered off is accurately located. On this basis, the specific problem is located by the technical personnel, the disadvantageous situation that the hardware problem is located by the software personnel and the software problem is located by the hardware personnel is avoided, and the product development efficiency is improved.
[0071] In order to realize the storage of the flag information by the NOR FLASH, as a preferred embodiment, before the solid state disk is abnormally powered off, the method further includes:
[0072] a preset space is set in the NOR FLASH, and an abnormal power-off cutoff time is set;
[0073] storage spaces are respectively allocated to each core of the solid state disk controller in the preset space, so as to be used for storing, by each core, the flag information when the abnormal power-off is interrupted and the flag information when the abnormal power-off is cut off in the corresponding storage space;
[0074] The preset space is arranged in the capacitor working time storage space, and is used for storing the capacitor working time information of the capacitor when the solid state disk is abnormally powered off.
[0075] Specifically, first, a preset space is arranged in the NOR FLASH of the solid state disk, and is used for storing the flag information of each core when the solid state disk is abnormally powered off and the capacitor working time information of the capacitor. In this embodiment, the size of the preset space is not limited, and is determined according to the specific implementation. Preferably, the preset space can be set to 4K.
[0076] Meanwhile, the abnormal power-off cutoff time also needs to be arranged. It can be understood that when the solid state disk is abnormally powered off, the interrupt pin of the solid state disk controller is triggered, at this time, the power supply of the solid state disk is switched from the peripheral component interconnect express (PCIE) interface (host power supply) to the capacitor in the solid state disk. Generally, the capacitor can support 40-80ms, and the power-off process of the solid state disk must be completed within this period of time, otherwise the solid state disk will be hung. The abnormal power-off cutoff time in this embodiment is the last time when the power-off process is performed, that is, the abnormal power-off of the solid state disk must be completed within the abnormal power-off cutoff time, otherwise it is considered that the power-off fails. In this embodiment, the abnormal power-off interrupt cutoff time is not limited, and is determined according to the specific implementation. Preferably, the abnormal power-off cutoff time can be set to 40ms.
[0077] Further, the storage space is respectively allocated to each core of the solid state disk controller in the preset space, and is used for storing the flag information when the abnormal power-off interrupt is stored in the corresponding storage space and the flag information when the abnormal power-off cutoff is stored in the corresponding storage space. It can be understood that for each core of the solid state disk controller, the respectively allocated storage space is used for respectively storing the flag information when the abnormal power-off interrupt is stored and the flag information when the abnormal power-off cutoff is stored. The above two kinds of flag information respectively represent the beginning and end of the abnormal power-off. In addition, the capacitor working time storage space is arranged in the preset space, and is used for storing the capacitor working time information of the capacitor when the solid state disk is abnormally powered off.
[0078] It should be noted that in this embodiment, the specific form of the flag information and the capacitor working time information is not limited, and the specific allocation of the preset space is also not limited, and is determined according to the specific implementation.
[0079] In this embodiment, the preset space is arranged in the NOR FLASH, and the storage of the flag information is realized.
[0080] The specific manner of storing flag information in the NOR FLASH memory in the above embodiment is not limited, and as a preferred embodiment, in the present embodiment, the storage space includes a first storage space and a second storage space, and when the solid state disk is abnormally powered off, the NOR FLASH stores flag information including:
[0081] The flag information at the time of abnormal power-off interruption is stored in the first storage space corresponding to each core, respectively;
[0082] The flag information at the time of abnormal power-off cutoff is stored in the second storage space corresponding to each core, respectively, based on the abnormal power-off cutoff time;
[0083] The capacitance working time information of the capacitance is stored in the capacitance working time storage space.
[0084] It can be understood that, since the storage space is allocated to each core of the solid state disk controller in the preset space of the NOR FLASH, for storing the flag information at the time of abnormal power-off interruption and the flag information at the time of abnormal power-off cutoff in the corresponding storage space, two sub-storage spaces, i.e., the first storage space and the second storage space, can be allocated to each core, respectively, for storing the flag information at the time of abnormal power-off interruption and the flag information at the time of abnormal power-off cutoff, respectively. Therefore, the storage of the flag information in the NOR FLASH can specifically include: storing the flag information at the time of abnormal power-off interruption in the first storage space corresponding to each core, respectively; storing the flag information at the time of abnormal power-off cutoff in the second storage space corresponding to each core, respectively, based on the abnormal power-off cutoff time; and storing the capacitance working time information of the capacitance in the capacitance working time storage space.
[0085] In the present embodiment, the solid state disk controller is taken as an example of 4 cores, i.e., core0, core1, core2 and core3, and each core corresponds to four software modules, i.e., a control module (CM), a management module (AM), a data module (DM) and a write module (WM); and it is assumed that the preset space of the NOR FLASH is 4K, and in the specific implementation, 0-3 bytes of the 4K space can be taken as the first storage space of core0 for storing the flag information of core0 at the time of abnormal power-off interruption, and 4-7 bytes can be taken as the second storage space of core0 for storing the flag information of core0 at the time of abnormal power-off cutoff. Preferably, the two kinds of flag information can be specifically 0xa and 0xaa, respectively.
[0086] Further, 8-11 bytes are taken as the first storage space of core 1, used for storing the flag information of core 1 in the abnormal power-off interruption; 12-15 bytes are taken as the second storage space of core 1, used for storing the flag information of core 1 in the abnormal power-off cutoff; preferably, the two kinds of flag information can be specifically flag numbers 0xb and 0xbb respectively.
[0087] 16-19 bytes are taken as the first storage space of core 2, used for storing the flag information of core 2 in the abnormal power-off interruption; 20-23 bytes are taken as the second storage space of core 2, used for storing the flag information of core 2 in the abnormal power-off cutoff; preferably, the two kinds of flag information can be specifically flag numbers 0xc and 0xcc respectively.
[0088] 24-27 bytes are taken as the first storage space of core 3, used for storing the flag information of core 3 in the abnormal power-off interruption; 28-31 bytes are taken as the second storage space of core 3, used for storing the flag information of core 3 in the abnormal power-off cutoff; preferably, the two kinds of flag information can be specifically flag numbers 0xd and 0xdd respectively.
[0089] Finally, after 32 bytes, every 4 bytes is a capacitor capacity support time scale, taken as a capacitor working time storage space, used for storing the capacitor working time information of the capacitor.
[0090] It should be noted that the specific process of NOR FLASH storage flag bit information in the embodiment is not limited, and is determined according to the specific implementation.
[0091] In the embodiment, the flag information in the abnormal power-off interruption is stored through the first storage space corresponding to each core respectively; based on the abnormal power-off cutoff time, the flag information in the abnormal power-off cutoff is stored through the second storage space corresponding to each core respectively; the capacitor working time information of the capacitor is stored in the capacitor working time storage space, so as to realize the storage of flag bit information, and facilitate the determination of subsequent disk loss reasons.
[0092] In order to realize the specific storage of flag bit information in NOR FLASH, on the basis of the above embodiment, as a preferred embodiment, the flag information in the abnormal power-off interruption stored through the first storage space corresponding to each core respectively includes:
[0093] The timers corresponding to each core are started respectively, and the locks of each core are applied respectively; wherein, the lock represents that only one core can operate NOR FLASH at the same time;
[0094] Whether each core has applied for a lock is judged respectively;
[0095] If so, write the flag information of the abnormal power-off interruption into the first storage space corresponding to the core and release the lock;
[0096] If not, the core is added to the waiting queue and the process returns to the step of applying for the lock by each core.
[0097] Specifically, when the SSD unexpectedly powers off, each core of the SSD controller detects the abnormal power-off interrupt, starts its corresponding timer, and applies for a lock. It should be noted that the purpose of the lock is to ensure that only one core is operating the NOR FLASH at a time.
[0098] Therefore, it is necessary to further determine whether each core has applied for the lock. For cores that have applied for the lock, the corresponding abnormal power-off flag information is written to the corresponding first storage space, and the lock is released after completion. Cores that have not applied for the lock are added to the waiting queue (pengding list) and wait for the lock to be released before continuing to apply for the lock until all cores have written the corresponding abnormal power-off flag information to the corresponding first storage space.
[0099] Similarly, in the process of storing the flag information of abnormal power-off in the second storage space corresponding to each core, each core also needs to apply for a lock:
[0100] When the abnormal power-off deadline is reached according to the corresponding timer, each core applies for a lock.
[0101] Determine whether each core has applied for a lock;
[0102] If so, write the flag information of the abnormal power-off to the second storage space corresponding to the core and release the lock;
[0103] If not, the core is added to the waiting queue and the process returns to the step of applying for the lock by each core.
[0104] In a specific implementation, after all cores have written the corresponding abnormal power-off interruption flag information to the corresponding first storage space, as time increases, when the time determined by the corresponding timer reaches the abnormal power-off cutoff time, each core will separately apply for a lock. Cores that have applied for a lock must write the abnormal power-off cutoff flag information to the core's corresponding second storage space and release the lock. Cores that have not applied for a lock must be added to the waiting queue and wait for the lock to be released before continuing to apply for a lock until all cores have written the abnormal power-off cutoff flag information to the corresponding second storage space.
[0105] It can be understood that the storage of the capacitor working time information also starts when the solid state disk is abnormally powered off. Therefore, the storage of the capacitor working time information of the capacitor in the capacitor working time storage space comprises:
[0106] selecting a preset core in each core of the solid state disk controller;
[0107] starting a capacitor capacity timer of the preset core;
[0108] writing the capacitor working time information into the capacitor working time storage space through the capacitor capacity timer at a preset period.
[0109] Specifically, a preset core is selected in the solid state disk controller. For example, core0, i.e. the core running the control module CM, is selected; the core is used to record the capacity of the capacitor after abnormal power-off. When the solid state disk is abnormally powered off, the core core0 detects the occurrence of the abnormal power-off interrupt, and then enables a capacitor capacity timer, which functions to write the capacitor working time information into the capacitor working time storage space of the NOR FLASH at a preset period.
[0110] Suppose the abnormal power-off cutoff time is 40ms, then theoretically the capacitor should be powered for at least 40ms after abnormal power-off. Taking the capacitor working time information as time count and the preset period as 5ms for example, after abnormal power-off, the capacitor capacity timer writes a number into the capacitor working time storage space of the NOR FLASH every 5ms, for example, 1 at 5ms, 2 at 10ms, …, and 8 at 40ms. Therefore, the actual working time of the capacitor can be confirmed only by the time count in the capacitor working time storage space subsequently.
[0111] In this embodiment, the storage of the flag information in the NOR FLASH is used to facilitate the subsequent determination of the disk loss reason.
[0112] In order to realize the final determination of the disk loss reason, on the basis of the above-mentioned embodiment, as a preferred embodiment, the determination of the disk loss reason according to the flag information comprises:
[0113] determining whether each core triggered the abnormal power-off interrupt according to the flag information at the time of the abnormal power-off interrupt in each first storage space;
[0114] if it is determined that there is a core that did not trigger the abnormal power-off interrupt, it is determined that the disk loss reason is a fault of the solid state disk controller;
[0115] if it is determined that each core triggered the abnormal power-off interrupt, it is determined whether each core wrote the flag information at the time of the abnormal power-off cutoff in the corresponding second storage space;
[0116] If at least one core writes the flag information at the time of abnormal power-off stop in the corresponding second storage space, it is determined that the disk loss reason is software failure in the core.
[0117] If none of the cores writes the flag information at the time of abnormal power-off stop in the corresponding second storage space, the capacitor working time information stored in the capacitor working time storage space is obtained.
[0118] If the capacitor working time information does not meet the abnormal power-off stop time, it is determined that the disk loss reason is capacitor and hardware failure.
[0119] In a specific implementation, after obtaining the flag bit information stored in the NOR FLASH, it is first observed whether all the cores of the solid state disk controller have received the abnormal power-off interrupt; it is specifically determined whether the cores have triggered the abnormal power-off interrupt according to the flag information at the time of abnormal power-off interrupt in each first storage space. If there is a core that has not triggered the abnormal power-off interrupt, it is determined that the disk loss reason is solid state disk controller failure, and specific inspection is required; if it is determined that all the cores have triggered the abnormal power-off interrupt, it is respectively determined whether all the cores have written the flag information at the time of abnormal power-off stop in the corresponding second storage space. If at least one core writes the flag information at the time of abnormal power-off stop in the corresponding second storage space, it is determined that the disk loss reason is software failure in the core; if none of the cores writes the flag information at the time of abnormal power-off stop in the corresponding second storage space, the capacitor working time information stored in the capacitor working time storage space is obtained to determine whether it is a capacitor and other hardware problem. If the capacitor working time information does not correspond to the abnormal power-off stop time, for example, the time counting calculates that the capacitor lasts from the triggering of the abnormal power-off interrupt to the depletion of the power supply, and the duration is not enough for the abnormal power-off stop time, it is determined that the disk loss reason is capacitor and hardware failure.
[0120] In the embodiment, the flag bit information is used to confirm the disk loss reason, which provides a supplement to the problem that the disk loss reason cannot be located through the log; and the technical personnel can clearly distinguish whether the problem is caused by software problem or hardware problem, which is convenient for the technical personnel to maintain.
[0121] In addition, in a specific implementation, in order to ensure the normal progress of the disk loss reason determination process, when the solid state disk is powered on again after abnormal power-off, if it is determined that the power-on state of the solid state disk is a normal state, the method further includes:
[0122] Erasing the flag bit information stored in the NOR FLASH.
[0123] It is understandable that when the SSD is powered on again after an abnormal power outage, if the SSD is in normal condition at this point, there is no need to determine the cause of the drive loss. However, the SSD still retains the flag information stored during the previous abnormal power outage. Therefore, to ensure that the flag information is written smoothly the next time the SSD is powered off abnormally, the flag information stored in the NOR FLASH must be erased. This ensures that the cause of the drive loss can be determined normally the next time the SSD loses a drive due to an abnormal power outage.
[0124] Furthermore, after determining that the power-on state of the solid-state hard disk is a lost disk state, the method further includes:
[0125] If the SSD is abnormally powered off again, the NOR FLASH retains the flag information stored when the SSD was abnormally powered off for the first time.
[0126] It is understandable that after determining that the power-on state of the solid-state hard drive is a lost disk state, if the solid-state hard drive is abnormally powered off again, in order to determine the cause of the lost disk due to the first abnormal power-off, the NOR FLASH needs to retain the flag information stored when the solid-state hard drive was abnormally powered off for the first time, and not record the flag information during this abnormal power-off, so as to ensure the normal progress of the process of determining the cause of the lost disk.
[0127] In the above embodiments, the method for determining the cause of disk loss is described in detail. This application also provides corresponding embodiments of the apparatus for determining the cause of disk loss. It should be noted that this application describes the embodiments of the apparatus from two perspectives: one is based on the functional modules, and the other is based on the hardware structure.
[0128] Figure 2 This is a schematic diagram of a device for determining the cause of lost disks provided in an embodiment of the present application. Figure 2 As shown, the device for determining the cause of lost disk includes:
[0129] The judgment module 10 is used to determine whether the cause of the lost disk can be determined based on the operation log of the solid-state hard disk when the solid-state hard disk is powered on again after abnormal power-off; if not, the acquisition module 11 is triggered.
[0130] The acquisition module 11 is used to acquire the flag information stored in the NOR FLASH when the solid state drive is abnormally powered off. The flag information includes the flag information of each core in the solid state drive controller when abnormally powered off and the capacitor working time information.
[0131] The determination module 12 is used to determine the cause of the disk loss according to the flag information.
[0132] In this embodiment, the device for determining the cause of disk loss includes a judgment module, an acquisition module, and a determination module. The method implemented by the device for determining the cause of disk loss is the same as the above-mentioned method for determining the cause of disk loss. When a solid-state drive (SSD) is powered on again after an abnormal power failure, if the SSD power-on state is determined to be a disk loss state, a determination is made as to whether the cause of disk loss can be determined based on the SSD's operation log. If not, the device obtains flag information stored in the NOR FLASH memory at the time of the abnormal power failure. The flag information includes flag information of each core in the SSD controller at the time of the abnormal power failure and information about the operating time of the capacitor. The cause of disk loss is determined based on the flag information. Therefore, the above-mentioned solution determines the cause of disk loss based on the flag information stored in the NOR FLASH memory at the time of the abnormal power failure, thus remedying the problem of not being able to locate the cause of disk loss based on the operation log. It also enables technicians to distinguish whether the disk loss is caused by a software problem or a hardware problem, thereby accurately locating the cause of disk loss in the event of an abnormal power failure of the SSD. On this basis, technicians can locate the specific problem, avoiding the unfavorable situation where hardware problems require software personnel to locate the problem, and vice versa, thereby improving product development efficiency.
[0133] Figure 3 This is a schematic diagram of another device for determining the cause of lost disks provided in an embodiment of the present application. Figure 3 As shown, the device for determining the cause of lost disk includes:
[0134] The memory 20 is used to store computer programs.
[0135] The processor 21 is configured to implement the steps of the method for determining the cause of disk loss mentioned in the above embodiment when executing the computer program.
[0136] The method for determining the cause of disk loss provided in this embodiment may include but is not limited to a smartphone, a tablet computer, a laptop computer, or a desktop computer.
[0137] The processor 21 can include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one of a hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), a programmable logic array (PLA), etc. The processor 21 can also include a main processor and a coprocessor. The main processor is a processor for processing data in a wake-up state, also referred to as a central processing unit (CPU). The coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 can be integrated with a graphics processing unit (GPU) for rendering and drawing content required to be displayed by the display screen. In some embodiments, the processor 21 can further include an artificial intelligence (AI) processor for processing computing operations related to machine learning.
[0138] The memory 20 can include one or more computer-readable storage media, which can be non-transitory. The memory 20 can further include a high-speed random access memory, and a nonvolatile memory such as one or more disk storage devices, flash storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein the computer program is loaded and executed by the processor 21, and can implement the related steps of the disc loss reason determination method disclosed in any of the preceding embodiments. In addition, the resources stored by the memory 20 can further include an operating system 202 and data 203, etc., and the storage mode can be temporary storage or permanent storage. The operating system 202 can include Windows, Unix, Linux, etc. The data 203 can include but is not limited to data related to the disc loss reason determination method.
[0139] In some embodiments, the disc loss reason determination apparatus can further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
[0140] Those skilled in the art can understand that the structure shown in the above embodiments does not constitute a limitation on the disc loss reason determination apparatus, and can include more or fewer components than those shown in the drawings. Figure 3
[0141] In this embodiment, the disc loss reason determination apparatus includes a memory and a processor. The memory is configured to store a computer program. The processor is configured to implement the steps of the disc loss reason determination method mentioned in the above embodiments when executing the computer program. When the solid state disk is powered on again after abnormal power-off, if it is determined that the power-on state of the solid state disk is a disc loss state, it is determined whether the disc loss reason can be determined according to the running log of the solid state disk; if not, the flag bit information stored by the NOR FLASH when the solid state disk is abnormally powered off is obtained; wherein the flag bit information includes the flag information of each core in the solid state disk controller when abnormally powered off and the capacitor working time information of the capacitor; and the disc loss reason is determined according to the flag bit information. It can be known that, in the case of disc loss of the SSD, the disc loss reason is determined according to the flag bit information stored by the NOR FLASH when abnormally powered off, which makes up for the defect that the disc loss reason cannot be located by the running log; the technician can distinguish whether the disc loss is caused by a software problem or a hardware problem, and the disc loss reason when the SSD is abnormally powered off is accurately located. On this basis, the technician locates the specific problem, avoids the disadvantageous situation that the hardware problem is located by the software personnel and the software problem is located by the hardware personnel, and the product development efficiency is improved.
[0142] Finally, the present application also provides a corresponding embodiment of a computer readable storage medium. The computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the steps described in the above method embodiments.
[0143] It can be understood that if the method in the above embodiments is implemented in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and executes all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0144] In this embodiment, the computer program is stored on the computer readable storage medium, and the computer program is executed by the processor to implement the steps described in the above method embodiments. When the solid state disk is powered on again after abnormal power-off, if it is determined that the power-on state of the solid state disk is a disk loss state, it is determined whether the disk loss reason can be determined according to the running log of the solid state disk; if not, the flag bit information stored by the NOR FLASH when the solid state disk is abnormally powered off is obtained; wherein the flag bit information includes the flag information of each core in the solid state disk controller when the solid state disk is abnormally powered off and the capacitor working time information of the capacitor; and the disk loss reason is determined according to the flag bit information. As can be seen, in the case of SSD disk loss, the flag bit information stored by the NOR FLASH when the solid state disk is abnormally powered off is used to determine the disk loss reason, which makes up for the defect that the disk loss reason cannot be located by the running log; it can be determined by the technician whether the disk loss is caused by software problem or hardware problem, and the specific problem is located by the technician, avoiding the disadvantage that the software personnel locate the problem caused by the hardware problem and the hardware personnel locate the problem caused by the software problem, and improving the product development efficiency.
[0145] The above describes in detail a disk loss reason determination method, device and medium provided by the present application. The embodiments in the specification are described in a progressive manner, and each embodiment mainly describes the difference from other embodiments. The same or similar parts of each embodiment can be referred to. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the related parts can be referred to the method part. It should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
[0146] It should also be noted that in this specification, relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
Claims
1. A method for determining the cause of lost disk, characterized in that: include: When the solid-state drive is powered on again after abnormal power-off, if it is determined that the power-on state of the solid-state drive is a lost disk state, determining whether the cause of the lost disk can be determined based on the operation log of the solid-state drive; If not, obtaining flag information stored in NOR FLASH when the solid state drive is abnormally powered off; wherein the flag information includes flag information of each core in the solid state drive controller when abnormally powered off and capacitance working time information of the capacitor; Determining the reason for the disk loss according to the flag information; Before the solid state drive is abnormally powered off, the method further includes: Setting a preset space in the NOR FLASH and setting an abnormal power-off cut-off time; Allocating storage space in the preset space to each core of the solid-state drive controller, respectively, so that each core stores the flag information when abnormal power-off is interrupted and the flag information when abnormal power-off is cut off in the corresponding storage space; Setting a capacitor working time storage space in the preset space, so as to store the capacitor working time information of the capacitor when the solid-state hard disk is abnormally powered off in the capacitor working time storage space; The storage space includes a first storage space and a second storage space. When the solid state drive is abnormally powered off, the flag information stored in the NOR FLASH includes: storing the flag information of abnormal power-off in the first storage space corresponding to each core respectively; Based on the abnormal power-off cut-off time, the flag information of the abnormal power-off cut-off is stored in the second storage space corresponding to each core; Storing the capacitor working time information of the capacitor in the capacitor working time storage space; Determining the disk loss reason according to the flag information includes: determining whether each core has triggered an abnormal power-off interruption according to the flag information of the abnormal power-off interruption in each of the first storage spaces; If it is determined that the core does not trigger an abnormal power-off interruption, then the cause of the disk loss is determined to be a failure of the solid-state hard disk controller; If it is determined that each core has triggered an abnormal power-off interrupt, then determining whether each core has written the flag information of the abnormal power-off interrupt into the corresponding second storage space; If at least one of the cores has written the flag information of abnormal power-off in the corresponding second storage space, determining that the cause of the disk loss is a software failure in the core; If each of the cores does not write the flag information of abnormal power-off in the corresponding second storage space, acquiring the capacitor working time information stored in the capacitor working time storage space; If the capacitor working time information does not correspond to the abnormal power-off cut-off time, it is determined that the cause of the disk loss is a failure of the capacitor and hardware.
2. The method for determining the cause of disk loss according to claim 1, wherein: The storing of the flag information of abnormal power-off in the first storage space corresponding to each core includes: respectively starting a timer corresponding to each core and respectively applying for a lock by each core; wherein the lock indicates that only one core can operate the NOR FLASH at the same time; Determine whether each core has applied for the lock; If so, writing the flag information of the abnormal power-off interruption into the first storage space corresponding to the core and releasing the lock; If not, the core is added to the waiting queue, and the process returns to the step of respectively requesting the lock from each core.
3. The method for determining the cause of disk loss according to claim 2, wherein: The storing of the flag information of abnormal power-off in the second storage space corresponding to each core includes: When it is determined according to the corresponding timer that the abnormal power-off deadline has been reached, each core applies for the lock; Determine whether each core has applied for the lock; If so, writing the flag information at the time of abnormal power-off into the second storage space corresponding to the core and releasing the lock; If not, the core is added to the waiting queue, and the process returns to the step of separately requesting the lock from each core.
4. The method for determining the cause of disk loss according to claim 1, wherein: The storing of the capacitor working time information of the capacitor in the capacitor working time storage space includes: Selecting a preset core from the cores of the solid-state drive controller; Starting a capacitor charge timer of the preset core; The capacitor working time information is written into the capacitor working time storage space at a preset period by the capacitor power timer.
5. The method for determining the cause of disk loss according to any one of claims 1 to 4, wherein: When the solid state drive is powered on again after being abnormally powered off, if it is determined that the power-on state of the solid state drive is normal, the method further includes: Erasing the flag information stored in the NOR FLASH.
6. The method for determining the cause of disk loss according to claim 5, wherein: After determining that the power-on state of the solid-state hard disk is the lost disk state, the method further includes: If the solid state drive is abnormally powered off again, the NOR FLASH retains the flag information stored when the solid state drive is abnormally powered off for the first time.
7. A device for determining the cause of lost disk, characterized in that: include: a judgment module for, when the solid-state drive is powered on again after an abnormal power-off, determining whether the cause of the lost disk can be determined based on the operation log of the solid-state drive when the solid-state drive is powered on again; if not, triggering the acquisition module; The acquisition module is used to acquire flag information stored in the NOR FLASH when the solid-state drive is abnormally powered off; wherein the flag information includes flag information of each core in the solid-state drive controller when abnormally powered off and capacitance working time information of the capacitor; A determination module, configured to determine the cause of the disk loss according to the flag information; Before the solid state drive is abnormally powered off, the method further includes: Setting a preset space in the NOR FLASH and setting an abnormal power-off cut-off time; Allocating storage space in the preset space to each core of the solid-state drive controller, respectively, so that each core stores the flag information when abnormal power-off is interrupted and the flag information when abnormal power-off is cut off in the corresponding storage space; Setting a capacitor working time storage space in the preset space, so as to store the capacitor working time information of the capacitor when the solid-state hard disk is abnormally powered off in the capacitor working time storage space; The storage space includes a first storage space and a second storage space. When the solid state drive is abnormally powered off, the flag information stored in the NOR FLASH includes: storing the flag information of abnormal power-off in the first storage space corresponding to each core respectively; Based on the abnormal power-off cut-off time, the flag information of the abnormal power-off cut-off is stored in the second storage space corresponding to each core; Storing the capacitor working time information of the capacitor in the capacitor working time storage space; Determining the disk loss reason according to the flag information includes: determining whether each core has triggered an abnormal power-off interruption according to the flag information of the abnormal power-off interruption in each of the first storage spaces; If it is determined that the core does not trigger an abnormal power-off interruption, then the cause of the disk loss is determined to be a failure of the solid-state hard disk controller; If it is determined that each core has triggered an abnormal power-off interrupt, then determining whether each core has written the flag information of the abnormal power-off interrupt into the corresponding second storage space; If at least one of the cores has written the flag information of abnormal power-off in the corresponding second storage space, determining that the cause of the disk loss is a software failure in the core; If each of the cores does not write the flag information of abnormal power-off in the corresponding second storage space, acquiring the capacitor working time information stored in the capacitor working time storage space; If the capacitor working time information does not correspond to the abnormal power-off cut-off time, it is determined that the cause of the disk loss is a failure of the capacitor and hardware.
8. A device for determining the cause of lost disk, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for determining a cause of disk loss according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for determining the cause of disk loss according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method, apparatus and device for positioning SSD loss reasons
CN110673998A