Processing method for enhancing flash memory data reliability and flash memory storage

By dynamically adjusting the filling strategy in the flash memory according to the free area and the size of the data to be written, and generating verification data related to the data to be written, the problem of uneven charge distribution caused by incomplete physical pages is solved, and the error correction capability and reliability of the data are improved.

CN119620942BActive Publication Date: 2025-10-28SHENZHEN LINGDECHUANG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411704441.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-10-28
Estimated Expiration
2044-11-26

AI Technical Summary

Technical Problem

In flash memory data organization, when physical pages are not fully written, uneven charge distribution occurs, increasing the bad block rate, reducing performance, and increasing the risk of data loss.

Method used

The filling strategy is dynamically adjusted by the size of the free area and the data to be written, generating filling data with verification function related to the data to be written, and writing it into the physical page to reduce the free space of the physical page.

Benefits of technology

It enhances data error correction capabilities, improves data integrity and reliability, and reduces the amount of free space on physical pages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119620942B_ABST
    Figure CN119620942B_ABST
Patent Text Reader

Abstract

This application provides a processing method and a flash memory for enhancing the reliability of flash data. The flash memory acquires data to be written; when it is determined that the data to be written cannot fill the physical page to be written, it determines the fill data for the free area based on the size of the free area of ​​the physical page. The fill data is data with verification function related to the data to be written; and the data to be written and the fill data are written into the physical page. Therefore, in this application, the flash memory dynamically adjusts the filling strategy by adjusting the size of the free area and the data to be written, which can reduce the free space of the physical page. Furthermore, since the fill data is data related to the data to be written and has verification function, it can enhance the error correction capability of the data, thus contributing to the enhancement of data integrity and reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, and in particular to a processing method and a flash memory that enhances the reliability of flash data. Background Technology

[0002] The data organization of NAND flash memory consists of dies, blocks, and pages. A physical page is the smallest unit for performing editing operations. When a physical page is not full, it may cause problems such as uneven charge distribution inside the flash memory, or cause read / write data interference, increased bad block rate, etc., which will lead to flash memory performance degradation, shortened lifespan, and increased risk of data loss. Summary of the Invention

[0003] This application provides a processing method and a flash memory to enhance the reliability of flash data. The flash memory dynamically adjusts the filling strategy by adjusting the size of the free area and the data to be written, which can reduce the free space of physical pages. Since the filling data is related to the data to be written and has a verification function, it can enhance the error correction capability of the data and help enhance the integrity and reliability of the data.

[0004] In a first aspect, embodiments of this application provide a processing method for enhancing the reliability of flash memory data, applied to a flash memory; the method includes: acquiring data to be written; when it is determined that the data to be written cannot fill the physical page to be written, determining filling data for the free area according to the size of the free area of ​​the physical page, wherein the filling data is data with verification function related to the data to be written; and writing the data to be written and the filling data into the physical page.

[0005] In a second aspect, embodiments of this application provide a flash memory including a flash controller and at least one flash chip, the flash controller being configured to execute step instructions in the method as described in any of the first aspects.

[0006] As can be seen, in this embodiment, the flash memory acquires the data to be written; when it is determined that the data to be written cannot fill the physical page to be written, the fill data for the free area is determined according to the size of the free area of ​​the physical page. The fill data is data with verification function related to the data to be written; the data to be written and the fill data are written into the physical page. Therefore, in this application, the flash memory dynamically adjusts the filling strategy based on the size of the free area and the data to be written, which can reduce the free space of the physical page. Furthermore, since the fill data is data related to the data to be written and has verification function, it can enhance the error correction capability of the data, thus helping to enhance the integrity and reliability of the data. Attached Figure Description

[0007] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0008] Figure 1 This is a schematic diagram of the structure of a flash memory provided in an embodiment of this application;

[0009] Figure 2 A flowchart illustrating a method for enhancing the reliability of flash memory data, provided in an embodiment of this application;

[0010] Figure 3 A schematic diagram illustrating multiple physical pages within the same physical block, as provided in the embodiments of this application;

[0011] Figure 4 A schematic diagram of multiple physical pages in different physical blocks provided in the embodiments of this application;

[0012] Figure 5 A schematic diagram of each physical page within a physical block, provided for embodiments of this application;

[0013] Figure 6 A schematic diagram illustrating the writing of physical pages when the data to be written is small, as provided in an embodiment of this application;

[0014] Figure 7 A schematic diagram illustrating header and footer filling provided for embodiments of this application;

[0015] Figure 8 A schematic diagram illustrating another header filling method provided in this application embodiment;

[0016] Figure 9 This is a schematic diagram illustrating the filling of redundant areas in an embodiment of this application. Detailed Implementation

[0017] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0018] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0019] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0020] In the embodiments of this application, "and / or" describes the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent the following three situations: A exists alone; A and B exist simultaneously; B exists alone. Among them, A and B can be singular or plural.

[0021] In this embodiment, the symbol " / " can indicate that the preceding and following objects are in an "or" relationship. Alternatively, the symbol " / " can also represent a division sign, i.e., performing a division operation. For example, A / B can mean A divided by B.

[0022] In the embodiments of this application, "at least one item" or its similar expression refers to any combination of these items, including any combination of a single item or a plurality of items. "One or more" means one or more, while "multiple" means two or more. For example, "at least one item" of a, b, or c can represent the following seven cases: a, b, c; a and b; a and c; b and c; a, b, and c. Each of a, b, and c can be an element or a set containing one or more elements.

[0023] In the embodiments of this application, "equal to" can be used with "greater than" and is applicable to technical solutions used when "greater than" is used; it can also be used with "less than" and is applicable to technical solutions used when "less than" is used. When "equal to" is used with "greater than", it is not used with "less than"; when "equal to" is used with "less than", it is not used with "greater than".

[0024] To address the aforementioned issues, this application provides a processing method and a flash memory that enhances the reliability of flash data. The flash memory dynamically adjusts its filling strategy based on the size of the free area and the data to be written, thereby reducing the free space of physical pages. Furthermore, since the filling data is related to the data to be written and has verification functions, it enhances the error correction capability of the data, thus contributing to the improvement of data integrity and reliability.

[0025] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0026] Please see Figure 1 , Figure 1 This is a schematic diagram of the structure of a flash memory 1 provided in an embodiment of this application. Figure 1 As shown, the flash memory 11 includes a flash controller 10 and at least one flash chip 20 (shown as one in the figure), specifically:

[0027] The flash memory controller 10 is communicatively connected to the host 2 and each flash memory chip 20. After receiving read / write commands, logical addresses, and data sizes from the host 2, the flash memory controller 10 translates the logical addresses of the read / write commands into the physical addresses within the flash memory chip 20 by looking up the address mapping table. It also translates the read / write commands into a series of internal control commands (read, write, erase) of the flash memory 1 and sends the control commands to the flash memory chip 20.

[0028] Flash memory chip 20 is the physical medium ultimately used to store data. It includes multiple physical blocks, and each physical block contains many physical pages. After receiving control instructions from flash memory controller 10, flash memory chip 20 performs read, write, or erase tasks on the physical block or physical page at the corresponding physical block address.

[0029] In this application, host 2 sends a data write request to flash memory 1. Flash controller 10 receives the data write request and performs erase and write operations (erasure must be performed before writing data). Specifically: after receiving the data write request, flash controller 10 determines whether each physical page can be completely filled based on the size of the data to be written and the physical page size. When flash controller 10 determines that the data to be written cannot fill the physical page to be written, it determines the filling strategy of the data to be written based on the size of the unfilled free area. Flash controller 10 generates filling data for the free area based on the adjustment strategy and the data to be written, and writes the filling data into the physical page in flash chip 20.

[0030] During this process, if the data to be written carries a logical address, the flash memory 1 determines whether the physical page corresponding to the logical address can completely fill the data to be written; if the data to be written does not carry a logical address, the flash controller 10 allocates storage space according to the storage status of the flash chip 20. Furthermore, after adjusting the filling strategy, the storage space for data writing may change, and the flash controller 10 can record the adjusted storage space by mapping the changed physical address back to the original physical address.

[0031] Based on the above hardware structure, this application proposes an embodiment of a processing method to enhance the reliability of flash memory data.

[0032] Please see Figure 2 , Figure 2 A flowchart illustrating a method for enhancing flash memory data reliability provided in this application embodiment is shown below. Figure 2 As shown, the processing method is applied to, for example Figure 1 The flash memory controller 10 in the method includes:

[0033] Step S201: The flash memory controller acquires the data to be written.

[0034] In step S202, when the flash memory controller determines that the data to be written cannot fill the physical page to be written, it determines the filling data for the free area based on the size of the free area of ​​the physical page.

[0035] When the flash memory controller receives the data to be written from the host, it determines whether the data to be written can fill the physical page based on the physical page size and the size of the data to be written. The specific process includes: taking the remainder of the size of the data to be written divided by the physical page size. If the remainder is 0, it means that the data to be written can fill the corresponding physical page; if the remainder is not 0, it means that the data to be written cannot fill the corresponding physical page. The remainder indicates the proportion of the remaining free pages to a single physical page.

[0036] The filling data is data with verification function related to the data to be written. In existing technologies, filling methods for incomplete physical pages include zero-filling (filling the unfilled portion with 0s) and random filling (filling the incomplete flash memory page with randomly generated data). These filling methods can fill the physical page and avoid problems such as uneven charge distribution. However, existing methods for filling incomplete physical pages do not have error correction capabilities; the written 0s or random numbers cannot cooperate with the internal data of the flash memory to improve data reliability. In this application, the filling data is determined based on the size of the free area. The filling data is data with verification function related to the data to be written. Besides filling the physical page, the filling data can also cooperate with the data to be written to improve the data's error correction capability and reliability.

[0037] Therefore, the size of the fill data can be determined based on the size of the free area. The general filling strategy is as follows: if the free area is large, generate the complete data checksum; if the free area is small, generate the partial data checksum or generate the complete data checksum.

[0038] Checksums and check data are two types of verification information. Checksums, which are used for complete or partial data, are mainly used to detect and correct errors in a single data block. Checksums typically include one or more check blocks, which can be used to recover lost or damaged data. However, they usually require more storage space to store the check blocks, so they are suitable for situations where the free space is relatively large. Checksums are mainly used to verify the integrity of data, ensuring that all data blocks have not been tampered with or damaged during transmission or storage. Checksums are the result of a bitwise XOR operation on multiple data blocks, but they cannot detect and correct errors in a single data block. They require less storage space, so they are suitable for situations where the free space is small.

[0039] Furthermore, it should be noted that a physical page includes a data area, which is the main part of each physical page and is used to store user data. The data to be written in this application is the data that needs to be stored in the data area. The data area has two states relative to the data to be written: a full state (no free space in the data area) and a partially full state (free space in the data area). Some physical pages also include a redundancy area. The redundancy area is extra space designed to ensure data integrity and reliability. It is typically used to store error correction codes (ECC) or logical block addresses (LBAs). It is auxiliary information for the data in the data area and is generated based on the data in the data area. Its function is to correct errors based on the data in the redundancy area even if minor data corruption occurs during reading. The size of the redundancy area can be determined according to actual needs, specifically based on the size of the data area. Therefore, after determining the size of the redundancy area, the redundancy area also has two states relative to the redundancy area data generated from the data to be written: a full state (no free space in the redundancy area) and a partially full state (free space in the redundancy area). For physical pages that include a data area and a redundant area, when the size of the data to be written is smaller than the size of the data area, the size of the redundant area is adjusted so that the data area is full and the redundant area is not full. When adjusting the filling, only the filling strategy of the redundant area needs to be adjusted.

[0040] Therefore, based on the overall data filling approach and the structure of the physical page described above, the data filling method of this application includes:

[0041] First embodiment: The physical page includes a data area and a free area is located in the data area. If the free area is large, complete check data of all data to be written is generated; if the free area is small, check data of part of the data to be written or checksum of the data to be written is generated.

[0042] Second embodiment: The physical page includes a data area and a redundancy area. The free area is located in the redundancy area. If the free area is large, check data of complete redundant data is generated; if the free area is small, check data of partial redundant data or checksum of redundant data is generated.

[0043] In step S203, the flash controller writes the data to be written and the filling data into the physical page.

[0044] As can be seen, in this embodiment, the flash memory acquires the data to be written; when it is determined that the data to be written cannot fill the physical page to be written, the fill data for the free area is determined according to the size of the free area of ​​the physical page. The fill data is data with verification function related to the data to be written; the data to be written and the fill data are written into the physical page. Therefore, in this application, the flash memory dynamically adjusts the filling strategy based on the size of the free area and the data to be written, which can reduce the free space of the physical page. Furthermore, since the fill data is data related to the data to be written and has verification function, it can enhance the error correction capability of the data, thus helping to enhance the integrity and reliability of the data.

[0045] Specifically, regarding the first embodiment:

[0046] In some embodiments, the physical page includes a data area for writing the data to be written, and the free area is located within the data area; determining the fill data of the free area based on the size of the free area of ​​the physical page includes: if the size of the free area is greater than or equal to a first preset threshold, the fill data includes first verification data of all the data to be written; if the size of the free area is greater than or equal to a second preset threshold and less than the first preset threshold, the fill data includes second verification data of the target data to be written within the physical page where the free area is located; if the size of the free area is less than the second preset threshold, the fill data includes the checksum of the data to be written; wherein, the first preset threshold is greater than the second preset threshold.

[0047] The first preset threshold and the second preset threshold can be set according to actual needs, and this application does not make specific limitations on them.

[0048] In some embodiments, after generating the fill data for the free area based on the free area size, the method for writing the fill data to the physical page includes the following three methods:

[0049] The first method involves writing the padding data directly after the data to be written, i.e., "data to be written + padding data".

[0050] The second method involves writing a preset fill array at the top of the physical page, and then writing the data to be written and the fill data at a position after the preset fill array, i.e., "preset fill data + data to be written + fill data".

[0051] The third method involves writing a preset fill array at the end of the physical page, and then writing the data to be written and the fill data at a position after the preset fill array, i.e., "data to be written + fill data + preset fill data".

[0052] The preset fill data is a fixed length of data, such as 16 a's, "aaaaaaaaaaaaaaaa", or 16 5's, "5555555555555555". It can be designed according to actual needs, and this application does not impose specific restrictions.

[0053] In some embodiments, when the size of the free area is greater than or equal to a first preset threshold, the process of generating the first verification data of the data to be written includes: dividing the data to be written into at least two data blocks, each of the at least two data blocks being of equal length; generating a corresponding verification block for each of the at least two data blocks, wherein the first verification data includes at least two verification blocks.

[0054] The size of a single data block must be divisible by the size of a physical page.

[0055] In this process, a checksum block is generated for each data block. The checksum data can typically be generated using methods such as CRC (Cyclic Redundancy Check), checksum, hash functions (such as MD5), or erasure coding. For example, the generation process of the checksum block for each data block is illustrated using the principle of erasure coding:

[0056] Erasure coding protects data by generating a certain number of parity blocks, allowing the original data to be recovered even if some data blocks are lost. For a given amount of data k, erasure coding generates m additional parity blocks, making the total number of blocks n = k + m. In this case, as long as k blocks exist (where k is the number of original data blocks), all the data can be recovered. If any single data block is lost, the lost data can be recovered using the remaining data blocks and parity block P; if only parity block P is lost, no recovery is needed because P can be recalculated from the data blocks.

[0057] Suppose there are 5 data blocks D1 = 0b1101, D2 = 0b1011, D3 = 0b1110, D4 = 0b0111, and D5 = 0b1111. Five parity blocks P1, P2, P3, P4, and P5 are generated through a bitwise XOR operation. Specifically:

[0058] P1=D1⊕D2⊕D3⊕D4⊕D5=0b1101⊕0b1011⊕0b1110⊕0b0111⊕0b1111=0b0000;

[0059] P2=D1⊕D2⊕D3⊕D4⊕P1=0b1101⊕0b1011⊕0b1110⊕0b1001⊕0b0000=0b0001;

[0060] P3=D1⊕D2⊕D3⊕P1⊕P2=0b1101⊕0b1011⊕0b1001⊕0b0000⊕0b0001=0b1110;

[0061] P4=D1⊕D2⊕P1⊕P2⊕P3=0b1101⊕0b1001⊕0b0000⊕0b0001⊕0b1110=0b1001;

[0062] P5 = D1⊕P1⊕P2⊕P3⊕P4 = 0b1101⊕0b0000⊕0b0001⊕0b1110⊕0b1001 = 0b1111; where “⊕” represents bitwise XOR operation.

[0063] When D1 is lost, D1 is calculated using the formula D1 = P1⊕D2⊕D3⊕D4⊕D5. When P1 is lost, it is calculated directly from the 5 data blocks. The same applies to the other data blocks.

[0064] Therefore, in this example, the data to be written includes D1, D2, D3, D4, and D5, and the data to be filled includes P1, P2, P3, P4, and P5.

[0065] Since read interference affects data on adjacent pages, write interference affects not only adjacent pages but also the pages themselves. Therefore, to improve flash memory data reliability, two approaches can be taken: firstly, reducing the number of unfilled physical pages can improve charge stability; secondly, when data to be written needs to be written to more than one physical page, these pages can be stored on different physical pages within different physical blocks according to certain rules. This reduces interference to adjacent physical pages during the writing process and improves flash memory data reliability.

[0066] Based on the above two approaches, this application provides the following two specific embodiments to enhance the reliability of flash memory data.

[0067] In some embodiments, when the size of the free area is greater than or equal to a first preset threshold, after determining the data to be written and the filling data, directly writing the filling data at the position after the data to be written includes: dividing the at least two data blocks into at least two physical pages of the same physical block; for any physical page among the at least two physical pages, filling the position after the data block of that physical page with the check block of the data blocks contained in other physical pages among the at least two physical pages, to fill the free area of ​​the current physical page.

[0068] In this embodiment, since at least two data blocks are still assigned to the same physical page and may be adjacent, the data area in each physical page should be full. The free space in each physical page, excluding the assigned data block, is filled with checksum blocks from all data blocks in other physical pages.

[0069] In practical implementation, following the example above, see... Figure 3 If a physical page can hold four data blocks, and the data to be written includes D1, D2, D3, D4, and D5, two physical pages are needed. D1 and D2 can be placed in the first physical page, and D3, D4, and D5 in the second physical page. The first and second physical pages reside within the same physical block. Correspondingly, the checksum blocks P3, P4, and P5 of the data blocks (D3, D4, D5) from the second physical page are placed in the free area of ​​the first physical page, and the checksum blocks (P1 and P2) of the data blocks (D1 and D2) from the first physical page are placed in the free area of ​​the second physical page. Alternatively, a single physical block can be placed within a single physical page. The length of the checksum blocks can be adjusted based on the length of the free area, ensuring that each physical page contains checksum blocks for both the data blocks and other physical pages. Furthermore, since multiple physical pages reside within the same physical block, the length of the checksum blocks within each physical page must satisfy the size of the area excluding the data blocks to ensure the physical page is fully written.

[0070] In some embodiments, when the band of the free area is greater than or equal to a first preset threshold, after determining the data to be written and the padding data, the step of directly writing the padding data after the data to be written includes: assigning each data block in the at least two data blocks to physical pages of different physical blocks; for any physical page in the at least two physical pages, filling the position after the data block of that physical page with a check block of the data blocks contained in other physical pages in the at least two physical pages excluding that physical page.

[0071] Unlike the previous embodiments, in this embodiment, each data block is distributed across physical pages of different physical blocks, avoiding the situation where two physical pages are adjacent, and thus avoiding interference between adjacent pages when writing data. Therefore, in this embodiment, each physical page does not need to be fully written, provided that two physical pages are not adjacent. By storing one data block and one check block in each physical page, read and write interference can be avoided, and the remaining space can be used as storage for other critical data.

[0072] In practical implementation, following the example above, see... Figure 4 If a physical page can hold four data blocks, and the data to be written includes D1, D2, D3, D4, and D5, two physical pages are needed. D1 and D2 can be placed in the first physical page, and D3, D4, and D5 in the second physical page. The first and second physical pages are located in different physical blocks; the first physical page is in the first physical block, and the second physical page is in the second physical block. Correspondingly, the checksum blocks P3, P4, and P5 of the data blocks (D3, D4, D5) in the second physical page are placed in the free area of ​​the first physical page, and the checksum blocks (P1 and P2) of the data blocks (D1 and D2) in the first physical page are placed in the free area of ​​the second physical page. Alternatively, a single physical page can be placed within a single physical block, see [link to relevant documentation]. Figure 5 Each physical page must contain a data block and a check block for other physical pages. Furthermore, since multiple physical pages are located in different physical blocks, the page state of each physical page does not have to be filled; the remaining area can be filled with other critical data.

[0073] In some embodiments, the number of data blocks split is greater than or equal to the number of physical pages occupied by the data to be written. That is, the number of data blocks split is generally greater than or equal to 2, but when the number of physical pages required for the data to be written is greater than 2, such as 3 physical pages, it is split into at least 3 data blocks to ensure that a physical page can be written to a single data block.

[0074] In some embodiments, when the size of the free area is greater than a first preset threshold, preset fill data is filled at the beginning of the physical page before the data to be written and all of its verification data are written; or, preset data is filled at the end of the physical page before the data to be written and all of its verification data are written.

[0075] In some embodiments, when the size of the free area is greater than or equal to a second preset threshold and less than a first preset threshold, verification data is generated based on the data to be written within the physical page where the free area is located. For example, the data to be written includes D6 and D7, see... Figure 6 For the data D7 to be written in the second physical page, generate the verification data P7 for D7.

[0076] In some embodiments, when the size of the free area is greater than or equal to a second preset threshold and less than a first preset threshold, after determining the filling data, the verification data P7 is directly written after the data to be written D7, see [link to documentation]. Figure 7 Alternatively, write the preset padding array at the beginning of the second physical page, followed by the data to be written (D7) and the checksum (P7). See [link to relevant documentation]. Figure 7 Alternatively, write the preset padding array at the end of the second physical page, then write the data to be written (D7) and the checksum (P7), see [link to documentation]. Figure 7 c.

[0077] In some embodiments, the preset padding array for the header and the preset padding array for the footer may be different.

[0078] In some embodiments, the target data to be written and the second verification data are not of equal length. After writing a preset fill array at the beginning or end of the physical page, and writing the data to be written and the fill data at a position after the preset fill array, the method further includes: when it is determined that the preset fill array, the data to be written and the second verification data still cannot fill the physical page, writing a random number to fill the free area.

[0079] In specific implementation, the data to be written, D7, and the verification data, P7, are of unequal length. A preset padding array is written at the beginning of the second physical page, followed by the data to be written, D7, and the verification data, P7; or, after writing the preset padding array at the end of the second physical page, the method further includes: when it is determined that the preset padding data, the data to be written, D7, and the verification data, P7, still cannot fill the second physical page, a random number is filled into the remaining free area. (See...) Figure 7 d and e.

[0080] In some embodiments, the target data to be written is of the same length as the second verification data. After writing a preset padding array at the beginning or end of the physical page, and writing the data to be written and the padding data after the preset padding array, the method further includes: when it is determined that the preset padding array, the data to be written, and the second verification data still cannot fill the physical page, generating a first verification block based on the target data to be written, and generating a second verification block based on the second verification data; writing the preset padding data, the target data to be written, and the second verification block into a first physical page, and writing the preset padding data, the second verification data, and the first verification block into a second physical page; the first physical page and the second physical page are different physical pages.

[0081] Specifically, when the data to be written, D7, and the check data, P7, are of equal length, and it is determined that the preset padding data, the data to be written, D7, and the check data, P7, are still insufficient to fill the second physical page, a check block P7' is generated based on the data to be written, and a check block P7' is generated based on the check data P7. The preset padding data, the data to be written, D7, and the check block P7' are then written into the first physical page, and the preset padding data, check block P7, and check block P7' are written into the second physical page. See [link to documentation]. Figure 8 In some embodiments, the first physical page and the second physical page are different physical pages within the same physical block; in other embodiments, the first physical page and the second physical page are physical pages within different physical blocks, with the same principle. Figure 4 and Figure 5 The embodiments shown are consistent and will not be repeated here.

[0082] In some embodiments, when the size of the free area is less than the second preset threshold, the free area is too small to write the complete verification data of the data to be written, and only the checksum of the data to be written can be filled in. In this case, the checksum is directly filled in after the data to be written; or, a preset padding array is written at the beginning and / or end of the physical page, and the data to be written and the checksum are filled in after the preset padding array.

[0083] In summary, regarding the first embodiment, when a physical page includes a data area and the free area is located within the data area, the free area can be filled using the methods described above. The filling methods described above are general methods; in actual use, the most suitable method can be selected for different data types. For example, for filling critical data areas such as address mapping tables, the following methods can be used... Figure 3-Figure 5 The specific method of the illustrated embodiment; for data of variable length, such as snapshot data, can be used Figure 7-Figure 8 The specific method of the illustrated embodiment.

[0084] Specifically, regarding the second embodiment:

[0085] In some embodiments, the physical page includes a data area and a redundancy area. The data area is used to write the data to be written, and the redundancy area is used to write at least one auxiliary data of the data to be written. The free area is located within the redundancy area. Determining the filling data of the free area based on the size of the free area of ​​the physical page includes: if the free area exceeds half the size of the redundancy area, filling the beginning or end position of the redundancy area with the verification data of the at least one auxiliary data; and backing up each auxiliary information and filling it into the free area, with the backup data and the original data symmetrically positioned in the redundancy area; if the free area is less than half the size of the redundancy area and greater than a preset minimum free area value, filling the beginning or end position of the redundancy area with the verification data of the at least one auxiliary information; and selecting key information from the at least one auxiliary information and backing it up into the free area; if the free area is less than or equal to the preset minimum free area value, filling the beginning or end position of the redundancy area with the checksum of the at least one auxiliary information.

[0086] The physical page includes a data area and a redundancy area, with the redundancy area containing multiple data storage cells.

[0087] When the free area exceeds half the size of the redundant area, the free area is considered large. A checksum is generated based on the auxiliary data in the redundant area and stored at the beginning or end of the redundant area. Figure 9 The location of the "redundant" or "area" in the data. For auxiliary data in the redundant area, symmetrical backups are used to fill the free area. For example, the data in the "remainder" is backed up to the data storage cell before the "area". In the redundant area, the positions of the two are symmetrical.

[0088] When the free area is small, less than half the size of the redundant area, the checksum of the auxiliary data is still stored at the beginning or end of the redundant area. Since the free area is small, it is not possible to perform symmetrical backups of all auxiliary data. Therefore, the decision to back up can be made based on the importance of at least one auxiliary data.

[0089] When the free area is less than the preset minimum free value, symmetrical backup cannot be performed. In this case, a checksum is stored at the beginning or end of the redundant area, or error correction codes are filled into the critical data so that the redundant area is full.

[0090] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0091] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0092] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.

[0093] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0094] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0095] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, 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. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0096] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0097] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A processing method for enhancing the reliability of flash memory data, characterized in that, Applied to flash memory; the method includes: Get the data to be written; Determine whether the data to be written can fill the physical page based on the physical page size and the size of the data to be written. When it is determined that the data to be written cannot fill the physical page to be written, the filling data of the free area is determined according to the size of the free area of ​​the physical page, and the filling data is data with verification function related to the data to be written; Write the data to be written and the padding data into the physical page; The physical page includes a data area for writing the data to be written, and the free area is located within the data area; determining the filling data for the free area based on the size of the free area of ​​the physical page includes: If the size of the free area is greater than or equal to a first preset threshold, the filling data includes the first verification data of all the data to be written; if the size of the free area is greater than or equal to a second preset threshold and less than the first preset threshold, the filling data includes the second verification data of the target data to be written within the physical page where the free area is located; if the size of the free area is less than the second preset threshold, the filling data includes the checksum of the data to be written; wherein, the first preset threshold is greater than the second preset threshold; The physical page includes a data area and a redundancy area. The data area is used to write the data to be written, and the redundancy area is used to write at least one auxiliary data of the data to be written. The free area is located within the redundancy area. Determining the filling data for the free area based on the size of the free area of ​​the physical page includes: If the free area exceeds half the size of the redundant area, then the check data of at least one auxiliary data is filled at the beginning or end of the redundant area; and, each auxiliary information is backed up and filled into the free area, with the backup data and the original data symmetrically positioned in the redundant area; if the free area is less than half the size of the redundant area but greater than a preset minimum free area value, then the check data of at least one auxiliary information is filled at the beginning or end of the redundant area; and, key information from the at least one auxiliary information is selected and backed up and filled into the free area; if the free area is less than or equal to the preset minimum free area value, then the checksum of at least one auxiliary information is filled at the beginning or end of the redundant area.

2. The method according to claim 1, characterized in that, The step of writing the data to be written and the filling data within the physical page includes: Write the padding data directly after the data to be written; or... Write a preset fill array at the beginning or end of the physical page, and write the data to be written and the fill data at a position after the preset fill array.

3. The method according to claim 2, characterized in that, The process of generating the first verification data of the data to be written includes: The data to be written is divided into at least two data blocks, and each of the at least two data blocks is of equal length; A corresponding check block is generated for each of the at least two data blocks, and the first check data includes at least two check blocks.

4. The method according to claim 3, characterized in that, Writing the fill data directly at the position following the data to be written includes: The at least two data blocks are divided into at least two physical pages of the same physical block; For any one of the at least two physical pages, the position after the data block of the physical page is filled with the check block of the data block contained in the other physical pages of the at least two physical pages, excluding the physical page itself, to fill the free area of ​​the physical page.

5. The method according to claim 3, characterized in that, Writing the fill data directly at the position following the data to be written includes: Each of the at least two data blocks is assigned to a physical page in a different physical block; For any one of the at least two physical pages, a check block of the data blocks contained in the other physical pages besides that physical page is filled in at the position after the data block of that physical page.

6. The method according to claim 2, characterized in that, The target data to be written is of the same length as the second verification data. After writing a preset padding array at the beginning or end of the physical page, and writing the data to be written and the padding data at a position after the preset padding array, the method further includes: When it is determined that the preset filling array, the data to be written, and the second verification data still cannot fill the physical page, a first verification block is generated based on the target data to be written, and a second verification block is generated based on the second verification data. The preset fill data, the target data to be written, and the second verification block are written into the first physical page, and the preset fill data, the second verification data, and the first verification block are written into the second physical page; the first physical page and the second physical page are different physical pages.

7. The method according to claim 2, characterized in that, The target data to be written is not of equal length to the second verification data. After writing a preset padding array at the beginning or end of the physical page, and writing the data to be written and the padding data at a position after the preset padding array, the method further includes: When it is determined that the preset filling array, the data to be written, and the second verification data still cannot fill the physical page, a random number is written to fill the free area.

8. A flash memory, characterized in that, It includes a flash memory controller and at least one flash memory chip, the flash memory controller being used to execute the step instructions in the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Data writing method, distributed storage system, equipment and storage medium

    CN115268786A

  • Data writing method, data writing device, electronic equipment and readable storage medium

    CN118885115A