CN103970674B - A kind of physical block wiring method and system - Google Patents

A kind of physical block wiring method and system Download PDF

Info

Publication number
CN103970674B
CN103970674B CN201310037340.7A CN201310037340A CN103970674B CN 103970674 B CN103970674 B CN 103970674B CN 201310037340 A CN201310037340 A CN 201310037340A CN 103970674 B CN103970674 B CN 103970674B
Authority
CN
China
Prior art keywords
buffer stopper
block
write
physical
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310037340.7A
Other languages
Chinese (zh)
Other versions
CN103970674A (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 CN201310037340.7A priority Critical patent/CN103970674B/en
Publication of CN103970674A publication Critical patent/CN103970674A/en
Application granted granted Critical
Publication of CN103970674B publication Critical patent/CN103970674B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the present invention provides a kind of physical block wiring method, and methods described is comprised the following steps that:A, the mapping relations for setting up logical block and physical block;B, sequentially to buffer stopper write data, complete the write of n buffer stopper;C, kth buffer stopper is compareed with all buffer stoppers for writing after which, whether the corresponding Sector Range of buffer stopper write after judging kth buffer stopper covers the corresponding Sector Range of kth buffer stopper, judge that kth buffer stopper is invalid buffer stopper if covering, be otherwise judged to effective buffer stopper;Release the mapping relations of invalid buffer stopper and logical block;D, chosen with the physical block of invalid buffer stopper equal amount again as buffer stopper, and complete the write of the buffer stopper of new selection;E, step c d is repeated, until n buffer stopper is effective buffer stopper, then valid data are searched from former data block and effective buffer stopper;The valid data are copied to into new data block;K is more than 0 and less than the integer of n.

Description

A kind of physical block wiring method and system
Technical field
The present invention relates to technical field of data storage, more particularly to a kind of physical block wiring method and system.
Background technology
NAND is a kind of outstanding flash memory scheme of current stage performance, is characterized in low in energy consumption, lightweight, readwrite performance It is good;Flash disk and storage card are widely used at present.NAND chip contains multiple physical blocks as storage medium, each thing Reason block includes multiple Physical Page again.Because the erasable number of times of the physical block of NAND chip and Physical Page is all limited, therefrom Derivative balanced algorithm of writing becomes the important technical for extending NAND chip service life.And write the usual all bases of balanced algorithm In file system, the mapping relations of the logical block of the virtual aspect or sector physical block actual with NAND chip or Physical Page are come Launch.
In the patent of Application No. 201010229936.3, disclose a kind of NAND and write Balance Treatment method;Substantially think Road is as follows:Logical block two physical blocks of correspondence in the method;In described physical block, one is mapped one by one with logical block, Another and logical block Random Maps.It is referred to as data block with the physical block that logical block maps one by one, with logical block Random Maps Physical block be referred to as buffer stopper;Data are written in buffer stopper first in write, by certain mechanism after the completion of write Each page data of Random Maps in each page data in old data block and buffer stopper is written to according to the rules integration for mapping one by one One new data block.
The physical block includes multiple Physical Page, and the logical block includes multiple sectors, it is however generally that in a physical block Physical Page quantity be equal to the number of sectors in a logical block, each Physical Page correspond to a sector.In above-mentioned patent In the middle of the ablation process of technical scheme, although buffer stopper only exists one, but one can essentially be made by simple improvement Logical block is corresponding with multiple buffer stoppers.The multiple Physical Page correspondence identical fans of appearance inherently repeated in multiple buffer stoppers Area, it is however generally that select the data compilation in the Physical Page being ultimately written in this case in the middle of new data block.And In the case of multiple buffer stoppers, it is likely that in the buffer stopper for writing afterwards, the corresponding sector of Physical Page completely includes the buffering for first writing The sector that corresponding Physical Page is included in block, then total data is invalid in the buffer stopper for so first writing, and is not required to It is organized in data block, that is, the buffer stopper for first writing is completely ineffective in the case.And in the prior art, on Stating invalid buffer stopper also needs to retain until the end of whole ablation process, exists during data are arranged to new data block A large amount of invalid buffer stoppers, cause the number of times of Data Integration not drop to bottom line, and excessive Data Integration expends NAND cores The read-write number of times of piece, shortens the Acceptable life of NAND chip.
The content of the invention
In view of this, it is an object of the invention to provide a kind of physical block wiring method and system, said write method exists Judge while write whether buffer stopper belongs to invalid buffer stopper, and invalid buffer stopper is deleted.
For achieving the above object, the present invention has following technical scheme:
, there are mapping relations between logical block and multiple physical blocks in methods described in a kind of physical block wiring method, described Multiple physical blocks include data block and certain amount of buffer stopper;The data block includes former data block and new data block, described The specific quantity of buffer stopper is n, and n is the integer more than 1, and methods described is comprised the following steps that:
A, the mapping relations for setting up logical block and physical block;
B, sequentially to buffer stopper write data, complete the write of n buffer stopper;
C, kth buffer stopper is compareed with all buffer stoppers for writing after which, write after judging kth buffer stopper The corresponding Sector Range of buffer stopper whether cover the corresponding Sector Range of kth buffer stopper, if covering judge kth buffer stopper For invalid buffer stopper, otherwise it is judged to effective buffer stopper;Release the mapping relations of invalid buffer stopper and logical block;
D, chosen with the physical block of invalid buffer stopper equal amount again as buffer stopper, set up the new buffer stopper chosen and patrol The mapping relations of block are collected, and completes the write of the buffer stopper of new selection;
E, step c-d is repeated, until n buffer stopper is effective buffer stopper, then buffered from former data block and effectively Valid data are searched in block;The valid data are copied to into new data block;
K is more than 0 and less than the integer of n.
The physical block includes multiple Physical Page, and the logical block includes multiple sectors, and the thing that a physical block includes The quantity of reason page is equal to the quantity of the sector that a logical block includes, then the logical block of setting up is had with the mapping relations of physical block Body is:
Physical Page in physical block is corresponded on the sector in logical block.
The corresponding Sector Range of buffer stopper write after the kth buffer stopper covers the corresponding sector model of kth buffer stopper Enclose specially:
When any one sector corresponding with Physical Page in kth buffer stopper, the buffer stopper for writing after kth buffer stopper In there is corresponding Physical Page, then it is assumed that the corresponding Sector Range of buffer stopper write after kth buffer stopper covers kth buffer stopper Corresponding Sector Range.
The valid data of searching from each physical block are specially:
Data are ultimately written into as the valid data of the sector.
Methods described also includes:
Again to successively to each buffer stopper write data when, sequentially in time for each buffer stopper labelling it is incremented by successively write meter Number.
The valid data of searching from each physical block also include:
When it is described valid data are copied to during new data block break and restart when, compare machine according to default Make more former data block and effective buffer stopper and write countings, to write the larger data of counting be the data that are ultimately written so as to find, and As valid data.
Methods described also includes:
After valid data are copied in new data block, the mapping for cancelling buffer stopper and former data block with logical block is closed System.
Randomly select physical block to set up mapping relations with logical block and write in methods described.
The physical block includes multiple Physical Page, then described to write counting for buffer stopper labelling and be specially:
Count tag will be write in each Physical Page, when in Same Physical block different Physical Page to write counting different, then with In the physical block, writing for the 0th Physical Page is counted as effectively writing counting.
, there are mapping relations between logical block and multiple physical blocks in the system in a kind of physical block writing system, described Multiple physical blocks include data block and certain amount of buffer stopper;The data block includes former data block and new data block, described The specific quantity of buffer stopper is n, and n is the integer more than 1, and the system is specifically included:
Mapping block, the mapping relations for setting up logical block and physical block;
Writing module, for sequentially to buffer stopper write data, complete the write of n buffer stopper;And complete complementary module The write of the new buffer stopper chosen;
Invalid judge module, for kth buffer stopper is compareed with all buffer stoppers for writing after which, judge Whether the corresponding Sector Range of buffer stopper write after k buffer stoppers covers the corresponding Sector Range of kth buffer stopper, if covered Then judge that kth buffer stopper is invalid buffer stopper, be otherwise judged to effective buffer stopper;Invalid buffer stopper is released with logical block Mapping relations;K is more than 0 and less than the integer of n;
Complementary module, for being chosen with the physical block of invalid buffer stopper equal amount again as buffer stopper;
Effectively judge module, for when n buffer stopper is effective buffer stopper, from former data block and effective buffer stopper Search valid data;
Copy module, for the valid data are copied to new data block.
According to above technical scheme, the beneficial effect that the present invention is present is:By the sector for contrasting each buffer stopper Scope, so as to find invalid buffer stopper, and releases the corresponding relation of invalid buffer stopper and logical block, is achieved in integration process In all of buffer stopper be effective buffer stopper, farthest reduce the number of times of Data Integration, extend making for NAND chip Use the life-span.
Description of the drawings
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing Accompanying drawing to be used needed for having technology description is briefly described, it should be apparent that, drawings in the following description are the present invention Some embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can be with basis These accompanying drawings obtain other accompanying drawings.
Fig. 1 is mapping relations schematic diagram one by one in prior art;
Fig. 2 is Random Maps relation schematic diagram in prior art;
Fig. 3 is physical block integration process schematic diagram in prior art;
Fig. 4 is embodiment of the present invention methods described flow chart;
Fig. 5 is valid data integration process schematic diagram in the embodiment of the present invention;
Fig. 6 is another embodiment of the present invention methods described flow chart;
Fig. 7 is system structure diagram described in the embodiment of the present invention.
Specific embodiment
To make purpose, technical scheme and the advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is The a part of embodiment of the present invention, rather than the embodiment of whole.Based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
The present invention provides a kind of wiring method of physical block, is mainly used in the middle of NAND chip.Write of the present invention In method, it is optimized on existing wiring method so that methods described can be found that invalid buffer stopper, and releases Mapping relations between invalid buffer stopper and logical block.For the ease of being explained and illustrated to the method for the invention, herein A kind of wiring method of NAND chip physical block of brief description first:
In the ablation process that the method is related to, between logical block and multiple physical blocks, there are mapping relations;One logical block Include multiple sectors, and a physical block includes multiple Physical Page;Generally speaking a logical block includes number of sectors Include the quantity of Physical Page equal to a physical block.Described logical block and sector are logically virtually built for file system Memory element;And the physical block and Physical Page are actual storage medium, the data preserved in storage medium are by mapping Relation reflects on virtual logical block or sector, and sets up the mapping relations of logical block and physical block, that is, by physical block In Physical Page correspond to the sector in logical block.
The physical block is divided into data block and buffer stopper according to the difference of purposes in ablation process;Each thing in data block The data that reason page is preserved are the data that each sector of logical block is presented, and in data block, each Physical Page is with each sector in logical block one by one Mapping.In general in ablation process, data block corresponding with logical block has two;One is former data block, data in former data block The data that namely each sector of the logical block is presented originally;It is another for new data block, will the data of ablation process newly write be The data block obtained after reintegrating to a part of legacy data, the data in new data block are exactly that each sector of the logical block is being write Enter to complete the data for presenting afterwards.In addition, generally during write-not, when the data stabilization of logical block presentation is constant, patrolling Collect block and only there are mapping relations with a data block.
It is described to map in namely data block each Physical Page each sector in counterlogic block in order one by one.Referring to figure 1 show the schematic diagram for mapping one by one, assumes that a physical block includes 4 Physical Page in Fig. 1, and a logical block includes 4 fans Area.In Fig. 1, four square frames represent 4 Physical Page in physical block respectively, according to order from left to right be page 0 respectively, the 1st Page, page 2 and page 3.Label in figure on each Physical Page represents the corresponding sector of the Physical Page, is page 0 corresponding in Fig. 1 4th sector, the 5th sector of page 1 correspondence, the rest may be inferred.Each Physical Page corresponds to reflecting for a sector in order as shown in Figure 1 Penetrate and i.e. so-called map one by one.Mapping one by one generally means that certain ablation process has finished, it is also possible to think to map one by one It is a kind of mapping relations under logical block steady statue.
And buffer stopper needs presence at least one in ablation process.For from physical layer, need to write in ablation process It is the buffer stopper that writes direct to enter the data in logical block sector, after a buffer stopper is fully written, can again to others Buffer stopper writes.The mapping relations of buffer stopper and logical block are random right of each Physical Page in Random Maps, that is, buffer stopper The sector in logical block is answered, both not necessarily in order and the correspondence for repeating was also possible to, with specific reference to concrete during write Depending on situation.
Schematic diagram for Random Maps shown in Figure 2, also assumes that in Fig. 2 that a physical block includes 4 Physical Page, one Individual logical block includes 4 sectors.In Fig. 2, four square frames represent 4 Physical Page in physical block respectively, according to order from left to right It is page 0, page 1, page 2 and page 3 respectively.Label in figure on each Physical Page represents the corresponding sector of the Physical Page; It can be seen that the 0th, 1,2 three Physical Page correspond to the 7th sector, and the 3rd Physical Page corresponds to the 6th sector.This be due to first write three The data of individual Physical Page need to write the 7th sector, and then page of data need to write the 6th sector, Physical Page and sector Corresponding relation is depending on write situation.The presence of buffer stopper represents that ablation process is carried out, so Random Maps can consider It is unstabilized a kind of mapping relations between logical block and physical block.
Schematic diagram for physical block integration process shown in Figure 3, that is, using data block shown in Fig. 1 as former data block With the concrete steps of Data Integration in buffer stopper shown in Fig. 2.Data are completed to after the write of buffer stopper, is also needed empty to one White physical block integrates former data block and the data in buffer stopper, and the blank physical block also just will be used as new data block.With reference to Fig. 3 Shown in data block and buffer stopper from the point of view of, the corresponding Physical Page in sector may more than one, then it is corresponding in the sector So in Physical Page, it is valid data to take the data in the Physical Page for finally being write.Will be 4 sectors corresponding effectively Data are incorporated in a new data block according to the mode for mapping one by one, so as to replace former data block.
It is a kind of physical block wiring method related to the method for the invention above.According to the method described above in actual motion It is central, it is found that often to there is problem below:There are multiple buffer stoppers in the middle of write-once process, and according to the rule of write Then it is generally acknowledged that the data write after the time is upper are valid data;So in most cases, most number in new data block According to both being from last one or several buffer stoppers.Data in the buffer stopper and former data block of relatively early write are often coated to Lid, is considered invalid buffer stopper because valid data are not included in some buffer stoppers, rises during the arrangement of valid data Less than effect.
It is shown in Figure 4, it is a specific embodiment of physical block wiring method of the present invention, pin in the present embodiment To there is invalid buffer stopper in ablation process.Exist between logical block and multiple physical blocks in the present embodiment methods described Mapping relations, the plurality of physical block include data block and certain amount of buffer stopper;The data block include former data block and New data block, the specific quantity of the buffer stopper is n, and n is the integer more than 1, is comprised steps that:
Step 401, the mapping relations for setting up logical block and physical block;
The step is the initialization step of write.
Step 402, sequentially to buffer stopper write data, complete the write of n buffer stopper;
It is basically identical with physical block wiring method in aforementioned prior art for the write of buffer stopper described in this step. It is the buffer stopper that writes direct that the data in logical block sector need to be write, after a buffer stopper is fully written, can again to which His buffer stopper write.
It is n that buffering number of blocks corresponding with logical block is pre-set in the present embodiment, and n is the integer more than 1. Need to complete the write of n buffer stopper first in ablation process, and then start follow-up flow process.
Step 403, kth buffer stopper is compareed with all buffer stoppers for writing after which, judge kth buffer stopper it Whether the corresponding Sector Range of buffer stopper for writing afterwards covers the corresponding Sector Range of kth buffer stopper, and kth is judged if covering Buffer stopper is invalid buffer stopper, is otherwise judged to effective buffer stopper;Release the mapping relations of invalid buffer stopper and logical block; K is more than 0 and less than the integer of n.
In general, after the buffer stopper for completing to write reaches specific quantity n, that is, starting from buffer stopper and former data block It is middle to search valid data and carry out arrangement and the copy of valid data.But increase number to solve invalid buffer stopper in the present embodiment According to the problem for arranging copy number of times, the technical characteristic in step 403 is added.
Whether in this step, it is to judge certain buffer stopper as invalid buffer stopper to be substantially.Due to writing in time later The data for entering are valid data, so the n-th buffer stopper being ultimately written in n buffer stopper necessarily valid data block, and the 1st delays It is probably invalid buffer stopper to rush the-the (n-1)th buffer stopper of block.So in the present embodiment, taking in the 1st the-the (n-1)th buffer stopper of buffer stopper Arbitrarily buffer stopper, i.e. kth buffer stopper, judge that the buffer stopper whether its Sector Range is write thereafter is covered.The fan of kth buffer stopper Some buffer stopper that area's scope may be write thereafter is fully contemplated by, it is also possible to the Sector Range of the several buffer stoppers of thereafter certain Union covers the Sector Range of kth buffer stopper.In a word, as long as inevitable in kth buffer stopper do not have valid data, then it is assumed that the K buffer stoppers are invalid buffer stopper.
The corresponding Sector Range of buffer stopper write after the kth buffer stopper covers the corresponding sector model of kth buffer stopper The criterion enclosed is specially:When any one sector corresponding with Physical Page in kth buffer stopper, after kth buffer stopper There is corresponding Physical Page in the buffer stopper of write, then it is assumed that the corresponding Sector Range of buffer stopper write after kth buffer stopper Cover the corresponding Sector Range of kth buffer stopper.
If there is no invalid buffer stopper in n buffer stopper, directly start the lookup of the valid data described in step 405 With the process of copy.
With reference to shown in Fig. 5, it is the concrete case of logical block three buffer stoppers of correspondence, that is to say, that in the present embodiment Shown in Fig. 5, the specific quantity of buffer stopper is three, writes full three buffer stoppers when data and proceeds by subsequent process.
Visible by observing Fig. 5, in the first buffer stopper, the corresponding sector of 4 Physical Page includes the 4th, 6,7 three sectors, then Think that the above-mentioned 4th, 6,7 three sectors are the Sector Range of the first buffer stopper;Second buffer stopper and the 3rd buffer stopper in the same manner Sector Range is the 5th, 6,7 three sectors.
The Sector Range of contrast three can find, as the 4th sector is not in the second buffer stopper and the 3rd buffer stopper sector model Within enclosing, so the Sector Range of the first buffer stopper is not included beyond the Sector Range of follow-up all buffer stoppers;Namely The corresponding sector of one Physical Page of presence in first buffer stopper(4th sector), the sector is in the second buffer stopper or the 3rd buffer stopper In no corresponding Physical Page.The valid data of the 4th sector come from the first buffer stopper.It is determined that the first buffer stopper is effective Buffer stopper.
But only contrast the second buffer stopper to find with the 3rd buffer stopper, Sector Range >=the second buffer stopper of the 3rd buffer stopper Sector Range, as the write time of the 3rd buffer stopper is rear, so the valid data of the 5th, 6,7 three sectors are impossible Come from the second buffer stopper.That is in this case, when any one institute corresponding with Physical Page in the second buffer stopper There is sector(I.e. the 5th, 6,7 three sectors)Corresponding Physical Page is equally existed in the 3rd buffer stopper, then the 3rd buffer stopper pair The Sector Range answered covers the corresponding Sector Range of the second buffer stopper.Valid data are not included in second buffer stopper, then it is assumed that Second buffer stopper is actually an invalid buffer stopper.
In this case, judge in the present embodiment that the second buffer stopper is invalid buffer stopper, the first buffer stopper and the 3rd delays It is effective buffer stopper to rush block, releases the mapping relations of invalid buffer stopper and logical block.
Step 404, chosen with the physical block of invalid buffer stopper equal amount again as buffer stopper, set up the new buffering chosen The mapping relations of block and logical block, and complete the write of the buffer stopper of new selection;
As invalid buffer stopper is found that in above-mentioned steps, and relieve the mapping pass of invalid buffer stopper and logical block System, so the corresponding buffer stopper of logical block is no longer able to reach specific quantity n, cannot carry out valid data in this case Integration.Some physical blocks are then now filled up again and sets up Random Maps relation with logical block, proceed as buffer stopper Write.The quantity of the buffer stopper filled up is equal to the quantity of invalid buffer stopper in step 403, can so keep logical block corresponding Buffering number of blocks still meets specific quantity n.For the new buffer stopper chosen is also carried out same write operation.
Step 405, step 403- step 404 is repeated, until n buffer stopper is effective buffer stopper, then from former number According to searching valid data in block and effective buffer stopper;The valid data are copied to into new data block.
After the new buffer stopper chosen completes write in step 404, there is n buffering corresponding with logical block again Block.For this n buffer stopper, the judge process of the invalid buffer stopper in same execution step 403 is also needed.If it is invalid still to exist Buffer stopper, then also need to release the mapping relations of invalid buffer stopper and logical block, and fill up new again by scheme in step 404 Buffer stopper.
What is so circulated repeats step 403- step 404, until n buffer stopper is effective buffer stopper, just starts The lookup of valid data is carried out, the process for arranging and copying.
After increasing by the 4th buffer stopper in Fig. 5, each buffer stopper is valid data block, and buffer stopper reaches certain number Amount three.Can start to perform follow-up process.In the present embodiment, integration process and the said physical block write side of valid data Method is consistent.
In aforesaid wiring method, as long as completing the write of specific quantity buffer stopper, then start the copy of valid data, but Invalid buffer stopper be will likely include ones which in its multiple buffer stopper for including, thus integrate number of times do not drop to it is minimum.This enforcement In example, only when effective buffer stopper reaches specific quantity, the copy of valid data is just carried out, actually accomplish the buffer stopper of write Quantity is likely larger than specific quantity, so reduces the number of times of valid data integration, extends the service life of NAND chip.
The beneficial effect that the present embodiment is present is to realize that all of buffer stopper is effective buffer stopper in integration process, The number of times of Data Integration is farthest reduced, the service life of NAND chip is extended.
It is shown in Figure 6, it is another specific embodiment of physical block wiring method of the present invention.The present embodiment institute There are mapping relations in stating method between logical block and multiple physical blocks, the plurality of physical block includes data block and specific quantity Buffer stopper;The data block includes former data block and new data block, and the specific quantity of the buffer stopper is n, and n is more than 1 Integer, described in the present embodiment, method specifically includes following:
Step 601, the mapping relations for setting up logical block and physical block;
The step is the initialization step of write.
Step 602, sequentially to buffer stopper write data, complete the write of n buffer stopper;Again to writing to each buffer stopper successively When entering data, sequentially in time for each buffer stopper labelling it is incremented by successively write counting.
Step 603, kth buffer stopper is compareed with all buffer stoppers for writing after which, judge kth buffer stopper it Whether the corresponding Sector Range of buffer stopper for writing afterwards covers the corresponding Sector Range of kth buffer stopper, and kth is judged if covering Buffer stopper is invalid buffer stopper, is otherwise judged to effective buffer stopper;Release the mapping relations of invalid buffer stopper and logical block; K is more than 0 and less than the integer of n.
Step 604, chosen with the physical block of invalid buffer stopper equal amount again as buffer stopper, set up the new buffering chosen The mapping relations of block and logical block, and complete the write of the buffer stopper of new selection;
Step 605, step 603- step 604 is repeated, until n buffer stopper is effective buffer stopper;
Step 606, when it is described valid data are copied to during new data block break and restart when, according to default The more former data block of comparison mechanism and effective buffer stopper write counting, count larger data and be ultimately written so as to find to write Data, and as valid data.
Step 607, the valid data are copied to into new data block.
Step 608, the mapping relations for cancelling buffer stopper and former data block and logical block.
After the copy for completing valid data, cancel the mapping relations of buffer stopper and former data block and logical block, can be with The internal memory and memory space of computer system are saved, is easy to the re-using of physical block.
If the write of whole data and integration process are to be normally carried out, period does not have any interruption, then can be in write The Physical Page that automatic storing is ultimately written for each sector simultaneously, and valid data therein are integrated.But if write And there is interruption and recovers again in the process integrated, then need by ad hoc approach to find out again the data being ultimately written, and As valid data.At this stage after interrupting and recovering, to search the method for valid data mainly by labelling And compare and write counting.It is by default mechanism to write the labelling of counting and compares.
A kind of technical scheme that counting is write with regard to local of following discloses, concrete principle are as follows:
When data are write to the first buffer stopper, write counting by the first of former data block and be incremented by and be labeled as the first buffer stopper First writes counting;
To m buffer stoppers write data when, relative to m-1 buffer stoppers retain m write count before it is all write counting, The numerical value that the m of m-1 buffer stoppers writes counting is incremented by, the m that the numeric indicia after described being incremented by is m buffer stoppers is write into meter Number;M is the positive integer more than 1.
Correspondence is above-mentioned to write count tag method, enters row write for effective buffer stopper and counts the integration compared with valid data; Method is specific as follows:
Counting is write by the first of each physical block to be compared, if first write counting it is identical if sequentially continue meter more afterwards Number, until occurring writing, counting is different then stops comparing;The data that write in big physical block are counted as being ultimately written depending on writing Data.In same buffer stopper all Physical Page write counting it is identical, but write order be according to Physical Page put in order into Capable.
The present embodiment methods described further combines one kind with regard to writing meter on the basis of embodiment illustrated in fig. 4 Several technical scheme, so the beneficial effect that the present embodiment is further present is:The method of counting of writing is in Different Logic block pair The buffer stopper answered each independently enters the labelling of row write counting, unrelated;And described level is write count tag method and is only existed Labelling and be incremented by and write countings when buffer stopper writes, and during valid data integration valid data no longer occur it is any Change;So the present embodiment methods described realizes the support hardware-accelerated for COPYBACK, it is possible to achieve pass through The speed of service of the hardware-accelerated raising NAND of COPYBACK;In addition, the count tag method of writing of level described in the present embodiment drops Low writing counts the speed being incremented by, and re-flags when logical block sets up mapping relations with physical block again and write counting, it is to avoid Write counting constantly it is accumulative be incremented by caused by write count value increasing, so as to save whole computer system memory and Memory space;Method and technology scheme described in the present embodiment is more perfect, open more abundant.
Furthermore it is also possible on the basis of the embodiment of the method shown in Fig. 4 or Fig. 6, further combined with following optimization side Case:
When physical block is chosen and logical block sets up mapping relations, set up with logical block using physical block is randomly selected Mapping relations, and the method for starting follow-up write.It is achieved from probability according to the method described above and reaches writing for all physical blocks Balance so that the erasable number of times of all physical blocks is of substantially equal in NAND chip, extends the service life of NAND chip.
It is shown in Figure 7, it is a specific embodiment of physical block writing system of the present invention.Described in the present embodiment System is the system that embodiment of the method shown in correspondence Fig. 4 is set up, so specifically, described in the present embodiment, system is as follows:
There are mapping relations in the system between logical block and multiple physical blocks, the plurality of physical block includes data block With certain amount of buffer stopper;The data block includes former data block and new data block, and the specific quantity of the buffer stopper is n, n It is the integer more than 1, the system is specifically included:
Mapping block, the mapping relations for setting up logical block and physical block;
Writing module, for sequentially to buffer stopper write data, complete the write of n buffer stopper;And complete complementary module The write of the new buffer stopper chosen;
Invalid judge module, for kth buffer stopper is compareed with all buffer stoppers for writing after which, judge Whether the corresponding Sector Range of buffer stopper write after k buffer stoppers covers the corresponding Sector Range of kth buffer stopper, if covered Then judge that kth buffer stopper is invalid buffer stopper, be otherwise judged to effective buffer stopper;Invalid buffer stopper is released with logical block Mapping relations;K is more than 0 and less than the integer of n;
Complementary module, for being chosen with the physical block of invalid buffer stopper equal amount again as buffer stopper;
Effectively judge module, for when n buffer stopper is effective buffer stopper, from former data block and effective buffer stopper Search valid data;
Copy module, for the valid data are copied to new data block.
The present embodiment exist beneficial effect be:Realize that all of buffer stopper is effective buffer stopper in integration process, The number of times of Data Integration is farthest reduced, the service life of NAND chip is extended.
The above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications also should It is considered as protection scope of the present invention.

Claims (8)

1. a kind of physical block wiring method, it is characterised in that there is mapping in methods described between logical block and multiple physical blocks Relation, the plurality of physical block include data block and certain amount of buffer stopper;The data block includes former data block and new number According to block, the specific quantity of the buffer stopper is n, and n is the integer more than 1, and methods described is comprised the following steps that:
A, the mapping relations for setting up logical block and physical block;
B, sequentially to buffer stopper write data, complete the write of n buffer stopper;
C, kth buffer stopper is compareed with all buffer stoppers for writing after which, what is write after judging kth buffer stopper is slow Rush whether the corresponding Sector Range of block covers the corresponding Sector Range of kth buffer stopper, if covering, judge kth buffer stopper as nothing Effect buffer stopper, is otherwise judged to effective buffer stopper;Release the mapping relations of invalid buffer stopper and logical block;
D, chosen with the physical block of invalid buffer stopper equal amount again as buffer stopper, set up the new buffer stopper chosen and logical block Mapping relations, and complete the write of the buffer stopper of new selection;
E, step c-d is repeated, until n buffer stopper is effective buffer stopper, then from former data block and effective buffer stopper Search valid data;The valid data are copied to into new data block;
K is more than 0 and less than the integer of n;
Wherein, the physical block includes multiple Physical Page, and the logical block includes multiple sectors, and the thing that a physical block includes The quantity of reason page is equal to the quantity of the sector that a logical block includes, then the logical block of setting up is had with the mapping relations of physical block Body is:Physical Page in physical block is corresponded on the sector in logical block;
The corresponding Sector Range of buffer stopper write after the kth buffer stopper covers the corresponding Sector Range tool of kth buffer stopper Body is:When any one sector corresponding with Physical Page in kth buffer stopper, in the buffer stopper for writing after kth buffer stopper There is corresponding Physical Page, then it is assumed that the corresponding Sector Range of buffer stopper write after kth buffer stopper covers kth buffer stopper pair The Sector Range answered.
2. method according to claim 1, it is characterised in that the lookup valid data are specially:
Data are ultimately written into as the valid data of the sector.
3. method according to claim 1, it is characterised in that methods described also includes:
Successively to each buffer stopper write data while, sequentially in time for each buffer stopper labelling it is incremented by successively write counting.
4. method according to claim 3, it is characterised in that the lookup valid data also include:
When it is described the valid data are copied to during new data block break and restart when, compare machine according to default Make more former data block and effective buffer stopper and write countings, to write the larger data of counting be the data that are ultimately written so as to find, and As valid data.
5. method according to claim 1, it is characterised in that methods described also includes:
After valid data are copied in new data block, cancel the mapping relations of buffer stopper and former data block and logical block.
6. according to claim 1-5 any one methods described, it is characterised in that physical block is randomly selected in methods described and is patrolled Collect block to set up mapping relations and write.
7. according to claim 1-5 any one methods described, it is characterised in that the physical block includes multiple Physical Page, then It is described to write counting for buffer stopper labelling and be specially:
Count tag will be write in each Physical Page, when writing for different Physical Page counts different in Same Physical block, then with the thing In reason block, writing for the 0th Physical Page is counted as effectively writing counting.
8. a kind of physical block writing system, it is characterised in that there is mapping in the system between logical block and multiple physical blocks Relation, the plurality of physical block include data block and certain amount of buffer stopper;The data block includes former data block and new number According to block, the specific quantity of the buffer stopper is n, and n is the integer more than 1, and the system is specifically included:
Mapping block, the mapping relations for setting up logical block and physical block;
Writing module, for sequentially to buffer stopper write data, complete the write of n buffer stopper;And complete complementary module and newly select The write of the buffer stopper for taking;
Invalid judge module, for kth buffer stopper is compareed with all buffer stoppers for writing after which, judge that kth is delayed Whether the corresponding Sector Range of buffer stopper write after rushing block covers the corresponding Sector Range of kth buffer stopper, if covering Judge that kth buffer stopper is invalid buffer stopper, be otherwise judged to effective buffer stopper;Release reflecting for invalid buffer stopper and logical block Penetrate relation;K is more than 0 and less than the integer of n;
Complementary module, for being chosen with the physical block of invalid buffer stopper equal amount again as buffer stopper;
Effectively judge module, for when n buffer stopper is effective buffer stopper, the lookup from former data block and effective buffer stopper Valid data;
Copy module, for the valid data are copied to new data block;
Wherein, the physical block includes multiple Physical Page, and the logical block includes multiple sectors, and the thing that a physical block includes The quantity of reason page is equal to the quantity of the sector that a logical block includes, then the logical block of setting up is had with the mapping relations of physical block Body is:Physical Page in physical block is corresponded on the sector in logical block;
The corresponding Sector Range of buffer stopper write after the kth buffer stopper covers the corresponding Sector Range tool of kth buffer stopper Body is:When any one sector corresponding with Physical Page in kth buffer stopper, in the buffer stopper for writing after kth buffer stopper There is corresponding Physical Page, then it is assumed that the corresponding Sector Range of buffer stopper write after kth buffer stopper covers kth buffer stopper pair The Sector Range answered.
CN201310037340.7A 2013-01-30 2013-01-30 A kind of physical block wiring method and system Active CN103970674B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310037340.7A CN103970674B (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
CN201310037340.7A CN103970674B (en) 2013-01-30 2013-01-30 A kind of physical block wiring method and system

Publications (2)

Publication Number Publication Date
CN103970674A CN103970674A (en) 2014-08-06
CN103970674B true CN103970674B (en) 2017-04-05

Family

ID=51240203

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN103970674B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107861884B (en) * 2017-11-06 2020-06-02 华中科技大学 Method for improving cross-page memory address mapping efficiency in NAND flash memory

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101727403A (en) * 2008-10-15 2010-06-09 深圳市朗科科技股份有限公司 Data storage system, equipment and method
CN102339255A (en) * 2010-07-16 2012-02-01 安凯(广州)微电子技术有限公司 Nand writing balance processing method
CN102521156A (en) * 2011-12-12 2012-06-27 云海创想信息技术(天津)有限公司 Mapping relation access method and mapping relation access device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101727403A (en) * 2008-10-15 2010-06-09 深圳市朗科科技股份有限公司 Data storage system, equipment and method
CN102339255A (en) * 2010-07-16 2012-02-01 安凯(广州)微电子技术有限公司 Nand writing balance processing method
CN102521156A (en) * 2011-12-12 2012-06-27 云海创想信息技术(天津)有限公司 Mapping relation access method and mapping relation access device

Also Published As

Publication number Publication date
CN103970674A (en) 2014-08-06

Similar Documents

Publication Publication Date Title
US8291155B2 (en) Data access method, memory controller and memory storage system
CN105242871B (en) A kind of method for writing data and device
US8312554B2 (en) Method of hiding file at data protecting mode for non-volatile memory module, memory controller and portable memory storage apparatus
CN103092766B (en) A kind of loss equalizing implementation method for NAND FLASH
CN102779096B (en) Page, block and face-based three-dimensional flash memory address mapping method
US8838937B1 (en) Methods, systems and computer readable medium for writing and reading data
WO2014074449A2 (en) Wear leveling in flash memory devices with trim commands
CN110347336A (en) A kind of key assignments storage system based on NVM with SSD mixing storage organization
CN104461393A (en) Mixed mapping method of flash memory
CN103034562A (en) Meta data handling within a flash media controller
CN101999117B (en) Memory drive that can be operated like optical disk drive and method for virtualizing memory drive as optical disk drive
CN110168532A (en) Data-updating method and storage device
CN110888600A (en) Buffer area management method for NAND flash memory
CN110377233A (en) SSD reading performance optimization method, device, computer equipment and storage medium
CN111580754B (en) Write-friendly flash memory solid-state disk cache management method
CN104156432A (en) File access method
US20090138530A1 (en) Data management method for logical volume manager
KR100914646B1 (en) Management Scheme for Flash Memory with the Multi-Plane Architecture
CN103970674B (en) A kind of physical block wiring method and system
CN105653466B (en) data storage device and flash memory control method
JP3431581B2 (en) Disk control system and data relocation method
US8589620B2 (en) Data writing method, memory controller, and memory storage apparatus
JP3204295B2 (en) Cache memory system
US8832358B2 (en) Data writing method, memory controller and memory storage apparatus
KR101020781B1 (en) A method for log management in flash memory-based database systems

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
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Method and system for writing physical blocks

Effective date of registration: 20171102

Granted publication date: 20170405

Pledgee: China Co truction Bank Corp Guangzhou economic and Technological Development Zone sub branch

Pledgor: Anyka (Guangzhou) Microelectronics Technology Co., Ltd.

Registration number: 2017990001008

PE01 Entry into force of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20181227

Granted publication date: 20170405

Pledgee: China Co truction Bank Corp Guangzhou economic and Technological Development Zone sub branch

Pledgor: Anyka (Guangzhou) Microelectronics Technology Co., Ltd.

Registration number: 2017990001008

PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Method and system for writing physical blocks

Effective date of registration: 20190130

Granted publication date: 20170405

Pledgee: China Co truction Bank Corp Guangzhou economic and Technological Development Zone sub branch

Pledgor: Anyka (Guangzhou) Microelectronics Technology Co., Ltd.

Registration number: 2019440000051

PE01 Entry into force of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20200320

Granted publication date: 20170405

Pledgee: China Co truction Bank Corp Guangzhou economic and Technological Development Zone sub branch

Pledgor: ANYKA (GUANGZHOU) MICROELECTRONICS TECHNOLOGY Co.,Ltd.

Registration number: 2019440000051

PC01 Cancellation of the registration of the contract for pledge of patent right
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.

CP01 Change in the name or title 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 3rd floor, area C1, innovation building, 182 science Avenue, Guangzhou Science City, Luogang District, Guangzhou City, Guangdong Province

Patentee before: Guangzhou Ankai Microelectronics Co.,Ltd.

CP02 Change in the address of a patent holder