CN100538900C - Data manipulation method in the flash media - Google Patents

Data manipulation method in the flash media Download PDF

Info

Publication number
CN100538900C
CN100538900C CNB2003101177161A CN200310117716A CN100538900C CN 100538900 C CN100538900 C CN 100538900C CN B2003101177161 A CNB2003101177161 A CN B2003101177161A CN 200310117716 A CN200310117716 A CN 200310117716A CN 100538900 C CN100538900 C CN 100538900C
Authority
CN
China
Prior art keywords
data
new
piece
scratch pad
pad block
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.)
Expired - Lifetime
Application number
CNB2003101177161A
Other languages
Chinese (zh)
Other versions
CN1635579A (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.)
Netac Technology Co Ltd
Original Assignee
Netac Technology 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 Netac Technology Co Ltd filed Critical Netac Technology Co Ltd
Priority to CNB2003101177161A priority Critical patent/CN100538900C/en
Publication of CN1635579A publication Critical patent/CN1635579A/en
Application granted granted Critical
Publication of CN100538900C publication Critical patent/CN100538900C/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Abstract

The invention provides a kind of data manipulation method in flash media, comprising:, determine and the relevant new storage block of this write data instruction according to the specified storage block of assigned address in the current write command; Described new storage block is carried out data writing operation; Judge whether subsequent instructions is relevant with described new storage block, if relevant, then carry out this relevant instruction, all executed is intact up to the instruction that described new storage block is correlated with; With with the net result of the content in the described new storage block as the write data instruction manipulation relevant with this storage block.Use method of the present invention to carry out data manipulation, can simplify the data manipulation instruction implementation of the flash media of most of kinds greatly, significantly improve data manipulation efficient, save the running time, also can guarantee the data security in the operating process, the loss that minimizing causes the flash media frequent operation prolongs flash media serviceable life.

Description

Data manipulation method in the flash media
Technical field
The present invention relates to the semiconductor storage field, relate in particular to the flash media data manipulation method, be used for just to operate in a certain storage area the data manipulation instruction unification handle.
Background technology
At present, the flash memory device that adopts flash media to carry out data storage has obtained to be extensive use of.But because flash media self character and the existing defective of existing data manipulation method thereof make that the operating speed of this class flash memory device is lower.And in the flash media of some type, or in some data manipulation in particular cases, data manipulation speed can significantly reduce, and uses to the user and has caused inconvenience.
In the prior art, the storage space of flash media (abbreviation flash media) generally is divided into a plurality of storage block (Block, be physical block), each storage block is made of a plurality of pages or leaves (Page), and each page comprises the data storage area of some bytes and the redundant area of some bytes.In redundant area, also be provided with the check code zone, be used to deposit check code.According to the prior art standard, all preserve the logical address of this piece in each storage block, this address is generally held in first page of storage block.Address information in this logical address and the table of comparisons has corresponding relation, is the foundation of searching and locating storage block.According to the assigned address in the data manipulation instruction, can draw corresponding appointment logical address by address mapping, search the table of comparisons according to this appointment logical address, find out and specify the corresponding logical address of logical address, find out this logical address physical address corresponding again, just can from flash media, find the storage block of appointment.
When operating system is operated according to the user, when in flash media, writing data by certain concrete write data instruction, the read write attribute special according to flash media, on the one hand the data that will keep in the storage block 10 (hereinafter referred to as former) that must the assigned address in the write data instruction is pointed by former " resettlement " in the correspondence of another storage block 20 (hereinafter referred to as new piece) page, the new data that also the write data command request will be write former 10 on the other hand writes in the corresponding page or leaf of new piece 20, then former is wiped, substitute former 10 with new piece 20.
In said method, the above-mentioned data that will keep are meant the data in those pages that the new data that will do not write covers in the raw data of former 10 record.Data that keep and the new data that will write are formed the result data that the write data instruction obtains jointly.Writing and moving of above-mentioned data normally is that unit carries out with the page or leaf, and wiping then is that unit carries out with the piece.
But according to the available data access technique, a data writing operation instruction is only sent the some memory blocks in flash memory space; Above-mentioned memory block is the one section continuous storage space that is positioned at storage block, can be one or more continuous pages or leaves.Each write data instruction writes a page data at least in certain storage block, but can not exceed the capacity of this piece.Yet in fact in most of operating systems, the data writing operation instruction is carried out downwards according to the physical address order, can occur one group of continuous write data instruction under a lot of situations.These write commands some storage blocks in same storage block or certain scope are sent, and write new data successively according to the order of the physical address in this piece or this scope, until the last page of having write this piece.And, when carrying out each write data instruction,, all need to carry out secondary data resettlement as long as have data in the storage block of appointment according to aforesaid existing flash media read-write technology.This will cause in a certain or the data in a certain scope continuously, repeat repeatedly to move, thereby influence instruction execution speed greatly, and frequent read-write operation shortens its life-span with the loss flash media.
In addition, in above-mentioned prior art, from the flash media reading of data need by read file allocation table, the directory area waits the information that obtains data file in the flash media.If carry out in the process of above-mentioned resettlement in the data that will need to keep, meet accident or situation such as user misoperation causes power-off illegally, can make this moving process accidental interruption.In power-cut time the relocating work of the data that will keep is not finished as yet, the logical address of this part data is not upgraded in file allocation table, directory area etc. in time, may produce the storage block repetition that participates in resettlement, the data mistakes and omissions in the storage block, become invalid data.Like this, the file that contains this part data becomes inactive file, causes data file to lose.Therefore its data security is relatively poor.
Have again, after the data relocating work is finished, carry out erase operation to former 10, be " sky "; Erase operation is that all positions in former 10 are set to logical one.Piece through erase operation is called " empty piece ", and its inner all positions all are logical one.If flash media sudden power in erase process may exist in this piece part position to be logical one, and still have the part position still to be the situation of logical zero.At this moment, will make mistakes if write new data to this piece again.
In some flash media product, be provided with buffer memory (being called for short CACHE) mechanism and corresponding programming instruction thereof.Utilize this mechanism, some storage blocks in the flash media can be considered as the data working storage, adopt empty programming (CACHE PROGRAM) that data are write and wherein carry out the temporary of volatibility, if this moment, flash media was stopped power supply, data will be lost in this piece, and this piece also can write new data; Certainly, also can adopt real programming (PAGE PROGRAM) operation, in this piece, write data and carry out permanent non-volatile memory with this storage block as normal storage block.Data behind real programming operation with the same permanent storage in the common flash media, can not lost even flash media is stopped power supply yet.
Summary of the invention
The objective of the invention is to propose a kind of data manipulation method in flash media, with the operating speed of the available data operative technique that solves flash media with efficient is low, loss big and shortcoming such as data security difference.
For achieving the above object, the invention provides the data manipulation method in a kind of flash media, it is characterized in that described method comprises step:
1) according at the assigned address in the former current write command, determines the new piece relevant with this write command;
2) carry out the write command operation to described new;
3) new piece is carried out and the new relevant follow-up write command of piece; With
4) replace former with new piece.
The said method step 1) comprises step: judge whether to exist the new piece corresponding with the assigned address of described write command; As there not being new piece, or existing new piece exists, but uncorrelated with this write data instruction, then sets up new piece; If perhaps existed and the relevant new piece of current write data instruction, determine that then this new is the piece that current write data instruction will write.
Wherein, the process of the new piece of described foundation comprises:
To the empty piece mark logical address corresponding, piece number or other correspondence markings with the assigned address of described current write command, with described former set up corresponding relation; Described empty piece is found out in storage space after receiving write command or before receiving write command; Or after carrying out erase operation to former, with this former of being wiped free of as empty piece; Or when storage medium was formatd, the piece of reserving some constituted described empty piece as unavailable.
Step 2 in the said method) to the described new following situation that comprises of carrying out the write command operation: directly new piece is carried out write command, new data is write new piece; The volatile storage that perhaps utilizes described flash memory device is got one of them storage block and is set up corresponding relation with new piece as working storage, and this scratch pad block is carried out write command, and data are write scratch pad block, is copied in the corresponding page or leaf of new piece by scratch pad block again; Perhaps for storage medium with empty programming and real programming mechanism, get one of them empty piece and set up corresponding relation or mirror with new piece, this scratch pad block is carried out empty programming operation, the empty programming of data is write scratch pad block, again new piece is carried out real programming operation, data are programmed in the corresponding page or leaf of new piece by scratch pad block is real.
Above-mentioned scratch pad block copies data to the operation of the corresponding page or leaf of new piece and can seek unity of action after scratch pad block accumulative total is carried out a plurality of write commands.
In the said method in the step 3), judge whether relevant method comprises for follow-up write command and new piece: judge new piece last page whether operate by the executed write command, if new piece last page executed write operation, then follow-up write command has nothing to do execution in step 4 with described new); Whether the logical address of the assigned address of perhaps judging follow-up write command and new piece, piece number or other correspondence markings are identical or corresponding; For the follow-up write command relevant, adopt the step identical to carry out with present instruction with new piece;
Said method further comprises the process that the irrelevant new piece of described and current write command or scratch pad block are cleared up, and this process comprises: filter out new piece or the scratch pad block that should clear up in all existing new or scratch pad block; With described new piece or the scratch pad block that filters out cleared up; Described cleaning operation is realized by the data moving process.
Described screening is carried out in the following way:
Timing mode: relatively all new or scratch pad block wait the duration of relevant write data instruction, and new piece or the scratch pad block that waits at most screened; Or
Priority mode:, filter out priority minimum or the highest new piece or scratch pad block according to waiting for duration, the priority of dependent instruction, the priority of associated documents; Or
Physical address mode:, the new piece or the scratch pad block of minimum use farthest screened according to described new or scratch pad block physical address at flash media; Or
The instruction count mode: according to the number of instructions that described new or scratch pad block are carried out, the new piece or the scratch pad block that the execution command number are met preassigned screen;
In aforesaid way, screened described new or scratch pad block quantity are one or more.
Former of new piece replacement can be by the realization of data moving process in the step 4) in the said method; The data that will keep in described former can directly be moved in the new piece, also can move in the scratch pad block, form valid data jointly with the new data in the described scratch pad block, copy in the corresponding page or leaf of new piece by scratch pad block again, or by in disposable corresponding page of being written to simultaneously with the new piece of described scratch pad block mirror image of scratch pad block.
Further comprise in the said method: receive last write operation instruction timing from new piece of described appointment or scratch pad block; Judge whether timing arrives scheduled duration; If timing does not arrive scheduled duration, then continue timing, otherwise judged whether described new or scratch pad block; If have described new or scratch pad block,, otherwise continue timing then to existing new or scratch pad block is screened and cleaning operation; With when described flash memory device quits work, stop timing.
Said method also comprises: when carrying out data writing operation to described new, at least to the filling of one page wherein markup information; After flash media powers on, to any storage block, check its markup information, if markup information and predetermined information are not inconsistent,, keep another storage block with this memory block erasing; Keep this storage block if markup information meets predetermined information, wipe another storage block;
Search the table of comparisons, if find two storage blocks with same logical address, and the markup information of each all page of piece is consistent, then selects a correct storage block of data to be kept, and wipes another storage block;
Check in the free piece of institute of flash media whether also have the data of partly not wiping fully, if having then this sky piece is wiped once more.
When having the complete storage block of two data, adopt check code that two complete storage blocks of data are tested, select correct being kept of one of them data, the described check code that utilizes comprises the method for data checks: write to storage block or the temporal data process in, when every pair of one page carries out data manipulation, the data computation that will write check code, it is kept in this page redundant area; Data according to data storage area in the page or leaf is preserved adopt identical algorithm computation to go out proof test value, and the check code of preserving in this value and this page redundant area is compared; If inequality with both, illustrate that the data that the data storage area is preserved in this page are different with the data that will write, the data in this page are incorrect, and the storage block data under it are incorrect.
According to the data manipulation method in flash media of the present invention, described flash media comprises a plurality of storage blocks, each described storage block is made of a plurality of pages or leaves, each page or leaf comprises data storage area and redundant area, at least one data manipulation instruction is carried out in described data manipulation, described method comprises: according to the specified storage block of assigned address in the current write command, determine and the relevant new storage block of this write data instruction; Described new storage block is carried out data writing operation; Judge whether subsequent instructions is relevant with described new storage block, if relevant, then carry out this relevant instruction, all executed is intact up to the instruction that described new storage block is correlated with; With with the net result of the content in the described new storage block as the write data instruction manipulation relevant with this storage block.
Use method of the present invention to carry out data manipulation, can simplify the data manipulation instruction implementation of the flash media of most of kinds greatly, obviously improving data manipulation instruction carries out efficient, saves the running time, also can guarantee the data security in the operating process, the loss that minimizing causes the flash media frequent operation prolongs flash media serviceable life.And in process operation data, no matter be situations such as artificial illegal operation or accident power-off, can not cause losing of valid data in the flash media.In addition, also can avoid storage block not wiped so that read and write once more the situation of makeing mistakes fully, under the prerequisite of raising data manipulation speed, improve data security and system stability.
Followingly will make those of ordinary skills understand thought of the present invention to the concrete and detailed explanation of the specific embodiment of the present invention with reference to accompanying drawing.
Brief description of drawings
Fig. 1 schematically illustrates the institutional framework of storage block and page or leaf in the existing flash media;
Fig. 2 is a synoptic diagram of implementing former of the inventive method, new piece and scratch pad block;
Fig. 3 adopts first embodiment of the invention to carry out the main flow synoptic diagram of write data instruction;
Fig. 4 is the schematic flow sheet of data moving process in the first embodiment of the invention;
Fig. 5 is the schematic flow sheet of scratch pad block scale removal process in the first embodiment of the invention;
Fig. 6 adopts second embodiment of the invention to carry out the main flow synoptic diagram of write data instruction;
Fig. 7 is the schematic flow sheet of data moving process in the second embodiment of the invention;
Fig. 8 is the schematic flow sheet of monitor procedure in the first embodiment of the invention.
Embodiment
First embodiment of the invention in the normal flash medium product, is utilized the working storage mechanism of flash memory device, will unify to handle to a plurality of write data instructions of a certain, to realize the speed-raising of data manipulation.
According to this embodiment, the volatile storage that adopts flash memory device is opened up the scratch pad block 30 that equates with former 10 capacity as working storage in the storage space of working storage, is used for the new data in the temporary write command of execution process instruction.
In an embodiment of this first embodiment, can scratch pad block be set to whole working storage and have sign, indicate whether there is the scratch pad block of having kept in new data in the working storage.Scratch pad block exists the method to set up of sign to be: when opening up a storage block first when keeping in new data in working storage, this sign is made as " existence "; All keep this value of statistical indicant when using more storage blocks thereafter and be " existence "; When last storage block that is used for temporary director data is released, exist sign to be made as " not existing " this scratch pad block.For example, it is 0 that the sign initial value is set, and expression does not have scratch pad block, the value of statistical indicant of non-zero to represent that scratch pad block is arranged; Whenever set up a scratch pad block, add 1 to this value of statistical indicant; Whenever the scratch pad block of finishing using just subtracts 1 with this value of statistical indicant when it is discharged.Certainly, also can adopt other regular fashions, as long as controller can judge whether scratch pad block is arranged in the working storage according to this value.
In another embodiment, also can not adopt above-mentioned whole working storage to be provided with the method that there is sign in scratch pad block, but single scratch pad block is provided with temporary sign, be used to indicate the operating position of scratch pad block.Specific practice is: whenever open up a storage block when being used for temporary new data in working storage, all this piece is provided with a temporary sign; The value of the sign by reading certain storage block, controller can be understood this piece and whether be used for temporary new data; By reading the value of the sign of all storage blocks in the working storage, whether there is the scratch pad block of having kept in new data in this working storage as can be known.After certain scratch pad block is finished using, should simultaneously its sign be changed into the value of " not temporary " when discharging this scratch pad block.
Above-mentioned two kinds of signs all can be stored in working storage, flash media or other storeies, and its value can be numerical value, character and numerical value and character combination or Boolean.
When in flash media, adopting data manipulation method of the present invention, as shown in Figure 2, data manipulation can the storage block in flash media 10 and 20 and scratch pad block 30 in working storage between carry out.Wherein storage block 10 is former, is the assigned address storage block pointed in the write data instruction.Storage block 20 is empty pieces (being designated hereinafter simply as new piece) of finding out in storage space, this piece use with former 10 identical logical address, piece number or other correspondence markings as its mark.By these marks, this storage block 20 is set up corresponding relation with former 10.When the instruction of write data is when pointing to former 10, marks such as the logical address of its appointment, piece number also can conform to this storage block 20, and promptly storage block 20 is also relevant with the write data instruction to former 10 write data.After to former 10 unified the disposing of one group of write data instruction, the data that will keep among the new data that this group instruction will write and former all will write in the new piece 20.And scratch pad block 30 is according to write data instruction, in working storage, open up with the identical storage block of storage block 10,20 capacity, the new data that is used for writing former 10 is temporarily stored in wherein.This storage block 30 is also set up corresponding relation by mark such as logical address, piece number and former 10, and is also relevant with the write data instruction to former 10.
Fig. 3 shows the implementation of using data manipulation method of the present invention in the present embodiment single write data to be instructed.Concrete steps are:
Described flash memory device receives after the write data instruction (step 301) of operating system, and the controller of flash memory device is found out the storage block that will write data according to the assigned address in the described instruction, promptly former 10 (steps 302).
Next execution in step 303, and the controller of flash memory device exists to indicate to judge whether have scratch pad block 30 in the working storage according to scratch pad block:
If there is not scratch pad block in the working storage, not temporary any new data that will write former in the working storage is described.This moment should be according to information such as former 10 address, capacity, in working storage, open up an empty scratch pad block 30 that equates with former 10 capacity, by modes such as mark logical address, piece number or other correspondence markings, set up the corresponding relation between scratch pad block 30 and former 10, then revise scratch pad block and exist and be masked as " existence " (step 306).
Next, the controller of flash memory device according to existing flash media working specification, finds out an empty piece in flash media, and marks such as mark logical address, piece number make it become new piece 20 (step 308).
On the other hand, if existing scratch pad block in the working storage illustrates in the write operation process before this write operation have some new data to be temporarily stored in the scratch pad block, do not handle but also finish resettlement; This scratch pad block may be corresponding with former 10 that this write command points to, also may be irrelevant with this write data instruction.
Should further check this scratch pad block this moment, judges whether and this write data instruction relevant (step 304):
If determine that this scratch pad block is relevant with this write data instruction, should write this write data instruction and will write former 10 new data (step 307) this moment in these scratch pad block 30 corresponding pages or leaves;
If judge by contrast, determine that the instruction of this scratch pad block and this write data is irrelevant, tackle that this piece is cleared up and scratch pad block exists sign to be set to " not existing " (step 305), this scratch pad block is cleared up after way is described in detail in.After this piece cleaned out, execution in step 306 again, open up new scratch pad block 30 in working storage, then find out a new piece 20 (step 308) in flash media.
After above-mentioned steps was finished, the new data that the write data command request is write write in the corresponding page or leaf of the scratch pad block relevant with this instruction 30, and writes down page or leaf side-play amount or the page number (step 309) of this page in this scratch pad block 30.
After having write the new data that the instruction of this write data will write, should check and whether last page of scratch pad block 30 carried out data writing operation (step 310).
If data writing operation does not proceed to the last page of scratch pad block 30 as yet, illustrate that the relevant write operation instruction of this group to former 10 does not finish as yet, may follow the instruction of carrying out write operation to former 10 in addition.Should wait for assign (step 311) of next write data instruction this moment, this write data instruction is finished, and finishes main flow;
If scratch pad block 30 has been write last page, illustrate to former 10 one group relevant data writing operation all executed finish, the new data in this group dependent instruction all is kept in the scratch pad block 30.Should form valid data jointly this moment with the data that will shift among the new data in the scratch pad block 30 and former 10, calls the data moving process, and above-mentioned valid data are moved in the new piece 20 that step 308 is found out, and replaces former 10 (step 312).After the data moving process is described in detail in.
After above-mentioned steps is finished, also should exist sign to change " not existing " (step 313) into scratch pad block.
The single write data instruction of present embodiment is carried out main flow and is finished.
In the step 305 of above-mentioned main flow, to carrying out cleaning operation with the irrelevant single scratch pad block of present instruction, its cleaning operation is actual to be to call the data moving process to carry out.With step 312 place call the data moving process different be, step 305 place will carry out the scratch pad block of data resettlements, the temporary operation of its data does not proceed to last page as yet; And the scratch pad block at step 312 place, although the valid data district that wherein has part page or leaf temporal data not, temporary operation has proceeded to last page.In fact, these two kinds of operations all are that content with scratch pad block is converted to the desired valid data that obtain of relative instruction.
The data moving process as shown in Figure 4, detailed process is:
Step 401 copies to the new data in the scratch pad block 30 in the corresponding page or leaf of new piece 20;
Step 402, page number or side-play amount according to the new data place page or leaf of record in the main flow step 309, compare with the page number or the side-play amount of new all pages of piece, draw the page number or the side-play amount at non-new data place, with the data in these pages in former, promptly the data that will keep copy to the corresponding page or leaf of new piece 20; After step 402 was finished, all pages or leaves of new piece 20 had all write valid data, these valid data by from former 10 data that will keep with form jointly from the new data of scratch pad block 30; The data that will keep in former 10 are copied in the corresponding page or leaf of new piece 20;
Step 403 is carried out erase operation to former 10, makes that former all position is complete to be logical one, becomes the sky piece;
Step 404 discharges scratch pad block, and scratch pad block exists sign to be set to " not existing ";
Step 405, the corresponding address information of new piece 20 in the renewal table of comparisons, the logical address that is about to corresponding stored piece 20 in the table of comparisons is revised as this group and points to former 10 the specified logical address (just former 10 logical address) of write data instruction.
The data moving process finishes.
The above-mentioned data that will keep with former 10 with move in the operating process of new piece from the new data of scratch pad block 30, be that order is carried out between each step.In practical operation, the execution order of above steps and opportunity can suitably be adjusted.For example, step 401 and step 402 can be exchanged, or step 403 and step 404 are carried out simultaneously.Certainly, in order to guarantee the security of valid data, must after the data that will keep all copy in the new piece, carry out, and the operation that discharges scratch pad block must be carried out after new data all being copied in the new piece the operation of wiping former.
And, specific performance according to working storage, flash media and controller, and the concrete principle of work difference of flash memory device, the resettlement of the data that will keep in former can have two kinds of approach: a kind of is directly to move to new piece 20 by former 10, another kind is to write in the process of new data to scratch pad block 30, move to scratch pad block 30 by former 10 and to keep in, in the data moving process again with new data, with the resettlement of monoblock data to new piece 20.
Still with reference to Fig. 3.In above-mentioned main flow, require to have a scratch pad block of keeping in data at most in the synchronization working area, if by (main flow step 304) judged in the contrast of marks such as logical address, piece number, find that the instruction of this scratch pad block and current write data is irrelevant, then no matter whether this scratch pad block has write last page, all call the scratch pad block scale removal process this scratch pad block is carried out cleaning operation (step 305), can set up new scratch pad block according to current write data instruction.If interting between a plurality of different files (corresponding a plurality of storage blocks) back and forth, the user operates, then might cause each storage block all can't unify to handle to one group of operational order, still only carry out data resettlement operation according to an operational order, therefore only improved data manipulation speed to a certain extent, for this reason, can improve above-mentioned write data instruction execution flow, to allow there are a plurality of scratch pad block of keeping in data in the synchronization flash memory space, these scratch pad block are distinguished corresponding different former, and respectively with relevant to the instruction of these former write data.
Like this, the step 304 of main flow can be improved to: judging through step 303, under the known situation that has a scratch pad block, check the mark such as logical address, piece number of all scratch pad block, if it is relevant with current write data instruction to find out a scratch pad block, then execution in step 307, and the data in the write data instruction are write in the corresponding page or leaf of this scratch pad block; If marks such as the logical address of all scratch pad block or piece number all with specified not being inconsistent of present instruction, illustrate in all scratch pad block that the neither one scratch pad block is relevant with present instruction.Should carry out step 306 this moment, opens up an empty storage block as scratch pad block in working storage, the new data in the temporary current write data instruction.
Though nearly all storage block all can be used as scratch pad block and keeps in new data in the working storage in theory, in the present embodiment, too much scratch pad block will cause the reduction of seek rate and data security to reduce.Need to take number that the scale removal process of scratch pad block guarantees scratch pad block in the reasonable scope thus.Described scale removal process should occur in through step 304 determine in all scratch pad block that neither one and current write data instruct under the relevant situation and should step 306 set up an empty storage block as new scratch pad block before.
Specifically scale removal process is as shown in Figure 5:
Step 501 filters out the scratch pad block that should clear up in all scratch pad block 30 in working storage;
Step 502 is called aforementioned moving process to scratch pad block, and all new datas in this scratch pad block are moved in the new piece, replaces former with new piece;
Allow the scratch pad block scale removal process under a plurality of scratch pad block situations to finish.
Screening process in the step 501 of above-mentioned scale removal process can adopt multiple superseded mechanism or screening mechanism, adopts multiple algorithm to realize.For example, can adopt the mode of timing, relatively all scratch pad block wait the duration of relevant write data instruction, and the scratch pad block that waits is at most screened; Also can adopt the mode of priority,, filter out the minimum or the highest scratch pad block of priority according to waiting for duration, the priority of relevant instruction, the factors such as priority of relevant document; Also can consider the physical address of scratch pad block correspondence, the scratch pad block of minimum use is farthest screened at flash media, or the like.Certainly, also can once screen a plurality of scratch pad block clears up.One of ordinary skill in the art will appreciate that, can replace according to actual conditions, be not confined in the scope of this instructions announcement the screening mechanism of scratch pad block.Illustrating of the mechanism of screening do not constituted limitation of the invention.
When the data manipulation method that adopts present embodiment carries out the read data operation, if the storage block that the read data command request reads is in the process that the instruction of one group of write operation seeks unity of action, promptly there is the scratch pad block of a correspondence in this storage block, kept in the new data that the write data instruction will write to this storage block in this scratch pad block, then can call the scratch pad block liquidation procedures this moment, the data that will keep in the storage block with read data instruction sensing are transferred in the new piece, form the result data that described one group of write operation instruction will obtain jointly with new data temporary in this scratch pad block, with the storage block that this new alternative read data instruction pointed to, make the read data instruction read the new piece that has new data.
Also this read data instruction can be carried out step by step:
The first step will read out with all new datas in the corresponding scratch pad block of the storage block of appointment;
Second step pages compared according to all with the designated store piece of the page or leaf at the new data place of reading in the scratch pad block, and the data (i.e. the data that will keep) in those pages that do not covered by new data in the designated store piece are read out;
The 3rd step went on foot the data of reading with the first step and second and forms valid data jointly, returned to operating system.
The execution sequence in the above-mentioned first step and second step can be exchanged.
In addition, for convenient a plurality of scratch pad block are organized, and in a plurality of scratch pad block, searched the relevant scratch pad block of and instruction, can set up and safeguard a scratch pad block information table.Enumerate the logical address of all scratch pad block or piece number in this scratch pad block information table, further also can enumerate these logical address physical address corresponding; This table for empty with otherwise can be used as scratch pad block and have sign, there is not any scratch pad block for empty the expression in this table in the working storage.By reading this table information, just can judge whether to exist scratch pad block, and can search the scratch pad block corresponding with present instruction, also can further find this scratch pad block physical address corresponding, directly this scratch pad block of location from working storage.Certainly, do not adopt this scratch pad block information table, can directly in working storage, search all scratch pad block yet.
In the description of preamble, introduced, in some flash media product, be provided with buffer memory (being called for short CACHE) mechanism background technology.Present embodiment can utilize this mechanism to carry out following improvement:
Some storage blocks in the flash memory space are considered as scratch pad block, adopt empty programming (CACHE PROGRAM) that data are write and wherein carry out the temporary of volatibility; According to the caching mechanism of flash media product, can be between this scratch pad block and new piece establishing mirror image relation, make scratch pad block and newly piece is corresponding one by one.The main flow that instruction is carried out in main flow and the foregoing description is similar, when the scratch pad block in flash memory space writes new data, adopts empty programming operation, writes with higher rate; And in the data moving process, can carry out real programming operation simultaneously to a plurality of page or leaf of scratch pad block, in the disposable corresponding page or leaf that writes the new piece 20 of mirror image with it simultaneously of the new data in a plurality of pages or leaves.The scale removal process of scratch pad block and above-mentioned scale removal process are similar.
The foregoing description utilizes the scratch pad block in flash memory space and the flash memory device controller, and the new data of desiring to write in former 10 is temporarily stored in the scratch pad block 30, unified again the resettlement in the new piece 20, and whole write data process need takies more than three storage blocks.And because the new data in the scratch pad block is a volatile storage, if temporary new data is not also moved fully to new piece in scratch pad block, flash memory device generation sudden power phenomenon, then Zan Cun new data is probably lost.
Therefore,, propose another embodiment, do not use scratch pad block and directly new data is write and carry out non-volatile memory in the new piece according to inventive concept.
Another embodiment of flash media data manipulation method of the present invention is described according to Fig. 2 now.In this embodiment, can unify to handle to a plurality of write data instructions of a certain.Yet, one of ordinary skill in the art will appreciate that this embodiment is not a limitation of the invention.
When adopting the data manipulation method of present embodiment, as shown in Figure 2, data manipulation is carried out between the storage block in flash media 10 and 20.Wherein storage block 10 is former, is the assigned address storage block pointed in the data manipulation instruction.Storage block 20 (hereinafter to be referred as new piece) is the empty piece of finding out in flash media, and it is marked with and former 10 logical address that conforms to, piece number or other correspondence markings.By these marks, set up corresponding relation for this new 20 and former 10.When the instruction of write data is when pointing to former 10, marks such as the logical address of its appointment, piece number also can conform to this new 20, and promptly new piece 20 is also relevant with the write data instruction to former 10 write data.With last embodiment similarly, present embodiment is provided with new block information table to whole flash memory space, with the information table is whether emptyly to show whether there is the new piece that has write new data in the flash memory space.
Fig. 6 shows the data manipulation method that uses second embodiment of the invention, to the main flow of one group of write data instruction execution.
As shown in Figure 6, described flash memory device receives after the write data instruction (step 601) of operating system, and the controller of flash memory device is sought the storage block that will write data, promptly former 10 (steps 602) according to the assigned address in the described instruction.
Next execution in step 603, and the controller of flash memory device judges whether there is the new piece 20 of having stored data in the flash media according to new block information table for whether empty.
If there is no new piece 20 should be found out an empty piece 20 according to former 10 information such as capacity in flash media, mark and former 10 identical logical address, piece number or other correspondence markings are with foundation and the corresponding relation between former 10.This sky piece 20 will be stored in one group of write data instruction and will write former 10 new data as new piece.Should new piece for information about in the new block information table of typing, this stylish block information table becomes non-NULL (step 606).
On the other hand,, illustrate in the write operation process before this write operation have some new data to be stored in the new piece, do not handle but also finish the data resettlement if existing new piece exists in the flash media.In these new, it is corresponding to have certain new former 10 of pointing to this write data, also may all instruct with this write data to have nothing to do.
Whether should further search in new block information table this moment has and the relevant new piece (step 604) of this write data instruction.
If by searching new block information table, determine certain new 20 relevant with the instruction of this write data, should be written in the corresponding page or leaf of new piece 20 (step 607) this moment according to the new data that this write data instruction will be write former 10.
If judge by contrast, conclude that all new is instructed irrelevant with this write data, should filter out one or more irrelevant new pieces and it is cleared up, delete corresponding these information (step 605) of new in the new block information table simultaneously, after new piece cleaning way is described in detail in.After the irrelevant new piece of part cleaned out, execution in step 606 was found out the new piece of an empty piece as corresponding this write data instruction in flash memory space, with the new block information table of its information typing, prepare the storage new data.
After above-mentioned steps was finished, the new data that the write data command request is write write in the corresponding page or leaf of the new piece 20 relevant with this instruction, and writes down page or leaf side-play amount or the page number (step 608) of this page in this new 20.
After having write the new data that the instruction of this write data will write, whether check that the last page to new piece 20 carries out write operation (step 609).
If write operation does not proceed to the last page of scratch pad block 20 as yet, illustrate that the relevant write operation instruction of this group to former does not finish as yet, may follow the instruction of carrying out write operation to former 10 in addition.Should wait for assign (step 610) of next write data instruction this moment, this write data instruction is finished, and finishes main flow.
If the last page to new piece 20 carries out write operation, explanation to former 10 one group relevant data writing operation all executed finish, new data in this group dependent instruction all has been kept in the new piece 20, and ensuing write operation instruction generally is meant to next storage block.Should call the data moving process this moment, and the data that will keep in former 10 are write in the new piece 20, replaces former 10 (step 611) with new piece 20.After above-mentioned steps is finished, also should from new block information table, delete the information of relevant this new piece.
The main flow that the single write data instruction of present embodiment is carried out finishes.
In above-mentioned main flow step 605, carry out carrying out the actual data moving process that calls of cleaning operation with the irrelevant new piece of present instruction.With step 611 place call the data moving process different be, step 605 place will carry out the new piece of data resettlements, its write operation does not proceed to last page as yet; And the new piece at step 611 place, although the valid data district that wherein has part page or leaf temporal data not, write operation has proceeded to last page.With first embodiment in like manner, these two kinds of operations all are that the content with scratch pad block is converted to the desired valid data that obtain of relative instruction.
The data moving process as shown in Figure 7, detailed process is:
Step 701, page number or side-play amount according to the new data place page or leaf of record in the main flow step 608, compare with the page number or the side-play amount of new piece 20 all pages, draw the page number or the side-play amount at non-new data place, the data (i.e. the data that will keep) in these pages in former are copied to the corresponding page or leaf of new piece 20.After step 701 was finished, all pages or leaves of new piece 20 had all write valid data, and these valid data are made of jointly the new data that writes from former 10 the data and instruction that will keep.
Step 702 is carried out erase operation to former 10, makes that former all position is complete to be logical one, becomes the sky piece;
Step 703 is upgraded the corresponding address information of new piece 20 in the table of comparisons, and the logical address that is about to corresponding new piece 20 in the table of comparisons is revised as this group and points to former 10 write data and instruct specified logical address (just former 10 logical address);
Data resettlement flow process finishes.
By the description of above-mentioned two embodiments, data manipulation method of the present invention can be realized the speed-raising of data manipulation in most flash medias.Below, will some auxiliary and innovative approachs be proposed in conjunction with above-mentioned two embodiments for making the solution of the present invention safer efficient.
According to the explanation of above-mentioned two embodiments, carry out in the write data instruction process at flash memory device, use an empty piece as new piece if desired, just in a plurality of storage blocks of flash memory space, find out a untapped empty piece temporarily; Do like this and need often carry out the searching of extensive storage block, speed and efficient are low.
According to an improvement scheme of the present invention, before carrying out the write operation instruction, in each flash memory space or flash area (ZONE), find out an available empty piece in advance and prepare.When needs use new piece, do not need to search the sky piece temporarily, but take out the empty piece of this preparation, annotated logic address, piece number or other correspondence markings make it become new piece 20, with former 10 set up corresponding relation, again new data is write 20 li of new pieces.
According to existing flash memory device principle, when formaing for each sheet flash chip, the piece that reserve some comprises bad piece and controller reserved block etc. as unavailable.Actual formatted memory capacity can be deducted these unavailable.So always can find more than one good unavailable as empty piece, and these sky pieces can be looked the flash memory space amount of capacity and to the management flexible allocation of storage unit.For example, the capacity of whole flash memory can be divided into the M five equilibrium, in the storage area of each 1/M capacity, reserve some unavailable.
In the data moving process, referring to Fig. 7, be erased into and be empty piece (step 703) whenever former 10, all can with should the sky piece as the empty piece of reserving, in order to using as new piece 20 next time, save the time of searching new piece.
This is improved one's methods and is applicable to the normal flash chip product and is provided with the flash chip product of cache mechanism, applicable to adopting working storage or not using the specific implementation method of the present invention of working storage.
With first embodiment is example, main flow is carried out in write data instruction with reference to Fig. 3, in actual application to flash memory device, the user may be interrupted write operation for a long time and be carried out other operations, in the flash media of flash memory device, still there is a scratch pad block not carry out data resettlement operation probably at this moment.That is to say, a plurality of data writing operation instruction desires have been arranged to certain former write data, but former last page do not pointed in these instructions as yet, and the new data in these instructions all is temporarily stored in the corresponding scratch pad block, and instruction is carried out main flow and is in the state (step 610) of waiting for next instruction for a long time.If user's illegal operation or flash media sudden power take place during this period of time, temporary a collection of new data will be lost because of outage in the scratch pad block so.For avoiding analogue to produce, according to a preferred version of the present invention, one monitor procedure is provided, carry out in the process operation data at flash media, continue the time interval of monitoring write data instruction issuing, wait for that write command is long-time excessively in case find certain scratch pad block, monitor procedure will call the scratch pad block scale removal process this scratch pad block will be cleared up, and temporal data is wherein moved in the new piece 20.
This monitor procedure at certain concrete monitoring flow process of former as shown in Figure 8, specific practice is:
Step 801 receives last write operation instruction timing from former;
Step 802 judges whether timing arrives scheduled duration; If no, then continue timing;
Step 803 if timing arrives scheduled duration, judges whether scratch pad block is arranged in the flash media; If no, then continue timing;
Step 804 if scratch pad block is arranged in the flash media, is then called the scratch pad block scale removal process, and scratch pad block is screened and cleaning operation;
Step 805 if flash memory device quits work, then stops timing, withdraws from monitor procedure; Otherwise continue timing.
This monitor procedure can be applied in the second above-mentioned embodiment equally, and promptly the wait duration of new piece in the monitoring flash memory space carries out the data resettlement to the stand-by period above the scratch pad block of a predetermined value and handles, and makes new piece 20 replace former 10.
In above-mentioned monitor procedure, not only can adopt timing, also can adopt other modes to detect write data instruction issuing situation; Above-mentioned monitor procedure also can embed write data instruction and carry out in the step of main flow and carry out.
Because data manipulation method of the present invention is that one group of write data instruction is unified to handle, when data from temporary state or from scratch pad block, move in the process of new piece, still may when moving, data lose data original and that newly write as described in the background technology because of power-off illegally.
In the above-described first embodiment, because of the situation of power-off illegally obliterated data only may occur in scratch pad block is carried out in the process of data resettlement.In conjunction with Fig. 4 explanation scratch pad block is being carried out in the data moving process now, power-off illegally may cause the situation of corrupted data.
As cutting off the power supply before step 402 beginning in step 401 beginning back, the data that will keep in then former may only have partly and copy in the new piece, and scratch pad block is lost all data after cutting off the power supply.After powering on once more, there are not a plurality of storage blocks in the flash media, can not cause loss of data with same logical address.
If carry out cutting off the power supply in the process in step 402, possible data resettlement operating process is not finished as yet, and the new data of scratch pad block middle part paging has been moved in the new piece 20, and new data temporary in the remainder paging will be lost.After powering on once more, can have two storage blocks with same logical address in the flash memory space, the data of one of them storage block are intact, and another data are incomplete.Cause owing to logical address is identical and can't accurately locate storage block, the data file of this storage block correspondence just is damaged.
If cut off the power supply after step 402 is finished, before step 403 beginning, the data among scratch pad block 30 and former 10 have all been moved in the new piece 20 at this moment, can not lose because of outage.Can have two storage blocks with same logical address in the flash memory space, the data in these two storage blocks are all complete.But the data in one of them piece are before the data writing operation, and the data in another piece are upgraded through data writing operation.Cause owing to logical address is identical and can't accurately locate storage block, the data file of this storage block correspondence just is damaged.
If carry out cutting off the power supply in the process in step 403, may only wipe a part for former, still surplus part page or leaf still has data.File system can be considered as it sky piece, will make mistakes when this storage block writes new data once more.
If after step 403 is finished, cut off the power supply,, can not cause losing or the mistakes and omissions situation of data because the data manipulation of storage block is finished.If the process of upgrading the table of comparisons, still can be carried out after powering on once more again because of power-off illegally interrupts.
Loss of data and the identical phenomenon of storage block logical address at above-mentioned abnormal power-down may cause in a preferred implementation of the present invention, have proposed the measure of protection valid data.
In using data manipulation method process of the present invention, when scratch pad block is carried out data resettlement operation and is execution in step 402, whenever write one page new data, just to this page or leaf information of marking to new piece 20.This markup information is determined by system's predefine or user-defined markup information rule, its content can be former 10 the logical address that the write data instruction is pointed to, perhaps can be to have certain Changing Pattern or changeless symbol, also can be to carry out the page number of page or leaf of data manipulation and the combination of numerical value, character or numerical value and character.After so can guaranteeing the data of scratch pad block resettlement operation finished, the markup information of all having annotated of each page or leaf in the new piece 20.If in to the data of scratch pad block resettlement operating process, cut off the power supply, the part page or leaf markup information of having annotated newly must be arranged in the piece 20, and the remainder paging markup information of not annotating.Check by all pages markup information, just can judge in the new piece 20 whether data integrity new piece 20.
In conjunction with above-mentioned scratch pad block is carried out in the data moving process situation that power-off illegally may cause corrupted data takes place, adopt the measure of the protection valid data that such scheme of the present invention proposes after, as follows to the recovery operation measure principle of data:
1) if outage occurs in before step 401 carries out, or is wiped free of after (step 403) finish,, need do not carry out data restore operation because data read-write operation does not begin as yet or finishes at former 10.
2), then after flash media re-powers, search the table of comparisons and will find two storage blocks with same logical address if carry out cutting off the power supply in the process in step 402.According to aforementioned analysis, the data in one of them storage block have mistakes and omissions.To any storage block, check the markup information of its all pages, if be not that all pages markup information is all consistent, illustrate that the data in this storage block have mistakes and omissions, with this memory block erasing, keep another storage block; If all pages markup information unanimity then keep this storage block is wiped another storage block.
3) if after step 402 is finished, before step 403 beginning, cut off the power supply, after flash media re-powers, search the table of comparisons and will find two storage blocks with same logical address.According to aforementioned analysis, the data in these two storage blocks all are complete, and the markup information of all pages also must be consistent separately.Can select a correct storage block of data to be kept this moment, wipes another storage block.
4) if carry out cutting off the power supply in the process in step 403, after then flash media re-powers, whether the free piece of reply in the flash media check, check to also have the data of partly not wiping fully in some empty piece, if having then this sky piece is wiped once more.
5) if step 403 is cut off the power supply after finishing, after then flash media re-powers, the controller of flash memory device will regenerate the table of comparisons, need not carry out the recovery operation of data.
Below be after flash memory device causes operation disruption because of power-off illegally, the concrete Data Recovery Process when powering up once more:
After described flash memory device powers on once more, or before carrying out data manipulation once more, controller reads the redundant area information of all storage blocks in the storage space of described flash memory device, sets up the table of comparisons according to the information of reading; Setting up the operation of the table of comparisons can adopt prior art to carry out.All storage blocks are being carried out read operation, setting up in the process of the table of comparisons,, then interrupting setting up the step of the table of comparisons, forwarding to these two storage blocks are carried out data restore operation if find have two storage blocks 10 to have identical logical address in the storage space with 20.
In identical two storage blocks 10 and 20 of logical address, have one and contain incomplete data message.Whether the information of all pages mark of one of them storage block that this moment check is found (for example 10) meets predefined markup information.
As long as certain one page markup information and predefine markup information are not inconsistent and just illustrate in the data manipulation of this storage block before interruption and used, this blocks of data is imperfect, it is wiped, otherwise the markup information of another storage block 20 all pages is checked in employing with quadrat method.
If check by all pages markup information to another storage block 20, if all markup informations do not conform to predefined markup information, illustrate that data are imperfect in this storage block, storage block 20 is wiped.
If the markup information of second interior all page of storage block is also correct, illustrate that the data in two storage blocks all are complete.But whether two data possibility differences that storage block internal data store district preserves need come check data correct to two storage blocks by check code respectively.At this moment, according to the data computation proof test value of every page of storage in the storage block 20, and with the check code of this page redundant area stored relatively; Be not inconsistent if find certain page of check code, illustrate that this storage block assay is incorrect, then erase block memory 20.
If the assay of all pages is all correct in the storage block 20, then storage block 10 is carried out identical check code inspection; As find in the storage block 10 there to be check codes and be not inconsistent then erase block memory 10; Otherwise illustrate that the data in two storage blocks all are correct, can wipe wherein any, erase block memory 20 herein.
By this way, got rid of storage block error in data that the storage block data manipulation is interrupted causing, lost or the repetition situation, judge that then the table of comparisons was set up and whether finished this moment; If do not finish, then set up the step of the table of comparisons again, up to the storage block of finding that no longer logical address is identical, till the table of comparisons was set up and finished, Data Recovery Process finished.
For those empty pieces of not wiping fully, also need clear up separately, empty piece scale removal process is as follows:
All are the storage block of logical one at first to find out the homepage redundant area, and if erase operation entirely be not logical one, then to this storage block carried out entirely for logical one in all positions that reexamine these all pages of storage block whether.
For aforementioned second embodiment, the opportunity that outage takes place is different with first embodiment with issuable consequence, but data protection measure and data recovery measure principle are similar.As follows below with reference to Fig. 7 labor:
1 ') duplicate from former 10 and copy to before the new piece 20 (step 701 carry out before) if outage occurs in the data that will keep, or after former 10 is wiped free of (step 703 finish after), because data read-write operation does not begin as yet or finishes, and need not carry out data restore operation.
2 '), newly have only part page or leaf the move into data and the markup information of having annotated from the above description as can be known in the piece 20 if when step 702 is carried out, cut off the power supply in step 701 beginning back.After powering on once more, search the table of comparisons and will find two storage blocks with same logical address.To any storage block, check the markup information of its all pages, if be not that all pages markup information is all consistent, illustrate that the data in this storage block have mistakes and omissions, with this memory block erasing, keep another storage block; If all pages markup information unanimity then keep this storage block is wiped another storage block.
3 ') if after step 702 is finished, step 703 is cut off the power supply before carrying out, and has preserved valid data for this stylish 20, and all pages markup information of all having annotated.And the data in former 10 do not begin to wipe as yet, and separately all of two storage blocks page markup informations are all consistent, but two data differences that storage block internal data store district preserves.After flash media re-powers, search the table of comparisons and will find two storage blocks with same logical address.According to aforementioned analysis, the data in these two storage blocks all are complete, and the markup information of all pages also must be consistent separately.Can select a correct storage block of data to be kept this moment, wipes another storage block.Selection course is illustrated below.
4 '), may have the part page or leaf for former 10 at this moment and be wiped free of if carry out cutting off the power supply in the process in step 703; After flash media re-powered, the free piece of reply in the flash media checked, checks the data that still surplus part is not wiped fully in the piece of whether having time, if having then this sky piece is wiped once more.
In the above-mentioned data recovery measure, may select correct being kept of data in the complete storage block of two data, this selection can adopt check code to carry out.Utilize check code to be to the method for inspection of data: write to storage block or the temporal data process in, when every pair of one page carries out data manipulation, controller check code according to the known algorithm of prior art to the data computation that will write, and it is kept in this page redundant area.When using check code that data are tested, data according to data storage area preservation in the page or leaf, adopt identical algorithm computation to go out proof test value, the check code of the preservation in this value and this page redundant area is compared, if both are inequality, illustrate that the data that the data storage area is preserved in this page are different with the data that will write, the data in this page are wrong.Concrete recovery and empty piece clean-up process and last embodiment are similar.
More than be that the present invention is exemplarily illustrated, one of ordinary skill in the art will appreciate that, can improve data manipulation method of the present invention.For example, the storage block in a plurality of storage blocks in the flash media or certain scope is formed a zone, then can utilize inventive concept that one group of data manipulation instruction in this zone is unified to handle.If regulation is all carried out with sequence of addresses in the order of page or leaf or the piece the operation of storage block, the data that then can simplify new data and will keep are formed the process of valid data, simplification also can make the idiographic flow arrangement more flexible to the page or leaf filling markup information of storage block and to the checking process of markup information.
In addition, selection, setting and the concrete operations flow process to scratch pad block is not unique among the present invention; Concrete grammars such as the record of markup information setting in form that relates among the present invention and sign setting, timing/counting, the page or leaf, storage block bias internal amount or page number and data check are not unique.These information can be stored in controller, flash memory space or other place of flash memory device.In addition, the approach of search storage block, the screening of storage block also can be adopted various known technology.
Marrow of the present invention is when storage block is carried out data manipulation, will handle the instruction unification that one or more storage blocks are carried out data manipulation, and the data set that a plurality of data manipulation instructions are related to weaves unified migration operation of carrying out data again.Thereby solved the prior art defective well, realized purpose of the present invention.
The various remodeling to technical solution of the present invention that do not depart from inventive concept will fall into claim of the present invention institute restricted portion.

Claims (9)

1. the data manipulation method in the flash media is characterized in that, described method comprises step:
1) according at the assigned address in the former current write command, determines the new piece relevant with this write command;
2) carry out the write command operation to described new;
3) new piece is carried out and the new relevant follow-up write command of piece; With
4) replace former with new piece;
It is characterized in that, when carrying out the write command operation, at least to one page filling markup information wherein to described new;
After flash media powers on, to any storage block, check its markup information, if markup information and predetermined information are not inconsistent,, keep another storage block with this memory block erasing; Keep this storage block if markup information meets predetermined information, wipe another storage block;
Search the table of comparisons, if find two storage blocks with same logical address, and the markup information of each all page of piece is consistent, then selects a correct storage block of data to be kept, and wipes another storage block;
Check in the free piece of institute of flash media whether also have the data of partly not wiping fully, if having then this sky piece wiped once more,
And, in described step 2) in, the volatile storage that utilizes described flash memory device is as working storage, get one of them storage block and set up corresponding relation with new piece, this scratch pad block is carried out write command, data are write scratch pad block, copy in the corresponding page or leaf of new piece by scratch pad block again;
And above-mentioned scratch pad block copies data to the operation of the corresponding page or leaf of new piece and can seek unity of action after scratch pad block accumulative total is carried out a plurality of write commands.
2. method according to claim 1 is characterized in that, described step 1) comprises:
Judge whether to exist the new piece corresponding with the assigned address of described write command;
As there not being new piece, or existing new piece exists, but uncorrelated with this write data instruction, then sets up a new piece; Perhaps
If existed and the relevant new piece of current write data instruction, determine that then this new is the piece that current write data instruction will write.
3. method according to claim 2 is characterized in that, the process of the new piece of described foundation comprises:
To the empty piece mark logical address corresponding, piece number or other correspondence markings with the assigned address of described current write command, with described former set up corresponding relation; Described empty piece is found out in storage space after receiving write command or before receiving write command;
Or after carrying out erase operation to former, with this former of being wiped free of as empty piece;
Or when storage medium was formatd, the piece of reserving some constituted described empty piece as unavailable.
4. method according to claim 1 is characterized in that in the described step 3), judges whether relevant method comprises for follow-up write command and new piece:
Judge the whether executed write command operation of new piece last page, if new piece last page oneself carry out write operation, then follow-up write command has nothing to do execution in step 4 with described new);
Whether the logical address of the assigned address of perhaps judging follow-up write command and new piece, piece number or other correspondence markings are identical or corresponding;
For the follow-up write command relevant, adopt the step identical to carry out with present instruction with new piece.
5. method according to claim 1 is characterized in that, further comprises the process that the irrelevant new piece of described and current write command or scratch pad block are cleared up, and this process comprises:
In all existing new or scratch pad block, filter out new piece or the scratch pad block that to clear up; With
Described new piece or the scratch pad block that filters out cleared up;
Described cleaning operation is realized by the data moving process.
6. method according to claim 5 is characterized in that, described screening is carried out in the following way:
Timing mode: relatively all new or scratch pad block wait the duration of relevant write data instruction, and new piece or the scratch pad block that waits at most screened; Or
Priority mode:, filter out priority minimum or the highest new piece or scratch pad block according to waiting for duration, the priority of dependent instruction, the priority of associated documents; Or
Physical address mode:, the new piece or the scratch pad block of minimum use farthest screened according to described new or scratch pad block physical address at flash media; Or
The instruction count mode: according to the number of instructions that described new or scratch pad block are carried out, the new piece or the scratch pad block that the execution command number are met preassigned screen;
In aforesaid way, screened described new or scratch pad block quantity are one or more.
7. method according to claim 1 is characterized in that, former of new piece replacement can realize by the data moving process in the described step 4); The data that will keep in described former can directly be moved in the new piece, also can move in the scratch pad block, form valid data jointly with the new data in the described scratch pad block, copy in the corresponding page or leaf of new piece by scratch pad block again, or by in disposable corresponding page of being written to simultaneously with the new piece of described scratch pad block mirror image of scratch pad block.
8. according to each described method of claim 1 to 7, it is characterized in that, further comprise:
Receive last write operation instruction timing from new piece of described appointment or scratch pad block;
Judge whether timing arrives scheduled duration;
If timing does not arrive scheduled duration, then continue timing, otherwise judged whether described new or scratch pad block;
If have described new or scratch pad block,, otherwise continue timing then to existing new or scratch pad block is screened and cleaning operation; With
When described flash memory device quits work, stop timing.
9. method according to claim 1, it is characterized in that, when having the complete storage block of two data, adopt check code that two complete storage blocks of data are tested, select correct being kept of one of them data, the described check code that utilizes comprises the method for data check:
Write to storage block or the temporal data process in, when every pair of one page carries out data manipulation, the data computation that write check code, it is kept in this page redundant area;
Data according to data storage area in the page or leaf is preserved adopt identical algorithm computation to go out proof test value, and the check code of preserving in this value and this page redundant area is compared; With
If both are inequality, illustrate that the data that the data storage area is preserved in this page are different with the data that will write, the data in this page are incorrect, and the storage block data under it are incorrect.
CNB2003101177161A 2003-12-31 2003-12-31 Data manipulation method in the flash media Expired - Lifetime CN100538900C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2003101177161A CN100538900C (en) 2003-12-31 2003-12-31 Data manipulation method in the flash media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2003101177161A CN100538900C (en) 2003-12-31 2003-12-31 Data manipulation method in the flash media

Publications (2)

Publication Number Publication Date
CN1635579A CN1635579A (en) 2005-07-06
CN100538900C true CN100538900C (en) 2009-09-09

Family

ID=34843698

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2003101177161A Expired - Lifetime CN100538900C (en) 2003-12-31 2003-12-31 Data manipulation method in the flash media

Country Status (1)

Country Link
CN (1) CN100538900C (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8560760B2 (en) * 2007-01-31 2013-10-15 Microsoft Corporation Extending flash drive lifespan
CN102237130B (en) * 2010-04-20 2014-01-29 深圳市江波龙电子有限公司 Method and system for finding least significant bit pages in multi-layer cell flash memory
CN103268290B (en) * 2013-01-04 2016-02-17 深圳爱淘城网络科技股份有限公司 Based on the flash memory storage method of priority locking
CN103116552B (en) * 2013-03-18 2017-03-15 华为技术有限公司 Method and apparatus for distributing memory space in distributed memory system
CN103456360B (en) * 2013-09-13 2016-08-17 昆腾微电子股份有限公司 The management method of nonvolatile memory and device
CN106126469A (en) * 2016-08-17 2016-11-16 中国海洋石油总公司 A kind of Deepwater Risers integral type data acquisition unit and date storage method thereof
US10838621B2 (en) * 2018-08-14 2020-11-17 Silicon Motion, Inc. Method and flash memory controller capable of avoiding inefficient memory block swap or inefficient garbage collection

Also Published As

Publication number Publication date
CN1635579A (en) 2005-07-06

Similar Documents

Publication Publication Date Title
CN103577121B (en) A kind of highly reliable linear file access method based on Nand Flash
CN100557580C (en) The posted write-through cache that is used for flash memory
CN101346704B (en) Memory with block-erasable locations and a linked chain of pointers to locate blocks with pointer information
CN101165660B (en) Methods of reusing log blocks in non-volatile memories and related non-volatile memory devices
CN101346703B (en) Non-volatile memory with block erasable locations
US8060468B2 (en) Storage system and data recovery method
US7472139B2 (en) Database recovery method applying update journal and database log
CN100419714C (en) Flash memory file system
CN1331063C (en) On-line data backup method based on data volume snapshot
CN100498796C (en) Logic log generation method, database backup/ restoration method and system
CN101470641B (en) Method and system for managing damage of memory medium
CN102541757B (en) Write cache method, cache synchronization method and device
CN103577574A (en) High-reliability linear file system based on nand flash
CN101673245A (en) Information processing device including memory management device and memory management method
CN107943414A (en) The file partition of built-in Linux and data read-write method
CN101346702A (en) Memory with block-erasable locations
KR20080037283A (en) System comprising flash memory device and data recovery method thereof
JPH05108534A (en) System constituting and setting method for data processing system, data processing system and expanding device for data processing system
CN103544110A (en) Block-level continuous data protection method based on solid-state disc
CN109669889B (en) Light Nor Flash control method and device
CN107818269A (en) A kind of file saving method and system based on Flash
CN101699476A (en) Data processing method and device of smart cards
CN100590737C (en) Method for managing data in flash storage medium
CN100538900C (en) Data manipulation method in the flash media
JPH03224045A (en) Data holding system

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
CX01 Expiry of patent term

Granted publication date: 20090909

CX01 Expiry of patent term