CN112015340A - Nonvolatile data storage structure and storage method - Google Patents
Nonvolatile data storage structure and storage method Download PDFInfo
- Publication number
- CN112015340A CN112015340A CN202010863937.7A CN202010863937A CN112015340A CN 112015340 A CN112015340 A CN 112015340A CN 202010863937 A CN202010863937 A CN 202010863937A CN 112015340 A CN112015340 A CN 112015340A
- Authority
- CN
- China
- Prior art keywords
- nvram
- data
- storage
- storage unit
- block
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 26
- 238000013500 data storage Methods 0.000 title claims abstract description 17
- 230000008569 process Effects 0.000 claims description 13
- 230000001360 synchronised effect Effects 0.000 claims description 10
- 230000003068 static effect Effects 0.000 claims description 9
- 230000007717 exclusion Effects 0.000 claims description 8
- 238000010586 diagram Methods 0.000 description 6
- 230000004048 modification Effects 0.000 description 5
- 238000012986 modification Methods 0.000 description 5
- 238000007726 management method Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000002688 persistence Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 239000004033 plastic Substances 0.000 description 1
- 229920003023 plastic Polymers 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 239000000047 product Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0614—Improving the reliability of storage systems
- G06F3/0619—Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0614—Improving the reliability of storage systems
- G06F3/0616—Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0644—Management of space entities, e.g. partitions, extents, pools
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0662—Virtualisation aspects
- G06F3/0667—Virtualisation aspects at data level, e.g. file, record or object virtualisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0683—Plurality of storage devices
- G06F3/0685—Hybrid storage combining heterogeneous device types, e.g. hierarchical storage, hybrid arrays
Abstract
A non-volatile data storage structure and storage method, the structure includes non-volatile memory cell NVRAM, NVRAM mirror memory cell, NVRAM read-write manager and NVRAM and mirror synchronization unit; the NVRAM comprises N-1 memory blocks with the same memory space size and a BACKUP block; the NVRAM mirror storage unit is used for mirror storage of data in the NVRAM, and comprises N-1 storage blocks with the same storage space size, and the size of each storage block is the same as that of each storage block of the NVRAM; the NVRAM read-write manager performs read-write operation on all data in the NVRAM mirror storage unit through the NVRAM access interface; the NVRAM and mirror synchronization unit is used for synchronizing all data in the non-volatile storage unit NVRAM with all mirror data in the NVRAM mirror storage unit.
Description
Technical Field
The present invention relates to the field of semiconductor manufacturing technologies, and in particular, to a data processing apparatus and a processing method thereof, and more particularly, to a fast and reliable nonvolatile data storage structure and a storage method thereof.
Background
With the continuous improvement of performance and the continuous clarity of various application scenes, industrial robots have been widely applied in the industries of automobiles, electronics, metal products, plastics, chemical products and the like. In automation industries such as industrial robots, it is often necessary to support the execution of certain automation programs, which may need to generate or modify some data quickly, and the modification frequency is very high, which may be more than 10-10,000 times per second. Moreover, these data often need to be not lost after a power outage.
At present, if the above-mentioned high frequency modification requirement of data is to be satisfied, the conventional way is to place the data in a memory (RAM). However, it is clear to those skilled in the art that the memory has a volatile characteristic in that data in the memory is lost immediately after power is turned off.
If the data is not lost after power failure, the data is often required to be written into a medium such as a magnetic disk (HDD or SSD). However, the disk (HDD or SSD) speeds on the market often cannot support such high frequency reading and writing; in addition, a magnetic disk (HDD or SSD) generally reads and writes in units of files, and one file occupies at least one sector, so that even if only one byte is modified, a complete sector is written, which is inefficient; in addition, reading and writing to the high frequency of the disk can quickly consume the life of the disk.
In addition, if the power failure occurs during the writing process of the data, it may happen that part of the data is written and part of the data is not written, and the correctness of the data cannot be guaranteed; moreover, since disk data writing operations are relatively slow and take a long time, the probability of the above situation occurring is relatively high. In industrial applications and the like, where reliability is highly required, this is not negligible and must be taken into account in the design.
Disclosure of Invention
The invention aims to provide a nonvolatile data storage structure and a nonvolatile data storage method, which are suitable for meeting the requirements of high-frequency reading and writing occasions when a robot executes automatically.
In order to achieve the purpose, the technical scheme of the invention is as follows:
a non-volatile data storage structure, comprising:
the NVRAM comprises N-1 memory blocks with the same memory space size and a BACKUP block; each storage block is divided into a first data area and a first attribute area; the first data area is used for storing data needing to be modified quickly, and the first attribute area is used for storing the serial number of the current storage area and the check mark information of the data in the first data area;
an NVRAM mirror storage unit which is a volatile storage unit and is used as the NVRAM mirror storage unit for mirror storage of data in the NVRAM; the NVRAM mirror storage unit comprises N-1 storage blocks with the same storage space size; the storage area of each NVRAM mirror storage unit is the same as the storage space of each NVRAM; each storage block is divided into a second data area and a second attribute area; the second data area is used for storing rapidly changing data, and the second attribute area is used for storing the number of the current storage area and the flag information of the data which are modified and are not synchronized with the data of the non-volatile storage unit NVRAM;
the NVRAM read-write manager is used for receiving data access requests of other program modules and performing read-write operation on all data in the NVRAM mirror storage unit through an NVRAM access interface;
and the NVRAM and mirror image synchronization unit is used for synchronizing all data in the NVRAM of the nonvolatile storage unit with all mirror image data in the NVRAM mirror image storage unit.
Further, the non-volatile storage unit NVRAM includes:
a Static Random Access Memory (SRAM);
the power supply is connected with the Static Random Access Memory (SRAM) and supplies power to the SRAM when the power supply is not powered off; and
and the standby battery is connected with the static random access memory SRAM and supplies power to the static random access memory SRAM when the power supply is powered off.
Further, the NVRAM mirror storage unit is a memory unit.
In order to achieve the above object, another technical solution of the present invention is as follows:
a storage method adopting the non-volatile data storage structure comprises a system starting NVRAM SERVER step, a NVRAM data reading step, a NVRAM data writing process step and a NVRAM and mirror synchronous data step;
the system start NVRAM SERVER step includes:
step S11: when the system is started, sequentially reading data in a first data area of the NVRAM, and checking the consistency of the data in the first data area according to the check information in the first attribute area;
step S12: if the checking result is inconsistent, reading the data in the BACKUP block, checking whether the number of the BACKUP block is consistent with the number of the current block, and if so, overwriting the data in the first data area of the current block with the data in the BACKUP block;
step S13: after all the checks are finished, creating an NVRAM mirror image storage unit according to the specification of a storage block in a NVRAM;
step S14: creating a timer to start a synchronous code process for synchronizing data of a storage block in an NVRAM mirror storage unit and a corresponding storage block in a non-volatile storage unit NVRAM;
the step of reading NVRAM data comprises:
step S21: the control program of the storage industrial robot sends a request for reading NVRAM data to an NVRAM access interface;
step S22: after the NVRAM access interface receives the request, calculating the storage block of the NVRAM data in the NVRAM mirror storage unit and the position of the data in the corresponding NVRAM mirror storage unit, reading the data from the mirror block storage area at the corresponding position of the NVRAM mirror storage unit, and returning the data to the control program of the industrial storage robot;
the step of writing data to the system by the external program comprises the following steps:
step S31: the control program of the storage industrial robot sends a data writing request to an NVRAM access interface;
step S32: after the NVRAM access interface receives the request, calculating the storage block of the data needing to be written in the NVRAM mirror image storage unit and the position of the data in the corresponding NVRAM mirror image storage unit, and requesting to write a mutual exclusion lock;
step S33: writing data to be stored in the control program of the industrial robot into a mirror image block storage area in the NVRAM mirror image storage unit, and setting modified flag information of the data in the second attribute area of the mirror image block in the NVRAM mirror image storage unit as TRUE;
step S34: releasing the write mutex;
the NVRAM synchronizing data with mirroring comprises:
step S41: after the system is started, starting a timer to sequentially scan the mark information of the second attribute area of each storage block in the NVRAM mirror image storage unit at a preset time;
step S42: if the flag information is found to be TRUE, recalculating the check flag information data of the current first data area data, and requesting to write a mutual exclusion lock;
step S43: synchronizing the data block of the second data area with the dirty flag being TRUE to a BACKUP block of a non-volatile memory unit NVRAM;
step S44: writing check information data calculated according to the data in the second data area into a property area of a BACKUP BACKUP block, then synchronizing the data blocks in the NVRAM mirror storage unit into a corresponding storage block in a non-volatile storage unit NVRAM, and writing the check information data into a first property area of the corresponding storage block in the non-volatile storage unit NVRAM;
step S45: and releasing the write exclusive lock, and setting the dirty mark information of the corresponding mirror block in the NVRAM mirror storage unit as FALSE.
According to the technical scheme, the invention provides a non-volatile data storage structure and a storage method, wherein data of an NVRAM mirror image storage unit is synchronized into the NVRAM in an asynchronous mode through a mirror image mode of the NVRAM mirror image storage unit so as to ensure the data access speed, and the change of Int type variables for thousands of times per second can be supported through actual measurement.
In addition, during synchronization, the BACKUP method can still ensure the correctness of data when sudden power failure is ensured by backing up the BACKUP block; in addition, the problem of the service life of a high-frequency read-write magnetic disk can be avoided by a mode of adding a standby power supply to the SRAM. That is, the invention not only ensures the read-write speed, but also ensures the relative real-time and persistence of data operation.
Drawings
FIG. 1 is a diagram illustrating a non-volatile data storage structure according to an embodiment of the present invention
FIG. 2 is a block diagram of a non-volatile memory unit NVRAM according to an embodiment of the present invention
FIG. 3 is a block diagram of an NVRAM mirror memory cell according to an embodiment of the present invention
FIG. 4 is a flow chart illustrating system startup NVRAM SERVER according to an embodiment of the invention
FIG. 5 is a flow chart illustrating a process of reading NVRAM data according to an embodiment of the present invention
FIG. 6 is a flow chart illustrating a process of writing NVRAM data according to an embodiment of the present invention
FIG. 7 is a flow chart illustrating an NVRAM and mirror synchronization data according to an embodiment of the present invention
Detailed Description
The following description of the present invention will be made in detail with reference to the accompanying drawings 1 to 7.
It should be noted that the present invention can perfectly and simultaneously satisfy a plurality of demanding requirements of high frequency modification of data, no loss after power off, high modification efficiency, etc., and is applicable to the application occasions of nonvolatile data with high requirements on high frequency modification and reliability of management data.
In an embodiment of the present invention, the non-volatile data storage structure includes a non-volatile storage unit NVRAM, an NVRAM mirroring storage unit, an NVRAM read-write manager, and an NVRAM and mirroring synchronization unit.
The non-volatile storage unit NVRAM may be used, for example, to store program data of the industrial robot, position information, and other rapidly changing data. A non-volatile memory unit NVRAM is used as a persistent storage device, and a common scheme is that the non-volatile memory unit NVRAM is formed by combining a static memory SRAM, a common power supply and a backup battery, and is used as a peripheral device to be accessed into a computer system through an SPI interface. When the power is off, the standby battery is used for supplying power; of course, other pattern schemes are possible.
The structure of the non-volatile memory unit NVRAM may also be referred to as NVRAM space, which may be divided into many equally sized memory blocks for fine-grained management. Referring to fig. 1, fig. 1 is a schematic diagram illustrating a nonvolatile data storage structure according to an embodiment of the present invention. As shown in fig. 1, the non-volatile memory unit NVRAM may include N-1 memory blocks and a BACKUP block having the same memory space size. Referring to fig. 2, fig. 2 is a block diagram of a non-volatile memory unit NVRAM according to an embodiment of the present invention. As shown in fig. 2, each memory block is divided into a first data area and a first attribute area; the first data area is used for storing data needing to be modified quickly, the first attribute area is used for storing the number of the current storage area and the check mark information of the data in the first data area, one of the blocks is used as a BACKUP function, and the block is named as a BACKUP block; the last block or the first block is usually taken as the BACKUP block.
Referring to fig. 1, the NVRAM mirror memory unit is a volatile memory unit, such as a memory unit. The purpose of memory mirroring is to mirror data in the non-volatile memory unit NVRAM. The number of data blocks in the memory image is only one BACKUP block less than the NVRAM. That is, if the non-volatile memory unit NVRAM has N memory blocks, then the NVRAM mirror memory unit has only N-1 memory blocks.
Referring to fig. 3, fig. 3 is a block structure diagram of an NVRAM mirror memory cell according to an embodiment of the present invention. As shown in fig. 3, the NVRAM mirrors an N-1 memory block in the memory unit for mirroring data in the non-volatile memory unit NVRAM; the memory unit comprises N-1 memory blocks with the same size of memory space; the storage area of each memory unit is the same as the storage space of each non-volatile storage unit NVRAM; each storage block is divided into a second data area and a second attribute area; the second data area is used for storing rapidly changing data, and the second attribute area is used for storing the number of the current storage area and the flag information of the data which are modified and are not synchronized with the data of the non-volatile storage unit NVRAM. Specifically, the second attribute area is slightly different from the first attribute area, and includes the number of the block and a ' dirty ' flag (dirty ' means that data is modified and not synchronized into NVRAM), and so on.
In the embodiment of the present invention, there is also an important unit, namely, an NVRAM read-write manager, through which all data operations in the NVRAM by external programs must be performed. That is to say, the NVRAM read-write manager is configured to receive a data access request from another program module, and perform read-write operation on all data in the non-volatile storage unit NVRAM through the NVRAM access interface, and specifically, the NVRAM read-write manager allocates in advance what data each block is used to store, so that when an external program (for example, a control program of an industrial robot) reads and writes some data in the non-volatile storage unit NVRAM, it can know which data to read from and write the data to.
And the NVRAM and mirror image synchronization unit is used for synchronizing all data in the NVRAM with all mirror image data in the NVRAM mirror image storage unit when starting a control program of the industrial robot.
After the structural framework is completed, the storage method adopting the nonvolatile data storage structure can be operated, and the method comprises four steps of system starting NVRAM SERVER, NVRAM data reading, NVRAM data writing, NVRAM and mirror image synchronization data. The steps can be performed synchronously or step by step, for example, the step of mirroring synchronous data can be started at a fixed time or performed when the system is idle.
Referring to fig. 4, fig. 4 is a flow chart illustrating a system startup NVRAM SERVER according to an embodiment of the invention. As shown in FIG. 4, the system boot NVRAM SERVER step is a system boot initialization process that, when started, initiates a system boot NVRAM SERVER process. The system starts NVRAM SERVER reading data in the first data area of each storage block of the non-volatile memory unit NVRAM, and checking the correctness of the data in the current storage block according to the check mark information of the data in the first data area in the first attribute area; if not, it tries to check if the BACKUP block is consistent with the current block, and if so, overwrites the block data with the data in the BACKUP block. After the check is completed, a mirror block of a non-volatile storage unit NVRAM is created in an NVRAM mirror storage unit (memory), and then a timer is created to start a synchronization code process for synchronizing data in the NVRAM mirror storage unit and the non-volatile storage unit NVRAM.
Specifically, the system start NVRAM SERVER step includes:
step S11: when the system is started, sequentially reading data in a first data area of the NVRAM, and checking the consistency of the data in the first data area according to the check information in the first attribute area;
step S12: if the checking result is inconsistent, reading the data in the BACKUP block, checking whether the number of the BACKUP block is consistent with the number of the current block, and if so, overwriting the data in the first data area of the current block with the data in the BACKUP block;
step S13: after all the checks are finished, creating an NVRAM mirror image storage unit according to the specification of a storage block in a NVRAM;
step S14: a timer is created to start a synchronization code process for synchronizing data of a memory block in the NVRAM mirror memory unit with a corresponding memory block in the non-volatile memory unit NVRAM.
Referring to fig. 5, fig. 5 is a flow chart illustrating NVRAM data reading according to an embodiment of the invention. As shown in fig. 5, when an external program (or another module) needs to read the non-volatile storage unit NVRAM data, a request must be sent to the NVRAM access interface. And after receiving the request, the NVRAM access interface reads out data from the mirror block in the NVRAM mirror storage unit and returns the data to the external program. Therefore, since the data in the non-volatile storage unit NVRAM is not actually read, the data is read only from the mirror block in the NVRAM mirror storage unit, and an effect that the data reading speed is fast can be achieved.
Specifically, the step of reading NVRAM data includes:
step S21: the control program of the storage industrial robot sends a request for reading NVRAM data to an NVRAM access interface;
step S22: and after receiving the request, the NVRAM access interface calculates the storage area of the NVRAM data in the NVRAM mirror storage unit and the position of the data in the corresponding NVRAM mirror storage unit, reads the data from the mirror block storage area at the corresponding position of the NVRAM mirror storage unit, and returns the data to the control program of the industrial storage robot.
Referring to fig. 6, fig. 6 is a schematic flow chart illustrating a process of writing NVRAM data according to an embodiment of the present invention. As shown in fig. 6, when an external program (or another module) needs to write data in the non-volatile storage unit NVRAM, a request for writing data needs to be sent to the NVRAM access module. The NVRAM access module receives a data writing request, which is actually writing a data to a certain block of the NVRAM mirror storage unit image, and the data is not directly written into the non-volatile storage unit NVRAM, so that the data writing speed is high, and the flag information (dirty flag) of the second attribute area of the storage block of the NVRAM mirror storage unit which is written is set to TRUE.
Specifically, the step of writing data to the system by the external program includes:
step S31: the control program of the storage industrial robot sends a data writing request to an NVRAM access interface;
step S32: after the NVRAM access interface receives the request, calculating the storage block of the data needing to be written in the NVRAM mirror image storage unit and the position of the data in the corresponding NVRAM mirror image storage unit, and requesting to write a mutual exclusion lock;
step S33: writing data to be stored in the control program of the industrial robot into a mirror image block storage area in the NVRAM mirror image storage unit, and setting the mark information of a second attribute area of the mirror image block in the NVRAM mirror image storage unit as TRUE;
step S34: and releasing the write mutual exclusion lock.
Referring to fig. 7, fig. 7 is a schematic flow chart illustrating a NVRAM and mirror synchronization data according to an embodiment of the present invention. As shown in fig. 7, after the step NVRAM SERVER of starting the system is completed, a timer is started, and when the system is idle, the timer scans the flag information (dirty flag) of each storage block in the NVRAM image storage unit to determine whether the storage block is dirty or not. If the dirty mark information is found to be TRUE, recalculating the check information data in the first attribute area, and requesting to write a mutual exclusion lock; synchronizing the data block of the second data area with the dirty flag TRUE to the BACKUP block; writing the check information data in the first attribute area into the attribute area of the BACKUP BACKUP block, then synchronizing the data block in the NVRAM mirror storage unit into the corresponding storage block in the NVRAM, and writing the check information data in the first attribute area into the first attribute area of the corresponding storage block in the NVRAM; and after the completion, releasing the write exclusive lock, and setting the dirty mark information of the mirror block in the NVRAM mirror storage unit as FALSE.
Specifically, the NVRAM and mirror synchronizing data step includes:
step S41: after the system is started, starting a timer to sequentially scan the mark information of the second attribute area of each storage block in the NVRAM mirror image storage unit at a preset time;
step S42: if the flag information is found to be TRUE, recalculating the check flag information data of the current first data area data, and requesting to write a mutual exclusion lock;
step S43: synchronizing the data block of the second data area with the dirty flag being TRUE to a BACKUP block of a non-volatile memory unit NVRAM;
step S44: writing check information data calculated according to the data in the second data area into a property area of a BACKUP BACKUP block, then synchronizing the data blocks in the NVRAM mirror storage unit into a corresponding storage block in a non-volatile storage unit NVRAM, and writing the check information data into a first property area of the corresponding storage block in the non-volatile storage unit NVRAM;
step S45: and releasing the write exclusive lock, and setting the dirty mark information of the corresponding mirror block in the NVRAM mirror storage unit as FALSE.
In the embodiment of the invention, if the power failure occurs in the writing process of the data, the correctness of the data can still be ensured. Specifically, the power failure of data during writing can be classified into the following two cases:
if the BACKUP block is forcibly powered off in the process of synchronizing to the BACKUP block, the data in the BACKUP data block is incomplete, but at the moment, the data can still realize the integrity through operation because the content in the target data block is not changed.
And if the process of synchronously backing up the data in the BACKUP block is finished and power-off occurs when the data in the target block is synchronized, the data in the BACKUP block is complete. When the system is restarted, i.e. at system start-up NVRAM SERVER (initialization step), the checking can be done and the data can be restored.
The above description is only for the preferred embodiment of the present invention, and the embodiment is not intended to limit the scope of the present invention, so that all the equivalent structural changes made by using the contents of the description and the drawings of the present invention should be included in the scope of the present invention.
Claims (4)
1. A non-volatile data storage structure, comprising:
the NVRAM comprises N-1 memory blocks with the same memory space size and a BACKUP block; each storage block is divided into a first data area and a first attribute area; the first data area is used for storing data needing to be modified quickly, and the first attribute area is used for storing the serial number of the current storage area and the check mark information of the data in the first data area;
an NVRAM mirror storage unit which is a volatile storage unit and is used as the NVRAM mirror storage unit for mirror storage of data in the NVRAM; the NVRAM mirror storage unit comprises N-1 storage blocks with the same storage space size; the storage area of each NVRAM mirror storage unit is the same as the storage space of each NVRAM; each storage block is divided into a second data area and a second attribute area; the second data area is used for storing rapidly changing data, and the second attribute area is used for storing the number of the current storage area and the flag information of the data which are modified and are not synchronized with the data of the non-volatile storage unit NVRAM;
the NVRAM read-write manager is used for receiving data access requests of other program modules and performing read-write operation on all data in the NVRAM mirror storage unit through an NVRAM access interface;
and the NVRAM and mirror image synchronization unit is used for synchronizing all data in the NVRAM of the nonvolatile storage unit with all mirror image data in the NVRAM mirror image storage unit.
2. The non-volatile data storage structure of claim 1, wherein the non-volatile storage unit NVRAM comprises:
a Static Random Access Memory (SRAM);
the power supply is connected with the Static Random Access Memory (SRAM) and supplies power to the SRAM when the power supply is not powered off; and
and the standby battery is connected with the static random access memory SRAM and supplies power to the static random access memory SRAM when the power supply is powered off.
3. The non-volatile data storage structure of claim 1, wherein the NVRAM mirrored storage unit is a memory unit.
4. A storage method using the non-volatile data storage structure of claim 1, comprising a system boot NVRAM SERVER step, a read NVRAM data step, a write NVRAM data process step, and a NVRAM and mirror synchronization data step;
the system start NVRAM SERVER step includes:
step S11: when the system is started, sequentially reading data in a first data area of the NVRAM, and checking the consistency of the data in the first data area according to the check information in the first attribute area;
step S12: if the checking result is inconsistent, reading the data in the BACKUP block, checking whether the number of the BACKUP block is consistent with the number of the current block, and if so, overwriting the data in the first data area of the current block with the data in the BACKUP block;
step S13: after all the checks are finished, creating an NVRAM mirror image storage unit according to the specification of a storage block in a NVRAM;
step S14: creating a timer to start a synchronous code process for synchronizing data of a storage block in an NVRAM mirror storage unit and a corresponding storage block in a non-volatile storage unit NVRAM;
the step of reading NVRAM data comprises:
step S21: the control program of the storage industrial robot sends a request for reading NVRAM data to an NVRAM access interface;
step S22: after the NVRAM access interface receives the request, calculating the storage block of the NVRAM data in the NVRAM mirror storage unit and the position of the data in the corresponding NVRAM mirror storage unit, reading the data from the mirror block storage area at the corresponding position of the NVRAM mirror storage unit, and returning the data to the control program of the industrial storage robot;
the step of writing data to the system by the external program comprises the following steps:
step S31: the control program of the storage industrial robot sends a data writing request to an NVRAM access interface;
step S32: after the NVRAM access interface receives the request, calculating the storage block of the data needing to be written in the NVRAM mirror image storage unit and the position of the data in the corresponding NVRAM mirror image storage unit, and requesting to write a mutual exclusion lock;
step S33: writing data to be stored in the control program of the industrial robot into a mirror image block storage area in the NVRAM mirror image storage unit, and setting modified flag information of the data in the second attribute area of the mirror image block in the NVRAM mirror image storage unit as TRUE;
step S34: releasing the write mutex;
the NVRAM synchronizing data with mirroring comprises:
step S41: after the system is started, starting a timer to sequentially scan the mark information of the second attribute area of each storage block in the NVRAM mirror image storage unit at a preset time;
step S42: if the flag information is found to be TRUE, recalculating the check flag information data of the current first data area data, and requesting to write a mutual exclusion lock;
step S43: synchronizing the data block of the second data area with the dirty flag being TRUE to a BACKUP block of a non-volatile memory unit NVRAM;
step S44: writing check information data calculated according to the data in the second data area into a property area of a BACKUP BACKUP block, then synchronizing the data blocks in the NVRAM mirror storage unit into a corresponding storage block in a non-volatile storage unit NVRAM, and writing the check information data into a first property area of the corresponding storage block in the non-volatile storage unit NVRAM;
step S45: and releasing the write exclusive lock, and setting the dirty mark information of the corresponding mirror block in the NVRAM mirror storage unit as FALSE.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010863937.7A CN112015340A (en) | 2020-08-25 | 2020-08-25 | Nonvolatile data storage structure and storage method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010863937.7A CN112015340A (en) | 2020-08-25 | 2020-08-25 | Nonvolatile data storage structure and storage method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112015340A true CN112015340A (en) | 2020-12-01 |
Family
ID=73505920
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010863937.7A Pending CN112015340A (en) | 2020-08-25 | 2020-08-25 | Nonvolatile data storage structure and storage method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112015340A (en) |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2097783A1 (en) * | 1992-06-05 | 1993-12-06 | Stephen M. Schultz | Method and apparatus for maintaining and retrieving live data in a posted write cache in case of power failure |
KR19980076636A (en) * | 1997-04-11 | 1998-11-16 | 윤종용 | How to protect your data in case of power failure |
JP2000047830A (en) * | 1998-05-26 | 2000-02-18 | Nec Software Ltd | Device and method for mirror disk access |
US20040059869A1 (en) * | 2002-09-20 | 2004-03-25 | Tim Orsley | Accelerated RAID with rewind capability |
US20070101077A1 (en) * | 2005-10-28 | 2007-05-03 | International Business Machines Corporation | Mirroring system memory in non-volatile random access memory (NVRAM) for fast power on/off cycling |
US7702863B1 (en) * | 2003-07-01 | 2010-04-20 | Symantec Operating Corporation | Method of data caching in mirrored storage |
CN102594858A (en) * | 2010-11-19 | 2012-07-18 | 马维尔国际贸易有限公司 | Mirroring solution in cloud storage environment |
CN103076989A (en) * | 2012-11-27 | 2013-05-01 | 厦门美亚中敏电子科技有限公司 | High-speed mirror image method of computer storage mediums |
CN103544045A (en) * | 2013-10-16 | 2014-01-29 | 南京大学镇江高新技术研究院 | HDFS-based virtual machine image storage system and construction method thereof |
CN105556520A (en) * | 2013-09-21 | 2016-05-04 | 甲骨文国际公司 | Mirroring, in memory, data from disk to improve query performance |
CN108874695A (en) * | 2017-05-11 | 2018-11-23 | 西部数据技术公司 | Data are saved when electric power is closed |
-
2020
- 2020-08-25 CN CN202010863937.7A patent/CN112015340A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2097783A1 (en) * | 1992-06-05 | 1993-12-06 | Stephen M. Schultz | Method and apparatus for maintaining and retrieving live data in a posted write cache in case of power failure |
KR19980076636A (en) * | 1997-04-11 | 1998-11-16 | 윤종용 | How to protect your data in case of power failure |
JP2000047830A (en) * | 1998-05-26 | 2000-02-18 | Nec Software Ltd | Device and method for mirror disk access |
US20040059869A1 (en) * | 2002-09-20 | 2004-03-25 | Tim Orsley | Accelerated RAID with rewind capability |
US7702863B1 (en) * | 2003-07-01 | 2010-04-20 | Symantec Operating Corporation | Method of data caching in mirrored storage |
US20070101077A1 (en) * | 2005-10-28 | 2007-05-03 | International Business Machines Corporation | Mirroring system memory in non-volatile random access memory (NVRAM) for fast power on/off cycling |
CN102594858A (en) * | 2010-11-19 | 2012-07-18 | 马维尔国际贸易有限公司 | Mirroring solution in cloud storage environment |
CN103076989A (en) * | 2012-11-27 | 2013-05-01 | 厦门美亚中敏电子科技有限公司 | High-speed mirror image method of computer storage mediums |
CN105556520A (en) * | 2013-09-21 | 2016-05-04 | 甲骨文国际公司 | Mirroring, in memory, data from disk to improve query performance |
CN103544045A (en) * | 2013-10-16 | 2014-01-29 | 南京大学镇江高新技术研究院 | HDFS-based virtual machine image storage system and construction method thereof |
CN108874695A (en) * | 2017-05-11 | 2018-11-23 | 西部数据技术公司 | Data are saved when electric power is closed |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7472139B2 (en) | Database recovery method applying update journal and database log | |
CN102084350B (en) | Verification of remote copies of data | |
EP1504346B1 (en) | Method and apparatus for creating a virtual data copy | |
US7587562B2 (en) | Data duplication system, data duplication method and program | |
US8516208B2 (en) | Data backup method and information processing apparatus | |
CN112965856B (en) | Backup data-based fast fine-grained recovery method and device | |
US7664910B2 (en) | Data management method and apparatus, hierarchical storage apparatus and computer-readable storage medium | |
US20030229819A1 (en) | Method and apparatus for data backup and recovery | |
TW432333B (en) | Method and apparatus for mapping hard disk partitions and block devices to logical drives in a computer system | |
US20180143886A1 (en) | Method for Rebuilding a Mapping Table of a Solid State Disk | |
CN115098299B (en) | Backup method, disaster recovery method, device and equipment of virtual machine | |
CN103810060A (en) | Data backup method and system thereof based on distributed database | |
US6205526B1 (en) | Device and method for backing up internal information and storage medium having internal information backup control program stored thereon | |
US7013317B2 (en) | Method for backup and storage system | |
CN111198780B (en) | Apparatus and method for performing a restore operation of a memory system | |
CN109189480B (en) | File system starting method and device | |
US7529968B2 (en) | Storing RAID configuration data within a BIOS image | |
US7600151B2 (en) | RAID capacity expansion interruption recovery handling method and system | |
CN112015340A (en) | Nonvolatile data storage structure and storage method | |
CN115328704A (en) | File backup method, file recovery method, device, equipment and storage medium | |
US20130262804A1 (en) | Data duplication system, data duplication method, and program thereof | |
JPH0981405A (en) | Retry processor of computer system | |
CN106599046B (en) | Writing method and device of distributed file system | |
CN111209132A (en) | Embedded system, power failure protection method, electronic device 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 |