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

By dynamically adjusting the filling strategy in the flash memory based on the free area size of the physical page and the data to be written, and generating fill data with verification functions, the problems of uneven charge distribution and data loss risks in the data organization and writing process of flash memory are solved, and higher data reliability and memory life are achieved.

CN119620942AActive Publication Date: 2025-03-14SHENZHEN LINGDECHUANG TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Flash memory may lead to uneven charge distribution, interference with read and write data, and increased bad block rate during data organization and writing, resulting in reduced performance, shortened lifetime and increased risk of data loss.

Method used

By dynamically adjusting the fill strategy in flash memory, fill data related to the data to be written and has a verification function according to the free area size of the physical page and the data to be written, and write the data to be written and fill data to be written in the physical page to reduce the free space of the physical page and enhance the error correction ability of the data.

Benefits of technology

This method effectively reduces the free space of physical pages, enhances the error correction ability of data, improves the integrity and reliability of data, thereby extending the life of flash memory and reducing the risk of data loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119620942A_ABST
    Figure CN119620942A_ABST
Patent Text Reader

Abstract

The invention provides a processing method for enhancing reliability of flash memory data and a flash memory. The processing method comprises the following steps: acquiring to-be-written data by the flash memory; when it is determined that the written physical page cannot be filled with the to-be-written data, filling data of a free area are determined according to the size of the free area of the physical page, and the filling data are data which are related to the to-be-written data and have a verification function; and writing the to-be-written data and the filling data in the physical page. It can be seen that in the application, the flash memory dynamically adjusts the filling strategy through the size of the free area and the to-be-written data, so that the free space of the physical page can be reduced, and since the filling data is the data which is related to the to-be-written data and has a verification function, the error correction capability of the data can be enhanced, and the integrity and reliability of the data can be enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of storage technology, and in particular to a processing method for enhancing the reliability of flash memory data and a flash memory storage. Background Art

[0002] The data organization of NAND flash memory consists of a die, a physical block, and a physical page. A physical page is the smallest unit for editing operations. When a physical page is not fully written, it may cause problems such as uneven charge distribution inside the flash memory, or may cause read and write data interference, increased bad block rate, and other problems, thereby causing the flash memory to perform poorly, shorten its lifespan, and increase the risk of data loss. Summary of the invention

[0003] The present application provides a processing method for enhancing the reliability of flash memory data and a flash memory storage device. The flash memory storage device can reduce the free space of a physical page by dynamically adjusting the filling strategy through the size of the free area and the data to be written. Moreover, since the filling data is related to the data to be written and has a verification function, the error correction capability of the data can be enhanced, which helps to enhance the integrity and reliability of the data.

[0004] In a first aspect, an embodiment of the present application provides a processing method for enhancing the reliability of flash memory data, which is applied to a flash memory; the method comprises: obtaining data to be written; when it is determined that the data to be written cannot fill the entire physical page to be written, determining filling data for the free area according to the size of the free area of ​​the physical page, the filling data being data with a 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, an embodiment of the present application provides a flash memory, comprising a flash controller and at least one flash chip, wherein the flash controller is used to execute the step instructions in the method as described in any one of the first aspects.

[0006] It can be seen that in the embodiment of the present application, the flash memory obtains 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 a verification function related to the data to be written; the data to be written and the filling data are written in the physical page. It can be seen that in the present application, the flash memory dynamically adjusts the filling strategy according to the size of the free area and the data to be written, which can reduce the free space of the physical page, and because the filling data is data related to the data to be written and has a verification function, it can enhance the error correction capability of the data, which helps to enhance the integrity and reliability of the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0008] Figure 1 A schematic diagram of the structure of a flash memory provided in an embodiment of the present application;

[0009] Figure 2 A flowchart of a processing method for enhancing the reliability of flash memory data provided by an embodiment of the present application;

[0010] Figure 3 A schematic diagram of multiple physical pages in the same physical block provided in an embodiment of the present application;

[0011] Figure 4 A schematic diagram of multiple physical pages in different physical blocks provided by an embodiment of the present application;

[0012] Figure 5 A schematic diagram of each physical page in a physical block provided in an embodiment of the present application;

[0013] Figure 6 A schematic diagram of writing a physical page when the data to be written is small provided in an embodiment of the present application;

[0014] Figure 7 A schematic diagram of filling a header and footer provided in an embodiment of the present application;

[0015] Figure 8 A schematic diagram of another page header filling method provided in an embodiment of the present application;

[0016] Fig. 9 A schematic diagram of redundant area filling provided in an embodiment of the present application. DETAILED DESCRIPTION

[0017] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, 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 and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0019] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

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

[0021] In the embodiment of the present application, the symbol " / " can indicate that the objects associated with each other are in an "or" relationship. In addition, the symbol " / " can also indicate a division sign, that is, performing a division operation. For example, A / B can indicate A divided by B.

[0022] In the embodiments of the present application, "at least one item" or similar expressions refer to any combination of these items, including any combination of single items or plural items, and refer to one or more, and multiple refers to two or more. For example, at least one item of a, b, or c can represent the following seven situations: a, b, c, a and b, a and c, b and c, a, b, and c. Among them, each of a, b, and c can be an element or a set containing one or more elements.

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

[0024] In order to solve the above problems, the present application provides a processing method and a flash memory for enhancing the reliability of flash memory data. The flash memory can reduce the free space of the physical page by dynamically adjusting the filling strategy according to the size of the free area and the data to be written. Moreover, since the filling data is related to the data to be written and has a verification function, the error correction capability of the data can be enhanced, which helps to enhance the integrity and reliability of the data.

[0025] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. 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] See also Figure 1 , Figure 1 This is a schematic diagram of the structure of a flash memory 1 provided in an embodiment of the present application. Figure 1 As shown, the flash memory 11 includes a flash controller 10 and at least one flash chip 20 (shown as 1 in the figure), specifically:

[0027] The flash memory controller 10 is communicatively connected with the host 2 and each flash memory chip 20. After receiving the read and write commands, logic address, data size and other information from the host 2, the flash memory controller 10 converts the logical address of the read and write instructions into the physical address within the flash memory chip 20 by looking up the address mapping table, and converts the read and write commands into a series of internal control instructions (read, write, erase) of the flash memory 1, and sends the control instructions to the flash memory chip 20.

[0028] The flash memory chip 20 is the physical medium ultimately used to store data, including multiple physical blocks, each of which contains many physical pages. After receiving the control instruction from the flash memory controller 10, the flash memory chip 20 performs a read, write or erase task on the physical block or physical page of the corresponding physical block address.

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

[0030] In this process, if the data to be written carries a logical address, the flash memory 1 determines whether the physical page of the corresponding physical address can be completely filled with the data to be written according to the logical address; if the data to be written does not carry a logical address, the flash memory controller 10 allocates a storage location according to the storage situation of the flash memory chip 20. Further, after adjusting the filling strategy, the storage location where the data is written may be changed, and the flash memory controller 10 can record the adjusted storage location by mapping the changed physical address to the original physical address.

[0031] Based on the above hardware structure, an embodiment of a processing method for enhancing the reliability of flash memory data provided by the present application is proposed.

[0032] See also Figure 2 , Figure 2 A flowchart of a processing method for enhancing the reliability of flash memory data provided by an embodiment of the present application is shown as follows: Figure 2 As shown, the processing method is applied to Figure 1 The flash memory controller 10 in the embodiment of the present invention comprises:

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

[0034] Step S202: When the flash memory controller determines that the data to be written cannot fill up the physical page to be written, the flash memory controller determines filling data for the free area according to the size of the free area of ​​the physical page.

[0035] Among them, after receiving the data to be written from the host, the flash memory controller determines whether the data to be written can fill the physical page according to 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 and the physical page size. If the remainder is 0, it indicates that the data to be written can fill the corresponding physical page; if the remainder is not 0, it indicates that the data to be written cannot fill the corresponding physical page, and the remainder indicates the proportion of the remaining free pages to a single physical page.

[0036] Among them, the filling data is data with a verification function related to the data to be written. In the prior art, the filling methods for incomplete physical pages include zero filling (filling the unfilled part with 0), random filling (filling the unfilled flash memory page with randomly generated data), etc. These filling methods can fill the physical page and avoid problems such as uneven charge distribution. However, the incomplete physical page filling method in the prior art does not have error correction capability, and the written 0 or random number cannot cooperate with the internal data of the flash memory to improve the reliability of the data. In the present application, the filling data is determined according to the size of the free area. The filling data is data related to the data to be written and has a verification function. In addition to being able to fill the physical page, the filling data can also cooperate with the data to be written to improve the error correction capability and reliability of the data.

[0037] Therefore, the size of the generated filling data can be specifically determined according to the size of the free area. The overall filling idea is: if the free area is larger, then generate verification data for the complete data; if the free area is smaller, then generate verification data for partial data or generate the checksum of the complete data.

[0038] Among them, check data and checksum are two types of check information. Check data for complete data or partial data is mainly used to detect and correct errors in a single data block. Check data usually includes one or more check blocks, which can be used to recover loss or damage, but usually require more storage space to save the check blocks, so it is suitable for situations where the free area is relatively large; checksum is mainly used to verify the integrity of data and ensure that all data blocks are not tampered with or damaged during transmission or storage. Checksum is the result of bitwise XOR operation on multiple data blocks, and cannot detect and correct errors in a single data block. It requires less storage space, so it is suitable for situations where the free area is small.

[0039] In addition, it should be noted that the 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, namely, a full state (there is no free area in the data area) and a not full state (there is a free area in the data area). Some physical pages also include a redundant area. The redundant area is an additional space designed to ensure the integrity and reliability of the data. It is usually used to store error correction codes (ECC) or logical block addresses (LBA). It is auxiliary information of the data area data and is also generated based on the data area data. Its function is that even if the data is slightly damaged during reading, it can be corrected according to the redundant area data. The size of the redundant area can be determined according to actual needs, and can be determined specifically according to the size of the data area. Therefore, after determining the size of the redundant area, the redundant area also has two states relative to the redundant area data generated according to the data to be written, namely, a full state (there is no free area in the redundant area) and a not full state (there is a free area in the redundant area). For a physical page including a data area + 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 in a full state and the redundant area is in a not full state. When performing filling adjustment, only the filling strategy of the redundant area needs to be adjusted.

[0040] Therefore, according to the above-mentioned overall filling idea and the structure of the physical page, the data filling method of the present application includes:

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

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

[0043] Step S203: the flash memory controller writes the to-be-written data and the filling data into the physical page.

[0044] It can be seen that in the embodiment of the present application, the flash memory obtains 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 a verification function related to the data to be written; the data to be written and the filling data are written in the physical page. It can be seen that in the present application, the flash memory dynamically adjusts the filling strategy according to the size of the free area and the data to be written, which can reduce the free space of the physical page, and because the filling data is data related to the data to be written and has a verification function, it can enhance the error correction capability of the data, which helps to enhance the integrity and reliability of the data.

[0045] Specifically, for the first embodiment:

[0046] In some embodiments, the physical page includes a data area, which is used to write the data to be written, and the free area is located in the data area; the filling data of the free area is determined according to the size of the free area of ​​the physical page, including: if the size of the free area is greater than or equal to a first preset threshold, the filling 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 filling data includes second verification data of the target data to be written in 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 a checksum of the data to be written; wherein, the first preset threshold is greater than the second preset threshold.

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

[0048] In some embodiments, after generating the filling data of the free area according to the size of the free area, the method of writing the filling data into the physical page includes the following three methods:

[0049] The first one is to directly write the filling data at the position after the data to be written, that is, "data to be written+filling data".

[0050] The second method is to write a preset filling array at the head position of the physical page, and write the data to be written and the filling data at the position after the preset filling array, that is, "preset filling data+data to be written+filling data".

[0051] The third method is to write a preset filling array at the end of the physical page, and write the data to be written and the filling data at the position after the preset filling array, that is, "data to be written+filling data+preset filling data".

[0052] Among them, the preset filling data is data of fixed length, such as 16 a's, "aaaaaaaaaaaaaaaaaa", or 16 5's, "5555555555555555", which can be designed according to actual needs and this application does not make any 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 data block of the at least two data blocks, and 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 the physical page.

[0055] A check block is generated for each data block, and the check data can usually be generated by using methods such as CRC (cyclic redundancy check), checksum, hash function (such as MD5) or erasure coding. For example, the generation process of the check block of each data block is explained by taking the erasure coding principle as an example:

[0056] Erasure codes protect data by generating a certain number of check blocks, so that even if some data blocks are lost, the original data can be restored. For a given amount of data k, the erasure code will generate an additional m check blocks, so that 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 restored. If any single data block is lost, the lost data can be restored through the remaining data blocks and the check block P; if the check block P is lost, it does not need to be restored because P can be recalculated from the data blocks.

[0057] Assume that there are five data blocks D1=0b1101, D2=0b1011, D3=0b1110, D4=0b0111, D5=0b1111, and five check blocks P1, P2, P3, P4, and P5 are generated by 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; wherein, “⊕” represents a bitwise exclusive OR operation.

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

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

[0065] Since read interference affects the data of the adjacent pages of the read data page, write interference not only affects the data of the adjacent pages, but also affects the read data page itself. Therefore, in order to improve the reliability of flash memory data, on the one hand, the charge stability can be improved by reducing the number of unfilled physical pages; on the other hand, when the data to be written needs to be written to more than one physical page, more than one physical page is stored in a physical page of different physical blocks according to certain rules to reduce the interference with the data of adjacent physical pages during the data writing process, thereby improving the reliability of flash memory data.

[0066] Based on the above two ideas, the embodiments of the present application provide 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, the filling data is directly written at the position after the data to be written, including: dividing the at least two data blocks into at least two physical pages of the same physical block; for any physical page of the at least two physical pages, filling the position after the data block of the physical page with the check blocks of the data blocks contained in the other physical pages of the at least two physical pages except the physical page, to complete the free area of ​​the current physical page.

[0068] In this embodiment, since at least two data blocks are still allocated to the physical page of the same physical block, there may be adjacent data blocks, so the data area in each physical page should be full. For each physical page, in addition to the allocated data blocks, the free area is filled with the check blocks of all data blocks in other physical pages.

[0069] In the specific implementation, follow the above example, see Figure 3 If a physical page can hold 4 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 can be placed in the second physical page. The first physical page and the second physical page are located in the same physical block. Correspondingly, the check blocks P3, P4, and P5 of the data blocks (D3, D4, and D5) in the second physical page are placed in the free area of ​​the first physical page, and the check 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. Of course, one physical block can also be placed in one physical page. The length of the check block can be adjusted according to the length of the free area, and it must be satisfied that each physical page contains data blocks and check blocks of other physical pages. In addition, since multiple physical pages are located in the same physical block, the length of the check block in each physical page must meet the size of other areas except the data blocks, so that the page status of the physical page is full.

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

[0071] Different from the above embodiment, in this embodiment, each data block is divided into physical pages of different physical blocks, which avoids the situation where two physical pages are adjacent, and further avoids the problem of interference with adjacent pages when writing data. Therefore, in this embodiment, under the premise that two physical pages are not adjacent, each physical page does not have to be in a full state. By storing a data block and a check block in each physical page, read and write interference can be avoided, and at the same time, the remaining space can be used as a storage location for other key data.

[0072] In the specific implementation, follow the above example, see Figure 4 , if a physical page can hold 4 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 can be placed in the second physical page. The first physical page and the second physical page are located in different physical blocks, the first physical page is located in the first physical block, and the second physical page is located in the second physical block; correspondingly, the check blocks P3, P4, and P5 of the data blocks (D3, D4, and D5) in the second physical page are placed in the free area of ​​the first physical page, and the check blocks (P1, P2) of the data blocks (D1, D2) in the first physical page are placed in the free area of ​​the second physical page. Of course, a physical page can also be placed in a physical block, see Figure 5 , it is required that each physical page contains data blocks and check blocks of other physical pages. In addition, since multiple physical pages are located in different physical blocks, the page status of each physical page does not have to be kept full, and the remaining area can be filled with other key data.

[0073] In some embodiments, the number of split data blocks is greater than or equal to the number of physical pages occupied by the data to be written. That is, the number of split data blocks 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, for example, 3 physical pages are required, it is split into at least 3 data blocks to ensure that the physical page can be written into a single data block.

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

[0075] In some embodiments, when the size of the free area is greater than or equal to the second preset threshold and less than the first preset threshold, verification data is generated according to the data to be written in the physical page where the free area is located. Exemplarily, 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 verification data P7 of D7.

[0076] In some embodiments, when the size of the free area is greater than or equal to the second preset threshold and less than the first preset threshold, after the filling data is determined, the verification data P7 is directly written after the data to be written D7. Figure 7 or, after writing a preset fill array at the header position of the second physical page, write the data to be written D7 and the check data P7, see Figure 7 or write the preset fill array at the end of the second physical page and then write the data to be written D7 and the check data P7, see Figure 7 Middle c.

[0077] In some embodiments, the default fill array at the top of the page may be different from the default fill array at the bottom of the page.

[0078] In some embodiments, the target data to be written is not of the same length as the second verification data, a preset filling array is written at the beginning or the end of the physical page, and after the data to be written and the filling data are written at the position after the preset filling 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 up the physical page, writing a random number to fill the free area.

[0079] In a specific implementation, the data to be written D7 and the verification data P7 are of different lengths, and the data to be written D7 and the verification data P7 are written after the preset filling array is written at the head of the second physical page; or after the preset filling array is written at the end of the second physical page and the data to be written D7 and the verification data P7 are written, the method further includes: when it is determined that the preset filling data, the data to be written D7 and the verification data P7 still cannot fill up the second physical page, the remaining free area is filled with random numbers, see Figure 7 Middle d and e.

[0080] In some embodiments, the target data to be written is of the same length as the second verification data, and after writing a preset filling array at the beginning or the end of the physical page, and writing the data to be written and the filling data at the position after the preset filling 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, generating a first verification block according to the target data to be written, and generating a second verification block according to the second verification data; writing the preset filling data, the target data to be written and the second verification block into a first physical page, and writing the preset filling 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, when it is determined that the preset filling data, the data to be written D7 and the check data P7 still cannot fill up the second physical page, a check block P7' is generated again according to the data to be written D7, a check block P7" is generated according to the check data P7, the preset filling data, the data to be written D7 and the check block P7" are written into the first physical page, and the preset filling data, the check block P7 and the check block P7' are written into the second physical page. Figure 8 In some embodiments, the first physical page and the second physical page are different physical pages in the same physical block; in some embodiments, the first physical page and the second physical page are physical pages in different physical blocks. Figure 4 and Figure 5 The embodiments shown are consistent and will not be described again here.

[0082] In some embodiments, when the size of the free area is less than a 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 the position after the data to be written; or, a preset filling array is written at the head position and / or the end position of the physical page, and the data to be written and the checksum are filled in the position after the preset filling array.

[0083] In summary, for the first embodiment, when the physical page includes a data area and the idle area is located in the data area, the idle area can be filled by the above embodiments. The above filling methods are general methods. In actual use, the most appropriate method can be selected for different data types. For example, for filling key data areas such as address mapping tables, Figure 3-Figure 5 The specific method of the embodiment shown; for data of uncertain length, such as snapshot data, you can use Figure 7-Figure 8 The specific method of the embodiment shown.

[0084] Specifically, for the second embodiment:

[0085] In some embodiments, the physical page includes a data area and a redundant area, the data area is used to write the data to be written, the redundant area is used to write at least one auxiliary data of the data to be written, and the free area is located in the redundant area; the filling data of the free area is determined according to the size of the free area of ​​the physical page, including: if the free area exceeds one half of the size of the redundant area, then filling the verification data of the at least one auxiliary data at the beginning or end of the redundant area; and, backing up each auxiliary information and filling it into the free area, and the positions of the backup data and the original data in the redundant area are symmetrical front and back; if the free area is less than one half of the redundant area and greater than a preset minimum free value, then filling the verification data of the at least one auxiliary information at the beginning or end of the redundant area; and, selecting key information from the at least one auxiliary information to back up and fill it into the free area; if the free area is less than or equal to the preset minimum free value, then filling the checksum of the at least one auxiliary information at the beginning or end of the redundant area.

[0086] The physical page includes a data area and a redundant area, and the redundant area includes a plurality of data storage cells.

[0087] When the free area exceeds half of the redundant area, the free area is large, and a checksum is generated based on the auxiliary data in the redundant area and stored at the beginning or end of the redundant area, such as Fig. 9 The position of the "redundant" or "area" in the redundant area. For the auxiliary data in the redundant area, symmetrical backup is filled into the free area, such as backing up the data in the "surplus" to the data storage grid before the "area". In the redundant area, the positions of the two are symmetrical.

[0088] When the free area is small, less than half 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, not all auxiliary data can be symmetrically backed up. Therefore, whether to back up can be decided based on the importance of at least one auxiliary data.

[0089] When the free area is less than the preset minimum free value, symmetric backup cannot be performed, and a checksum is stored at the beginning or end of the redundant area, or error correction code is filled for key data to make the redundant area full.

[0090] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders 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 application.

[0091] 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.

[0092] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, 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 through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

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

[0094] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0095] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application 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, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or CD-ROM and other media that can store program codes.

[0096] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.

[0097] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for enhancing the reliability of flash memory data, characterized in that: Applied to flash memory; the method comprises: Get the data to be written; When it is determined that the data to be written cannot fill up 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 a verification function related to the data to be written; The to-be-written data and the filling data are written into the physical page.

2. The method according to claim 1, characterized in that The physical page includes a data area, the data area is used to write the data to be written, and the idle area is located in the data area; and the step of determining the filling data of the idle area according to the size of the idle 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 first verification data of all the data to be written; If the size of the idle area is greater than or equal to the second preset threshold and less than the first preset threshold, the filling data includes second verification data of the target data to be written in the physical page where the idle area is located; If the size of the free area is smaller than the second preset threshold, the filling data includes a checksum of the data to be written; Wherein, the first preset threshold is greater than the second preset threshold.

3. The method according to claim 2, characterized in that Writing the to-be-written data and the filling data into the physical page includes: Directly write the filling data at the position after the data to be written; or, A preset filling array is written at the head position or the tail position of the physical page, and the data to be written and the filling data are written at the position after the preset filling array.

4. The method according to claim 3, characterized in that 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 having the same 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.

5. The method according to claim 4, characterized in that The step of directly writing the filling data at a position after the data to be written comprises: dividing the at least two data blocks into at least two physical pages of the same physical block; For any physical page of the at least two physical pages, a check block of data blocks included in other physical pages of the at least two physical pages except the physical page is filled after the data block of the physical page to complete the free area of ​​the current physical page.

6. The method according to claim 4, characterized in that The step of directly writing the filling data at a position after the data to be written comprises: dividing each of the at least two data blocks into physical pages of different physical blocks; For any physical page among the at least two physical pages, a check block of data blocks included in other physical pages among the at least two physical pages except the physical page is filled in the position after the data block of the physical page.

7. The method according to claim 3, characterized in that The target data to be written is equal in length to the second verification data, a preset padding array is written at the head position or the tail position of the physical page, and after the data to be written and the padding data are written at the 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 up the physical page, generating a first verification block according to the target data to be written, and generating a second verification block according to the second verification data; The preset filling data, the target data to be written and the second check block are written into a first physical page, and the preset filling data, the second check data and the first check block are written into a second physical page; the first physical page and the second physical page are different physical pages.

8. The method according to claim 3, characterized in that The target data to be written and the second verification data are not of equal length, a preset padding array is written at the head position or the tail position of the physical page, and after the data to be written and the padding data are written at the 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 up the physical page, a random number is written to fill the free area.

9. The method according to claim 1, characterized in that: The physical page includes a data area and a redundant area, the data area is used to write the data to be written, the redundant area is used to write at least one auxiliary data of the data to be written, and the idle area is located in the redundant area; the determining the filling data of the idle area according to the size of the idle area of ​​the physical page includes: If the free area exceeds one half of the size of the redundant area, fill the check data of the at least one auxiliary data at the beginning or the end of the redundant area; and fill the auxiliary information backup to the free area, and the positions of the backup data and the original data in the redundant area are symmetrical; If the free area is smaller than half of the redundant area and larger than a preset minimum free value, fill the check data of the at least one auxiliary information at the beginning or end of the redundant area; and select key information in the at least one auxiliary information to back up and fill it into the free area; If the idle area is less than or equal to the preset minimum idle value, a checksum of the at least one auxiliary information is filled at the beginning or the end of the redundant area.

10. A flash memory, characterized in that: The method comprises a flash memory controller and at least one flash memory chip, wherein the flash memory controller is used to execute the step instructions in the method as claimed in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Flash memory device and management method thereof

    CN103914397A

  • ECC frame length adjustment method and apparatus

    CN107168816A

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

    CN115268786A

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

    CN118885115A