CN109918228B - Data power failure maintaining method and system - Google Patents

Data power failure maintaining method and system Download PDF

Info

Publication number
CN109918228B
CN109918228B CN201910081089.1A CN201910081089A CN109918228B CN 109918228 B CN109918228 B CN 109918228B CN 201910081089 A CN201910081089 A CN 201910081089A CN 109918228 B CN109918228 B CN 109918228B
Authority
CN
China
Prior art keywords
data
backup
backup area
area
power failure
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
CN201910081089.1A
Other languages
Chinese (zh)
Other versions
CN109918228A (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.)
Zhejiang Supcon Technology Co Ltd
Original Assignee
Zhejiang Supcon Technology 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 Zhejiang Supcon Technology Co Ltd filed Critical Zhejiang Supcon Technology Co Ltd
Priority to CN201910081089.1A priority Critical patent/CN109918228B/en
Publication of CN109918228A publication Critical patent/CN109918228A/en
Application granted granted Critical
Publication of CN109918228B publication Critical patent/CN109918228B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)
  • Power Sources (AREA)

Abstract

The invention provides a method and a system for maintaining data power failure, wherein the method comprises the following steps: dividing real-time data to be kept in power failure into a plurality of data blocks; in a periodic backup mode, sequentially backing up a plurality of data blocks to a nonvolatile memory in batches, wherein the backup process of each data block is as follows: backing up the current data block to a second backup area of the nonvolatile memory; after the current data block is backed up in the second backup area, backing up the current data block to the first backup area of the nonvolatile memory; and after the current data block is completely backed up in the first backup area, emptying the data stored in the second backup area for the backup of the next data block. The method and the system for maintaining the power failure of the data can realize double backup power failure maintenance of the real-time data as long as one part of the storage space is slightly larger than the storage space of the real-time data area needing power failure maintenance, and the backup data also has the power failure maintenance function when power failure occurs in the updating process, so that the cost is low and the reliability is good.

Description

Data power failure maintaining method and system
Technical Field
The invention relates to the technical field of computers, in particular to a data power failure maintaining method and system.
Background
Generally, a control system needs to have power-down retention of data, that is, data needing power-down retention is backed up to a nonvolatile memory capable of power-down retention, for example: MRAM (Magnetic Random Access Memory, nonvolatile Magnetic Random Access Memory), FLASH Memory, and the like.
Compared with DDR (synchronous dynamic random access memory), the nonvolatile memory is generally not large in space and slow in execution speed, so real-time Data of the control system generally runs on DDR (Double Data Rate) and periodically backs up real-time Data which needs to be maintained in a power-down mode to the nonvolatile memory.
At present, a control system has the following two data power-down maintaining methods: the method comprises a single backup data power failure holding method and a complete double backup data power failure holding method. The single backup data power failure holding method is to back up only one copy of data to be held in power failure on the nonvolatile memory, so that only one copy of data storage space is needed. However, in the single backup method, if power failure occurs during data storage, the corresponding stored data will fail, and the reliability is low. The method for keeping the power failure of the data with the complete double backup is to backup two completely consistent data needing power failure keeping on a nonvolatile memory. Therefore, when a backup is carried out to a power-down holding storage area, if power failure occurs, the data of the other backup area is still valid and can still be recovered after power-up, and therefore the complete data holding function is realized. However, this method requires two storage spaces with the same size as the data space to be kept, requires a large-capacity storage device to be kept in a power-down state, and is relatively high in cost.
Therefore, a data power-down maintaining technology which is low in cost and reliable and is suitable for a control system is lacked in the prior art.
Disclosure of Invention
In order to solve the problems of low reliability and high cost of the conventional data power failure holding method, the invention provides a data power failure holding method and a data power failure holding system, which can realize double backup of data only by requiring a storage space larger than a data space to be held under the condition that the storage space of a nonvolatile memory with a power failure holding function is limited.
The invention provides a data power failure holding method which is characterized by comprising the following steps:
dividing real-time data to be kept in power failure into a plurality of data blocks;
and backing up the plurality of data blocks to the nonvolatile memory in a periodic backup mode in sequence in batches, wherein the backup process of each data block is as follows:
backing up a current data block to a second backup area of the nonvolatile memory; after the current data block is backed up in the second backup area, backing up the current data block to the first backup area of the nonvolatile memory; and after the current data block is backed up in the first backup area, clearing the data stored in the second backup area for the backup of the next data block.
As an implementable embodiment, the method for maintaining power failure of data provided by the present invention further includes the following steps:
setting the first backup area and the second backup area in a nonvolatile memory; the size of the first backup area is larger than or equal to the size of a real-time data operation area needing power failure maintenance; the first backup area comprises a plurality of partition areas, and the size of each partition area is the same as that of the data block; the size of the second backup area is greater than or equal to the size of the data blocks.
According to the capacity and the address of the first backup area, the capacity and the address of the second backup area and the backup sequence number, the data blocks are sequentially backed up in batches to the nonvolatile memory.
As an implementation manner, the method for backing up the plurality of data blocks to the nonvolatile memory in sequence in batches in a periodic backup manner includes the following steps:
when the real-time data backup period is up, matching the data block needing to be backed up currently and the corresponding partition area of the data block in the first backup area according to the backup serial number;
setting the data valid flag of the second backup area to be invalid, copying the data block to the second backup area, and setting the data valid flag of the second backup area to be valid after copying is completed;
setting the data valid flag of the corresponding partition in the first backup area as invalid, copying the data block to the corresponding partition in the first backup area, and setting the data valid flag of the partition as valid;
and after the data block is completely backed up in the first backup area, setting the data valid flag of the second backup area as invalid.
As an implementable manner, the data power-down maintaining method of the present invention further includes the steps of:
after the system is powered on, detecting whether all the data blocks backed up in the first backup area are effective; if so, restoring by using the backup data of the first backup area; and if not, recovering the effective data blocks backed up by the first backup area and the backup data of the second backup area.
As an implementation manner, the restoring using the valid data blocks backed up by the first backup area and the backup data of the second backup area includes the following steps:
acquiring a data effective mark of each partition area of the first backup area, a data effective mark of the second backup area and a backup serial number;
if the data valid flag of the second backup area is valid, copying the data of the second backup area to the corresponding partition area in the first backup area according to the backup serial number, setting the data valid flag of the corresponding partition area in the first backup area to be valid after the copying is finished, and setting the data valid flag of the second backup area to be invalid;
and copying the data of all the effective partition areas of the first backup area to an area of real-time data.
Correspondingly, the invention provides a data power failure holding system, which comprises a data block dividing module and a data backup module;
the data dividing module is used for dividing real-time data needing to be kept in power failure into a plurality of data blocks;
the data backup module is used for backing up the data blocks to the nonvolatile memory in batches in sequence in a periodic backup mode, and the backup process of each data block is as follows:
backing up a current data block to a second backup area of the nonvolatile memory; after the current data block is backed up in the second backup area, backing up the current data block to the first backup area of the nonvolatile memory; and after the current data block is backed up in the first backup area, clearing the data stored in the second backup area for the backup of the next data block.
As an implementable manner, the data power failure holding system provided by the invention further comprises a memory setting module;
the memory setting module is used for setting the first backup area and the second backup area in a nonvolatile memory; the size of the first backup area is larger than or equal to the size of a real-time data operation area needing power failure maintenance; the first backup area comprises a plurality of partition areas, and the size of each partition area is the same as that of the data block; the size of the second backup area is greater than or equal to the size of the data blocks.
As an implementation manner, the data backup module sequentially backs up the plurality of data blocks to the nonvolatile memory in batches according to the capacity and address of the first backup area, the capacity and address of the second backup area, and the backup serial number.
As an implementation manner, the data backup module comprises a matching unit, a primary backup unit, a secondary backup unit and an end unit;
the matching unit is used for matching the data block needing to be backed up currently and the corresponding partition area of the data block in the first backup area according to the backup serial number after the real-time data backup period is reached;
the first backup unit is configured to set the data valid flag of the second backup area to be invalid, copy the data block to the second backup area, and set the data valid flag of the second backup area to be valid after the copying is completed;
the secondary backup unit is configured to set the data valid flag of the corresponding partition in the first backup area to invalid, copy the data block to the corresponding partition in the first backup area, and set the data valid flag of the partition to valid;
and the ending unit is used for setting the data valid flag of the second backup area as invalid after the data block is completely backed up in the first backup area.
As an implementable mode, the data power failure maintaining system of the invention further comprises a data recovery module;
the data recovery module is used for detecting whether all the data blocks backed up in the first backup area are valid or not after the system is powered on; if so, restoring by using the backup data of the first backup area; and if not, recovering the effective data blocks backed up by the first backup area and the backup data of the second backup area.
As an implementable manner, the data recovery module includes an acquisition unit, a copy unit, and a recovery unit;
the acquiring unit is used for acquiring the data valid flag of each partition area of the first backup area, the data valid flag of the second backup area and the backup serial number;
the copying unit is configured to copy, according to the backup serial number, the data in the second backup area to the corresponding partition area in the first backup area if the data valid flag in the second backup area is valid, set the data valid flag in the corresponding partition area in the first backup area to be valid after the copying is completed, and set the data valid flag in the second backup area to be invalid;
and the recovery unit is used for copying the data of all the effective partition areas of the first backup area to the real-time data area.
Compared with the prior art, the invention has the beneficial effects that:
the method and the system for maintaining the power failure of the data do not need two backup areas with the size completely consistent with that of the real-time data, can realize double backup power failure maintenance of the real-time data as long as one backup area is slightly larger than the storage space of the real-time data area needing power failure maintenance, and has the power failure maintenance function when the power failure occurs in the updating process of the backup data, so that the cost is low and the reliability is good.
Drawings
Fig. 1 is a schematic flowchart of a data power failure maintaining method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a data storage area in a method for providing a power-down data retention function according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a real-time data backup process in a method for maintaining a power failure of data according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a power-on data reply flow in a method for maintaining power failure of data according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a data power failure holding system according to a second embodiment of the present invention.
Detailed Description
The above and further features and advantages of the present invention will be apparent from the following, complete description of the invention, taken in conjunction with the accompanying drawings, wherein the described embodiments are merely some, but not all embodiments of the invention.
The invention provides a novel double-backup data power-down maintaining technology, which can realize double backup of data as long as the storage space is larger than the data space to be maintained under the condition that the storage space of a memory with a power-down maintaining function is limited, and has a complete power-down maintaining function.
Referring to fig. 1, an embodiment of the present invention provides a method for maintaining a power failure of data, including the following steps:
s100, dividing real-time data needing to be maintained in a power failure mode into a plurality of data blocks;
s200, backing up a plurality of data blocks to a nonvolatile memory in a batch mode in sequence in a periodic backing up mode, wherein the backing up process of each data block is as follows:
backing up the current data block to a second backup area of the nonvolatile memory; after the current data block is backed up in the second backup area, backing up the current data block to the first backup area of the nonvolatile memory; and after the current data block is completely backed up in the first backup area, emptying the data stored in the second backup area for the backup of the next data block.
The invention firstly adopts a nonvolatile memory as a medium for maintaining data in case of power failure. Because the execution speed of the nonvolatile memory is different from that of the DDR, the real-time data operation area is the DDR, and the power failure holding area is the nonvolatile memory. The invention backups the real-time data on the DDR to the nonvolatile memory in batches in a periodic backup mode, and the specific backup process is as follows:
assuming that the real-time data is divided into 6 blocks of data, the first backup area is also divided into 6 partition areas. If the 4 th block data block needs to be backed up in the current period, the 4 th block data block of the real-time data is backed up to the second backup area, and then the 4 th block data block of the real-time data is backed up to the 4 th block partition area of the first backup area after the backup is finished. And after the 4 th block data block in the first backup area is completely backed up, clearing the fourth block data block stored in the second backup area. And the rest is done in the same way, and the 5 th block data block is backed up.
If all the 6 data blocks are successfully backed up to the first backup area, only the storage space of the first backup area is occupied. In the backup process, only a storage space slightly larger than the real-time data is needed, and two backup areas with the size completely consistent with the size of the real-time data are not needed. If a certain block of the 6 data blocks is powered down in the process of being backed up to the first backup area, the data block failed in backup in the first backup area can be found back in the second backup area, and the reliability is greatly improved on the basis of saving the storage space.
The corresponding power-on recovery operation is as follows:
and after power on, checking whether the data blocks stored in each partition area of the first backup area are valid, and if so, directly using the first backup area for recovery. If the data block stored in one partition area is invalid, the data in the partition area is replaced by the backup data in the second backup area, namely the valid data block backed up by the first backup area and the backup data in the second backup area are used for restoring.
The data power failure holding method provided by the invention does not need 2 backup areas with the size completely consistent with that of the real-time data, can realize double backup power failure holding of the real-time data as long as one backup area is slightly larger than the storage space of the real-time data area needing power failure holding, and has the power failure holding function when the power failure occurs in the updating process of the backup data, thereby having low cost and good reliability.
The data power failure maintaining method provided by the embodiment comprises the following data areas in the operation process: the system comprises a real-time data operation area, a first backup area and a second backup area which need to be maintained in a power failure mode. The real-time data operation area is in DDR, and the first backup area and the second backup area are in non-volatile memories such as MRAM.
As an implementable embodiment, the method for maintaining power failure of data provided by the present invention further includes the following steps:
setting a first backup area and a second backup area in a nonvolatile memory; the size of the first backup area is larger than or equal to the size of a real-time data operation area needing to be maintained in a power failure mode; the first backup area comprises a plurality of partition areas, and the size of each partition area is the same as that of the data block; the size of the second backup area is greater than or equal to the size of the data blocks.
The user can set the first backup area and the second backup area according to the size of the data block divided by the real-time data to be kept in power failure, and can also divide the real-time data to be kept in power failure according to the size of the storage space of the actually used nonvolatile memory.
As shown in fig. 2, the first backup area is divided into N partition areas, and the size of the first backup area is the same as or slightly larger than the size of the real-time data operation area that needs to be maintained in a power-down manner, so as to ensure that the real-time data that needs to be maintained in the power-down manner can be completely backed up in the first backup area. The second backup area is used as a temporary backup area, the size of the second backup area is the same as that of a partitioned area obtained after the first backup area is partitioned, and the size of the second backup area is larger than or equal to that of a data block, so that the data block can be completely backed up.
Further, in step S200, the plurality of data blocks are sequentially backed up to the nonvolatile memory in batches according to the capacity and address of the first backup area, the capacity and address of the second backup area, and the backup serial number.
The capacity and the address of the first backup area and the capacity and the address of the second backup area can be solidified, and only need to be read after each power-on without repeated configuration. And loading when power is on, acquiring the data of the power failure holding area, and determining how to load the data according to the control information of the backup area.
Taking MRAM as an example, the backup area control information may include the capacity and address of the first backup area, the capacity and address of the second backup area, the backup serial number, and whether each partition of the first backup area is valid and whether the second backup area is valid. The real-time data backup process is shown in fig. 3 and includes the following steps:
s210, when the real-time data backup period is reached, matching the data block needing to be backed up currently and the corresponding partition area of the data block in the first backup area according to the backup serial number;
s220, setting the data valid flag of the second backup area to be invalid, and copying the data block to the second backup area; if the backup serial number is N-1, setting the backup serial number as 0, otherwise adding 1 to the backup serial number; after copying is finished, setting the data valid flag of the second backup area as valid;
s230, setting the data valid flag of the corresponding partition in the first backup area to be invalid, copying the data block to the corresponding partition in the first backup area, and setting the data valid flag of the partition to be valid;
and S240, after the data block is completely backed up in the first backup area, setting the data valid flag of the second backup area as invalid.
By adopting the real-time data backup process, if power is lost outside the whole backup process, the data in the first backup area is recovered when power is on. And if the power failure occurs when the backup is carried out to the second backup area in the real-time data backup process, the data in the first backup area is recovered during the power-on process. If the power failure occurs when the first backup area is backed up in the real-time data backup process, the effective data in the first backup area is adopted for data recovery during power-on, and the ineffective data in the first backup area is replaced by the data in the second backup area.
The corresponding power-on recovery process is shown in fig. 4, and includes the following steps:
s310, acquiring backup area control information, including: the data valid flag of each partition area of the first backup area, the data valid flag of the second backup area and the backup serial number;
s320, judging whether the second backup area data is valid according to the backup area control information;
s330, if the data valid flag of the second backup area is valid, copying the data of the second backup area to the corresponding partition area in the first backup area according to the backup serial number, setting the data valid flag of the corresponding partition area in the first backup area to be valid after the copying is finished, and setting the data valid flag of the second backup area to be invalid;
and S340, if the data valid flag of the second backup area is invalid, copying the data of all valid partition areas of the first backup area to the corresponding area of the real-time data.
S350, if the data valid marks of all the partition areas of the first backup area are valid, setting the backup serial number to be 0, otherwise, setting the backup serial number to be the initial invalid partition area, wherein the specific recovery process is as follows:
assume that there are 6 partition areas in the first backup area corresponding to real-time data: 0. 1, 2, 3, 4 and 5, wherein the data in the first backup area are all valid, and the backup data before power failure are 3, 4 and 5 in the previous period and 0, 1 and 2 in the last period of power failure; the order of recovery of the real-time data is: 0. 1, 2, 3, 4, 5; the backup sequence number is set to 0.
Assume that there are 6 partition areas in the first backup area corresponding to real-time data: 0. 1, 2, 3, 4 and 5, wherein the first backup areas are not all effective, and the backup data before power failure are 4 and 5 of the previous period and 0, 1 and 2 of the last period of power failure, and the second backup areas; the order of recovery of the real-time data is: 0. 1, 2, a second backup area, 4, 5; the backup sequence number is 3.
Based on the same inventive concept, the invention also provides a data power failure holding system, which has the same principle as the data power failure holding method, and the implementation of the system can be realized by referring to the method, and the repetition part is not described redundantly.
Referring to fig. 5, the system for maintaining the power failure of data according to the second embodiment of the present invention includes a data block partitioning module 100 and a data backup module 200. The data dividing module 100 is configured to divide real-time data that needs to be maintained in a power-down state into a plurality of data blocks; the data backup module 200 is configured to backup a plurality of data blocks to the nonvolatile memory in a batch manner in sequence in a periodic backup manner, where a backup process of each data block is as follows:
backing up the current data block to a second backup area of the nonvolatile memory; after the current data block is backed up in the second backup area, backing up the current data block to the first backup area of the nonvolatile memory; and after the current data block is completely backed up in the first backup area, emptying the data stored in the second backup area for the backup of the next data block.
Further, the system for maintaining the power failure of data provided by the invention further comprises a memory setting module 300. The memory setting module 300 is configured to set a first backup area and a second backup area in the nonvolatile memory; the size of the first backup area is larger than or equal to the size of a real-time data operation area needing to be maintained in a power failure mode; the first backup area comprises a plurality of partition areas, and the size of each partition area is the same as that of the data block; the size of the second backup area is greater than or equal to the size of the data blocks.
The data backup module 200 backs up the plurality of data blocks to the nonvolatile memory in sequence in batches according to the capacity and address of the first backup area, the capacity and address of the second backup area, and the backup serial number.
Further, the data backup module 200 includes a matching unit 210, a primary backup unit 220, a secondary backup unit 230, and an ending unit 240. The matching unit 210 is configured to match, according to the backup sequence number, the data block that needs to be backed up currently and the corresponding partition area of the data block in the first backup area when the real-time data backup cycle arrives; the first backup unit 220 is configured to set the data valid flag of the second backup area to be invalid, copy the data block to the second backup area, and set the data valid flag of the second backup area to be valid after the copying is completed; the secondary backup unit 230 is configured to set the data valid flag of the corresponding partition in the first backup area to be invalid, copy the data block to the corresponding partition in the first backup area, and set the data valid flag of the partition to be valid; the ending unit 240 is configured to set the data valid flag of the second backup area to be invalid after the data block is completely backed up in the first backup area.
Further, the above-mentioned data loss holding system further includes a data recovery module 300. The data recovery module 300 is configured to detect whether all data blocks backed up in the first backup area are valid after the system is powered on; if so, restoring by using the backup data of the first backup area; if not, the effective data blocks backed up by the first backup area and the backup data of the second backup area are used for recovery.
The data recovery module 300 includes an acquisition unit 310, a copy unit 320, and a recovery unit 330. The obtaining unit 310 is configured to obtain a data valid flag of each partition in the first backup area, a data valid flag of the second backup area, and a backup serial number; the copying unit 320 is configured to copy the data in the second backup area to the corresponding partition area in the first backup area according to the backup serial number if the data valid flag in the second backup area is valid, set the data valid flag in the corresponding partition area in the first backup area to be valid after the copying is completed, and set the data valid flag in the second backup area to be invalid; the recovery unit 330 is configured to copy data of all valid partition areas of the first backup area to an area of real-time data.
The data power failure holding system provided by the invention does not need two backup areas with the size completely consistent with that of the real-time data, can realize double backup power failure holding of the real-time data as long as one backup area is slightly larger than the storage space of the real-time data area needing power failure holding, and has the power failure holding function when the power failure occurs in the updating process of the backup data, thereby having low cost and good reliability.
The above-mentioned embodiments are provided to further explain the objects, technical solutions and advantages of the present invention in detail, and it should be understood that the above-mentioned embodiments are only examples of the present invention and are not intended to limit the scope of the present invention. It should be understood that any modifications, equivalents, improvements and the like, which come within the spirit and principle of the invention, may occur to those skilled in the art and are intended to be included within the scope of the invention.

Claims (10)

1. A data power failure holding method is characterized by comprising the following steps:
dividing real-time data to be kept in power failure into a plurality of data blocks;
and backing up the plurality of data blocks to the nonvolatile memory in a periodic backup mode in sequence in batches, wherein the backup process of each data block is as follows:
backing up a current data block to a second backup area of the nonvolatile memory; after the current data block is backed up in the second backup area, backing up the current data block to the first backup area of the nonvolatile memory; after the current data block is backed up in the first backup area, clearing the data stored in the second backup area for the backup of the next data block;
setting the first backup area and the second backup area in a nonvolatile memory; the size of the first backup area is larger than or equal to the size of a real-time data operation area needing power failure maintenance; the first backup area comprises a plurality of partition areas, and the size of each partition area is the same as that of the data block; the size of the second backup area is greater than or equal to the size of the data blocks.
2. The method for maintaining the power failure of the data according to claim 1, wherein the plurality of data blocks are sequentially backed up to the nonvolatile memory in batches according to the capacity and the address of the first backup area, the capacity and the address of the second backup area, and the backup sequence number.
3. The method for maintaining the power failure of the data, according to any one of claims 1 to 2, wherein the plurality of data blocks are sequentially backed up to the nonvolatile memory in batches in a periodic backup mode, and the method comprises the following steps:
when the real-time data backup period is up, matching the data block needing to be backed up currently and the corresponding partition area of the data block in the first backup area according to the backup serial number;
setting the data valid flag of the second backup area to be invalid, copying the data block to the second backup area, and setting the data valid flag of the second backup area to be valid after copying is completed;
setting the data valid flag of the corresponding partition in the first backup area as invalid, copying the data block to the corresponding partition in the first backup area, and setting the data valid flag of the partition as valid;
and after the data block is completely backed up in the first backup area, setting the data valid flag of the second backup area as invalid.
4. The method for maintaining the power failure of the data according to claim 3, further comprising the steps of:
after the system is powered on, detecting whether all the data blocks backed up in the first backup area are effective; if so, restoring by using the backup data of the first backup area; and if not, recovering the effective data blocks backed up by the first backup area and the backup data of the second backup area.
5. The method for maintaining the power failure of the data according to claim 4, wherein the recovering using the valid data blocks backed up by the first backup area and the backup data of the second backup area comprises the following steps:
acquiring a data effective mark of each partition area of the first backup area, a data effective mark of the second backup area and a backup serial number;
if the data valid flag of the second backup area is valid, copying the data of the second backup area to the corresponding partition area in the first backup area according to the backup serial number, setting the data valid flag of the corresponding partition area in the first backup area to be valid after the copying is finished, and setting the data valid flag of the second backup area to be invalid;
and copying the data of all the effective partition areas of the first backup area to an area of real-time data.
6. A data power failure holding system is characterized by comprising a data block dividing module and a data backup module;
the data block dividing module is used for dividing real-time data needing to be kept in power failure into a plurality of data blocks;
the data backup module is used for backing up the data blocks to the nonvolatile memory in batches in sequence in a periodic backup mode, and the backup process of each data block is as follows:
backing up a current data block to a second backup area of the nonvolatile memory; after the current data block is backed up in the second backup area, backing up the current data block to the first backup area of the nonvolatile memory; after the current data block is backed up in the first backup area, clearing the data stored in the second backup area for the backup of the next data block;
the device also comprises a memory setting module;
the memory setting module is used for setting the first backup area and the second backup area in a nonvolatile memory; the size of the first backup area is larger than or equal to the size of a real-time data operation area needing power failure maintenance; the first backup area comprises a plurality of partition areas, and the size of each partition area is the same as that of the data block; the size of the second backup area is greater than or equal to the size of the data blocks.
7. The system for maintaining the data in the power-down state according to claim 6, wherein the data backup module backs up the data blocks to the nonvolatile memory in sequence in batches according to the capacity and the address of the first backup area, the capacity and the address of the second backup area, and the backup sequence number.
8. The system for maintaining the power failure of the data according to any one of claims 6 to 7, wherein the data backup module comprises a matching unit, a primary backup unit, a secondary backup unit, and an ending unit;
the matching unit is used for matching the data block needing to be backed up currently and the corresponding partition area of the data block in the first backup area according to the backup serial number after the real-time data backup period is reached;
the first backup unit is configured to set the data valid flag of the second backup area to be invalid, copy the data block to the second backup area, and set the data valid flag of the second backup area to be valid after the copying is completed;
the secondary backup unit is configured to set the data valid flag of the corresponding partition in the first backup area to invalid, copy the data block to the corresponding partition in the first backup area, and set the data valid flag of the partition to valid;
and the ending unit is used for setting the data valid flag of the second backup area as invalid after the data block is completely backed up in the first backup area.
9. The system for maintaining loss of data as recited in claim 8, further comprising a data recovery module;
the data recovery module is used for detecting whether all the data blocks backed up in the first backup area are valid or not after the system is powered on; if so, restoring by using the backup data of the first backup area; and if not, recovering the effective data blocks backed up by the first backup area and the backup data of the second backup area.
10. The system for maintaining lost data of claim 9, wherein the data recovery module comprises an acquisition unit, a copy unit, and a recovery unit;
the acquiring unit is used for acquiring the data valid flag of each partition area of the first backup area, the data valid flag of the second backup area and the backup serial number;
the copying unit is configured to copy, according to the backup serial number, the data in the second backup area to the corresponding partition area in the first backup area if the data valid flag in the second backup area is valid, set the data valid flag in the corresponding partition area in the first backup area to be valid after the copying is completed, and set the data valid flag in the second backup area to be invalid;
and the recovery unit is used for copying the data of all the effective partition areas of the first backup area to the real-time data area.
CN201910081089.1A 2019-01-28 2019-01-28 Data power failure maintaining method and system Active CN109918228B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910081089.1A CN109918228B (en) 2019-01-28 2019-01-28 Data power failure maintaining method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910081089.1A CN109918228B (en) 2019-01-28 2019-01-28 Data power failure maintaining method and system

Publications (2)

Publication Number Publication Date
CN109918228A CN109918228A (en) 2019-06-21
CN109918228B true CN109918228B (en) 2021-01-12

Family

ID=66960946

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910081089.1A Active CN109918228B (en) 2019-01-28 2019-01-28 Data power failure maintaining method and system

Country Status (1)

Country Link
CN (1) CN109918228B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113760186A (en) 2019-07-30 2021-12-07 华为技术有限公司 Data storage method and device, computing equipment, storage system and storage medium
CN113434338A (en) * 2021-06-25 2021-09-24 苏州伟创电气科技股份有限公司 Fault-tolerant method, device and equipment for data storage and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100426259C (en) * 2005-08-18 2008-10-15 北京中星微电子有限公司 Virtual access method of storage document data
CN100456253C (en) * 2005-12-28 2009-01-28 英业达股份有限公司 Protection method for caching data of memory system
CN103531234B (en) * 2012-07-06 2017-02-08 河南思维自动化设备股份有限公司 Power-down protection method in write operation process of NandFlash memory
CN106919474A (en) * 2015-12-28 2017-07-04 中移(苏州)软件技术有限公司 A kind of data cached guard method and device
KR102547056B1 (en) * 2016-03-28 2023-06-22 에스케이하이닉스 주식회사 Command-address snooping for non-volatile memory module
CN106407050B (en) * 2016-10-20 2020-11-10 科华恒盛股份有限公司 Data storage method
CN106569748B (en) * 2016-10-27 2019-04-09 南方电网科学研究院有限责任公司 The data processing method and device of Flash File System
US10423783B2 (en) * 2016-12-19 2019-09-24 Intel Corporation Methods and apparatus to recover a processor state during a system failure or security event
CN109254879A (en) * 2018-09-27 2019-01-22 南方电网科学研究院有限责任公司 A kind of data processing method, system, device and readable storage medium storing program for executing

Also Published As

Publication number Publication date
CN109918228A (en) 2019-06-21

Similar Documents

Publication Publication Date Title
CN102750191B (en) For starting the method for the refresh operation in solid state, non-volatile memory
US10846008B2 (en) Apparatuses and methods for single level cell caching
US20130254457A1 (en) Methods and structure for rapid offloading of cached data in a volatile cache memory of a storage controller to a nonvolatile memory
US8228753B2 (en) System and method of maintaining data integrity in a flash storage device
CN102541690B (en) Intelligent card and method for recovering data
CN105653345A (en) Method and device supporting data nonvolatile random access
CN109918228B (en) Data power failure maintaining method and system
CN107632943B (en) Solid state disk data protection method and solid state disk
CN112612634A (en) Memory system, operation method of host, and computing system
CN104094240A (en) Preventing hybrid memory module from being mapped
CN107239411A (en) A kind of Vehicle Controller EMS memory management process and system
CN111819549A (en) Backup operation from volatile to non-volatile memory
CN102279757A (en) Method and device for starting system program
WO2017188978A1 (en) Recovering using write data stored by a powerloss data protection technique
CN102314321B (en) Storage system, utilization storage system carry out the method and apparatus of data access
CN112632643A (en) Method for preventing flash memory data loss, solid state disk controller and solid state disk
CN104714757A (en) Refresh Apparatus and Electronic Device
US20100005229A1 (en) Flash memory apparatus and method for securing a flash memory from data damage
JP2007094921A (en) Memory card and control method for it
CN111221750B (en) Data processing method of solid-state storage device
CN109815166B (en) Dynamic recovery processing method of stored data and storage device
CN109284070B (en) Solid-state storage device power-off recovery method based on STT-MRAM
CN111124294B (en) Sector mapping information management method and device, storage medium and equipment
CN111837107A (en) Backup operation from volatile to non-volatile memory
JP2006338083A (en) Memory controller

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