CN111930302B - Data reading method, device, computer readable storage medium and electronic equipment - Google Patents
Data reading method, device, computer readable storage medium and electronic equipment Download PDFInfo
- Publication number
- CN111930302B CN111930302B CN202010619558.3A CN202010619558A CN111930302B CN 111930302 B CN111930302 B CN 111930302B CN 202010619558 A CN202010619558 A CN 202010619558A CN 111930302 B CN111930302 B CN 111930302B
- Authority
- CN
- China
- Prior art keywords
- data
- preset
- page
- reading
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 230000008569 process Effects 0.000 claims abstract description 13
- 238000004590 computer program Methods 0.000 claims description 13
- 238000010586 diagram Methods 0.000 description 6
- 238000013507 mapping Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/08—Error detection or correction by redundancy in data representation, e.g. by using checking codes
- G06F11/10—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
- G06F11/1008—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
- G06F11/1044—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices with specific ECC/EDC distribution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/064—Management of blocks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0643—Management of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0646—Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
- G06F3/0647—Migration mechanisms
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Quality & Reliability (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a data reading method, a device, a computer readable storage medium and an electronic device, wherein the data reading method comprises the following steps: reading data from the flash memory according to the data reading request, judging whether the ECC value corresponding to the data page is in a preset range or not every time the data of one data page is read in the data reading process, and if so, marking the data page; reading the flash memory data corresponding to each marked data page and storing the flash memory data into a preset data block; judging whether each data page data stored in the preset data block is successfully written, if so, deleting the mark corresponding to the data page which is successfully written, if not, returning to execute the reading of the flash memory data corresponding to each marked data page, and storing the flash memory data in the preset data block until each data page data stored in the preset data block is successfully written; through timely data movement, the risk of data loss is reduced to zero, high-low temperature read-write data can be guaranteed not to be lost any more, and the stability and the correctness of the data are improved.
Description
Technical Field
The present invention relates to the field of flash memory technologies, and in particular, to a data reading method and apparatus, a computer readable storage medium, and an electronic device.
Background
The current data is written into the flash memory (such as Nand-flash, nor-flash, etc.) at high temperature, and the ecc (error correcting code, error checking and correcting) value is often increased rapidly when the data is read out from the flash memory at low temperature. In order to cope with this situation, the conventional processing method is to mark a block corresponding to the rapid increase of the ecce value as Refresh, and to start GC (Garbage Collection, garbage collection algorithm) until the next time of receiving the data reading command, and to move the corresponding block data. However, if the data read command is received after a long period of time, there is a long time without performing GC operation, and there is a risk of data loss.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: provided are a data reading method, a data reading device, a computer readable storage medium, and an electronic apparatus, which prevent data loss.
In order to solve the technical problems, the invention adopts a technical scheme that:
a data reading method comprising the steps of:
Reading data from the flash memory according to a data reading request, judging whether an ECC value corresponding to a data page is in a preset range or not every time the data of one data page is read in the data reading process, and if so, marking the data page;
reading the flash memory data corresponding to each marked data page and storing the flash memory data into a preset data block;
And judging whether the data of each data page stored in the preset data block is successfully written, if so, deleting the mark corresponding to the data page successfully written, if not, returning to execute the reading of the flash memory data corresponding to the data page of each mark, and storing the flash memory data into the preset data block until the data of each data page stored in the preset data block is successfully written.
In order to solve the technical problems, the invention adopts another technical scheme that:
A data reading apparatus comprising:
The reading module is used for reading data from the flash memory according to the data reading request, judging whether the ECC value corresponding to the data page is in a preset range or not every time the data of one data page is read in the data reading process, and if yes, marking the data page;
The storage module is used for reading the flash memory data corresponding to each marked data page and storing the flash memory data into a preset data block;
And the judging module is used for judging whether the data of each data page stored in the preset data block is successfully written, if so, deleting the mark corresponding to the data page successfully written, and if not, returning to execute the reading of the flash memory data corresponding to the data page of each mark, and storing the flash memory data into the preset data block until the data of each data page stored in the preset data block is successfully written.
In order to solve the technical problems, the invention adopts another technical scheme that:
a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the data reading method described above.
In order to solve the technical problems, the invention adopts another technical scheme that:
An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the data reading method described above when the computer program is executed.
The invention has the beneficial effects that: in the process of reading the flash memory data, marking the data pages with ECC values in a preset range, after the data reading is finished, reading the flash memory data corresponding to all marked data pages and storing the flash memory data into a preset data block, judging whether the flash memory data stored into the preset data block is successfully written, and re-reading and writing the data with the writing failure into the preset data block until the writing is successful; after the flash memory data is read, the data with abnormal ECC value is immediately moved to a safe preset data block, and the data can be moved only by starting GC operation when the data is not required to be read next time like the prior art, so that the correctness of the read data is ensured, if the GC operation is not performed for a long time, even if the original data is destroyed, the new data is already present due to the timely data movement, the risk of data loss is reduced to zero, the high-low temperature read-write data is not lost any more, and the stability and the correctness of the data are improved.
Drawings
FIG. 1 is a flowchart illustrating a data reading method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a data reading apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a default data table for storing data page indexes with increased ECC values according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of performing deduplication on a preset data table according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of writing data into a target block of data according to an embodiment of the present invention;
FIG. 7 is a diagram of a mapping table for updating logical addresses to physical addresses according to an embodiment of the present invention.
Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
Referring to fig. 1, an embodiment of the present invention provides a data reading method, including the steps of:
Reading data from the flash memory according to a data reading request, judging whether an ECC value corresponding to a data page is in a preset range or not every time the data of one data page is read in the data reading process, and if so, marking the data page;
reading the flash memory data corresponding to each marked data page and storing the flash memory data into a preset data block;
And judging whether the data of each data page stored in the preset data block is successfully written, if so, deleting the mark corresponding to the data page successfully written, if not, returning to execute the reading of the flash memory data corresponding to the data page of each mark, and storing the flash memory data into the preset data block until the data of each data page stored in the preset data block is successfully written.
From the above description, the beneficial effects of the invention are as follows: in the process of reading the flash memory data, marking the data pages with ECC values in a preset range, after the data reading is finished, reading the flash memory data corresponding to all marked data pages and storing the flash memory data into a preset data block, judging whether the flash memory data stored into the preset data block is successfully written, and re-reading and writing the data with the writing failure into the preset data block until the writing is successful; after the flash memory data is read, the data with abnormal ECC value is immediately moved to a safe preset data block, and the data can be moved only by starting GC operation when the data is not required to be read next time like the prior art, so that the correctness of the read data is ensured, if the GC operation is not performed for a long time, even if the original data is destroyed, the new data is already present due to the timely data movement, the risk of data loss is reduced to zero, the high-low temperature read-write data is not lost any more, and the stability and the correctness of the data are improved.
Further, the determining whether the ECC value corresponding to the data page is within a preset range includes:
Judging whether the ECC value corresponding to the data page is larger than or equal to a first preset percentage of a preset threshold value and smaller than or equal to the preset threshold value, if yes, judging that the ECC value corresponding to the data page is in a preset range, and if not, judging that the ECC value corresponding to the data page is not in the preset range.
According to the description, if the ECC value corresponding to the data page falls within the preset range, the ECC value is increased, so that the probability of damage to the data is increased rapidly.
Further, the determining whether the writing of the data of each data page stored in the preset data block is successful includes:
Judging whether the ECC value corresponding to each data page stored in the preset data block is smaller than a second preset percentage of a preset threshold value, if so, successfully writing the data of the data page, and if not, failing to write the data of the data page.
As can be seen from the above description, by setting a preset value and comparing the preset value with the ECC value corresponding to each data page, if the ECC value is smaller than the preset value, it is indicated that the risk of data loss is small, which indicates that the data writing is successful, so that whether the data writing is successful can be quickly and conveniently determined.
Further, the marking the data page includes:
Writing the index corresponding to the data page into a preset data table;
the reading the flash memory data corresponding to each marked data page and storing the flash memory data into the preset data block comprises the following steps:
Reading each index record in the preset data table in sequence, reading corresponding data from the flash memory according to the index record, and storing the corresponding data into the preset data block;
the deleting and writing the marks corresponding to the successful data pages comprises the following steps:
And deleting the index record corresponding to the successfully written data page in the preset data table.
As can be seen from the above description, the index of all the data pages with risk of data loss is recorded and counted by a preset data table, so that the data with risk of data loss can be conveniently moved according to the index record in the preset data table, and the corresponding index of the successfully moved data can be directly deleted in the preset data table, so that the operation is simple, convenient and quick.
Further, the determining whether the writing of each data page data stored in the preset data block is successful, if yes, deleting the mark corresponding to the data page with successful writing, if not, returning to execute the reading of the flash memory data corresponding to the data page of each mark, and storing the flash memory data in the preset data block until the writing of each data page data stored in the preset data block is successful includes:
sequentially judging whether the data of each data page corresponding to each index record in the preset data table is successfully written, if so, deleting the index record corresponding to the data page which is successfully written in the preset data table, and if not, reserving the index record corresponding to the data page which is failed to be written in the preset data table;
And after each index record in the preset data table is judged, judging whether the preset data table is empty, and if not, returning to execute the step of sequentially reading each index record in the preset data table until the preset data table is empty.
As can be seen from the above description, the index records in the preset data table are traversed, for the data page data which is successfully written, the index records corresponding to the data page data which is successfully written are deleted from the preset data table, for the data page data which is failed to be written, the corresponding index records are retained in the preset data table, after the preset data table is traversed once each time, whether the preset data table is empty is judged, if not, the preset data table is continuously traversed until the preset data table is empty, and only the traversing judgment is needed for the index records in the preset data table, so that the data can be conveniently moved, and the data loss is avoided.
Further, the index comprises a data block index number and a data page index number;
the method also comprises the following steps after the data reading is finished:
And judging whether the preset data table has repeated index records, if so, only one index record is reserved, and the rest index records repeated with the reserved index records are deleted, wherein the repeated index records refer to index records with the same index numbers of the data blocks and the data pages.
As can be seen from the above description, for repeated index records, only one index record is reserved, the high efficiency of the subsequent data moving operation is ensured through the duplication removing operation of the index record, the repeated data moving is avoided, and the data processing efficiency and the utilization rate of the data storage space are improved.
Further, after judging that the data of the data page stored in the preset data block is successfully written, the method further comprises the steps of:
and modifying the physical address corresponding to the successfully written data page data into the preset data block.
As can be seen from the above description, for the data page data successfully written in the preset data block, the corresponding physical address is modified into the preset data block, so that the subsequent reading of the data page data can be ensured to be directly read from the preset data block, even if the original data is damaged, the correct reading of the data can be performed from the modified physical address, and the stability and the correctness of the data are improved.
Referring to fig. 2, another embodiment of the present invention provides a data reading apparatus, including:
The reading module is used for reading data from the flash memory according to the data reading request, judging whether the ECC value corresponding to the data page is in a preset range or not every time the data of one data page is read in the data reading process, and if yes, marking the data page;
The storage module is used for reading the flash memory data corresponding to each marked data page and storing the flash memory data into a preset data block;
And the judging module is used for judging whether the data of each data page stored in the preset data block is successfully written, if so, deleting the mark corresponding to the data page successfully written, and if not, returning to execute the reading of the flash memory data corresponding to the data page of each mark, and storing the flash memory data into the preset data block until the data of each data page stored in the preset data block is successfully written.
Another embodiment of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the above-described data reading method.
Referring to fig. 3, another embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the steps of the data reading method when executing the computer program.
The data reading method, the device, the computer readable storage medium and the electronic apparatus of the present invention can be applied to any type of flash memory data reading, such as Nand-flash, nor-flash, etc., and the following description is made with reference to specific embodiments:
Example 1
Referring to fig. 1, a data reading method includes the steps of:
s1, receiving a data reading request, reading data from a flash memory according to the data reading request, judging whether an ECC value corresponding to a data page is in a preset range or not after reading data of one data page in a data reading process, and if so, marking the data page;
The determining whether the ECC value corresponding to the data page is within a preset range includes:
Judging whether the ECC value corresponding to the data page is larger than or equal to a first preset percentage P of a preset threshold value and smaller than or equal to the preset threshold value, if yes, judging that the ECC value corresponding to the data page is in a preset range, if not, judging that the ECC value corresponding to the data page is not in the preset range, namely if the ECC value range is as follows:
threshold value*P≤ECC≤threshold value;
the ECC value is increased, and the damage probability of the page data of the corresponding data page is relatively high;
the threshold value may refer to the maximum ECC value of the flash memory specified by the original factory, for example, the ECC value specified by Nand-flash is 64;
the ECC value is stored in an ECC register, and the value refers to the number of bits of errors in read page data;
p can be dynamically set as required, in an alternative embodiment, P takes 80%;
For the data reading request, the data reading request may include reading of data of a plurality of page pages, or may include reading of data of a specific page only, so that after the data reading is finished, the number of the marked page data may be 0, 1 or more;
s2, reading the flash memory data corresponding to each marked data page, and storing the flash memory data into a preset data block;
Immediately moving the corresponding flash memory data of the marked data page into a preset data block after the data is read;
s3, judging whether each data page data stored in the preset data block is successfully written, if so, deleting the mark corresponding to the successfully written data page, if not, returning to execute the reading of the flash memory data corresponding to each marked data page, and storing the flash memory data in the preset data block until each data page data stored in the preset data block is successfully written;
For all the marked data moved to a preset data block, sequentially judging whether the data of each data page is successfully written, specifically judging whether the ECC value corresponding to each data page stored to the preset data block is smaller than a second preset percentage of a preset threshold value, if so, the data of the data page is successfully written, and if not, the data of the data page is failed to be written;
the preset threshold may refer to a maximum ECC value of the flash memory specified by the factory, for example, the ECC value specified by Nand-flash is 64, and the second preset percentage may be the same as the first preset percentage, and in an optional embodiment, 80% may be taken; the method can also set a percentage different from the first preset percentage according to the actual situation requirement, so that the success of writing is judged and the data loss is easy to cause a transition;
Deleting the corresponding mark of the data page which is successfully written, and reserving the corresponding mark of the data page which is failed to be written;
After finishing one-time traversal of all data page data moved to a preset data block, judging whether a marked data page exists, if so, returning to execute S2 until the marked data page does not exist, namely, until each data page data stored in the preset data block is successfully written;
and for the successfully written data page data, modifying the physical address of the successfully written data page data into the preset data block.
Example two
This embodiment specifically defines how to mark a data page with an increased ECC value relative to embodiment one:
S21, after data of a data page is read in the data reading process, detecting the value of an ECC register, judging whether the page ECC value is greater than or equal to 80% of a preset threshold value and smaller than or equal to the preset threshold value, if yes, writing an index corresponding to the data page into a preset data Table Err Table, wherein the index comprises a data block index number and a data page index number, and as shown in FIG. 4, an index corresponding to the data page with the increased ECC value is recorded in the Table, for example, block_0page_0 refers to a data page with the data block index of 0, block_4page_4 refers to a data page with the data block index of 4, and the data page index of 4 corresponds to the data page;
S22, after the data is read, traversing the Err Table of the preset data Table, detecting whether repeated index records exist, namely whether the index records with the same index numbers of the data blocks and the data pages exist or not, for the repeated index records, only one index record is reserved, and the rest of the repeated index records are deleted, as shown in FIG. 5, two repeated index records page_0block_0 and two repeated index records page_5block_5 exist in the original Err Table, so that one redundant repeated index record is deleted, only one redundant index record is reserved, namely, the other redundant index record page_0block_0 and the other redundant index record page_5block_5 are deleted, and the Err Table after duplication removal is obtained;
s23, reading data of a data page corresponding to each index record in the Err Table, and then storing the data of the data page corresponding to each index record in the Err Table into a target data block, wherein as shown in FIG. 6, the data of the data page corresponding to each index record in the Err Table after duplication removal is sequentially stored into pages 0, 1 and 2 … … in the target block;
S24, sequentially checking whether the data of the data page corresponding to each index record in all Err tables written in the target block are written successfully;
specifically, detecting a value in an ECC register, judging whether the value is less than 80% of a preset threshold value, if yes, successfully writing data, mapping a data physical address of a corresponding data page in an Err Table to a target block, changing a mapping Table L2P address Table from a logical address to a physical address, and clearing a page index record corresponding to the Err Table;
Wherein, as shown in fig. 7, the change to the L2P address table indicates Logical Block Address, i.e. a logical address, the PUA indicates Physical Unit Address, i.e. a physical address, oldPUA indicates a physical address where data is stored before being rewritten, and NewPUA indicates a physical address where data is stored after being rewritten; for example, before the data is rewritten, the corresponding physical address is page_0block_0, after the data is rewritten, the physical address stored in the data is changed from page_0block_0 to page0 Target Blcok when the data is written into page0 of target blcok;
If not, the writing fails, and an index record corresponding to the data page with the writing failure in the Err Table is reserved;
After each index record in the Err Table is judged, namely after all the index records are detected, judging whether the Err Table is empty or not, and if not, returning to S23 until the Err Table is empty.
Example III
Referring to fig. 2, the present embodiment provides a data reading apparatus, including:
The reading module is used for reading data from the flash memory according to the data reading request, judging whether the ECC value corresponding to the data page is in a preset range or not every time the data of one data page is read in the data reading process, and if yes, marking the data page;
The storage module is used for reading the flash memory data corresponding to each marked data page and storing the flash memory data into a preset data block;
And the judging module is used for judging whether the data of each data page stored in the preset data block is successfully written, if so, deleting the mark corresponding to the data page successfully written, and if not, returning to execute the reading of the flash memory data corresponding to the data page of each mark, and storing the flash memory data into the preset data block until the data of each data page stored in the preset data block is successfully written.
Example IV
The present embodiment provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the data reading method in the first or second embodiments.
Example five
Referring to fig. 3, the present embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the steps of the data reading method in the first embodiment or the second embodiment when executing the computer program.
In summary, in the data reading process of the flash memory data, the index corresponding to the data page with the increased ECC value is recorded and counted by the preset data table, after the data reading is completed, the preset data table is de-duplicated, the flash memory data corresponding to the data page recorded by each index in the de-duplicated preset data table is read and stored into the preset data block, whether the flash memory data stored into the preset data block is successfully written is judged, the physical address of the data which is successfully written is changed, the mapping table from the logical address to the physical address is changed, and the data which is failed to be written is re-read and written into the preset data block until the writing is successful; after the flash memory data are read, the data with the raised ECC value are immediately moved to a safe preset data block, and the data can be moved only by starting GC operation when the data need not wait for the next data reading command in the prior art, so that the correctness of the read data is ensured, and if the GC operation is not performed for a long time, even if the original data are destroyed, the new data are already present due to the timely data movement, the risk of data loss is reduced to zero, the high-low temperature read-write data can be ensured not to be lost any more, and the stability and the correctness of the data are improved.
In the foregoing embodiments of the present application, it should be understood that the disclosed method, apparatus, computer readable storage medium and electronic device may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple components or modules may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with respect to each other may be an indirect coupling or communication connection via some interfaces, devices or components or modules, which may be in electrical, mechanical, or other forms.
The components illustrated as separate components may or may not be physically separate, and components shown as components may or may not be physical modules, i.e., may be located in one place, or may be distributed over multiple network modules. Some or all of the components may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each component may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
The integrated modules, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present invention is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all required for the present invention.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.
Claims (9)
1. A data reading method, comprising the steps of:
Reading data from the flash memory according to a data reading request, judging whether an ECC value corresponding to a data page is in a preset range or not every time the data of one data page is read in the data reading process, and if so, marking the data page;
reading the flash memory data corresponding to each marked data page and storing the flash memory data into a preset data block;
Judging whether each data page data stored in the preset data block is successfully written, if so, deleting the mark corresponding to the data page which is successfully written, if not, returning to execute the reading of the flash memory data corresponding to the data page of each mark, and storing the flash memory data in the preset data block until each data page data stored in the preset data block is successfully written;
The determining whether the ECC value corresponding to the data page is within a preset range includes:
Judging whether the ECC value corresponding to the data page is larger than or equal to a first preset percentage of a preset threshold value and smaller than or equal to the preset threshold value, if yes, judging that the ECC value corresponding to the data page is in a preset range, and if not, judging that the ECC value corresponding to the data page is not in the preset range.
2. The method of claim 1, wherein determining whether each page of data stored in the predetermined data block is successfully written comprises:
Judging whether the ECC value corresponding to each data page stored in the preset data block is smaller than a second preset percentage of a preset threshold value, if so, successfully writing the data of the data page, and if not, failing to write the data of the data page.
3. A data reading method according to claim 2, wherein said marking said data page comprises:
Writing the index corresponding to the data page into a preset data table;
the reading the flash memory data corresponding to each marked data page and storing the flash memory data into the preset data block comprises the following steps:
Reading each index record in the preset data table in sequence, reading corresponding data from the flash memory according to the index record, and storing the corresponding data into the preset data block;
the deleting and writing the marks corresponding to the successful data pages comprises the following steps:
And deleting the index record corresponding to the successfully written data page in the preset data table.
4. A method for reading data according to claim 3, wherein determining whether each page of data stored in the preset data block is successfully written, if so, deleting a flag corresponding to a successfully written page of data, and if not, returning to execute reading of flash memory data corresponding to a page of data of each flag, and storing the flash memory data in the preset data block until each page of data stored in the preset data block is successfully written comprises:
sequentially judging whether the data of each data page corresponding to each index record in the preset data table is successfully written, if so, deleting the index record corresponding to the data page which is successfully written in the preset data table, and if not, reserving the index record corresponding to the data page which is failed to be written in the preset data table;
And after each index record in the preset data table is judged, judging whether the preset data table is empty, and if not, returning to execute the step of sequentially reading each index record in the preset data table until the preset data table is empty.
5. A data reading method according to claim 3, wherein the index comprises a data block index number and a data page index number;
the method also comprises the following steps after the data reading is finished:
And judging whether the preset data table has repeated index records, if so, only one index record is reserved, and the rest index records repeated with the reserved index records are deleted, wherein the repeated index records refer to index records with the same index numbers of the data blocks and the data pages.
6. The data reading method according to any one of claims 1 to 2,4 to 5, wherein after judging that the writing of the data page data stored to the preset data block is successful, further comprising the step of:
and modifying the physical address corresponding to the successfully written data page data into the preset data block.
7. A data reading apparatus, comprising:
The reading module is used for reading data from the flash memory according to the data reading request, judging whether the ECC value corresponding to the data page is in a preset range or not every time the data of one data page is read in the data reading process, and if yes, marking the data page;
The determining whether the ECC value corresponding to the data page is within a preset range includes:
Judging whether the ECC value corresponding to the data page is larger than or equal to a first preset percentage of a preset threshold value and smaller than or equal to the preset threshold value, if so, judging that the ECC value corresponding to the data page is in a preset range, and if not, judging that the ECC value corresponding to the data page is not in the preset range;
The storage module is used for reading the flash memory data corresponding to each marked data page and storing the flash memory data into a preset data block;
And the judging module is used for judging whether the data of each data page stored in the preset data block is successfully written, if so, deleting the mark corresponding to the data page successfully written, and if not, returning to execute the reading of the flash memory data corresponding to the data page of each mark, and storing the flash memory data into the preset data block until the data of each data page stored in the preset data block is successfully written.
8. A computer-readable storage medium having stored thereon a computer program, characterized by: the computer program, when executed by a processor, implements the steps of a data reading method as claimed in any one of claims 1 to 6.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of a data reading method according to any of claims 1-6 when the computer program is executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010619558.3A CN111930302B (en) | 2020-06-30 | 2020-06-30 | Data reading method, device, computer readable storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010619558.3A CN111930302B (en) | 2020-06-30 | 2020-06-30 | Data reading method, device, computer readable storage medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111930302A CN111930302A (en) | 2020-11-13 |
CN111930302B true CN111930302B (en) | 2024-10-18 |
Family
ID=73316957
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010619558.3A Active CN111930302B (en) | 2020-06-30 | 2020-06-30 | Data reading method, device, computer readable storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111930302B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112817879B (en) * | 2021-01-11 | 2023-04-11 | 成都佰维存储科技有限公司 | Garbage recycling method and device, readable storage medium and electronic equipment |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109582488A (en) * | 2018-12-03 | 2019-04-05 | 郑州云海信息技术有限公司 | A kind of wrong prevention method and relevant apparatus of solid state hard disk |
Family Cites Families (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4866107B2 (en) * | 2006-03-08 | 2012-02-01 | パナソニック株式会社 | Nonvolatile memory device and write determination method thereof |
TW200947450A (en) * | 2008-05-09 | 2009-11-16 | A Data Technology Co Ltd | Storage system capable of data recovery and method thereof |
TWI382422B (en) * | 2008-07-11 | 2013-01-11 | Genesys Logic Inc | Storage device for refreshing data pages of flash memory based on error correction code and method for the same |
US20110072333A1 (en) * | 2009-09-24 | 2011-03-24 | Innostor Technology Corporation | Control method for flash memory based on variable length ecc |
TWI473103B (en) * | 2011-09-14 | 2015-02-11 | 威剛科技股份有限公司 | Flash memory storage device and method for determining bad storage area thereof |
CN104091617B (en) * | 2014-06-17 | 2017-05-03 | 深圳市江波龙电子有限公司 | Flash memory equipment detection method and apparatus thereof |
CN107391300B (en) * | 2017-07-26 | 2020-07-14 | 湖南国科微电子股份有限公司 | Method and system for improving data storage reliability of flash memory |
CN109343790B (en) * | 2018-08-06 | 2021-07-13 | 百富计算机技术(深圳)有限公司 | Data storage method based on NAND FLASH, terminal equipment and storage medium |
CN110459259A (en) * | 2019-07-31 | 2019-11-15 | 至誉科技(武汉)有限公司 | Store test method, system and the storage medium of equipment write error error correcting capability |
-
2020
- 2020-06-30 CN CN202010619558.3A patent/CN111930302B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109582488A (en) * | 2018-12-03 | 2019-04-05 | 郑州云海信息技术有限公司 | A kind of wrong prevention method and relevant apparatus of solid state hard disk |
Also Published As
Publication number | Publication date |
---|---|
CN111930302A (en) | 2020-11-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108733510B (en) | Data storage device and mapping table reconstruction method | |
US11966295B2 (en) | Capacitor energy management for unexpected power loss in datacenter SSD devices | |
KR101870521B1 (en) | Methods and systems for improving storage journaling | |
US20130013874A1 (en) | Data store page recovery | |
WO2023116346A1 (en) | Method and system for recovering trim data under abnormal power failure, and solid-state drive | |
CN113223583B (en) | Method for re-reading data in NAND FLASH bad blocks, electronic equipment and storage medium | |
CN112379830B (en) | Method and device for creating effective data bitmap, storage medium and electronic equipment | |
TW201810289A (en) | Method for selecting bad columns and data storage device with bad column summary table | |
US8959416B1 (en) | Memory defect management using signature identification | |
CN110231914B (en) | Data storage device and method of operating the same | |
US10127106B2 (en) | Redundant disk array system and data storage method thereof | |
CN111930302B (en) | Data reading method, device, computer readable storage medium and electronic equipment | |
CN113220221A (en) | Memory controller and data processing method | |
US20120226957A1 (en) | Controller, data storage device and program product | |
CN113391941A (en) | RAID read-write timeout processing method, device, equipment and medium | |
CN100367181C (en) | Hard disk re-identification system in redundant array of inexpensive disks and method thereof | |
CN112905496A (en) | Garbage recycling method and device, readable storage medium and electronic equipment | |
CN116795296B (en) | Data storage method, storage device and computer readable storage medium | |
CN110688257A (en) | Method, device and equipment for repairing local metadata of full flash memory array | |
CN115509466B (en) | Data management method and device, electronic equipment and storage medium | |
CN115454710B (en) | Flash memory data reading method and device, electronic equipment and storage medium | |
CN112698984B (en) | Database recovery method of embedded device, electronic device and medium | |
CN113050888B (en) | Method, system, device and storage medium for quickly removing unstable Flash blocks | |
US11550710B2 (en) | Data processing method and memory controller utilizing the same | |
US9262264B2 (en) | Error correction code seeding |
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 | ||
CB02 | Change of applicant information |
Address after: 518000 floors 1-3 and 4 of buildings 4 and 8, zone 2, Zhongguan honghualing Industrial South Zone, No. 1213 Liuxian Avenue, Pingshan community, Taoyuan Street, Nanshan District, Shenzhen, Guangdong Applicant after: BIWIN STORAGE TECHNOLOGY Co.,Ltd. Address before: 518000 1st, 2nd, 4th and 6th floors of No.4 factory building of tongfuyu industrial city, Taoyuan Street, Nanshan District, Shenzhen City, Guangdong Province Applicant before: BIWIN STORAGE TECHNOLOGY Co.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |