CN109542345A - The data write-in of flash storage and read method, device - Google Patents

The data write-in of flash storage and read method, device Download PDF

Info

Publication number
CN109542345A
CN109542345A CN201811365109.XA CN201811365109A CN109542345A CN 109542345 A CN109542345 A CN 109542345A CN 201811365109 A CN201811365109 A CN 201811365109A CN 109542345 A CN109542345 A CN 109542345A
Authority
CN
China
Prior art keywords
data
memory block
flash storage
wiped
reading
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811365109.XA
Other languages
Chinese (zh)
Other versions
CN109542345B (en
Inventor
郭修其
陈湘华
方正
邝杰源
张永光
张斌彧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
GUANGZHOU JINHONGYUAN ELECTRONIC TECHNOLOGY Co Ltd
Original Assignee
GUANGZHOU JINHONGYUAN ELECTRONIC 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 GUANGZHOU JINHONGYUAN ELECTRONIC TECHNOLOGY Co Ltd filed Critical GUANGZHOU JINHONGYUAN ELECTRONIC TECHNOLOGY Co Ltd
Priority to CN201811365109.XA priority Critical patent/CN109542345B/en
Publication of CN109542345A publication Critical patent/CN109542345A/en
Application granted granted Critical
Publication of CN109542345B publication Critical patent/CN109542345B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0616Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

This application involves a kind of write-in of the data of flash storage and read methods, device.The described method includes: obtaining pending data;It is wiped for the data in the first memory block of the flash storage;When the data in the first memory block of the flash storage are not wiped free of, wiped for the data in the second memory block of the flash storage;When the data in the second memory block of the flash storage are wiped free of, the pending data is written in second memory block.It can be avoided using this method and erasing work carried out to the memory block not used, improve the service life of flash storage.

Description

The data write-in of flash storage and read method, device
Technical field
This application involves field of computer technology, more particularly to a kind of data processing method, device, computer equipment and Storage medium.
Background technique
In the development process of electronic product, need to remain to save the memory of data using power down to save some parameters Or significant data, such as error code, self study value etc..Flash storage is exactly a kind of storage that rapidly can be wiped and be written Device has power-down protection, amount of storage big, and can be repeatedly erasable.And there is Flash inside single-chip microcontroller typically now Region, for storing specific data.
If continually erasable to flash storage progress, the service life of FLASH memory will affect, and FLASH is stored The service life of device directly influences the service life of electronic product.Therefore, in order to guarantee the service life of electronic product, Ying Jinliang subtracts The number of few FLASH memory erasing;
And in single-chip microcontroller preservation low volume data, it is all stored in fixed position, it is corresponding that this will lead to data preservation Page needs carry out erasing operation when having data variation, this just easily reaches the erasable maximum number of times of FLASH, in turn Entire processor is caused to be unable to run.
Summary of the invention
Based on this, it is necessary in view of the above technical problems, provide a kind of number that can reduce FLASH memory erasing A kind of data write-in of flash storage and read method, device, computer equipment and storage medium.
A kind of method for writing data of flash storage, which comprises
Obtain pending data;
It is wiped for the data in the first memory block of the flash storage;
When the data in the first memory block of the flash storage are not wiped free of, for the flash storage Data in second memory block are wiped;
When the data in the second memory block of the flash storage are wiped free of, institute is written into the pending data It states in the second memory block.
In one of the embodiments, the method also includes:
When the data in the second memory block of the flash storage are not wiped free of, for the flash storage Data in third memory block are wiped;
When the data in the third memory block of the flash storage are wiped free of, then the pending data is written In the third memory block.
In one of the embodiments, the method also includes:
When the data in the third memory block of the flash storage are not wiped free of, for the flash storage Data in 4th memory block are wiped;
When the data in the 4th memory block of the flash storage are wiped free of, then the pending data is written In 4th memory block.
It is described when the data in the second memory block of the flash storage are wiped free of in one of the embodiments, The pending data is written in second memory block, comprising:
When the data in the second memory block of the flash storage are wiped free of, by pending data write-in the The first page of two memory blocks;And the pending data is written to the second page of the second memory block.
A kind of method for reading data of flash storage, which comprises
Read the data in the first memory block of the flash storage;
When the reading data failure in the first memory block of the flash storage, the flash storage is read Data in second memory block;
Data after output reading.
Data in the first memory block for reading the flash storage in one of the embodiments, comprising:
Read the data of first page in the first memory block;
When the reading data failure of first page in the first memory block, second page in the first memory block is read Data;
When the reading data failure of second page in the first memory block, determine that the first memory block reads failure.
A kind of data transfer apparatus of flash storage, described device include:
Pending data obtains module, for obtaining pending data;
First erasing module, for being wiped for the data in the first memory block of the flash storage;
Second erasing module, for when the data in the first memory block of the flash storage are not wiped free of, for Data in second memory block of the flash storage are wiped;
First writing module will be described for when the data in the second memory block of the flash storage are wiped free of Pending data is written in second memory block.
Described device in one of the embodiments, further include:
Third wipes module, for when the data in the second memory block of the flash storage are not wiped free of, for Data in the third memory block of the flash storage are wiped;
Second writing module, for when the data in the third memory block of the flash storage are wiped free of, then by institute Pending data is stated to be written in the third memory block.
Described device in one of the embodiments, further include:
4th erasing module, for when the data in the third memory block of the flash storage are not wiped free of, for Data in 4th memory block of the flash storage are wiped;
Third writing module, for when the data in the 4th memory block of the flash storage are wiped free of, then by institute Pending data is stated to be written in the 4th memory block.
First writing module includes: in one of the embodiments,
Submodule is written in paging, for when the data in the second memory block of the flash storage are wiped free of, by institute State the first page that the second memory block is written in pending data;And the pending data is written the second of the second memory block Page.
A kind of reading data device of flash storage, described device include:
First read module, the data in first memory block for reading the flash storage;
Second read module, for reading when the reading data failure in the first memory block of the flash storage Data in second memory block of the flash storage;
Output module, for exporting the data after reading.
First read module includes: in one of the embodiments,
First reading submodule, for reading the data of first page in the first memory block;
Second reading submodule, for when the reading data failure of first page in the first memory block, described in reading The data of second page in first memory block;
Failure submodule is read, described in determining when the reading data failure of second page in the first memory block First memory block reads failure.
A kind of computer equipment, including memory and processor, the memory are stored with computer program, the processing Device performs the steps of when executing the computer program
Obtain pending data;
It is wiped for the data in the first memory block of the flash storage;
When the data in the first memory block of the flash storage are not wiped free of, for the flash storage Data in second memory block are wiped;
When the data in the second memory block of the flash storage are wiped free of, institute is written into the pending data It states in the second memory block.
A kind of computer equipment, including memory and processor, the memory are stored with computer program, the processing Device performs the steps of when executing the computer program
Read the data in the first memory block of the flash storage;
When the reading data failure in the first memory block of the flash storage, the flash storage is read Data in second memory block;
Data after output reading.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor It is performed the steps of when row
Obtain pending data;
It is wiped for the data in the first memory block of the flash storage;
When the data in the first memory block of the flash storage are not wiped free of, for the flash storage Data in second memory block are wiped;
When the data in the second memory block of the flash storage are wiped free of, institute is written into the pending data It states in the second memory block.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor It is performed the steps of when row
Read the data in the first memory block of the flash storage;
When the reading data failure in the first memory block of the flash storage, the flash storage is read Data in second memory block;
Data after output reading.
The data write-in of above-mentioned flash storage and read method, device, computer equipment and storage medium, by obtaining Take pending data;It is wiped for the data in the first memory block of the flash storage;When the Flash is stored When data in the first memory block of device are not wiped free of, carried out for the data in the second memory block of the flash storage Erasing;When the data in the second memory block of the flash storage are wiped free of, by pending data write-in described the In two memory blocks;Since the size of one piece of Flash memory block can satisfy the required data length write enough, so need to only wipe one Block Flash memory block.It can avoid carrying out erasing work to the memory block not used in this way, that improves flash storage uses the longevity Life.
Detailed description of the invention
Fig. 1 is a kind of flow diagram of the method for writing data of flash storage of one embodiment;
Fig. 2 is a kind of flow diagram of the method for reading data of flash storage of one embodiment;
Fig. 3 is reading data, erasing and the flow chart of write operation of a kind of flash storage of one embodiment;
Fig. 4 is a kind of flow chart of the data erasing operation of flash storage of one embodiment;
Fig. 5 is a kind of flow chart of the data write operation of flash storage of one embodiment;
Fig. 6 is the flow chart of the data write operation of another flash storage of one embodiment;
Fig. 7 is a kind of flow chart of the data read operation of flash storage of one embodiment;
Fig. 8 is a kind of structural block diagram of the data transfer apparatus of flash storage of one embodiment;
Fig. 9 is a kind of structural block diagram of the reading data device of flash storage of one embodiment;
Figure 10 is a kind of internal structure chart of computer equipment of one embodiment.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not For limiting the application.
In one embodiment, as shown in Figure 1, providing a kind of method for writing data of flash storage, including it is following Step:
Step S201 obtains pending data;
In the concrete realization, the embodiment of the present invention can be applied in the terminal, for example, mobile phone, tablet computer, individual Digital assistants, wearable device (such as glasses, wrist-watch) etc..
In embodiments of the present invention, the operating system of mobile terminal may include Android (Android), IOS, Windows Phone, Windows etc..
It should be noted that the mobile terminal can be the electronic product applied in automotive field, the present embodiment is to shifting The concrete application purposes of dynamic terminal is with no restriction;Further, in composed structure, which may include storage inside Device, external memory, processor, mainboard, power-supply device, display equipment, input equipment and output equipment etc., the storage inside Device may include flash storage, the present embodiment to this with no restriction.
Further, the processor is in communication with each other with the flash storage, i.e., the described processor can be read Information in flash storage can also write data into flash storage, complete number in conjunction with above-mentioned certain hardware According to treatment process.
Specifically, the processor can be general processor, digital signal processor (DigitalSignalProcessor, DSP), specific integrated circuit (ApplicationSpecific IntegratedCircuit, ASIC), ready-made programmable gate array (FieldProgrammableGateArray, FPGA) or Other programmable logic device, discrete gate or transistor logic, discrete hardware components.It may be implemented or execute this reality Apply each method, step and the logic diagram in example.General processor can be microprocessor or the processor is also possible to appoint What conventional processor etc..
The processor of the mobile terminal can get the pending data from the external memory, need to illustrate , the pending data may include text data, video data, image data and audio data, the pending data Can be binary data, the present embodiment to this with no restriction.
Step S202 is wiped for the data in the first memory block of the flash storage;
It is further applicable in the present embodiment, which can be divided into multiple memory blocks, such as the first storage Block, the second memory block, third memory block and the 4th memory block, memory block can be divided into multiple pages again, and memory block is erasable Minimum unit, and page be written data minimum unit.
The operation that the flash storage reads data is similar with common internal storage, can actually read at random.But The write operation of flash storage and the internal storage passed through are different, and the write operation of flash storage must be according to The sequence of memory block is wiped, and carries out write operation according still further to the sequence of page, since flash storage erasing takes a long time, so The time that flash storage write operation expends essentially consists in the erasing operation inside flash storage.
It is specifically applied in the present embodiment, the processor is for the number in the first memory block of the flash storage According to being wiped;Specifically, the processor has corresponding file system, and an index node is arranged in the file system, Save the information of whole system;That is the index node most information of storing this document system, such as index node update number, tufted State table, the block number of next memory block to be wiped free of, the node serial number to next newly-built node, system root directory information Table.System updates each time can all generate new index node, and index node update number adds 1.
The processor gets the block number for the first memory block to be wiped free of by file system, is directed to according to the block number Data in the first memory block are wiped.
It should be noted that the data in the first memory block can be binary text data, video data, image Data and audio data etc., the present embodiment to this with no restriction.
Step S203, when the data in the first memory block of the flash storage are not wiped free of, for described Data in second memory block of flash storage are wiped;
It is specifically applied in the present embodiment, the data in the first memory block that processor determines the flash storage It is not wiped free of, i.e., when occurring mistake or erasing failure when the erasing of the first memory block of the flash storage, which can To be wiped for the data in the second memory block.
It should be noted that when the processor identifies that the first memory block is empty, it can be by the number to be processed According to directly writing in the first memory block.
Step S204, when the data in the second memory block of the flash storage are wiped free of, by the number to be processed According in write-in second memory block.
It applies in the present embodiment, when the success of the second memory block erasing of the flash storage, processor will be to Data are handled to be written in second memory block.
It should be noted that the processor can be to be written second memory block for the pending data per next byte In, the pending data can also be written in second memory block one group of byte every time.
According to the method for writing data of flash storage provided in this embodiment, by obtaining pending data;For institute The data stated in the first memory block of flash storage are wiped;Number in the first memory block of the flash storage When according to not being wiped free of, wiped for the data in the second memory block of the flash storage;When the Flash is stored When data in second memory block of device are wiped free of, the pending data is written in second memory block;Due to one piece The size of Flash memory block can satisfy the required data length write enough, so need to only wipe one piece of Flash memory block.In this way It can avoid carrying out erasing work to the memory block not used, improve the service life of flash storage.
In another embodiment, the method also includes data in the second memory block of the flash storage When not being wiped free of, wiped for the data in the third memory block of the flash storage;
When the data in the third memory block of the flash storage are wiped free of, then the pending data is written In the third memory block.
It is specifically applied in the present embodiment, which can also include third memory block, when the processor determines It, will be in the third memory block of the flash storage when data in second memory block of the flash storage are not wiped free of Data wiped.
I.e. when the error of the second memory block erasing of the flash storage or erasing failure, processor can only be got The block number of the third memory block wipes the data in third memory block according to the block number, it is only necessary to wipe a certain piece Memory block avoids unnecessary erasing operation, improves the service life of flash storage.
In another embodiment, the method also includes data in the third memory block of the flash storage When not being wiped free of, wiped for the data in the 4th memory block of the flash storage;
When the data in the 4th memory block of the flash storage are wiped free of, then the pending data is written In 4th memory block.
It is further applicable in the present embodiment, which can also include the 4th memory block, when the processor is sentenced When data in the third memory block of the fixed flash storage are not wiped free of, by the 4th memory block of the flash storage In data wiped.
When the third memory block erasing error in operation of the flash storage or erasing failure, processor can only be obtained To the block number of the 4th memory block, the data in the 4th memory block are wiped according to the block number, it is only necessary to wipe a certain Block memory block, can be to avoid unnecessary erasing operation.
It should be noted that above-mentioned first memory block, the second memory block, third memory block and the 4th memory block are only The citing of the present embodiment can also include the 5th memory block and the 6th memory block etc., the number that the present embodiment divides the memory block It measures with no restriction, and the criteria for classifying of memory block is that the size of each memory block can satisfy the data length of required write-in.
In another embodiment, the step S204 includes: when the number in the second memory block of the flash storage When according to being wiped free of, the pending data is written to the first page of the second memory block;And by pending data write-in the The second page of two memory blocks.
In the present embodiment, some memory block can be divided into page two, will be identical to be processed such as first page and second page Data are respectively written into the first page and second page, when page two being all successfully written, then terminate write operation;If certain one page write-in behaviour When malfunctioning or failing, then continue to carry out erasing operation and write operation to next piece of memory block.
In one embodiment, as shown in Fig. 2, providing a kind of method for reading data of flash storage, including it is following Step:
Step S301 reads the data in the first memory block of the flash storage;
In the present embodiment, processor can read the data in the first memory block of the flash storage;I.e. in system After powering on, if the first memory block for reading the flash storage can be attempted when the unread data crossed in first memory block In data.
Step S302, when the reading data failure in the first memory block of the flash storage, described in reading Data in second memory block of flash storage;
It is further applicable in the present embodiment, the number in the first memory block that processor determines the flash storage When according to reading failure, the data in the second memory block of the flash storage are read.
When the data in the second memory block of the flash storage equally read failure, then processor can basis The block number of memory block is successively read remaining memory block, until reading successfully.
Step S303, the data after output reading.
It is specifically applied in the present embodiment, which can export data after the reading, for example, can export this Data after reading are to equipment is shown, control shows that equipment shows corresponding content, and processor can also pass through corresponding process It is output in application program, enables applications to be handled for the data of the output.It, will be described in the present embodiment Flash storage piecemeal is read, and improves the reading efficiency of flash storage.
In another embodiment, the step S301, comprising: read the data of first page in the first memory block; When the reading data failure of first page in the first memory block, the data of second page in the first memory block are read;When In the first memory block when reading data failure of second page, determine that the first memory block reads failure.
It should be noted that processor can read the first of some memory block when reading the data of memory block first If the data of page read the data of second page in the first memory block, page two when some memory block are all read read failure When taking unsuccessfully, it is determined that the memory block reads failure, starts to read next memory block.
For the understanding the present embodiment that kept those skilled in the art more preferable, it is illustrated below with several specific examples.
It is divided into multiple memory blocks inside flash storage, and each memory block can be to be divided into multiple pages.Memory block is Erasable minimum unit, page are the minimum units that data are written.
Flash storage reading data are similar with general memory, may be implemented to read at random.And flash storage Write operation it is different.The write operation of flash storage must be wiped first by block, then being sequentially written in by page.Due to Flash Memory erasing takes a long time, so the time of flash storage write-in essentially consists in the behaviour of the erasing inside flash storage Make.
The reading of data is divided into the operation of Flash and writes two parts, referring to Fig. 3, shows a kind of Flash of the present embodiment Reading data, erasing and the flow chart of write operation of memory;As shown in figure 3, after system electrification, if unread cross Flash When data in memory (1), then (2) are read to the data stored in flash storage, data read operation is complete At (3).If needing to save relevant data when system cut-off (4), then (5) are first wiped as unit of memory block, then again It is written data (6), write-in data complete (7).The each power-up/down of system only carries out primary read-write behaviour to flash storage Make.
First part: data write operation
The write operation of flash storage must first wipe flash storage as unit of page, but before being written Operation, entire flash storage can be divided into four pieces of memory blocks, respectively first memory block, the second memory block, third storage Block, the 4th memory block, since the size of one piece of memory block can satisfy the data length of required write-in enough, so need to only wipe one Block memory block.It can avoid carrying out erasing work to the memory block not used in this way, improve the service life of flash storage.Ginseng According to Fig. 4, a kind of flow chart of the data erasing operation of flash storage of the present embodiment is shown;As shown in Figure 4;Erasing behaviour Make in blocks, to wipe the data (8) of first memory block first, if wiping successfully, terminates to wipe work;If failure (9), Then continue the data (10) of the second memory block of erasing.And so on, until can successfully wipe one piece of memory block data, if four pieces are deposited Storage block erasing all fails, then entirely erasing work failure, data can not be written, and implements failure limping processing;The failure is walked lamely After processing re-powers, the data of required reading are set as default value.
Referring to Fig. 5, a kind of flow chart of the data write operation of flash storage of the present embodiment is shown;Such as Fig. 5 institute Show, if the erasing operation success of a certain piece of memory block, write operation can be carried out to corresponding memory block block, first determine whether that first deposits Whether storage block wipes successfully (17), if not wiping successfully, continues to judge whether next memory block successfully wipes.If four pieces all Successfully to wipe, then limping processing is carried out.After finding the memory block successfully wiped, the data of storage needed for being written thereto (18), if the operation for successfully terminating data write-in is written.If not being successfully written, the second memory block (20) and right is wiped It carries out write operation (22).If the erasing of the second memory block malfunctions (21) or is written data failure (23), continue to Three memory blocks carry out erasing and write operation (24), until successfully wiping and be written data, or data can not be written, progress Failure limping handles (28).
Referring to Fig. 6, the flow chart of the data write operation of another flash storage of the present embodiment is shown;Such as Fig. 6 It is shown, to realize the backup functionality to data, certain block memory block is divided into A, B page two, first A pages is written when data are written (29), write operation then is terminated if page two are all successfully written to the identical data (30) of B pages of write-in again;If certain one page is written Failure (31) then continues to carry out erasing and write operation (32) to next piece.
Second part: data reading operation
Referring to Fig. 7, a kind of flow chart of the data read operation of flash storage of the present embodiment is shown;Such as Fig. 7 institute Show, when reading the data of memory block, reads the A page data (33) of first memory block first, if reading A page data error (34), Then continue the B page data (35) of reading first memory block.If two page datas all read errors (36), continue to read second piece Data (37).
It should be understood that although each step in the flow chart of Fig. 1-2 is successively shown according to the instruction of arrow, These steps are not that the inevitable sequence according to arrow instruction successively executes.Unless expressly stating otherwise herein, these steps Execution there is no stringent sequences to limit, these steps can execute in other order.Moreover, at least one in Fig. 1-2 Part steps may include that perhaps these sub-steps of multiple stages or stage are not necessarily in synchronization to multiple sub-steps Completion is executed, but can be executed at different times, the execution sequence in these sub-steps or stage is also not necessarily successively It carries out, but can be at least part of the sub-step or stage of other steps or other steps in turn or alternately It executes.
In one embodiment, as shown in figure 8, providing a kind of data transfer apparatus of flash storage, comprising: to It handles data acquisition module 401, first and wipes the erasing module 403 of module 402, second and the first writing module 404, in which:
Pending data obtains module 401, for obtaining pending data;
First erasing module 402, for being wiped for the data in the first memory block of the flash storage;
Second erasing module 403, for when the data in the first memory block of the flash storage are not wiped free of, It is wiped for the data in the second memory block of the flash storage;
First writing module 404, for inciting somebody to action when the data in the second memory block of the flash storage are wiped free of The pending data is written in second memory block.
In one embodiment, described device further include:
Third wipes module, for when the data in the second memory block of the flash storage are not wiped free of, for Data in the third memory block of the flash storage are wiped;
Second writing module, for when the data in the third memory block of the flash storage are wiped free of, then by institute Pending data is stated to be written in the third memory block.
In one embodiment, described device further include:
4th erasing module, for when the data in the third memory block of the flash storage are not wiped free of, for Data in 4th memory block of the flash storage are wiped;
Third writing module, for when the data in the 4th memory block of the flash storage are wiped free of, then by institute Pending data is stated to be written in the 4th memory block.
In one embodiment, first writing module includes:
Submodule is written in paging, for when the data in the second memory block of the flash storage are wiped free of, by institute State the first page that the second memory block is written in pending data;And the pending data is written the second of the second memory block Page.
In one embodiment, as shown in figure 9, providing a kind of reading data device of flash storage, comprising: the One read module 501, the second read module 502 and output module 503, in which:
First read module 501, the data in first memory block for reading the flash storage;
Second read module 502, for when in the first memory block of the flash storage reading data failure when, Read the data in the second memory block of the flash storage;
Output module 503, for exporting the data after reading.
In one embodiment, first read module includes:
First reading submodule, for reading the data of first page in the first memory block;
Second reading submodule, for when the reading data failure of first page in the first memory block, described in reading The data of second page in first memory block;
Failure submodule is read, described in determining when the reading data failure of second page in the first memory block First memory block reads failure.
It may refer to about the data write-in of flash storage and the specific restriction of reading device above for Flash The restriction of the data write-in and read method of memory, details are not described herein.The data of above-mentioned flash storage are written and read Modules in device can be realized fully or partially through software, hardware and combinations thereof.Above-mentioned each module can be with hardware shape Formula is embedded in or independently of in the processor in computer equipment, can also be stored in depositing in computer equipment in a software form In reservoir, the corresponding operation of the above modules is executed in order to which processor calls.
The data write-in of the flash storage of above-mentioned offer and reading device can be used for executing above-mentioned any embodiment and provide Flash storage data write-in and read method, have corresponding function and beneficial effect.
In one embodiment, a kind of computer equipment is provided, which can be terminal, internal structure Figure can be as shown in Figure 10.The computer equipment includes the processor connected by system bus, memory, network interface, shows Display screen and input unit.Wherein, the processor of the computer equipment is for providing calculating and control ability.The computer equipment Memory includes non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system and computer Program.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The meter The network interface for calculating machine equipment is used to communicate with external terminal by network connection.When the computer program is executed by processor To realize data write-in and the read method of a kind of flash storage.The display screen of the computer equipment can be liquid crystal display Screen or electric ink display screen, the input unit of the computer equipment can be the touch layer covered on display screen, can also be with It is the key being arranged on computer equipment shell, trace ball or Trackpad, can also be external keyboard, Trackpad or mouse Deng.
It will be understood by those skilled in the art that structure shown in Figure 10, only part relevant to application scheme The block diagram of structure, does not constitute the restriction for the computer equipment being applied thereon to application scheme, and specific computer is set Standby may include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of computer equipment, including memory and processor are provided, is stored in memory Computer program, the processor perform the steps of when executing computer program
Obtain pending data;
It is wiped for the data in the first memory block of the flash storage;
When the data in the first memory block of the flash storage are not wiped free of, for the flash storage Data in second memory block are wiped;
When the data in the second memory block of the flash storage are wiped free of, institute is written into the pending data It states in the second memory block.
In one embodiment, it is also performed the steps of when processor executes computer program
When the data in the second memory block of the flash storage are not wiped free of, for the flash storage Data in third memory block are wiped;
When the data in the third memory block of the flash storage are wiped free of, then the pending data is written In the third memory block.
In one embodiment, it is also performed the steps of when processor executes computer program
When the data in the third memory block of the flash storage are not wiped free of, for the flash storage Data in 4th memory block are wiped;
When the data in the 4th memory block of the flash storage are wiped free of, then the pending data is written In 4th memory block.
In one embodiment, it is also performed the steps of when processor executes computer program
When the data in the second memory block of the flash storage are wiped free of, by pending data write-in the The first page of two memory blocks;And the pending data is written to the second page of the second memory block.
In one embodiment, a kind of computer equipment, including memory and processor are provided, is stored in memory Computer program, the processor perform the steps of when executing computer program
Read the data in the first memory block of the flash storage;
When the reading data failure in the first memory block of the flash storage, the flash storage is read Data in second memory block;
Data after output reading.
In one embodiment, it is also performed the steps of when processor executes computer program
Read the data of first page in the first memory block;
When the reading data failure of first page in the first memory block, second page in the first memory block is read Data;
When the reading data failure of second page in the first memory block, determine that the first memory block reads failure.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program performs the steps of when being executed by processor
Obtain pending data;
It is wiped for the data in the first memory block of the flash storage;
When the data in the first memory block of the flash storage are not wiped free of, for the flash storage Data in second memory block are wiped;
When the data in the second memory block of the flash storage are wiped free of, institute is written into the pending data It states in the second memory block.
In one embodiment, it is also performed the steps of when computer program is executed by processor when the Flash is stored When data in second memory block of device are not wiped free of, carried out for the data in the third memory block of the flash storage Erasing;
When the data in the third memory block of the flash storage are wiped free of, then the pending data is written In the third memory block.
In one embodiment, it is also performed the steps of when computer program is executed by processor when the Flash is stored When data in the third memory block of device are not wiped free of, carried out for the data in the 4th memory block of the flash storage Erasing;
When the data in the 4th memory block of the flash storage are wiped free of, then the pending data is written In 4th memory block.
In one embodiment, it is also performed the steps of when computer program is executed by processor when the Flash is stored When data in second memory block of device are wiped free of, the pending data is written to the first page of the second memory block;And it will The second page of the second memory block is written in the pending data.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program performs the steps of the data in the first memory block for reading the flash storage when being executed by processor;
When the reading data failure in the first memory block of the flash storage, the flash storage is read Data in second memory block;
Data after output reading.
In one embodiment, reading described first is also performed the steps of when computer program is executed by processor to deposit Store up the data of first page in block;
When the reading data failure of first page in the first memory block, second page in the first memory block is read Data;
When the reading data failure of second page in the first memory block, determine that the first memory block reads failure.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, To any reference of memory, storage, database or other media used in each embodiment provided herein, Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously It cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art It says, without departing from the concept of this application, various modifications and improvements can be made, these belong to the protection of the application Range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.

Claims (10)

1. a kind of method for writing data of flash storage characterized by comprising
Obtain pending data;
It is wiped for the data in the first memory block of the flash storage;
When the data in the first memory block of the flash storage are not wiped free of, for the second of the flash storage Data in memory block are wiped;
When the data in the second memory block of the flash storage are wiped free of, by pending data write-in described the In two memory blocks.
2. the method according to claim 1, wherein the method also includes:
When the data in the second memory block of the flash storage are not wiped free of, for the third of the flash storage Data in memory block are wiped;
It, then will be described in pending data write-in when the data in the third memory block of the flash storage are wiped free of In third memory block.
3. according to the method described in claim 2, it is characterized in that, the method also includes:
When the data in the third memory block of the flash storage are not wiped free of, for the 4th of the flash storage the Data in memory block are wiped;
It, then will be described in pending data write-in when the data in the 4th memory block of the flash storage are wiped free of In 4th memory block.
4. method according to claim 1 or 2, which is characterized in that second memory block when the flash storage In data when being wiped free of, the pending data is written in second memory block, comprising:
When the data in the second memory block of the flash storage are wiped free of, pending data write-in second is deposited Store up the first page of block;And the pending data is written to the second page of the second memory block.
5. a kind of method for reading data of flash storage characterized by comprising
Read the data in the first memory block of the flash storage;
When the reading data failure in the first memory block of the flash storage, the second of the flash storage is read Data in memory block;
Data after output reading.
6. according to the method described in claim 5, it is characterized in that, the first memory block for reading the flash storage In data, comprising:
Read the data of first page in the first memory block;
When the reading data failure of first page in the first memory block, the number of second page in the first memory block is read According to;
When the reading data failure of second page in the first memory block, determine that the first memory block reads failure.
7. a kind of data transfer apparatus of flash storage characterized by comprising
Pending data obtains module, for obtaining pending data;
First erasing module, for being wiped for the data in the first memory block of the flash storage;
Second erasing module, for when the data in the first memory block of the flash storage are not wiped free of, for described Data in second memory block of flash storage are wiped;
First writing module, for when the data in the second memory block of the flash storage are wiped free of, by described wait locate Data are managed to be written in second memory block.
8. a kind of reading data device of flash storage characterized by comprising
First read module, the data in first memory block for reading the flash storage;
Second read module, for when the reading data failure in the first memory block of the flash storage, described in reading Data in second memory block of flash storage;
Output module, for exporting the data after reading.
9. a kind of computer equipment, including memory and processor, the memory are stored with computer program, feature exists In the processor realizes flash storage described in any one of claims 1 to 6 when executing the computer program The step of data write-in and read method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program Data write-in and the read method of flash storage described in any one of claims 1 to 6 are realized when being executed by processor Step.
CN201811365109.XA 2018-11-16 2018-11-16 Data writing and reading method and device of Flash memory Active CN109542345B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811365109.XA CN109542345B (en) 2018-11-16 2018-11-16 Data writing and reading method and device of Flash memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811365109.XA CN109542345B (en) 2018-11-16 2018-11-16 Data writing and reading method and device of Flash memory

Publications (2)

Publication Number Publication Date
CN109542345A true CN109542345A (en) 2019-03-29
CN109542345B CN109542345B (en) 2022-02-08

Family

ID=65847907

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811365109.XA Active CN109542345B (en) 2018-11-16 2018-11-16 Data writing and reading method and device of Flash memory

Country Status (1)

Country Link
CN (1) CN109542345B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096300A (en) * 2019-04-08 2019-08-06 上海赛治信息技术有限公司 A kind of fpga program file backup management system, operation method and upgrade method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923900A (en) * 2009-06-09 2010-12-22 北京芯技佳易微电子科技有限公司 Erasing method and device for non-volatile memory
WO2011099963A1 (en) * 2010-02-10 2011-08-18 Hewlett-Packard Development Company, L.P. Identifying a location containing invalid data in a storage media
CN103473098A (en) * 2013-09-10 2013-12-25 华为技术有限公司 Starting method of boot program and relevant device
US20150071006A1 (en) * 2013-09-09 2015-03-12 Kabushiki Kaisha Toshiba Semiconductor storage device
CN105589767A (en) * 2015-12-21 2016-05-18 北京时代民芯科技有限公司 System power failure protection realizing method for NAND FLASH
CN105976867A (en) * 2016-07-06 2016-09-28 北京兆易创新科技股份有限公司 Erasing method for storage units

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923900A (en) * 2009-06-09 2010-12-22 北京芯技佳易微电子科技有限公司 Erasing method and device for non-volatile memory
WO2011099963A1 (en) * 2010-02-10 2011-08-18 Hewlett-Packard Development Company, L.P. Identifying a location containing invalid data in a storage media
US20150071006A1 (en) * 2013-09-09 2015-03-12 Kabushiki Kaisha Toshiba Semiconductor storage device
CN103473098A (en) * 2013-09-10 2013-12-25 华为技术有限公司 Starting method of boot program and relevant device
CN105589767A (en) * 2015-12-21 2016-05-18 北京时代民芯科技有限公司 System power failure protection realizing method for NAND FLASH
CN105976867A (en) * 2016-07-06 2016-09-28 北京兆易创新科技股份有限公司 Erasing method for storage units

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王冬等: "基于区域地址映射的NAND Flash静态磨损均衡算法", 《航空计算技术》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096300A (en) * 2019-04-08 2019-08-06 上海赛治信息技术有限公司 A kind of fpga program file backup management system, operation method and upgrade method
CN110096300B (en) * 2019-04-08 2023-03-14 上海赛治信息技术有限公司 FPGA program file backup management system, operation method and upgrading method

Also Published As

Publication number Publication date
CN109542345B (en) 2022-02-08

Similar Documents

Publication Publication Date Title
CN101923516B (en) Block-based flash memory and its operation method
CN101957726B (en) Phase transition storage in dual inline memory module
US11163679B2 (en) Garbage collection strategy for memory system and method of executing such garbage collection
US8225067B2 (en) Multilevel cell NAND flash memory storage system, and controller and access method thereof
JP5364807B2 (en) MEMORY CONTROLLER AND NONVOLATILE MEMORY DEVICE
US11138080B2 (en) Apparatus and method for reducing cell disturb in an open block of a memory system during a recovery procedure
US8266368B2 (en) Memory controller, memory system, and control method for memory system
CN101494085A (en) Method and controller for preventing nonvolatile semiconductor memory from occurring read interference
CN102157202A (en) Method and controller for preventing nonvolatile memory from occurring read interference
KR20150029402A (en) Data storing system and operating method thereof
JP2011243193A (en) Memory buffer having information that can be accessed after program has failed
US8898420B2 (en) Non-volatile storage device and a memory controller controlling parity tables of recording regions of the non-volatile storage device
CN104239096A (en) Method and unit for realizing security data partitions in Android system
US20160054935A1 (en) Data storing method and memory controller and memory storage device using the same
CN103136111A (en) Data writing method, memorizer controller and memorizer storage device
CN105302679B (en) A kind of detection method and system of intelligent terminal storage stability
CN109542345A (en) The data write-in of flash storage and read method, device
US11093369B2 (en) Reconfigurable simulation system and method for testing firmware of storage
US8738847B2 (en) Data writing method, and memory controller and memory storage apparatus using the same
CN110597552B (en) Configuration method, device, equipment and storage medium of project continuous integrated pipeline
CN102800357A (en) Program code loading and accessing methods, memory controller and storage device of memory
US20190065123A1 (en) Memory system with shared buffer architecture for multiple decoders and method of operating such memory system
CN104166558B (en) Firmware code loading method, Memory Controller and memory storage apparatus
CN102591738B (en) Data managing method, Memory Controller and in-line memory storage device
CN110275596A (en) Power-up initializing accelerated method, device and computer equipment based on solid state hard disk

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant