CN103970483A - Method and system for writing physical blocks - Google Patents

Method and system for writing physical blocks Download PDF

Info

Publication number
CN103970483A
CN103970483A CN201310037365.7A CN201310037365A CN103970483A CN 103970483 A CN103970483 A CN 103970483A CN 201310037365 A CN201310037365 A CN 201310037365A CN 103970483 A CN103970483 A CN 103970483A
Authority
CN
China
Prior art keywords
data
block
write
buffer stopper
writing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201310037365.7A
Other languages
Chinese (zh)
Other versions
CN103970483B (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.)
Guangzhou Ankai Microelectronics Co.,Ltd.
Original Assignee
Anyka Guangzhou Microelectronics 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 Anyka Guangzhou Microelectronics Technology Co Ltd filed Critical Anyka Guangzhou Microelectronics Technology Co Ltd
Priority to CN201310037365.7A priority Critical patent/CN103970483B/en
Publication of CN103970483A publication Critical patent/CN103970483A/en
Application granted granted Critical
Publication of CN103970483B publication Critical patent/CN103970483B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The embodiment of the invention provides a method for writing physical blocks. The method comprises the following specific steps: establishing a mapping relation of logic blocks and the physic blocks; sequentially writing data in buffer blocks and marking write count for the buffer blocks in the data writing process according to a preset marking rule; searching valid data from each physical block; copying all valid data to new data blocks. The marking rule comprises the following specific steps: when data are written into a first data block, progressively increasing a first write count of an original data block and marking the progressively-increased first write count as a first write count of the first buffer block; when the data are written into the nth buffer block, retaining all write counts prior to the nth write count relative to the (n-1)th buffer block, progressively increasing the value of the nth write count of the (n-1)th buffer block and marking the progressively-increased value as the nth write count of the nth buffer block, wherein n is a position integer greater than 1.

Description

A kind of physical block wiring method and system
Technical field
The present invention relates to technical field of data storage, particularly a kind of physical block wiring method and system.
Background technology
NAND is a kind of flash memory scheme that current stage performance is outstanding, is characterized in low in energy consumption, lightweight, readwrite performance is good; Be widely used at present flash disk and storage card.NAND chip has comprised a plurality of physical blocks as storage medium, and each physical block comprises again a plurality of Physical Page.Because the erasable number of times of the physical block of NAND chip and Physical Page is all limited, the derivative balanced algorithm of writing becomes the prolongation NAND chip important technical in serviceable life therefrom.And write balanced algorithm, all the logical block based on virtual aspect in file system or sector and the physical block of NAND chip reality or the mapping relations of Physical Page are launched conventionally.
In the patent that is 201010229936.3 at application number, disclose a kind of NAND and write Balance Treatment method; General idea is as follows: corresponding two physical blocks of logical block in the method; In described physical block, one shines upon one by one with logical block, another and logical block Random Maps.The physical block shining upon one by one with logical block is called as data block, is called as buffer stopper with the physical block of logical block Random Maps; Data are being write fashionable being first written in buffer stopper, after having write, by certain mechanism, each page data of Random Maps in each page data and buffer stopper in old data block are written to a new data block according to the rules integration of mapping one by one.
Present stage write balanced algorithm in the process writing, the order being written into for distinguishing physical block or Physical Page, can write counting one of the same tense marker writing; After the physical block that is written into or Physical Page write fashionable, the writing counting and can compare and last time increased progressively Yi Ge unit's (adding 1) of mark.And it is generally acknowledged and only write the maximum physical block of counting or Physical Page (physical block being finally written into or Physical Page) is effective, all the other are all invalid.It is of overall importance in prior art, writing the mark of counting and increasing progressively, namely for Physical Page all in NAND or physical block.
The shortcoming of writing counting existence of overall importance is mainly to support that COPYBACK is hardware-accelerated.COPYBACK is hardware-accelerated is in fact hardware copy instruction in, can realize data copy fast.But in the middle of global write counting, all write operations all need progressive increase mark to write counting, represent that in the process of all write operations, change has all occurred data.The write operation process that data appearance changes is disagreed with copy procedure, so COPYBACK is hardware-accelerated and both existence of counting contradiction in essence of writing of overall importance, can not coexist.
Another shortcoming of writing counting of overall importance is in use procedure, to write counting constantly to add up to increase progressively, and can cause numerical value increasing, to such an extent as to make the operation of NAND take internal memories a large amount of in whole computer system and storage space.
Summary of the invention
In view of this, the object of the present invention is to provide a kind of physical block wiring method and system, described method and system are write counting by local level mark in ablation process, realized the hardware-accelerated support for COPYBACK, and it is increasing to have avoided writing counting, taken the problem of internal memory and storage space a large amount of in whole computer system.
For achieving the above object, the present invention has following technical scheme:
, there are mapping relations between logical block and a plurality of physical block in described method in a physical block wiring method, has the data block of shining upon one by one with logical block in described a plurality of physical blocks, and described data block comprises former data block and new data block; Buffer stopper with at least one and logical block Random Maps; The quantity of writing counting in each physical block equals the quantity of buffer stopper; Described method concrete steps are as follows:
Set up the mapping relations of logical block and physical block;
In turn to buffer stopper data writing, and according to default marking convention, be that buffer stopper mark is write counting in the process of data writing;
From each physical block, search valid data; Described valid data are copied to new data block;
Described marking convention is specially;
During to the first buffer stopper data writing, by first of former data block, write count increments and be labeled as first of the first buffer stopper and write counting;
During to n buffer stopper data writing, retain n write counting all countings of writing before with respect to n-1 buffer stopper, the numerical value of the n of n-1 buffer stopper being write to counting increases progressively, and the n that is n buffer stopper by the numeric indicia after described increasing progressively writes counting; N is greater than 1 positive integer.
Described physical block comprises a plurality of Physical Page, and described logical block comprises a plurality of sectors, and the quantity of the Physical Page that comprises of physical block equals the quantity of the sector that a logical block comprises, the described mapping relations of setting up logical block and physical block are specially:
Physical Page in physical block is corresponded on the sector in logical block.
Describedly from each physical block, search valid data and be specially:
Valid data using last data writing as this sector.
Describedly from each physical block, search valid data and also comprise:
When said write process is interrupted and is restarted, according to the counting of writing of default each physical block of comparison mechanism comparison, thereby find the data that finally write, and using it as valid data.
Described default comparison mechanism is specially:
By first of each physical block write counting compare, if first write counting identical; continue more afterwards in turn counting, until occur writing counting difference stop comparison; Depending on writing the data that write in the large physical block of counting as the data that finally write.
Described method also comprises:
When new data block consistent with the feature of former data block or buffer stopper, any one in the physical block that in retaining, feature is consistent is as tentative data piece, according to the counting of writing of mark in default comparison mechanism comparison buffer stopper and tentative data piece, find out the valid data in buffer stopper or tentative data blocks of data piece again; The feature of described physical block comprises the sector that each Physical Page is corresponding and writes counting;
By blank physical block data block as a supplement, according to the mode of mapping one by one, valid data are copied in supplementary data piece.
The quantity of described buffer stopper is two, and the quantity of writing counting is two, and described marking convention is specially:
When first of described old data block, write and be counted as a, during to the first buffer stopper data writing, first of mark the first buffer stopper is write and is counted as a+1, and second writes and be counted as b;
While changing data writing to the second buffering, first of mark the second buffer stopper is write and is counted as a+1, and second writes and be counted as b+1;
A, b are less than 4 nonnegative integer, when a+1 or b+1 are not less than 4, make a+1 or b+1 equal 0.
In described method, choose at random physical block and logical block is set up mapping relations and writes.
Described physical block comprises a plurality of Physical Page, described for buffer stopper mark, write to count be specially:
To write count tag in each Physical Page, in Same Physical piece, writing of different Physical Page counted difference, with writing of the 0th Physical Page in this physical block, is counted as and effectively writes counting.
, there are mapping relations between logical block and a plurality of physical block in described method in a physical block writing system, has the data block of shining upon one by one with logical block in described a plurality of physical blocks, and described data block comprises former data block and new data block; Buffer stopper with at least one and logical block Random Maps; The quantity of writing counting in each physical block equals the quantity of buffer stopper; Described system comprises:
Mapping block, for setting up the mapping relations of logical block and physical block;
Writing module, in turn to buffer stopper data writing;
Said write module comprises indexing unit, for the process at data writing, according to default marking convention, is that buffer stopper mark is write counting; Described marking convention is specially;
During to the first buffer stopper data writing, by first of former data block, write count increments and be labeled as first of the first buffer stopper and write counting;
During to n buffer stopper data writing, retain n write counting all countings of writing before with respect to n-1 buffer stopper, the numerical value of the n of n-1 buffer stopper being write to counting increases progressively, and the n that is n buffer stopper by the numeric indicia after described increasing progressively writes counting; N is greater than 1 positive integer;
Effective judge module, for searching valid data from each; ;
Copy module, for being copied to new data block by described valid data.
Known according to above technical scheme, the beneficial effect that the present invention exists is: the buffer stopper that in the present invention, Different Logic piece is corresponding is independently write the mark of counting separately, unrelated; And described level is write only mark and increase progressively and write counting when buffer stopper writes of count tag method, and in the process of integrating at valid data, any change no longer occurs valid data; So the method for the invention has realized the hardware-accelerated support for COPYBACK, can realize by the travelling speed of the hardware-accelerated raising of COPYBACK NAND; In addition, the count tag method of writing of level described in the present invention has reduced the speed of writing count increments, and when logical block is set up mapping relations with physical block again again mark write counting, avoided writing counting constantly accumulative total increase progressively, thereby saved whole computer system memory and storage space.
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 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 mapping relations schematic diagram one by one in prior art;
Fig. 2 is that in prior art, Random Maps is related to schematic diagram;
Fig. 3 is physical block integration process schematic diagram in prior art;
Fig. 4 is method flow diagram described in the embodiment of the present invention;
Fig. 5 is valid data integration process schematic diagram in the embodiment of the present invention;
Fig. 6 is method flow diagram described in another embodiment of the present invention;
Fig. 7 is valid data integration process schematic diagram in another embodiment of the present invention;
Fig. 8 is that in another embodiment of the present invention, valid data are integrated intermediateness schematic diagram;
Fig. 9-10 are fault-tolerant recovery technology schematic diagram described in another embodiment of the present invention;
Figure 11 is system architecture schematic diagram described in the embodiment of the present invention.
Embodiment
For making object, technical scheme and the advantage of the embodiment of the present invention clearer, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is 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.
The invention provides a kind of wiring method of physical block, be mainly used in the middle of NAND chip.In wiring method of the present invention, on existing wiring method, changed the labeling method of writing counting in ablation process.For the ease of the method for the invention is explained and illustrated, the wiring method of a kind of NAND chip of first concise and to the point description physical block herein:
In the ablation process that the method relates to, between logical block and a plurality of physical block, there are mapping relations; A logical block comprises a plurality of sectors, and a physical block comprises a plurality of Physical Page; Generally speaking a logical block comprises that number of sectors equals the quantity that a physical block comprises Physical Page.Described logical block and sector are the logically storage unit of virtual structure of file system; And described physical block and Physical Page are actual storage medium, the data of preserving in storage medium are reflected on virtual logical block or sector by mapping relations, and set up the mapping relations of logical block and physical block, namely the Physical Page in physical block is corresponded to the sector in logical block.
Described physical block is divided into data block and buffer stopper according to the difference of purposes in ablation process; The data that in data block, each Physical Page is preserved are the data that each sector of logical block presents, and in data block, in each Physical Page and logical block, each sector is shone upon one by one.In general in ablation process, the data block corresponding with logical block has two; One is former data block, the data data that namely each sector of this logical block presents originally in former data block; Another is new data block, the data block that the data that soon ablation process newly writes and even a part of legacy data obtain after reintegrating, and the data in new data block are exactly the data that each sector of this logical block has presented after having write.In addition, conventionally in the non-process writing, when data stabilization that logical block presents is constant, only there are mapping relations with a data block in logical block.
Described each Physical Page each sector in counterlogic piece in order of shining upon one by one namely in data block.Shown in Figure 1 is the schematic diagram shining upon one by one, supposes that a physical block comprises 4 Physical Page in Fig. 1, and a logical block comprises 4 sectors.Four square frames, 4 Physical Page in represents physical pieces respectively in Fig. 1 are respectively the 0th page, the 1st page, the 2nd page and the 3rd page according to order from left to right.Label in figure on each Physical Page represents the sector that this Physical Page is corresponding, is the 0th page of correspondence the 4th sector in Fig. 1, the 1st page of correspondence the 5th sector, and the rest may be inferred.As shown in Figure 1 each Physical Page in order the mapping of a corresponding sector be so-called mapping one by one.Mapping generally means that certain ablation process finishes one by one, also can think that mapping is a kind of mapping relations under logical block steady state (SS) one by one.
And buffer stopper needs to exist at least one in ablation process.From physical layer, the data that need to write in ablation process in logical block sector are all the buffer stoppers that write direct, and after a buffer stopper is fully written, can be again to other buffer stopper, write.The mapping relations of buffer stopper and logical block are Random Maps, and both not necessarily in order and the correspondence also likely repeating, specifically determine according to writing fashionable concrete condition the sector in the random counterlogic piece of each Physical Page in buffer stopper namely.
Shown in Figure 2 is the schematic diagram of Random Maps, and in Fig. 2, a physical block of same supposition comprises 4 Physical Page, and a logical block comprises 4 sectors.Four square frames, 4 Physical Page in represents physical pieces respectively in Fig. 2 are respectively the 0th page, the 1st page, the 2nd page and the 3rd page according to order from left to right.Label in figure on each Physical Page represents the sector that this Physical Page is corresponding; All corresponding the 7th sector of visible the 0th, 1,2 three Physical Page, and corresponding the 6th sector of the 3rd Physical Page.This is that data due to three Physical Page that first write need write the 7th sector, and the next page data need write the 6th sector, and the corresponding relation of Physical Page and sector is depending on writing situation.The existence of buffer stopper represents that ablation process carries out, so Random Maps can be thought unstabilized a kind of mapping relations between logical block and physical block.
Shown in Figure 3 is the schematic diagram of physical block integration process, namely using the concrete steps of the Data Integration in buffer stopper shown in former data block and Fig. 2 of data block shown in Fig. 1.Completed data after the writing of buffer stopper, also needed to integrate the data in former data block and buffer stopper to a blank physical block, this blank physical block also just will be as new data block.In conjunction with the data block shown in Fig. 3 and buffer stopper, Physical Page corresponding to sector may more than one, so in Physical Page corresponding to this sector, the data of getting in the Physical Page finally writing are valid data.4 valid data corresponding to sector are incorporated in a new data block according to the mode of mapping one by one, thereby replace former data block.
Be more than a kind of physical block wiring method relevant to the method for the invention.Physical block wiring method of the present invention on this basis, has increased the local method of writing counting.It is below a specific embodiment of the method for the invention, shown in Figure 4, described in the present embodiment in method, between logical block and a plurality of physical block, there are mapping relations, in described a plurality of physical block, have the data block of shining upon one by one with logical block, described data block comprises former data block and new data block; Buffer stopper with at least one and logical block Random Maps; In the present embodiment, for all buffer stoppers corresponding to same logical block, according to default rule, write counting for its mark; The quantity of writing counting in each buffer stopper equals the total quantity of the corresponding buffer stopper of logical block; Described method concrete steps are as follows:
Step 401, set up the mapping relations of logical block and physical block;
This step is the initialization step writing;
Step 402, in turn to buffer stopper data writing, and according to default marking convention, be that buffer stopper mark is write counting in the process of data writing;
Described in this step for buffer stopper write with aforementioned prior art in physical block wiring method basically identical.The data that need write in logical block sector are all the buffer stoppers that write direct, and after a buffer stopper is fully written, can be again to other buffer stopper, write.In the present embodiment, when a buffer stopper is carried out to write operation, according to default marking convention, be also that buffer stopper mark is write counting.
The mark of writing counting in the present embodiment is different from the counting of writing of overall importance of the prior art, but only for buffer stopper corresponding to same logical block, carries out mark.The buffer stopper that Different Logic piece is corresponding is independently write the mark of counting separately, unrelated.That is to say, the mark of writing counting in the present embodiment be take logical block and is carried out as unit part.
In the present embodiment, as follows for the rule of writing count tag:
During to the first buffer stopper data writing, by first of former data block, write count increments and be labeled as first of the first buffer stopper and write counting;
During to n buffer stopper data writing, retain n write counting all countings of writing before with respect to n-1 buffer stopper, the numerical value of the n of n-1 buffer stopper being write to counting increases progressively, and the n that is n buffer stopper by the numeric indicia after described increasing progressively writes counting; N is greater than 1 positive integer.
Concrete, corresponding three buffer stoppers of a certain logical block of take in the present embodiment are example, concrete describes for the described labeling process of writing counting.
Described three buffer stoppers are respectively the first buffer stopper, the second buffer stopper and the 3rd buffer stopper according to the order writing; Because the quantity of buffer stopper is three, so write the quantity of counting, it is also three; Writing counting for three is respectively first and writes counting, second and write and count and the 3rd write counting according to putting in order.
First of the first buffer stopper is write counting and is write count increments with respect to first of former data block, supposes that first of former data block is write to be counted as 0 in the present embodiment, and the numerical value after increasing progressively is 0+1=1.So in the first buffer stopper data writing, numerical value 1 after first of mark the first buffer stopper is write and is counted as this and increases progressively, second of the first buffer stopper is write counting and the 3rd and is write counting and do not affect herein overall technical architecture, can or give tacit consent to numerical value for random number, be 0 in the present embodiment.That is to say that writing of the first buffer stopper is counted as 100.
In the time of to the second buffer stopper data writing, with respect to the first buffer stopper, do not increase progressively first and write counting, only increase progressively the counting of writing of next level, namely second write counting; Being about to second of the first buffer stopper, to write count increments be 0+1=1, so first the writing and be counted as 1 of mark the second buffer stopper; Second of mark the second buffer stopper is write and is counted as 1; The 3rd of the second buffer stopper is write counting does not affect overall technical architecture herein, can be random number or default value, is 0 in the present embodiment.Namely writing of the second buffer stopper is counted as 110.
When to the 3rd buffer stopper data writing, the 3rd buffer stopper no longer increases progressively first with respect to the second buffer stopper and writes counting and second write counting, but the counting of writing increasing progressively is down to lower one deck again, namely the 3rd buffer stopper only increases progressively the 3rd with respect to the second buffer stopper and writes counting, and first writes counting and second, and to write counting identical with the second buffer stopper.First of the 3rd buffer stopper write and be counted as 1, the second and write and be counted as 1, the three and write and be counted as 0+1=1, the 3rd buffer stopper write counting 111.
On the present embodiment, extend and can think, if there is the 4th buffer stopper, the 4th buffer stopper only increases progressively the 4th with respect to the 3rd buffer stopper and writes counting, first write counting, second write counting and the 3rd write count all identical with the 3rd buffer stopper.Above thinking is described in the present embodiment level in method and increases progressively the basic thought of writing counting.
Step 403, from each physical block, search valid data;
With respect to the technical method of level, the comparative approach in described comparison mechanism is similarly that level carries out.Specifically can be described as, by first write counting compare, if first write counting identical; continue more afterwards in turn counting, until occur writing counting difference stop comparison; Using and write the data that write in the large physical block of counting as valid data.
Step 404, described valid data are copied to new data block.
Integrating step 403 and step 404, and with reference to shown in Fig. 5, the following specifically describes and write the comparison of counting and the detailed process of valid data copy.
In Fig. 5, suppose that a physical block comprises 4 Physical Page, a logical block comprises four sectors.In Fig. 5, a rectangle of four square frame compositions represents a physical block, Physical Page in each square frame difference represents physical piece.On each Physical Page, have two labels, top label represents the sector that this Physical Page is corresponding, and counting is write in label representative in below.
For example, the label 4 of the 0th Physical Page top of former data block represents corresponding the 4th sector of this Physical Page, and the label 001 of below represents that writing of this Physical Page is counted as 001.It should be noted that, in former data block, writing of 4 Physical Page counted difference, is that the valid data of 4 Physical Page may come from different physical blocks because writing to former data block in the process of integration.In this case, think that writing of data block the 0th Physical Page is counted as effectively, think in this case in other words the counting of writing that counting is the 0th Physical Page of writing of each Physical Page of data block, 001.
After having write of buffer stopper, for each sector, find out in former data block or buffer stopper valid data that should sector, then valid data are copied to a Physical Page in new data block according to the mode of mapping one by one.
If whole data write and integration process is normally to carry out, during without any interruption, Physical Page that can automatic storing finally writes for each sector when writing, and valid data are wherein integrated.But if the process that writes and integrate occur to interrupt recovering again, searching valid data need to be according to the counting of writing of default each physical block of comparison mechanism comparison, thereby finds the data that finally write, and using it as valid data; The described default counting comparison mechanism of writing is specially, and writes counting compare first of each physical block, if first to write counting identical, continues more afterwards in turn counting, until there is writing counting difference, stops comparison; Depending on writing the data that write in the large physical block of counting as the data that finally write.In same buffer stopper all Physical Page to write counting identical, but the order writing puts in order and carries out according to Physical Page.For Fig. 5, namely in same buffer stopper, 4 Physical Page write from left to right successively.
In the present embodiment, owing to writing the mark mode of counting, be that level is carried out, so corresponding, the manner of comparison of writing counting is also that level is carried out.Physical block to be integrated is for comprising a data block and three buffer stoppers herein, and totally 4 physical blocks are 16 Physical Page; Related sector i.e. four sectors of this logical block, specifically comprise the 4th sector, the 5th sector, the 6th sector and the 7th sector.
If the mode according to mapping is one by one incorporated into new data block by the valid data of four sectors, must integrate since the 4th sector, the valid data of the 4th sector are write to the 0th Physical Page of new data block.In 4 physical blocks to be integrated, totally two of the Physical Page of corresponding the 4th sector, i.e. the 0th Physical Page of former data block and the 0th Physical Page of the first buffer stopper.Compare the counting of writing of two Physical Page below.The 0th the writing of Physical Page that the writing of the 0th Physical Page of data block is counted as 001, the first buffer stopper is counted as 100; First relatively write first of counting and write and count to get 0 < 1 for two, so think that the 0th Physical Page of the first buffer stopper is the Physical Page of rear data writing, in this Physical Page, data are the valid data of the 4th sector, the data in the 0th Physical Page of the first buffer stopper are write to the 0th Physical Page of new data block.
The Physical Page of corresponding the 5th sector is also two, and the data that in like manner find the second buffer stopper the 0th Physical Page after are relatively the valid data of the 5th sector, the valid data of the 5th sector are write to the first Physical Page of new data block.
Totally five of the Physical Page of corresponding the 6th sector, thus must more all five Physical Page of integral body write counting.Equally, first relatively first write counting (according to aforementioned known, thinking that former data block the 2nd writing of Physical Page is counted as 001 herein), comparative result is 0 < 1, and reservation first is write and is counted as four Physical Page of 1 and carries out next stage comparison; Namely relatively four first write and be counted as second of 1 Physical Page and write counting, obtain 0 < 1; Retain second and write and be counted as three Physical Page of 1 and carry out again the comparison of next stage, namely relatively three second write and be counted as the 3rd of 1 Physical Page and write counting, obtain 0 < 1; So think that the 2nd Physical Page of the 3rd buffer stopper is that middle data are the valid data of the 6th sector, these valid data write to the 2nd Physical Page of new data block.
Totally 7 of the Physical Page of corresponding the 7th sector, manner of comparison and the 6th sector of writing counting are similar, successively relatively first write counting, second write count and the 3rd write counting after, obtain the Physical Page of three correspondence the 7th sectors in the 3rd buffer stopper, write count identical.The Physical Page that goes in this case last corresponding the 7th sector in the 3rd buffer stopper, in the 3rd Physical Page of the 3rd buffer stopper, data are valid data; These valid data are written to the 3rd Physical Page of new data block.
In the present embodiment, write the part that is labeled as of counting and write count tag, namely only at mark in buffer stopper data writing, write counting with increasing progressively; In the above-mentioned process that valid data is write to new data block, owing to writing counting, do not change.This also means, the count tag mode of writing described in the present embodiment does not have the counting of writing of overall importance in prior art and writes arbitrarily and all increase progressively the feature of writing counting.When valid data are write to new data block, there is not any change in valid data, and in this point, the present embodiment is no longer hardware-accelerated to running counter to COPYBACK.So valid data are write to the process of new data block, can pass through the hardware-accelerated direct copying of COPYBACK.
Four Physical Page of the new data block obtaining thus, are according to four sectors of the mode counterlogic piece shining upon one by one.Generally, be to save internal memory and storage space, the original data block of immediate cancel and all buffer stopper and the mapping relations of this logical block after new data block has write.
Visible by above technical scheme, the beneficial effect that the present embodiment exists is: the buffer stopper that in the present embodiment, Different Logic piece is corresponding is independently write the mark of counting separately, unrelated; And described level is write only mark and increase progressively and write counting when buffer stopper writes of count tag method, and in the process of integrating at valid data, any change no longer occurs valid data; So method has realized the hardware-accelerated support for COPYBACK described in the present embodiment, can realize by the travelling speed of the hardware-accelerated raising of COPYBACK NAND; In addition, the count tag method of writing of level described in the present embodiment has reduced the speed of writing count increments, and when logical block is set up mapping relations with physical block again again mark write counting, avoided writing counting constantly accumulative total increase progressively cause to write count value increasing, thereby saved whole computer system memory and storage space.
Shown in Fig. 6, it is another specific embodiment of the method for the invention.In the present embodiment, on basis embodiment illustrated in fig. 4, the concrete quantity that defines buffer stopper is two.When needs, logical block being write fashionable, must there are mapping relations with at least one buffer stopper in logical block; Above-mentioned logical block and buffer stopper exist the state of mapping relations to be called the buffer status of logical block.In fact, in research process, find, when the quantity of buffer stopper is brought up to two from one, the performance of NAND chip has larger lifting; If but continuation increases the quantity of buffer stopper, the performance boost amplitude of NAND chip is very low, but the more committed memories of buffer stopper quantity are more; So from the angle of performance, it is optimum scheme that buffer stopper quantity is set as two.
So the quantity that defines buffer stopper concrete in the present embodiment is two, the concrete steps of method described in the present embodiment are as follows:
Step 601, set up the mapping relations of logical block and physical block;
Step 602, when first of described old data block, write and be counted as a, during to the first buffer stopper data writing, first of mark the first buffer stopper is write and is counted as a+1, and second writes and be counted as b;
In step 603, the first buffer stopper data write full after, to the second buffer stopper data writing, when changing data writing to the second buffering, first of mark the second buffer stopper is write and is counted as a+1, second writes and is counted as b+1;
In step 602 and step 603, a, b are less than 4 nonnegative integer, when a+1 or b+1 are not less than 4, make a+1 or b+1 equal 0.
In above-mentioned two steps, described embodiment illustrated in fig. 4 in, described level mark is write method of counting, the concrete condition when buffer stopper quantity equals 2.And created symbol subtraction of integer principle in the present embodiment, makes writing counting and only may occurring 0,1,2,3 four numeral increasing progressively successively of mark.When writing counting while continuing to increase progressively again by 3, there will be the situation that counting overflows of writing.So set in this case the numeral of overflowing, make zero, namely make 0 > 3.
The equivalent expression of above-mentioned symbol subtraction of integer principle can be concrete be expressed as:
INTr=A.nWrCnt-B.nWrCnt;
return r>1||r<-1?-r:r;
Above-mentioned symbol subtraction of integer principle and expression formula thereof all belong to prior art, and therefore not to repeat here.
Step 604, when said write process is interrupted and is restarted, according to default comparison mechanism relatively in each physical block piece mark write counting, find out the valid data in each physical block;
Step 605, described valid data are copied to new data block.
The mapping relations of step 606, cancellation buffer stopper and former data block and logical block.
After completing the copy of valid data, cancel the mapping relations of buffer stopper and former data block and logical block, can save internal memory and the storage space of computer system, be convenient to the re-using of physical block.
Shown in Figure 7, for writing the comparison of counting and the detailed process of valid data copy in the present embodiment.Shown in the present embodiment Fig. 7, in process, write the principle of obtaining with copying of counting comparison and valid data with embodiment illustrated in fig. 4 consistent, do not do the narration of repetition herein.
When ablation process interrupts and restart, having certain probability to occur that new data block is consistent with former data block characteristics in addition,, even also may there is new data block situation about cannot differentiating consistent with buffer stopper feature in situation about cannot differentiate; In the present embodiment, in described method, the special circumstances for above-mentioned, are solved by following steps:
Step 607, when new data block consistent with the feature of former data block or buffer stopper, any one in the physical block that in retaining, feature is consistent is as tentative data piece, according to the counting of writing of mark in default comparison mechanism comparison buffer stopper and tentative data piece, find out the valid data in buffer stopper or tentative data blocks of data piece again;
The feature of described physical block comprises the sector that each Physical Page is corresponding and writes counting.
Step 608, by blank physical block data block as a supplement, according to the mode of mapping one by one, valid data are copied in supplementary data piece.
Because traditional counting of writing of overall importance can be found easily by relatively writing counting the physical block of last data writing in whole NAND chip, and in all ablation process, write counting and all can increase progressively, also just there will not be two physical blocks to write the identical situation of counting.So interrupting appears in process when to new data block integral data in prior art, also can simply by relatively writing counting, find new data block, and proceed to integrate.For of overall importance, write, the interruption of ablation process does not affect the work of NAND.And in the present embodiment in described physical block wiring method owing to having adopted the local counting mode of writing, writing of the physical block that Different Logic piece is corresponding counted mutually independently, there is no association, so do not possess of overall importance writing in counting, can not determine easily the feature of the physical block of last data writing.And to writing counting in the process of new data block integral data, do not increase progressively again, new data block also can to write counting consistent with some other physical blocks with regard to having like this, if the sector that the two each Physical Page is corresponding is also by chance consistent, which is new data block actually cannot to differentiate the two.For the problems referred to above that may occur, in the present embodiment in steps 607 and step 608 as a solution.
Shown in Figure 8, the schematic diagram of intermediateness while writing interruption for data.When integrating in effective data procedures to new data block 804, while being written to the second Physical Page of new data block 804, interrupt, now the intermediateness of each physical block is as shown in Figure 8.
Owing to adopting part in the present embodiment, write counting, and as seen hereinto between under state, Fig. 8 Central Plains data block 801 and new data block 804 features are in full accord, and (shown in Fig. 8, in former data block 801, the 3rd Physical Page is blank, data writing not), so cannot tell from two data blocks of shining upon one by one after ablation process is recovered, which is written into the new data block 804 of data before being actually, and which is original data block 801.
For this situation, delete any one in two data blocks, retain another as tentative data piece, then according to default comparison mechanism again relatively in buffer stopper and tentative data piece mark write counting, find out the valid data in buffer stopper or data block; After namely deleting any one data block, tentative data piece is substituted to former data block 801 and re-start searching and integrating of valid data in step 604-step 606, namely in tentative data piece and buffer stopper, find out in the same way valid data.And then choose blank physical block data block as a supplement, according to the mode of mapping one by one, valid data are copied in supplementary data piece.Aforesaid way is called as fault-tolerant recovery technology.The new data block obtaining is in the manner described above consistent with the new data block obtaining by normal integration process; No matter deleted data block was as new data block or former data block before integrating interruption, for result, did not all exert an influence, and concrete principle is as follows:
If delete former data block 801, retain new data block 804 as tentative data piece, as shown in Figure 9; According to the comparison mechanism of writing counting, the data that write in new data block 804 must be covered the data of script in former data block 801; So the supplementary data piece 905 after reintegrating is consistent with the new data block 704 that normal integration obtains.
If delete new data block 804, retain former data block 801 as tentative data piece, as shown in figure 10, be equal to the state writing before interrupting completely; Subsequent step is equivalent to again the valid data in former data 801 and two buffer stoppers be write the conventional process of new data block 804; Reintegrate the supplementary data piece 1005 obtaining consistent with the new data block 704 that normal integration obtains.
In addition, buffer stopper and logical block are Random Maps, so the sector that each Physical Page is corresponding is generally random, the probability of obscuring with new data block is very low, but buffering change each Physical Page in order each sector of counterlogic piece be also a kind of result of Random Maps, not can not occur, so the possibility that also exists buffer stopper and new data block to obscure in theory.Can utilize equally in this case fault-tolerant recovery technology to be solved, delete any one in two physical blocks of obscuring, retain another as tentative data piece, principle is identical.
Described in the present embodiment in method, when choosing physical block and logical block and setting up mapping relations, adopt and choose physical block at random and logical block is set up mapping relations, and start the follow-up method writing.Be achieved according to the method described above the balance of writing that reaches all physical blocks from probability, make in NAND chip the erasable number of times of all physical blocks substantially equal, extended the serviceable life of NAND chip.
The beneficial effect that the present embodiment exists is: on basis embodiment illustrated in fig. 4, set most preferred buffer stopper quantity; And have no progeny and cannot find the problem of the data block being finally written in utilizing described fault-tolerant recovery technology to solve to write; In addition, by random, choose physical block and logical block is set up mapping relations, make the physical block on NAND chip reach and write balance from probability, extended the serviceable life of NAND chip.
Shown in Figure 11, be a specific embodiment of physical block writing system of the present invention.System described in the present embodiment is the system that shown in corresponding diagram 4, embodiment of the method is set up, so concrete, system is as follows described in the present embodiment:
In described system, between logical block and a plurality of physical block, have mapping relations, have the data block of shining upon one by one with logical block in described a plurality of physical blocks, described data block comprises former data block and new data block; Buffer stopper with at least one and logical block Random Maps; The quantity of writing counting in each physical block equals the quantity of buffer stopper; Described system comprises:
Mapping block, for setting up the mapping relations of logical block and physical block;
Writing module, in turn to buffer stopper data writing;
Said write module comprises indexing unit, for the process at data writing, according to default marking convention, is that buffer stopper mark is write counting; Described marking convention is specially;
During to the first buffer stopper data writing, by first of former data block, write count increments and be labeled as first of the first buffer stopper and write counting;
During to n buffer stopper data writing, retain n write counting all countings of writing before with respect to n-1 buffer stopper, the numerical value of the n of n-1 buffer stopper being write to counting increases progressively, and the n that is n buffer stopper by the numeric indicia after described increasing progressively writes counting; N is greater than 1 positive integer;
Effective judge module, for searching valid data from each; ;
Copy module, for being copied to new data block by described valid data.
The beneficial effect that described in the present embodiment, system exists is: the buffer stopper that in the present embodiment, Different Logic piece is corresponding is independently write the mark of counting separately, unrelated; And described level is write only mark and increase progressively and write counting when buffer stopper writes of count tag method, and in the process of integrating at valid data, any change no longer occurs valid data; So system has realized the hardware-accelerated support for COPYBACK described in the present embodiment, can realize by the travelling speed of the hardware-accelerated raising of COPYBACK NAND; In addition, the count tag method of writing of level described in the present embodiment has reduced the speed of writing count increments, and when logical block is set up mapping relations with physical block again again mark write counting, avoided writing counting constantly accumulative total increase progressively cause to write count value increasing, thereby saved whole computer system memory and storage space.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (10)

1. a physical block wiring method, is characterized in that, in described method, between logical block and a plurality of physical block, has mapping relations, has the data block of shining upon one by one with logical block in described a plurality of physical blocks, and described data block comprises former data block and new data block; Buffer stopper with at least one and logical block Random Maps; The quantity of writing counting in each physical block equals the quantity of buffer stopper; Described method concrete steps are as follows:
Set up the mapping relations of logical block and physical block;
In turn to buffer stopper data writing, and according to default marking convention, be that buffer stopper mark is write counting in the process of data writing;
From each physical block, search valid data; Described valid data are copied to new data block;
Described marking convention is specially;
During to the first buffer stopper data writing, by first of former data block, write count increments and be labeled as first of the first buffer stopper and write counting;
During to n buffer stopper data writing, retain n write counting all countings of writing before with respect to n-1 buffer stopper, the numerical value of the n of n-1 buffer stopper being write to counting increases progressively, and the n that is n buffer stopper by the numeric indicia after described increasing progressively writes counting; N is greater than 1 positive integer.
2. method according to claim 1, it is characterized in that, described physical block comprises a plurality of Physical Page, described logical block comprises a plurality of sectors, and the quantity of the Physical Page that physical block comprises equals the quantity of the sector that a logical block comprises, the described mapping relations of setting up logical block and physical block are specially:
Physical Page in physical block is corresponded on the sector in logical block.
3. method according to claim 1, is characterized in that, describedly from each physical block, searches valid data and is specially:
Valid data using last data writing as this sector.
4. method according to claim 3, is characterized in that, describedly from each physical block, searches valid data and also comprises:
When said write process is interrupted and is restarted, according to the counting of writing of default each physical block of comparison mechanism comparison, thereby find the data that finally write, and using it as valid data.
5. method according to claim 4, is characterized in that, described default comparison mechanism is specially:
By first of each physical block write counting compare, if first write counting identical; continue more afterwards in turn counting, until occur writing counting difference stop comparison; Depending on writing the data that write in the large physical block of counting as the data that finally write.
6. method according to claim 4, is characterized in that, described method also comprises:
When new data block consistent with the feature of former data block or buffer stopper, any one in the physical block that in retaining, feature is consistent is as tentative data piece, according to the counting of writing of mark in default comparison mechanism comparison buffer stopper and tentative data piece, find out the valid data in buffer stopper or tentative data blocks of data piece again; The feature of described physical block comprises the sector that each Physical Page is corresponding and writes counting;
By blank physical block data block as a supplement, according to the mode of mapping one by one, valid data are copied in supplementary data piece.
7. method according to claim 1, is characterized in that, the quantity of described buffer stopper is two, and the quantity of writing counting is two, and described marking convention is specially:
When first of described old data block, write and be counted as a, during to the first buffer stopper data writing, first of mark the first buffer stopper is write and is counted as a+1, and second writes and be counted as b;
While changing data writing to the second buffering, first of mark the second buffer stopper is write and is counted as a+1, and second writes and be counted as b+1;
A, b are less than 4 nonnegative integer, when a+1 or b+1 are not less than 4, make a+1 or b+1 equal 0.
8. according to method described in claim 1-7 any one, it is characterized in that, in described method, choose at random physical block and logical block is set up mapping relations and writes.
9. according to method described in claim 1-7 any one, it is characterized in that, described physical block comprises a plurality of Physical Page, described for buffer stopper mark, write to count be specially:
To write count tag in each Physical Page, in Same Physical piece, writing of different Physical Page counted difference, with writing of the 0th Physical Page in this physical block, is counted as and effectively writes counting.
10. a physical block writing system, is characterized in that, in described method, between logical block and a plurality of physical block, has mapping relations, has the data block of shining upon one by one with logical block in described a plurality of physical blocks, and described data block comprises former data block and new data block; Buffer stopper with at least one and logical block Random Maps; The quantity of writing counting in each physical block equals the quantity of buffer stopper; Described system comprises:
Mapping block, for setting up the mapping relations of logical block and physical block;
Writing module, in turn to buffer stopper data writing;
Said write module comprises indexing unit, for the process at data writing, according to default marking convention, is that buffer stopper mark is write counting; Described marking convention is specially;
During to the first buffer stopper data writing, by first of former data block, write count increments and be labeled as first of the first buffer stopper and write counting;
During to n buffer stopper data writing, retain n write counting all countings of writing before with respect to n-1 buffer stopper, the numerical value of the n of n-1 buffer stopper being write to counting increases progressively, and the n that is n buffer stopper by the numeric indicia after described increasing progressively writes counting; N is greater than 1 positive integer;
Effective judge module, for searching valid data from each; ;
Copy module, for being copied to new data block by described valid data.
CN201310037365.7A 2013-01-30 2013-01-30 A kind of physical block wiring method and system Active CN103970483B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310037365.7A CN103970483B (en) 2013-01-30 2013-01-30 A kind of physical block wiring method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310037365.7A CN103970483B (en) 2013-01-30 2013-01-30 A kind of physical block wiring method and system

Publications (2)

Publication Number Publication Date
CN103970483A true CN103970483A (en) 2014-08-06
CN103970483B CN103970483B (en) 2017-05-31

Family

ID=51240042

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310037365.7A Active CN103970483B (en) 2013-01-30 2013-01-30 A kind of physical block wiring method and system

Country Status (1)

Country Link
CN (1) CN103970483B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108108118A (en) * 2016-11-24 2018-06-01 大心电子股份有限公司 Method for writing data and storage control

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1199481A (en) * 1996-06-28 1998-11-18 索尼株式会社 Method and device for processing information
US20080091875A1 (en) * 2006-10-12 2008-04-17 International Business Machines Corporation Method to increase performance of non-contiguously written sectors
US20080162786A1 (en) * 2007-01-03 2008-07-03 Ca Shanmuganathan Flash memory wear leveling system and method
CN102339255A (en) * 2010-07-16 2012-02-01 安凯(广州)微电子技术有限公司 Nand writing balance processing method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1199481A (en) * 1996-06-28 1998-11-18 索尼株式会社 Method and device for processing information
US20080091875A1 (en) * 2006-10-12 2008-04-17 International Business Machines Corporation Method to increase performance of non-contiguously written sectors
US20080162786A1 (en) * 2007-01-03 2008-07-03 Ca Shanmuganathan Flash memory wear leveling system and method
CN102339255A (en) * 2010-07-16 2012-02-01 安凯(广州)微电子技术有限公司 Nand writing balance processing method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108108118A (en) * 2016-11-24 2018-06-01 大心电子股份有限公司 Method for writing data and storage control
CN108108118B (en) * 2016-11-24 2021-02-26 深圳大心电子科技有限公司 Data writing method and storage controller

Also Published As

Publication number Publication date
CN103970483B (en) 2017-05-31

Similar Documents

Publication Publication Date Title
US10678768B2 (en) Logical band-based key-value storage structure
US9940255B2 (en) Implementing hardware accelerator for storage write cache management for identification of data age in storage write cache
CN102737715B (en) For the method for power fail safeguard of data of NOR flash memory
US10019381B2 (en) Cache control to reduce transaction roll back
US8433844B2 (en) Method for managing a memory device having multiple channels and multiple ways, and associated memory device and controller thereof
US10209891B2 (en) Methods and systems for improving flash memory flushing
US11164650B2 (en) Scrub management in storage class memory
CN104813293B (en) Use the memory management in the dirty mask space of dynamically distributes
CN103455435A (en) Data writing method and device
US11675707B2 (en) Logical to virtual and virtual to physical translation in storage class memory
CN102339255B (en) Nand writing balance processing method
CN103970483A (en) Method and system for writing physical blocks
CN104424132A (en) High-performance instruction cache system and method
CN103970674A (en) Method and system for writing physical blocks
CN103838647A (en) Data state transition method and system based on snapshot remapping
US20090043770A1 (en) Method of Realizing Commands Synchronization in Supporting Multi-Threading Non-Volitale Memory File System
US20190251996A1 (en) Wandering write protection for shingled magnetic recording storage devices
US20210064538A1 (en) Virtual to physical translation and media repair in storage class memory
CN106528446A (en) Flash memory data control method and system
JP6601077B2 (en) Information processing apparatus, log recording method, and log recording program
JPS58166584A (en) Buffer memory control 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
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 510663 3rd floor, area C1, innovation building, 182 science Avenue, Guangzhou Science City, Luogang District, Guangzhou City, Guangdong Province

Patentee after: Guangzhou Ankai Microelectronics Co.,Ltd.

Address before: 510663 3rd floor, area C1, innovation building, 182 science Avenue, Guangzhou Science City, Luogang District, Guangzhou City, Guangdong Province

Patentee before: ANYKA (GUANGZHOU) MICROELECTRONICS TECHNOLOGY Co.,Ltd.

CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 510555 No. 107 Bowen Road, Huangpu District, Guangzhou, Guangdong

Patentee after: Guangzhou Ankai Microelectronics Co., Ltd

Address before: 510663 floor 3, zone C1, innovation building, No. 182, science Avenue, Guangzhou Science City, Luogang District, Guangzhou City, Guangdong Province

Patentee before: Guangzhou Ankai Microelectronics Co., Ltd