CN103268201A - Data storing method, storing device and reading method - Google Patents

Data storing method, storing device and reading method Download PDF

Info

Publication number
CN103268201A
CN103268201A CN2013101381913A CN201310138191A CN103268201A CN 103268201 A CN103268201 A CN 103268201A CN 2013101381913 A CN2013101381913 A CN 2013101381913A CN 201310138191 A CN201310138191 A CN 201310138191A CN 103268201 A CN103268201 A CN 103268201A
Authority
CN
China
Prior art keywords
data
writing area
written
storage space
type
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
Application number
CN2013101381913A
Other languages
Chinese (zh)
Other versions
CN103268201B (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

Images

Landscapes

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

Abstract

The invention discloses a data storing method, a storing device and a reading method. The method comprises steps of firstly, receiving data to be written, then determining the type of the data to be written, and finally, sequentially wiring the data to be written into the storage space corresponding to the data type. In the data storing process of the method, the data to be written is sequentially written into the storage spaces, and an erasing operation is carried out for one time when the data to be written does not need to be written each time, so that the method solves the problem in the prior art that the service life of flash memory is shortened due to frequent erasing operations which are caused by the fact that data in the last effective SECTOR needs to be erased in each data storing process.

Description

A kind of date storage method, memory storage and read method
Technical field
The application relates to the 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 products all are next program code stored with flash memory, and storing with serial storage often needs data updated.But this storage mode can make the hardware cost of product rise on the one hand because use serial storage, on the other hand also can be bigger because of the storage space of flash memory, and only program code stored in flash memory, can cause the waste of flash memory space.
Prior art, a kind of date storage method is provided, this method utilizes flash memory to simulate the function of serial storage storage data, mainly be storage space with flash memory be divided into n SECTOR(wherein SECTOR be the minimum erase units of flash memory), and be provided with the state validity that the Sector Status(corresponding with it wherein comprises SECTOR among the Sector Status among each SECTOR, data validity, information such as type and length), because flash memory carries out must carrying out the wiping operation earlier before the write operation, carry out write operation again, so when existing data to write request, flash memory is at first found current effective SECTOR by Sector Status, then the data among this SECTOR are copied out, and be written to next SECTOR with the data that are about to write, at last with the data erase among the last SECTOR, thereby realize storage to data.
By the research to prior art, the inventor finds: though existing date storage method can be realized the function by flash memory simulation serial storage storage data, but because write in the process of data at every turn, all need the data among the last effective SECTOR are carried out erase operation, make erase operation frequent, and then cause the flash memory life-span to be reduced.
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 the data storage, all need the data among the last effective SECTOR are carried out erase operation, make erase operation frequent, and then cause the problem of flash memory life-span reduction.
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 is applied to flash memory, comprises at least one storage space in the described flash memory, comprising:
Receive data to be written;
Determine the data type of described data to be written;
In the storage space corresponding with described data type, write described data to be written successively.
Preferably, the data type of described definite described data to be written comprises:
Obtain the entrained type identification of described data to be written;
Determine the data type of described data to be written according to the corresponding relation between the type identification that sets in advance and the data type.
Preferably, include at least two writing areas in each described storage space, and be provided with status identifier in each said write zone, described status identifier is represented effective status or disarmed state, and synchronization has and has only 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 and comprise:
Determine the corresponding storage space of data type of described data to be written according to the corresponding relation between the data type that sets in advance and the storage space, and as the target storage space;
In described target storage space, search the writing area that status identifier is represented effective status, and as the target writing area;
Whether the remaining space of judging described target writing area satisfies taking up room of described data to be written;
When satisfying, the white space in described target writing area writes described data to be written.
Preferably, each said write zone is provided with serial number in each described storage space, and the next writing area of afterbody writing area is the head writing area,
When the remaining space of described target writing area did not satisfy taking up room of described data to be written, this method also comprised:
Obtain the valid data in the described target writing area;
The described valid data of storage in the next writing area of described target writing area;
In the next writing area of described target writing area, write described data to be written after institute's stored valid data;
The state indications of described target writing area is set to represent the state indications of disarmed state;
State indications in the next writing area of described target writing area is set to represent the state indications of effective status;
Wipe all data in the described target writing area.
Preferably, described method also comprises:
Judgement writes in the process of described data to be written whether produce fault successively in the storage space corresponding with described data type;
If obtain fault identifier;
Determine the fault type of described fault according to the corresponding relation between the fault identifier that sets in advance and the fault type;
The failure handling mechanisms corresponding with described fault type that execution sets in advance;
Perhaps,
Judge whether presence bit counter-rotating fault;
If carry out the bit reversal failure handling mechanisms corresponding with described bit reversal fault that sets in advance.
A kind of data storage device is applied to flash memory, comprises at least one storage space in the described flash memory, comprising: data receiving element, data type determining unit and storage unit, wherein,
Described data receiving element is used for receiving data to be written;
Described data type determining unit is connected with described data receiving element, is used for determining the data type of described data to be written;
Described storage unit is connected with described data type determining unit, is used for writing described data to be written successively at the storage space corresponding with described data type.
Preferably, described data type determining unit comprises: type identification acquiring unit and data type are determined subelement, wherein,
Described type identification acquiring unit is connected with described data receiving element, is used for obtaining the entrained type identification of described data to be written;
Described data type determines that subelement is connected with described type identification acquiring unit, is used for the data type of determining described data to be written according to the type identification that sets in advance and the corresponding relation between the data type.
Preferably, include at least two writing areas in each described storage space, and be provided with status identifier in each said write zone, described status identifier is represented effective status or disarmed state, and synchronization has and have only a status identifier to represent effective status in same storage space; And each said write zone is provided with serial number in each described storage space, and the next writing area of afterbody writing area is the head writing area;
Described storage unit comprises: unit, judging unit and data write unit are searched in the target writing area, wherein,
Described target storage space determining unit determines that with described data type subelement is connected, be used for the corresponding storage space of data type of determining described data to be written according to the data type that sets in advance and the corresponding relation between the storage space, and as the target storage space; Described target writing area is searched the unit and is connected with described target storage space determining unit, is used for searching the writing area that status identifier is represented effective status, and as the target writing area;
Described judging unit is searched the unit with described target writing area and is connected, and is used for judging whether the remaining space of described target writing area satisfies taking up room of described data to be written;
Described data write unit is connected with described judging unit, and when satisfying, the white space that is used in described target writing area writes described data to be written;
Described data write unit comprises: the valid data acquiring unit, write subelement and erase unit, wherein:
The valid data acquiring unit is connected with described judging unit, is used for obtaining the valid data in the described target writing area when the remaining space of described target writing area does not satisfy taking up room of described data to be written;
The said write subelement is connected with described valid data acquiring unit, and the described valid data that are used for getting access to store the next writing area of described target writing area into; And described data to be written are written in the next writing area of described target writing area after institute's stored valid data;
Described erase unit is connected with the said write subelement, is used for wiping all data of described target writing area.
Preferably, described device also comprises: fault processing unit, wherein,
Described fault processing unit be used for to judge in the storage space corresponding with described data type writes the process of described data to be written successively whether produce fault;
If obtain fault identifier;
Determine the fault type of described fault according to the corresponding relation between the fault identifier that sets in advance and the fault type;
The failure handling mechanisms corresponding with described fault type that execution sets in advance;
Perhaps,
Described fault processing unit is used for judging whether presence bit counter-rotating fault;
If carry out the bit reversal failure handling mechanisms corresponding with described bit reversal fault that sets in advance.
Corresponding with the above-mentioned a kind of date storage method that provides and device, the application also provides a kind of method for reading data, can the data of storage be read.
A kind of method for reading data, be applied to flash memory, comprise at least one storage space in the described flash memory, include at least two writing areas in each described storage space, and be provided with status identifier in each said write zone, described status identifier is represented effective status or disarmed state, and synchronization has and have only a status identifier to represent effective status in same storage space, comprising:
Receive data read request information;
Obtain the data type of the entrained data to be read of described data read request information;
Determine the storage space corresponding with described data read request information according to the data type that sets in advance with the corresponding relation between the storage space, and read storage space as target;
Read in described target and to search the state indications in the storage space and represent that the writing area of effective status reads the writing area as target;
Read in described target and to read valid data in the writing area.
This shows, the application provides a kind of date storage method and memory storage, at first receive data to be written, determine the type of data to be written then, at last in the storage space corresponding with this data type, write data to be written successively, this method is in data storage procedure, by in storage space, writing data to be written successively, all carry out one time erase operation when not needing to write data to be written at every turn, can solve prior art in the process of at every turn carrying out the data storage, all need the data among the last effective SECTOR are carried out erase operation, make erase operation frequent, and then cause the problem of flash memory life-span reduction.
Description of drawings
In order to be illustrated more clearly in the embodiment of the present application or technical scheme of the prior art, to do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below, apparently, the accompanying drawing that describes below only is some embodiment that put down in writing among the application, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing 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 synoptic diagram of the data write unit that Fig. 7 provides for the embodiment of the present application five.
Embodiment
In order to make those skilled in the art person understand the application's scheme better.Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment only is the application's part embodiment, rather than whole embodiment.Based on the embodiment among the application, those of ordinary skills are not making the every other embodiment that obtains under the 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, this method comprises:
Step S101: receive data to be written.
In the embodiment of the present application, the date storage method that provides is applied to flash memory, and comprises at least one storage space in the flash memory, when the user need store data in flash memory, when namely having data storage requirement, this method at first receives the data to be written that the user sends.
Step S102: the data type of determining data to be written.
In the embodiment of the present application, the date storage method that provides, after receiving data to be written, this method can be judged the data type of these data to be written, and the data type of judging data to be written mainly is by obtaining the entrained type identification of data to be written, then the data type of determining data to be written according to the type identification that sets in advance and the corresponding relation between the data type.
Step S103: in the storage space corresponding with data type, write data to be written successively.
In the embodiment of the present application, each storage space in the flash memory all to unique data type should be arranged, after the data type of determining data to be written, writes data to be written in the storage space corresponding with data types data to be written in flash memory successively.Wherein, writing data to be written successively in the storage space corresponding with the data type of data to be written 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 for revising the low and important data type of frequency, revise the high data type of frequency or revise the low data type of frequency etc., and the data of the unique a kind of data type of corresponding stored in each storage space.
This shows, the application provides a kind of date storage method, this method at first receives data to be written, determine the type of data to be written then, at last in the storage space corresponding with this data type, write data to be written successively, this method is in data storage procedure, by in storage space, writing data to be written successively, when not needing to write data to be written at every turn, all carry out erase operation one time, can solve prior art in the process of at every turn carrying out the data storage, all need the data among the last effective SECTOR are carried out erase operation, make erase operation frequent, and then cause the problem of flash memory life-span reduction.
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, this method comprises
Step S201: receive data to be written.
In the embodiment of the present application, the date storage method that provides is applied to flash memory, and comprises at least one storage space in the flash memory, when the user need store data in flash memory, when namely having data storage requirement, this method at first receives the data to be written that the user sends.
Step S202: obtain the entrained type identification of data to be written.
In the embodiment of the present application, the data to be written that the user who receives sends all carry type identification, obtain the type identification of data to be written.
Step S203: the data type of determining data to be written according to the corresponding relation between the type identification that sets in advance and the data type.
In the date storage method that the embodiment of the present application provides, set in advance 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 that sets in advance and the data type.
Step S204: determine the corresponding storage space of data type of data to be written according to the corresponding relation between the data type that sets in advance and the storage space, and as the target storage space.
In the embodiment of the present application, each storage space in the flash memory is the unique data type of correspondence all, after the data type of determining data to be written, determine the corresponding storage space of this data type to be written according to the corresponding relation between the data type that sets in advance and the storage space, and with this storage space as the target storage space.
Step S205: search the writing area that status identifier is represented effective status, and as the target writing area.
In the embodiment of the present application, include at least two writing areas in each described storage space, and be provided with status identifier in each said write zone, described status identifier is represented effective status or disarmed state, and synchronization has and have only a status identifier to represent effective status in same storage space.Behind the corresponding storage space of data type of determining data to be written, with this storage space as the target storage space, and in this target storage space, search the writing area that status identifier is represented effective status, and with this writing area as the target writing area.
Step S206: whether the remaining space of judging the target writing area satisfies taking up room of data to be written.
In the embodiment of the present application, before writing data to be written, may store other data in the target writing area, judge whether the remaining space of target writing area satisfies data to be written and want occupation space this moment.
Step S207: the white space in the target writing area writes data to be written.
In the embodiment of the present application, when the remaining space of target writing area satisfied data to be written and wants occupation space, the white space in the target writing area write data to be written.
Step S208: obtain the valid data in the target writing area.
In the embodiment of the present application, when the remaining space of target writing area does not satisfy data to be written and wants occupation space, obtain the valid data in this target writing area.Wherein, valid data refer to the data of present up-to-date storage, as: the information of having stored twice same file altogether in this target writing area, the information of this document of storage is valid data so for the second time.But, be the preferred implementation method that the embodiment of the present application provides more than, which is valid data, and the inventor can set arbitrarily according to the demand of oneself in concrete stipulating.
Step S209: in the next writing area of target writing area, store valid data.
In the embodiment of the present application, each said write zone is provided with serial number in each described storage space, and the next writing area of afterbody writing area is the head writing area.Behind the valid data in getting access to the target writing area, number these valid data of storage in the corresponding writing area at the next one of the numbering of this target writing area, and data to be written are written in the next writing area of target writing area after institute's stored valid data.
Step S210: in the next writing area of target writing area, write data to be written after institute's stored valid data.
In the embodiment of the present application, when numbering at the next one of the numbering of this target writing area in the corresponding writing area after these valid data of storage, write data to be written.
Step S211: wipe all data in the target writing area.
This shows that the embodiment of the present application provides a kind of date storage method, by the detailed description to each process of data storage means, clear, the introduction understood the detailed process of data storages, make the concrete operations personnel of this method understand more 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, this method comprises:
Step S301: receive data to be written.
Step S302: the data type of determining data to be written.
Step S303: in the storage space corresponding with data type, write data to be written successively.
The implementation of the step S101-S103 that provides among the implementation of the step S301-S303 that provides in the embodiment of the present application three and the embodiment one is identical, the detailed description of the step S301-S303 that the application implements to provide in three sees also the step S101-S103 in the embodiment of the present application one, does not repeat them here.
In the application implements, data to be written are write in the process of the storage space corresponding with the data type of these data to be written and may produce fault, therefore, the date storage method that the embodiment of the present application provides also comprises:
Step S304: judge in the process that in the storage space corresponding with data type, writes described data to be written successively whether produce fault.
In the embodiment of the present application, be to judge in the process that in the storage space corresponding with data type, writes described data to be written successively whether produce fault, it is a kind of optimal way of the embodiment of the present application, the inventor can also be according to own demand, and setting any time judges whether to produce fault.
Step S305: obtain fault identifier.
Step S306: the fault type of determining fault according to the corresponding relation between the fault identifier that sets in advance and the fault type.
In the application implements, set in advance the fault type corresponding with fault identifier, after getting access to fault identifier, determine the fault type of fault according to the corresponding relation between the fault identifier that sets in advance and the fault type.
Step S307: carry out the failure handling mechanisms corresponding with fault type that sets in advance.
In the embodiment of the present application, set in advance the failure handling mechanisms corresponding with fault type, after determining the corresponding fault type of fault identifier, according to the failure handling mechanisms corresponding with fault type that sets in advance, the definite failure handling mechanisms that should carry out, and carry out this failure handling mechanisms.
In actual applications, be set with following several fault and the failure handling mechanisms corresponding with it:
In the embodiment of the present application, when following fault takes place, as:
When the address that needs write is not sky, perhaps, the data and the expectation value that write are not inconsistent, perhaps current write operation is not also finished, new request has been arranged again, and perhaps, the next writing area of target writing area is not empty, the failure handling mechanisms that adopts is earlier deletion action to be carried out in the next writing area of target writing area, and then the valid data in the target writing area is copied in the next writing area of this target writing area.
In all writing areas in the same storage area, the state of a writing area is arranged for effective, the state of another writing area is fashionable for writing, and the failure handling mechanisms of employing is for wiping state for the writing area that is writing.
When the header that has the writing area in the storage area was incorrect, the failure handling mechanisms of employing was with the data erase in the whole storage areas in this storage area, carries out record according to the data among the RAM again.
When the verification of the data that read from the writing area with the verification of calculating when these data are write this writing area with when not being inconsistent, the failure handling mechanisms of employing is to ignore the data that this time read, and records this event.
In the application implemented, the bit reversal fault may take place in the data that store the writing area in each storage space in the flash memory, and therefore, the date storage method that the embodiment of the present application provides also comprises:
Step S308: judge whether presence bit counter-rotating fault.
Step S309: carry out the bit reversal failure handling mechanisms corresponding with described bit reversal fault that sets in advance.
In the embodiment of the present application, the treatment mechanism of the corresponding bit reversal fault that provides is at first obtaining fault address, and read all valid data 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, wipe the writing area that this fault address is positioned at simultaneously.
This shows, 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 the failure handling mechanisms that breaks down and flash memory stores in data storage procedure on the basis of above-described embodiment, more perfect, clear by the date storage method that the basis at date storage method provides failure handling mechanisms to make the application provide.
Embodiment four:
At the date storage method that above-mentioned each embodiment 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, this method comprises:
Step S401: receive data read request information.
In the embodiment of the present application, the method for reading data that provides at 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 of obtaining the entrained data to be read of described data read request information.
Step S403: determine the storage space corresponding with described data read request information according to the data type that sets in advance with the corresponding relation between the storage space, and read storage space as target.
In the embodiment of the present application, in data read process, at first receive request of data information, and obtain the data type of data to be read entrained in the request of data information, determine the storage space corresponding with data read request information according to the data type that sets in advance with the corresponding relation between the storage space then, and this storage space is read storage space as target.
Step S404: read in target and to search the state indications in the storage space and represent that the writing area of effective status reads the writing area as target.
In the embodiment of the present application, include at least two writing areas in each each storage space, and be provided with status identifier in each writing area, status identifier is represented effective status or disarmed state, and synchronization has and has only a status identifier to represent effective status in same storage space, when inquiring after target reads storage space, read in target and to search the writing area that state indications label table is shown with the effect state in the storage space, and read the writing area as target.
Step S405: read in target and to read valid data in the writing area.
In the embodiment of the present application, target reads the data that valid data in the storage space refer to present up-to-date storage, as: the information of having stored twice same file altogether in this target writing area, the information of this document of storage is valid data so for the second time.But, be the preferred implementation method that the embodiment of the present application provides more than, which is valid data, and the inventor can set arbitrarily according to the demand of oneself in concrete stipulating.
This shows, the embodiment of the present application provides a kind of method for reading data on the basis of the date storage method that above-described embodiment provides, this method at first receives data read request information, judge the storage space corresponding with request of data information then, and read storage space as target, and read in target that the query State indications identifies effective writing area in the storage space, and read the writing area as target, read in target at last and read valid data in the writing area.The embodiment of the present application is by the method for reading data at date storage method, and the scheme that makes the application provide 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 receiving element 1, data type determining unit 2 and storage unit 3.
Wherein, data receiving element 1, data type determining unit 2 and storage unit 3 are connected successively.
Data receiving element 1 is used for receiving data to be written.
In the embodiment of the present application, the data storage device that provides is applied to flash memory, and comprises at least one storage space in the flash memory, when the user need store data in flash memory, when namely having data storage requirement, this data receiving element 1 at first receives the data to be written that the user sends.
Described data type determining unit 2 is connected with described data receiving element 1, and data type determining unit 2 is determined the data type of the data to be written that receive.
In the embodiment of the present application, the data storage device that provides, after receiving data to be written, data type determining unit 2 in this device can be judged the data type of these data to be written, and the data type of judging data to be written mainly is by obtaining the entrained type identification of data to be written, then the data type of determining data to be written according to the type identification that sets in advance and the corresponding relation between the data type.
Described storage unit 3 is connected with described data type determining 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 the flash memory is all to there being unique data type, after the data type of determining data to be written, write data to be written successively in storage unit 3 storage spaces corresponding with the data type of data to be written in flash memory.Wherein, writing data to be written successively in the storage space corresponding with the data type of data to be written 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: data receiving element 1, type identification acquiring unit 21, data type determine that subelement 22, target storage space determining unit 31, target writing area search unit 32, judging unit 33 and data write unit 34.
Wherein, data receiving element 1, type identification acquiring unit 21, data type determine that subelement 22, target storage space determining unit 31, target writing area search unit 32, judging unit 33 and data write unit 34 and link to each other successively.
Data receiving element 1 is used for receiving data to be written.
In the embodiment of the present application, the data storage device that provides is applied to flash memory, and comprises at least one storage space in the flash memory, when the user need store data in flash memory, when namely having data storage requirement, this data receiving element 1 at first receives the data to be written that the user sends.
Described type identification acquiring unit 21 is connected with described data receiving element 1, and type identification acquiring unit 21 obtains the entrained type identification of data to be written that receives.
Described data type determines that subelement 22 is connected with described type identification acquiring unit 21, and data type is determined the data type that subelement 22 is determined described data to be written according to the type identification that sets in advance and the corresponding relation between the data type.
Described target storage space determining unit 31 determines that with described data type subelement 22 is connected, the corresponding storage space of data type that the data type that target storage space determining unit 31 bases set in advance and the corresponding relation between the storage space are determined described data to be written, and as the target storage space.
In the embodiment of the present application, each storage space in the flash memory is the unique data type of correspondence all, after the data type of determining data to be written, target storage space determining unit 31 is determined the corresponding storage space of this data type to be written according to the data type that sets in advance and the corresponding relation between the storage space, i.e. these data to be written storage space of being about to be written into, and with this storage space as the target storage space.
The target writing area is searched unit 32 and is connected with target storage space determining unit 31, and the target writing area is searched unit 32 and searched the writing area that status identifier is represented effective status, and with it as the target writing area.
In the embodiment of the present application, include at least two writing areas in each described storage space, and be provided with status identifier in each said write zone, described status identifier is represented effective status or disarmed state, and synchronization has and have only a status identifier to represent effective status in same storage space.Behind the corresponding storage space of data type of determining data to be written, with this storage space as the target storage space, the target writing area is searched unit 32 and search the writing area that status identifier is represented effective status in this target storage space, and with this writing area as the 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 satisfies taking up room of described data to be written.
Described data write unit 34 is connected with described judging unit 33, and when satisfying, the white space of data write unit 34 in described target writing area writes described data to be written.
When not satisfying, 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, writing subelement 341, valid data acquiring unit 342 and erase unit 343 is connected successively.
Valid data acquiring unit 342 is connected with described judging unit 33, and when the remaining space of described target writing area did not satisfy taking up room of described data to be written, valid data acquiring unit 342 obtained the valid data in the described target writing area.In the embodiment of the present application, when the remaining space of target writing area did not satisfy data to be written and wants occupation space, valid data acquiring unit 342 obtained the valid data in this target writing area.Wherein, valid data refer to the data of present up-to-date storage, as: the information of having stored twice same file altogether in this target writing area, the information of this document of storage is valid data so for the second time.But, be the preferred implementation method that the embodiment of the present application provides more than, which is valid data, and the inventor can set arbitrarily according to the demand of oneself in concrete stipulating.
Said write subelement 342 is connected with described valid data acquiring unit 341, writes subelement 342 stores described target writing area into for the described valid data that will get access to next writing area; And described data to be written are written in the next writing area of described target writing area after institute's stored valid data.
In the embodiment of the present application, each said write zone is provided with serial number in each described storage space, and the next writing area of afterbody writing area is the head writing area.Behind the valid data in getting access to the target writing area, write subelement 342 and number at the next one of the numbering of this target writing area and write this valid data in the corresponding writing area, and data to be written are written in the next writing area of target writing area after institute's stored valid data.
Described erase unit 343 is connected with said write subelement 342, and erase unit 343 is wiped all data in the 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 can judge in the process that writes described data to be written in the storage space corresponding with described data type successively whether produce fault on the one hand; If obtain fault identifier; And determine the fault type of described fault according to the corresponding relation between the fault identifier that sets in advance and the fault type; Carry out the failure handling mechanisms corresponding with described fault type that sets in advance at last;
Fault processing unit 4 can be used for judging the data presence bit fault of reversing whether in the writing area of flash memory on the one hand; If carry out the bit reversal failure handling mechanisms corresponding with described bit reversal fault that sets in advance.
This shows that the embodiment of the present application provides a kind of data storage device, this device comprises: data receiving element, data type determining unit and storage unit, and wherein, the data receiving element is used for receiving data to be written; Described data type determining unit is connected with described data receiving element, and the data type determining unit is determined the data type of the described data to be written that receive; Described storage unit is connected with described data type determining 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 in storage space, writing data to be written successively, when not needing to write data to be written at every turn, all carry out erase operation one time, can solve prior art in the process of at every turn carrying out the data storage, all need the data among the last effective SECTOR are carried out erase operation, make erase operation frequent, and then cause the problem of flash memory life-span reduction.
Each embodiment adopts the mode of going forward one by one to describe in this instructions, and what each embodiment stressed is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.For the disclosed device of embodiment, because it is corresponding with the embodiment disclosed method, so description is fairly simple, relevant part partly illustrates referring to method and gets final product.
For the convenience of describing, be divided into various unit with function when describing above the device and describe respectively.Certainly, when implementing the application, can in same or a plurality of softwares and/or hardware, realize the function of each unit.
As seen through the above description of the embodiments, those skilled in the art can be well understood to the application and can realize by the mode that software adds essential general hardware platform.Based on such understanding, the part that the application's technical scheme contributes to prior art in essence in other words can embody with the form of software product, this computer software product can be stored in the storage medium, as ROM/RAM, magnetic disc, CD etc., comprise that some instructions are with so that a computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the described method of 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, and identical similar part is mutually referring to getting final product between each embodiment, and each embodiment stresses is difference with other embodiment.Especially, for device embodiment, because it is substantially similar in appearance to method embodiment, so describe fairly simplely, relevant part gets final product referring to the part explanation of method embodiment.Device embodiment described above only is schematic, wherein said unit as the separating component explanation can or can not be physically to separate also, the parts that show as the unit can be or can not be physical locations also, namely can be positioned at a place, perhaps also can be distributed on a plurality of network element.Can select wherein some or all of module to realize the purpose of present embodiment scheme according to the actual needs.Those of ordinary skills namely can understand and implement under the situation of not paying creative work.
The application can be used in numerous general or special purpose computingasystem environment or the configuration.For example: personal computer, server computer, handheld device or portable set, plate equipment, multicomputer system, the system based on microprocessor, set top box, programmable consumer-elcetronics devices, network PC, small-size computer, mainframe computer, comprise distributed computing environment of above any system or equipment etc.
The application can describe in the general context of the computer executable instructions of being carried out by computing machine, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract data type, program, object, assembly, data structure etc.Also can in distributed computing environment, put into practice the application, in these distributed computing environment, be executed the task by the teleprocessing equipment that is connected by communication network.In distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
The above only is the application's embodiment; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the application's principle; can also make some improvements and modifications, these improvements and modifications also should be considered as the application's protection domain.

Claims (10)

1. a date storage method is applied to flash memory, comprises at least one storage space in the described flash memory, it is characterized in that, comprising:
Receive data to be written;
Determine the data type of described data to be written;
In the storage space corresponding with described data type, write described data to be written successively.
2. method according to claim 1 is characterized in that, the data type of described definite described data to be written comprises:
Obtain the entrained type identification of described data to be written;
Determine the data type of described data to be written according to the corresponding relation between the type identification that sets in advance and the data type.
3. method according to claim 2, it is characterized in that, include at least two writing areas in each described storage space, and be provided with status identifier in each said write zone, described status identifier is represented effective status or disarmed state, and synchronization has and has only 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 and comprise:
Determine the corresponding storage space of data type of described data to be written according to the corresponding relation between the data type that sets in advance and the storage space, and as the target storage space;
In described target storage space, search the writing area that status identifier is represented effective status, and as the target writing area;
Whether the remaining space of judging described target writing area satisfies taking up room of described data to be written;
When satisfying, the white space in described target writing area writes described data to be written.
4. method according to claim 3 is characterized in that, each said write zone is provided with serial number in each described storage space, and the next writing area of afterbody writing area is the head writing area,
When the remaining space of described target writing area did not satisfy taking up room of described data to be written, this method also comprised:
Obtain the valid data in the described target writing area;
The described valid data of storage in the next writing area of described target writing area;
In the next writing area of described target writing area, write described data to be written after institute's stored valid data;
The state indications of described target writing area is set to represent the state indications of disarmed state;
State indications in the next writing area of described target writing area is set to represent the state indications of effective status;
Wipe all data in the described target writing area.
5. method according to claim 4 is characterized in that, also comprises:
Judgement writes in the process of described data to be written whether produce fault successively in the storage space corresponding with described data type;
If obtain fault identifier;
Determine the fault type of described fault according to the corresponding relation between the fault identifier that sets in advance and the fault type;
The failure handling mechanisms corresponding with described fault type that execution sets in advance;
Perhaps,
Judge whether presence bit counter-rotating fault;
If carry out the bit reversal failure handling mechanisms corresponding with described bit reversal fault that sets in advance.
6. a data storage device is applied to flash memory, comprises at least one storage space in the described flash memory, it is characterized in that, comprising: data receiving element, data type determining unit and storage unit, wherein,
Described data receiving element is used for receiving data to be written;
Described data type determining unit is connected with described data receiving element, is used for determining the data type of described data to be written;
Described storage unit is connected with described data type determining unit, is used for writing described data to be written successively at the storage space corresponding with described data type.
7. device according to claim 6 is characterized in that, described data type determining unit comprises: type identification acquiring unit and data type are determined subelement, wherein,
Described type identification acquiring unit is connected with described data receiving element, is used for obtaining the entrained type identification of described data to be written;
Described data type determines that subelement is connected with described type identification acquiring unit, is used for the data type of determining described data to be written according to the type identification that sets in advance and the corresponding relation between the data type.
8. device according to claim 7, it is characterized in that, include at least two writing areas in each described storage space, and be provided with status identifier in each said write zone, described status identifier is represented effective status or disarmed state, and synchronization has and have only a status identifier to represent effective status in same storage space; And each said write zone is provided with serial number in each described storage space, and the next writing area of afterbody writing area is the head writing area;
Described storage unit comprises: unit, judging unit and data write unit are searched in the target writing area, wherein,
Described target storage space determining unit determines that with described data type subelement is connected, be used for the corresponding storage space of data type of determining described data to be written according to the data type that sets in advance and the corresponding relation between the storage space, and as the target storage space; Described target writing area is searched the unit and is connected with described target storage space determining unit, is used for searching the writing area that status identifier is represented effective status, and as the target writing area;
Described judging unit is searched the unit with described target writing area and is connected, and is used for judging whether the remaining space of described target writing area satisfies taking up room of described data to be written;
Described data write unit is connected with described judging unit, and when satisfying, the white space that is used in described target writing area writes described data to be written;
Described data write unit comprises: the valid data acquiring unit, write subelement and erase unit, wherein:
The valid data acquiring unit is connected with described judging unit, is used for obtaining the valid data in the described target writing area when the remaining space of described target writing area does not satisfy taking up room of described data to be written;
The said write subelement is connected with described valid data acquiring unit, and the described valid data that are used for getting access to store the next writing area of described target writing area into; And described data to be written are written in the next writing area of described target writing area after institute's stored valid data;
Described erase unit is connected with the said write subelement, is used for wiping all data of described target writing area.
9. device according to claim 8 is characterized in that, also comprises: fault processing unit, wherein,
Described fault processing unit be used for to judge in the storage space corresponding with described data type writes the process of described data to be written successively whether produce fault;
If obtain fault identifier;
Determine the fault type of described fault according to the corresponding relation between the fault identifier that sets in advance and the fault type;
The failure handling mechanisms corresponding with described fault type that execution sets in advance;
Perhaps,
Described fault processing unit is used for judging whether presence bit counter-rotating fault;
If carry out the bit reversal failure handling mechanisms corresponding with described bit reversal fault that sets in advance.
10. method for reading data, be applied to flash memory, comprise at least one storage space in the described flash memory, include at least two writing areas in each described storage space, and be provided with status identifier in each said write zone, described status identifier is represented effective status or disarmed state, and synchronization has and have only 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 entrained data to be read of described data read request information;
Determine the storage space corresponding with described data read request information according to the data type that sets in advance with the corresponding relation between the storage space, and read storage space as target;
Read in described target and to search the state indications in the storage space and represent that the writing area of effective status reads the writing area as target;
Read in described target and to read valid data in the writing area.
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 true CN103268201A (en) 2013-08-28
CN103268201B 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)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104615546A (en) * 2015-02-13 2015-05-13 小米科技有限责任公司 File data management method and device
CN105760112A (en) * 2016-02-01 2016-07-13 惠州市蓝微新源技术有限公司 Data storage method, reading method and systems for prolonging service life of memory
CN106649138A (en) * 2015-10-13 2017-05-10 株式会社艾库塞尔 Information processing apparatus and method of processing information
CN106816175A (en) * 2015-12-01 2017-06-09 中芯国际集成电路制造(上海)有限公司 The control method and device of memory
CN107015985A (en) * 2016-01-27 2017-08-04 阿里巴巴集团控股有限公司 A kind of data storage and acquisition methods and device
CN107153510A (en) * 2016-03-03 2017-09-12 爱思开海力士有限公司 Memory Controller and the 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
CN109446462A (en) * 2018-10-29 2019-03-08 东软集团股份有限公司 Data monitoring processing method, device, equipment and storage medium based on the page
CN109769005A (en) * 2017-11-09 2019-05-17 宁波方太厨具有限公司 A kind of data cache method and data buffering system of network request
CN109767003A (en) * 2019-01-31 2019-05-17 深兰科技(上海)有限公司 Storage controlling method, device, electronic equipment and the medium of neural network accelerator
CN110515944A (en) * 2019-08-16 2019-11-29 出门问问(苏州)信息科技有限公司 Date storage method, storage medium and electronic equipment based on distributed data base
CN111324554A (en) * 2020-02-18 2020-06-23 日立楼宇技术(广州)有限公司 Management method and device of flash memory data and elevator controller
CN111797089A (en) * 2019-04-09 2020-10-20 Oppo广东移动通信有限公司 Data writing method and device, storage medium and electronic equipment
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
CN113660180A (en) * 2021-07-30 2021-11-16 鹏城实验室 Data storage method, device, terminal and storage medium
WO2023179243A1 (en) * 2022-03-21 2023-09-28 上海美仁半导体有限公司 Data reading/writing method and system, medium, and device

Citations (6)

* 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
US20090125753A1 (en) * 2007-11-13 2009-05-14 Anton Joseph Kryka Handling of data storage within a flash media device
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
CN101894077A (en) * 2010-06-24 2010-11-24 深圳市江波龙电子有限公司 Data storage method and system

Patent Citations (6)

* 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
US20090125753A1 (en) * 2007-11-13 2009-05-14 Anton Joseph Kryka Handling of data storage within a flash media device
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
CN101894077A (en) * 2010-06-24 2010-11-24 深圳市江波龙电子有限公司 Data storage method and system

Cited By (23)

* 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
CN104615546A (en) * 2015-02-13 2015-05-13 小米科技有限责任公司 File data management method and device
CN106649138A (en) * 2015-10-13 2017-05-10 株式会社艾库塞尔 Information processing apparatus and method of processing information
CN106816175A (en) * 2015-12-01 2017-06-09 中芯国际集成电路制造(上海)有限公司 The control method and device of memory
CN107015985A (en) * 2016-01-27 2017-08-04 阿里巴巴集团控股有限公司 A kind of data storage and acquisition methods and device
CN105760112A (en) * 2016-02-01 2016-07-13 惠州市蓝微新源技术有限公司 Data storage method, reading method and systems for prolonging service life of memory
CN107153510B (en) * 2016-03-03 2020-09-08 爱思开海力士有限公司 Memory controller and method for managing memory
CN107153510A (en) * 2016-03-03 2017-09-12 爱思开海力士有限公司 Memory Controller and the method for managing memory
KR20170103200A (en) * 2016-03-03 2017-09-13 에스케이하이닉스 주식회사 Method for managing memory
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
CN109446462A (en) * 2018-10-29 2019-03-08 东软集团股份有限公司 Data monitoring processing method, device, equipment and storage medium based on the page
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
CN110515944A (en) * 2019-08-16 2019-11-29 出门问问(苏州)信息科技有限公司 Date storage method, storage medium and electronic equipment based on distributed data base
CN111324554A (en) * 2020-02-18 2020-06-23 日立楼宇技术(广州)有限公司 Management method and device of flash memory data and elevator controller
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
CN113660180A (en) * 2021-07-30 2021-11-16 鹏城实验室 Data storage method, device, terminal and storage medium
CN113660180B (en) * 2021-07-30 2023-11-28 鹏城实验室 Data storage method, device, terminal and storage medium
WO2023179243A1 (en) * 2022-03-21 2023-09-28 上海美仁半导体有限公司 Data reading/writing method and system, medium, and device

Also Published As

Publication number Publication date
CN103268201B (en) 2016-02-17

Similar Documents

Publication Publication Date Title
CN103268201B (en) A kind of date storage method, memory storage and read method
CN112765271B (en) Block chain transaction index storage method and device, computer equipment and medium
CN101354715B (en) For system, the method and computer program product of operating data processing system
CN110018989B (en) Snapshot comparison method and device
CN107066246B (en) Software development method and device
CN103294572A (en) Electronic device to restore MBR, and method thereof
CN104216796A (en) Data backup and recovery method and electronic device
CN110489357B (en) Method and system for hiding data on removable storage device
CN109496292B (en) Disk management method, disk management device and electronic equipment
CN103995855A (en) Method and device for storing data
CN106970856B (en) Data management system and method for backing up, recovering and mounting data
CN103677653A (en) Data processing method and electronic device based on solid state disk (SSD)
CN104978148A (en) Data writing method and device and data reading method and device
CN108763341B (en) Electronic device, automatic table building method and storage medium
CN104572917A (en) Method and device for locking data and distributed storage system
CN108304142B (en) Data management method and device
US20050154786A1 (en) Ordering updates in remote copying of data
CN102902770A (en) Method and system for assembling mirror image files
CN104503868A (en) Data synchronizing method, device and system
CN108228611B (en) Document information copying method and device
CN105426131A (en) KV (Key Value) storage implementation method and device
CN104506636A (en) Method and device for synchronizing data
CN114327246B (en) Method for storing data in storage medium, storage medium and computer device
CN103870603A (en) Directory management method and electronic device
CN114328280A (en) Log access method and device based on Flash, storage medium and terminal

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
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.