CN101526921B - Method and device for writing data - Google Patents

Method and device for writing data Download PDF

Info

Publication number
CN101526921B
CN101526921B CN200810247055.7A CN200810247055A CN101526921B CN 101526921 B CN101526921 B CN 101526921B CN 200810247055 A CN200810247055 A CN 200810247055A CN 101526921 B CN101526921 B CN 101526921B
Authority
CN
China
Prior art keywords
storage block
data
block
random
empty
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
CN200810247055.7A
Other languages
Chinese (zh)
Other versions
CN101526921A (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.)
Feitian Technologies Co Ltd
Beijing Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies 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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN200810247055.7A priority Critical patent/CN101526921B/en
Publication of CN101526921A publication Critical patent/CN101526921A/en
Application granted granted Critical
Publication of CN101526921B publication Critical patent/CN101526921B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a method and a device for writing data, which relate to the field of data storage and solve the problem that some storage blocks in memories are easy to have high extent of damage in the prior art. The method for writing data comprises the following steps: receiving an instruction for writing new data; locating the data storage block where the data to be modified is located; selecting one storage block from all storage blocks randomly; judging whether the randomly selected storage block is blank; if true, combining the data in the data storage block with the new data into refresh data and writing the refresh data in the blank storage block; else, processing the randomly selected storage block into a blank storage block, then combining the data in the data storage block with the new data into refresh data and writing the refresh data in the blank storage block; and erasing the located data storage block into a blank storage block. The embodiment of the invention is mainly applied to the situations of executing various operations on memories.

Description

The method of data writing and device
Technical field
The present invention relates to field of data storage, relate in particular to a kind of method and device of data writing.
Background technology
Flash memory belongs to a kind of of type of memory, even if because it has mobility and is kept at the advantage that the data on flash memory still can not lose under powering-off state and is developed rapidly.In flash memory, write Flash operation and data in Flash can only be changed to " 0 " (Bit) from " 1 "; Erase operation can become " 1 " " 0 ", but erase operation can only carry out for unit for whole " storage block ".For example: the size of a storage block is generally 256 bytes to 1024 bytes.
During the data of user's certain storage block in need to revising storer, be generally in empty storage block, to write to need the data revised.In the prior art, conventionally adopt and in some empty storage blocks, find out in a certain order the method for an empty storage block, and then amended data are written in this sky storage block and wipe the data in the DSB data store block before modification.But the number of times that each storage block can be written into and wipe is limited, particularly when user revises some data frequently or when empty storage block number is few, empty storage block before being easy to occur coming to sequence number is carried out continually and is write or the situation of erase operation, in the course of time will make the extent of damage of these sky storage blocks increase, reduce serviceable life, even may therefore cannot reuse this storage block, cause out of memory.
Summary of the invention
Embodiments of the invention provide a kind of method and device of data writing.To improve the number of times that in this storer, storage block can be used.
For achieving the above object, embodiments of the invention adopt following technical scheme:
A method for data writing, comprising:
Receive the instruction that writes new data;
Location needs the DSB data store block at the data place of modification;
From all storage blocks, select at random a storage block;
Judge whether the described storage block of selecting is at random sky storage block;
If so, the data of described DSB data store block and new data are combined into more new data, described more new data is write in described empty storage block;
If not, first the described storage block of selecting is at random processed into sky storage block, then the data of described DSB data store block and new data is combined into more new data, described more new data is write in described empty storage block;
The data of wiping storage in the DSB data store block navigating to, making this DSB data store block is empty storage block.
A device for data writing, comprising:
Receiver module, for receiving the instruction that writes new data;
Locating module, for locating the DSB data store block at the data place that needs modification;
Select module, for the storage block from all, select at random a storage block;
Judge module, for judging whether the described storage block of selecting is at random sky storage block;
Writing module, for when judge module judgement is, is combined into more new data by the data of described DSB data store block and new data, and described more new data is write in described empty storage block;
Said write module is also for judging when judge module when no, first the described storage block of selecting is at random processed into sky storage block, then the data of described DSB data store block and new data are combined into more new data, described more new data is write in described empty storage block;
Wipe module, for the data of storing in the DSB data store block navigating to described in wiping, making this DSB data store block is empty storage block.
The method that the data that the embodiment of the present invention provides write and device have following beneficial effect: by adopting the technical scheme of choosing at random storage block, obtained and made the extent of damage that in storer, storage block is used can arrive balance, and reduced the beneficial effect of the single storage block extent of damage.That has improved storage block in storer can access times simultaneously, are also equivalent to have extended the serviceable life of this storer.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, to the accompanying drawing of required use in embodiment or description of the Prior Art be briefly described below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skills, do not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the structural representation of the empty storage block that provides of the embodiment of the present invention 1;
Fig. 2 is the structural representation of the empty storage block that has record that provides of the embodiment of the present invention 1;
Fig. 3 is the structural representation of the DSB data store block that provides of the embodiment of the present invention 1;
Fig. 4 is the process flow diagram of the method for the embodiment of the present invention 1 data writing;
Fig. 5 is the process flow diagram of the method for 2 one kinds of preferred data writings of the embodiment of the present invention;
Fig. 6 is the block diagram of the device of the embodiment of the present invention 3 data writings.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
Embodiment 1
The present embodiment specifically describes when the method to data writing, and as shown in Figure 4, the method comprises the steps:
In order to set forth conveniently, in the following example, suppose that the address in flash memory storage district is:
0x00000000~0x00007800, is total to 0x78 storage block, every 0x100 byte.The first byte of each piece is used for the logical block number (LBN) of this storage block of mark.Different according to the value of storage block first byte, in the present embodiment, storage block is divided into the storage block of 2 types:
Empty storage block: first byte is the storage block of 0xFF.If the value of other all bytes of empty storage block is all 0xFF, so empty storage block at any time can data writing, as shown in Figure 1; Otherwise needing is first 0xFF by other byte-erases.Especially, the empty storage block of the data of can not writing direct is called " the empty storage block that has record ", as shown in Figure 2.
DSB data store block: as shown in Figure 3, the scope of the value of first byte at 0x01~0x78 with interior storage block.Data in region in DSB data store block outside first byte are all considered to active data.
101, receive the instruction that writes new data.
102, location needs the DSB data store block at the data place of modification.
Look for certain logical block number (LBN) be the concrete operations of DSB data store block of X for making a pointer P=0x00000000, judge whether the value of the byte that P is pointed is X.If so, this DSB data store block is looked for DSB data store block.If not, P=P+0x100 continues to search.Because the size of each storage block is 0x100 byte, so P always points to the first byte of storage block.
103, from all storage blocks, select at random a storage block.
In the present embodiment, from all storage blocks, storage block of random selection, for generating a random number that is not more than all storage block sums, is located using this random number as physical block number for the address of storage block.
The number of supposing storage block be B in other words the scope of this random number can be B, can be also a function f (B) relevant to B.Such as B=10, can produce in the present embodiment one 1~10 with interior random integers C.(1 <=C <=10), also can produce a 1~5*10 with interior random integers.Concrete, what in the present embodiment, take is first method, produces a random number C between 1~B.
A local variable N3=0 is opened up in concrete being operating as at internal memory, then makes a pointer P from 0x00000000, to 0x00007800, finishes, and the step-length of P is 0x100, makes P=P+0x100, makes N3=N3+1; In the time of N3=C, the corresponding storage block of P is the required storage block of selecting at random.
104, judge whether the described storage block of selecting is at random sky storage block, if so, execution step 105,
If not, the described storage block of selecting at random is first processed into sky storage block, and then execution step 105.
Whether concrete this storage block that judges is sky storage block, judges whether the first byte of this storage block is 0xFF, if so, illustrates that this storage block is sky storage block, can directly perform step 105; Judge that the described storage block of selecting is not at random sky storage block, judge that the first byte of this sky storage block is within the scope of 0x01~0x78, need the described storage block of selecting at random to process, specifically comprise: from the current storage block of selecting at random, search successively backward or forward, find an empty storage block, using described empty storage block as an interim empty storage block, then the data of the storage block of selecting are at random write in this sky storage block, then be empty storage block by the described memory block erasing of selecting at random.Wherein, the data of the storage block of selecting are at random being write in this sky storage block to the data field data of first data writing storage block, and then write-in block number.If there is power down in ablation process, cause data writing incomplete, described empty storage block, in " the empty storage block that has record " state, can not become available DSB data store block mistakenly.Accordingly, before the data of the storage block of selecting are at random write to this sky storage block, also need to judge the state of described empty storage block.If described empty storage block is in " the empty storage block that has record " state, the data of can not writing direct, by described empty memory block erasing, be first can data writing empty storage block, then data writing.
105, the data of the DSB data store block in step 102 are combined with new data, write in the described storage block of selecting at random.
In this step, the data of the DSB data store block in step 102 are combined with new data, write in described empty storage block and be: first the data of the DSB data store block in step 102 are read in to internal memory, the logical block number (LBN) of described DSB data store block is constant, by the data modification of data field, be new data, soon the data of DSB data store block and new data are in conjunction with generating more new data.
Will be more when new data writes sky storage block, preferred, first write more new data and write again logical block number (LBN).Avoid power down occurs in ablation process, cause data writing incomplete, make described empty storage block in " the empty storage block that has record " state.And this has the empty storage block of record also can not become mistakenly available DSB data store block.Equally, corresponding, before step 105 is writing sky storage block, also need to judge the state of described empty storage block.If this sky storage block is in " the empty storage block that has record " state, the first empty storage block for the data of can writing direct by described empty memory block erasing, then data writing.
106, wiping the DSB data store block navigating to becomes sky storage block.
In this step, concrete being operating as becomes 0xFF by all bytes of this DSB data store block.
107, process ends.
In the prior art, because be searches sky storage block in order in the empty storage block of storer, so easily because some storage block is excessively carried out to wipe with write operation causes storage block impaired, even can not use.The scheme that the present embodiment provides, by adopting random number, to finding storage block, carry out the technical scheme of write operation, overcome in prior art because part storage block impaired excessively, the technical matters that causes memory span to diminish, and then obtained and make the extent of damage of each storage block in storer obtain equilibrium, and improve the beneficial effect that storage block in storer can access times.
Embodiment 2
The present embodiment specifically describes a kind of method of preferred data writing, and as shown in Figure 5, the method comprises:
In order to set forth conveniently, in the following example, suppose that the address in flash memory storage district is:
0x00000000~0x00007800, is total to 0x78 storage block, every 0x100 byte.The first byte of each piece is used for the logical block number (LBN) of this storage block of mark.Different according to the value of storage block first byte, in the present embodiment, storage block is divided into the storage block of 2 types:
Empty storage block: first byte is the storage block of 0xFF.If the value of other all bytes of empty storage block is all 0xFF, so empty storage block at any time can data writing, as shown in Figure 1; Otherwise needing is first 0xFF by other byte-erases.Especially, the empty storage block of the data of can not writing direct is called " the empty storage block that has record ", as shown in Figure 2.
DSB data store block: as shown in Figure 3, the scope of the value of first byte at 0x01~0x78 with interior storage block.Data in region in DSB data store block outside first byte are all considered to active data.
201, receive the instruction that writes new data.
202, location needs the DSB data store block at the data place of modification.
203, from all storage blocks, select at random a storage block.
In the present embodiment, from all storage blocks, storage block of random selection, for generating a random number that is not more than all storage block sums, utilizes this random number as the address of physical block number location storage block.
The number of supposing storage block is B, if B=10 can produce one 1~10 in the present embodiment with interior random integers C (1 <=C <=10), produces a random number C between 1~B.
Make a pointer P from 0x00000000, to 0x00007800, finish, the step-length of P is 0x100, i.e. P=C*0x100, and the corresponding storage block of P is the required storage block of selecting at random.
204, judge whether the described storage block of selecting is at random the DSB data store block of step 202, if so, return to execution step 203; If not, perform step 205.
Concrete judge that in this step this storage block of selecting is at random whether identical with the first byte of the DSB data store block of step 202, if identical, the DSB data store block that this storage block of selecting is at random step 202 is described, now, need again from all storage blocks, to select at random a storage block, again perform step 203.
205, judge whether this storage block of selecting is at random sky storage block, if so, directly performs step 206,
If not, the storage block of this being selected is at random processed, and then execution step 206.
After judging that the described storage block of selecting is not at random sky storage block, being about to the described storage block of selecting at random processes and specifically comprises from the current storage block of selecting at random and searching successively backward or forward, find an empty storage block, as interim empty storage block, then the data of the described storage block of selecting are at random write in described interim empty storage block, before the data of the storage block of selecting at random being write to described interim empty storage block, need to first judge the state that also needs to judge described empty storage block, if this sky storage block is in " the empty storage block that has record " state, first by described empty memory block erasing for writing direct the empty storage block of data, data writing again.And then be empty storage block by the described memory block erasing of selecting at random.
206, the data of the DSB data store block of step 202 are combined with new data, then write in this storage block of selecting at random.
The data of the DSB data store block in step 202 are combined with new data, write again in this storage block of selecting at random and be: first the data of the DSB data store block in step 202 are read in to internal memory, in internal memory, logical block number (LBN) is constant, by the data modification of data field, it is new data, and then the data of described DSB data store block and new data are combined into more new data, when writing sky storage block, first write more new data and write again logical block number (LBN).
Will be more when new data writes sky storage block, preferred, first write more new data and write again logical block number (LBN).Avoid power down occurs in ablation process, cause data writing incomplete, make described empty storage block in " the empty storage block that has record " state.And this has the empty storage block of record also can not become mistakenly available DSB data store block.Equally, corresponding, before step 105 is writing sky storage block, also need to judge the state of described empty storage block.If this sky storage block is in " the empty storage block that has record " state, the first empty storage block for the data of can writing direct by described empty memory block erasing, then data writing.
207, the DSB data store block in step 202 is erased to sky storage block.
208, process ends.
In the present embodiment, step 204-206 can also be following steps:
204 ', judge that whether the described storage block of selecting is at random the DSB data store block of step 202, if so, selects the next storage block of the DSB data store block of step 202; If not, perform step 205 '.
Judge that in this step described DSB data store block is can also select a upper storage block of the DSB data store block of step 202 after the DSB data store block of step 202.
205 ', judge that whether this storage block is sky storage block, if so, directly performs step 206 '; If not, this storage block is processed, and then execution step 206 '.
After judging that the described storage block of selecting is not at random sky storage block, the described storage block of selecting is at random processed and specifically comprised from the current storage block of selecting at random and searching successively backward or forward, find an interim empty storage block, then the data of the described storage block of selecting are at random write in described interim empty storage block, then be empty storage block by the described memory block erasing of selecting at random.In addition, before the data of the storage block of selecting at random being write to described interim empty storage block, need to first judge the state that also needs to judge described empty storage block, if this sky storage block is in " the empty storage block that has record " state, first by described empty memory block erasing for writing direct the empty storage block of data, then data writing.
206 ', the data of the DSB data store block of step 202 are combined with new data, then write in this storage block.
The method of the data writing that the present embodiment provides and device, with in prior art, in the storage block of storer, choose in order sky storage block and compare, adopted and in the storage block of storer, chosen at random the technical scheme of storage block, having overcome empty storage block before easily occurring coming to sequence number in prior art carries out continually and to write or the situation of erase operation, and then reached and can make the extent of damage of each storage block be balanced, reduce the technique effect of the extent of damage of single storage block.In storer is provided storage block can access times in, be also equivalent to extend serviceable life of this storer.
Embodiment 3
The present embodiment discloses a kind of device of data writing, and as shown in Figure 6, this device comprises: receiver module 61, and locating module 62, selects module 63, and judge module 64, the first judge modules 67, the first are removed module 68, and writing module 65, wipes module 66.
Receiver module 61 is for receiving the instruction that writes new data; Locating module 62 is for locating the DSB data store block at the data place that needs modification; Select module 63 and select at random a storage block for the storage block from all; Judge module 64 is for judging whether the described storage block of selecting is at random sky storage block; Writing module 65, for when judge module 64 judgements are, is combined into more new data by the data of described DSB data store block and new data, and described more new data is write in described empty storage block; The first judge module 67, for when the described empty storage block of judge module 64 judgement is when being, judges whether described empty storage block is the empty storage block that has record; First removes module 68 for when the first judge module judgement 67 is, has the data of storing in the empty storage block of record described in wiping, and makes this storage block become sky storage block.
Said write module 65 is also for when judge module 64 judgement is no, first the described storage block of selecting is at random processed into sky storage block, then the data of described DSB data store block and new data are combined into more new data, described more new data is write in described empty storage block; Wipe module 66 for wiping the data of storing in the DSB data store block navigating to, making this DSB data store block is empty storage block.
The data of the DSB data store block of locating module 62 location comprise logical block number (LBN) and data field data in the present embodiment, and writing module 65 comprises: reading unit 651, updating block 652, writing unit 653.
Reading unit 651, for reading in internal memory by the data of described DSB data store block; Updating block 652, for being combined into more new data at internal memory by the data field data in described data and new data; Writing unit 653, for described more new data and logical block number (LBN) are write to sky storage block, and writing module 65 is first will be more after new data writes in sky storage block, then logical block number (LBN) is write to sky storage block.
Further, in the present embodiment, writing module 65 also comprises: first selects unit 654, the first writing unit 655, the first erase unit 656, the first judging unit 657, the first clearing cells 658.
First selects unit 654 for select an interim empty storage block according to default rule; The first writing unit 655 is for writing the data of the described storage block of selecting at random in described interim empty storage block; The first erase unit 656 is for being empty storage block by the described memory block erasing of selecting at random; The first judging unit 657 is for judging whether described interim empty storage block is the empty storage block that has record; The first clearing cell 658 is for when described the first judging unit judgement is, to have the empty memory block erasing of record be empty storage block by described.
And, originally executing in example, first selects unit 654 comprises: the adjacent subelement 6541 of selecting.The adjacent subelement 6541 of selecting, for from the described storage block of selecting at random, is searched backward successively, until find an empty storage block and using described empty storage block as interim empty storage block; Or the adjacent subelement 6541 of selecting, for from the described storage block of selecting at random, is searched forward successively, until find an empty storage block and using described empty storage block as interim empty storage block.
In the present embodiment, select module 63 and comprise: generation unit 631, positioning unit 632, the second judging units 633, gravity treatment unit 634.
Generation unit 631 is for generating a random number that is not more than all storage block sums; Positioning unit 632, for the address of the storage block in location using this random number as physical block number, is selected described storage block; The second judging unit 633 is for judging whether the storage block of selecting is at random the DSB data store block that needs the data place of modification; Gravity treatment unit 634 is for when judging unit judgement is, from all storage blocks, again select at random a storage block, or gravity treatment unit 634 is for selecting the next storage block of the current storage block of selecting at random, or gravity treatment unit 634 is for selecting a upper storage block of the current storage block of selecting at random.
Through the above description of the embodiments, those skilled in the art can be well understood to the mode that the present invention can add essential general hardware platform by software and realize, can certainly pass through hardware, but in a lot of situation, the former is better embodiment.Understanding based on such, the part that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in the storage medium can read, as the floppy disk of computing machine, hard disk or CD etc., comprise some instructions with so that equipment (can be notebook computer, also can above flash memory etc.) carry out the method described in each embodiment of the present invention.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion by the described protection domain with claim.

Claims (18)

1. a method for data writing, is characterized in that, comprising:
Receive the instruction that writes new data;
Location needs the DSB data store block at the data place of modification;
From all storage blocks, select at random a storage block;
Judge whether the described storage block of selecting is at random sky storage block;
If so, the data of described DSB data store block and new data are combined into more new data, described more new data is write in described empty storage block;
If not, first the described storage block of selecting is at random processed into sky storage block, then the data of described DSB data store block and new data is combined into more new data, described more new data is write in described empty storage block;
The DSB data store block navigating to is erased to sky storage block.
2. the method for data writing according to claim 1, it is characterized in that, the data of described DSB data store block comprise logical block number (LBN) and data field data, the data of described DSB data store block and new data are combined into more new data, described more new data is write to sky storage block and comprise:
The data of described DSB data store block are read in internal memory;
In internal memory, the data field data in described data and new data are combined into more new data;
Described more new data and logical block number (LBN) are write in sky storage block.
3. the method for data writing according to claim 2, is characterized in that, described described more new data and logical block number (LBN) are write in sky storage block is:
First more new data writes in sky storage block, then logical block number (LBN) is write to sky storage block.
4. the method for data writing according to claim 1, it is characterized in that, described the data of described DSB data store block and new data are combined into more new data, described more new data are write to described empty storage block, before described more new data is write to described empty storage block, also comprise:
Judge whether described empty storage block is the empty storage block that has record;
If so, having the empty storage block of record described in wiping is empty storage block;
If not, directly carry out described more new data is write to described empty storage block.
5. the method for data writing according to claim 1, is characterized in that, describedly from all storage blocks, selects at random a storage block and comprises:
Generate a random number that is not more than all storage block sums, using described random number as physical block number, the address of the storage block in location, selects described storage block.
6. the method for data writing according to claim 1, is characterized in that, describedly the described storage block of selecting is at random processed into sky storage block comprises:
According to default rule, select an interim empty storage block;
Data in the described storage block of selecting are at random write in described interim empty storage block;
By the described memory block erasing of selecting at random, it is empty storage block.
7. the method for data writing according to claim 6, is characterized in that, described data in the described storage block of selecting are at random write in described interim empty storage block before, the method also comprises:
Judge whether described interim empty storage block is the empty storage block that has record;
If so, to have the empty memory block erasing of record be empty storage block by described;
If not, directly carry out the data in the described storage block of selecting are at random write in described interim empty storage block.
8. the method for data writing according to claim 7, is characterized in that, describedly according to default rule, selects an interim empty storage block and is:
From the described storage block of selecting at random, search successively backward, until find an empty storage block and using described empty storage block as interim empty storage block; Or
From the described storage block of selecting at random, search successively forward, until find an empty storage block and using described empty storage block as interim empty storage block.
9. the method for data writing according to claim 1, is characterized in that, selects at random a storage block and also comprise from all storage blocks:
Whether the storage block that judgement is selected is at random the DSB data store block that needs the data place of modification;
If so, from all storage blocks, again select at random a storage block, or
Select the next storage block of the current storage block of selecting at random, or
Select a upper storage block of the current storage block of selecting at random;
If not, execution step judges whether the described storage block of selecting is at random sky storage block.
10. a device for data writing, is characterized in that, comprising:
Receiver module, for receiving the instruction that writes new data;
Locating module, for locating the DSB data store block at the data place that needs modification;
Select module, for the storage block from all, select at random a storage block;
Judge module, for judging whether the described storage block of selecting is at random sky storage block;
Writing module, for when judge module judgement is, is combined into more new data by the data of described DSB data store block and new data, and described more new data is write in described empty storage block;
Said write module is also for judging when judge module when no, first the described storage block of selecting is at random processed into sky storage block, then the data of described DSB data store block and new data are combined into more new data, described more new data is write in described empty storage block;
Wipe module, for the DSB data store block navigating to is erased to sky storage block.
The device of 11. data writings according to claim 10, is characterized in that, the data of the DSB data store block of described locating module location comprise logical block number (LBN) and data field data, and writing module comprises:
Reading unit, for reading in internal memory by the data of described DSB data store block;
Updating block, for being combined into more new data at internal memory by the data field data in described data and new data;
Writing unit, for writing sky storage block by described more new data and logical block number (LBN).
The device of 12. data writings according to claim 11, is characterized in that, said write unit is first incited somebody to action more new data and write in sky storage block, then logical block number (LBN) is write to sky storage block.
The device of 13. data writings according to claim 10, is characterized in that, this device also comprises:
The first judge module, for judging whether described empty storage block is the empty storage block that has record;
First removes module, and for when the first judge module judgement is, the empty storage block that has record described in wiping is empty storage block.
The device of 14. data writings according to claim 10, is characterized in that, described in select module and comprise:
Generation unit, for generating a random number that is not more than all storage block sums;
Positioning unit, for the address of the storage block in location using described random number as physical block number, selects described storage block.
The device of 15. data writings according to claim 10, is characterized in that, said write module also comprises:
First selects unit, for select an interim empty storage block according to default rule;
The first writing unit, for writing the data of the described storage block of selecting at random in described interim empty storage block;
The first erase unit, for being empty storage block by the described memory block erasing of selecting at random.
The device of 16. data writings according to claim 15, is characterized in that, said write module also comprises:
The first judging unit, judges whether described interim empty storage block is the empty storage block that has record;
The first clearing cell, for when described the first judging unit judgement is, to have the empty memory block erasing of record be empty storage block by described.
The device of 17. data writings according to claim 15, is characterized in that, described first selects unit comprises:
The adjacent subelement of selecting, for from the described storage block of selecting at random, searches backward successively, until find an empty storage block and using described empty storage block as interim empty storage block; Or
The described adjacent subelement of selecting, for from the described storage block of selecting at random, searches forward successively, until find an empty storage block and using described empty storage block as interim empty storage block.
The device of 18. data writings according to claim 10, is characterized in that, selects module and also comprises:
The second judging unit, for judging whether the storage block of selecting is at random the DSB data store block that needs the data place of modification;
A storage block for when described the second judging unit judgement is, is again selected at random in gravity treatment unit from all storage blocks, or
Described gravity treatment unit, for selecting the next storage block of the current storage block of selecting at random, or
Described gravity treatment unit, for selecting a upper storage block of the current storage block of selecting at random.
CN200810247055.7A 2008-12-31 2008-12-31 Method and device for writing data Active CN101526921B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200810247055.7A CN101526921B (en) 2008-12-31 2008-12-31 Method and device for writing data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200810247055.7A CN101526921B (en) 2008-12-31 2008-12-31 Method and device for writing data

Publications (2)

Publication Number Publication Date
CN101526921A CN101526921A (en) 2009-09-09
CN101526921B true CN101526921B (en) 2014-07-30

Family

ID=41094791

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200810247055.7A Active CN101526921B (en) 2008-12-31 2008-12-31 Method and device for writing data

Country Status (1)

Country Link
CN (1) CN101526921B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104699623B (en) * 2015-02-12 2018-09-11 北京天诚盛业科技有限公司 Accelerate the method and device of Flash write operations
CN106776362B (en) * 2015-11-24 2019-12-03 中芯国际集成电路制造(上海)有限公司 The control method and device of memory
US10013335B2 (en) * 2015-12-21 2018-07-03 Intel Corporation Data flow analysis in processor trace logs using compiler-type information method and apparatus

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1362708A (en) * 2001-01-02 2002-08-07 吴秀林 Read-write method for flash memory chip
CN1851672A (en) * 2006-04-05 2006-10-25 北京飞天诚信科技有限公司 Flashmemory safety read-write method
EP1430386B1 (en) * 2001-09-28 2007-01-24 Lexar Media, Inc. Method of writing data to non-volatile memory
CN100356347C (en) * 2006-04-29 2007-12-19 北京飞天诚信科技有限公司 Safety writing method for flash memory

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008181203A (en) * 2007-01-23 2008-08-07 Sony Corp Storage device, computer system, and method for managing storage device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1362708A (en) * 2001-01-02 2002-08-07 吴秀林 Read-write method for flash memory chip
EP1430386B1 (en) * 2001-09-28 2007-01-24 Lexar Media, Inc. Method of writing data to non-volatile memory
CN1851672A (en) * 2006-04-05 2006-10-25 北京飞天诚信科技有限公司 Flashmemory safety read-write method
CN100356347C (en) * 2006-04-29 2007-12-19 北京飞天诚信科技有限公司 Safety writing method for flash memory

Also Published As

Publication number Publication date
CN101526921A (en) 2009-09-09

Similar Documents

Publication Publication Date Title
US8417872B2 (en) Write and merge methods in memory card systems for reducing the number of page copies
US7639537B2 (en) Method for writing data in a non volatile memory unit
CN100424655C (en) Method for managing flash memory
US8429327B2 (en) Mapping apparatus and method for non-volatile memory supporting different cell types
CN101354681B (en) Memory system, abrasion equilibrium method and apparatus of non-volatile memory
CN102819496B (en) Address translation method of flash FTL (Flash Translation Layer)
CN102483714A (en) Restore Index Page
KR20100080350A (en) Recovery for non-volatile memory after power loss
US8549214B2 (en) Protection against data corruption for multi-level memory cell (MLC) flash memory
JP2009510552A (en) Data management method in flash memory media
CN101025712A (en) Storage apparatus using nonvolatile memory and its mapping information recovering method
CN100382049C (en) Data processing apparatus and method for flash memory
CN103425600A (en) Address mapping method for flash translation layer of solid state drive
CN104090730A (en) Method and device for conducting data reading and writing on storage device
CN104461750B (en) A kind of access method and device of NAND flash
TW201312352A (en) System for increasing read/write speed of hybrid storage unit and method thereof
CN104516959A (en) Method and device for managing database logs
CN103413569B (en) One reads and one writes static RAM
CN109101437A (en) A kind of date storage method and terminal
KR20080101568A (en) Apparatus and method of managing mapping table of non-volatile memory
CN101526921B (en) Method and device for writing data
US20170285953A1 (en) Data Storage Device and Data Maintenance Method thereof
CN112347001B (en) Verification method and device for flash memory garbage collection and electronic equipment
CN101526920B (en) Method and device for writing data
CN113568579A (en) Memory, data storage method and data reading method

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