CN112015340B - Nonvolatile data storage structure and storage method - Google Patents
Nonvolatile data storage structure and storage method Download PDFInfo
- Publication number
- CN112015340B CN112015340B CN202010863937.7A CN202010863937A CN112015340B CN 112015340 B CN112015340 B CN 112015340B CN 202010863937 A CN202010863937 A CN 202010863937A CN 112015340 B CN112015340 B CN 112015340B
- Authority
- CN
- China
- Prior art keywords
- data
- nvram
- block
- storage unit
- storage
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 26
- 238000013500 data storage Methods 0.000 title claims abstract description 17
- 230000001360 synchronised effect Effects 0.000 claims description 10
- 230000007717 exclusion Effects 0.000 claims description 7
- 230000003068 static effect Effects 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 7
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 230000006870 function Effects 0.000 description 2
- 238000005352 clarification Methods 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
- 238000007726 management method Methods 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
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
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A nonvolatile data storage structure and a storage method, the structure includes a nonvolatile storage unit NVRAM, a NVRAM mirror storage unit, a NVRAM read/write manager, and a NVRAM and mirror synchronization unit; the nonvolatile memory unit NVRAM comprises an N-1 memory block and a BACKUP block, wherein the N-1 memory block and the BACKUP block have the same memory space size; the NVRAM mirror image storage unit is used for mirror image storage of data in the non-volatile storage unit NVRAM, and comprises N-1 storage blocks with the same storage space size, wherein the size of each storage block is the same as that of each non-volatile storage unit NVRAM; the NVRAM read-write manager performs read-write operation on all data in the NVRAM mirror image 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 technology, 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.
Background
With the continuous improvement of performance and the continuous clarification of various application scenes, industrial robots have been widely applied to industries such as automobiles, electronics, metal products, plastics, chemical products and the like. In the automation industry, such as industrial robots, it is often necessary to support some kind of automation program execution, which may require the rapid generation or modification of some data, which is very frequent, possibly up to 10 to 10,000 times per second. Moreover, such data often needs to be not lost after power failure.
Currently, if the above-mentioned high frequency modification requirement of data is to be met, 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 the characteristic of being volatile, i.e., the data in the memory is lost immediately after power is removed.
If the requirement that the data is not lost after power failure is met, 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 reads and writes; in addition, the 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, the entire one sector is written, which is inefficient; in addition, the high frequency reading and writing of the magnetic disk can quickly consume the service life of the magnetic disk.
In addition, if the data is powered off in the writing process, partial data may be written, partial data is not written, and the correctness of the data cannot be guaranteed; moreover, since disk data writing operations are relatively slow and time consuming, the probability of the above situation occurring is relatively high. In the case of industrial applications, which require high reliability, the design must be considered.
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 read-write occasions when a robot automatically executes.
In order to achieve the above purpose, the technical scheme of the invention is as follows:
A non-volatile data storage structure, comprising:
The nonvolatile memory unit NVRAM comprises an N-1 memory block and a BACKUP block, wherein the N-1 memory block and the BACKUP block have the same memory space size; 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 quickly modified, and the first attribute area is used for storing the number of the current storage area and the check mark information of the data of the first data area;
an NVRAM image storage unit, which is a volatile storage unit, serving as the NVRAM image storage unit for image-storing data in the non-volatile storage unit NVRAM; the NVRAM mirror image storage unit comprises N-1 storage blocks with the same storage space size; the storage area of each NVRAM mirror image storage unit is the same as the storage space of each nonvolatile 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 the data which changes rapidly, the second attribute area is used for storing the number of the current storage area and the mark information of the NVRAM data of the non-volatile storage unit, the data of which are modified and not synchronized;
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 image 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 nonvolatile memory unit NVRAM includes:
static random access memory SRAM;
the power supply is connected with the SRAM and supplies power to the SRAM when the power supply is not powered off; and
And the standby battery is connected with the SRAM and supplies power to the 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, a further technical solution of the present invention is as follows:
The storage method adopting the nonvolatile 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 image synchronous data step;
The system start-up NVRAM SERVER step includes:
Step S11: when the system is started, sequentially reading data in a first data area of the nonvolatile memory unit NVRAM, and checking consistency of the data in the first data area according to check information in a 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, covering the data in the first data area of the current block by the data in the BACKUP block;
step S13: after all the checks are completed, creating an NVRAM mirror image storage unit according to the storage block specification in the NVRAM of the nonvolatile storage unit;
Step S14: creating a timer to start a synchronous code process at regular time, which is used for synchronizing the storage blocks in the NVRAM mirror storage unit with the data of the corresponding storage blocks in the NVRAM of the nonvolatile storage unit;
the step of reading NVRAM data includes:
Step S21: the control program of the storage industrial robot sends a NVRAM data reading request to a NVRAM access interface;
Step S22: after receiving the request, the NVRAM access interface calculates the storage block in which the NVRAM data is stored 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 in the corresponding position of the NVRAM mirror storage unit, and returns the data to the control program of the storage industrial robot;
the process steps of the external program for writing data to the system comprise 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 position of the data which is required to be written in the storage block in the NVRAM mirror storage unit and the position of the data in the corresponding NVRAM mirror storage unit, and requesting to write a mutual exclusion lock;
Step S33: writing data to be stored in the control program of the storage industrial robot into a mirror image block storage area in the NVRAM mirror image storage unit, and setting modified flag information of data in a second attribute area of the mirror image block in the NVRAM mirror image storage unit as TRUE;
step S34: releasing the write exclusive lock;
The step of synchronizing the NVRAM and the mirror image comprises the following steps:
Step S41: after the system is started, a timer is started 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 check flag information data of the current first data area data, and requesting to write a mutual exclusion lock;
step S43: firstly synchronizing a data block of a second data area with a dirty flag as TRUE into a BACKUP block of a nonvolatile memory unit NVRAM;
Step S44: writing the check information data calculated according to the data in the second data area into the attribute area of the BACKUP block, synchronizing the data block in the NVRAM mirror storage unit into the corresponding storage block in the NVRAM, and writing the check information data into the first attribute area of the corresponding storage block in the NVRAM;
Step S45: releasing the write exclusive lock and setting dirty flag information of a corresponding mirror block in the NVRAM mirror storage unit to FALSE.
According to the technical scheme, the invention provides the nonvolatile data storage structure and the storage method, the data of the NVRAM mirror image storage unit is synchronized into the NVRAM of the nonvolatile storage unit in an asynchronous mode through the mirror image mode of the NVRAM mirror image storage unit, so that the data access speed is ensured, and thousands of changes of the Int variable per second can be supported by actual measurement.
In addition, during synchronization, the invention ensures that the correctness of data can be still ensured when sudden power failure occurs through backing up the BACKUP block; and the problem of the service life of the high-frequency read-write disk can be avoided by adding a standby power supply to the SRAM. That is, the invention not only ensures the read-write speed, but also can ensure the relative real-time and persistence of the data operation.
Drawings
FIG. 1 is a schematic diagram of a nonvolatile data storage structure according to an embodiment of the invention
FIG. 2 is a block diagram illustrating a non-volatile memory unit NVRAM according to an embodiment of the present invention
FIG. 3 is a block diagram illustrating an NVRAM mirror storage unit in accordance with an embodiment of the present invention
FIG. 4 is a flow chart of a system start NVRAM SERVER in an embodiment of the present invention
FIG. 5 is a flow chart of reading NVRAM data according to an embodiment of the invention
FIG. 6 is a flow chart of writing NVRAM data in an embodiment of the invention
FIG. 7 is a schematic diagram illustrating a process of synchronizing data between NVRAM and mirror in an embodiment of the present invention
Detailed Description
The following describes embodiments of the present invention in further detail with reference to FIGS. 1-7.
It should be noted that the invention can perfectly meet a plurality of harsh requirements of high-frequency data modification, no loss after power failure, high modification efficiency and the like, and is applicable to application occasions of high-frequency data modification and high reliability requirement of nonvolatile data for managing data.
In an embodiment of the present invention, such a nonvolatile data storage structure includes a nonvolatile storage unit NVRAM, a NVRAM mirror storage unit, a NVRAM read/write manager, and a NVRAM and mirror synchronization unit.
The nonvolatile memory unit NVRAM may be used to store, for example, program data of an industrial robot, rapidly changing data of position information, and the like. The non-volatile memory unit NVRAM is used as a persistent memory device, and one common scheme is formed by combining a static memory SRAM with a common power supply and a standby battery, and is used as a peripheral device to be connected into a computer system through an SPI interface. When the power is not cut off, the normal power supply is used for supplying power, and when the power is cut off, the standby battery is used for supplying power; of course, other modes schemes are also possible.
The structure of the nonvolatile memory unit NVRAM may also be referred to as NVRAM space, and the NVRAM space may be divided into a plurality of memory blocks of the same size for fine management. Referring to fig. 1, fig. 1 is a schematic diagram of a nonvolatile data storage structure according to an embodiment of the invention. As shown in fig. 1, the nonvolatile memory unit NVRAM may include an N-1 memory block and a BACKUP block having the same memory size. Referring to fig. 2, fig. 2 is a block diagram of a nonvolatile memory unit NVRAM according to an embodiment of the invention. As shown in fig. 2, 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 quickly modified, the first attribute area is used for storing the number of the current storage area and the check mark information of the data of the first data area, one of the data areas is taken as a BACKUP function, and the BACKUP function is named as a BACKUP block; the last block or the first block is typically taken as the BACKUP block.
Referring to fig. 1, the nvram mirror storage unit is a volatile storage unit, such as a memory unit. The memory mirroring purpose is to mirror the data in the non-volatile storage unit NVRAM. So the number of data blocks in the memory mirror image is 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 diagram of an NVRAM mirror memory unit according to an embodiment of the invention. As shown in fig. 3, the N-1 memory block in the NVRAM mirror memory unit is used for mirror-storing the data in the non-volatile memory unit NVRAM; the memory unit comprises N-1 memory blocks with the same memory space size; the storage area of each memory unit is the same as the storage space of each nonvolatile 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 mark information of the NVRAM data of the non-volatile storage unit, which is modified and not synchronized. Specifically, the second attribute area is slightly different from the first attribute area, and includes the number of the present block and a ' dirty ' flag (dirty ' means that the data is modified and not synchronized into the NVRAM), and so on.
In the embodiment of the invention, an important unit is an NVRAM read-write manager, and all data operations in the NVRAM by external programs are required to be performed through the NVRAM read-write manager. That is, the NVRAM read/write manager is configured to receive data access requests of other program modules, and perform read/write operations on all data in the non-volatile storage unit NVRAM through the NVRAM access interface, specifically, the NVRAM read/write manager may allocate in advance what data each block is configured to store, so that when an external program (for example, a control program of the industrial robot) reads and writes certain data in the non-volatile storage unit NVRAM, it can know which data should be read from and written to.
And when the NVRAM and mirror image synchronization unit is used for starting the control program of the industrial robot, all data in the non-volatile storage unit NVRAM and all mirror image data in the NVRAM mirror image storage unit are synchronized.
After the above structure is completed, the storage method adopting the above nonvolatile data storage structure of the present invention can be operated, and the method includes four steps of system start NVRAM SERVER, NVRAM data reading, NVRAM data writing, and NVRAM and mirror synchronization. The steps can be performed synchronously or stepwise, for example, the step of mirroring synchronous data can be started at fixed time or performed when the system is idle.
Referring to fig. 4, fig. 4 is a schematic flow chart of a system start NVRAM SERVER in an embodiment of the invention. As shown in fig. 4, the system start NVRAM SERVER is a system start initialization process, which starts a system start NVRAM SERVER process when the system starts. The system is started NVRAM SERVER to read the data in the first data area of each storage block of the nonvolatile storage unit NVRAM, and check 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, an attempt is made to check whether the BACKUP block is consistent with the current memory block, and if so, the data in the BACKUP block is overwritten with the data in the BACKUP block. After the completion of the check, a mirror block of the nonvolatile memory cell NVRAM is created in the NVRAM mirror memory cell (memory), and then a timer is created to start the synchronization code process for synchronizing the data in the NVRAM mirror memory cell and the nonvolatile memory cell NVRAM.
Specifically, the system start-up NVRAM SERVER step includes:
Step S11: when the system is started, sequentially reading data in a first data area of the nonvolatile memory unit NVRAM, and checking consistency of the data in the first data area according to check information in a 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, covering the data in the first data area of the current block by the data in the BACKUP block;
step S13: after all the checks are completed, creating an NVRAM mirror image storage unit according to the storage block specification in the NVRAM of the nonvolatile storage unit;
step S14: a timer is created to start a synchronization code process for synchronizing the memory blocks in the NVRAM mirror memory locations with the data of the corresponding memory blocks in the non-volatile memory locations NVRAM.
Referring to fig. 5, fig. 5 is a schematic flow chart of reading NVRAM data according to an embodiment of the invention. As shown in fig. 5, when an external program (or another module) needs to read the nonvolatile memory 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 image block in the NVRAM mirror image storage unit and returns the data to an external program. Therefore, since the data in the nonvolatile memory unit NVRAM is not actually read, the data is read only from the mirror block in the NVRAM mirror memory unit, and an effect of a fast data reading speed can be achieved.
Specifically, the step of reading NVRAM data includes:
Step S21: the control program of the storage industrial robot sends a NVRAM data reading request to a NVRAM access interface;
step S22: and after receiving the request, the NVRAM access interface calculates the position of the NVRAM data stored in one storage block 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 in the corresponding position of the NVRAM mirror storage unit, and returns the data to the control program of the storage industrial robot.
Referring to fig. 6, fig. 6 is a schematic flow chart of writing NVRAM data in an embodiment of the invention. As shown in fig. 6, when an external program (or another module) needs to write data in the nonvolatile memory unit NVRAM, a data writing request needs to be sent to the NVRAM access module. The write data request received by the NVRAM access module is actually a data write to a certain block of the NVRAM mirror storage unit image, and is not directly written to the non-volatile storage unit NVRAM, so the speed of writing the data is fast, and the flag information (dirty flag) of the second attribute area of the storage block of the written NVRAM mirror storage unit is then set to TRUE.
Specifically, the process steps of the external program for writing data to the system comprise 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 position of the data which is required to be written in the storage block in the NVRAM mirror storage unit and the position of the data in the corresponding NVRAM mirror storage unit, and requesting to write a mutual exclusion lock;
Step S33: writing data to be stored in the control program of the storage industrial robot into a mirror image block storage area in the NVRAM mirror image storage unit, and setting flag information of a second attribute area of the mirror image block in the NVRAM mirror image storage unit as TRUE;
step S34: releasing the write exclusive lock.
Referring to fig. 7, fig. 7 is a schematic flow chart of synchronizing data between NVRAM and mirror image in an embodiment of the invention. As shown in fig. 7, after the system is started NVRAM SERVER, a timer is started, and when the timer is idle, the timer scans the flag information (dirty flag) of each storage block in the NVRAM mirror storage unit to determine whether the system is dirty. If the dirty flag 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 as TRUE to the BACKUP block; writing the check information data in the first attribute area into the attribute area of the BACKUP block, synchronizing the data block in the NVRAM mirror storage unit into the corresponding storage block in the non-volatile storage unit NVRAM, and writing the check information data in the first attribute area into the first attribute area of the corresponding storage block in the non-volatile storage unit NVRAM; after the completion, the write exclusive lock is released, and the dirty flag information of the mirror block in the NVRAM mirror storage unit is set to be FALSE.
Specifically, the step of synchronizing the NVRAM with the mirror image includes:
Step S41: after the system is started, a timer is started 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 check flag information data of the current first data area data, and requesting to write a mutual exclusion lock;
step S43: firstly synchronizing a data block of a second data area with a dirty flag as TRUE into a BACKUP block of a nonvolatile memory unit NVRAM;
Step S44: writing the check information data calculated according to the data in the second data area into the attribute area of the BACKUP block, synchronizing the data block in the NVRAM mirror storage unit into the corresponding storage block in the NVRAM, and writing the check information data into the first attribute area of the corresponding storage block in the NVRAM;
Step S45: releasing the write exclusive lock and setting dirty flag information of a corresponding mirror block in the NVRAM mirror storage unit to FALSE.
In the embodiment of the invention, if the data is powered off in the writing process, the correctness of the data can be ensured. Specifically, the occurrence of power failure of data during writing can be classified into the following two cases:
① . When 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 this time, the integrity of the data can still be realized through operation because the content in the target data block is not changed.
② . If the process of synchronizing the BACKUP block data has been completed, a power-off occurs while synchronizing the data in the target block, the BACKUP block data is complete. When the system is restarted, i.e., at system start-up NVRAM SERVER (initialization step), the check can be completed and the data restored.
The foregoing description is only of the preferred embodiments of the present invention, and the embodiments are not intended to limit the scope of the invention, so that all changes made in the equivalent structures of the present invention described in the specification and the drawings are included in the scope of the invention.
Claims (4)
1. A non-volatile data storage structure, comprising:
The nonvolatile memory unit NVRAM comprises an N-1 memory block and a BACKUP block, wherein the N-1 memory block and the BACKUP block have the same memory space size; 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 quickly modified, and the first attribute area is used for storing the number of the current storage area and the check mark information of the data of the first data area;
an NVRAM mirror image storage unit which is a volatile storage unit and is used for mirror image storage of data in the NVRAM of the nonvolatile storage unit; the NVRAM mirror image storage unit comprises N-1 storage blocks with the same storage space size; the storage area of each NVRAM mirror image storage unit is the same as the storage space of each nonvolatile 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 the data which changes rapidly, the second attribute area is used for storing the number of the current storage area and the mark information of the NVRAM data of the non-volatile storage unit, the data of which are modified and not synchronized;
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 image storage unit through an NVRAM access interface;
an NVRAM and mirror synchronization unit for synchronizing all data in the NVRAM of the nonvolatile storage unit with all mirror data in the NVRAM mirror storage unit; wherein,
When the system is started, starting a timer to sequentially scan the dirty mark information of the second attribute area of each storage block in the NVRAM mirror image storage unit at a preset time; if the dirty flag information is found to be TRUE, recalculating the check flag information data of the current first data area data, and synchronizing the data block with the second data area with the dirty flag as TRUE into a BACKUP block of a nonvolatile storage unit NVRAM; and writing the check information data calculated according to the data in the second data area into the attribute area of the BACKUP block, synchronizing the data block in the NVRAM mirror storage unit into the corresponding storage block in the non-volatile storage unit NVRAM, and writing the check information data into the first attribute area of the corresponding storage block in the non-volatile storage unit NVRAM.
2. The nonvolatile data storage structure of claim 1, wherein the nonvolatile memory unit NVRAM comprises:
static random access memory SRAM;
the power supply is connected with the SRAM and supplies power to the SRAM when the power supply is not powered off; and
And the standby battery is connected with the SRAM and supplies power to the SRAM when the power supply is powered off.
3. The non-volatile data storage structure of claim 1, wherein the NVRAM mirror storage unit is a memory unit.
4. A storage method employing the nonvolatile data storage structure of claim 1, comprising a system start NVRAM SERVER step, a read NVRAM data step, a write NVRAM data process step, and an NVRAM and mirror synchronization data step;
The system start-up NVRAM SERVER step includes:
Step S11: when the system is started, sequentially reading data in a first data area of the nonvolatile memory unit NVRAM, and checking consistency of the data in the first data area according to check information in a 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, covering the data in the first data area of the current block by the data in the BACKUP block;
step S13: after all the checks are completed, creating an NVRAM mirror image storage unit according to the storage block specification in the NVRAM of the nonvolatile storage unit;
Step S14: creating a timer to start a synchronous code process at regular time, which is used for synchronizing the storage blocks in the NVRAM mirror storage unit with the data of the corresponding storage blocks in the NVRAM of the nonvolatile storage unit;
the step of reading NVRAM data includes:
Step S21: storing a control program of the industrial robot by sending a read-one NVRAM data request to the NVRAM access interface;
Step S22: after receiving the request, the NVRAM access interface calculates the storage block in which the NVRAM data is stored 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 in the corresponding position of the NVRAM mirror storage unit, and returns the data to the control program of the storage industrial robot;
The writing NVRAM data process steps include:
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 position of the data which is required to be written in the storage block in the NVRAM mirror storage unit and the position of the data in the corresponding NVRAM mirror storage unit, and requesting to write a mutual exclusion lock;
Step S33: writing data to be stored in the control program of the storage industrial robot into a mirror image block storage area in the NVRAM mirror image storage unit, and setting modified flag information of data in a second attribute area of the mirror image block in the NVRAM mirror image storage unit as TRUE;
step S34: releasing the write exclusive lock;
The step of synchronizing the NVRAM and the mirror image comprises the following steps:
step S41: after the system is started, a timer is started to sequentially scan the dirty 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 dirty flag information is found to be TRUE, recalculating check flag information data of the current first data area data, and requesting to write a mutual exclusion lock;
step S43: firstly synchronizing a data block of a second data area with a dirty flag as TRUE into a BACKUP block of a nonvolatile memory unit NVRAM;
Step S44: writing the check information data calculated according to the data in the second data area into the attribute area of the BACKUP block, synchronizing the data block in the NVRAM mirror storage unit into the corresponding storage block in the NVRAM, and writing the check information data into the first attribute area of the corresponding storage block in the NVRAM;
Step S45: releasing the write exclusive lock and setting dirty flag information of a corresponding mirror block in the NVRAM mirror storage unit to FALSE.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010863937.7A CN112015340B (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 CN112015340B (en) | 2020-08-25 | 2020-08-25 | Nonvolatile data storage structure and storage method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112015340A CN112015340A (en) | 2020-12-01 |
CN112015340B true CN112015340B (en) | 2024-05-03 |
Family
ID=73505920
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010863937.7A Active CN112015340B (en) | 2020-08-25 | 2020-08-25 | Nonvolatile data storage structure and storage method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112015340B (en) |
Citations (9)
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 |
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 |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7076606B2 (en) * | 2002-09-20 | 2006-07-11 | Quantum Corporation | Accelerated RAID with rewind capability |
US7457928B2 (en) * | 2005-10-28 | 2008-11-25 | International Business Machines Corporation | Mirroring system memory in non-volatile random access memory (NVRAM) for fast power on/off cycling |
-
2020
- 2020-08-25 CN CN202010863937.7A patent/CN112015340B/en active Active
Patent Citations (9)
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 |
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 |
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 |
Also Published As
Publication number | Publication date |
---|---|
CN112015340A (en) | 2020-12-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7472139B2 (en) | Database recovery method applying update journal and database log | |
US5535399A (en) | Solid state disk drive unit having on-board backup non-volatile memory | |
US20060010300A1 (en) | Remote copy system maintaining consistency | |
CN104077380B (en) | A kind of data de-duplication method, apparatus and system | |
US8516208B2 (en) | Data backup method and information processing apparatus | |
US6944789B2 (en) | Method and apparatus for data backup and recovery | |
KR20030017532A (en) | Data storage system and process | |
US6112319A (en) | Method and system for verifying the accuracy of stored data | |
WO2023241350A1 (en) | Data processing method and device, data access end, and storage medium | |
CN110188068B (en) | Volume-level backup method and device for guaranteeing consistency of file system data | |
CN103810060A (en) | Data backup method and system thereof based on distributed database | |
CN115098299B (en) | Backup method, disaster recovery method, device and equipment of virtual machine | |
US20180143886A1 (en) | Method for Rebuilding a Mapping Table of a Solid State Disk | |
CN109240943B (en) | Address mapping relation feedback method, device and equipment and readable storage medium | |
US7013317B2 (en) | Method for backup and storage system | |
WO2024113685A1 (en) | Data recovery method for raid array and related apparatus | |
CN115328704A (en) | File backup method, file recovery method, device, equipment and storage medium | |
CN112015340B (en) | Nonvolatile data storage structure and storage method | |
US7600151B2 (en) | RAID capacity expansion interruption recovery handling method and system | |
CN111475334A (en) | TiDB database maintenance method and device, computer equipment and storage medium | |
US6854038B2 (en) | Global status journaling in NVS | |
CN115562593A (en) | Abnormal RAID member disk processing method, device and medium | |
CN115827322A (en) | Cloud storage data full-scale disaster recovery method and system | |
CN111601062B (en) | Storage security fault-tolerant method and system for vehicle-mounted monitoring video | |
CN110389855B (en) | Magnetic tape library data verification method and device, electronic equipment and readable storage medium |
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 |