CN103268201B - A kind of date storage method, memory storage and read method - Google Patents

A kind of date storage method, memory storage and read method Download PDF

Info

Publication number
CN103268201B
CN103268201B CN201310138191.3A CN201310138191A CN103268201B CN 103268201 B CN103268201 B CN 103268201B CN 201310138191 A CN201310138191 A CN 201310138191A CN 103268201 B CN103268201 B CN 103268201B
Authority
CN
China
Prior art keywords
data
writing area
written
storage space
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310138191.3A
Other languages
Chinese (zh)
Other versions
CN103268201A (en
Inventor
李德魁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingwei Hirain Tech Co Ltd
Original Assignee
Beijing Jingwei Hirain Tech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingwei Hirain Tech Co Ltd filed Critical Beijing Jingwei Hirain Tech Co Ltd
Priority to CN201310138191.3A priority Critical patent/CN103268201B/en
Publication of CN103268201A publication Critical patent/CN103268201A/en
Application granted granted Critical
Publication of CN103268201B publication Critical patent/CN103268201B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This application discloses a kind of date storage method, memory storage and read method, first the method receives data to be written, then the type of data to be written is determined, finally in the storage space corresponding with this data type, write data to be written successively, the method is in data storage procedure, by writing data to be written successively in storage space, when not needing to write data to be written at every turn, all carry out an erase operation, can solve prior art is carrying out in the process of data storage at every turn, all need to carry out erase operation to the data in a upper effective SECTOR, make erase operation frequent, and then the problem causing service life of flash memory to reduce.

Description

A kind of date storage method, memory storage and read method
Technical field
The application relates to flash memory technology field, particularly relates to a kind of date storage method, memory storage and read method.
Background technology
The erasable number of times of flash memory is generally 100,000 times, and the erasable number of times of serial storage is generally 1,000,000 times, and therefore, a lot of electronic product is all come program code stored with flash memory, stores the data often needing to upgrade with serial storage.But this storage mode, can make the hardware cost of product rise because using serial storage on the one hand, on the other hand also can be comparatively large because of the storage space of flash memory, and only program code stored in a flash memory, the waste of flash memory space can be caused.
Prior art, a kind of date storage method is provided, the method utilizes flash memory to simulate the function that serial storage stores data, mainly the storage space of flash memory is divided into n SECTOR(wherein SECTOR be the minimum erase units of flash memory), and be provided with in each SECTOR SectorStatus(corresponding thereto wherein SectorStatus comprise the state validity of SECTOR, data validity, the information such as type and length), because wiping operation first must be performed before flash memory carries out write operation, perform write operation again, so when there is data write request, first flash memory finds current effective SECTOR by SectorStatus, then by the data copy in this SECTOR out, and next SECTOR is written to together with the data being about to write, finally by the data erase in a upper SECTOR, thus the storage realized data.
By the research to prior art, inventor finds: although existing date storage method can realize the function being stored data by flash memory simulation serial storage, but because in the process of each write data, all need to carry out erase operation to the data in a upper effective SECTOR, make erase operation frequent, and then cause service life of flash memory to reduce.
Summary of the invention
In view of this, the embodiment of the present application provides a kind of date storage method, memory storage and read method, to solve prior art at every turn in the process of carrying out data storage, all need to carry out erase operation to the data in a upper effective SECTOR, make erase operation frequent, and then the problem causing service life of flash memory to reduce.
To achieve these goals, the technical scheme that provides of the embodiment of the present application is as follows:
A kind of date storage method, be applied to flash memory, described flash memory comprises at least one storage space, comprising:
Receive data to be written;
Determine the data type of described data to be written;
Described data to be written are write successively in the storage space corresponding with described data type.
Preferably, describedly determine that the data type of described data to be written comprises:
Obtain the type identification entrained by described data to be written;
The data type of described data to be written is determined according to the corresponding relation between the type identification pre-set and data type.
Preferably, at least two writing areas are included in each described storage space, and be provided with status identifier in each said write region, described status identifier represents effective status or disarmed state, and synchronization has and only has a status identifier to represent effective status in same storage space
Describedly in the storage space corresponding with described data type, write described data to be written successively comprise:
The storage space corresponding to data type of described data to be written is determined according to the corresponding relation between the data type pre-set and storage space, and as target storage space;
The writing area that status identifier represents effective status is searched in described target storage space, and as target writing area;
Judge whether the remaining space of described target writing area meets taking up room of described data to be written;
When meeting, the described data to be written of white space write in described target writing area.
Preferably, in each described storage space, each said write region is provided with serial number, and the next writing area of afterbody writing area is head writing area,
When the remaining space of described target writing area does not meet taking up room of described data to be written, the method also comprises:
Obtain the valid data in described target writing area;
Described valid data are stored in the next writing area of described target writing area;
Described data to be written are write after the valid data stored in the next writing area of described target writing area;
The state indications of described target writing area is set to the state indications representing disarmed state;
State indications in the next writing area of described target writing area is set to the state indications representing effective status;
Wipe all data in described target writing area.
Preferably, described method also comprises:
Judge to write successively in the storage space corresponding with described data type in the process of described data to be written and whether produce fault;
If so, fault identifier is obtained;
The fault type of described fault is determined according to the corresponding relation between the fault identifier pre-set and fault type;
Perform the failure handling mechanisms corresponding with described fault type pre-set;
Or,
Judge whether presence bit reversion fault;
If so, the bit reversal failure handling mechanisms corresponding with described bit reversal fault phase pre-set is performed.
A kind of data storage device, be applied to flash memory, described flash memory comprises at least one storage space, comprising: data receipt unit, data type determination unit and storage unit, wherein,
Described data receipt unit is for receiving data to be written;
Described data type determination unit is connected with described data receipt unit, for determining the data type of described data to be written;
Described storage unit is connected with described data type determination unit, for writing described data to be written successively in the storage space corresponding with described data type.
Preferably, described data type determination unit comprises: type identification acquiring unit and data type determination subelement, wherein,
Described type identification acquiring unit is connected with described data receipt unit, for obtaining the type identification entrained by described data to be written;
Described data type determination subelement is connected with described type identification acquiring unit, for determining the data type of described data to be written according to the corresponding relation between the type identification pre-set and data type.
Preferably, at least two writing areas are included in each described storage space, and be provided with status identifier in each said write region, described status identifier represents effective status or disarmed state, and synchronization has and only has a status identifier to represent effective status in same storage space; And each said write region is provided with serial number in each described storage space, and the next writing area of afterbody writing area is head writing area;
Described storage unit comprises: unit, judging unit and data write unit are searched in target writing area, wherein,
Described target storage space determining unit is connected with described data type determination subelement, corresponding relation between the data type pre-set for basis and storage space determines the storage space corresponding to the data type of described data to be written, and as target storage space; Described target writing area is searched unit and is connected with described target storage space determining unit, represents the writing area of effective status for searching status identifier, and as target writing area;
Described judging unit is searched unit with described target writing area and is connected, for judging whether the remaining space of described target writing area meets taking up room of described data to be written;
Described data write unit is connected with described judging unit, when meeting, for the described data to be written of white space write in described target writing area;
Described data write unit comprises: valid data acquiring unit, write subelement and erase unit, wherein:
Valid data acquiring unit is connected with described judging unit, for when the remaining space of described target writing area does not meet taking up room of described data to be written, obtains the valid data in described target writing area;
Said write subelement is connected with described valid data acquiring unit, for being stored into by the described valid data got in the next writing area of described target writing area; And after described data to be written are written to the valid data stored in the next writing area of described target writing area;
Described erase unit is connected with said write subelement, for wiping all data in described target writing area.
Preferably, described device also comprises: fault processing unit, wherein,
Described fault processing unit for judge to write successively described data to be written in the storage space corresponding with described data type process in whether produce fault;
If so, fault identifier is obtained;
The fault type of described fault is determined according to the corresponding relation between the fault identifier pre-set and fault type;
Perform the failure handling mechanisms corresponding with described fault type pre-set;
Or,
Described fault processing unit is used for judging whether presence bit reversion fault;
If so, the bit reversal failure handling mechanisms corresponding with described bit reversal fault phase pre-set is performed.
Corresponding with device to the above-mentioned a kind of date storage method provided, the application also provides a kind of method for reading data, can read the data stored.
A kind of method for reading data, be applied to flash memory, described flash memory comprises at least one storage space, at least two writing areas are included in each described storage space, and be provided with status identifier in each said write region, described status identifier represents effective status or disarmed state, and synchronization has and only has a status identifier to represent effective status in same storage space, comprising:
Receive data read request information;
Obtain the data type of the data to be read entrained by described data read request information;
Determine the storage space corresponding with described data read request information according to the data type pre-set and the corresponding relation between storage space, and read storage space as target;
In described target reading storage space, search state indications represent that writing area is read as target in the writing area of effective status;
Read in writing area in described target and read valid data.
As can be seen here, the application provides a kind of date storage method and memory storage, first data to be written are received, then the type of data to be written is determined, finally in the storage space corresponding with this data type, write data to be written successively, the method is in data storage procedure, by writing data to be written successively in storage space, do not need all to carry out an erase operation when writing data to be written at every turn, can solve prior art is carrying out in the process of data storage at every turn, all need to carry out erase operation to the data in a upper effective SECTOR, make erase operation frequent, and then the problem causing service life of flash memory to reduce.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present application or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, the accompanying drawing that the following describes is only some embodiments recorded in the application, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
A kind of date storage method process flow diagram that Fig. 1 provides for the embodiment of the present application one;
A kind of date storage method process flow diagram that Fig. 2 provides for the embodiment of the present application two;
A kind of date storage method process flow diagram that Fig. 3 provides for the embodiment of the present application three;
A kind of method for reading data process flow diagram that Fig. 4 provides for the embodiment of the present application four;
The structural representation of a kind of data storage device that Fig. 5 provides for the embodiment of the present application five;
The structural representation of the another kind of data storage device that Fig. 6 provides for the embodiment of the present application five;
The detailed construction schematic diagram of the data write unit that Fig. 7 provides for the embodiment of the present application five.
Embodiment
The application's scheme is understood better in order to make those skilled in the art person.Below in conjunction with the accompanying drawing in the embodiment of the present application, be clearly and completely described the technical scheme in the embodiment of the present application, obviously, described embodiment is only some embodiments of the present application, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtained under creative work prerequisite, all should belong to the scope of the application's protection.
Embodiment one:
A kind of date storage method process flow diagram that Fig. 1 provides for the embodiment of the present application one.
As shown in Figure 1, the method comprises:
Step S101: receive data to be written.
In the embodiment of the present application, the date storage method provided is applied to flash memory, and flash memory comprises at least one storage space, when user needs to store data in a flash memory, when namely there is data storage requirement, first the method receives the data to be written that user sends.
Step S102: the data type determining data to be written.
In the embodiment of the present application, the date storage method provided, after receiving data to be written, the method can judge the data type of these data to be written, and judge that the data type of data to be written is mainly by obtaining the type identification entrained by data to be written, then determines the data type of data to be written according to the corresponding relation between the type identification pre-set and data type.
Step S103: write data to be written successively in the storage space corresponding with data type.
In the embodiment of the present application, each storage space in flash memory, all to there being unique data type, when after the data type determining data to be written, writes data to be written in the storage space corresponding with the data type of data to be written in a flash memory successively.Wherein, in the storage space corresponding with the data type of data to be written, write data to be written successively can be to have the white space in this storage space to write data to be written successively at every turn.
In the embodiment of the present application, the data type of data to be written can be the data type etc. that data type that the low and important data type of Modification Frequency, Modification Frequency are high or Modification Frequency are low, and the data of the unique a kind of data type of corresponding stored in each storage space.
As can be seen here, the application provides a kind of date storage method, first the method receives data to be written, then the type of data to be written is determined, finally in the storage space corresponding with this data type, write data to be written successively, the method is in data storage procedure, by writing data to be written successively in storage space, when not needing to write data to be written at every turn, all carry out an erase operation, can solve prior art is carrying out in the process of data storage at every turn, all need to carry out erase operation to the data in a upper effective SECTOR, make erase operation frequent, and then the problem causing service life of flash memory to reduce.
Embodiment two:
A kind of date storage method process flow diagram that Fig. 2 provides for the embodiment of the present application two.
As shown in Figure 2, the method comprises
Step S201: receive data to be written.
In the embodiment of the present application, the date storage method provided is applied to flash memory, and flash memory comprises at least one storage space, when user needs to store data in a flash memory, when namely there is data storage requirement, first the method receives the data to be written that user sends.
Step S202: obtain the type identification entrained by data to be written.
In the embodiment of the present application, the data to be written that the user received sends all carry type identification, obtain the type identification of data to be written.
Step S203: the data type determining data to be written according to the corresponding relation between the type identification pre-set and data type.
In the date storage method that the embodiment of the present application provides, be previously provided with the corresponding relation of type identification and data type, after receiving data to be written, obtain the type identification of data to be written, and determine the data type of data to be written according to the corresponding relation between the type identification pre-set and data type.
Step S204: the storage space corresponding to data type determining data to be written according to the corresponding relation between the data type pre-set and storage space, and as target storage space.
In the embodiment of the present application, the data type that each storage space in flash memory is all corresponding unique, when after the data type determining data to be written, the storage space corresponding to this data type to be written is determined according to the corresponding relation between the data type pre-set and storage space, and using this storage space as target storage space.
Step S205: search the writing area that status identifier represents effective status, and as target writing area.
In the embodiment of the present application, at least two writing areas are included in each described storage space, and be provided with status identifier in each said write region, described status identifier represents effective status or disarmed state, and synchronization has and only has a status identifier to represent effective status in same storage space.When after the storage space corresponding to the data type determining data to be written, using this storage space as target storage space, and search the writing area that status identifier represents effective status in this target storage space, and using this writing area as target writing area.
Step S206: judge whether the remaining space of target writing area meets taking up room of data to be written.
In the embodiment of the present application, in target writing area, may store other data before write data to be written, now judge the space whether remaining space of target writing area meets data to be written and will take.
Step S207: write data to be written at the white space of target writing area.
In the embodiment of the present application, when the remaining space of target writing area meets the space that data to be written will take, data to be written are write at the white space of target writing area.
Step S208: obtain the valid data in target writing area.
In the embodiment of the present application, when the remaining space of target writing area does not meet the space that data to be written will take, the valid data in this target writing area are obtained.Wherein, valid data refer to the data of current up-to-date storage, as: the information storing altogether twice same file in this target writing area, the information of this file of so second time storage is valid data.But, be more than the preferred implementation method that the embodiment of the present application provides, concrete specifies which is valid data, and inventor can set arbitrarily according to the demand of oneself.
Step S209: store valid data in the next writing area of target writing area.
In the embodiment of the present application, in each described storage space, each said write region is provided with serial number, and the next writing area of afterbody writing area is head writing area.After getting the valid data in target writing area, this valid data are stored in the writing area corresponding to next one numbering of the numbering in this target writing area, and after data to be written being written to the valid data stored in the next writing area of target writing area.
Step S210: write data to be written after the valid data stored in the next writing area of target writing area.
In the embodiment of the present application, after storing these valid data in the writing area corresponding to numbering when the next one of the numbering in this target writing area, data to be written are write.
Step S211: all data in erasing target writing area.
As can be seen here, the embodiment of the present application provides a kind of date storage method, and by the detailed description of each process to date storage method, clear, the clear detailed process describing data storage, makes the concrete operations personnel of the method more understand method.
Embodiment three:
A kind of date storage method process flow diagram that Fig. 3 provides for the embodiment of the present application three.
As shown in Figure 3, the method comprises:
Step S301: receive data to be written.
Step S302: the data type determining data to be written.
Step S303: write data to be written successively in the storage space corresponding with data type.
The implementation of the step S301-S303 provided in the embodiment of the present application three is identical with the implementation of the step S101-S103 provided in embodiment one, the detailed description that the application implements the step S301-S303 provided in three refers to the step S101-S103 in the embodiment of the present application one, does not repeat them here.
In the application implements, may produce fault by the process of storage space corresponding with the data type of these data to be written for data write to be written, therefore, the date storage method that the embodiment of the present application provides also comprises:
Step S304: judge to write successively in the storage space corresponding with data type in the process of described data to be written whether produce fault.
In the embodiment of the present application, whether produce fault in the process judging to write successively described data to be written in the storage space corresponding with data type, just a kind of optimal way of the embodiment of the present application, inventor can also according to the demand of oneself, and setting any time judges whether to produce fault.
Step S305: obtain fault identifier.
Step S306: according to the fault type of the corresponding relation determination fault between the fault identifier pre-set and fault type.
In the application implements, be previously provided with the fault type corresponding with fault identifier, after getting fault identifier, according to the fault type of the corresponding relation determination fault between the fault identifier pre-set and fault type.
Step S307: perform the failure handling mechanisms corresponding with fault type pre-set.
In the embodiment of the present application, be previously provided with the failure handling mechanisms corresponding with fault type, after determining the fault type corresponding to fault identifier, according to the failure handling mechanisms corresponding with fault type pre-set, determine the failure handling mechanisms that perform, and perform this failure handling mechanisms.
In actual applications, following several fault and failure handling mechanisms is corresponding thereto set with:
In the embodiment of the present application, when there is following fault, as:
When the address of needs write is not empty, or, data and the expectation value of write are not inconsistent, or current write operation does not also complete, had again new request, or the next writing area of target writing area is not empty, the failure handling mechanisms adopted is first perform deletion action to the next writing area of target writing area, and then is copied in the next writing area of this target writing area by the valid data in target writing area.
When in all writing areas in same storage area, have the state of a writing area to be effective, when the state of another writing area is for writing, the failure handling mechanisms of employing is be the writing area erasing write by state.
When the header that there is writing area in a storage area is incorrect, the failure handling mechanisms of employing is by the data erase in the whole storage areas in this storage area, then carries out record according to the data in RAM.
When the School Affairs of the data read from writing area is not inconsistent with the School Affairs calculated when these data are write this writing area, the failure handling mechanisms of employing is ignore the data this time read, and records this event.
In the application implements, may there is bit reversal fault in the data that the writing area in each storage space in flash memory stores, therefore, the date storage method that the embodiment of the present application provides also comprises:
Step S308: judge whether presence bit reversion fault.
Step S309: perform the bit reversal failure handling mechanisms corresponding with described bit reversal fault phase pre-set.
In the embodiment of the present application, first the treatment mechanism of the corresponding bit reversal fault provided for obtain fault address, and all valid data read before this fault address, and valid data are write the next writing area of the writing area of the storage area that this fault address is positioned at, the writing area erasing be simultaneously positioned at by this fault address.
As can be seen here, the embodiment of the present application provides the bit reversal failure handling mechanisms of the data generation bit reversal fault that the writing area in each storage space of failure handling mechanisms and the flash memory broken down in data storage procedure stores on the basis of above-described embodiment, more perfect, clear by the date storage method providing failure handling mechanisms to make the application provide on the basis of date storage method.
Embodiment four:
For the date storage method that each embodiment above-mentioned provides, provide a kind of corresponding method for reading data in the embodiment of the present application.
A kind of method for reading data process flow diagram that Fig. 4 provides for the embodiment of the present application four.
As shown in Figure 4, the method comprises:
Step S401: receive data read request information.
In the embodiment of the present application, the method for reading data provided, first receives data read request information, and carries the data type of data to be read in this data read request information.
Step S402: the data type obtaining the data to be read entrained by described data read request information.
Step S403: determine the storage space corresponding with described data read request information according to the data type pre-set and the corresponding relation between storage space, and read storage space as target.
In the embodiment of the present application, in data read process, first data request information is received, and obtain the data type of data to be read entrained in data request information, then determine the storage space corresponding with data read request information according to the data type pre-set with the corresponding relation between storage space, and this storage space is read storage space as target.
Step S404: search state indications and represent that writing area is read as target in the writing area of effective status in target reading storage space.
In the embodiment of the present application, at least two writing areas are included in each each storage space, and be provided with status identifier in each writing area, status identifier represents effective status or disarmed state, and synchronization has and only has a status identifier to represent effective status in same storage space, after inquiring target reading storage space, read in storage space the writing area of searching state indications label table and showing effective status in target, and read writing area as target.
Step S405: read in writing area in target and read valid data.
In the embodiment of the present application, the target valid data read in storage space refer to the data of current up-to-date storage, as: the information storing altogether twice same file in this target writing area, the information of this file of so second time storage is valid data.But, be more than the preferred implementation method that the embodiment of the present application provides, concrete specifies which is valid data, and inventor can set arbitrarily according to the demand of oneself.
As can be seen here, the basis of the date storage method that the embodiment of the present application provides at above-described embodiment provides a kind of method for reading data, first the method receives data read request information, then the storage space corresponding with data request information is judged, and read storage space as target, and query State indications identifies effective writing area in target reading storage space, and read writing area as target, finally read in writing area in target and read valid data.The embodiment of the present application is by the method for reading data for date storage method, and the scheme that the application is provided is more perfect.
Embodiment five:
The structural representation of a kind of data storage device that Fig. 5 provides for the embodiment of the present application five.
As shown in Figure 5, this device comprises: data receipt unit 1, data type determination unit 2 and storage unit 3.
Wherein, data receipt unit 1, data type determination unit 2 are connected successively with storage unit 3.
Data receipt unit 1 is for receiving data to be written.
In the embodiment of the present application, the data storage device provided is applied to flash memory, and flash memory comprises at least one storage space, when user needs to store data in a flash memory, when namely there is data storage requirement, first this data receipt unit 1 receives the data to be written that user sends.
Described data type determination unit 2 is connected with described data receipt unit 1, and data type determination unit 2 determines the data type of the data to be written received.
In the embodiment of the present application, the data storage device provided, after receiving data to be written, data type determination unit 2 in this device can judge the data type of these data to be written, and judge that the data type of data to be written is mainly by obtaining the type identification entrained by data to be written, then determines the data type of data to be written according to the corresponding relation between the type identification pre-set and data type.
Described storage unit 3 is connected with described data type determination unit 2, and storage unit 3 writes described data to be written successively in the storage space corresponding with described data type.
In the embodiment of the present application, each storage space in flash memory is all to there being unique data type, when after the data type determining data to be written, in storage unit 3 storage space corresponding with the data type of data to be written in a flash memory, write data to be written successively.Wherein, in the storage space corresponding with the data type of data to be written, write data to be written successively can be to have the white space in this storage space to write data to be written successively at every turn.
The structural representation of the another kind of data storage device that Fig. 6 provides for the embodiment of the present application five.
As shown in Figure 6, this device comprises: unit 32, judging unit 33 and data write unit 34 are searched in data receipt unit 1, type identification acquiring unit 21, data type determination subelement 22, target storage space determining unit 31, target writing area.
Wherein, data receipt unit 1, type identification acquiring unit 21, data type determination subelement 22, target storage space determining unit 31, unit 32 is searched in target writing area, judging unit 33 is connected successively with data write unit 34.
Data receipt unit 1 is for receiving data to be written.
In the embodiment of the present application, the data storage device provided is applied to flash memory, and flash memory comprises at least one storage space, when user needs to store data in a flash memory, when namely there is data storage requirement, first this data receipt unit 1 receives the data to be written that user sends.
Described type identification acquiring unit 21 is connected with described data receipt unit 1, and type identification acquiring unit 21 obtains the type identification entrained by data to be written received.
Described data type determination subelement 22 is connected with described type identification acquiring unit 21, and data type determination subelement 22 determines the data type of described data to be written according to the corresponding relation between the type identification pre-set and data type.
Described target storage space determining unit 31 is connected with described data type determination subelement 22, target storage space determining unit 31 determines the storage space corresponding to the data type of described data to be written according to the corresponding relation between the data type pre-set and storage space, and as target storage space.
In the embodiment of the present application, the data type that each storage space in flash memory is all corresponding unique, when after the data type determining data to be written, target storage space determining unit 31 determines the storage space corresponding to this data type to be written according to the corresponding relation between the data type pre-set and storage space, namely these data to be written are about to the storage space that is written into, and using this storage space as target storage space.
Target writing area is searched unit 32 and is connected with target storage space determining unit 31, and target writing area is searched unit 32 and searched the writing area that status identifier represents effective status, and it can be used as target writing area.
In the embodiment of the present application, at least two writing areas are included in each described storage space, and be provided with status identifier in each said write region, described status identifier represents effective status or disarmed state, and synchronization has and only has a status identifier to represent effective status in same storage space.When after the storage space corresponding to the data type determining data to be written, using this storage space as target storage space, target writing area is searched unit 32 in this target storage space, is searched the writing area that status identifier represents effective status, and using this writing area as target writing area.
Described judging unit 33 is searched unit 32 with described target writing area and is connected, and judging unit 33 judges whether the remaining space of described target writing area meets taking up room of described data to be written.
Described data write unit 34 is connected with described judging unit 33, when meeting, and the white space write described to be written data of data write unit 34 in described target writing area.
When not meeting, as shown in Figure 7, this data write unit concrete structure comprises: write subelement 341, valid data acquiring unit 342 and erase unit 343.
Wherein, write subelement 341, valid data acquiring unit 342 are connected successively with erase unit 343.
Valid data acquiring unit 342 is connected with described judging unit 33, and when the remaining space of described target writing area does not meet taking up room of described data to be written, valid data acquiring unit 342 obtains the valid data in described target writing area.In the embodiment of the present application, when the remaining space of target writing area does not meet the space that data to be written will take, valid data acquiring unit 342 obtains the valid data in this target writing area.Wherein, valid data refer to the data of current up-to-date storage, as: the information storing altogether twice same file in this target writing area, the information of this file of so second time storage is valid data.But, be more than the preferred implementation method that the embodiment of the present application provides, concrete specifies which is valid data, and inventor can set arbitrarily according to the demand of oneself.
Said write subelement 342 is connected with described valid data acquiring unit 341, and write subelement 342 is for being stored in the next writing area of described target writing area by the described valid data got; And after described data to be written are written to the valid data stored in the next writing area of described target writing area.
In the embodiment of the present application, in each described storage space, each said write region is provided with serial number, and the next writing area of afterbody writing area is head writing area.After getting the valid data in target writing area, write subelement 342 writes this valid data in the writing area corresponding to the next one numbering of the numbering of this target writing area, and after data to be written being written to the valid data stored in the next writing area of target writing area.
Described erase unit 343 is connected with said write subelement 342, and erase unit 343 wipes all data in described target writing area.
In addition, as shown in Figure 6, the data storage device that the embodiment of the present application provides also comprises fault processing unit 4.
This fault processing unit 4 is connected with data write unit 34, and described fault processing unit 4 one aspect can judge to write successively in the storage space corresponding with described data type in the process of described data to be written whether produce fault; If so, fault identifier is obtained; And the fault type of described fault is determined according to the corresponding relation between the fault identifier pre-set and fault type; Finally perform the failure handling mechanisms corresponding with described fault type pre-set;
Fault processing unit 4 one aspect may be used for judging data in the writing area in flash memory whether presence bit reversion fault; If so, the bit reversal failure handling mechanisms corresponding with described bit reversal fault phase pre-set is performed.
As can be seen here, the embodiment of the present application provides a kind of data storage device, and this device comprises: data receipt unit, data type determination unit and storage unit, and wherein, data receipt unit is for receiving data to be written; Described data type determination unit is connected with described data receipt unit, and data type determination unit determines the data type of the data described to be written received; Described storage unit is connected with described data type determination unit, and storage unit writes described data to be written successively in the storage space corresponding with described data type.This device is in data storage procedure, by writing data to be written successively in storage space, when not needing to write data to be written at every turn, all carry out an erase operation, can solve prior art is carrying out in the process of data storage at every turn, all need to carry out erase operation to the data in a upper effective SECTOR, make erase operation frequent, and then the problem causing service life of flash memory to reduce.
In this instructions, each embodiment adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar portion mutually see.For device disclosed in embodiment, because it corresponds to the method disclosed in Example, so description is fairly simple, relevant part illustrates see method part.
For convenience of description, various unit is divided into describe respectively with function when describing above device.Certainly, the function of each unit can be realized in same or multiple software and/or hardware when implementing the application.
As seen through the above description of the embodiments, those skilled in the art can be well understood to the mode that the application can add required general hardware platform by software and realizes.Based on such understanding, the technical scheme of the application can embody with the form of software product the part that prior art contributes in essence in other words, this computer software product can be stored in storage medium, as ROM/RAM, magnetic disc, CD etc., comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform the method described in some part of each embodiment of the application or embodiment.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, between each embodiment identical similar part mutually see, what each embodiment stressed is the difference with other embodiments.Especially, for device embodiment, because it is substantially similar to embodiment of the method, so describe fairly simple, relevant part illustrates see the part of embodiment of the method.Device embodiment described above is only schematic, the wherein said unit illustrated as separating component or can may not be and physically separates, parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of module wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.Those of ordinary skill in the art, when not paying creative work, are namely appreciated that and implement.
The application can be used in numerous general or special purpose computing system environment or configuration.Such as: personal computer, server computer, handheld device or portable set, laptop device, multicomputer system, system, set top box, programmable consumer-elcetronics devices, network PC, small-size computer, mainframe computer, the distributed computing environment comprising above any system or equipment etc. based on microprocessor.
The application can describe in the general context of computer executable instructions, such as program module.Usually, program module comprises the routine, program, object, assembly, data structure etc. that perform particular task or realize particular abstract data type.Also can put into practice the application in a distributed computing environment, in these distributed computing environment, be executed the task by the remote processing devices be connected by communication network.In a distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium comprising memory device.
The above is only the embodiment of the application; it should be pointed out that for those skilled in the art, under the prerequisite not departing from the application's principle; can also make some improvements and modifications, these improvements and modifications also should be considered as the protection domain of the application.

Claims (6)

1. a date storage method, is applied to flash memory, and described flash memory comprises at least one storage space, it is characterized in that, comprising:
Each storage space is all to there being unique data type, at least two writing areas are included in each described storage space, and be provided with status identifier in each said write region, described status identifier represents effective status or disarmed state, and synchronization has and only has a status identifier to represent effective status in same storage space;
Receive data to be written;
Determine the data type of described data to be written, comprising: obtain the type identification entrained by described data to be written, determine the data type of described data to be written according to the corresponding relation between the type identification pre-set and data type;
Described data to be written are write successively in the storage space corresponding with described data type, comprising: the storage space corresponding to the data type determining described data to be written according to the corresponding relation between the data type pre-set and storage space, and as target storage space; The writing area that status identifier represents effective status is searched in described target storage space, and as target writing area; Judge whether the remaining space of described target writing area meets taking up room of described data to be written; When meeting, the described data to be written of white space write in described target writing area.
2. method according to claim 1, is characterized in that, in each described storage space, each said write region is provided with serial number, and the next writing area of afterbody writing area is head writing area,
When the remaining space of described target writing area does not meet taking up room of described data to be written, the method also comprises:
Obtain the valid data in described target writing area;
Described valid data are stored in the next writing area of described target writing area;
Described data to be written are write after the valid data stored in the next writing area of described target writing area;
The state indications of described target writing area is set to the state indications representing disarmed state;
State indications in the next writing area of described target writing area is set to the state indications representing effective status;
Wipe all data in described target writing area.
3. method according to claim 2, is characterized in that, also comprises:
Judge to write successively in the storage space corresponding with described data type in the process of described data to be written and whether produce fault;
If so, fault identifier is obtained;
The fault type of described fault is determined according to the corresponding relation between the fault identifier pre-set and fault type;
Perform the failure handling mechanisms corresponding with described fault type pre-set;
Or,
Judge whether presence bit reversion fault;
If so, the bit reversal failure handling mechanisms corresponding with described bit reversal fault phase pre-set is performed.
4. a data storage device, is applied to flash memory, and described flash memory comprises at least one storage space, it is characterized in that, comprising: data receipt unit, data type determination unit and storage unit, wherein,
Described data receipt unit is for receiving data to be written;
Described data type determination unit is connected with described data receipt unit, for determining the data type of described data to be written;
Described storage unit is connected with described data type determination unit, for writing described data to be written successively in the storage space corresponding with described data type;
Wherein, each storage space is all to there being unique data type;
Described data type determination unit comprises: type identification acquiring unit and data type determination subelement, wherein,
Described type identification acquiring unit is connected with described data receipt unit, for obtaining the type identification entrained by described data to be written;
Described data type determination subelement is connected with described type identification acquiring unit, for determining the data type of described data to be written according to the corresponding relation between the type identification pre-set and data type;
At least two writing areas are included in each described storage space, and be provided with status identifier in each said write region, described status identifier represents effective status or disarmed state, and synchronization has and only has a status identifier to represent effective status in same storage space; And each said write region is provided with serial number in each described storage space, and the next writing area of afterbody writing area is head writing area;
Described storage unit comprises: unit, judging unit and data write unit are searched in target writing area, wherein,
Target storage space determining unit is connected with described data type determination subelement, corresponding relation between the data type pre-set for basis and storage space determines the storage space corresponding to the data type of described data to be written, and as target storage space; Described target writing area is searched unit and is connected with described target storage space determining unit, represents the writing area of effective status for searching status identifier, and as target writing area;
Described judging unit is searched unit with described target writing area and is connected, for judging whether the remaining space of described target writing area meets taking up room of described data to be written;
Described data write unit is connected with described judging unit, when meeting, for the described data to be written of white space write in described target writing area;
Described data write unit comprises: valid data acquiring unit, write subelement and erase unit, wherein:
Valid data acquiring unit is connected with described judging unit, for when the remaining space of described target writing area does not meet taking up room of described data to be written, obtains the valid data in described target writing area;
Said write subelement is connected with described valid data acquiring unit, for being stored into by the described valid data got in the next writing area of described target writing area; And after described data to be written are written to the valid data stored in the next writing area of described target writing area;
Described erase unit is connected with said write subelement, for wiping all data in described target writing area.
5. device according to claim 4, is characterized in that, also comprises: fault processing unit, wherein,
Described fault processing unit for judge to write successively described data to be written in the storage space corresponding with described data type process in whether produce fault;
If so, fault identifier is obtained;
The fault type of described fault is determined according to the corresponding relation between the fault identifier pre-set and fault type;
Perform the failure handling mechanisms corresponding with described fault type pre-set;
Or,
Described fault processing unit is used for judging whether presence bit reversion fault;
If so, the bit reversal failure handling mechanisms corresponding with described bit reversal fault phase pre-set is performed.
6. a method for reading data, be applied to flash memory, described flash memory comprises at least one storage space, at least two writing areas are included in each described storage space, and being provided with status identifier in each said write region, described status identifier represents effective status or disarmed state, and synchronization has and only has a status identifier to represent effective status in same storage space, it is characterized in that, comprising:
Receive data read request information;
Obtain the data type of the data to be read entrained by described data read request information;
Determine the storage space corresponding with described data read request information according to the data type pre-set and the corresponding relation between storage space, and read storage space as target;
In described target reading storage space, search state indications represent that writing area is read as target in the writing area of effective status;
Read in writing area in described target and read valid data.
CN201310138191.3A 2013-04-19 2013-04-19 A kind of date storage method, memory storage and read method Active CN103268201B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310138191.3A CN103268201B (en) 2013-04-19 2013-04-19 A kind of date storage method, memory storage and read method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310138191.3A CN103268201B (en) 2013-04-19 2013-04-19 A kind of date storage method, memory storage and read method

Publications (2)

Publication Number Publication Date
CN103268201A CN103268201A (en) 2013-08-28
CN103268201B true CN103268201B (en) 2016-02-17

Family

ID=49011836

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310138191.3A Active CN103268201B (en) 2013-04-19 2013-04-19 A kind of date storage method, memory storage and read method

Country Status (1)

Country Link
CN (1) CN103268201B (en)

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104615546B (en) * 2015-02-13 2018-04-27 小米科技有限责任公司 file data management method and device
JP6424330B2 (en) * 2015-10-13 2018-11-21 株式会社アクセル INFORMATION PROCESSING APPARATUS AND INFORMATION PROCESSING METHOD
CN106816175A (en) * 2015-12-01 2017-06-09 中芯国际集成电路制造(上海)有限公司 The control method and device of memory
CN107015985B (en) * 2016-01-27 2021-03-30 创新先进技术有限公司 Data storage and acquisition method and device
CN105760112B (en) * 2016-02-01 2017-03-15 惠州市蓝微新源技术有限公司 Extend date storage method, read method and the system of memory use time
KR102652293B1 (en) * 2016-03-03 2024-03-29 에스케이하이닉스 주식회사 Method for managing memory
CN107783732A (en) * 2017-10-30 2018-03-09 郑州云海信息技术有限公司 A kind of data read-write method, system, equipment and computer-readable storage medium
CN109769005A (en) * 2017-11-09 2019-05-17 宁波方太厨具有限公司 A kind of data cache method and data buffering system of network request
CN109446462B (en) * 2018-10-29 2021-09-28 东软集团股份有限公司 Page-based data monitoring processing method, device, equipment and storage medium
CN109767003A (en) * 2019-01-31 2019-05-17 深兰科技(上海)有限公司 Storage controlling method, device, electronic equipment and the medium of neural network accelerator
CN111797089A (en) * 2019-04-09 2020-10-20 Oppo广东移动通信有限公司 Data writing method and device, storage medium and electronic equipment
CN110515944B (en) * 2019-08-16 2022-03-29 出门问问(苏州)信息科技有限公司 Data storage method based on distributed database, storage medium and electronic equipment
CN111324554B (en) * 2020-02-18 2022-03-18 日立楼宇技术(广州)有限公司 Management method and device of flash memory data and elevator controller
CN111831590A (en) * 2020-06-05 2020-10-27 嘉兴行适安车联网信息科技有限公司 Algorithm for reliably protecting NVRAM data content from loss
CN112255997A (en) * 2020-10-23 2021-01-22 深圳市元征科技股份有限公司 Vehicle offline diagnosis method and device and computer storage medium
CN113660180B (en) * 2021-07-30 2023-11-28 鹏城实验室 Data storage method, device, terminal and storage medium
CN114637469A (en) * 2022-03-21 2022-06-17 上海美仁半导体有限公司 Data read-write method, system, medium and equipment of Flash memory

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1627272A (en) * 2003-12-10 2005-06-15 上海贝豪通讯电子有限公司 Method for managing files in flash memory of mobile terminal
CN101324862A (en) * 2008-05-05 2008-12-17 青岛海信电器股份有限公司 Flash memory storage management method
CN101446921A (en) * 2008-12-23 2009-06-03 青岛海信宽带多媒体技术股份有限公司 Dynamic storage method of Flash memory
CN101521734A (en) * 2009-03-31 2009-09-02 深圳创维-Rgb电子有限公司 Method, device and television for storing television data

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090125753A1 (en) * 2007-11-13 2009-05-14 Anton Joseph Kryka Handling of data storage within a flash media device
CN101894077B (en) * 2010-06-24 2012-06-27 深圳市江波龙电子有限公司 Data storage method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1627272A (en) * 2003-12-10 2005-06-15 上海贝豪通讯电子有限公司 Method for managing files in flash memory of mobile terminal
CN101324862A (en) * 2008-05-05 2008-12-17 青岛海信电器股份有限公司 Flash memory storage management method
CN101446921A (en) * 2008-12-23 2009-06-03 青岛海信宽带多媒体技术股份有限公司 Dynamic storage method of Flash memory
CN101521734A (en) * 2009-03-31 2009-09-02 深圳创维-Rgb电子有限公司 Method, device and television for storing television data

Also Published As

Publication number Publication date
CN103268201A (en) 2013-08-28

Similar Documents

Publication Publication Date Title
CN103268201B (en) A kind of date storage method, memory storage and read method
CN101354715B (en) For system, the method and computer program product of operating data processing system
CN109522154B (en) Data recovery method and related equipment and system
CN103294572A (en) Electronic device to restore MBR, and method thereof
CN102902763B (en) The method of association, retrieving information process data and process information task and device
CN104461390A (en) Method and device for writing data into imbricate magnetic recording SMR hard disk
CN109496292B (en) Disk management method, disk management device and electronic equipment
CN107291950B (en) Form data updating method and device and computer equipment
CN104216796A (en) Data backup and recovery method and electronic device
US10572335B2 (en) Metadata recovery method and apparatus
CN104077380A (en) Method and device for deleting duplicated data and system
US20100131685A1 (en) Hardware configuration information system, method, and computer program product
CN105653539A (en) Index distributed storage implement method and device
US9875046B2 (en) Tape backup and restore in a disk storage environment with intelligent data placement
CN102902770A (en) Method and system for assembling mirror image files
CN108228611B (en) Document information copying method and device
CN106201570A (en) A kind of application program exempts from installation and operation method and device
CN105426131A (en) KV (Key Value) storage implementation method and device
US9535796B2 (en) Method, apparatus and computer for data operation
CN107704208B (en) Method, device and medium for repairing metadata
CN103870603A (en) Directory management method and electronic device
US20180307684A1 (en) Method and Device for Reading and Writing Video Data in NAS Device
CN111221817B (en) Service information data storage method, device, computer equipment and storage medium
CN114185849A (en) File operation method, file operation system, electronic device and storage medium
CN112148712A (en) Data processing method, device, equipment and medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address

Address after: 4 / F, building 1, No.14 Jiuxianqiao Road, Chaoyang District, Beijing 100020

Patentee after: Beijing Jingwei Hirain Technologies Co.,Inc.

Address before: 100101 Beijing city Chaoyang District Anxiang Beili 11 B block 8 layer

Patentee before: Beijing Jingwei HiRain Technologies Co.,Ltd.

CP03 Change of name, title or address