CN102073595A - Power failure prevention loss balanced storage method - Google Patents

Power failure prevention loss balanced storage method Download PDF

Info

Publication number
CN102073595A
CN102073595A CN 201110026022 CN201110026022A CN102073595A CN 102073595 A CN102073595 A CN 102073595A CN 201110026022 CN201110026022 CN 201110026022 CN 201110026022 A CN201110026022 A CN 201110026022A CN 102073595 A CN102073595 A CN 102073595A
Authority
CN
China
Prior art keywords
physical block
power failure
block
access times
storage means
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.)
Pending
Application number
CN 201110026022
Other languages
Chinese (zh)
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.)
Huaya Microelectronics Shanghai Inc
Original Assignee
Huaya Microelectronics Shanghai Inc
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 Huaya Microelectronics Shanghai Inc filed Critical Huaya Microelectronics Shanghai Inc
Priority to CN 201110026022 priority Critical patent/CN102073595A/en
Publication of CN102073595A publication Critical patent/CN102073595A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention provides a power failure prevention loss balanced storage method, which comprises the following steps of: scanning a memory, and associating a physical block with a logic block number corresponding to the physical block, and the use frequency of the physical block; judging whether two equal and effective logic block numbers of the physical blocks exist; if so, deleting one of the physical blocks with the smaller use frequency; generating a badblock table, an associative table and a mapping table; judging whether the use frequency of the physical block is greater than a set threshold; if so, searching a used first physical block with the smallest use frequency and a used second physical block with the greatest use frequency, and copying the data of the first physical block into the second physical block; updating the logic block numbers of the first physical block and the second physical block; deleting a source data block and updating the badblock table and the mapping data. By the method, the memory, under the condition of power failure, can automatically recover a loss balanced storage process after being powered up so as to better increase the storage use frequency of the memory and improve the effectiveness of the loss balanced storage.

Description

The loss balancing storage means of anti-power failure
Technical field
The present invention relates to a kind of storage means, relate more specifically to a kind of loss balancing storage means of anti-power failure.
Background technology
Along with developing rapidly and widespread use of memory device, need in a large number a kind ofly can to realize repeatedly programming, capacity is big, read and write, wipe quick and easy, simple, the memory device that peripheral components is few, cheap.Flash memory (Flash Memory) storage medium arises at the historic moment under this demand, for example NANDFLASH.Flash memory is based on semi-conductive storer, still can keep internal information after having system's power down, and online functional characteristics such as erasable, is a kind of novel storer of alternative EEPROM storage medium.Because its read or write speed is faster than EEPROM, cost is lower under the situation of same capability, therefore the storage card that constitutes with flash memory (Flash storer) is at present progressively replacing flexible plastic disc, and is used for equipment such as portable computer, digital camera, MP3, MP4 player in a large number.
Nonvolatile memory refers to still can effectively preserve memory of data after the power down in the long duration, as EEPROM, and EPROM, Flash etc.Have non-volatile characteristics based on the Flash storer, in its information safety devices of being everlasting as the carrier of firmware program or data.Information safety devices is a kind of small hardware device that has processor and storer, and it can be connected with computing machine by the data communication interface by computing machine, has the key systematic function, but and the safe storage key, can preset the cryptographic algorithm function.Can only key device relevant with key computing is fully at the device internal operation, and intelligent key apparatus has anti-aggressive characteristic, and security is high.
Yet various types of memory, all be limited the serviceable life that comprises the Flash storer.Specifically, under normal operating condition, be by the maximum erasable number of times decision of erasable block its serviceable life.Surpassed maximum erasable number of times, this erasable block has just become bad piece.Therefore excessively erasable for fear of certain erasable block quilt, to such an extent as to it reaches maximum erasable number of times prior to other erasable block, should consider that under the prerequisite of little performance impact of trying one's best erasable operation is evenly distributed on each erasable block, and this generally is called the storage means of loss balancing.
Yet some characteristics of various types of memory have caused its deficiency, particularly its read-write operation on using to do this difficult problem of anti-power failure protection processing and have never well solved.With the flash memory is example, because the intrinsic characteristic of flash media, when operating in file system on the flash memory at present and will rewrite the sector of a block device, normally the data of this place, sector erasable block are read in the internal memory, be placed in the buffer memory, then content corresponding with this sector in the buffer memory is replaced with new content, again this erasable block is carried out erasable operation, at last the data in the buffer memory are write back this erasable block.
The shortcoming of this implementation is clearly: efficient is low, will rewrite data on the whole erasable block to the renewal of a sector, also causes the very big waste of memory headroom; Loss balancing is not provided, and those will at first be become bad piece by the erasable block at the data place of frequent updating.
Summary of the invention
The invention provides a kind of loss balancing storage means of anti-power failure, to overcome prior art can't realize occurring the cutting off the power supply technical matters of post-equalization flash memory physical block.
For achieving the above object, the present invention adopts following technical scheme:
A kind of loss balancing storage means of anti-power failure comprises the steps: step 1: swept memory, related physical block and logical block number (LBN), the physical block access times corresponding with it; Step 2: the logical block number (LBN) that judges whether to exist two equal and effective physical blocks; If enter step 3 after then deleting the less physical block of one of them access times; If not, then directly enter step 3; Step 3: generate the piece chained list, logical block number (LBN) and intact physical block is corresponding to one by one generating contingency table, and with untapped physical block according to the access times formation mapping table that sorts; Step 4: judge whether to be read operation; If then directly enter step 10; Then enter step 5 if not; Step 5: judge whether to be erase operation; If then enter step 6; If not, then further judge whether to be write operation, be that write operation then carries out entering step 10 behind the write operation, otherwise directly enter step 10; Step 6: whether the access times of judging physical block surpass preset threshold; If then enter step 7; If not, then enter step 10; Step 7: search for one and be used and first physical block that access times are minimum and one have been used and access times are maximum second physical block, with the copying data of first physical block in second physical block; Step 8: the logical block number (LBN) that upgrades described first physical block and second physical block; Step 9: the deletion source block is also upgraded piece chained list and mapping table; Step 10: finish.
Said method has realized that effectively storer is occurring under the powering-off state, in case the back that powers on just can automatically restore in the storing process of loss balancing, has improved the storage access times of storer and the validity of loss balancing storage better.
Description of drawings
Fig. 1 is the process flow diagram of the loss balancing storage means of anti-power failure of the present invention.
Fig. 2 is the form synoptic diagram of the piece chained list in the loss balancing storage means of anti-power failure of the present invention.
Fig. 3 is the synoptic diagram of the contingency table in the loss balancing storage means of anti-power failure of the present invention.
Fig. 4 is the NAND FLASH type memory form synoptic diagram in the loss balancing storage means of anti-power failure of the present invention.
Fig. 5 is the piece chained list in the loss balancing storage means of anti-power failure of the present invention and the synoptic diagram of mapping table.
Embodiment
For the ease of those skilled in the art's understanding, the present invention is described in further detail below in conjunction with specific embodiment and accompanying drawing thereof.
Fig. 1 shows the flow process of the loss balancing storage means of anti-power failure of the present invention.As shown in Figure 1, the present invention includes following step:
1) if program is the operation that powers on for the first time, so at first scan whole storer, spendable physical block (hereinafter to be referred as piece, physical block herein comprise used with untapped) and the bad physical block that can not use in main memory, build up a chained list, (abbreviate BBT as referred to herein as the piece chained list, badblock table), then this piece storage of linked list in reliable physical block.For the such storer of NAND FLASH, generally be to be stored among the block 0.
If program is not the operation that powers on for the first time, check piece chained list (BBT) so? if have,, otherwise operate just as powering on for the first time of front directly during this piece chained list is from the memory read to the main memory.
The form of piece chained list is seen Fig. 2, and the piece chained list comprises the status data that physical block number and this physical block be whether intact and whether used.
2) program is by the physical block in the logical block number (LBN) access block chained list.The all corresponding physical block of each logical block number (LBN), when detecting the physical block damage, it is corresponding with logical block number (LBN) to reselect a physical block.As shown in Figure 3, l has damaged when physical block, the corresponding again physical block number k of logical block number (LBN) 1.So just generate a contingency table, each described logical block number (LBN) is related with the physical block number of an intact physical block.The deposit position of logical block number (LBN) is the backup area of described storer, as shown in Figure 4.
3) deposit position of physical block access times
As shown in Figure 4, if the such storer of NAND FLASH, the access times of each piece are stored in certain page spare area zone so.Generally speaking, only need have the spare area of page 0, remaining page or leaf does not need to preserve this data.
4) scan the position and the logical block number (LBN) of the piece access times of all available physical blocks, obtain the access times and the logical block number (LBN) of all available physical blocks.If the physical block that has two logical block number (LBN)s to equate exists, the data of the minimum physical block of access times are deleted.Access times with physical block are foundation, and untapped physical block rearrangement is generated a chained list, are referred to as mapping table.(can be that the pieces that use came at last at most before the piece of minimum use came; Before also the piece that can use at most came, the piece of minimum use came at last).
5) when physical block being wiped at every turn, if wipe failure, so this piece is labeled as bad physical block, upgrade piece chained list (BBT) simultaneously and this piece storage of linked list in storer; If this physical block also in mapping table, is deleted this physical block so from mapping table.Otherwise the access times of physical block add one, the access times of physical block are written to the position of physical block access times; If this physical block not in mapping table, is inserted into it in the mapping table so, again mapping table is sorted.In erase process, if the access times of physical block surpass certain threshold value (this value is specified by the user), search for the physical block that all have been used so, therefrom find out a physical block that access times are minimum, and the access times of this physical block are less than threshold value.If found such physical block, maximum the data block copy of this physical block so to access times, and physical block that be not used, available, if write failure, this piece is labeled as bad piece, upgrade BBT, it is write among the block 0, repeat searching piece and writing the step of piece just now, if to a last piece, still unsuccessful, then directly return, otherwise proceed down.The logical block number (LBN) of correspondence, write corresponding position at last.Then, the data of the physical block of source data are given are deleted,, so it is inserted in the mapping table if this physical block behind the deleted data is available, otherwise, this physical block is labeled as bad piece, simultaneously this piece storage of linked list in storer.
6) at every turn, at first inquire about the pairing physical block of current logical block and be used when logical block being carried out write operation? if be not used, then from mapping table, find out a minimum physical block of access times and use.Upgrade the mapping relations of logical block number (LBN) and physical block number simultaneously, this physical block is deleted from mapping table.If be used, then use current physical block.
7) in use,, its mark in the piece chained list is come out, again this piece chained list is write in the storer if there is physical block to damage.If this physical block also in mapping table, is deleted this physical block so from mapping table.
The front provides the description to preferred embodiment, so that any technician in this area can use or utilize the present invention.To this preferred embodiment, those skilled in the art can make various modifications or conversion on the basis that does not break away from the principle of the invention.Should be appreciated that these modifications or conversion do not break away from protection scope of the present invention.

Claims (14)

1. the loss balancing storage means of an anti-power failure comprises the steps:
Step 1: swept memory, related physical block and logical block number (LBN), the physical block access times corresponding with it;
Step 2: the logical block number (LBN) that judges whether to exist two equal and effective physical blocks; If enter step 3 after then deleting the less physical block of one of them access times; If not, then directly enter step 3;
Step 3: generate the piece chained list, logical block number (LBN) and intact physical block is corresponding to one by one generating contingency table, and with untapped physical block according to the access times formation mapping table that sorts;
Step 4: judge whether to be read operation; If then directly enter step 10; Then enter step 5 if not;
Step 5: judge whether to be erase operation; If then enter step 6; If not, then further judge whether to be write operation, be that write operation then carries out entering step 10 behind the write operation, otherwise directly enter step 10;
Step 6: whether the access times of judging physical block surpass preset threshold; If then enter step 7; If not, then enter step 10;
Step 7: search for one and be used and first physical block that access times are minimum and one have been used and access times are maximum second physical block, with the copying data of first physical block in second physical block;
Step 8: the logical block number (LBN) that upgrades described first physical block and second physical block;
Step 9: the deletion source block is also upgraded piece chained list and mapping table;
Step 10: finish.
2. the loss balancing storage means of anti-power failure as claimed in claim 1 is characterized in that, described chained list comprises the status data that physical block number and this physical block be whether intact and whether used.
3. the loss balancing storage means of anti-power failure as claimed in claim 2 is characterized in that, described chained list is built in the main memory.
4. the loss balancing storage means of anti-power failure as claimed in claim 3 is characterized in that, described storer is a NAND FLASH storer.
5. the loss balancing storage means of anti-power failure as claimed in claim 4 is characterized in that, described chained list is built among the block 0.
6. the loss balancing storage means of anti-power failure as claimed in claim 4 is characterized in that, described physical block access times are stored in the backup area of storer.
7. the loss balancing storage means of anti-power failure as claimed in claim 4 is characterized in that, described physical block access times are stored in the backup area of page 0 of storer.
8. the loss balancing storage means of anti-power failure as claimed in claim 2, it is characterized in that, the step of described generation contingency table is: at the backup area stored logic piece of described storer number, each described logical block number (LBN) is related with the physical block number of a physical block, when the physical block of association for damage the time, it is related with logical block number (LBN) to reselect physical block.
9. the loss balancing storage means of anti-power failure as claimed in claim 2 is characterized in that, the described write operation that carries out comprises the steps:
Step 9-1: judge whether the pairing physical block of current logical block number (LBN) is used; If not, then enter step 9-2, use current physical block and enter step 9-3 if then continue;
Step 9-2: from mapping table, find out the minimum physical block of access times and use, and upgrade mapping table;
Step 9-3: in the physical block of current use, write data;
Step 9-4: judge whether write operation is successful; If then enter step 10; Then more enter step 10 behind the new physical block chained list if not.
10. the loss balancing storage means of anti-power failure as claimed in claim 2 is characterized in that, when physical block damaged, the piece chained list carried out behind the mark in the write store.
11. the loss balancing storage means of anti-power failure as claimed in claim 10 is characterized in that, when the physical block that damages in mapping table, then this physical block is deleted from mapping table.
12. the loss balancing storage means of anti-power failure as claimed in claim 1 is characterized in that, in the described mapping table, before the minimum physical block of access times came, the physical block that access times are maximum came at last.
13. the loss balancing storage means of anti-power failure as claimed in claim 1 is characterized in that, in the described mapping table, before the physical block that access times are maximum came, the minimum physical block of access times came at last.
14. the loss balancing storage means of anti-power failure as claimed in claim 1 or 2 is characterized in that, after the described erase operation success, the access times that are performed the physical block of erase operation add one.
CN 201110026022 2011-01-24 2011-01-24 Power failure prevention loss balanced storage method Pending CN102073595A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110026022 CN102073595A (en) 2011-01-24 2011-01-24 Power failure prevention loss balanced storage method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110026022 CN102073595A (en) 2011-01-24 2011-01-24 Power failure prevention loss balanced storage method

Publications (1)

Publication Number Publication Date
CN102073595A true CN102073595A (en) 2011-05-25

Family

ID=44032141

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110026022 Pending CN102073595A (en) 2011-01-24 2011-01-24 Power failure prevention loss balanced storage method

Country Status (1)

Country Link
CN (1) CN102073595A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294195A (en) * 2016-07-19 2017-01-04 深圳市瑞耐斯技术有限公司 The control method of a kind of 3D flash memory and system
CN108804033A (en) * 2018-05-18 2018-11-13 记忆科技(深圳)有限公司 Scan full hard disk method, apparatus, computer equipment and the medium continued again based on power-off
CN109685190A (en) * 2018-12-28 2019-04-26 江苏恒宝智能系统技术有限公司 A kind of IC card power-off protection method and device
CN110462577A (en) * 2017-12-28 2019-11-15 华为技术有限公司 A kind of method and solid state hard disk array of data write-in
CN110865772A (en) * 2019-11-11 2020-03-06 深圳忆联信息系统有限公司 Method and device for protecting system data physical block erasure count value, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101354681A (en) * 2008-09-23 2009-01-28 美商威睿电通公司 Memory system, abrasion equilibrium method and apparatus of non-volatile memory
CN101458661A (en) * 2008-12-29 2009-06-17 北京飞天诚信科技有限公司 Flash memory block abrasion equilibration method and system
US20100185805A1 (en) * 2007-07-05 2010-07-22 Actions Semiconductor Co., Ltd. Method And Apparatus For Performing Wear Leveling In Memory

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100185805A1 (en) * 2007-07-05 2010-07-22 Actions Semiconductor Co., Ltd. Method And Apparatus For Performing Wear Leveling In Memory
CN101354681A (en) * 2008-09-23 2009-01-28 美商威睿电通公司 Memory system, abrasion equilibrium method and apparatus of non-volatile memory
CN101458661A (en) * 2008-12-29 2009-06-17 北京飞天诚信科技有限公司 Flash memory block abrasion equilibration method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《浙江工业大学学报》 20090228 黄德才等 闪存磨损均衡算法综述 73-78 1-14 第37卷, 第1期 2 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294195A (en) * 2016-07-19 2017-01-04 深圳市瑞耐斯技术有限公司 The control method of a kind of 3D flash memory and system
CN106294195B (en) * 2016-07-19 2019-06-21 深圳市领存技术有限公司 A kind of control method and system of 3D flash memory
CN110462577A (en) * 2017-12-28 2019-11-15 华为技术有限公司 A kind of method and solid state hard disk array of data write-in
US11243701B2 (en) 2017-12-28 2022-02-08 Huawei Technologies Co., Ltd. Data write method and solid-state drive array
CN108804033A (en) * 2018-05-18 2018-11-13 记忆科技(深圳)有限公司 Scan full hard disk method, apparatus, computer equipment and the medium continued again based on power-off
CN108804033B (en) * 2018-05-18 2021-04-20 记忆科技(深圳)有限公司 Full-disk scanning method and device based on power-off continuation, computer equipment and medium
CN109685190A (en) * 2018-12-28 2019-04-26 江苏恒宝智能系统技术有限公司 A kind of IC card power-off protection method and device
CN109685190B (en) * 2018-12-28 2022-04-12 江苏恒宝智能系统技术有限公司 Power-down protection method and device for IC card
CN110865772A (en) * 2019-11-11 2020-03-06 深圳忆联信息系统有限公司 Method and device for protecting system data physical block erasure count value, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN100462944C (en) Power-fail protection method based on two continuous logical blocks for non-volatile memory
CN102591807B (en) Processing method for power down and abnormal writing of solid state disc and system
US10452535B2 (en) Method for reusing destination block related to garbage collection in memory device, associated memory device and controller thereof, and associated electronic device
US10552311B2 (en) Recovery for non-volatile memory after power loss
CN101876949B (en) Date memorizing system and method thereof
KR100725410B1 (en) Apparatus and method for executing garbage collection of non volatile memory according to power state
CN103136116B (en) Storage system and control device, management method and power interruption recovering method
TWI524183B (en) Data writing method, memory control circuit unit and memory storage apparatus
CN102999430B (en) Process has not closing completely of the system of nonvolatile memory
CN102004706B (en) Flash erasing power-fail protection method based on FTL(Flash Translation Layer)
CN100511166C (en) High-speed storage device and method for high-speed updating data
CN106776376B (en) Buffer storage supervisory method, memorizer control circuit unit and storage device
TWI454916B (en) Storage unit management method, memory controller and memory storage device using the same
US8874830B2 (en) Method for controlling memory array of flash memory, and flash memory using the same
CN102073595A (en) Power failure prevention loss balanced storage method
CN102609334B (en) Nonvolatile flash memory is wiped abnormal memory block restorative procedure and device
KR20110046243A (en) User device and its mapping data management method
CN101673243B (en) Data storage device and method
CN101963891A (en) Method and device for data storage and processing, solid-state drive system and data processing system
KR20110089728A (en) Error control method of solid state drive
CN101539891A (en) Embedded type flash memory, storage system and method for power fail safeguard of data
CN110362499B (en) Electronic machine and control method thereof, computer system and control method thereof, and control method of host
US9524212B2 (en) Method, device and operating system for processing and using burn data of NAND flash
US20150149692A1 (en) Efficient reuse of segments in nonoverwrite storage systems
CN100456253C (en) Protection method for caching data of memory system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20110525