CN103645990B - A kind of Data Update and read method based on large page Flash - Google Patents

A kind of Data Update and read method based on large page Flash Download PDF

Info

Publication number
CN103645990B
CN103645990B CN201310718814.4A CN201310718814A CN103645990B CN 103645990 B CN103645990 B CN 103645990B CN 201310718814 A CN201310718814 A CN 201310718814A CN 103645990 B CN103645990 B CN 103645990B
Authority
CN
China
Prior art keywords
page
flash
update log
data
described flash
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201310718814.4A
Other languages
Chinese (zh)
Other versions
CN103645990A (en
Inventor
陆舟
于华章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201310718814.4A priority Critical patent/CN103645990B/en
Publication of CN103645990A publication Critical patent/CN103645990A/en
Priority to US15/107,326 priority patent/US10228875B2/en
Priority to PCT/CN2014/094668 priority patent/WO2015096698A1/en
Application granted granted Critical
Publication of CN103645990B publication Critical patent/CN103645990B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention discloses a kind of Data Update and read method based on large page Flash, belong to memory area. Wherein, the method for Data Update comprises: when the Flash page is free page or for free page but remaining space are when sufficient, generate a Update log write the Flash page according to new data more; When the described Flash page is not free page and remaining space when not enough, organize the True Data in the Flash page, and obtain a Update log according to True Data and write new free page; The method that data read comprises: organize the True Data in the Flash page, return to the corresponding data in True Data. Beneficial effect of the present invention is: can improve the efficiency of Data Update, and particularly larger at the Flash page, in the situation that the data volume of renewal is less at every turn, can significantly promote performance and the life-span of Flash.

Description

A kind of Data Update and read method based on large page Flash
Technical field
The present invention relates to memory area, relate in particular to a kind of Data Update based on large page Flash and readMethod.
Background technology
Flash is the one of storage chip, and Flash memory claims again flash memory, and it combines, and ROM(is read-only to be depositedReservoir) and RAM(random access memory) strong point, not only possess the performance of electronics erasable programmable, alsoReading out data fast, can not lose because of power-off data.
Inventor finds realizing in process of the present invention, at least has the following disadvantages: have very in prior artThe page of many Flash chip is very large, for example 2KB/4KB, but in application, need the content of upgrading at every turnFewer, according to current general method, even upgrade the data of several bytes at every turn, also will be againSearch free page, after then the content of parent page being upgraded in RAM, write the new Flash page,Adopt and carry out in this way Data Update, efficiency is low, and can shorten the life-span of Flash.
Summary of the invention
The object of the invention is the defect in order to overcome prior art, propose a kind of number based on large page FlashAccording to upgrading and read method.
The inventive method is achieved through the following technical solutions:
On the one hand, the invention provides a kind of data-updating method based on large page Flash, described method bagDraw together:
Steps A 1: according to scheduler computational logic page number and first page bias internal address, according to new data more,More the length of new data and described first page bias internal address generate Update log, and according to logical page number (LPN) and thingThe corresponding relation of reason page number is searched the Flash page corresponding with described logical page number (LPN) in Flash;
Steps A 2: judging whether the described Flash page is free page, is by the Update log of described generationWrite the described Flash page, finish; Otherwise execution step A3;
Steps A 3: calculate the size of the free area of the described Flash page, and judge the sky of the described Flash pageWhether the size in not busy district is greater than the length of the Update log of described generation, is by the Update log of described generationWrite the free area of the described Flash page, finish; Otherwise execution step A4;
Steps A 4: search new free page in described Flash, according to the renewal day in the described Flash pageThe Update log tissue of will and described generation obtains the True Data in the described Flash page, according to described trueData obtain a Update log and write the new free page finding, and upgrade described logical page number (LPN) and physicsThe corresponding relation of page number, finishes.
Further, between described steps A 2 and described steps A 3, can also comprise: judge described FlashWhether the page is write full, is to perform step A4, otherwise execution step A3;
Particularly, describedly judge whether the described Flash page is write and full specifically comprise: calculate the described Flash pageThe byte number having used, and judge whether the byte number that the described Flash page has used has reached described FlashThe size of the page is that the described Flash page is write full; Otherwise the described Flash page is not write full; Wherein, instituteState and calculate the byte number that used of the described Flash page and specifically comprise: travel through the described Flash page, record instituteState the length of the each Update log in the Flash page, be no less than continuously second default several value and be when findingWhen the byte of preset value, calculate each Update log length and, obtain the byte that the described Flash page has usedNumber.
Further, judge whether the described Flash page is that free page comprises: read the described Flash page fromThe data of first default several byte that initial address starts, whether each byte data that judgement readsBeing preset value, be that the described Flash page is free page, otherwise the described Flash page is not free page.
Further, the size of the free area of the described Flash page of described calculating specifically comprises: described in traversalThe Flash page, records the length of the each Update log in the described Flash page, when finding continuous being no less thanWhen byte that second default several value are preset value, calculate each Update log length and, obtain described FlashThe byte number that the page has used, deducts the word that the described Flash page has used by the size of the described Flash pageJoint number obtains the size of the free area of the described Flash page.
Further, described according to the Update log group of the Update log in the described Flash page and described generationKnitting the True Data obtaining in the described Flash page specifically comprises:
Step B1: initialize the big or small memory headroom that equals described Flash page-size;
Step B2: read one by one the Update log in the described Flash page, and according to the renewal day readingFirst page bias internal address in will, with internal memory sky described in the renewal data replacement in the Update log readingBetween in corresponding data;
Step B3: read the Update log of described generation, according to the first page in the Update log of described generationBias internal address, with the corresponding data in the renewal data replacement memory headroom in the Update log of described generation,Obtain the True Data in the described Flash page;
Particularly, described step B2 specifically comprises:
Step C1: order reads a Update log in the described Flash page, as current Update log;
Step C2: according to the first page bias internal address in current Update log, with in current Update logCorresponding data described in renewal data replacement in memory headroom;
Step C3: judging the Update log whether not reading in addition in the described Flash page, is to return to stepRapid C1, otherwise execution step B3;
Wherein, describedly judge that the Update log whether not reading in addition in the described Flash page specifically comprises: sentenceWhether after disconnected current Update log, be to be no less than the byte that second default several value is preset value, be instituteState the Update log not reading in the Flash page, otherwise have the renewal of not reading in the described Flash pageDaily record.
Further, describedly obtain a Update log according to described True Data and specifically comprise: according to describedThe data initial address of the length of True Data, described True Data and described new free page obtains one moreNew daily record.
Further, describedly in Flash, search with described according to the corresponding relation of logical page number (LPN) and physical page numberThe Flash page that logical page number (LPN) is corresponding specifically comprises: search logical page number (LPN) physical page number table, obtain patrolling with describedCollect physical page number corresponding to page number, in Flash, search the physical page corresponding with described physical page number, obtainThe Flash page corresponding with described logical page number (LPN);
Particularly, the corresponding relation of described renewal logical page number (LPN) and physical page number specifically comprises: by described logicIn page number physical page number table, the physical page number corresponding with described logical page number (LPN) repaiied by the page number of the described Flash pageChange the page number of described new free page into.
On the other hand, the present invention also provides a kind of method for reading data based on large page Flash, described sideMethod comprises:
Step D1: according to reading address computational logic page number and second page bias internal address, according to logical page number (LPN)In Flash, search the Flash page corresponding with described logical page number (LPN) with the corresponding relation of physical page number;
Step D2: initialize the big or small memory headroom that equals described Flash page-size, described in reading one by oneUpdate log in the Flash page, and according to the first page bias internal address in the Update log reading, useCorresponding data described in renewal data replacement in the Update log reading in memory headroom, described in obtainingTrue Data in the Flash page;
Step D3: return in the True Data in the described Flash page with described second page bias internal address andRead the corresponding data of length.
Further, described step D2 specifically comprises:
Step e 1: order reads a Update log in the described Flash page, as current Update log;
Step e 2: according to the first page bias internal address in current Update log, with in current Update logCorresponding data described in renewal data replacement in memory headroom;
Step e 3: judging the Update log whether not reading in addition in the described Flash page, is to return to stepRapid E1, otherwise execution step D3;
Preferably, describedly judge that the Update log whether not reading in addition in the described Flash page specifically comprises:Judging whether current Update log is to be no less than the byte that second default several value is preset value afterwards, isThe Update log not reading in the described Flash page, otherwise do not read more in the described Flash pageNew daily record.
Further, describedly judge that the Update log whether not reading in addition in the described Flash page specifically comprises:Judging whether current Update log is to be no less than the byte that second default several value is preset value afterwards, isThe Update log not reading in the described Flash page, otherwise do not read more in the described Flash pageNew daily record.
The beneficial effect of the inventive method is, adopts method provided by the invention can improve Data UpdateEfficiency, particularly larger at the Flash page, in the situation that the data volume of renewal is less at every turn, can significantly carryRise performance and the life-span of Flash.
Brief description of the drawings
For the clearer explanation embodiment of the present invention or technical scheme of the prior art, below will be to institute in embodiment or description of the Prior ArtNeed the accompanying drawing using to be briefly described, apparently, the accompanying drawing in the following describes is only some embodiments of the present invention, for thisField those of ordinary skill, is not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
The flow chart of a kind of data-updating method based on large page Flash that Fig. 1 provides for the embodiment of the present invention one;
Fig. 2 is the schematic diagram when Flash page is free page described in the embodiment of the present invention one;
Fig. 3 is the schematic diagram that writes the described Flash page after Update log in the Flash page shown in Fig. 2;
Fig. 4 is a kind of schematic diagram when Flash page is free page described in the embodiment of the present invention one;
Fig. 5 is the schematic diagram that writes the described Flash page after Update log in the Flash page shown in Fig. 4;
Fig. 6 is the another kind of schematic diagram when Flash page is free page described in the embodiment of the present invention one;
Fig. 7 is the refinement flow chart of step 111 in the embodiment of the present invention one;
Fig. 8 is the refinement flow chart of step 111-2 in the embodiment of the present invention one;
Fig. 9 is the schematic diagram of free page new in the embodiment of the present invention one;
Figure 10 is the schematic diagram that writes described new free page after Update log to the new free page shown in Fig. 9;
The flow chart of a kind of method for reading data based on large page Flash that Figure 11 provides for the embodiment of the present invention two;
Figure 12 is the refinement flow chart of step 204 in the embodiment of the present invention two.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clearlyChu, intactly description, obviously, described embodiment is only the present invention's part embodiment, instead ofWhole embodiment. Based on the embodiment in the present invention, those skilled in the art are not making creative laborThe every other embodiment obtaining under moving prerequisite, belongs to the scope of protection of the invention.
A kind of Data Update and read method based on large page Flash provided by the invention, whole by FlashIndividual physical page is as daily record region, for storage update daily record, when the number that need to upgrade in this physical pageAccording to time, directly add the less important data that write of minute book maybe need upgrade content Update log to shouldIn physical page, after this physical page is write completely, search new free page, by the free page findingReplace this physical page; When need to read in this physical page data time, read one by one in this physical pageDaily record, arrange and obtain True Data in this physical page, return to the content that will read.
Embodiment mono-
Referring to Fig. 1, the embodiment of the present invention one provides a kind of data-updating method based on large page Flash, bagDraw together and call renewal function, to import in described renewal function new data more, more new data length and upgrade groundLocation (this scheduler is logical address), described renewal function receives the more new data that imports into, new data moreLength and scheduler after carry out following steps:
Step 101: according to scheduler computational logic page number and page bias internal address;
For example, in the present embodiment, the size of physical page and logical page (LPAGE) is 4KB, and scheduler is0x1400, logical page number (LPN)=| 0x1400/0x1000|=1, page bias internal address=0x1400-1*0x1000=0x0400.
Step 102: search the Flash page corresponding with described logical page number (LPN);
Particularly, in the present embodiment, step 102 comprises, exists according to logical page number (LPN) and physical page number corresponding relationIn Flash, search the Flash page corresponding with described logical page number (LPN);
Preferably, in the present embodiment, step 102 comprises, searches logical page number (LPN) physical page number table, obtains and instituteState the physical page number that logical page number (LPN) is corresponding, in Flash, search the physical page corresponding with described physical page number,Obtain the Flash page corresponding with described logical page number (LPN).
Step 103: according to more new data, more length and the generation renewal day of described page bias internal address of new dataWill;
Particularly, in the present embodiment, step 103 comprises: according to " more length+page bias internal of new data groundLocation+more new data " form generate Update log;
Preferably, in the present embodiment, by the more length of new data of data representation of two bytes, with two wordsThe data representation page bias internal address of joint;
For example, in the present embodiment, if page bias internal address is 0x0400, more new data is 0x313233343536, the Update log generating is: 0x00060400313233343536;
More preferably, in the present embodiment, the least significant end of Update log can also arrange check bit;
Further, in the present embodiment, the order interchangeable of step 102 and step 103.
Step 104: judge whether the described Flash page is free page, is to perform step 105, otherwise carry outStep 106;
Particularly, in the present embodiment, judge whether the described Flash page is that free page comprises: read described FlashThe data of first default several byte that the page starts from initial address, each byte number that judgement readsAccording to whether being preset value, be that the described Flash page is free page, otherwise the described Flash page not emptyNot busy page;
Preferably, in the present embodiment, described first default several byte is two bytes; Preset value is 0xFF;
For example, in the present embodiment, read the data of two bytes that the described Flash page starts from initial address,If the data that read be 0xFFFF the described Flash page be free page, otherwise the described Flash page is notFree page.
Step 105: the Update log of generation is write to the described Flash page, finish;
For example,, in the present embodiment: the described Flash page is free page as shown in Figure 2; The renewal day generatingWill is 0x00060400313233343536; The Update log of generation is write the described Flash page itAfter, the described Flash page is as shown in Figure 3.
Step 106: judge whether the described Flash page is write completely, is to perform step 110, otherwise execution step107;
Particularly, in the present embodiment, judge whether the described Flash page is write completely to comprise:
Step 106-1: calculate the byte number that the described Flash page has used;
Particularly, step 106-1 comprises: travel through the described Flash page, record each in the described Flash pageThe length of Update log, when finding while being no less than continuously the byte that second default several value is preset value,Calculate each Update log length and, obtain the byte number that the described Flash page has used;
Preferably, second default several byte is two bytes, and preset value is 0xFF;
Step 106-2: judge whether the byte number that the described Flash page has used has reached the described Flash pageSize, be that the described Flash page is write fullly, otherwise that the described Flash page is not write is full;
For example, in the present embodiment, the size of the described Flash page is 4KB, and 4096 bytes, work as instituteState when byte number that the Flash page used reaches 4096 bytes, represent log area write full, as described FlashWhen the byte number that the page has used does not reach 4096 byte, represent that the described Flash page do not write full;
Further, in the present embodiment, can omit directly execution step 107 of step 106.
Step 107: the size of calculating the free area of the described Flash page;
Particularly, in the present embodiment, the size of calculating the free area of the described Flash page comprises: described in traversalThe Flash page, records the length of the each Update log in the described Flash page, when finding continuous being no less thanWhen byte that second default several value are preset value, calculate each Update log length and, obtain described FlashThe byte number that the page has used, deducts the word that the described Flash page has used by the size of the described Flash pageJoint number obtains the size of the free area of the described Flash page;
Preferably, in the present embodiment, second default several byte is two bytes, and preset value is 0xFF;
For example,, in the present embodiment, if the byte number that the described Flash page calculating has used is 32Byte, the size of the described Flash page is 4096 bytes, the size of the free area of the described Flash pageByte=4064 ,=4096 byte-32 byte.
Step 108: whether the size that judges the free area of the described Flash page is greater than the Update log of generationLength, is to perform step 109, otherwise execution step 110;
Step 109: the Update log of generation is written to the free area of the described Flash page, finishes;
For example, in the present embodiment, the described Flash page as shown in Figure 4, comprises two Update logs, respectivelyFor: 0x80000000444444444444...(is the 0x44 of totally 2048 bytes) and 0x04008000555555555555...(the 0x55 of totally 2048 bytes), the Update log of generation is 0x00060400313233343536, the Update log of generation is written to behind the free area of the described Flash page to described FlashThe page as shown in Figure 5.
Step 110: search new free page;
In the present embodiment, write failure if search less than new free page, finish.
Step 111: obtain institute according to the Update log tissue of the Update log in the described Flash page and generationState the True Data in the Flash page;
For example, in the present embodiment, the described Flash page as shown in Figure 6, comprises three Update log: 0x800000444444444444...(the 0x44 of totally 2048 bytes), 0x0080005555555555...(is commonThe 0x55 of 1024 bytes) and the 0x03EE0C00666666666666...(0x66 of totally 1006 bytes),The Update log generating is 0x00060400313233343536, the described Flash page that tissue obtainsIn True Data be: 0x444444...(the 0x44 of totally 1024 bytes) 313233343536444444...(0x44 of totally 1018 bytes) the 555555...(0x55 of totally 1024 bytes) 666666...(totally 1006The 0x66 of individual byte);
As shown in Figure 7, in the present embodiment, step 111 specifically comprises:
Step 111-1: initialize the big or small memory headroom that equals described Flash page-size;
Particularly, in the present embodiment, the data in initialized memory headroom are preset value;
Preferably, in the present embodiment, preset value is 0xFF;
For example, in the present embodiment, the size of the described Flash page is 4KB, initializes 4KB sizeMemory headroom.
Step 111-2: read one by one the Update log in the described Flash page, and according in Update logPage bias internal address, with the corresponding data in the renewal data replacement memory headroom in Update log;
Particularly, as shown in Figure 8, in the present embodiment, step 111-2 comprises:
Step a1: order reads a Update log in the described Flash page, as current Update log;
Step a2: according to the page bias internal address in current Update log, with the renewal in current Update logCorresponding data described in data replacement in memory headroom;
For example,, in the present embodiment, if current Update log is totally 2048 of 0x80000000444444...(The 0x44 of byte), the page bias internal address in current Update log is 0x0000, more new data is 0x444444...(the 0x44 of totally 2048 bytes), according to the page bias internal address 0x0000 in current Update log, willThe data replacement of 2048 bytes of the 1st byte to the in described memory headroom is that 0x444444...(is total toThe 0x44 of 2048 bytes);
Step a3: judging the Update log whether not reading in addition in the described Flash page, is to return to stepA1, otherwise execution step 111-3;
Particularly, in the present embodiment, judge the Update log bag whether not reading in addition in the described Flash pageDraw together: judge whether current Update log is to be no less than the byte that second default several value is preset value afterwards,Be the Update log not reading in the described Flash page, otherwise do not read in the described Flash pageUpdate log;
Preferably, in the present embodiment, second default several byte is two bytes, and preset value is 0xFF;
Step 111-3: read the Update log of generation, according to the page bias internal address in the Update log generating,With the corresponding data in the renewal data replacement memory headroom in the Update log generating, obtain described Flash pageTrue Data in face.
For example, in the present embodiment, the Update log of generation is 0x00060400313233343536,Page bias internal address in the Update log generating is 0x0400, and more new data is 0x313233343536,According to the page bias internal address 0x0400 in the Update log generating, by the 1025th in described memory headroomThe data replacement of 1030 bytes of byte to the is 0x313233343536.
Step 112: generate a Update log according to the True Data in the described Flash page, write newFree page, upgrades logical page number (LPN) and physical page number corresponding relation, finishes;
Particularly, in the present embodiment, generate a Update log according to the True Data in the described Flash pageSpecifically comprise: using the True Data in the described Flash page as new data more, according to " the more length of new dataDegree+page bias internal address+more new data " form generate Update log;
Preferably, in the present embodiment, by the more length of new data of data representation of two bytes, with two wordsThe data representation page bias internal address of joint;
For example, in the present embodiment, the True Data in the described Flash page is 0x444444...(totally 1024The 0x44 of individual byte) the 313233343536444444...(0x44 of totally 1018 bytes) 555555...(0x55 of totally 1024 bytes) the 666666...(0x66 of totally 1006 bytes), the renewal day generatingWill is the 0x0FEE0000444444...(0x44 of totally 1024 bytes) 313233343536444444...(0x44 of totally 1018 bytes) the 555555...(0x55 of totally 1024 bytes) 666666...(totally 1006The 0x66 of individual byte); In the present embodiment, new free page as shown in Figure 9, will be according in the described Flash pageThe Update log that generates of True Data write described new free page after, shown in new free page as Figure 10Shown in;
More preferably, in the present embodiment, the least significant end of Update log can also arrange check bit;
Particularly, in the present embodiment, upgrade logical page number (LPN) and physical page number corresponding relation and specifically comprise: will patrolCollect in page number physical page number table, the physical page number corresponding with described logical page number (LPN) is by the page number of the described Flash pageBe revised as the page number of described new free page;
In the present embodiment, after step 112, to the handling process of the described Flash page not at this patent categoryIn, wherein, the handling process of the described Flash page is included but not limited to, remove in the described Flash pageData, make it to become free page; Further, power down protection mechanism can also be set, in step 112Before, first described Flash renewal of the page is become to backed-up pages, then perform step 112, pending complete step 112After remove again the data in the described Flash page, make it to become free page.
Embodiment bis-
Referring to Figure 11, the present embodiment two provides a kind of method for reading data based on large page Flash, this enforcementLarge page Flash in example two adopts the method providing in embodiment mono-to carry out Data Update; Described method comprisesCall function reading, to import in described function reading reading address (this reading address is logical address) andRead length, described function reading is carried out following steps after receiving the reading address importing into and reading length:
Step 201: according to reading address computational logic page number and page bias internal address;
For example, in the present embodiment, the size of physical page and logical page (LPAGE) is 4KB, and reading address is0x1400, logical page number (LPN)=| 0x1400/0x1000|=1, page bias internal address=0x1400-1*0x1000=0x0400.
Step 202: search the Flash page corresponding with described logical page number (LPN);
Particularly, in the present embodiment, step 202 comprises, exists according to logical page number (LPN) and physical page number corresponding relationIn Flash, search the Flash page corresponding with described logical page number (LPN);
Preferably, in the present embodiment, step 202 comprises, searches logical page number (LPN) physical page number table, obtains and instituteState the physical page number that logical page number (LPN) is corresponding, in Flash, search the physical page corresponding with described physical page number,Obtain the Flash page corresponding with described logical page number (LPN).
Step 203: initialize the big or small memory headroom that equals described Flash page-size;
Preferably, in the present embodiment, the data in initialized memory headroom are 0xFF;
For example, in the present embodiment, the size of the described Flash page is 4KB, initializes 4KB sizeMemory headroom.
Step 204: read one by one the Update log in the described Flash page, and according to the page in Update logBias internal address, with the corresponding data in the renewal data replacement memory headroom in Update log, described in obtainingTrue Data in the Flash page;
For example, in the present embodiment, the described Flash page comprises three Update log: 0x800000444444444444...(the 0x44 of totally 2048 bytes), 0x0080005555555555...(totally 1024 wordsThe 0x55 of joint) and the 0x03EE0C00666666666666...(0x66 of totally 1006 bytes), generateUpdate log be 0x00060400313233343536, in the described Flash page that obtains of tissueTrue Data is: 0x444444...(is the 0x44 of totally 1024 bytes) 313233343536444444...(0x44 of totally 1018 bytes) the 555555...(0x55 of totally 1024 bytes) 666666...(totally 1006The 0x66 of individual byte);
Particularly, as shown in figure 12, in the present embodiment, step 204 comprises:
Step 204-1: order reads a Update log in the described Flash page, as current renewal dayWill;
Step 204-2: according in current Update log page bias internal address, with in current Update log moreNew data is replaced the corresponding data in described memory headroom;
For example,, in the present embodiment, if current Update log is totally 2048 of 0x80000000444444...(The 0x44 of byte), the page bias internal address in current Update log is 0x0000, more new data is 0x444444...(the 0x44 of totally 2048 bytes), according to the page bias internal address 0x0000 in current Update log, willThe data replacement of 2048 bytes of the 1st byte to the in described memory headroom is that 0x444444...(is total toThe 0x44 of 2048 bytes);
Step 204-3: judging the Update log whether not reading in addition in the described Flash page, is to returnStep 204-1, otherwise obtain the True Data in the described Flash page, execution step 205;
Particularly, in the present embodiment, judge the Update log bag whether not reading in addition in the described Flash pageDraw together: judge whether current Update log is to be no less than the byte that second default several value is preset value afterwards,Be the Update log not reading in the described Flash page, otherwise do not read in the described Flash pageUpdate log;
Preferably, in the present embodiment, second default several byte is two bytes, and preset value is 0xFF.
Step 205: return in the True Data in the described Flash page with described page bias internal address and described inRead the corresponding data of length, finish.
For example, the True Data in the described Flash page is: 0x444444...(is the 0x44 of totally 1024 bytes)313233343536444444...(the 0x44 of totally 1018 bytes) 555555...(totally 1024 bytes0x55) the 666666...(0x66 of totally 1006 bytes), described page bias internal address is 0x0400, readsGetting length is 8 bytes, by 1032 the byte (0x of the 1025th byte to the in the described Flash page3132333435364444) return.
Above-described embodiment is more preferably detailed description of the invention of the present invention, those skilled in the artThe common variation of carrying out within the scope of technical solution of the present invention and replacement all should be included in protection scope of the present inventionIn.

Claims (16)

1. the data-updating method based on large page Flash, is characterized in that, comprising:
Steps A 1: according to scheduler computational logic page number and first page bias internal address, according to new data more,More the length of new data and described first page bias internal address generate Update log, and according to logical page number (LPN) and thingThe corresponding relation of reason page number is searched the Flash page corresponding with described logical page number (LPN) in Flash;
Steps A 2: judging whether the described Flash page is free page, is the Update log of described generation to be writeEnter the described Flash page, finish; Otherwise execution step A3;
Steps A 3: calculate the size of the free area of the described Flash page, and judge the sky of the described Flash pageWhether the size in not busy district is greater than the length of the Update log of described generation, is by the Update log of described generationWrite the free area of the described Flash page, finish; Otherwise execution step A4;
Steps A 4: search new free page in described Flash, according to the renewal day in the described Flash pageThe Update log tissue of will and described generation obtains the True Data in the described Flash page, according to described trueData obtain a Update log and write the new free page finding, and upgrade described logical page number (LPN) and physicsThe corresponding relation of page number, finishes.
2. method according to claim 1, is characterized in that, judges whether the described Flash page is emptyNot busy page specifically comprises: the number that reads first default several byte that the described Flash page starts from initial addressAccording to, whether each byte data that judgement reads is preset value, is that the described Flash page is free page,Otherwise the described Flash page is not free page.
3. method according to claim 1, is characterized in that, described steps A 2 and described steps A 3Between also comprise: judge whether the described Flash page is write fullly, is to perform step A4, otherwise execution stepA3。
4. method according to claim 3, is characterized in that, the described Flash page of described judgement isNo writing completely specifically comprises: calculate the byte number that the described Flash page has used, and judge the described Flash pageWhether the byte number having used has reached the size of the described Flash page, is that the described Flash page is write full;Otherwise the described Flash page is not write full.
5. method according to claim 4, is characterized in that, the described Flash page of described calculatingThe byte number using specifically comprises: travel through the described Flash page, record the each renewal in the described Flash pageThe length of daily record, when finding while being no less than continuously the byte that second default several value is preset value, calculatesThe length of each Update log and, obtain the byte number that the described Flash page has used.
6. method according to claim 1, is characterized in that, the described Flash page of described calculatingThe size of free area specifically comprises: travel through the described Flash page, record the each renewal in the described Flash pageThe length of daily record, continuous while being no less than the byte that second default several value is preset value when finding, meterCalculate each Update log length and, obtain the byte number that the described Flash page has used, with described Flash pageThe size of face deducts byte number that the described Flash page used and obtains free area large of the described Flash pageLittle.
7. method according to claim 1, is characterized in that, described according in the described Flash pageUpdate log and the True Data that obtains in the described Flash page of the Update log tissue of described generation specifically wrapDraw together:
Step B1: initialize the big or small memory headroom that equals described Flash page-size;
Step B2: read one by one the Update log in the described Flash page, and according to the Update log readingIn first page bias internal address, with memory headroom described in the renewal data replacement in the Update log readingIn corresponding data;
Step B3: read the Update log of described generation, according to the first page in the Update log of described generationBias internal address, with the corresponding data in the renewal data replacement memory headroom in the Update log of described generation,Obtain the True Data in the described Flash page.
8. method according to claim 7, is characterized in that, described step B2 specifically comprises:
Step C1: order reads a Update log in the described Flash page, as current Update log;
Step C2: according to the first page bias internal address in current Update log, with in current Update logCorresponding data described in renewal data replacement in memory headroom;
Step C3: judging the Update log whether not reading in addition in the described Flash page, is to return to stepC1, otherwise execution step B3.
9. method according to claim 8, is characterized in that, in the described Flash page of described judgementWhether the Update log whether not reading in addition specifically comprises: judge after current Update log for being no less than theTwo default bytes that several values are preset value, are the Update logs not reading in the described Flash page,Otherwise there is the Update log not reading in the described Flash page.
10. method according to claim 1, is characterized in that, describedly obtains according to described True DataArticle one, Update log specifically comprises: according to the length of described True Data, described True Data and described newThe data initial address of free page obtains a Update log.
11. method according to claim 1, is characterized in that, described according to logical page number (LPN) and Physical PageNumber corresponding relation in Flash, search the Flash page corresponding with described logical page number (LPN) and specifically comprise: searchLogical page number (LPN) physical page number table, obtains the physical page number corresponding with described logical page number (LPN), in Flash, search withThe physical page that described physical page number is corresponding, obtains the Flash page corresponding with described logical page number (LPN).
12. method according to claim 11, is characterized in that, described renewal logical page number (LPN) and physicsThe corresponding relation of page number specifically comprises: by described logical page number (LPN) physical page number table, with described logical page number (LPN) pairThe physical page number of answering is revised as the page number of described new free page by the page number of the described Flash page.
13. based on a method for reading data of large page Flash, comprising:
Step D1: according to reading address computational logic page number and second page bias internal address, according to logical page number (LPN)In Flash, search the Flash page corresponding with described logical page number (LPN) with the corresponding relation of physical page number;
Step D2: initialize the big or small memory headroom that equals described Flash page-size, described in reading one by oneUpdate log in the Flash page, and according to the first page bias internal address in the Update log reading, useCorresponding data described in renewal data replacement in the Update log reading in memory headroom, described in obtainingTrue Data in the Flash page;
Step D3: return in the True Data in the described Flash page with described second page bias internal address andRead the corresponding data of length.
14. method according to claim 13, is characterized in that, described step D2 specifically comprises:
Step e 1: order reads a Update log in the described Flash page, as current Update log;
Step e 2: according to the first page bias internal address in current Update log, with in current Update logCorresponding data described in renewal data replacement in memory headroom;
Step e 3: judging the Update log whether not reading in addition in the described Flash page, is to return to stepE1, otherwise execution step D3.
15. method according to claim 14, is characterized in that, in the described Flash page of described judgementWhether the Update log whether not reading in addition specifically comprises: judge after current Update log for being no less than theTwo default bytes that several values are preset value, are the Update logs not reading in the described Flash page,Otherwise there is the Update log not reading in the described Flash page.
16. method according to claim 13, is characterized in that, described according to logical page number (LPN) and physicsThe corresponding relation of page number is searched the Flash page corresponding with described logical page number (LPN) and is specifically comprised in Flash: look intoLook for logical page number (LPN) physical page number table, obtain the physical page number corresponding with described logical page number (LPN), in Flash, searchThe physical page corresponding with described physical page number, obtains the Flash page corresponding with described logical page number (LPN).
CN201310718814.4A 2013-12-24 2013-12-24 A kind of Data Update and read method based on large page Flash Expired - Fee Related CN103645990B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201310718814.4A CN103645990B (en) 2013-12-24 2013-12-24 A kind of Data Update and read method based on large page Flash
US15/107,326 US10228875B2 (en) 2013-12-24 2014-12-23 Data writing and reading methods for flash
PCT/CN2014/094668 WO2015096698A1 (en) 2013-12-24 2014-12-23 Data writing and reading methods for flash

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310718814.4A CN103645990B (en) 2013-12-24 2013-12-24 A kind of Data Update and read method based on large page Flash

Publications (2)

Publication Number Publication Date
CN103645990A CN103645990A (en) 2014-03-19
CN103645990B true CN103645990B (en) 2016-05-25

Family

ID=50251211

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310718814.4A Expired - Fee Related CN103645990B (en) 2013-12-24 2013-12-24 A kind of Data Update and read method based on large page Flash

Country Status (1)

Country Link
CN (1) CN103645990B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015096698A1 (en) * 2013-12-24 2015-07-02 飞天诚信科技股份有限公司 Data writing and reading methods for flash
CN113380308B (en) * 2021-06-22 2023-10-27 力高(山东)新能源技术有限公司 Data storage method for simulating EEPROM by using PFLASH software

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1632765A (en) * 2004-12-31 2005-06-29 大唐微电子技术有限公司 A flash memory file system management method
CN101526927A (en) * 2008-03-07 2009-09-09 北京华虹集成电路设计有限责任公司 Data processing method and data processing device of Flash file system
US8285916B2 (en) * 2005-06-06 2012-10-09 Sony Corporation Storage device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1632765A (en) * 2004-12-31 2005-06-29 大唐微电子技术有限公司 A flash memory file system management method
US8285916B2 (en) * 2005-06-06 2012-10-09 Sony Corporation Storage device
CN101526927A (en) * 2008-03-07 2009-09-09 北京华虹集成电路设计有限责任公司 Data processing method and data processing device of Flash file system

Also Published As

Publication number Publication date
CN103645990A (en) 2014-03-19

Similar Documents

Publication Publication Date Title
CN103150258B (en) Writing, reading and garbage collection method of solid-state memory system
CN105843749B (en) A kind of NAND Flash fault-tolerance approach based on FPGA
CN102306125B (en) A kind of data erasing-writing method of FLASH memory
CN103425600B (en) Address mapping method in a kind of solid-state disk flash translation layer (FTL)
CN103729303B (en) A kind of data write of Flash and read method
CN103092766B (en) A kind of loss equalizing implementation method for NAND FLASH
CN102819496B (en) Address translation method of flash FTL (Flash Translation Layer)
CN103164490B (en) A kind of efficient storage implementation method of not fixed-length data and device
WO2015096698A1 (en) Data writing and reading methods for flash
TW201437807A (en) Method of recording mapping information method, and memory controller and memory storage apparatus using the same
CN106354658B (en) A method of it reducing mapping table memory source in mixed-use developments algorithm and occupies
CN104156317A (en) Wiping and writing management method and system for non-volatile flash memory
CN103744713A (en) Autonomous configuration method for FPGA (field programmable gate array)-based embedded dual-core system
CN108073522A (en) Garbage collection method for data storage device
CN102214143A (en) Method and device for managing multilayer unit flash memory, and storage equipment
CN103914397B (en) Flash memory device and its management method
CN104731886A (en) Processing method and system for mass small files
CN106020735A (en) Data storage method and device
CN104317671A (en) Power-down data storage and recovery algorithm prolonging service life of non-volatile memory
CN103365786A (en) Data storage method, device and system
CN103645990B (en) A kind of Data Update and read method based on large page Flash
CN103645993B (en) A kind of Data Update based on large page Flash and read method
CN102521146B (en) Data addressing storage method of flash memory block subdivision
CN102955787A (en) Using method for file directory table, file writing method and main circuit board, CPU (central processing unit) and external storage applying same
CN102650972B (en) Date storage method, Apparatus and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160525

CF01 Termination of patent right due to non-payment of annual fee