Data reading method, device, computer readable storage medium and electronic device

By marking and promptly moving data pages with increased ECC values ​​during the flash data reading process, the problem of data loss caused by increased ECC values ​​in flash memory is solved, data stability and correctness are achieved, and the risk of data loss is reduced. .

CN111930302BActive Publication Date: 2024-10-18BIWIN STORAGE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010619558.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-30
Publication Date
2024-10-18
Estimated Expiration
2040-06-30

AI Technical Summary

Technical Problem

When writing to flash memory at high temperatures, the ECC value increases rapidly when reading data at low temperatures, leading to the risk of data loss. The existing technology requires waiting for the next data read command before performing a GC operation to deal with this problem.

Method used

During the data reading process, the data pages whose ECC value is within the preset range are marked and stored in the preset data block. After determining that the write is successful, the mark is deleted. If the write fails, read and write again. Until successful, avoid waiting for the next data read command.

Benefits of technology

Through timely data migration, the risk of data loss is reduced, the stability and correctness of data during high and low temperature reading and writing are ensured, and data loss caused by waiting for GC operations is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111930302B_ABST
    Figure CN111930302B_ABST
Patent Text Reader

Abstract

The present invention discloses a data reading method, device, computer-readable storage medium and electronic device. The data reading method comprises the following steps: reading data from a flash memory according to a data reading request, during the data reading process, after each data page is read, judging whether the ECC value corresponding to the data page is within a preset range, if so, marking the data page; reading the flash memory data corresponding to each marked data page and storing it in a preset data block; judging whether each data page data stored in the preset data block is written successfully, if so, deleting the mark corresponding to the successfully written data page, if not, returning to execute reading the flash memory data corresponding to each marked data page, and storing it in the preset data block until each data page data stored in the preset data block is written successfully; by timely data migration, the risk of data loss is reduced to zero, and it can be ensured that high and low temperature reading and writing data are no longer lost, thereby improving the stability and correctness of the data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of flash memory technology, and in particular to a data reading method, device, computer-readable storage medium and electronic device. Background Art

[0002] When the current data is written to the flash memory (such as Nand-flash, Nor-flash, etc.) at high temperature and read from the flash memory at low temperature, the ecc (error correcting code) value often increases rapidly. In response to this situation, the conventional processing method is to mark the block corresponding to the rapid increase in the ecc value as Refresh, and start the GC (Garbage Collection) algorithm when the next data read command is received to move the corresponding block data. However, if the data read command is received after a long period of time, the GC operation will not be performed for a long time, and there will be a risk of data loss. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide a data reading method, device, computer-readable storage medium and electronic device to prevent data loss.

[0004] In order to solve the above technical problems, a technical solution adopted by the present invention is:

[0005] A data reading method comprises the steps of:

[0006] Reading data from the flash memory according to a data read request, during the data reading process, after each data page is read, determining whether the ECC value corresponding to the data page is within a preset range, and if so, marking the data page;

[0007] Read the flash memory data corresponding to each marked data page and store it in a preset data block;

[0008] Determine whether each data page stored in the preset data block is written successfully. If so, delete the mark corresponding to the successfully written data page. If not, return to execute reading the flash memory data corresponding to each marked data page and store it in the preset data block until each data page stored in the preset data block is written successfully.

[0009] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0010] A data reading device, comprising:

[0011] A reading module, used to read data from the flash memory according to a data reading request. During the data reading process, after each data page is read, it is determined whether the ECC value corresponding to the data page is within a preset range. If so, the data page is marked;

[0012] A storage module, used for reading the flash memory data corresponding to each marked data page and storing it in a preset data block;

[0013] The judgment module is used to judge whether each data page stored in the preset data block is written successfully. If so, delete the mark corresponding to the successfully written data page; if not, return to execute reading the flash memory data corresponding to each marked data page and store it in the preset data block until each data page stored in the preset data block is written successfully.

[0014] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0015] A computer-readable storage medium stores a computer program, which implements each step of the above data reading method when executed by a processor.

[0016] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0017] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein each step in the above-mentioned data reading method is implemented when the processor executes the computer program.

[0018] The beneficial effects of the present invention are as follows: during the flash memory data reading process, data pages with ECC values ​​within a preset range are marked, and after the data reading is completed, the flash memory data corresponding to all marked data pages are read and stored in preset data blocks, and it is determined whether the flash memory data stored in the preset data blocks is successfully written, and the data that fails to be written is re-read and written into the preset data blocks until the writing is successful; after reading the flash memory data, the data with abnormal ECC values ​​is immediately moved to a safe preset data block, without the need to wait for the next data read command as in the prior art, and the data can only be moved by starting the GC operation, thereby ensuring the correctness of the read data and ensuring that if there is no GC operation for a long time, even if the original data is destroyed, the new data already exists due to timely data migration, and there is no risk of data loss, reducing the risk of data loss to zero, ensuring that high and low temperature reading and writing data are no longer lost, and improving the stability and correctness of the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A flowchart of a data reading method according to an embodiment of the present invention;

[0020] Figure 2 A schematic diagram of the structure of a data reading device according to an embodiment of the present invention;

[0021] Figure 3 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention;

[0022] Figure 4 A schematic diagram of a preset data table for storing data page indexes with increased ECC values ​​according to an embodiment of the present invention;

[0023] Figure 5 A schematic diagram of deduplication of a preset data table according to an embodiment of the present invention;

[0024] Figure 6 A schematic diagram of writing data into a target data block target block according to an embodiment of the present invention;

[0025] Figure 7 A schematic diagram of updating a mapping table from a logical address to a physical address according to an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.

[0027] Please refer to Figure 1 , an embodiment of the present invention provides a data reading method, comprising the steps of:

[0028] Reading data from the flash memory according to a data read request, during the data reading process, after each data page is read, determining whether the ECC value corresponding to the data page is within a preset range, and if so, marking the data page;

[0029] Read the flash memory data corresponding to each marked data page and store it in a preset data block;

[0030] Determine whether each data page stored in the preset data block is written successfully. If so, delete the mark corresponding to the successfully written data page. If not, return to execute reading the flash memory data corresponding to each marked data page and store it in the preset data block until each data page stored in the preset data block is written successfully.

[0031] From the above description, it can be seen that the beneficial effects of the present invention are: in the process of reading flash memory data, the data pages with ECC values ​​within the preset range are marked, and after the data reading is completed, the flash memory data corresponding to all marked data pages are read and stored in the preset data blocks, and it is determined whether the flash memory data stored in the preset data blocks is written successfully. The data that failed to be written is re-read and written into the preset data blocks until the writing is successful; after reading the flash memory data, the data with abnormal ECC values ​​is immediately moved to a safe preset data block, without the need to wait for the next data read command as in the prior art, and the data can only be moved by starting the GC operation, thereby ensuring the correctness of the read data, and ensuring that if there is no GC operation for a long time, even if the original data is destroyed, the new data already exists through timely data movement, and there is no risk of data loss, which reduces the risk of data loss to zero, can ensure that high and low temperature reading and writing data are no longer lost, and improve the stability and correctness of the data.

[0032] Further, the determining whether the ECC value corresponding to the data page is within a preset range includes:

[0033] Determine whether the ECC value corresponding to the data page is greater than or equal to a first preset percentage of a preset threshold and less than or equal to the preset threshold; if so, determine that the ECC value corresponding to the data page is within a preset range; if not, determine that the ECC value corresponding to the data page is not within the preset range.

[0034] From the above description, it can be seen that by setting a preset range, if the ECC value corresponding to the data page falls within the range, it means that its ECC value increases, resulting in a rapidly increased probability of data damage. By setting the range and comparing it with the ECC value corresponding to the data page, it is possible to quickly and easily determine whether the corresponding data page is at risk of loss.

[0035] Furthermore, the determining whether each data page stored in the preset data block is written successfully includes:

[0036] It is determined whether the ECC value corresponding to each data page stored in the preset data block is less than a second preset percentage of the preset threshold value. If so, the data of the data page is written successfully; otherwise, the data of the data page is written unsuccessfully.

[0037] From the above description, it can be seen that by setting a preset value and comparing it with the ECC value corresponding to each data page, if the ECC value is less than the preset value, it means that the risk of data loss is small, indicating that the data is written successfully, thereby quickly and conveniently judging whether the data is written successfully.

[0038] Further, marking the data page includes:

[0039] Writing the index corresponding to the data page into a preset data table;

[0040] The step of reading the flash memory data corresponding to each marked data page and storing the data in the preset data block includes:

[0041] 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 data in the preset data block;

[0042] The mark corresponding to the successfully written data page includes:

[0043] Delete the index record corresponding to the successfully written data page in the preset data table.

[0044] From the above description, it can be seen that by using a preset data table to record and count the indexes of all data pages that may be at risk of data loss, the data that may be at risk of data loss can be easily moved according to the index records in the preset data table, and for the data that has been successfully moved, its corresponding index can be directly deleted in the preset data table, which is simple and quick to operate.

[0045] Further, the step of determining whether each data page stored in the preset data block is written successfully, and if so, deleting the mark corresponding to the successfully written data page, and if not, returning to execute reading the flash memory data corresponding to each marked data page, and storing it in the preset data block until each data page stored in the preset data block is written successfully includes:

[0046] Determine in sequence whether the data page data corresponding to each index record in the preset data table is written successfully, if the writing is successful, delete the index record corresponding to the successfully written data page in the preset data table, if the writing fails, retain the index record corresponding to the failed written data page in the preset data table;

[0047] After each index record in the preset data table has been judged, it is determined whether the preset data table is empty. If not, the process returns to the step of sequentially reading each index record in the preset data table until the preset data table is empty.

[0048] From the above description, it can be seen that the index records in the preset data table are traversed, and for the data page data that is written successfully, the corresponding index records are deleted from the preset data table. For the data page data that fails to be written, the corresponding index records are retained in the preset data table. After each traversal of the preset data table, it is determined whether the preset data table is empty. If not, the preset data table continues to be traversed until the preset data table is empty. It is only necessary to traverse and determine the index records in the preset data table, which can conveniently realize the movement of data and avoid data loss.

[0049] Further, the index includes a data block index number and a data page index number;

[0050] After the data is read, the following steps are also included:

[0051] Determine whether there are duplicate index records in the preset data table. If so, only retain one of the index records and delete the remaining index records that are duplicated with the retained index record. The duplicate index record refers to an index record with the same data block index number and data page index number.

[0052] From the above description, it can be seen that for duplicate index records, only one index record is retained. The deduplication operation of the index records ensures the efficiency of subsequent data migration operations, avoids duplicate data migration, and improves data processing efficiency and utilization of data storage space.

[0053] Further, after determining that the data page data stored in the preset data block is written successfully, the method further includes the following steps:

[0054] The physical address corresponding to the successfully written data page data is modified to the preset data block.

[0055] From the above description, it can be seen that for the data page data successfully written in the preset data block, the corresponding physical address is modified to the preset data block, which can ensure that the subsequent reading of the data page data can be directly read from the preset data block. Even if the original data is damaged, the data can be correctly read from the modified physical address, thereby improving the stability and correctness of the data.

[0056] Please refer to Figure 2 Another embodiment of the present invention provides a data reading device, comprising:

[0057] A reading module, used to read data from the flash memory according to a data reading request. During the data reading process, after each data page is read, it is determined whether the ECC value corresponding to the data page is within a preset range. If so, the data page is marked;

[0058] A storage module, used for reading the flash memory data corresponding to each marked data page and storing it in a preset data block;

[0059] The judgment module is used to judge whether each data page stored in the preset data block is written successfully. If so, delete the mark corresponding to the successfully written data page; if not, return to execute reading the flash memory data corresponding to each marked data page and store it in the preset data block until each data page stored in the preset data block is written successfully.

[0060] Another embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above data reading method are implemented.

[0061] Please refer to Figure 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 executable on the processor, wherein the processor implements each step of the above-mentioned data reading method when executing the computer program.

[0062] The data reading method, device, computer-readable storage medium and electronic device of the present invention can be applied to reading data of any type of flash memory, such as Nand-flash, Nor-flash, etc., and are described below in conjunction with specific embodiments:

[0063] Embodiment 1

[0064] Please refer to Figure 1 , a data reading method, comprising the steps of:

[0065] S1, receiving a data read request, reading data from a flash memory according to the data read request, and during the data reading process, after each data page is read, determining whether the ECC value corresponding to the data page is within a preset range, and if so, marking the data page;

[0066] Wherein, determining whether the ECC value corresponding to the data page is within a preset range includes:

[0067] Determine whether the ECC value corresponding to the data page is greater than or equal to a first preset percentage P of a preset threshold value and less than or equal to the preset threshold value. If so, determine that the ECC value corresponding to the data page is within a preset range. If not, determine that the ECC value corresponding to the data page is not within the preset range. That is, if the ECC value range is as follows:

[0068] threshold value*P≤ECC≤threshold value;

[0069] This indicates that the ECC value increases, and the corresponding data page is more likely to be damaged;

[0070] The threshold value can refer to the maximum ECC value of the flash memory specified by the manufacturer, for example, the ECC value specified by Nand-flash is 64;

[0071] The ECC value is stored in the ECC register, and its value refers to the number of erroneous bits in a page of page data read;

[0072] P can be set dynamically as needed. In an optional implementation, P is 80%;

[0073] For a data read request, it may include reading data from multiple pages or only reading data from a specific page. Therefore, after the data is read, the number of marked page data may be 0, 1, or more.

[0074] S2, reading the flash memory data corresponding to each marked data page, and storing it in a preset data block;

[0075] That is, after the data is read, for the marked data page, the corresponding flash memory data is immediately moved to the preset data block;

[0076] S3, determining whether each data page stored in the preset data block is written successfully, if so, deleting the mark corresponding to the successfully written data page, if not, returning to execute reading the flash memory data corresponding to each marked data page, and storing it in the preset data block until each data page stored in the preset data block is written successfully;

[0077] For all the marked data moved to the preset data block, determine in turn whether the data of each data page is written successfully. Specifically, determine whether the ECC value corresponding to each data page stored in the preset data block is less than a second preset percentage of a preset threshold. If so, the data of the data page is written successfully. If not, the data of the data page fails to be written.

[0078] The preset threshold value may refer to the maximum ECC value of the flash memory specified by the manufacturer, such as the ECC value specified by Nand-flash is 64. The second preset percentage may be the same as the first preset percentage. In an optional implementation, it may be 80%. It may also be set to be different from the first preset percentage according to actual needs, so that there is a transition between judging whether the writing is successful and whether data loss is likely to occur.

[0079] For data pages that are successfully written, the corresponding mark is deleted, and for data pages that are failed to be written, the corresponding mark is retained;

[0080] After completing a traversal of all data pages moved to the preset data block, determine whether there is a marked data page. If so, return to execute S2 until there is no marked data page, that is, until each data page stored in the preset data block is written successfully;

[0081] For the data page data that is written successfully, the corresponding physical address is modified to the preset data block.

[0082] Embodiment 2

[0083] Compared with the first embodiment, this embodiment specifically defines how to mark data pages with increased ECC values:

[0084] S21. During the data reading process, after each data page is read, the value of the ECC register is detected to determine whether the page ECC value is greater than or equal to 80% of the preset threshold value and less than or equal to the preset threshold value. If so, the index corresponding to the data page is written into the preset data table Err Table, where the index includes the data block index number and the data page index number, such as Figure 4 As shown, the table records the indexes corresponding to the data pages with increasing ECC values, for example, block_0page_0 refers to the data page corresponding to the data block index 0 and the data page index 0, and block_4page_4 refers to the data page corresponding to the data block index 4 and the data page index 4;

[0085] S22, after the data is read, the preset data table Err Table is traversed to detect whether there are duplicate index records, that is, whether there are index records with the same data block index number and data page index number. For duplicate index records, only one index record is retained and the rest of the duplicate index records are deleted, such as Figure 5 As shown, there are two duplicate index records page_0block_0 and two duplicate index records page_5block_5 in the original ErrTable, so delete one of the redundant duplicate index records and keep only one of them, that is, delete the other redundant page_0block_0 index record and the other page_5block_5 index record to obtain the Err Table after deduplication.

[0086] S23, read the data of the data page page corresponding to each index record in the Err Table, and then store all of them in the target data block target block, such as Figure 6 As shown, the data of the data page corresponding to each index record in the Err Table after deduplication is stored in page 0, page 1, page 2, etc. in the target block in sequence;

[0087] S24, check in turn whether the data of the data page corresponding to each index record in all Err Tables written in the target block is written successfully;

[0088] Specifically, the value in the ECC register is detected to determine whether the value is less than 80% of the preset threshold value. If so, the data is written successfully, the data physical address of the corresponding data page in the Err Table is mapped to the targetblock, the mapping table L2P address table of the logical address to the physical address is changed, and the corresponding page index record in the Err Table is cleared;

[0089] Among them, the changes to the L2P address table are as follows Figure 7 As shown, LBA refers to Logical Block Address, PUA refers to Physical Unit Address, OldPUA refers to the physical address where the data is stored before it is rewritten, and NewPUA refers to the physical address where the data is stored after it is rewritten; for example, before the data is rewritten, its corresponding physical address is page_0block_0, and after it is rewritten, it is written to page0 of target block, then the physical address where the data is stored is changed from page_0block_0 to page0 Target Block;

[0090] If not, the write fails, and the index record corresponding to the data page where the write fails in the Err Table is retained;

[0091] After each index record in the Err Table has been judged, that is, after all the tests have been completed, it is determined whether the Err Table is empty. If it is not empty, the process returns to execute S23 until the Err Table is empty.

[0092] Embodiment 3

[0093] Please refer to Figure 2 , this embodiment provides a data reading device, including:

[0094] A reading module, used to read data from the flash memory according to a data reading request. During the data reading process, after each data page is read, it is determined whether the ECC value corresponding to the data page is within a preset range. If so, the data page is marked;

[0095] A storage module, used for reading the flash memory data corresponding to each marked data page and storing it in a preset data block;

[0096] The judgment module is used to judge whether each data page stored in the preset data block is written successfully. If so, delete the mark corresponding to the successfully written data page; if not, return to execute reading the flash memory data corresponding to each marked data page and store it in the preset data block until each data page stored in the preset data block is written successfully.

[0097] Embodiment 4

[0098] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, each step in the data reading method in the first or second embodiment is implemented.

[0099] Embodiment 5

[0100] Please refer to Figure 3 This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step in the data reading method in Embodiment 1 or Embodiment 2 is implemented.

[0101] In summary, the present invention provides a data reading method, device, computer scale storage ring and electronic device. In the process of flash memory data reading, the index corresponding to the data page with increased ECC value is recorded and counted in a preset data table. After the data is read, the preset data table is deduplicated, and the flash memory data corresponding to the data page of each index record in the deduplicated preset data table is read and stored in the preset data block. It is judged whether the flash memory data stored in the preset data block is written successfully. For the data that is written successfully, its physical address is changed, and the mapping table from the logical address to the physical address is changed. For the data that fails to be written, it is re-read and written into the preset data block until the writing is successful. After reading the flash memory data, the data with increased ECC value is immediately moved to a safe preset data block, without waiting for the next data read command as in the prior art, and the data can be moved by starting the GC operation, thereby ensuring the correctness of the read data and ensuring that if there is no GC operation for a long time, even if the original data is destroyed, the new data already exists due to the timely data movement, and there is no risk of data loss. The risk of data loss is reduced to zero, and it can ensure that high and low temperature reading and writing data are no longer lost, thereby improving the stability and correctness of the data.

[0102] In the above embodiments provided in the present application, it should be understood that the disclosed methods, devices, computer-readable storage media, and electronic devices can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple components or modules can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or components or modules, which can be electrical, mechanical or other forms.

[0103] The components described as separate components may or may not be physically separated, and the components shown as components may or may not be physical modules, that is, they may be located in one place or distributed on 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.

[0104] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each component may exist physically separately, or two or more modules may be integrated into one module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0105] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0106] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0107] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0108] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A data reading method, characterized in that: Includes steps: Reading data from the flash memory according to a data read request, during the data reading process, after each data page is read, determining whether the ECC value corresponding to the data page is within a preset range, and if so, marking the data page; Read the flash memory data corresponding to each marked data page and store it in a preset data block; Determine whether each data page stored in the preset data block is written successfully, if so, delete the mark corresponding to the successfully written data page, if not, return to execute reading the flash memory data corresponding to each marked data page, and store it in the preset data block until each data page stored in the preset data block is written successfully; The determining whether the ECC value corresponding to the data page is within a preset range includes: Determine whether the ECC value corresponding to the data page is greater than or equal to a first preset percentage of a preset threshold and less than or equal to the preset threshold; if so, determine that the ECC value corresponding to the data page is within a preset range; if not, determine that the ECC value corresponding to the data page is not within the preset range.

2. A data reading method according to claim 1, characterized in that: The step of determining whether each data page stored in the preset data block is written successfully comprises: It is determined whether the ECC value corresponding to each data page stored in the preset data block is less than a second preset percentage of the preset threshold value. If so, the data of the data page is written successfully; otherwise, the data of the data page is written unsuccessfully.

3. A data reading method according to claim 2, characterized in that: The marking of the data page comprises: Writing the index corresponding to the data page into a preset data table; The step of reading the flash memory data corresponding to each marked data page and storing the data in the preset data block includes: 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 data in the preset data block; The mark corresponding to the successfully written data page includes: Delete the index record corresponding to the successfully written data page in the preset data table.

4. A data reading method according to claim 3, characterized in that: The step of determining whether each data page stored in the preset data block is successfully written, and if so, deleting the mark corresponding to the successfully written data page, and if not, returning to execute reading the flash memory data corresponding to each marked data page, and storing it in the preset data block until each data page stored in the preset data block is successfully written includes: Determine in sequence whether the data page data corresponding to each index record in the preset data table is written successfully, if the writing is successful, delete the index record corresponding to the successfully written data page in the preset data table, if the writing fails, retain the index record corresponding to the failed written data page in the preset data table; After each index record in the preset data table has been judged, it is determined whether the preset data table is empty. If not, the process returns to 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, characterized in that: The index includes a data block index number and a data page index number; After the data is read, the following steps are also included: Determine whether there are duplicate index records in the preset data table. If so, only retain one of the index records and delete the remaining index records that are duplicated with the retained index record. The duplicate index record refers to an index record with the same data block index number and data page index number.

6. A data reading method according to any one of claims 1 to 2, 4 to 5, characterized in that: After determining that the data page data stored in the preset data block is written successfully, the method further includes the following steps: The physical address corresponding to the successfully written data page data is modified to the preset data block.

7. A data reading device, characterized in that: include: A reading module, used to read data from the flash memory according to a data reading request. During the data reading process, after each data page is read, it is determined whether the ECC value corresponding to the data page is within a preset range. If so, the data page is marked; The determining whether the ECC value corresponding to the data page is within a preset range includes: Determine whether the ECC value corresponding to the data page is greater than or equal to a first preset percentage of a preset threshold and less than or equal to the preset threshold, if so, determine that the ECC value corresponding to the data page is within a preset range, if not, determine that the ECC value corresponding to the data page is not within the preset range; A storage module, used for reading the flash memory data corresponding to each marked data page and storing it in a preset data block; The judgment module is used to judge whether each data page stored in the preset data block is written successfully. If so, delete the mark corresponding to the successfully written data page; if not, return to execute reading the flash memory data corresponding to each marked data page and store it in the preset data block until each data page stored in the preset data block is written successfully.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step in a data reading method as described in any one of claims 1 to 6 is implemented.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, each step in the data reading method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • An error prevention method of a solid state disk and a related device

    CN109582488A