[go: up one dir, main page]

CN112256475B - Fault memory recovery method, device, computer equipment and storage medium - Google Patents

Fault memory recovery method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN112256475B
CN112256475B CN202011016495.9A CN202011016495A CN112256475B CN 112256475 B CN112256475 B CN 112256475B CN 202011016495 A CN202011016495 A CN 202011016495A CN 112256475 B CN112256475 B CN 112256475B
Authority
CN
China
Prior art keywords
file
memory
service
business
persistent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011016495.9A
Other languages
Chinese (zh)
Other versions
CN112256475A (en
Inventor
伍少成
马越
王波
李芬
梁洪浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Power Supply Bureau Co Ltd
Original Assignee
Shenzhen Power Supply Bureau Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Power Supply Bureau Co Ltd filed Critical Shenzhen Power Supply Bureau Co Ltd
Priority to CN202011016495.9A priority Critical patent/CN112256475B/en
Publication of CN112256475A publication Critical patent/CN112256475A/en
Application granted granted Critical
Publication of CN112256475B publication Critical patent/CN112256475B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1435Saving, restoring, recovering or retrying at system level using file system or storage system metadata
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/0727Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a storage system, e.g. in a DASD or network based storage system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a fault memory recovery method, a fault memory recovery device, computer equipment and a storage medium. The method comprises the following steps: file operations on the business files on the persistent memory are synchronized to the business files on the volatile memory. And intercepting a memory fault signal triggered by an operating system when service data is written into the service file on the persistent memory. And writing the service data into the service file on the volatile memory. And closing a file operation channel of the persistent memory, and repairing the persistent memory. When a file operation on a service file occurs during repair, a response is made through the service file on volatile memory. After the repair is finished, a file operation channel of the persistent memory is opened, and when the file operation on the service file occurs, the service file on the persistent memory is responded continuously. By adopting the method, the stability of the file management program can be improved.

Description

Fault memory recovery method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of embedded technologies, and in particular, to a fault memory recovery method, a fault memory recovery device, a computer device, and a storage medium.
Background
With the development of computer technology, embedded technology has emerged. An embedded system is a special computer system which uses application as a center, uses computer technology as a base, can cut software and hardware, and adapts to strict requirements of an application system on functions, reliability, cost, volume, power consumption and the like. An embedded system is a complex of software and hardware, defined from an application object. Where the business file needs to be saved for a long period of time, the business file is typically stored in a persistent memory, such as NAND FLASH (flash memory). When the persistent memory fails (e.g., NAND FLASH memory turns bit), which results in a failure to write, an exception may be raised in the handling of the business data by the file manager.
At present, to restore the failed persistent memory, normal operation of the service application program on the embedded terminal needs to be interrupted, so that stability of the service application program is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a failure memory recovery method, apparatus, computer device, and storage medium that can improve stability of a business application.
A method of failing memory recovery, the method comprising:
Synchronizing file operations on the business files on the persistent memory to the business files on the volatile memory;
intercepting a memory fault signal triggered by an operating system when service data is written into a service file on the persistent memory;
Writing the business data into the business file on the volatile memory;
closing a file operation channel of the persistent memory, and repairing the persistent memory;
Responding to the business file on the volatile memory when a file operation to the business file occurs during repair;
After the repair is finished, a file operation channel of the persistent memory is opened, and when the file operation on the service file occurs, the service file on the persistent memory is responded continuously.
A failed memory recovery device, the device comprising:
the synchronization module is used for synchronizing file operation on the service files on the persistent memory to the service files on the volatile memory;
The interception module is used for intercepting a memory fault signal triggered by an operating system when service data is written into the service file on the persistent memory;
The writing module is used for writing the business data into the business file on the volatile memory;
the repair module is used for closing a file operation channel of the persistent memory and repairing the persistent memory; responding to the business file on the volatile memory when a file operation to the business file occurs during repair;
And the starting module is used for starting the file operation channel of the persistent memory after the repair is completed, and responding continuously through the service file on the persistent memory when the file operation of the service file occurs.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of:
Synchronizing file operations on the business files on the persistent memory to the business files on the volatile memory;
intercepting a memory fault signal triggered by an operating system when service data is written into a service file on the persistent memory;
Writing the business data into the business file on the volatile memory;
closing a file operation channel of the persistent memory, and repairing the persistent memory;
Responding to the business file on the volatile memory when a file operation to the business file occurs during repair;
After the repair is finished, a file operation channel of the persistent memory is opened, and when the file operation on the service file occurs, the service file on the persistent memory is responded continuously.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Synchronizing file operations on the business files on the persistent memory to the business files on the volatile memory;
intercepting a memory fault signal triggered by an operating system when service data is written into a service file on the persistent memory;
Writing the business data into the business file on the volatile memory;
closing a file operation channel of the persistent memory, and repairing the persistent memory;
Responding to the business file on the volatile memory when a file operation to the business file occurs during repair;
After the repair is finished, a file operation channel of the persistent memory is opened, and when the file operation on the service file occurs, the service file on the persistent memory is responded continuously.
According to the fault memory recovery method, the fault memory recovery device, the computer equipment and the storage medium, the business files on the volatile memory are enabled to be consistent with the business files on the persistent memory in real time by synchronizing the file operation of the business files on the persistent memory to the business files on the volatile memory. When service data is written into the service file on the persistent memory, a memory fault signal triggered by the operating system is intercepted, so that the normal operation of the service application program on the embedded terminal is prevented from being influenced by the memory fault signal. And writing the business data into the business file on the volatile memory, so that the business application program has no sense on the fault of the persistent memory. And closing a file operation channel of the persistent memory, and repairing the persistent memory. When the file operation on the service file occurs during the repair, the service file on the volatile memory is responded, so that the normal operation of the service application program is ensured. After the repair is finished, a file operation channel of the persistent memory is opened, and when the file operation on the service file occurs, the service file on the persistent memory is responded continuously. Therefore, the volatile memory is used as a substitute of the persistent memory, and when the failed persistent memory is recovered, the normal operation of the business application program is not required to be interrupted, so that the stability of the business application program is improved.
Drawings
FIG. 1 is an application scenario diagram of a failing memory recovery method in one embodiment;
FIG. 2 is a flow diagram of a method of failing memory recovery in one embodiment;
FIG. 3 is a flow diagram of RAM memory initialization in one embodiment;
FIG. 4 is a schematic diagram of a business file replication process in one embodiment;
FIG. 5 is a flow diagram of a business file opening operation in one embodiment;
FIG. 6 is a flow diagram of a business file write operation in one embodiment;
FIG. 7 is a flow diagram of a business file read operation in one embodiment;
FIG. 8 is a flow diagram of a business file deletion operation in one embodiment;
FIG. 9 is a flow diagram of a business file closing operation in one embodiment;
FIG. 10 is a flow chart of a method of recovering a failed memory in another embodiment;
FIG. 11 is a block diagram of a failed memory recovery device in one embodiment;
FIG. 12 is a block diagram of a failure memory recovery apparatus in another embodiment
Fig. 13 is an internal structural view of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The fault memory recovery method provided by the application can be applied to an application environment shown in figure 1. The application environment includes an embedded terminal 102. The embedded terminal 102 has a file management program running therein. The embedded terminal 102 includes a persistent memory 1021 and a volatile memory 1022. The embedded terminal 102 may specifically include a desktop terminal or a mobile terminal. The mobile terminal may specifically include at least one of a mobile phone, a tablet computer, a notebook computer, and the like. Those skilled in the art will appreciate that the application environment shown in fig. 1 is only a partial scenario related to the present application, and does not constitute a limitation on the application environment of the present application.
The file management program on the embedded terminal 102 synchronizes file operations on the service files on the persistent storage 1021 to the service files on the volatile storage 1022. The file manager intercepts memory failure signals triggered by the operating system when business data is written to business files on persistent storage 1021. The file management program writes the service data to the service files on the volatile memory 1022. The file management program closes the file operation channel of the persistent memory 1021, and repairs the persistent memory 1021. When a file operation occurs on a business file during repair, the file management program responds with the business file on the volatile memory 1022. After the repair is completed, the file management program opens a file operation channel of the persistent memory 1021, and when the file operation on the service file occurs, the file management program continues to respond through the service file on the persistent memory 1021.
In one embodiment, as shown in fig. 2, a method for recovering a failed memory is provided, which is illustrated by taking a file management program applied to the embedded terminal 102 in fig. 1 as an example, and includes the following steps:
s202, synchronizing file operations on the business files on the persistent storage to the business files on the volatile storage.
Wherein the service file is a file in which service data is recorded. The service data is data used by the embedded terminal when the service processing is performed.
In particular, a file management program on an embedded terminal may monitor file operations on business files on persistent storage. When the file management program monitors the file operation on the service files on the persistent storage, the file management program can synchronize the file operation on the service files on the persistent storage to the service files on the volatile storage, so that the service files on the volatile storage are consistent with the service files on the persistent storage.
In one embodiment, the file operation may specifically include at least one of an open operation, a read operation, a write operation, a delete operation, a close operation, and the like.
In one embodiment, the persistent Memory may be any of NAND FLASH Memory, PROM Memory (Programmable Read-Only Memory ), EEPROM Memory (ELECTRICALLY ERASABLE EROGRAMMABLE READ ONLY MEMORY, electrically erasable programmable read-Only Memory), EPROM Memory (Erasable Programmable Read Only Memory, electrically erasable programmable read-Only Memory), and EAROM Memory (ELECTRICALLY ALTERABLE READ ONLY MEMORY, electrically rewritable read-Only Memory), among others. Volatile memory can include RAM (Random Access Memory) memories in particular.
S204, intercepting a memory fault signal triggered by an operating system when service data is written into a service file on a persistent memory.
Wherein the memory failure signal is a signal triggered by the operating system upon a persistent memory failure.
Specifically, if the service data continues to be written to the service file on the persistent storage when the persistent storage fails, the operating system may trigger generation of a storage failure signal. The file management program can monitor the memory fault signal in real time. When the file manager monitors the memory failure signal, the file manager may intercept the memory failure signal.
S206, writing the business data into the business file on the volatile memory.
Specifically, the file management program can write the service data into the service file on the volatile memory, and feed back the successful writing result to the service application program on the embedded terminal, so that the service application program does not feel the fault of the persistent memory and does not influence the normal processing of the service data by the service application program.
And S208, closing a file operation channel of the persistent memory, and repairing the persistent memory.
The file operation channel is a channel for carrying out file operation on the service files on the persistent storage.
Specifically, after writing the service data into the service file on the volatile memory and feeding back the writing success result to the service application program, the file management program may close the file operation channel of the persistent memory to avoid generating the memory failure signal again. After the file operation channel of the persistent memory is closed, the file management program can repair the persistent memory.
S210, responding through the business file on the volatile memory when the file operation of the business file occurs during the repairing period.
Specifically, the file management program can monitor the file operation of the service file in real time, and when the file operation of the service file occurs during the repair period, the file management program can respond through the service file on the volatile memory so as to ensure the normal operation of the service application program.
S212, after the repair is completed, opening a file operation channel of the persistent memory, and continuing to respond through the service file on the persistent memory when the file operation of the service file occurs.
In particular, the file manager may monitor repair status of persistent storage. When the file management program monitors that the repair of the persistent memory is completed, the file management program can open a file operation channel of the persistent memory. Upon occurrence of the file operation on the service file, the file management program may continue to respond with the service file on the persistent memory, i.e., perform S202, that is, the file management program may synchronize the file operation on the service file on the persistent memory to the step of the service file on the volatile memory.
In the fault memory recovery method, the file operation of the service file on the persistent memory is synchronized to the service file on the volatile memory, so that the service file on the volatile memory is consistent with the service file on the persistent memory in real time. When service data is written into the service file on the persistent memory, a memory fault signal triggered by the operating system is intercepted, so that the normal operation of the file management program is prevented from being influenced by the memory fault signal. The business data is written into business files on the volatile memory so that the file management program is not aware of the failure of the persistent memory. And closing a file operation channel of the persistent memory, and repairing the persistent memory. When the file operation on the service file occurs during the repair, the normal operation of the file management program is ensured by responding to the service file on the volatile memory. After the repair is finished, a file operation channel of the persistent memory is opened, and when the file operation on the service file occurs, the service file on the persistent memory is responded continuously. Therefore, the volatile memory is used as a substitute of the persistent memory, and when the failed persistent memory is recovered, the normal operation of the file management program is not required to be interrupted, so that the stability of the file management program is improved.
In one embodiment, the failed memory recovery method further comprises: when the embedded terminal is started, the file system of the persistent memory and the file system of the volatile memory are respectively mounted through an operating system of the embedded terminal; loading a file management program to an operating system kernel layer of the embedded terminal through an operating system; and calling a file operation interface of a virtual file system of the embedded terminal to copy the service file on the persistent memory to the volatile memory.
Wherein the file system is the software mechanism responsible for managing and storing the business files. The Virtual file system (VFS, virtual FILE SYSTEM) is a software adhesive layer on top of a heterogeneous file system. The virtual file system provides a unified operation interface and file operation interface for various file systems, i.e. a plurality of different types of file systems can be seamlessly used by the virtual file system.
In one embodiment, the persistent memory is NAND FLASH memory and the volatile memory is RAM memory. As shown in fig. 3, when the embedded terminal is started, the operating system of the embedded terminal may mount the file system of NAND FLASH memories and the file system of RAM memories, respectively. Further, the operating system loads a RAM file management module (i.e., file management program) to the operating system kernel layer of the embedded terminal. The RAM file management module may invoke a file operation interface of a virtual file system of the embedded terminal to copy the service file on the NAND FLASH memory to the RAM memory.
In one embodiment, as shown in FIG. 4, the operating system mounts the NAND FLASH memory's file system and the RAM memory's file system, respectively, under a specified root directory. Further, the RAM file management module may copy the business files on NAND FLASH memories to RAM memories.
In the above embodiment, the file management program is loaded to the kernel layer by mounting the file system of the persistent memory and the file system of the volatile memory, and the service file on the persistent memory is copied to the volatile memory, so that the initialization of the volatile memory is completed, and the service file on the volatile memory is ensured to be identical to the service file on the persistent memory.
In one embodiment, the repairing the persistent memory in step S208 specifically includes: unloading a file system of the persistent memory; formatting a storage block of a file system for storing the persistent memory; a file system that copies the business files on the volatile memory to the persistent memory; the file system of the persistent memory is re-mounted.
In particular, after closing the file operation channel of the persistent memory, the file manager may uninstall the file system of the persistent memory. The file manager may determine the memory blocks of the file system storing the persistent memory and format the memory blocks of the file system storing the persistent memory. The file manager may copy the business files on the volatile memory to the file system of the persistent memory and reload the file system of the persistent memory to restore the persistent memory to normal.
In the above embodiment, the service file of the failed persistent storage is cleared by unloading the file system of the persistent storage and formatting the storage block of the file system storing the persistent storage. By copying the business files on the volatile memory to the file system of the persistent memory, the business files can be restored seamlessly. The normal operation of the persistent memory is resumed by re-mounting the file system of the persistent memory.
In one embodiment, step S202, that is, the step of synchronizing the file operation on the service file on the persistent memory to the service file on the volatile memory, specifically includes: monitoring file operation of service files on a persistent memory; when the opening operation of the business files on the persistent memory is monitored, an opening function aiming at the business files on the volatile memory is called, and the business files under the same path of the volatile memory are opened; and acquiring and recording the opening information of the opened service file.
Wherein the open information is file information recorded in the opened service file. The opening information includes at least one of a file size, a read-write authority, a modification time, an owner, a file type, a file descriptor, and the like. The file descriptor is a file identification of the service file for uniquely determining the service file.
In one embodiment, the persistent memory is NAND FLASH memory and the volatile memory is RAM memory. When the NAND FLASH memory fails and the service application calls the open function in the sys_open system, the service application calls the open function of the file system of NAND FLASH memory in the VFS to open the specified service file, obtains and records the opening information of the opened service file, and returns the file descriptor in the opening information to the service application, as shown in fig. 5. Meanwhile, the RAM file management module (i.e., file management program) may call an open function in the VFS for a service file on the RAM memory, open the same service file in the same path of the RAM memory, and acquire and record opening information of the opened service file.
In the above embodiment, the service files in the same path of the volatile memory are opened by calling the opening function for the service files on the volatile memory, so that the opening state of the service files on the volatile memory is consistent with the opening state of the service files on the persistent memory.
In one embodiment, the failed memory recovery method further comprises: when the write operation of the service file on the persistent memory is monitored, a write function aiming at the service file on the volatile memory is called, and the service data is written into the same service file under the same target path of the persistent memory; and feeding back a writing result of the business data written into the business file under the target path of the persistent memory to the file management program.
In one embodiment, the persistent memory is NAND FLASH memory and the volatile memory is RAM memory. As shown in fig. 6, when NAND FLASH memory fails and the service application calls a write function in the sys_write system, the service application calls a write function of the file system of NAND FLASH memory in the VFS to write service data to a specified service file and returns the write result to the service application. Meanwhile, the RAM file management module (i.e., file management program) may call a write function in VFS for a service file on the RAM memory, write service data to the same service file in the same path of the RAM memory, and achieve synchronization with the service file on NAND FLASH memories.
In the above embodiment, the service data is written into the same service file under the same target path of the persistent memory by calling the write function for the service file on the volatile memory, so that the writing state of the service file on the volatile memory is consistent with the writing state of the service file on the persistent memory.
In one embodiment, the failed memory recovery method further comprises: when the reading operation of the service file on the persistent memory is monitored, acquiring a file descriptor of the service file to be read from the opening information; searching a business file corresponding to the file descriptor on a volatile memory; calling a reading function aiming at the service file on the volatile memory, and reading service data in the searched service file; and feeding the read business data back to the file management program.
In one embodiment, the persistent memory is NAND FLASH memory and the volatile memory is RAM memory. As shown in fig. 7, when the service application program calls the read function in the sys_read system, the service application program calls the read function of the file system of NAND FLASH memory in the VFS, and at the same time, the RAM file management module (i.e., file management program) may call the read function for the service file on the RAM memory in the VFS, read the service data of the same service file in the same path of the RAM memory, and feed back the read service data to the service application program.
In the above embodiment, the read service data in the searched service file is read from the service file on the volatile memory by calling the read function for the service file on the volatile memory, and the read service data is fed back to the file management program. The reading speed of the volatile memory is faster than that of the persistent memory, so that the reading speed of the business application program is improved.
In one embodiment, the persistent memory is NAND FLASH memory and the volatile memory is RAM memory. As shown in fig. 8, when NAND FLASH memory fails and the service application calls an unlink function in the sys_unlink system, the service application calls an unlink function of the file system of NAND FLASH memory in the VFS to delete the specified service file, and returns the deletion result to the service application. Meanwhile, the RAM file management module (i.e., file management program) can call an unlink function in the VFS for a service file on the RAM memory, delete the same service file on the same path of the RAM memory, and realize synchronization with the service file on the NAND FLASH memory.
In one embodiment, the failed memory recovery method further comprises: when the closing operation of the business files on the persistent memory is monitored, a closing function aiming at the business files on the volatile memory is called, and the business files under the same path of the volatile memory are closed; and deleting the opening information of the closed business file on the volatile memory.
In one embodiment, the persistent memory is NAND FLASH memory and the volatile memory is RAM memory. As shown in fig. 9, when the service application program calls the close function in the sys_close system, the service application program calls the close function of the file system of NAND FLASH memory in the VFS to close the service file, and feeds back the closing result to the service application program. Meanwhile, the RAM file management module (i.e., file management program) may call a close service file function in the VFS for a service file on the RAM memory, close the same service file in the same path of the RAM memory, and delete the previously recorded open information.
In the above embodiment, the closing function for the service file on the volatile memory is invoked to close the service file under the same path of the volatile memory, so that the closing state of the service file on the volatile memory is consistent with the closing state of the service file on the persistent memory. And the memory on the volatile memory is released by deleting the opening information of the closed business file on the volatile memory.
In one embodiment, the persistent memory is NAND FLASH memory and the volatile memory is RAM memory. As shown in FIG. 10, the file manager may snoop for memory failure signals generated when a write operation is performed. When the fault signal of the memory is not monitored, the embedded terminal executes normal operation, namely, file operation on the service file on the NAND FLASH memory is synchronized to the service file on the RAM memory. When the memory failure signal is monitored, the file management program can intercept the memory failure signal and write the service data into the service file on the RAM memory. Further, the file operation channel of the NAND FLASH memory is closed, the file system of the NAND FLASH memory is unloaded, the block where the file system of the NAND FLASH memory is located is formatted, the service file on the RAM memory is copied to the file system of the NAND FLASH memory, the file system of the NAND FLASH memory is re-mounted, the file operation channel of the NAND FLASH memory is opened, the NAND FLASH memory is restored to normal operation, and meanwhile, the file management program can continue to monitor the next memory fault signal.
It should be understood that, although the steps of fig. 2 are shown sequentially in order, the steps are not necessarily performed sequentially in order. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2 described above may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
In one embodiment, as shown in FIG. 11, there is provided a fail-over device 1100 comprising: a synchronization module 1101, an interception module 1102, a writing module 1103, a repairing module 1104 and an opening module 1105, wherein:
The synchronization module 1101 is configured to synchronize file operations on the service files on the persistent storage to the service files on the volatile storage.
The interception module 1102 is configured to intercept a memory failure signal triggered by the operating system when service data is written into a service file on the persistent storage.
A writing module 1103 is configured to write the service data into a service file on the volatile memory.
A repair module 1104, configured to close a file operation channel of the persistent memory, and repair the persistent memory; when a file operation on a service file occurs during repair, a response is made through the service file on volatile memory.
The opening module 1105 is configured to open a file operation channel of the persistent storage after the repair is completed, and when a file operation on the service file occurs, continue to respond through the service file on the persistent storage.
In one embodiment, repair module 1104 is also used to offload the file system of persistent memory; formatting a storage block of a file system for storing the persistent memory; a file system that copies the business files on the volatile memory to the persistent memory; the file system of the persistent memory is re-mounted.
In one embodiment, the synchronization module 1101 is further configured to monitor file operations of the business files on the persistent storage; when the opening operation of the business files on the persistent memory is monitored, an opening function aiming at the business files on the volatile memory is called, and the business files under the same path of the volatile memory are opened; and acquiring and recording the opening information of the opened service file.
In one embodiment, the synchronization module 1101 is further configured to, when a write operation to a service file on the persistent storage is monitored, invoke a write function for the service file on the volatile storage, and write the service data to the same service file under the same target path of the persistent storage; and feeding back a writing result of the business data written into the business file under the target path of the persistent memory to the file management program.
In one embodiment, the synchronization module 1101 is further configured to obtain, when a read operation of a service file on the persistent storage is monitored, a file descriptor of the service file to be read from the open information; searching a business file corresponding to the file descriptor on a volatile memory; calling a reading function aiming at the service file on the volatile memory, and reading service data in the searched service file; and feeding the read business data back to the file management program.
In one embodiment, the synchronization module 1101 is further configured to, when a shutdown operation for a service file on the persistent storage is monitored, invoke a shutdown function for the service file on the volatile storage, and shutdown the service file under the same path of the volatile storage; and deleting the opening information of the closed business file on the volatile memory.
Referring to fig. 12, in one embodiment, the fail-memory recovery apparatus 1100 further comprises: an initialization module 1106, wherein:
An initialization module 1106, configured to mount, when the embedded terminal is started, a file system of the persistent memory and a file system of the volatile memory through an operating system of the embedded terminal, respectively; loading a file management program to an operating system kernel layer of the embedded terminal through an operating system; and calling a file operation interface of a virtual file system of the embedded terminal to copy the service file on the persistent memory to the volatile memory.
According to the fault memory recovery device, the file operation of the service files on the persistent memory is synchronized to the service files on the volatile memory, so that the service files on the volatile memory are consistent with the service files on the persistent memory in real time. When service data is written into the service file on the persistent memory, a memory fault signal triggered by the operating system is intercepted, so that the normal operation of the file management program is prevented from being influenced by the memory fault signal. The business data is written into business files on the volatile memory so that the file management program is not aware of the failure of the persistent memory. And closing a file operation channel of the persistent memory, and repairing the persistent memory. When the file operation on the service file occurs during the repair, the normal operation of the file management program is ensured by responding to the service file on the volatile memory. After the repair is finished, a file operation channel of the persistent memory is opened, and when the file operation on the service file occurs, the service file on the persistent memory is responded continuously. Therefore, the volatile memory is used as a substitute of the persistent memory, and when the failed persistent memory is recovered, the normal operation of the file management program is not required to be interrupted, so that the stability of the file management program is improved.
For specific limitations on the failed memory recovery device, reference may be made to the above limitations on the failed memory recovery method, and no further description is given here. The various modules in the above described fail-over device may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be the embedded terminal 102 in fig. 1, and the internal structure diagram thereof may be shown in fig. 13. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method for failing memory recovery. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 13 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided that includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the above-described failed memory recovery method. The steps of the fail-over method herein may be the steps in the fail-over method of the respective embodiments described above.
In one embodiment, a computer readable storage medium is provided, storing a computer program which, when executed by a processor, causes the processor to perform the steps of the above-described fail-memory recovery method. The steps of the fail-over method herein may be the steps in the fail-over method of the respective embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (10)

1. A method for recovering a failed memory, the method being applied to a file management program on an embedded terminal, the embedded terminal comprising a persistent memory and a volatile memory, the method comprising:
Synchronizing file operations on the business files on the persistent memory to the business files on the volatile memory;
when the service data is written into the service file on the persistent memory, the memory fault signal triggered by the operating system is monitored in real time, and when the memory fault signal is monitored, the memory fault signal is intercepted;
Writing the business data into the business file on the volatile memory;
closing a file operation channel of the persistent memory, and repairing the persistent memory;
Responding to the business file on the volatile memory when a file operation to the business file occurs during repair;
After the repair is finished, a file operation channel of the persistent memory is opened, and when the file operation on the service file occurs, the service file on the persistent memory is responded continuously.
2. The method according to claim 1, wherein the method further comprises:
when the embedded terminal is started, respectively mounting a file system of the persistent memory and a file system of the volatile memory through an operating system of the embedded terminal;
Loading the file management program to an operating system kernel layer of the embedded terminal through the operating system;
and calling a file operation interface of a virtual file system of the embedded terminal to copy the service file on the persistent memory to the volatile memory.
3. The method of claim 1, wherein repairing the persistent memory comprises:
Unloading a file system of the persistent memory;
Formatting a storage block of a file system storing the persistent memory;
Copying business files on the volatile memory to a file system of the persistent memory;
And re-mounting the file system of the persistent memory.
4. A method according to any one of claims 1 to 3, wherein said synchronizing file operations on business files on said persistent storage to business files on said volatile storage comprises:
monitoring file operation of the service file on the persistent memory;
When the opening operation of the business files on the persistent storage is monitored, calling an opening function aiming at the business files on the volatile storage, and opening the business files under the same path of the volatile storage;
And acquiring and recording the opening information of the opened service file.
5. The method according to claim 4, wherein the method further comprises:
when the write operation of the business file on the persistent memory is monitored, a write function aiming at the business file on the volatile memory is called, and the business data is written into the same business file under the same target path of the persistent memory;
And feeding back a writing result of the service data written into the service file under the target path of the persistent memory to the file management program.
6. The method according to claim 4, wherein the method further comprises:
when the reading operation of the service file on the persistent memory is monitored, acquiring a file descriptor of the service file to be read from the opening information;
Searching a business file corresponding to the file descriptor on the volatile memory;
Calling a reading function aiming at the service file on the volatile memory, and reading service data in the searched service file;
And feeding the read business data back to the file management program.
7. The method according to claim 4, wherein the method further comprises:
when the closing operation of the business files on the persistent memory is monitored, a closing function aiming at the business files on the volatile memory is called, and the business files under the same path of the volatile memory are closed;
and deleting the opening information of the closed business file on the volatile memory.
8. A fail-over device, the device comprising:
the synchronization module is used for synchronizing file operation on the service files on the persistent memory to the service files on the volatile memory;
the intercepting module is used for monitoring a memory fault signal triggered by an operating system in real time when service data is written into the service file on the persistent memory, and intercepting the memory fault signal when the memory fault signal is monitored;
The writing module is used for writing the business data into the business file on the volatile memory;
the repair module is used for closing a file operation channel of the persistent memory and repairing the persistent memory; responding to the business file on the volatile memory when a file operation to the business file occurs during repair;
And the starting module is used for starting the file operation channel of the persistent memory after the repair is completed, and responding continuously through the service file on the persistent memory when the file operation of the service file occurs.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202011016495.9A 2020-09-24 2020-09-24 Fault memory recovery method, device, computer equipment and storage medium Active CN112256475B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011016495.9A CN112256475B (en) 2020-09-24 2020-09-24 Fault memory recovery method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011016495.9A CN112256475B (en) 2020-09-24 2020-09-24 Fault memory recovery method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112256475A CN112256475A (en) 2021-01-22
CN112256475B true CN112256475B (en) 2024-07-12

Family

ID=74232112

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011016495.9A Active CN112256475B (en) 2020-09-24 2020-09-24 Fault memory recovery method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112256475B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905375B (en) * 2021-02-07 2024-12-03 南方电网数字电网科技(广东)有限公司 Self-recovery method, device and computer equipment of dual-core smart meter management unit

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102880522B (en) * 2012-09-21 2014-12-31 中国人民解放军国防科学技术大学 Hardware fault-oriented method and device for correcting faults in key files of system
CN105335255A (en) * 2015-12-10 2016-02-17 上海数腾软件科技股份有限公司 System and method capable of achieving quick service recovery

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7818608B2 (en) * 2005-02-18 2010-10-19 Microsoft Corporation System and method for using a file system to automatically backup a file as a generational file
GB2510180A (en) * 2013-01-29 2014-07-30 Ibm Selective restoration of data from non-volatile storage to volatile memory
CN106681865B (en) * 2017-01-16 2020-07-07 北京腾凌科技有限公司 Service recovery method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102880522B (en) * 2012-09-21 2014-12-31 中国人民解放军国防科学技术大学 Hardware fault-oriented method and device for correcting faults in key files of system
CN105335255A (en) * 2015-12-10 2016-02-17 上海数腾软件科技股份有限公司 System and method capable of achieving quick service recovery

Also Published As

Publication number Publication date
CN112256475A (en) 2021-01-22

Similar Documents

Publication Publication Date Title
US10055146B1 (en) Virtual machine rollback
US7433898B1 (en) Methods and apparatus for shared storage journaling
US20170242584A1 (en) Method of dynamic table journaling
US7441085B2 (en) Memory control method for restoring data in a cache memory
US20150378642A1 (en) File system back-up for multiple storage medium device
CN111506253B (en) Distributed storage system and storage method thereof
US20060200500A1 (en) Method of efficiently recovering database
CN118656036B (en) Mirror image processing method, computer program product, apparatus, and storage medium
US9262433B2 (en) Virtualization of file input/output operations
CN112256475B (en) Fault memory recovery method, device, computer equipment and storage medium
CN111090701B (en) Service request processing method, device, readable storage medium and computer equipment
CN111338850A (en) Method and system for improving backup efficiency based on COW mode multi-snapshot
JP2015114750A (en) Examination program, information processing device, and information processing method
WO2024212850A1 (en) Metadata backup method and apparatus, electronic device, and storage medium
US10761892B2 (en) Method and electronic device for executing data reading/writing in volume migration
CN110134545B (en) Method and system for providing virtual NVRAM based on trusted execution environment
CN111124752A (en) Method and device for backup power protection of storage device
CN112825098A (en) Data protection method and device, computing equipment and storage medium
US11226875B2 (en) System halt event recovery
US20070061530A1 (en) Method for storage of digital data in a mainframe data center and associated device
CN110471623B (en) Hard disk file writing method, device, computer equipment and storage medium
CN101201778A (en) Hard Disk Test Method under Extensible Firmware Interface
CN114356653A (en) Power-down protection method and device for industrial control firewall
CN114356369A (en) SSD firmware consistency loading method and device, computer equipment and storage medium
JP2005149248A (en) Metadata restoration system, method thereof, storage device and program therefor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant