CN103064792A - Method and device for writing data - Google Patents

Method and device for writing data Download PDF

Info

Publication number
CN103064792A
CN103064792A CN2012105750908A CN201210575090A CN103064792A CN 103064792 A CN103064792 A CN 103064792A CN 2012105750908 A CN2012105750908 A CN 2012105750908A CN 201210575090 A CN201210575090 A CN 201210575090A CN 103064792 A CN103064792 A CN 103064792A
Authority
CN
China
Prior art keywords
data block
data
writing
wiping
flash memory
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
CN2012105750908A
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.)
Innofidei Technology Co Ltd
Original Assignee
Innofidei 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 Innofidei Technology Co Ltd filed Critical Innofidei Technology Co Ltd
Priority to CN2012105750908A priority Critical patent/CN103064792A/en
Publication of CN103064792A publication Critical patent/CN103064792A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Read Only Memory (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention provides a method and device for writing data. The data writing method includes: receiving data writing commands for writing data to a repeatedly erasable memory, and determining a first data block of data to be written in the repeatedly erasable memory according to the data writing commands; obtaining erasing/writing times of the first data block, when the erasable/writing times of the first data block reach a set threshold, selecting a second data block from other data blocks of the repeatedly erasable memory, wherein the erasable/writing times of the second data block do not reach the set threshold; exchanging data in the first data block and data in the second data block; and writing the data to the second data block after data exchange according to the data writing commands. By means of the method and device, an effect of effectively using memory performance of the repeatedly erasable memory is achieved.

Description

Method for writing data and device
Technical field
The present invention relates to communication technical field, particularly relate to a kind of method for writing data and device.
Background technology
Data card can be exported a lot of information when work and debugging.With LTE(Long Term Evolution, Long Term Evolution) data card is example, the LTE data card has a lot of LOG(daily records when work and debugging) information output, analyze debugging for the research staff.As a rule, can pass through the HOST(PC/ development board), the LOG information exchange is crossed virtual serial port derive.But in some situation, but there is not operation interface (such as the equipment of MIFI one class) such as development board, when perhaps being used for other unit's Meter Test, measuring unit does not provide in the situation of the service of assisting extraction LOG information, is necessary LOG information is preserved with the form of file.
At present in various systems, no matter FAT file system compatible relatively good is WINDOWS or Linux and other embedded system such as WINCE, and the FAT file system can be accepted.Therefore, when preserving LOG information with document form, can hardware using repeatedly flash memory such as nand memory, and adopt the FAT file system to preserve LOG information.
But during flash memory, take nand memory as example, because the problem of electronic component technique, nand memory exists to be wiped/the write operation life-span hardware using repeatedly.Use at present NAND wipe/during write operation, take the BLOCK(data block) be unit, can be repeatedly erasable 100,000 times.And when using the FAT file system to read and write, the meeting repeatable operation is the zone specifically, for some zone, the information such as file size, modification time have been recorded, these zones can along with the increase of file size, be rewritten, although the FAT file system has been utilized RAM(Random Access Memory repeatedly, random access memory) as the cache(buffer memory), but erasable frequency is still very high.Take file cache as example as 32k, at present the generation speed of LOG information be 1 second 20, every on average accounts for 30byte, will flush(refreshes for 55 seconds so) once, namely rewrite the zone at file size place once, be merely able to so continuous working 1527 hours (approximately 63 all day) for 100,000 times.The zone of repeatable operation is being carried out repeatedly wiping/write operation after because the characteristic of NAND, some data is made mistakes when carrying out the ECC verification after writing, after this situation occurring, the BLOCK under this zone can be judged as bad piece, is abandoned.
This because zone of repeatable operation causes the whole BLOCK at this place, zone to be judged as bad piece, with the significant wastage memory property of flash memory repeatedly, can't give full play to repeatedly the potential storage capacity of flash memory.
Summary of the invention
The invention provides a kind of method for writing data and a kind of data transfer apparatus, write fashionable to solve the data of using the FAT file system to carry out repeatedly flash memory, because of zone of repeatable operation, cause the whole BLOCK at this place, zone to be judged as bad piece, waste is the memory property of flash memory repeatedly, can't give full play to repeatedly the problem of the potential storage capacity of flash memory.
In order to address the above problem, the invention discloses a kind of method for writing data, comprise: receive to the data of flash memory data writing repeatedly and write instruction, write the first data block that data to be written in the described repeatedly flash memory are determined in instruction according to described data; Obtain the number of times of wiping/writing of described the first data block, and when the number of times of wiping/writing of described the first data block reached setting threshold, selective erasing from other data block of described repeatedly flash memory/number of times that writes did not reach the second data block of described setting threshold; Data in data in described the first data block and described the second data block are exchanged; Write instruction to described the second data block data writing that carries out after the exchanges data according to described data.
Preferably, write according to described data after the step of the described second data block data writing of instruction after carrying out exchanges data, also comprise: the number of times of wiping/writing that upgrades the notebook data piece that the outer data OOB district of band of described the second data block records.
Preferably, the described step of obtaining the number of times of wiping/writing of described the first data block comprises: the number of times of wiping/writing that reads the OOB district record of described the first data block.
Preferably, after the step of the number of times of wiping/writing of the notebook data piece of the outer data OOB district of the band of described the second data block of described renewal record, also comprise: according to the number of times of wiping/writing of described the second data block after upgrading, the number of times that described the second data block is moved to described wiping/write is less than or equal to after the data block of the number of times of wiping/writing of described the second data block, forms the data block chained list that links from small to large according to the number of times of wiping/writing.
Preferably, the step that the number of times of described selective erasing from other data block of described repeatedly flash memory/write does not reach the second data block of described setting threshold comprises: when the number of times of wiping/writing of the data block of the gauge outfit of described data block chained list does not reach described setting threshold, the data block of the gauge outfit of described data block chained list is defined as the second data block.
Preferably, the step that the number of times of described selective erasing from other data block of described repeatedly flash memory/write does not reach the second data block of described setting threshold comprises: obtain described wiping/number of times that writes and do not reach the information of the data block of described setting threshold from the data block information table, wherein, store the number of times of wiping/writing of each data block of described repeatedly flash memory in the described data block information table; Selecting a data block from data block corresponding to the information of the described data block obtained is the second data block.
In order to address the above problem, the invention also discloses a kind of data transfer apparatus, comprise: determination module, be used for to receive to the data of flash memory data writing repeatedly and write instruction, write the first data block that data to be written in the described repeatedly flash memory are determined in instruction according to described data; Acquisition module, be used for obtaining the number of times of wiping/writing of described the first data block, and when the number of times of wiping/writing of described the first data block reached setting threshold, selective erasing from other data block of described repeatedly flash memory/number of times that writes did not reach the second data block of described setting threshold; Execution module is used for the data of described the first data block and the data in described the second data block are exchanged; Write instruction to described the second data block data writing that carries out after the exchanges data according to described data.
Preferably, described data transfer apparatus also comprises: logging modle, be used for described execution module writes the described second data block data writing of instruction after carrying out exchanges data according to described data after, upgrade the number of times of wiping/writing of the notebook data piece that the outer data OOB district of band of described the second data block records.
Preferably, described acquisition module reads the number of times of wiping/writing of the OOB district record of described the first data block when obtaining the number of times of wiping/writing of described the first data block.
Preferably, described data transfer apparatus also comprises: processing module, after the number of times of wiping/writing for the notebook data piece of data OOB district record outside the band that upgrades described the second data block in described logging modle, the number of times of wiping/writing according to described the second data block after upgrading, the number of times that described the second data block is moved to described wiping/write is less than or equal to after the data block of the number of times of wiping/writing of described the second data block, forms the data block chained list that links from small to large according to the number of times of wiping/writing.
Preferably, when described acquisition module does not reach the second data block of described setting threshold at the number of times of selective erasing from other data block of described repeatedly flash memory/write, when the number of times of wiping/writing of the data block of the gauge outfit of described data block chained list does not reach described setting threshold, the data block of the gauge outfit of described data block chained list is defined as the second data block.
Preferably, when described acquisition module does not reach the second data block of described setting threshold at the number of times of selective erasing from other data block of described repeatedly flash memory/write, from the data block information table, obtain described wiping/number of times that writes and do not reach the information of the data block of described setting threshold, wherein, store the number of times of wiping/writing of each data block of described repeatedly flash memory in the described data block information table; Selecting a data block from data block corresponding to the information of the described data block obtained is the second data block.
Compared with prior art, the present invention has the following advantages:
The present invention is repeatedly the threshold value that each data block of flash memory is set the number of times of wiping/writing, to flash memory data writing repeatedly the time, the number of times of wiping/writing of determining first the first data block of data to be written reaches setting threshold, then, select the second new data block to carry out exchanges data, after exchanges data, data to be written are write the second new data block.Behind setting threshold, can look for again the data block of " suitable " to replace in a data block " wearing and tearing ".Change like this, just can utilize as much as possible repeatedly each data block in the flash memory, " wearing and tearing " on average in each data block, thereby avoided the wearing and tearing of individual data piece excessive, cause bad piece.By the present invention, having solved the data of using the FAT file system to carry out repeatedly flash memory writes fashionable, because of zone of repeatable operation, cause the whole BLOCK at this place, zone to be judged as bad piece, waste is the memory property of flash memory repeatedly, can't give full play to repeatedly the problem of the potential storage capacity of flash memory, reach the repeatedly effect of flash memory memory property of effective utilization.
Description of drawings
Fig. 1 is the flow chart of steps according to a kind of method for writing data of the embodiment of the invention one;
Fig. 2 is the flow chart of steps according to a kind of method for writing data of the embodiment of the invention two;
Fig. 3 is the flow chart of steps according to a kind of method for writing data of the embodiment of the invention three;
Fig. 4 is the structured flowchart according to a kind of data transfer apparatus of the embodiment of the invention four.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
Embodiment one
With reference to Fig. 1, show the flow chart of steps according to a kind of method for writing data of the embodiment of the invention one.
The method for writing data of the present embodiment may further comprise the steps:
Step S102: receive to the data of flash memory data writing repeatedly and write instruction, write the first data block that data to be written in the flash memory are determined repeatedly in instruction according to data.
Data write the data block address that usually includes data to be written in the instruction, such as the logical address of data block to be written, and then can determine the physical address of corresponding data block according to this logical address.
Step S104: the number of times of wiping/writing that obtains the first data block, and when the number of times of wiping/writing of the first data block reached setting threshold, selective erasing/number of times that writes did not reach the second data block of setting threshold from other data block of flash memory repeatedly.
Repeatedly preserve the number of times of wiping/writing of each data block in the flash memory, when to the data block data writing, judge first whether the number of times of wiping/writing of this data block reaches setting threshold.Wherein, setting threshold is frequently wiped/is write for fear of certain data block, and other data block might be left unused always, causes data block to utilize inhomogeneous, avoids producing the bad data piece and the threshold value that arranges.
When selecting the second data block, can be according to certain rule, as according to sequencing, select or other suitable selective rule at random, selective erasing/number of times that writes does not reach the data block of setting threshold.
Step S106: the data in the data in the first data block and the second data block are exchanged.
The number of times of wiping/writing of the second data block of selecting is less, after the exchanges data in the data in the first data block and the second data block, data writing in the second data block again, can balanced utilization the data block in the flash memory repeatedly, effectively avoid because a data block is frequently wiped/write, cause the situation of bad data blocks to occur.
Step S108: write instruction to the second data block data writing that carries out after the exchanges data according to data.
After data write the flow process end, the number of times of wiping/writing of the data block of repeatedly preserving in the flash memory upgraded.As, when all recording the number of times of wiping/writing of notebook data piece in every blocks of data piece, after data write, namely the indegree of wiping/write of notebook data increased counting, carry out real-time update; For another example, if when the number of times of wiping/writing of every blocks of data piece of flash memory adopts centralized record repeatedly, as when using the number of times of wiping/writing of file or each data block of charting, can be after data write, the number of times of corresponding the wiping of this data block in file or the form/write is upgraded.Certainly, be not limited to this, in actual applications, those skilled in the art also can adopt other appropriate ways record and the number of times of wiping/writing of new data block more.
Pass through the present embodiment, set the threshold value of the number of times of wiping/writing for each data block of flash memory repeatedly, to flash memory data writing repeatedly the time, the number of times of wiping/writing of determining first the first data block of data to be written reaches setting threshold, then, select the second new data block to carry out exchanges data, after exchanges data, data to be written are write the second new data block.Behind setting threshold, can look for again the data block of " suitable " to replace in a data block " wearing and tearing ".Change like this, just can utilize as much as possible repeatedly each data block in the flash memory, " wearing and tearing " on average in each data block, thereby avoided the wearing and tearing of individual data piece excessive, cause bad piece.Pass through the present embodiment, having solved the data of using the FAT file system to carry out repeatedly flash memory writes fashionable, because of zone of repeatable operation, cause the whole BLOCK at this place, zone to be judged as bad piece, waste is the memory property of flash memory repeatedly, can't give full play to repeatedly the problem of the potential storage capacity of flash memory, reach the repeatedly effect of flash memory memory property of effective utilization.
Embodiment two
With reference to Fig. 2, show the flow chart of steps according to a kind of method for writing data of the embodiment of the invention two.
In the present embodiment, take can be repeatedly erasable nand memory as example, use the chained list mode to link each data block of nand memory, at the OOB(Out of each data block Of Band, be with outer data) distinguish the number of times of wiping/writing of minute book data block.According to the number of times of wiping/writing of each data block of nand memory, use from small to large each data block of chained list link nand memory; When behind the data block data writing, according to the number of times of wiping/writing of the data block of data writing, the data block of data writing is moved to the number of times of wiping/writing be less than or equal to after the data block of the number of times of wiping/writing of data block of data writing.
Below with a simple example linked list data piece of nand memory is carried out exemplary illustration, as set nand memory A, B, C, four data blocks of D are arranged, when initial, list structure is A(0)-〉 B(0)-〉 C(0)-〉 D(0), wherein, the number of times that data representation notebook data piece in the bracket () is wiped free of/writes is 0 when initial.When behind A data block data writing, list structure becomes B(0)-〉 C(0)-〉 D(0)-〉 A(1); Behind B data block data writing, list structure becomes C(0 again)-〉 D(0)-〉 A(1)-〉 B(1); Behind A data block data writing, list structure becomes C(0 again)-〉 D(0)-〉 B(1)-〉 A(2); Behind D data block data writing, list structure becomes C(0 again)-〉 B(1)-〉 D(1)-〉 A(2), the like.
Based on above structure, the method for writing data of the present embodiment may further comprise the steps:
Step S202: receive to the data of nand memory data writing and write instruction, write the first data block that data to be written are determined in instruction according to data.
Step S204: read the number of times of wiping/writing of the OOB district record of the first data block, judge whether the number of times of wiping/writing of the first data block reaches setting threshold, if, execution in step S206 then; If not, execution in step S212 then.
Step S206: if the number of times of wiping/writing of the first data block reaches setting threshold, judge then whether the number of times of wiping/writing of data block of gauge outfit of the data block chained list of nand memory reaches setting threshold, if do not reach, execution in step S208 then; If reach, then provide prompting, finish this secondary data and write flow process.
In the present embodiment, because adopt list structure to link from small to large the data block of nand memory according to the number of times of wiping/writing of data block, therefore, when needed, directly select the data block of linked list head as the second data block, if this linked list head data block has also reached setting threshold, then illustrate in this chained list not reached the data block of setting threshold, provide corresponding prompting.Therefore but generally, the data block of linked list head can not reach setting threshold, can directly select this linked list head data block as the second new data block, and reach setting threshold the first data block and carry out exchanges data, and then data writing.
Need to prove, the storage organization of the data block of nand memory is not limited to list structure, and those skilled in the art can arrange suitable structure according to the actual requirements.The selection of the second data block also is not limited to the form of above-mentioned use linked list head data block, those skilled in the art can also select other form according to actual conditions.For example, the data block information table is set in nand memory, store the number of times of wiping/writing of each data block of nand memory in this data block information table, certainly, can also store the address information of each data block, like this, when needs are selected data block, can from the data block information table, obtain the information that the number of times of wiping/writing does not reach the data block of setting threshold; And then, according to suitable setting rule (as according to from small to large select progressively of the number of times of wiping/writing, random select etc.), from data block corresponding to the information of the data block obtained, select a data block as the second data block.Further, can according to the address information of second data block of storing in the data block information table, directly access the second data block of this selection.
Step S208: select the data block of gauge outfit of chained list as the second data block, the data in the first data block and data in the second data block of selecting are exchanged.
For example, the setting threshold of the number of times of wiping/writing is to store D1, D2, three data of D3 in 500, the A data block, and the number of times of current wiping/write is 200; Store D5, two data of D6 in the B data block, the number of times of current wiping/write is 500; During then again to B data block data writing, because the number of times of wiping/writing of B data block has reached setting threshold, then select the A data block as new data block.At this moment, temporarily store the data D1 in the A data block, D2, D3 into a scratchpad area (SPA), delete the data in the A data block, and the D5 in the B data block, D6 are copied in the A data block, the number of times of wiping/writing of A data block becomes 201; Then, with the deletion of the data in the B data block, the D1 in the scratchpad area (SPA), D2, D3 are copied in the B data block, the number of times of wiping/writing of B data block becomes 501.As seen, by aforesaid operations, realized the exchanges data of A data block and B data block, because the number of times of wiping/writing of A data block does not also reach setting threshold, therefore can continue the A data block is wiped/write operation, data have been write the A data block.
Step S210: write instruction to the second data block data writing that carries out after the exchanges data, execution in step S214 according to data.
Step S212: if the number of times of wiping/writing of the first data block does not reach setting threshold, then write instruction to this first data block data of writing direct, execution in step S214 according to data.
Step S214: the number of times of wiping/writing of the notebook data piece of the outer data OOB district of the band of the data block of renewal data writing record.
Step S216: according to the number of times of wiping/writing of the data block after upgrading, this data block is moved to the number of times of wiping/writing be less than or equal to after the data block of the number of times of wiping/writing of notebook data piece, form the data block chained list that links from small to large according to the number of times of wiping/writing.
By the present embodiment, effectively prolonged the service time of nand memory+FAT file system, using or test for data card is long-time provides how selectable LOG recording mode; And so that data card uses or during test long-time, the memory property of saving nand memory is given full play to the potential storage capacity of nand memory.
In addition, need to prove, in the present embodiment, at the number of times of wiping/writing of the OOB district of each data block minute book data block, can effectively utilize the OOB district of data block, and realize simply not needing the memory block is set in addition, saved the realization cost.
Embodiment three
With reference to Fig. 3, show the flow chart of steps according to a kind of method for writing data of the embodiment of the invention three.
The file that the present embodiment is stored in the nand memory is described the sector as example, and 512 bytes of this sector can be by frequently erasable, and wearing and tearing can be more serious.The present embodiment records the number of times of wiping/writing of this data block in the OOB district of data block corresponding to this sector, after number of times surpasses setting threshold, this data block and other available data block is exchanged, and makes it become " new data block ".
The method for writing data of the present embodiment may further comprise the steps:
Step S302:LTE data card output LOG information, LTE data card place equipment sends data and writes instruction, and the corresponding software module of LTE data card place equipment is prepared to describe the sector data writing to the file of nand memory.
Step S304: software module writes from data and obtains the logical address that file is described the sector the instruction.
Step S306: the logical address that software module is described the sector according to file determines that file describes the physical address of sector.
Step S308: software module judges that file describes the number of times of wiping/writing of data block at the physical address place of sector and whether reach setting threshold, if, execution in step S310 then; If not, execution in step S316 then.
Wherein, setting threshold can be according to those skilled in the art's experience or test simulation setting, generally can select nand memory erasable/below 90% of write operation life-span number of times, as, if nand memory can repeatedly be wiped/write 100,000 times, then setting threshold can be set to 80,000 times or be 90,000 inferior.Certainly, above only is exemplary illustration, and in actual applications, those skilled in the art can arrange according to actual needs flexibly.
Step S310: software module does not reach from the number of times of wiping/writing selects a data block the data block of setting threshold.
As, the data block of the least number of times of wiping/writing in selection linked list head data block or the selection data block information table.
Step S312: software module is described the data block at place, sector to file data exchange with data in the data block selected.
After the exchange, the data that file is described the sector have stored in the data block of selecting.
Step S314: software module writes instruction according to data, and the file in the data block of selecting is described the sector data writing, finishes this secondary data and writes flow process.
For example, software module writes instruction according to data, and control NAND controller is described the sector data writing to the file in the data block of selecting
Step S316: do not reach setting threshold if file is described the number of times of wiping/writing of data block at the physical address place of sector, then software module writes instruction to this data block data of writing direct according to data, finishes this secondary data and writes flow process.
The present embodiment for the FAT file system to the inhomogeneous and limited problem of the erasable number of times of nand memory of data block utilization factor, a kind of data writing scheme is provided, between logical address to be written and actual NAND physical address, add scheduling (being the scheduling of corresponding software module in the equipment of LTE data card place), this scheduling is after receiving logical address, can reschedule according to erasable number of times, then after shining upon real physical address, carry out read-write operation, thereby reduced as much as possible the unevenness of FAT file system operation, taken full advantage of the potential storage capacity of nand memory.For example, in the present embodiment, the sector is described as example take file, 512 bytes of this sector because of meeting by frequently erasable, wear and tear more serious, the scheme of the present embodiment is in the OOB district of data block corresponding to this sector, record the number of times of wiping/writing of this data block, after number of times surpasses setting threshold, this data block and other data block are exchanged, make it become " new data block ".After this " new data block " may wear to setting threshold, can look for again the data block of " suitable " to replace.Change like this, just can utilize as much as possible each data block in the nand memory, on average in each data block, avoid wearing and tearing the wearing and tearing of individual data piece excessive, cause bad piece.As seen, scheme by the present embodiment, can effectively prolong the service time of nand memory+FAT file system, so that data card is when long-time test, many selectable LOG recording modes, and the memory property of saving nand memory is given full play to the potential storage capacity of nand memory.
Embodiment four
With reference to Fig. 4, show the structured flowchart according to a kind of data transfer apparatus of the embodiment of the invention four.
The data transfer apparatus of the present embodiment four comprises: determination module 402, and be used for to receive to the data of flash memory data writing repeatedly and write instruction, write the first data block that data to be written in the flash memory are determined repeatedly in instruction according to data; Acquisition module 404, be used for obtaining the number of times of wiping/writing of the first data block, and when the number of times of wiping/writing of the first data block reached setting threshold, selective erasing/number of times that writes did not reach the second data block of setting threshold from other data block of flash memory repeatedly; Execution module 406 is used for the data of the first data block and the data in the second data block are exchanged; Write instruction to the second data block data writing that carries out after the exchanges data according to data.
Preferably, the data transfer apparatus of the present embodiment also comprises: logging modle 408, be used for execution module 406 writes the second data block data writing of instruction after carrying out exchanges data according to data after, upgrade the number of times of wiping/writing of the notebook data piece that the OOB district of the second data block records.
Preferably, acquisition module 404 reads the number of times of wiping/writing of the OOB district record of the first data block when obtaining the number of times of wiping/writing of the first data block.
Preferably, the data transfer apparatus of the present embodiment also comprises: processing module 410, be used for after logging modle 408 is upgraded the number of times of wiping/writing of the notebook data piece that the OOB district of the second data block records, the number of times of wiping/writing according to the second data block after upgrading, the second data block is moved to the number of times of wiping/writing be less than or equal to after the data block of the number of times of wiping/writing of the data block of selecting, form the data block chained list that links from small to large according to the number of times of wiping/writing.
Preferably, when acquisition module 404 does not reach the second data block of setting threshold at the number of times of selective erasing from other data block of flash memory repeatedly/write, when the number of times of wiping/writing of the data block of the gauge outfit of data block chained list does not reach setting threshold, the data block of the gauge outfit of data block chained list is defined as the second data block.
Preferably, when acquisition module 404 does not reach the second data block of setting threshold at the number of times of selective erasing from other data block of flash memory repeatedly/write, from the data block information table, obtain the information that the number of times of wiping/writing does not reach the data block of setting threshold, wherein, store repeatedly the number of times of wiping/writing of each data block of flash memory in the data block information table; According to setting rule, from data block corresponding to the information of the data block obtained, select a data block as the second data block.
Preferably, the repeatedly flash memory of the present embodiment is nand memory.
The data transfer apparatus of the present embodiment is used for realizing the corresponding method for writing data of aforementioned a plurality of embodiment of the method, and the beneficial effect with corresponding embodiment of the method, does not repeat them here.
Need to prove, among a plurality of embodiment of the present invention all take nand memory as example, but it should be understood by those skilled in the art that arbitrarily similar with nand memory, can repeatedly wipe/write operation and having wipes/the equal applicable the solution of the present invention of the storer in write operation life-span.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.For device embodiment because itself and embodiment of the method basic simlarity, so describe fairly simple, relevant part gets final product referring to the part explanation of embodiment of the method.
Above a kind of method for writing data provided by the present invention and device are described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (12)

1. a method for writing data is characterized in that, comprising:
Reception writes instruction to the data of flash memory data writing repeatedly, writes the first data block that data to be written in the described repeatedly flash memory are determined in instruction according to described data;
Obtain the number of times of wiping/writing of described the first data block, and when the number of times of wiping/writing of described the first data block reached setting threshold, selective erasing from other data block of described repeatedly flash memory/number of times that writes did not reach the second data block of described setting threshold;
Data in data in described the first data block and described the second data block are exchanged;
Write instruction to described the second data block data writing that carries out after the exchanges data according to described data.
2. method according to claim 1 is characterized in that, writes according to described data after the step of the described second data block data writing of instruction after carrying out exchanges data, also comprises:
Upgrade the number of times of wiping/writing of the notebook data piece that the outer data OOB district of band of described the second data block records.
3. method according to claim 2 is characterized in that, the described step of obtaining the number of times of wiping/writing of described the first data block comprises:
Read the number of times of wiping/writing of the OOB district record of described the first data block.
4. according to claim 2 or 3 described methods, it is characterized in that, after the step of the number of times of wiping/writing of the notebook data piece that the outer data OOB district of the band of described the second data block of described renewal records, also comprise:
The number of times of wiping/writing according to described the second data block after upgrading, the number of times that described the second data block is moved to described wiping/write is less than or equal to after the data block of the number of times of wiping/writing of described the second data block, forms the data block chained list that links from small to large according to the number of times of wiping/writing.
5. method according to claim 4 is characterized in that, the step that the number of times of described selective erasing from other data block of described repeatedly flash memory/write does not reach the second data block of described setting threshold comprises:
When the number of times of wiping/writing of the data block of the gauge outfit of described data block chained list does not reach described setting threshold, the data block of the gauge outfit of described data block chained list is defined as the second data block.
6. method according to claim 1 is characterized in that, the step that the number of times of described selective erasing from other data block of described repeatedly flash memory/write does not reach the second data block of described setting threshold comprises:
From the data block information table, obtain described wiping/number of times that writes and do not reach the information of the data block of described setting threshold, wherein, store the number of times of wiping/writing of each data block of described repeatedly flash memory in the described data block information table;
Selecting a data block from data block corresponding to the information of the described data block obtained is the second data block.
7. a data transfer apparatus is characterized in that, comprising:
Determination module be used for to receive to the data of flash memory data writing repeatedly and writes instruction, writes the first data block that data to be written in the described repeatedly flash memory are determined in instruction according to described data;
Acquisition module, be used for obtaining the number of times of wiping/writing of described the first data block, and when the number of times of wiping/writing of described the first data block reached setting threshold, selective erasing from other data block of described repeatedly flash memory/number of times that writes did not reach the second data block of described setting threshold;
Execution module is used for the data of described the first data block and the data in described the second data block are exchanged; Write instruction to described the second data block data writing that carries out after the exchanges data according to described data.
8. device according to claim 7 is characterized in that, also comprises:
Logging modle is used for described execution module writes the described second data block data writing of instruction after carrying out exchanges data according to described data after, upgrades the number of times of wiping/writing of the notebook data piece that the outer data OOB district of band of described the second data block records.
9. device according to claim 8 is characterized in that, described acquisition module reads the number of times of wiping/writing of the OOB district record of described the first data block when obtaining the number of times of wiping/writing of described the first data block.
10. according to claim 8 or 9 described devices, it is characterized in that, also comprise:
Processing module, after the number of times of wiping/writing for the notebook data piece of data OOB district record outside the band that upgrades described the second data block in described logging modle, the number of times of wiping/writing according to described the second data block after upgrading, the number of times that described the second data block is moved to described wiping/write is less than or equal to after the data block of the number of times of wiping/writing of described the second data block, forms the data block chained list that links from small to large according to the number of times of wiping/writing.
11. device according to claim 10, it is characterized in that, when described acquisition module does not reach the second data block of described setting threshold at the number of times of selective erasing from other data block of described repeatedly flash memory/write, when the number of times of wiping/writing of the data block of the gauge outfit of described data block chained list does not reach described setting threshold, the data block of the gauge outfit of described data block chained list is defined as the second data block.
12. device according to claim 7, it is characterized in that, when described acquisition module does not reach the second data block of described setting threshold at the number of times of selective erasing from other data block of described repeatedly flash memory/write, from the data block information table, obtain described wiping/number of times that writes and do not reach the information of the data block of described setting threshold, wherein, store the number of times of wiping/writing of each data block of described repeatedly flash memory in the described data block information table; Selecting a data block from data block corresponding to the information of the described data block obtained is the second data block.
CN2012105750908A 2012-12-26 2012-12-26 Method and device for writing data Pending CN103064792A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012105750908A CN103064792A (en) 2012-12-26 2012-12-26 Method and device for writing data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012105750908A CN103064792A (en) 2012-12-26 2012-12-26 Method and device for writing data

Publications (1)

Publication Number Publication Date
CN103064792A true CN103064792A (en) 2013-04-24

Family

ID=48107424

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012105750908A Pending CN103064792A (en) 2012-12-26 2012-12-26 Method and device for writing data

Country Status (1)

Country Link
CN (1) CN103064792A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103985410A (en) * 2014-04-30 2014-08-13 北京世纪东方国铁科技股份有限公司 Storage device and data access method for storage device
CN104461953A (en) * 2014-12-31 2015-03-25 厦门雅迅网络股份有限公司 Method and system for carrying out linux log management through virtual serial port
CN104598165A (en) * 2014-12-31 2015-05-06 深圳市共进电子股份有限公司 Method and device for improving durability of storage on embedded equipment
CN106293635A (en) * 2015-05-13 2017-01-04 华为技术有限公司 Instruction block processing method and processing device
CN106844583A (en) * 2017-01-10 2017-06-13 厦门雅迅网络股份有限公司 A kind of optimization method that FAT file system is set up on NOR Flash
CN106909512A (en) * 2015-12-23 2017-06-30 研祥智能科技股份有限公司 The application method and system of storage device
CN107301015A (en) * 2016-04-15 2017-10-27 飞思卡尔半导体公司 System and method for reducing the pressure on memory devices
CN107748649A (en) * 2017-09-18 2018-03-02 北京京东尚科信息技术有限公司 A kind of data cached method and apparatus
CN109669641A (en) * 2018-12-24 2019-04-23 深圳忆联信息系统有限公司 Reduce the data deposit method and device of the SSD bit error rate
CN110780808A (en) * 2018-07-31 2020-02-11 佳能株式会社 Information processing apparatus, control method therefor, and storage medium
CN110888596A (en) * 2019-06-25 2020-03-17 北京华虹集成电路设计有限责任公司 File erasing method and device for Flash storage area
CN111562882A (en) * 2020-04-22 2020-08-21 深圳震有科技股份有限公司 Data writing method, intelligent terminal and storage medium
CN112947862A (en) * 2021-03-10 2021-06-11 歌尔科技有限公司 Device, Flash memory and data storage method thereof

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5633824A (en) * 1995-03-30 1997-05-27 Nec Corporation File system for flash memory
CN101425041A (en) * 2007-10-30 2009-05-06 安凯(广州)软件技术有限公司 Optimizing method for establishing FAT file systems on NAND FLASH memory
CN101533670A (en) * 2009-04-23 2009-09-16 北京握奇数据系统有限公司 Method and memory device realizing loss balance of memory device
CN102135942A (en) * 2010-12-31 2011-07-27 北京握奇数据系统有限公司 Method for realizing wear-leveling in storage equipment as well as the storage equipment
CN102222046A (en) * 2011-06-09 2011-10-19 清华大学 Abrasion equilibrium method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5633824A (en) * 1995-03-30 1997-05-27 Nec Corporation File system for flash memory
CN101425041A (en) * 2007-10-30 2009-05-06 安凯(广州)软件技术有限公司 Optimizing method for establishing FAT file systems on NAND FLASH memory
CN101533670A (en) * 2009-04-23 2009-09-16 北京握奇数据系统有限公司 Method and memory device realizing loss balance of memory device
CN102135942A (en) * 2010-12-31 2011-07-27 北京握奇数据系统有限公司 Method for realizing wear-leveling in storage equipment as well as the storage equipment
CN102222046A (en) * 2011-06-09 2011-10-19 清华大学 Abrasion equilibrium method and device

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103985410B (en) * 2014-04-30 2017-05-24 北京世纪东方国铁科技股份有限公司 Storage device and data access method for storage device
CN103985410A (en) * 2014-04-30 2014-08-13 北京世纪东方国铁科技股份有限公司 Storage device and data access method for storage device
CN104461953A (en) * 2014-12-31 2015-03-25 厦门雅迅网络股份有限公司 Method and system for carrying out linux log management through virtual serial port
CN104598165A (en) * 2014-12-31 2015-05-06 深圳市共进电子股份有限公司 Method and device for improving durability of storage on embedded equipment
CN106293635B (en) * 2015-05-13 2018-10-30 华为技术有限公司 Instruction block processing method and processing device
CN106293635A (en) * 2015-05-13 2017-01-04 华为技术有限公司 Instruction block processing method and processing device
CN106909512A (en) * 2015-12-23 2017-06-30 研祥智能科技股份有限公司 The application method and system of storage device
CN107301015A (en) * 2016-04-15 2017-10-27 飞思卡尔半导体公司 System and method for reducing the pressure on memory devices
CN107301015B (en) * 2016-04-15 2022-05-13 恩智浦美国有限公司 System and method for reducing stress on memory devices
CN106844583A (en) * 2017-01-10 2017-06-13 厦门雅迅网络股份有限公司 A kind of optimization method that FAT file system is set up on NOR Flash
CN106844583B (en) * 2017-01-10 2022-03-25 厦门雅迅网络股份有限公司 Optimization method for establishing FAT file system on NOR Flash
CN107748649A (en) * 2017-09-18 2018-03-02 北京京东尚科信息技术有限公司 A kind of data cached method and apparatus
CN110780808A (en) * 2018-07-31 2020-02-11 佳能株式会社 Information processing apparatus, control method therefor, and storage medium
CN110780808B (en) * 2018-07-31 2023-10-31 佳能株式会社 Information processing apparatus and control method thereof
CN109669641A (en) * 2018-12-24 2019-04-23 深圳忆联信息系统有限公司 Reduce the data deposit method and device of the SSD bit error rate
CN109669641B (en) * 2018-12-24 2022-03-29 深圳忆联信息系统有限公司 Data storage method and device for reducing SSD bit error rate
CN110888596B (en) * 2019-06-25 2021-07-09 北京华弘集成电路设计有限责任公司 File erasing method and device for Flash storage area
CN110888596A (en) * 2019-06-25 2020-03-17 北京华虹集成电路设计有限责任公司 File erasing method and device for Flash storage area
CN111562882A (en) * 2020-04-22 2020-08-21 深圳震有科技股份有限公司 Data writing method, intelligent terminal and storage medium
CN112947862A (en) * 2021-03-10 2021-06-11 歌尔科技有限公司 Device, Flash memory and data storage method thereof

Similar Documents

Publication Publication Date Title
CN103064792A (en) Method and device for writing data
CN103049397B (en) A kind of solid state hard disc inner buffer management method based on phase transition storage and system
CN102880556B (en) Wear leveling method and system of Nand Flash
CN104516471B (en) Method and device for managing power supply of storage system
CN103229136B (en) Disk array brush method and disk array brush device
CN109753443A (en) A kind of data processing method, device and electronic equipment
CN102722455B (en) Method and device for storing data in flash memory equipment
CN102096561A (en) Hierarchical data storage processing method, device and storage equipment
CN101419844B (en) Flash memory simulating device and main control module evaluation method for the flash
US20140040533A1 (en) Data management method, memory controller and memory storage device
CN106354658B (en) A method of it reducing mapping table memory source in mixed-use developments algorithm and occupies
CN104699622A (en) Data storage device and data erasing method thereof
CN103514958A (en) Method for detecting service life of EMMC (embedded multi-media card) chip
CN103268204A (en) Adjusting and optimizing method and device of solid-state disk
CN103677653A (en) Data processing method and electronic device based on solid state disk (SSD)
CN104216796A (en) Data backup and recovery method and electronic device
CN117435416B (en) Memory testing system and method
CN106528443B (en) FLASH management system and method suitable for spaceborne data management
CN105137227A (en) Testing device and method for power-down protection of intelligent card
CN102789370B (en) A kind of RAID array synchronous method and device
CN109144419A (en) A kind of solid state hard disk memory read-write method and system
CN115408212A (en) System and method for parallel automatic testing of partitioned namespace solid state drives
CN104408126B (en) A kind of persistence wiring method of database, device and system
CN109656479A (en) A kind of method and device constructing memory command sequence
CN109375871A (en) A kind of log processing method, system and electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
ASS Succession or assignment of patent right

Owner name: BEIJING CHUANGYI VISION TECHNOLOGY CO., LTD.

Effective date: 20130509

C41 Transfer of patent application or patent right or utility model
TA01 Transfer of patent application right

Effective date of registration: 20130509

Address after: 100084 Beijing Qinghua East Road, No. 1, Tsinghua Science Park, science and technology building, block A, No. 801, Haidian District

Applicant after: Innofidei Technology Co., Ltd.

Applicant after: Beijing Chuangyi Vision Technology Co., Ltd.

Address before: 100084 Beijing Qinghua East Road, No. 1, Tsinghua Science Park, science and technology building, block A, No. 801, Haidian District

Applicant before: Innofidei Technology Co., Ltd.

RJ01 Rejection of invention patent application after publication

Application publication date: 20130424

RJ01 Rejection of invention patent application after publication