CN109213421A - A kind of storage recording method and device - Google Patents
A kind of storage recording method and device Download PDFInfo
- Publication number
- CN109213421A CN109213421A CN201710516314.0A CN201710516314A CN109213421A CN 109213421 A CN109213421 A CN 109213421A CN 201710516314 A CN201710516314 A CN 201710516314A CN 109213421 A CN109213421 A CN 109213421A
- Authority
- CN
- China
- Prior art keywords
- index
- storage
- spatial pieces
- record
- stored
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 66
- 230000015654 memory Effects 0.000 claims description 86
- 238000004590 computer program Methods 0.000 claims description 5
- 230000008094 contradictory effect Effects 0.000 abstract description 6
- 230000005611 electricity Effects 0.000 description 12
- 108010001267 Protein Subunits Proteins 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 238000004321 preservation Methods 0.000 description 7
- 230000008569 process Effects 0.000 description 7
- 238000012545 processing Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 5
- 230000005012 migration Effects 0.000 description 5
- 238000013508 migration Methods 0.000 description 5
- 230000001360 synchronised effect Effects 0.000 description 5
- 238000012795 verification Methods 0.000 description 4
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 230000006399 behavior Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 125000004122 cyclic group Chemical group 0.000 description 2
- 238000000151 deposition Methods 0.000 description 2
- 235000013399 edible fruits Nutrition 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 239000002245 particle Substances 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- KLDZYURQCUYZBL-UHFFFAOYSA-N 2-[3-[(2-hydroxyphenyl)methylideneamino]propyliminomethyl]phenol Chemical compound OC1=CC=CC=C1C=NCCCN=CC1=CC=CC=C1O KLDZYURQCUYZBL-UHFFFAOYSA-N 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000010485 coping Effects 0.000 description 1
- 201000001098 delayed sleep phase syndrome Diseases 0.000 description 1
- 208000033921 delayed sleep phase type circadian rhythm sleep disease Diseases 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 230000035800 maturation Effects 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005192 partition Methods 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/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/0652—Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
-
- 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
-
- 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/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/0647—Migration mechanisms
-
- 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/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
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)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
The embodiment of the invention provides a kind of storage recording method and device, the storage recording method comprises determining that index corresponding to record to be stored;It will be in the first buffer area of the first storage region pointed by record storage to be stored to the index;Judge whether the first buffer area is filled with;If the first buffer area has been filled with, the record that the first buffer area stores is moved in the second storage region;By the storage of index corresponding to record to be stored into the index area.The erasable number of storage and the contradictory problems between the service life that the storage recording method of the embodiment of the present invention and device can solve the second storage region (such as Flash).Meanwhile the storage recording method and device can also reduce when storage indexes in the multiple erasable of the same space piece (same position), and the service life of the first storage region can be improved.
Description
Technical field
The present invention relates to a kind of field of embedded technology, in particular to a kind of storage recording method and device.
Background technique
With the development of science and technology embedded software hardware technology is developed rapidly.In the field of communications, embedded device
As user demand increases, various record demand is started to increase, record quantity starts to increase, and storing frequencies also start to accelerate.
Flash memory (Flash Memory) is a kind of widely used non-volatile memory.The characteristics of flash memory is read-write speed
Degree is fast, the disadvantage is that storage management is cumbersome, reliable erasable number is limited, and flash memory is that unit carries out erasing behaviour with data block (sector)
Make.The write operation of flash memory must be carried out in white space, if there have been data in target area, it is necessary to be write again after first wiping
Enter.It needs high frequency time to be written using flash memory storage small data, is recorded if stored using commonsense method, high frequency time is erasable to be will affect
The service life of flash memory.
Summary of the invention
The erasable number of storage in order to solve memory and the contradictory problems between the service life, the embodiment of the invention provides one
Kind storage recording method and device.
One aspect according to an embodiment of the present invention provides a kind of storage recording method, comprising:
Determine index corresponding to record to be stored;
It will be in the first buffer area of the first storage region pointed by record storage to be stored to the index;
Judge whether first buffer area is filled with;
If first buffer area has been filled with, the record that first buffer area stores is moved into the second storage region
In;
By index storage corresponding to the record to be stored into the index area of first storage region.
Optionally, the record that first buffer area stores is moved in the second storage region, comprising:
The record that first buffer area stores is moved in the second buffer area of the second storage region;
Judge whether second buffer area is filled with;
If second buffer area is filled with, the record of second buffer area is moved to the data field of the second storage region
In.
Optionally, the index area includes the spatial pieces sequence being made of multiple spatial pieces;
By index storage corresponding to the record to be stored into the index area of first storage region, comprising:
The index storage is any other in addition to the spatial pieces of last storage index into the index area
In one spatial pieces.
Optionally, described that index storage to be stored is stored into rope except last into the index area of the first storage region
In any other spatial pieces except the spatial pieces drawn, comprising:
According to the first index and the first check bit in the first spatial pieces of the index area of the first storage region, described in judgement
Whether the first spatial pieces are the last spatial pieces for storing index, are calculated wherein first check bit is based on the first index
's;
If the first spatial pieces are the spatial pieces of last storage index, by the of the index storage to the index area
Two spatial pieces, wherein the second space piece is next spatial pieces of first spatial pieces.
Optionally, described that index storage to be stored is stored into rope except last into the index area of the first storage region
In any other spatial pieces except the spatial pieces drawn, further includes:
If the first spatial pieces are not the spatial pieces of last storage index, judge whether second space piece is the space
The last one spatial pieces in piece sequence, wherein the second space piece is next spatial pieces of the first spatial pieces;
If second space piece is the last one spatial pieces in the spatial pieces sequence, by index storage to index
In the specified spatial pieces in area;
If second space piece is not the last one spatial pieces in the spatial pieces sequence, according to the second space piece
In the second index and the second check bit, judge second space piece whether be last storage index spatial pieces;If second
Spatial pieces are the spatial pieces of last storage index, by the of index storage corresponding to record currently to be stored to index area
In next spatial pieces of two spatial pieces.
Optionally, the first index and the first check bit in first spatial pieces according to the index area, judges the
Whether one spatial pieces are the last spatial pieces for storing index, comprising:
Third check bit is calculated according to the first index in the first spatial pieces of the index area;
The third check bit is compared with first check bit;
If third check bit is consistent with first check bit, judge the first spatial pieces for the space of last storage index
Piece;
If third check bit and first check bit are inconsistent, judging the first spatial pieces not is last storage index
Spatial pieces.
Other side according to an embodiment of the present invention additionally provides a kind of storage recording device, comprising:
Determining module, for determining index corresponding to record to be stored;
Record storage module, for will be to be stored record storage to the index pointed by the first storage region
In one buffer area;
Judgment module, for judging whether first buffer area is filled with;
Transferring module will be stored in the record of the first buffer area storage if being filled with for first buffer area
It moves in the second storage region;
Memory module is indexed, for index corresponding to the record to be stored to be stored to the rope to the first storage region
Draw in area.
Optionally, memory module is indexed, comprising:
Index storage unit, for the space for removing last storage index by the index storage into the index area
In any other spatial pieces except piece.
Another aspect according to an embodiment of the present invention additionally provides a kind of storage recording device, comprising: memory, place
The computer program managing device and storage on a memory and can running on a processor, the processor execute real when described program
The step in recording method is now stored as described above.
Another aspect according to an embodiment of the present invention additionally provides a kind of computer readable storage medium, stores thereon
There is computer program, the step in storage recording method as described above is realized when which is executed by processor.
The embodiment of the present invention has the following beneficial effects:
Firstly, by that when the first storage region is filled with, then will deposit first by single record storage into the first storage region
It stores up the record stored in the first storage region to move in the second storage region, avoids the needs in storage single record every time
Whole erasing is carried out to the second storage region, the erasable number of the second storage region can be reduced in this way, the second storage can be improved
The region service life.Further, the storage recording method of the embodiment of the present invention and device are the behaviour of write-after-read when storing record
It is greatly improved the preservation speed of record (or being data).When second storage region uses Flash, implement through the invention
The erasable number of storage and the contradictory problems between the service life that the storage recording method and device of example can solve Flash.
Secondly, passing through the storing except last into the index area of the first storage region by index storage currently to be stored
It, in this way can be to avoid (same in the same space piece when storage index in any other spatial pieces except the spatial pieces of index
One position) it is multiple erasable, the service life of the first storage region can be improved.
Detailed description of the invention
Fig. 1 is a kind of structural schematic diagram for storing recording device provided in an embodiment of the present invention;
Fig. 2 is a kind of flow chart for storing recording method provided in an embodiment of the present invention;
Fig. 3 is the flow chart of another storage recording method provided in an embodiment of the present invention;
Fig. 4 is the flow chart of another storage recording method provided in an embodiment of the present invention;
Fig. 5 is the flow chart of another storage recording method provided in an embodiment of the present invention;
Fig. 6 is a kind of structural schematic diagram for storing recording device provided in an embodiment of the present invention;
Fig. 7 be another embodiment of the present invention provides storage recording device structural schematic diagram.
Specific embodiment
To keep the technical problem to be solved in the present invention, technical solution and advantage clearer, below in conjunction with attached drawing and tool
Body embodiment is described in detail.
Term " first ", " second " in description and claims of this specification etc. are for distinguishing similar right
As without being used to describe a particular order or precedence order.It should be understood that the data used in this way in the appropriate case can be with
It exchanges, so that the embodiment of the present invention described herein for example can be with suitable other than those of illustrating or describing herein
Sequence is implemented.
Fig. 1 is a kind of structural schematic diagram for storing recording device provided in an embodiment of the present invention, referring to Fig. 1, the storage
Recording device includes: MCU (Microcontroller Unit, micro-control unit), the first storage region and the second storage region,
Wherein MCU is electrically connected with the first storage region and the second storage region respectively.
The MCU can be used for the interface channel of logic calculation and the first storage region and the second storage region.For example, institute
Stating MCU can be used for judging whether the first storage region or the second storage region are filled with, and the MCU can also be used to that first will be stored in
The record stored in storage region is migrated into the second storage region.It should be noted that retouching about MCU purposes above
It states, only example and non-limiting.
First storage region includes one or more for storing the storage medium of record to be stored, for example, continuing
Referring to Fig. 1, first storage region can include: EEPROM (Electrically Erasable Programmable
Read-Only Memory, Electrically Erasable Programmable Read-Only Memory) and RAM (Random Access Memory, effumability with
Machine accesses memory).At this point, first buffer area and index area can be separately positioned in EEPROM and RAM.Alternatively, described
First storage region includes: EEPROM.First buffer area and index area may be provided in EEPROM.It needs to illustrate
It is that the above explanation about the first storage region is example and non-limiting, it is to be understood that in embodiments of the present invention
The concrete type of first storage region is not limited specifically.
First storage region is provided with the first buffer area and index area, and first buffer area is for caching wait store
Record (or being data to be stored), the index area of first storage region is for storing corresponding to record to be stored
Index, the index area includes the spatial pieces sequence being made of multiple for store index and the spatial pieces of check bit, each
A storage location in spatial pieces manipulative indexing area.The index area includes at least: the first spatial pieces and second space piece,
In, the second space piece is next spatial pieces of the first spatial pieces.The information that first spatial pieces are stored includes: the first rope
Draw with the first check bit, wherein first check bit is calculated based on the first index;The letter that second space piece is stored
Breath includes: the second index and the second check bit, and second check bit is calculated based on the second index.It optionally, can root
According to the first index of the first spatial pieces and the first check bit, judge whether the first spatial pieces are the last space for storing index
Piece.Similarly, can judge whether second space piece is last storage according to the second of second space piece the index and the second check bit
The spatial pieces of index.
Second storage region is also used for storage record, and second storage region includes one or more for storing
The storage medium of record to be stored, with continued reference to Fig. 1, second storage region can be Flash, be of course not solely limited to this.
Based on above-mentioned storage recording device, asked to solve the erasable number of storage and the contradiction between the service life of memory
Topic, the embodiment of the invention provides a kind of storage recording methods.Fig. 2 is a kind of storage recording method provided in an embodiment of the present invention
Flow chart, referring to fig. 2, specific steps:
S201 determines index corresponding to record to be stored.
Above-mentioned record to be stored refers to one or more record to be stored, it is to be understood that in the present embodiment
And the particular number of the record to be stored is not particularly limited.
In the present embodiment, the index is the location information for being recorded in the first storage region to be stored, and is deposited first
As soon as every deposit record, index will be updated once in storage area domain, if the first storage region saves full, the head index and tail of record
Index all will offset.For example, the first storage region can only store 100 records, if the storage location in the first storage region is with 1
~100 serial numbers are labeled, if the 100th article of record storage, in the storage location of serial number 100, the first storage region has been at this time
Through being filled with.It to save, the new record of this can be stored in the storage location of serial number 1 when having carried out a new record, this
When head index be 2, it is 1 that pygochord, which draws,.It should be noted that being above example and non-limiting about the description that index calculates.
It should be noted that because record is that power down saves, when system electrification, in determination record institute to be stored
Before corresponding index step, need to determine initialization index first.Initialization index, example can be obtained by many modes
Such as, setting value can be directly given to initialization index, or pass through general CRC (Cyclic Redundancy
Check, cyclic redundancy check) spatial pieces for judging to obtain last storage index are verified, the last time is stored to the space of index
Index in piece is set as initialization index, is of course not solely limited to this.
S202, will be in the first buffer area of the first storage region pointed by record storage to be stored to the index.
The record to be stored is the data wait store storage medium, and in the present embodiment, storage medium includes
But it is not limited to: the first storage region and the second storage region.Address of cache can be used in the storage mode being recorded in storage medium
Method, record are mapped in storage medium as unit of item number.Record is that circulation is erasable.After memory space is write completely, first it is stored in
Record, be first capped.
S203, judges whether first buffer area is filled with.If first buffer area has been filled with, S204 is executed, if institute
It states the first buffer area not to be filled with, executes S205.
Optionally, judge whether first buffer area is filled with there are many implementation, for example, can delay by judge second
Whether the index for depositing area changes, to judge whether first buffer area is filled with.If the index of the second storage region occurs
Variation, then illustrate that first buffer area has been filled with, if the index of the second storage region does not change, illustrate described first
Buffer area is not filled with.It should be noted that judging whether first buffer area is filled with there are many implementation, above example is only
It is one of.
S204 moves to the record that first buffer area stores in the second storage region.
Optionally, second storage region includes that data field or the second storage region include at least the second buffer area
The data field and.When second storage region is only provided with data field, if first buffer area has been filled with, institute can will be stored in
The record for stating the storage of the first buffer area moves to the data field of the second storage region.
It, can if first buffer area has been filled with when the second storage region includes at least the second buffer area and data field
The record for being stored in the first buffer area storage is first moved in the second buffer area of the second storage region, if the second caching
Second buffer area of device has been filled with, then the record that the second buffer area for being stored in the second buffer stores is moved to the second storage
In the data field in region.
S205, by index storage corresponding to the record to be stored into the index area of the first storage region.
It optionally, can be by the space of the last storage index of index storage currently to be stored removing into the index area
In any other spatial pieces except piece, the index currently to be stored refers to the record stored in the second storage region
Corresponding index.The index and check bit of the spatial pieces of simultaneously erased last storage index, by last storage index
Spatial pieces are set to may make that the spatial pieces of only new write-in index are effective in vain.
In embodiments of the present invention, first by record storage into the first storage region, when the first storage region is filled with,
It will be stored in the record stored in the first storage region again to move in the second storage region, avoid in storage single record every time
When need to carry out whole erasing to the second storage region, the erasable number of the second storage region can be reduced in this way.Meanwhile this hair
The operation that the storage recording method of bright embodiment and device do write-after-read when storing record is greatly improved record
Data) save speed.
Further, as that can store index corresponding to record currently to be stored to the index area of the first storage region
In any other spatial pieces in addition to the spatial pieces of last storage index in, can be reduced storage index in this way
When in the multiple erasable of the same space piece (same position), the service life of the first storage region can be improved.
In order to solve to store erasable number and the contradictory problems between the service life on Flash, the second storage region can be set
For Flash.Below by taking the second storage region is Flash as an example, to a kind of storage recording method provided in an embodiment of the present invention into
Row is described in detail.
For example, saving electricity record using storage recording device timing shown in FIG. 1 in the power supply system for communications.Electricity
It is primary that record needs every 6 hours to save, and saving the memory space for needing to occupy every time is 300Byts, since byte is written in single
Excessively, when will cause write-in using EEPROM, system runs Caton, so being arranged buffer area into RAM.Save 50 electricity
The memory space that record needs is about 20K.
In this example, it is 32K that Flash, which has data block (Sector) that 16 memory spaces are 4K and 14 memory spaces,
The memory space of data block (Sector), Flash amounts to 512K, is that 4K data block is divided into data field by 6 memory spaces.
Buffer area (or being the first buffer area) is provided in RAM, the memory space that buffer area occupies is 4K.Rope is provided in EEPROM
Draw area, index area includes 5 spatial pieces for storing index.
Referring to Fig. 3, the specific step of electricity record is saved using another storage recording method provided in an embodiment of the present invention
It is rapid as follows:
S301, initialization index.It is whether correct by verification computation index, if the verification of index is correct, import the rope
Draw and is indexed as initialization.
S302, computation index (calculate the save location of record).Computation index is for judging whether circulation covering.It calculates
The opposite deviation post that newly-increased record storage is recorded in opposite deviation post and the last item.Calculate new Data Area data
Block offset index calculates buffer area offset index.
Record (or being record to be stored) is saved in buffer area (or being the first buffer area) by S303.
S304, judges whether buffer area is filled with, that is, judges whether the index of data field changes, if data field
Index changes, then illustrates that buffer area has been filled with, and executes S305.If the index of data field does not change, illustrate to cache
Qu Wei is filled with, and executes S306.
S305 migrates the record for being stored in buffer area to data field.
Optionally, when being provided with L2 cache area in Flash, the record for being stored in buffer area is migrated to data field and is wrapped
Include following steps:
Judge whether the index in L2 cache area (the second buffer area) changes.
If the index in L2 cache area changes, data cached migration is carried out.
The record for being stored in buffer area is saved into the L2 cache area of Flash, only with Flash is erasable primary.
Judge whether the index of the data field of Flash changes.
If the index of the data field of Flash changes, the record for being stored in L2 cache is saved to data field.
S306, storage index.It prevents in same position multiple erasable influence device (or storage medium) service life.Storage every time
The data for being stored in spatial pieces are first read, by verification (for example, CRC check), judge to store the space currently indexed by index
The position of piece.Current index-check is wiped, index currently to be stored is put into next spatial pieces.
In this example, record to be stored first is buffered in the buffer area of RAM, may make single record storage in this way
Storage speed is fast.After the buffer area of RAM is filled with, the buffer area for being stored in RAM is migrated to Flash by the MCU.Caching
Area is preservation data minimum particle size in Flash, and buffer area is able to carry out the preservation of single record, is avoided in storage single note every time
It needs to carry out the second storage region whole erasing when record, the erasable number of Flash can be reduced in this way, can be solved due to single
The problem of record needs high frequency time write-in Flash and leads to Flash service life reduction.Meanwhile the storage record of the embodiment of the present invention
The operation that method and device does write-after-read when storing record is greatly improved the preservation speed of record (or being data).
Fig. 4 is the flow chart of another storage recording method provided in an embodiment of the present invention.In embodiments of the present invention,
Two storage regions are provided with the second buffer area and data field, wherein whether need that the second buffer area is arranged in the second storage region,
It can be made a decision according to record size to be stored, the first buffer area data block size and Data Area data block size.For example, the
The memory space of one buffer area is small, and the memory space shared by the record to be stored is greater than the first buffer memory space, needs
The second buffer area is arranged in second storage region.Referring to fig. 4, the storage recording method the following steps are included:
S401 determines index corresponding to record to be stored.
In the present embodiment, the index is the location information for being recorded in the first storage region to be stored, and is deposited first
As soon as every deposit record, index will be updated once in storage area domain, if the first storage region saves full, the head index and tail of record
Index all will offset.
It should be noted that because record is that power down saves, when system electrification, in determination record institute to be stored
Before corresponding index step, need to determine initialization index first.Initialization index, example can be obtained by many modes
Such as, setting value can be directly given to initialization index, or judge to obtain last storage rope by general CRC check
Index in the spatial pieces of last storage index is set as initialization index, is of course not solely limited to this by the spatial pieces drawn.
S402, will be in the first buffer area of the first storage region pointed by record storage to be stored to the index.
The record to be stored is the data wait store memory space, and in the present embodiment, memory space includes
But it is not limited to: the first storage region and the second storage region.Address of cache can be used in the storage mode being recorded in memory space
Method, record are mapped in memory space as unit of item number.Record is that circulation is erasable.After memory space is write completely, first it is stored in
Record, be first capped.
S403, judges whether first buffer area is filled with.If first buffer area has been filled with, S404 is executed, if institute
It states the first buffer area not to be filled with, executes S407.
Optionally, whether can be changed by judging the index of the second buffer area to judge whether the first buffer area is deposited
It is full, it is of course not solely limited to this.
S404 moves to the record that first buffer area stores in the second buffer area of the second storage region.
S405, judges whether second buffer area is filled with.If second buffer area is filled with, S406 is executed, if described
Second buffer area is not filled with, executes S407.
Optionally, whether can be changed by judging the index of data field to judge whether the second buffer area is filled with, when
So it is not limited to that.
S406 moves to the record of second buffer area in the data field of the second storage region.
S407, by index storage corresponding to record to be stored into the index area of the first storage region.
It optionally, can be by index storage depositing except the last time into the index area corresponding to record currently to be stored
It stores up in any other spatial pieces except the spatial pieces of index, for example, when storage indexes every time, first by current spatial pieces
The index of storage is read, and by verification, judges whether current spatial pieces are the position for the last time storing the spatial pieces indexed.Such as
The current spatial pieces of fruit are the position of the spatial pieces of last storage index, the index-check of current spatial piece are wiped, by upper one
The spatial pieces of secondary storage index are set in vain, are stored an index into next spatial pieces of current spatial piece, can be reduced in this way
It is repeatedly erasable in the same position of the first storage region, so that the service life of the first storage region can be improved.
The storage recording method of the embodiment of the present invention passes through first by single record storage into the first storage region, to first
When storage region is filled with, then the record stored in the first storage region will be stored in and moved in second buffer area, then
When the second buffer area is filled with, the record for being stored in the storage of the second buffer area is migrated into the data field of the second storage region,
It avoids needing to carry out the second storage region whole erasing in storage single record every time, can reduce by the second memory block in this way
The erasable number in domain, can be improved the service life of the second storage region.The storage recording method of the embodiment of the present invention is when storing record
The operation for doing write-after-read is greatly improved the preservation speed of data.
In order to solve to store erasable number and the contradictory problems between the service life on Flash, the second storage region can be set
For Flash.Below by taking the second storage region is Flash as an example, to another storage recording method provided in an embodiment of the present invention
It is described in detail.
For example, needing timing to save the electricity in 100 days in the power supply system for communications.Electricity record needs save for each hour
Once, the memory space that an electricity record needs to occupy is 60Bytes, and the item number of 100 days electricity records is 2400.
In this example, the first storage region uses EEPROM, and the second storage region uses Flash.Wherein Flash has 16
The data block (Sector) and 14 memory spaces that a memory space is 4K are 32K data block (Sector), and the storage of Flash is empty
Between amount to 512K, the data block that 4 memory spaces therein are 32K data block and 8 memory spaces are 4K is divided into Flash
Data field, the data block that 8 memory spaces therein are 4K is divided into L2 cache area (or for the second buffer area).
The size of EEPROM memory space is 32K.Index area and the first buffer area, the index area setting of EEPROM are provided in EEPROM
There are 5 for storing the spatial pieces of index, memory space shared by the first buffer area of EEPROM is 4K.
Optionally, another storage recording method shown in Fig. 3 can be used to record the electricity in this example.Its
In, it, first will caching when the index in L2 cache area changes since Flash is provided with L2 cache area and data field
It is saved in the L2 cache area to Flash in the record of the buffer area of EEPROM, at this time only with Flash is erasable primary.When
When the index of the data field of Flash changes, then will be stored in 8 memory spaces be 4K L2 cache record save to
Memory space is the data field of 32K.
If directly electricity record is stored directly in Flash, the data block that the memory space of Flash is 32K can be stored
About 500 electricity records, it is meant that the data block that the memory space of Flash is 32K is write into full need erasable 500 times.At this
In example, the memory space of Flash be the data block of 32K write it is full need to be erasable primary, 8 memory spaces of Flash are 4K data
Block need to be erasable primary, and the buffer area that the memory space of EEPROM is 4K needs erasable 8 times.What is provided through the embodiment of the present invention deposits
Recording method is stored up, the erasable number of Flash can be greatly reduced, the service life of Flash can be improved.
In this example, record to be stored first is buffered in the buffer area of EEPROM, after the buffer area of EEPROM is filled with,
The buffer area for being stored in EEPROM is first migrated into the L2 cache area of Flash by the MCU, when the second level of Flash is slow
It deposits after area is filled with, then the record in the L2 cache area for being stored in Flash is moved to the data field of Flash.Buffer area is Flash
Middle preservation data minimum particle size, buffer area are able to carry out the preservation of single record, can reduce the erasable number of Flash in this way,
It can solve the problems, such as to lead to Flash service life reduction due to needing high frequency time write-in Flash.
Index is stored on the same space piece (i.e. same position), will lead to the multiple erasable of the same space piece, in this way
The service life of the first storage region can be reduced.Same position is stored an index into order to reduce, the embodiment of the invention provides another
Kind storage recording method.Fig. 5 is the flow chart of another storage recording method provided in an embodiment of the present invention, referring to Fig. 5, specifically
Steps are as follows:
S501 determines index corresponding to record to be stored.
In the present embodiment, the index is the location information for being recorded in the first storage region to be stored, and is deposited first
As soon as every deposit record, index will be updated once in storage area domain, if the first storage region saves full, the head index and tail of record
Index all will offset.It should be noted that being above example and non-limiting about the description that index calculates.
It should be noted that because record is that power down saves, when system electrification, in determination record institute to be stored
Before corresponding index step, need to determine initialization index first.Initialization index, example can be obtained by many modes
Such as, setting value can be directly given to initialization index, or judge to obtain last storage rope by general CRC check
Index in the spatial pieces of last storage index is set as initialization index, is of course not solely limited to this by the spatial pieces drawn.
S502, will be in the first buffer area of the first storage region pointed by record storage to be stored to the index.
The record to be stored is the data wait store storage medium, and in the present embodiment, storage medium includes
But it is not limited to: the first storage region and the second storage region.Address of cache can be used in the storage mode being recorded in storage medium
Method, record are mapped in storage medium as unit of item number.Record is that circulation is erasable.After memory space is write completely, first it is stored in
Record, be first capped.
S503, judges whether first buffer area is filled with.If first buffer area has been filled with, S404 is executed, if institute
It states the first buffer area not to be filled with, executes S405.
S504 moves to the record for being stored in the first buffer area storage in the second storage region.
S505, by index storage currently to be stored into the index area except last storage index spatial pieces it
In outer any other spatial pieces.
Wherein, the index currently to be stored refers to index corresponding to the record stored in the second storage region.?
During storage index, the index and check bit of the spatial pieces of index can be stored the simultaneously erased last time, the last time is stored
The spatial pieces of index are set in vain, and next spatial pieces by the spatial pieces of last storage index are to be set as effectively, in this way
Can reduce storage index when in the same space piece (same position) it is multiple erasable.
Optionally, the spatial pieces for removing last storage index by index storage currently to be stored into the index area
Except any other spatial pieces in implementation can there are many, be illustrated by taking one of which as an example below.
Firstly, can judge the first sky according to the index of first in the first spatial pieces of the index area and the first check bit
Between piece whether be last storage index spatial pieces.
Optionally, third check bit first can be calculated according to the first index in the first spatial pieces of the index area.
The third check bit is compared by general CRC check with first check bit again, judges that the first spatial pieces are
The no spatial pieces for last storage index.If third check bit is consistent with first check bit, the first spatial pieces are upper one
The spatial pieces of secondary storage index.If third check bit and first check bit are inconsistent, the first spatial pieces are not to deposit the last time
Store up the spatial pieces of index.
If the first spatial pieces are the spatial pieces of last storage index, by index storage currently to be stored to index area
Second space piece, wherein the second space piece is next spatial pieces of the first spatial pieces.
If the first spatial pieces are not the spatial pieces of last storage index, judge whether second space piece is the space
The last one spatial pieces in piece sequence, wherein the second space piece is next spatial pieces of the first spatial pieces.
If second space piece is the last one spatial pieces in the spatial pieces sequence, by record institute currently to be stored
Corresponding index storage is into the specified spatial pieces of index area.
If second space piece is not the last one spatial pieces in the spatial pieces sequence, according to the of the index area
The second index and the second check bit in two spatial pieces judge whether second space piece is the last spatial pieces for storing index;
Whether second space piece is the last time to store the judgement process of the spatial pieces indexed and the judgement of analysis process and the first spatial pieces
Process is similar with analysis process, and details are not described herein.
If second space piece is the spatial pieces of last storage index, by index corresponding to record currently to be stored
It stores into next spatial pieces of the second space piece of index area.
For example, index area is the spatial pieces sequence of the spatial pieces 1 arranged in sequence, spatial pieces 2 and spatial pieces 3, work as institute
When to state the first spatial pieces be spatial pieces 2, if spatial pieces 2 are the spatial pieces of last storage index, by record currently to be stored
Corresponding index storage is into next spatial pieces (i.e. spatial pieces 3) of the spatial pieces 2 of index area.On if spatial pieces 2 are not
The spatial pieces of primary storage index then need to judge whether spatial pieces 3 are the last one spatial pieces in the spatial pieces sequence.Through
It crosses judgement to obtain, spatial pieces 3 are the last one spatial pieces in the spatial pieces sequence, then record institute currently to be stored is right
The index answered is stored into the specified spatial pieces of index area, for example, in spatial pieces 1, spatial pieces 2 or spatial pieces 3.
In embodiments of the present invention, by the way that first by single record storage into the first storage region, the first storage region is deposited
Man Shi will be stored in the record stored in the first storage region and move in the second storage region, avoid in storage single every time
It needs to carry out the second storage region whole erasing when record, the erasable number of the second storage region can be reduced in this way.With this
Meanwhile by the way that index storage corresponding to record currently to be stored is removed the last time into the index area of the first storage region
It stores in any other spatial pieces except the spatial pieces of index, can be reduced index in this way in the same space piece
(same position) it is multiple erasable, the service life of the first storage region can be improved.
The erasable number of storage in order to solve memory and the contradictory problems between the service life, the embodiment of the invention provides one
Kind storage recording device.Fig. 6 is a kind of structural schematic diagram for storing recording device provided in an embodiment of the present invention, referring to Fig. 6, institute
It states storage recording device 600 and comprises determining that module 601, record storage module 602, judgment module 603, transferring module 604 and rope
Draw memory module 605.
Wherein it is determined that module 601, for determining index corresponding to record to be stored.
Record storage module 602, for will be to be stored record storage to the index pointed by the first storage region
The first buffer area in position.
Judgment module 603, for judging whether first buffer area is filled with.
Transferring module 604 will be stored in the note of the first buffer area storage if being filled with for first buffer area
Record moves in the second storage region.
Index memory module 605, for will be to be stored record corresponding to index storage to the first storage region rope
Draw in area.Wherein the index area includes the spatial pieces sequence being made of multiple spatial pieces.
Optionally, transferring module 604 includes: the first migration units, the first judging unit and the second migration units.
Wherein, first migration units, for first caching when first buffer area is filled with, will to be stored in
The record of area's storage moves in the second buffer area of the second storage region;
First judging unit, for judging whether second buffer area is filled with;
Second migration units migrate the record of second buffer area if being filled with for second buffer area
Into the data field of the second storage region.
The index memory module 605 includes: index storage unit.
The wherein index storage unit, for index storage currently to be stored to be removed upper one into the index area
In any other spatial pieces except the spatial pieces of secondary storage index.Wherein the index currently to be stored refers to second
Index corresponding to the record stored in storage region.
Optionally, the index storage unit includes: the first judgment sub-unit, the first index storing sub-units, second sentences
Disconnected subelement, the second index storing sub-units, third judgment sub-unit and third index storing sub-units.
Wherein, first judgment sub-unit, in the first spatial pieces according to the index area first index and
First check bit judges whether the first spatial pieces are the last spatial pieces for storing index, wherein first check bit is based on
What the first index was calculated.
The first index storing sub-units will if being the spatial pieces that last storage indexes for the first spatial pieces
The second space piece of index area is arrived in index storage currently to be stored, wherein the second space piece is under the first spatial pieces
One spatial pieces.
Second judgment sub-unit judges second if not being the spatial pieces that last storage indexes for the first spatial pieces
Whether spatial pieces are the last one spatial pieces in the spatial pieces sequence, wherein the second space piece is the first spatial pieces
Next spatial pieces.
Second index storing sub-units, if being the last one space in the spatial pieces sequence for second space piece
Piece stores index currently to be stored into the specified spatial pieces of index area.
Third judgment sub-unit, if not being the last one space in the spatial pieces sequence for second space piece
Whether piece judges second space piece according to the index and the second check bit in the second space piece of the index area of first memory
For the spatial pieces of last storage index.
Third indexes storing sub-units, will be current if for second space piece being the spatial pieces of last storage index
Index to be stored is stored into next spatial pieces of the second space piece of index area.
Optionally, the first judgment sub-unit, comprising: it is single to calculate sub- subelement, the sub- subelement of comparison and the first judgement son
Member and second judges sub- subelement.
Wherein, described to calculate sub- subelement, it is calculated for the first index in the first spatial pieces according to the index area
Obtain third check bit;
The more sub- subelement judges for the third check bit to be compared with first check bit
Whether one spatial pieces are the last spatial pieces for storing index.
Described first judges sub- subelement, if consistent with first check bit for third check bit, judges the first sky
Between piece be last storage index spatial pieces.
Described second judges sub- subelement, if inconsistent for third check bit and first check bit, judges first
Spatial pieces are not the spatial pieces of last storage index.
Storage recording device provided in this embodiment can execute above method embodiment, realization principle and technology effect
Seemingly, details are not described herein again for the present embodiment for fruit.
It is provided in this embodiment storage recording device by record storage module 602 first by record storage to first storage
In region, the record stored in the first storage region will be stored in when the first storage region is filled with, then through transferring module 604
It moves in the second storage region, avoids needing to carry out the second storage region whole erasing in storage single record every time,
The erasable number of the second storage region can be reduced in this way.
Further, storage recording device provided in this embodiment can be by record currently to be stored by index storage unit
An any other sky except the spatial pieces of last storage index in addition to of the corresponding index storage into the index area
Between in piece, in the multiple erasable of the same space piece (same position) when can reduce storage index in this way, the first storage can be improved
The service life in region.
Fig. 7 be another embodiment of the present invention provides storage recording device structural schematic diagram.As shown in fig. 7, shown in Fig. 7
Storage recording device 700 include: at least one processor 701, memory 702.Store the various components in recording device 700
It is coupled by bus system 705.It is understood that bus system 705 is for realizing the connection communication between these components.Always
Linear system system 705 further includes power bus, control bus and status signal bus in addition in addition to including data/address bus.But in order to clear
For the sake of Chu's explanation, various buses are all designated as bus system 705 in Fig. 7.
It is appreciated that the memory 702 in the embodiment of the present invention can be volatile memory or nonvolatile memory,
It or may include both volatile and non-volatile memories.Wherein, nonvolatile memory can be read-only memory (Read-
Only Memory, ROM), programmable read only memory (Programmable ROM, PROM), the read-only storage of erasable programmable
Device (Erasable PROM, EPROM), electrically erasable programmable read-only memory (Electrically EPROM, EEPROM) or
Flash memory.Volatile memory can be random access memory (Random Access Memory, RAM), be used as external high
Speed caching.By exemplary but be not restricted explanation, the RAM of many forms is available, such as static random access memory
(Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), Synchronous Dynamic Random Access Memory
(Synchronous DRAM, SDRAM), double data speed synchronous dynamic RAM (Double Data Rate
SDRAM, DDRSDRAM), enhanced Synchronous Dynamic Random Access Memory (Enhanced SDRAM, ESDRAM), synchronized links
Dynamic random access memory (Synchlink DRAM, SLDRAM) and direct rambus random access memory (Direct
Rambus RAM, DRRAM).The memory 702 of the system and method for description of the embodiment of the present invention is intended to include but is not limited to these
With the memory of any other suitable type.
In some embodiments, memory 702 stores following element, executable modules or data structures, or
Their subset of person or their superset: operating system 7021 and application program 7022.
Wherein, operating system 7021 include various system programs, such as ccf layer, core library layer, driving layer etc., are used for
Realize various basic businesses and the hardware based task of processing.Application program 7022 includes various application programs, such as media
Player (Media Player), browser (Browser) etc., for realizing various applied business.Realize the embodiment of the present invention
The program of method may be embodied in application program 7022.
In embodiments of the present invention, by the program or instruction of calling memory 702 to store, specifically, can be application
The program or instruction stored in program 7022, processor 701 can execute above-mentioned storage recording method.
The method that the embodiments of the present invention disclose can be applied in processor 701, or be realized by processor 701.
Processor 701 may be a kind of IC chip, the processing capacity with signal.During realization, the above method it is each
Step can be completed by the integrated logic circuit of the hardware in processor 701 or the instruction of software form.Above-mentioned processing
Device 701 can be general processor, digital signal processor (Digital Signal Processor, DSP), dedicated integrated electricity
Road (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components.It may be implemented or execute disclosed each method, step and the logic diagram in the embodiment of the present invention.It is general
Processor can be microprocessor or the processor is also possible to any conventional processor etc..In conjunction with institute of the embodiment of the present invention
The step of disclosed method, can be embodied directly in hardware decoding processor and execute completion, or with the hardware in decoding processor
And software module combination executes completion.Software module can be located at random access memory, and flash memory, read-only memory may be programmed read-only
In the storage medium of this fields such as memory or electrically erasable programmable memory, register maturation.The storage medium is located at
The step of memory 702, processor 701 reads the information in memory 702, completes the above method in conjunction with its hardware.
It is understood that the embodiment of the present invention description these embodiments can with hardware, software, firmware, middleware,
Microcode or combinations thereof is realized.For hardware realization, processing unit be may be implemented in one or more specific integrated circuits
(Application Specific Integrated Circuits, ASIC), digital signal processor (Digital Signal
Processing, DSP), digital signal processing appts (DSP Device, DSPD), programmable logic device (Programmable
Logic Device, PLD), field programmable gate array (Field-Programmable Gate Array, FPGA), general place
It manages in device, controller, microcontroller, microprocessor, other electronic units for executing function of the present invention or combinations thereof.
For software implementations, can by execute the embodiment of the present invention described in function module (such as process, function etc.) come
Realize technology described in the embodiment of the present invention.Software code is storable in memory and is executed by processor.Memory can
With portion realizes in the processor or outside the processor.
In the present embodiment, processor 701 is specifically used for: determining index corresponding to record to be stored;By to be stored
In first buffer area pointed by record storage to the index;Judge whether first buffer area is filled with;If described
First buffer area has been filled with, and the record for being stored in the first buffer area storage is moved in the second storage region;It will be wait deposit
Index storage is into the index area of the first storage region corresponding to the record of storage.
Optionally, processor 701 is specifically used for: when first buffer area is filled with, will be stored in first caching
The record of area's storage moves in second buffer area;Judge whether second buffer area is filled with;If second caching
Area is filled with, and the record of second buffer area is moved in the data field of the second storage region.
Optionally, processor 701 is specifically used for: the index storage is stored rope except last into the index area
In any other spatial pieces except the spatial pieces drawn.
Optionally, processor 701 is specifically used for: according to the first index and first in the first spatial pieces of the index area
Check bit judges whether first spatial pieces are the last spatial pieces for storing index, wherein first check bit is based on
What the first index was calculated;If the first spatial pieces are the spatial pieces of last storage index, institute is arrived into index storage
State the second space piece of index area, wherein the second space piece is next spatial pieces of first spatial pieces.
Optionally, processor 701 is specifically used for: if the first spatial pieces are not the spatial pieces of last storage index, sentencing
Whether disconnected second space piece is the last one spatial pieces in the spatial pieces sequence, wherein the second space piece is first
Next spatial pieces of spatial pieces;If second space piece is the last one spatial pieces in the spatial pieces sequence, will be current
Index to be stored is stored into the specified spatial pieces of index area;If second space piece is not in the spatial pieces sequence
The last one spatial pieces judges according to the index and the second check bit in the second space piece of the index area of first memory
Whether two spatial pieces are the last spatial pieces for storing index;If second space piece is the spatial pieces of last storage index,
By index storage corresponding to record currently to be stored into next spatial pieces of the second space piece of index area.
Optionally, processor 701 is specifically used for: being calculated according to the first index in the first spatial pieces of the index area
To third check bit;The third check bit is compared with first check bit, judge the first spatial pieces whether be on
The spatial pieces of primary storage index.If third check bit is consistent with first check bit, judge the first spatial pieces for the last time
Store the spatial pieces of index;If third check bit and first check bit are inconsistent, it is last for judging the first spatial pieces not
Store the spatial pieces of index.
Storage recording device provided in an embodiment of the present invention by processor 701 first by record storage to the first memory block
In domain, when the first storage region is filled with, then by the record stored in the first storage region is stored in the second storage region is moved to
In, it avoids needing to carry out the second storage region whole erasing in storage single record every time, second can be reduced in this way and deposited
The erasable number in storage area domain.
Further, storage recording device provided in an embodiment of the present invention can be by note currently to be stored by processor 701
Any other one except the spatial pieces of last storage index in addition to of the corresponding index storage of record into the index area
In spatial pieces, in the multiple erasable of the same space piece (same position) when can be reduced storage index in this way, first can be improved
The service life of storage region.
The embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer program, the journey
The step in storage recording method as described above is realized when sequence is executed by processor.
It should be understood that " one embodiment " or " embodiment " that specification is mentioned in the whole text mean it is related with embodiment
A particular feature, structure, or characteristic is included at least one embodiment of the present invention.Therefore, occur everywhere in the whole instruction
" in one embodiment " or " in one embodiment " not necessarily refer to identical embodiment.In addition, these specific features, knot
Structure or characteristic can combine in any suitable manner in one or more embodiments.
In various embodiments of the present invention, it should be appreciated that magnitude of the sequence numbers of the above procedures are not meant to execute suitable
Sequence it is successive, the execution of each process sequence should be determined by its function and internal logic, the implementation without coping with the embodiment of the present invention
Process constitutes any restriction.
In embodiment provided herein, it should be appreciated that " B corresponding with A " indicates that B is associated with A, can be with according to A
Determine B.It is also to be understood that determine that B is not meant to determine B only according to A according to A, it can also be according to A and/or other information
Determine B.
In several embodiments provided herein, it should be understood that disclosed method and apparatus, it can be by other
Mode realize.For example, the apparatus embodiments described above are merely exemplary, for example, the division of the unit, only
For a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components can combine
Or it is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed phase
Coupling, direct-coupling or communication connection between mutually can be through some interfaces, the INDIRECT COUPLING or communication of device or unit
Connection can be electrical property, mechanical or other forms.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that the independent physics of each unit includes, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit being realized in the form of SFU software functional unit can store and computer-readable deposit at one
In storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are used so that a computer
Equipment (can be personal computer, server or network side equipment etc.) executes transmitting-receiving side described in each embodiment of the present invention
The part steps of method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (Read-Only Memory, letter
Claim ROM), random access memory (Random Access Memory, abbreviation RAM), magnetic or disk etc. is various to deposit
Store up the medium of program code.
The above is a preferred embodiment of the present invention, it is noted that for those skilled in the art
For, without departing from the principles of the present invention, it can also make several improvements and retouch, these improvements and modifications
It should be regarded as protection scope of the present invention.
Claims (10)
1. a kind of storage recording method, which is characterized in that the storage recording method includes:
Determine index corresponding to record to be stored;
It will be in the first buffer area of the first storage region pointed by record storage to be stored to the index;
Judge whether first buffer area is filled with;
If first buffer area has been filled with, the record that first buffer area stores is moved in the second storage region;
By index storage corresponding to the record to be stored into the index area of the first storage region.
2. storage recording method according to claim 1, which is characterized in that move the record that first buffer area stores
It moves on in the second storage region, comprising:
The record that first buffer area stores is moved in the second buffer area of the second storage region;
Judge whether second buffer area is filled with;
If second buffer area is filled with, the record of second buffer area is moved in the data field of the second storage region.
3. storage recording method according to claim 1, which is characterized in that the index area includes by multiple spatial pieces groups
At spatial pieces sequence;
By index storage corresponding to the record to be stored into the index area of first storage region, comprising:
By any other one except the spatial pieces of last storage index in addition to of the index storage into the index area
In spatial pieces.
4. storage recording method according to claim 3, which is characterized in that described by index storage to be stored to first
In any other spatial pieces in addition to the spatial pieces of last storage index in the index area of storage region, comprising:
According to the first index and the first check bit in the first spatial pieces of the index area, whether first spatial pieces are judged
For the spatial pieces of last storage index, wherein first check bit is calculated based on the first index;
If the first spatial pieces are the spatial pieces of last storage index, empty by the second of the index storage to the index area
Between piece, wherein the second space piece is next spatial pieces of first spatial pieces.
5. storage recording method according to claim 4, which is characterized in that described by index storage to be stored to first
In any other spatial pieces in addition to the spatial pieces of last storage index in the index area of storage region, also wrap
It includes:
If the first spatial pieces are not the spatial pieces of last storage index, judge whether second space piece is the spatial pieces sequence
The last one spatial pieces in column, wherein the second space piece is next spatial pieces of the first spatial pieces;
If second space piece is the last one spatial pieces in the spatial pieces sequence, index area is arrived into index storage
In specified spatial pieces;
If second space piece is not the last one spatial pieces in the spatial pieces sequence, according in the second space piece
Second index and the second check bit judge whether second space piece is the last spatial pieces for storing index;
If second space piece is the spatial pieces of last storage index, index corresponding to record currently to be stored is stored
Into next spatial pieces of the second space piece of index area.
6. storage recording method according to claim 4, which is characterized in that according in the first spatial pieces of the index area
The first index and the first check bit, judge whether the first spatial pieces are spatial pieces that last storage indexes, comprising:
Third check bit is calculated according to the first index in the first spatial pieces of the index area;
The third check bit is compared with first check bit;
If third check bit is consistent with first check bit, judge the first spatial pieces for the spatial pieces of last storage index;
If third check bit and first check bit are inconsistent, judging the first spatial pieces not is the space of last storage index
Piece.
7. a kind of storage recording device, which is characterized in that the storage recording device includes:
Determining module, for determining index corresponding to record to be stored;
Record storage module, for delaying first of the first storage region pointed by record storage to be stored to the index
It deposits in area;
Judgment module, for judging whether first buffer area is filled with;
Transferring module migrates the record for being stored in the first buffer area storage if being filled with for first buffer area
Into the second storage region;
Memory module is indexed, for storing index corresponding to the record to be stored to the index area of the first storage region
In.
8. storage recording device according to claim 7, which is characterized in that index memory module, comprising:
Index storage unit, for by the index storage into the index area except last storage index spatial pieces it
In outer any other spatial pieces.
9. a kind of storage recording device characterized by comprising memory, processor and storage on a memory and can located
The computer program run on reason device, the processor are realized as described in any one of claims 1 to 6 when executing described program
Store the step in recording method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor
The step in storage recording method as described in any one of claims 1 to 6 is realized when execution.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710516314.0A CN109213421B (en) | 2017-06-29 | 2017-06-29 | Storage recording method and device |
PCT/CN2018/091629 WO2019001296A1 (en) | 2017-06-29 | 2018-06-15 | Method and apparatus for storing record |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710516314.0A CN109213421B (en) | 2017-06-29 | 2017-06-29 | Storage recording method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109213421A true CN109213421A (en) | 2019-01-15 |
CN109213421B CN109213421B (en) | 2024-01-09 |
Family
ID=64741074
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710516314.0A Active CN109213421B (en) | 2017-06-29 | 2017-06-29 | Storage recording method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109213421B (en) |
WO (1) | WO2019001296A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110992519A (en) * | 2019-12-10 | 2020-04-10 | 厦门金龙联合汽车工业有限公司 | New energy automobile fault data processing method and processing device |
CN113703686A (en) * | 2021-08-31 | 2021-11-26 | 潍柴动力股份有限公司 | Data storage method, device and system |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1540659A (en) * | 2003-11-03 | 2004-10-27 | 威腾光电股份有限公司 | Method for managin buffer area of optical disk |
CN1858747A (en) * | 2006-04-30 | 2006-11-08 | 北京金山软件有限公司 | Data storage/searching method and system |
JP2011113232A (en) * | 2009-11-26 | 2011-06-09 | Nec Corp | Disk enclosure and control method for storage system |
CN102364474A (en) * | 2011-11-17 | 2012-02-29 | 中国科学院计算技术研究所 | Metadata storage system for cluster file system and metadata management method |
CN104281633A (en) * | 2013-09-06 | 2015-01-14 | 北京宇图天下软件有限公司 | Mobile navigation and positioning system for water information |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101727395A (en) * | 2008-10-17 | 2010-06-09 | 深圳市朗科科技股份有限公司 | Flash memory device and management system and method thereof |
CN103049394A (en) * | 2012-11-30 | 2013-04-17 | 记忆科技(深圳)有限公司 | Method and system for data caching of solid state disk |
CN103150397B (en) * | 2013-03-26 | 2016-03-16 | 北京经纬恒润科技有限公司 | A kind of data directory creation method, data retrieval method and system |
-
2017
- 2017-06-29 CN CN201710516314.0A patent/CN109213421B/en active Active
-
2018
- 2018-06-15 WO PCT/CN2018/091629 patent/WO2019001296A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1540659A (en) * | 2003-11-03 | 2004-10-27 | 威腾光电股份有限公司 | Method for managin buffer area of optical disk |
CN1858747A (en) * | 2006-04-30 | 2006-11-08 | 北京金山软件有限公司 | Data storage/searching method and system |
JP2011113232A (en) * | 2009-11-26 | 2011-06-09 | Nec Corp | Disk enclosure and control method for storage system |
CN102364474A (en) * | 2011-11-17 | 2012-02-29 | 中国科学院计算技术研究所 | Metadata storage system for cluster file system and metadata management method |
CN104281633A (en) * | 2013-09-06 | 2015-01-14 | 北京宇图天下软件有限公司 | Mobile navigation and positioning system for water information |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110992519A (en) * | 2019-12-10 | 2020-04-10 | 厦门金龙联合汽车工业有限公司 | New energy automobile fault data processing method and processing device |
CN113703686A (en) * | 2021-08-31 | 2021-11-26 | 潍柴动力股份有限公司 | Data storage method, device and system |
Also Published As
Publication number | Publication date |
---|---|
CN109213421B (en) | 2024-01-09 |
WO2019001296A1 (en) | 2019-01-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7716396B1 (en) | Multi-reader multi-writer circular buffer memory | |
CN106484316B (en) | Method for managing a memory device, memory device and controller | |
KR101391270B1 (en) | Nonvolatile memory system using magneto-resistive random access memoryMRAM | |
CN106445398A (en) | Novel memory-based embedded file system and realization method thereof | |
US8380958B2 (en) | Spatial extent migration for tiered storage architecture | |
CN107273042A (en) | Deduplication DRAM system algorithm framework | |
CN109783396A (en) | The method of access flash memory module and relevant flash controller and electronic device | |
CN110297603A (en) | Random write performance method for improving, device and computer equipment based on solid state hard disk | |
CN107066498A (en) | Key assignments KV storage methods and device | |
CN102306503A (en) | Method and system for detecting false capacity memory | |
CN109952565A (en) | Internal storage access technology | |
CN110018787A (en) | Based on the system-wide firmware reading/writing method of SSD, device and computer equipment | |
WO2023000536A1 (en) | Data processing method and system, device, and medium | |
CN110377233A (en) | SSD reading performance optimization method, device, computer equipment and storage medium | |
CN110297787A (en) | The method, device and equipment of I/O equipment access memory | |
CN109144422A (en) | A kind of data writing method of solid state hard disk, device, equipment and storage medium | |
CN109471843A (en) | A kind of metadata cache method, system and relevant apparatus | |
CN110534151A (en) | Realize method, apparatus, computer equipment and the storage medium wiped before write-in | |
CN109213421A (en) | A kind of storage recording method and device | |
CN109697022A (en) | A kind of processing method, device and the computer readable storage medium of message descriptor PD | |
CN117215491A (en) | Rapid data access method, rapid data access device and optical module | |
CN108763106A (en) | A kind of Cache implementation methods based on interleaved | |
KR101876574B1 (en) | Data i/o controller and system having the same | |
CN109408301A (en) | Internal storage testing method based on 64 bit processor of Godson under a kind of PMON | |
CN114281251B (en) | Data distribution and reprogramming optimization method for 3D TLC flash memory |
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 |