Flash memory data processing method, device, computer equipment and storage medium
By monitoring the number of reads in QLC flash memory and dynamically adjusting the Gray code encoding method, the reliability problems caused by the fixed encoding method are solved, the read and write performance and reliability of the flash memory are improved, and the service life is extended.
Patent Information
- Application Number
- CN202410734695.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-06-07
AI Technical Summary
In QLC flash memory, the fixed Grey code encoding method causes the reliability of some pages in the flash memory unit to be worse, increasing the number of data rereading and writing times, affecting performance and service life.
By monitoring the number of read times of application data, dynamically adjusting the Gray code encoding method, encoding according to the read and write performance characteristics of different data blocks, improving the reliability and performance of data blocks.
It improves the read and write performance and overall reliability of flash memory, extends the service life, and optimizes the storage efficiency and reliability of flash memory through dynamic encoding of data blocks.
Smart Images

Figure CN118312110B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of flash memory technology, and in particular to a flash memory data processing method, device, computer equipment and storage medium. Background Art
[0002] In QLC (Triple-Level Cell) flash memory, flash reads can distinguish whether a cell is above / below a certain voltage, so reading data from such a cell usually involves multiple flash reads. For the widely adopted flash data Gray code encoding, the minimum number of flash reads for different pages can be used to represent a specific Gray code selection. Based on this, in the relevant flash data processing scheme, a corresponding Gray code is usually set for the flash data to encode the stored data according to the Gray code.
[0003] However, there are certain differences in read and write performance and reliability between different Gray codes. At the same time, the use of fixed Gray code encoding will cause the reliability of some pages in the flash memory unit to further deteriorate. The deterioration in reliability will lead to an increase in the number of times the data in the flash memory is re-read and written, which not only affects the performance of the flash memory, but also affects the service life of the flash memory. Summary of the invention
[0004] In view of this, the present invention provides a flash memory data processing method, apparatus, computer equipment and storage medium to solve the problem that the reliability of some pages in the flash memory unit may be further deteriorated by using a fixed Gray code encoding method.
[0005] In a first aspect, the present invention provides a flash memory data processing method, the method comprising:
[0006] Acquire application data, and store the application data into a target data block in a data block of a flash memory, wherein the data block in the flash memory includes: a read data block associated with read-only data and / or a write data block associated with write data, and the encoding method corresponding to the read data block is different from that of the write data block;
[0007] When it is detected that the number of reads for the application data exceeds a read threshold of the target data block, determining a migration location for the application data in the flash memory, wherein the number of reads is used to indicate the number of reads for a preset page in the target data block;
[0008] The application data is encoded based on a first encoding method corresponding to the data block matching the migration position, and the encoded application data is stored in the migration position.
[0009] In an optional implementation manner, storing the application data into a target data block in a data block of a flash memory includes:
[0010] Based on the mapping information, searching for a second encoding method corresponding to the target data block, wherein the mapping information is used to characterize a corresponding relationship between the data block and the encoding method;
[0011] The application data is encoded according to the Gray code corresponding to the second encoding method, and the encoded application data is stored in the target data block.
[0012] In the disclosed embodiment, the second encoding method corresponding to the target data block can be found based on the mapping information in the DRAM, thereby implementing arbitration of the Gray code encoding method based on the characteristics of the application data, thereby improving the read performance and write performance of the flash memory.
[0013] In an optional implementation, the target data block includes: a write data block;
[0014] The step of encoding the application data according to the balanced Gray code corresponding to the second encoding mode and storing the encoded application data into the target data block includes:
[0015] Based on the balanced Gray code and the coarse coding steps of the second coding method, coarse coding a first page of the application data to obtain coarse coded data, wherein the first page includes: a most significant bit and a high significant bit;
[0016] Based on the balanced Gray code and the fine coding steps of the second coding method, the second page of the coarsely coded data is finely coded to obtain coded data, and the coded data is stored in the target data block, wherein the second page includes: middle valid bits and low valid bits.
[0017] In the embodiments of the present disclosure, it can be seen from the above that the write data block is usually related to the write data in the flash memory. Therefore, the above-mentioned unbalanced encoding method TSP (4,16) with better write performance and the corresponding Gray code GC (1,2,6,6) can be used in the write data block, thereby improving the write performance of the flash memory.
[0018] In an optional implementation, the flash memory includes: a four-level unit flash memory;
[0019] The method further comprises:
[0020] Obtaining Gray codes to be allocated corresponding to the four-layer unit flash memory, and respectively determining first mapping relationships between various Gray codes and corresponding encoding modes;
[0021] A second mapping relationship between the read data block and the write data block and the corresponding Gray code is established respectively, and mapping information is determined according to the first mapping relationship and the second mapping relationship.
[0022] In the disclosed embodiment, a mapping relationship can be established between the above-mentioned BGC block and UGC block and the corresponding Gray code and encoding method with better read and write performance, so as to determine the mapping information according to the mapping relationship, thereby providing a technical basis for the implementation of Gray code arbitration based on the characteristics of the application data.
[0023] In an optional embodiment, when the target data block includes a read data block, the preset page includes: a most significant bit, a high significant bit, an intermediate significant bit and a low significant bit; when the target data block includes a write data block, the preset page includes: a most significant bit and a high significant bit.
[0024] In the disclosed embodiment, a corresponding read threshold can be set for each page according to the read delay and weight of different page types in the QLC flash memory, thereby refining the granularity of setting the read threshold and further improving the reliability of the flash memory.
[0025] In an optional implementation manner, a method for determining a read threshold of a target data block includes:
[0026] Obtaining a number of re-read and write operations in the flash memory, and determining a storage state corresponding to the flash memory according to the number of re-read and write operations;
[0027] A preset threshold value at which the target data block matches the storage state is obtained, and the read threshold value is determined according to the preset threshold value.
[0028] In the disclosed embodiment, considering the different reading reliabilities of the UGC block and the BGC block, corresponding preset thresholds may be set for the UGC block and the BGC block, respectively, to ensure the reliability of the UGC block and the BGC block, thereby improving the overall reliability of the flash memory.
[0029] In an optional implementation, the above method further includes:
[0030] Based on the number of re-read and write operations in the flash memory, respectively setting corresponding re-read and write operation number intervals for the read data block and the write data block;
[0031] A corresponding storage state is set according to each of the re-read and re-write operation number intervals, and a corresponding preset threshold is set for each of the storage states.
[0032] In the disclosed embodiment, considering the different reading reliabilities of the UGC block and the BGC block, corresponding preset thresholds may be set for the UGC block and the BGC block, respectively, to ensure the reliability of the UGC block and the BGC block, thereby improving the overall reliability of the flash memory.
[0033] In an optional implementation, the storage state of the flash memory includes: a first storage state, a second storage state, and a third storage state, wherein the number of re-read and re-write operations in the flash memory corresponding to the first storage state, the second storage state, and the third storage state increases in sequence;
[0034] The step of storing the application data into a target data block in a data block of the flash memory further comprises:
[0035] When the flash memory is in a first storage state, determining an empty data block in the flash memory as the target data block, and storing the application data in the empty data block; or
[0036] When the flash memory is in the second storage state, determining a write data block in the flash memory as the target data block, and storing the application data into the write data block according to an encoding method corresponding to the write data block; or
[0037] When the flash memory is in the third storage state, a read data block in the flash memory is determined as the target data block, and the application data is stored in the read data block according to an encoding method corresponding to the read data block.
[0038] In the embodiments of the present disclosure, considering that the number of data re-read and write operations in the flash memory will gradually increase as the reliability of the flash memory decreases, the flash memory can be divided into different storage stages according to the number of re-read and write operations in the flash memory, and different application storage policies can be set for different storage stages, thereby improving the reliability of the flash memory in different storage stages.
[0039] In an optional implementation, the above method further includes:
[0040] Before monitoring that the number of reads for the application data exceeds a read threshold of the target data block, a preset threshold value of the read data block is determined based on an original bit error rate of data read in the read data block.
[0041] In the embodiment of the present disclosure, when setting the preset threshold TBR corresponding to the above BGC block, the value of TBR cannot be too large or too small. If it is too small, it will cause frequent data migration, and if it is too large, it will affect the read performance. Therefore, when setting, the preset threshold of the BGC block in each storage state of the flash memory can be set, thereby improving the applicability of the present disclosure to different storage states of the flash memory.
[0042] In an optional implementation manner, determining a preset threshold of the read data block based on an original bit error rate of secondary data read in the read data block includes:
[0043] Based on the to-be-confirmed threshold sequence, decoding the data in the read data block to obtain a decoded data sequence;
[0044] Acquire original data corresponding to the data in the read data block, and respectively determine original bit error rates corresponding to each decoded data in the decoded data sequence and the original data;
[0045] The to-be-confirmed threshold whose corresponding original bit error rate in the to-be-confirmed threshold sequence satisfies the bit error rate condition is determined as the preset threshold.
[0046] In the embodiment of the present disclosure, when setting the preset threshold TBR corresponding to the above BGC block, the value of TBR cannot be too large or too small. If it is too small, it will cause frequent data migration, and if it is too large, it will affect the read performance. Therefore, when setting, the preset threshold of the BGC block in each storage state of the flash memory can be set, thereby improving the applicability of the present disclosure to different storage states of the flash memory.
[0047] In an optional implementation, based on the to-be-confirmed threshold sequence, decoding the data in the read data block to obtain a decoded data sequence includes:
[0048] Obtaining the number of simulations of the to-be-confirmed threshold sequence, and determining whether the number of simulations does not exceed the number of elements in the to-be-confirmed threshold sequence;
[0049] If yes, decoding the data in the read data block based on the decoding mode corresponding to the read data block to obtain a decoded data sequence;
[0050] If not, the data in the read data block is decoded based on the decoding mode corresponding to the write data block to obtain a decoded data sequence.
[0051] In the disclosed embodiment, the decoding method can be determined based on the comparison result of the simulation times of the Monte Carlo method and the number of elements in the threshold sequence to be confirmed, thereby improving the accuracy of the decoded data obtained by decoding, and further improving the accuracy of the determined preset threshold.
[0052] In an optional implementation, determining a migration location for the application data in the flash memory includes:
[0053] When the target data block includes a write data block, determining a migration location for the application data in the read data block; or
[0054] When the target data block includes a read data block, the migration position is determined based on a target page of the write data block, wherein the target page includes: a middle valid bit and a low valid bit.
[0055] In the disclosed embodiment, the granularity of data migration between data blocks in the flash memory can be refined to the page level, thereby further improving the reliability of the flash memory.
[0056] In a second aspect, the present invention provides a flash memory data processing device, the device comprising:
[0057] An acquisition module, used for acquiring application data, and storing the application data into a target data block in a data block of a flash memory, wherein the data block in the flash memory includes: a read data block and / or a write data block;
[0058] a determination module, configured to determine a migration location for the application data in the flash memory when it is detected that the number of reads for the application data exceeds a read threshold of the target data block, wherein the number of reads is used to indicate the number of reads for a preset page in the target data block;
[0059] The encoding module is used to encode the application data based on a first encoding method corresponding to the data block matching the migration position, and store the encoded application data into the migration position.
[0060] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the flash memory data processing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0061] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the flash memory data processing method of the first aspect or any corresponding embodiment thereof.
[0062] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the flash memory data processing method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0064] Figure 1 It is a schematic diagram of the threshold voltage distribution of flash memory cells in QLC flash memory;
[0065] Figure 2 is a flow chart of a flash memory data processing method according to an embodiment of the present invention;
[0066] Figure 3 is a flow chart of another flash memory data processing method according to an embodiment of the present invention;
[0067] Figure 4 It is a schematic diagram of encoding application data based on an unbalanced encoding method;
[0068] Figure 5 is a flow chart of another flash memory data processing method according to an embodiment of the present invention;
[0069] Figure 6 It is a schematic diagram of the data storage method between data blocks in different storage states in flash memory;
[0070] Figure 7 It is a schematic diagram of the process of encoding and decoding data in flash memory;
[0071] Figure 8 is a framework diagram of a flash memory data processing system according to an embodiment of the present invention;
[0072] Fig. 9 is a structural block diagram of a flash memory data device according to an embodiment of the present invention;
[0073] Fig.10 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0075] In conjunction with the application scenarios on which the execution of the flash memory data processing method depends, the application scenarios are described here.
[0076] In QLC (Triple-Level Cell) flash memory, flash reads can distinguish whether a cell is above / below a certain voltage, so reading data from such a cell usually involves multiple flash reads. For the widely adopted flash data Gray code encoding, the minimum number of flash reads for different pages can be used to represent a specific Gray code selection. Based on this, in the relevant flash data processing scheme, a corresponding Gray code is usually set for the flash data to encode the stored data according to the Gray code.
[0077] However, there are certain differences in read and write performance and reliability between different Gray codes. At the same time, the use of fixed Gray code encoding will cause the reliability of some pages in the flash memory unit to further deteriorate. The deterioration in reliability will lead to an increase in the number of times the data in the flash memory is re-read and written, which not only affects the performance of the flash memory, but also affects the service life of the flash memory.
[0078] For example, if Figure 1 The figure shows a threshold voltage distribution diagram of a flash memory cell in a QLC flash memory. Commonly used Gray codes in the QLC flash memory include: GC (1,2,4,8), GC (1,2,6,6), GC (1,4,5,5) and GC (3,4,4,4). Among them, GC (1,2,4,8), GC (1,2,6,6), GC (1,4,5,5) have better write performance, and GC (3,4,4,4) has better read performance. However, after setting a fixed Gray code for the flash memory data, the read and write performance cannot be taken into account, and the reliability of some pages in the flash memory cell is further deteriorated.
[0079] Based on this, the present invention provides a flash memory data processing method, the method comprising: obtaining application data, and storing the application data in a target data block in a data block of the flash memory, wherein the data block in the flash memory comprises: a read data block related to read-only data and / or a write data block related to write data, and at the same time, the encoding method corresponding to the read data block is different from that of the write data block. When it is detected that the number of reads for the application data exceeds the read threshold of the target data block, a migration position can be determined for the application data in the flash memory, wherein the number of reads is used to indicate the number of reads of a preset page in the target data block. Next, the application data can be encoded based on a first encoding method corresponding to a data block matching the migration position, and the encoded application data is stored in the migration position. The present invention can partition the flash memory into data blocks, and different data blocks correspond to different Gray codes and encoding methods, so that when the application data is processed through the corresponding data blocks, the corresponding encoding method can be flexibly adopted, thereby improving the reliability of the pages in the flash memory unit, thereby improving the performance of the flash memory, and increasing the service life of the flash memory.
[0080] According to an embodiment of the present invention, an embodiment of a flash memory data processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0081] In this embodiment, a flash memory data processing method is provided, which can be used for the above-mentioned QLC flash memory. Figure 2 is a flow chart of a flash memory data processing method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0082] Step S201, obtain application data, and store the application data into a target data block in a data block of the flash memory, wherein the data block in the flash memory includes: a read data block related to read-only data and / or a write data block related to write data, and the encoding method corresponding to the read data block and the write data block is different.
[0083] In the disclosed embodiment, the read data block may be a BGC (balanced Gray Code) block, and the write data block may be a UGC (Unbalanced Gray Code) block. Here, the read data block and the write data block are both determined by blank data blocks in the flash memory. Specifically, a blank data block storing read-only data may be determined as a read data block, and a blank data block storing write data may be determined as a write data block.
[0084] It should be understood that the encoding method corresponding to the above BGC block can be a balanced encoding method, and the corresponding Gray code can be GC (3, 4, 4, 4). Here, the balanced encoding method can be TSP (16, 16), where TSP means two steps, which means encoding the flash memory word line in two steps based on the Gray code, the first step of coarse encoding has 16 encoding steps, and the second step of fine encoding has 16 encoding steps.
[0085] In addition, the encoding method corresponding to the above UGC block can be an unbalanced encoding method, and the corresponding Gray code can be GC (1,2,6,6). Here, the unbalanced encoding method can be TSP (4,16), wherein the number of encoding steps of the first step coarse encoding is 4, and the number of encoding steps of the second step fine encoding is 16. Here, the above balanced encoding method TSP (16,16) has better read performance, and the unbalanced encoding method TSP (4,16) has better write performance.
[0086] Taking into account that the characteristics of the above-mentioned application data are usually unknown before execution, that is, it is impossible to determine whether the application data is read-only data, write data, or read-write interleaved access data, therefore, the application data can first be stored in a BGC block or a blank data block according to the encoding method corresponding to the above-mentioned BGC block, so that the stored data has better read performance, thereby improving the reliability of subsequent reading of secondary data in the flash memory.
[0087] Next, the characteristics of the application data can be continuously detected, and the target data block corresponding to the application data can be determined based on the detected characteristics, thereby realizing arbitration of the Gray code encoding method used. For example, if it is detected that the characteristics of the application data are read-only data, the BGC block can be determined as the target data block to continue to store the application data in the BGC block. If it is detected that the subsequent application data is write data, the UGC block can be determined as the target data block to store the subsequent application data in the UGC block. If the application data is detected as read-write interleaved access data, the corresponding target data block can be selected based on the read-write ratio in the application data. For example, when the read ratio is high, the BGC block is determined as the target data block, and when the write ratio is high, the UGC block is determined as the target data block.
[0088] Step S202, when it is monitored that the number of reads for the application data exceeds the read threshold of the target data block, a migration location is determined for the application data in the flash memory, wherein the number of reads is used to indicate the number of reads of a preset page in the target data block.
[0089] In the embodiments of the present disclosure, it is taken into consideration that bad blocks will gradually be generated in flash memory cells as the usage time increases. For example, if the flash memory cells have a limit on the number of writes, frequent read operations are usually accompanied by erase operations. When a certain number of writes is reached, the storage cells may fail due to wear and tear and turn into bad blocks.
[0090] Based on this, the number of read operations for the above application data in the flash memory, that is, the above reading number, can be detected, so that the application data can be migrated at an appropriate time to avoid bad blocks, thereby improving the reliability of the flash memory.
[0091] Specifically, considering that there are certain differences in read / write performance and reliability between different Gray codes, this will lead to differences in read / write reliability of flash memory unit pages between different data blocks. For example, in the above-mentioned QLC flash memory, the flash memory unit page may include: LSB (Least Significant Bit), CSB (Central Significant Bit), MSB (Most Significant Bit), and TSB (Top Significant Bit).
[0092] In QLC flash memory, the read reliability of the LSB and MSB pages in the UGC block is higher than that of the CSB and TSB pages, and the read reliability of each page in the BGC block is relatively balanced. Therefore, corresponding read thresholds can be set for the UGC block and the BGC block respectively to ensure the reliability of the flash memory.
[0093] When setting the above read threshold, the granularity can be refined to the page in the flash memory unit, for example, corresponding read thresholds are set for different pages in the UGC block and the BGC block respectively.
[0094] Step S203: encode the application data based on a first encoding method corresponding to the data block matching the migration location, and store the encoded application data into the migration location.
[0095] In the disclosed embodiment, the first encoding method may be determined according to the encoding method corresponding to the data block matching the migration position. For example, if the data block corresponding to the migration position is the UGC, the first encoding method may be the unbalanced encoding method TSP (4,16).
[0096] Considering that the migration location often crosses data blocks when migrating data, it is necessary to re-encode the application data according to the encoding method of the data block corresponding to the migration location.
[0097] Specifically, the granularity of data migration can be refined to the page unit. For example, when migrating the data in the TSB and CSB pages of the above-mentioned UGC block to the BGC block, the application data to be migrated can be cached in DRAM (Dynamic Random Access Memory) and wait for the data in the LSB and MSB pages to be written to the BGC block, so that the data to be migrated and the data to be written are combined and written into the BGC block together, thereby reducing the frequency of data writing.
[0098] It can be known from the above description that in the embodiment of the present disclosure, application data is obtained and stored in a target data block in a data block of a flash memory, wherein the data block in the flash memory includes: a read data block related to read-only data and / or a write data block related to write data, and at the same time, the encoding method corresponding to the read data block is different from that of the write data block. When it is detected that the number of reads for the application data exceeds the read threshold of the target data block, a migration position can be determined for the application data in the flash memory, wherein the number of reads is used to indicate the number of reads of a preset page in the target data block. Next, the application data can be encoded based on the first encoding method corresponding to the data block matching the migration position, and the encoded application data is stored in the migration position. The present invention can partition the flash memory into data blocks, and the Gray codes and encoding methods corresponding to different data blocks are different, so that the corresponding encoding method can be flexibly adopted when processing the application data through the corresponding data blocks, thereby improving the reliability of the pages in the flash memory unit, thereby improving the performance of the flash memory, and increasing the service life of the flash memory.
[0099] In this embodiment, another flash memory data processing method is provided, which can be used for the above-mentioned QLC flash memory. Figure 3 is a flow chart of a flash memory data processing method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0100] Step S301, obtain application data, and store the application data into a target data block in a data block of the flash memory, wherein the data block in the flash memory includes: a read data block related to read-only data and / or a write data block related to write data, and the encoding method corresponding to the read data block and the write data block is different.
[0101] Specifically, the above step S301 includes:
[0102] Step S3011: searching for a second encoding method corresponding to the target data block based on mapping information, wherein the mapping information is used to represent a corresponding relationship between the data block and the encoding method.
[0103] Step S3012, encoding the application data according to the Gray code corresponding to the second encoding method, and storing the encoded application data into the target data block.
[0104] In the disclosed embodiment, a mapping relationship can be established in advance between data blocks in the flash memory and corresponding encoding methods, and mapping information can be determined based on the mapping relationship, wherein the mapping information can include GCB (Gray Code Bitmap) corresponding to the encoding method of each data block.
[0105] Here, the mapping information can be cached in the DRAM to call the DRAM to track which Gray code encoding method is used for each data block, so as to select different Gray code encoding methods for application data with different characteristics. For example, a Gray code encoding method with better read performance is used to improve read performance, and a Gray code encoding method with better programming performance is used to improve write performance, thereby performing Gray code arbitration based on the characteristics of application data.
[0106] It should be understood that, since the target data block and the data block corresponding to the migration position are usually different, the second encoding method is usually different from the first encoding method.
[0107] Step S302: When it is detected that the number of reads for the application data exceeds the read threshold of the target data block, a migration location is determined for the application data in the flash memory, wherein the number of reads indicates the number of reads for a preset page in the target data block. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0108] Step S303: Encode the application data based on the first encoding method corresponding to the data block matching the migration location, and store the encoded application data in the migration location. Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.
[0109] In the disclosed embodiment, the second encoding method corresponding to the target data block can be found based on the mapping information in the DRAM, thereby implementing arbitration of the Gray code encoding method based on the characteristics of the application data, thereby improving the read performance and write performance of the flash memory.
[0110] In some optional implementations, the target data block includes: a write data block, and the step S3012 includes:
[0111] Step a1, based on the balanced Gray code and the coarse coding steps of the second coding method, coarsely encode the first page of the application data to obtain coarsely encoded data, wherein the first page includes: the most significant bit and the high significant bit.
[0112] Step a2, based on the fine coding steps of the balanced Gray code and the second coding method, finely encode the second page of the coarsely encoded data to obtain encoded data, and store the encoded data into the target data block, wherein the second page includes: middle valid bits and low valid bits.
[0113] In the disclosed embodiment, when the target data block is the UGC block, the second encoding method may be an unbalanced encoding method TSP(4,16) in the form of TSP(M,N), and the Gray code corresponding to the encoding method may be the above GC(1,2,6,6), where M indicates the number of coarse encoding steps and N indicates the number of fine encoding steps. Here, the number of coarse encoding steps of TSP(4,16) is 4 and the number of fine encoding steps is 16.
[0114] like Figure 4 The figure shows a schematic diagram of encoding application data based on the unbalanced encoding method, wherein the first step is used to instruct to perform coarse programming on the first page to obtain coarse coded data, and the first page is the MSB and TSB. In addition, the second step is used to instruct to perform fine programming on the second page of the coarse coded data to obtain coded data, and the second page is the LSB and CSB.
[0115] In the embodiments of the present disclosure, it can be seen from the above that the write data block is usually related to the write data in the flash memory. Therefore, the above-mentioned unbalanced encoding method TSP (4,16) with better write performance and the corresponding Gray code GC (1,2,6,6) can be used in the write data block, thereby improving the write performance of the flash memory.
[0116] In some optional implementations, the flash memory includes: a four-layer unit flash memory, that is, the QLC flash memory unit, the target data block includes: a write data block, and the step S301 includes:
[0117] Step b1, obtaining the Gray code to be allocated corresponding to the four-layer unit flash memory, and respectively determining the first mapping relationship between various Gray codes and corresponding encoding methods.
[0118] Step b2: establishing second mapping relationships between the read data block and the write data block and the corresponding Gray code, and determining mapping information according to the first mapping relationship and the second mapping relationship.
[0119] In an embodiment of the present disclosure, after obtaining the Gray codes to be allocated, a corresponding encoding method with the best programming effect can be assigned to each Gray code to be allocated, so as to establish a first mapping relationship between various Gray codes and corresponding encoding methods. The specific method of determining the encoding method with the best programming effect shall be based on what can be implemented, and the present disclosure does not limit this.
[0120] Specifically, in the above-mentioned QLC flash memory, the Gray codes to be allocated may include: GC(1,2,4,8), GC(1,2,6,6), GC(1,4,5,5) and GC(3,4,4,4), wherein a first mapping relationship between the Gray codes GC(1,2,4,8), GC(1,2,6,6), GC(1,4,5,5) and the above-mentioned encoding method TSP(4,16) may be established, and a first mapping relationship between the Gray code GC(3,4,4,4) and the above-mentioned encoding method TSP(16,16) may be established.
[0121] Then, a second mapping relationship between the BGC block and the Gray code with better read performance may be established, and a second mapping relationship between the UGC block and the Gray code with better write performance may be established.
[0122] Specifically, a second mapping relationship between the BGC block and the balanced Gray code may be established, for example, a second mapping relationship between the BGC block and the balanced Gray code GC(3,4,4,4). In addition, a second mapping relationship between the UGC block and the unbalanced Gray code may be established, for example, a second mapping relationship between the UGC block and the unbalanced Gray code GC(1,2,4,8), GC(1,2,6,6) and GC(1,4,5,5).
[0123] In the disclosed embodiment, a mapping relationship can be established between the above-mentioned BGC block and UGC block and the corresponding Gray code and encoding method with better read and write performance, so as to determine the mapping information according to the mapping relationship, thereby providing a technical basis for the implementation of Gray code arbitration based on the characteristics of the application data.
[0124] In some optional embodiments, when the target data block includes a read data block, the preset page includes: a most significant bit, a high significant bit, a middle significant bit, and a low significant bit; when the target data block includes a write data block, the preset page includes: a most significant bit and a high significant bit.
[0125] In the disclosed embodiment, in the above QLC flash memory, considering that there are differences in read latency and reliability in different types of flash memory pages, the LSB (low significant bit) page has the smallest read latency and the best reliability, while the TSB (most significant bit) page has the largest read latency and the worst reliability, and the latency gap between the LSB page and the TSB page can be as high as 20 times.
[0126] According to the asymmetric read latency, the above flash memory pages can be divided into three types: Type 1, TSB and MSB of UGC block, which often have higher read latency; Type 2, all pages in BGC block, the read latency is in the medium range; Type 3, LSB (low significant bit) and CSB (mid-significant bit) pages in UGC block, the read latency is relatively low.
[0127] In addition, in the above UGC block, MSB represents the bit with the largest weight in the binary code, and its change has the greatest impact on the entire value. In Gray code, MSB is usually used to represent the most important information bit. Secondly, TSB and LSB represent the bit with the smallest weight and the second smallest weight, respectively, and their changes in binary code have relatively little impact on the entire value. In Gray code, these two bits are usually used to represent less important information bits. Finally, CSB is a bit between MSB and LSB, and its weight and impact are between the two.
[0128] Specifically, when reading these different bits of data, they contribute differently to the overall value because of their different weights in the encoding. In practical applications, this may mean that when processing signals or data, changes in different bits will result in different degrees of impact. For example, changes in the MSB and TSB may result in significant changes in the overall value, while changes in the CSB and LSB may only result in smaller changes.
[0129] Based on this, in the above UGC block, the TSB and MSB pages can be set as the default pages based on the consideration of read latency and weight. At the same time, in the above BGC block, all pages (TSB, MSB, LSB and CSB) in the BGC block are set as the default pages.
[0130] In the disclosed embodiment, a corresponding read threshold can be set for each page according to the read delay and weight of different page types in the QLC flash memory, thereby refining the granularity of setting the read threshold and further improving the reliability of the flash memory.
[0131] In this embodiment, another flash memory data processing method is provided, which can be used for the above-mentioned QLC flash memory. Figure 5 is a flowchart of another flash memory data processing method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0132] Step S501, obtain application data, and store the application data into a target data block in a data block of the flash memory, wherein the data block in the flash memory includes: a read data block related to read-only data and / or a write data block related to write data, and the encoding method corresponding to the read data block and the write data block is different. For details, please refer to Figure 2Step S201 of the illustrated embodiment will not be described in detail here.
[0133] Step S502, when it is monitored that the number of reads for the application data exceeds the read threshold of the target data block, a migration location is determined for the application data in the flash memory, wherein the number of reads is used to indicate the number of reads of a preset page in the target data block.
[0134] Specifically, in the above step S502, the method for determining the read threshold of the target data block includes:
[0135] Step S5021, obtaining the number of re-read and write operations in the flash memory, and determining the storage state corresponding to the flash memory according to the number of re-read and write operations.
[0136] Step S5022, obtaining a preset threshold value for matching the target data block with the storage state, and determining a read threshold value according to the preset threshold value.
[0137] Step S503: Encode the application data based on the first encoding method corresponding to the data block matching the migration location, and store the encoded application data in the migration location. Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.
[0138] In the disclosed embodiments, the reliability of the flash memory will gradually decrease as the usage time increases. For example, as the flash memory is used, the storage unit will undergo multiple programming and erasing operations, which will cause physical wear. In particular, QLC type flash memory needs to pass through a thinner silicon dioxide layer to store more bits, which makes the oxide layer thinner more easily, thereby reducing the service life. In addition, over time, even if no write operation is performed, the charge stored in the flash memory cell may gradually decrease due to leakage, which will also affect the reliability of the data.
[0139] As the reliability of flash memory decreases, the number of re-read and write operations on data in the flash memory will gradually increase. Therefore, the preset threshold corresponding to each data block in different storage states of the flash memory can be pre-set to determine the storage state corresponding to the flash memory based on the number of re-read and write operations occurring in the flash memory, thereby finding the preset threshold corresponding to the data block according to the storage state.
[0140] Specifically, the preset threshold setting method includes:
[0141] Step c1, based on the re-read and write operation numbers in the flash memory, respectively set corresponding re-read and write operation number intervals for the read data block and the write data block.
[0142] Step c2, setting a corresponding storage state according to each re-read and write operation number interval, and setting a corresponding preset threshold for each storage state.
[0143] In the disclosed embodiment, based on the re-read and write operands in the flash memory, corresponding re-read and write operand intervals are set for the read data block and the write data block, respectively, and the corresponding storage state is set according to each re-read and write operand interval as described below and will not be repeated here.
[0144] When setting the corresponding preset threshold for the storage status of the above-mentioned data block, the preset threshold TUR (Threshold Update Read) corresponding to the above-mentioned UGC block can be set first. For example, the TUR can ignore the storage status of the flash memory and be fixedly set to 1. That is, if data is read at the TSB or MSB of the UGC block, it will be considered that the read threshold is exceeded, so that the above-mentioned application data is migrated to the BGC block.
[0145] In addition, when setting the preset threshold TBR corresponding to the above BGC block, the value of TBR cannot be too large or too small. If it is too small, it will cause frequent data migration, and if it is too large, it will affect the reading performance. Therefore, when setting, the preset threshold of the BGC block in each storage state of the flash memory can be set to improve the applicability of the present disclosure to different storage states of the flash memory. The specific setting process is described as follows and will not be repeated here.
[0146] Step S503: Encode the application data based on the first encoding method corresponding to the data block matching the migration location, and store the encoded application data in the migration location. Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.
[0147] In the disclosed embodiment, considering the different reading reliabilities of the UGC block and the BGC block, corresponding preset thresholds may be set for the UGC block and the BGC block, respectively, to ensure the reliability of the UGC block and the BGC block, thereby improving the overall reliability of the flash memory.
[0148] In some optional implementations, the storage state of the flash memory includes: a first storage state, a second storage state, and a third storage state, wherein the number of re-read and re-write operations in the flash memory corresponding to the first storage state, the second storage state, and the third storage state increases in sequence, and the above step S201 also includes the following manner:
[0149] Method 1: The flash memory is in the first storage state.
[0150] An empty data block in the flash memory is determined as a target data block, and the application data is stored in the empty data block.
[0151] In the embodiment of the present disclosure, no additional reread and rewrite operations will occur during the first storage stage. It should be understood that a counter can be set to count the number of reread and rewrite operations that occur on different pages in the UGC block and the BGC block, so as to determine the storage state of the flash memory based on the number of reread and rewrite operations. Here, the more times the data is read, the higher the read heat. Therefore, the storage state of the flash memory can also be determined based on the number of rereads. The specific storage state determination method is not limited in the present disclosure.
[0152] like Figure 6 The figure shows the data storage method between data blocks in different storage states in the flash memory, wherein stage one is the above-mentioned first storage state, the UGC flash memory block is the UGC block, and the free data block is the empty data block.
[0153] In the above UGC block, data A to H are written for the first time. In the subsequent process, data A, C, F, and G are updated and rewritten into the UGC block to obtain updated pages. Then, the pages of the original locations of data A, C, F, and G can be determined as invalid pages after the update. Next, the application data can be written into the empty data blocks of the flash memory.
[0154] Method 2: The flash memory is in the second storage state, a write data block in the flash memory is determined as a target data block, and the application data is stored in the write data block according to an encoding method corresponding to the write data block.
[0155] In the disclosed embodiment, in the second storage phase, the TSB and MSB pages of the UGC may introduce a reread operation. At this time, the BGC block can be used as a default data block to determine the Gray code corresponding to the BGC block as the default Gray code. Specifically, after the acquired application data is updated to the UGC block, the application data in the TSB and MSB pages in the UGC block whose read times exceed the TUR can be updated to the BGC block.
[0156] Specifically, Figure 6 As shown, in the second storage state (i.e., stage 2 in the figure), when the application data A, C, F, G are stored in the UGC block, the number of reads of A, C, F, G can be detected, and F and G whose number of reads exceeds the above TUR are determined as hot read data. Then, F and G can be updated to the BGC block ( Figure 6 The CSB and LSB pages of the BGC flash memory block (i.e., the BGC block) in the BGC block are determined as hot pages storing hot read data.
[0157] Mode three: the flash memory is in the third storage state, a read data block in the flash memory is determined as a target data block, and the application data is stored in the read data block according to an encoding method corresponding to the read data block.
[0158] In the embodiment of the present disclosure, during the second storage phase, the BGC page also undergoes a reread operation. At this time, bad blocks appear on the TSB and MSB pages in the UGC block, and the encoding method corresponding to the UGC is no longer reliable.
[0159] Therefore, the application data A, C, F, G can be stored in the BGC block, and the read times of all data AH and A, C, F, G in the BGC block can be detected. When it is detected that the read times of B and D exceed the above TBR, the hot read data B and D can be stored in the CSB and LSB pages of the UGC.
[0160] In the embodiments of the present disclosure, considering that the number of data re-read and write operations in the flash memory will gradually increase as the reliability of the flash memory decreases, the flash memory can be divided into different storage stages according to the number of re-read and write operations in the flash memory, and different application storage policies can be set for different storage stages, thereby improving the reliability of the flash memory in different storage stages.
[0161] In some optional implementations, before the number of reads for the application data exceeds the read threshold of the target data block, Figure 2 The corresponding implementation method also includes the following process:
[0162] Based on the original bit error rate of the data read in the read data block, a preset threshold value of the read data block is determined.
[0163] In the disclosed embodiment, it can be seen from the above that the read threshold TUR of the UGC block is usually set to a fixed value, and when setting the preset threshold TBR corresponding to the BGC block, the value of TBR cannot be too large or too small. If it is too small, it will cause frequent data migration, and if it is too large, it will affect the reading performance. Therefore, the preset threshold of the BGC block in each storage state of the flash memory can be set during the setting.
[0164] Specifically, determining the preset threshold value for reading the data block includes:
[0165] Step S11, based on the threshold sequence to be confirmed, decoding the data in the read data block to obtain a decoded data sequence.
[0166] Step S12, obtaining the original data corresponding to the data in the read data block, and respectively determining the original bit error rate corresponding to each decoded data in the decoded data sequence and the original data.
[0167] Step S13: determining the to-be-confirmed threshold whose corresponding original bit error rate in the to-be-confirmed threshold sequence meets the bit error rate condition as the preset threshold.
[0168] In the embodiment of the present disclosure, multiple thresholds to be confirmed can be pre-set to obtain a threshold sequence xi (i=1, 2, ..., m) to be confirmed, and the Monte Carlo method is used to analyze the impact of different thresholds to be confirmed on flash memory reliability, thereby obtaining a preset threshold.
[0169] like Figure 7 The figure shows a flow chart of data encoding and decoding in a flash memory, wherein, first, the original transmission data Sn can be encoded in various ways according to the encoding method in the BGC block to obtain the original data S'n, and then, S'n can be transmitted through the channel according to any to-be-confirmed threshold xi in the to-be-confirmed threshold sequence to obtain a signal Rn, Rn=S'n+No. Among them, No represents the flash memory channel noise, which is used to represent the comprehensive additive noise such as programming or erasing interference, inter-cell interference, persistent interference, random telegraph noise, etc.
[0170] Next, the target signal R'n may be obtained by channel detection on Rn, and Yn may be obtained by source decoding on the target signal R'n, so as to calculate the original bit error rate RBERi based on Yn and the original data Sn.
[0171] It should be understood that the original bit error rate corresponding to each to-be-confirmed threshold in the to-be-confirmed threshold sequence xi can be calculated by the above-mentioned method of calculating the original bit error rate, so as to obtain the bit error rate matrix [RBER1, RBER2, ..., RBERm-1, RBERm]. Then, the original bit error rate RBERmin with the minimum bit error rate can be determined by the above-mentioned bit error rate condition, so as to determine the to-be-confirmed threshold corresponding to the RBERmin as the preset threshold.
[0172] In the embodiment of the present disclosure, when setting the preset threshold TBR corresponding to the above BGC block, the value of TBR cannot be too large or too small. If it is too small, it will cause frequent data migration, and if it is too large, it will affect the read performance. Therefore, when setting, the preset threshold of the BGC block in each storage state of the flash memory can be set, thereby improving the applicability of the present disclosure to different storage states of the flash memory.
[0173] In some optional implementations, the above step S11 includes:
[0174] Get the number of simulations for the threshold sequence to be confirmed, and determine whether the number of simulations does not exceed the number of elements in the threshold sequence to be confirmed.
[0175] Specifically, if yes, then based on the decoding mode corresponding to the read data block, the data in the read data block is decoded to obtain a decoded data sequence;
[0176] If not, the data in the read data block is decoded based on the decoding mode corresponding to the write data block to obtain a decoded data sequence.
[0177] In the embodiment of the present disclosure, it can be seen from the above that the Monte Carlo method can be used to analyze the influence of different thresholds to be confirmed on the reliability of the flash memory, so as to obtain the preset threshold. Therefore, when the target signal is decoded by the source to obtain the decoded data Yn, it can be determined whether the simulation times N of the Monte Carlo method does not exceed the number of elements i in the threshold sequence to be confirmed.
[0178] Specifically, if N≥i, R'n is decoded according to the Gray code GC(3,4,4,4) corresponding to BGC to obtain Yn; if N<i, R'n is decoded according to the Gray code GC(1,2,6,6) corresponding to UGC to obtain Yn.
[0179] In the disclosed embodiment, the decoding method can be determined based on the comparison result of the simulation times of the Monte Carlo method and the number of elements in the threshold sequence to be confirmed, thereby improving the accuracy of the decoded data obtained by decoding, and further improving the accuracy of the determined preset threshold.
[0180] In this embodiment, another flash memory data processing method is provided, which can be used for the above-mentioned QLC flash memory. The process includes the following steps:
[0181] Step S801, obtain application data, and store the application data into a target data block in a data block of the flash memory, wherein the data block in the flash memory includes: a read data block related to read-only data and / or a write data block related to write data, and the encoding method corresponding to the read data block and the write data block is different. For details, please refer to Figure 2 Step S201 of the illustrated embodiment will not be described in detail here.
[0182] Step S802: When it is detected that the number of reads for the application data exceeds the read threshold of the target data block, a migration location is determined for the application data in the flash memory, wherein the number of reads indicates the number of reads for a preset page in the target data block. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0183] Step S803: Encode the application data based on a first encoding method corresponding to the data block matching the migration location, and store the encoded application data into the migration location.
[0184] Specifically, the above step S803 includes:
[0185] When the target data block includes a write data block, a migration location is determined for the application data in the read data block; or when the target data block includes a read data block, a migration location is determined based on a target page of the write data block, wherein the target page includes: a middle valid bit and a low valid bit.
[0186] In the disclosed embodiment, considering that the reliability of the MSB and TSB pages in the above-mentioned UGC block is relatively poor, the preset pages in the UGC block are the MSB and TSB pages, while the reliability of the pages in the BGC block is relatively balanced. Therefore, the preset pages in the BGC block are all pages, namely LSB, CSB, MSB and TSB.
[0187] Therefore, when migrating data in UGC to BGC, any page in BGC can be used as the migration location, and when migrating data in BGC to UGC, the LSB and CSB pages with higher reliability in UGC can be used as target pages to determine the migration location based on the target pages.
[0188] In the disclosed embodiment, the granularity of data migration between data blocks in the flash memory can be refined to the page level, thereby further improving the reliability of the flash memory.
[0189] In this embodiment, a flash memory data processing system is also provided, which can be used for the above-mentioned QLC flash memory. Figure 8 1 is a framework diagram of a flash memory data processing system according to an embodiment of the present invention, the flash memory system comprises: an SSD (Solid State Drive) controller, an FTL (Flash Translation Layer) and a flash memory, wherein;
[0190] The SSD controller is used to connect the flash memory interface and the host interface, and regulate the data reading and writing between the flash memory chips to ensure their wear balance, control the garbage collection in the flash memory, and perform coding error correction in the flash memory.
[0191] FTL, used to perform the above Figure 2 The arbitration of the Gray code encoding method in the corresponding embodiment, wherein the DRAM is used to store the above mapping information GCB to perform the above Figure 3 The implementation method of determining the target data block in the corresponding embodiment.
[0192] In the disclosed embodiment, the initial Gray code arbitration is the implementation method corresponding to the above step S201 of determining the target data block corresponding to the application, and storing the application data in the target data block. The thermal data Gray code arbitration is the implementation method of the above step S203 of encoding the application data based on the first encoding method corresponding to the data block matching the migration position, and storing the encoded application data in the migration position. In the Gray code arbitration perceived in the reliability stage, the reliability stage includes the above first storage state to the third storage state, and the Gray code arbitration in this stage is the embodiment corresponding to the above step S201.
[0193] Flash memory is used to provide read and write operations for the above application data.
[0194] In the embodiment of the present disclosure, the above-mentioned UGC block and BGC block are included, so that the acquired application data is stored in the above-mentioned UGC block or BGC block through the controller, and the specific data storage process is not specifically limited in the present disclosure. At the same time, an encoding component for encoding the application data and a decoding component for decoding the application data are provided, so as to encode or decode the application data in response to the read and write operations on the application data.
[0195] In this embodiment, a flash memory data processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0196] This embodiment provides a flash memory data processing device, such as Fig. 9 As shown, including:
[0197] The acquisition module 901 is used to acquire application data and store the application data into a target data block in a data block of the flash memory, wherein the data block in the flash memory includes: a read data block and / or a write data block;
[0198] A determination module 902, configured to determine a migration location for the application data in the flash memory when it is detected that the number of reads for the application data exceeds a read threshold of the target data block, wherein the number of reads is used to indicate the number of reads for a preset page in the target data block;
[0199] The encoding module 903 is used to encode the application data based on a first encoding method corresponding to the data block matching the migration position, and store the encoded application data into the migration position.
[0200] In some optional implementations, the acquisition module 901 includes:
[0201] A search unit, used to search for a second encoding method corresponding to the target data block based on mapping information, where the mapping information is used to characterize a correspondence between the data block and the encoding method;
[0202] The encoding unit is used to encode the application data according to the Gray code corresponding to the second encoding method, and store the encoded application data into the target data block.
[0203] In some optional implementations, the target data block includes: a write data block; and the encoding unit includes:
[0204] The coarse coding subunit is used to coarsely code the first page of the application data based on the coarse coding steps of the balanced Gray code and the second coding mode to obtain coarse coded data, wherein the first page includes: a most significant bit and a high significant bit;
[0205] The fine coding subunit is used to perform fine coding on the second page of the coarse coding data based on the balanced Gray code and the fine coding steps of the second coding mode to obtain coded data and store the coded data into the target data block, wherein the second page includes: middle valid bits and low valid bits.
[0206] In some optional implementations, the flash memory includes: a four-layer unit flash memory; the acquisition module 901 also includes:
[0207] A first determining unit, used for obtaining Gray codes to be allocated corresponding to the four-layer unit flash memory, and respectively determining first mapping relationships between various Gray codes and corresponding encoding modes;
[0208] The second determining unit is used to respectively establish a second mapping relationship between the read data block and the write data block and the corresponding Gray code, and determine the mapping information according to the first mapping relationship and the second mapping relationship.
[0209] In some optional embodiments, when the target data block includes a read data block, the preset page includes: a most significant bit, a high significant bit, a middle significant bit, and a low significant bit; when the target data block includes a write data block, the preset page includes: a most significant bit and a high significant bit.
[0210] In some optional implementations, the determining module 902 includes:
[0211] A third determining unit is used to obtain a number of re-read and write operations in the flash memory, and determine a storage state corresponding to the flash memory according to the number of re-read and write operations;
[0212] The fourth determining unit is used to obtain a preset threshold value for matching the target data block with the storage state, and determine a read threshold value according to the preset threshold value.
[0213] In some optional implementations, the determining module 902 further includes:
[0214] A first setting unit is used to set corresponding re-read and write operation number intervals for the read data block and the write data block respectively based on the re-read and write operation number in the flash memory;
[0215] The second setting unit is used to set a corresponding storage state according to each re-read and write operation number interval, and to set a corresponding preset threshold for each storage state.
[0216] In some optional implementations, the storage state of the flash memory includes: a first storage state, a second storage state, and a third storage state, wherein the number of re-read and write operations in the flash memory corresponding to the first storage state, the second storage state, and the third storage state increases in sequence; the acquisition module 901 further includes:
[0217] A fifth determination unit is used to determine an empty data block in the flash memory as a target data block and store the application data into the empty data block when the flash memory is in a first storage state; or to determine a write data block in the flash memory as a target data block and store the application data into the write data block according to an encoding method corresponding to the write data block when the flash memory is in a second storage state; or to determine a read data block in the flash memory as a target data block and store the application data into the read data block according to an encoding method corresponding to the read data block when the flash memory is in a third storage state.
[0218] In some optional embodiments, the above device further includes:
[0219] The sixth determination unit is used to determine a preset threshold value of the read data block based on the original bit error rate of the data read in the read data block before monitoring that the number of reads for the application data exceeds the read threshold of the target data block.
[0220] In some optional implementations, the sixth determining unit includes:
[0221] A decoding subunit, used for decoding the data in the read data block based on the to-be-confirmed threshold sequence to obtain a decoded data sequence;
[0222] A first determining subunit is used to obtain original data corresponding to the data in the read data block, and respectively determine the original bit error rate corresponding to each decoded data in the decoded data sequence and the original data;
[0223] The second determining subunit is used to determine the to-be-confirmed threshold whose corresponding original bit error rate in the to-be-confirmed threshold sequence meets the bit error rate condition as the preset threshold.
[0224] In some optional implementations, the decoding subunit is further configured to:
[0225] Obtaining the number of simulations for the threshold sequence to be confirmed, and determining whether the number of simulations does not exceed the number of elements in the threshold sequence to be confirmed;
[0226] If yes, based on the decoding mode corresponding to the read data block, the data in the read data block is decoded to obtain a decoded data sequence;
[0227] If not, the data in the read data block is decoded based on the decoding method corresponding to the write data block to obtain a decoded data sequence.
[0228] In some optional implementations, the encoding module 903 includes:
[0229] a seventh determining unit, configured to determine a migration location for the application data in the read data block when the target data block includes the write data block; or
[0230] An eighth determination unit is configured to determine the migration position based on a target page of the write data block when the target data block includes the read data block, wherein the target page includes: a middle valid bit and a low valid bit.
[0231] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0232] The flash memory data processing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0233] The embodiment of the present invention also provides a computer device having the above Fig. 9 The flash memory data processing device shown.
[0234] See also Fig.10 , Fig.10 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.10 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.10 A processor 10 is taken as an example.
[0235] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0236] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0237] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0238] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0239] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0240] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0241] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0242] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A flash memory data processing method, characterized in that: The method comprises: Acquire application data, and store the application data into a target data block in a data block of a flash memory, wherein the data block in the flash memory includes: a read data block associated with read-only data and / or a write data block associated with write data, and the encoding method corresponding to the read data block is different from that of the write data block; Acquire a threshold sequence to be confirmed corresponding to the read data block, and decode the data in the read data block to obtain a decoded data sequence; Acquire original data corresponding to the data in the read data block, and respectively determine original bit error rates corresponding to each decoded data in the decoded data sequence and the original data; Determine the to-be-confirmed threshold whose corresponding original bit error rate in the to-be-confirmed threshold sequence satisfies the bit error rate condition as the preset threshold; Determine a read threshold of the read data block according to the preset threshold; When it is detected that the number of reads for the application data exceeds a read threshold of the target data block, determining a migration location for the application data in the flash memory, wherein the number of reads is used to indicate the number of read operations on a preset page in the target data block; The application data is encoded based on a first encoding method corresponding to the data block matching the migration position, and the encoded application data is stored in the migration position.
2. The method according to claim 1, characterized in that The step of storing the application data into a target data block in a data block of the flash memory comprises: Based on the mapping information, searching for a second encoding method corresponding to the target data block, wherein the mapping information is used to characterize a corresponding relationship between the data block and the encoding method; The application data is encoded according to the Gray code corresponding to the second encoding method, and the encoded application data is stored in the target data block.
3. The method according to claim 2, characterized in that The target data block includes: a write data block; The step of encoding the application data according to the balanced Gray code corresponding to the second encoding mode and storing the encoded application data into the target data block includes: Based on the balanced Gray code and the coarse coding steps of the second coding method, coarse coding a first page of the application data to obtain coarse coded data, wherein the first page includes: a most significant bit and a high significant bit; Based on the balanced Gray code and the fine coding steps of the second coding method, the second page of the coarsely coded data is finely coded to obtain coded data, and the coded data is stored in the target data block, wherein the second page includes: middle valid bits and low valid bits.
4. The method according to claim 2, characterized in that: The flash memory comprises: a four-layer unit flash memory; The method further comprises: Obtaining Gray codes to be allocated corresponding to the four-layer unit flash memory, and respectively determining first mapping relationships between various Gray codes and corresponding encoding modes; A second mapping relationship between the read data block and the write data block and the corresponding Gray code is established respectively, and mapping information is determined according to the first mapping relationship and the second mapping relationship.
5. The method according to claim 1, characterized in that When the target data block includes a read data block, the preset page includes: a most significant bit, a high significant bit, a middle significant bit and a low significant bit; when the target data block includes a write data block, the preset page includes: a most significant bit and a high significant bit.
6. The method according to claim 1, characterized in that The method for determining the read threshold of the target data block includes: Obtaining a number of re-read and write operations in the flash memory, and determining a storage state corresponding to the flash memory according to the number of re-read and write operations; A preset threshold value at which the target data block matches the storage state is obtained, and the read threshold value is determined according to the preset threshold value.
7. The method according to claim 6, characterized in that The method further comprises: Based on the number of re-read and write operations in the flash memory, respectively setting corresponding re-read and write operation number intervals for the read data block and the write data block; A corresponding storage state is set according to each of the re-read and re-write operation number intervals, and a corresponding preset threshold is set for each of the storage states.
8. The method according to claim 1, characterized in that The storage state of the flash memory includes: a first storage state, a second storage state and a third storage state, wherein the number of re-read and re-write operations in the flash memory corresponding to the first storage state, the second storage state and the third storage state increases in sequence; The step of storing the application data into a target data block in a data block of the flash memory further comprises: When the flash memory is in a first storage state, determining an empty data block in the flash memory as the target data block, and storing the application data in the empty data block; or When the flash memory is in the second storage state, determining a write data block in the flash memory as the target data block, and storing the application data into the write data block according to an encoding method corresponding to the write data block; or When the flash memory is in the third storage state, a read data block in the flash memory is determined as the target data block, and the application data is stored in the read data block according to an encoding method corresponding to the read data block.
9. The method according to claim 1, characterized in that: The method further comprises: Before monitoring that the number of reads for the application data exceeds the read threshold of the target data block, a preset threshold of the read data block is determined based on an original bit error rate of data read in the read data block.
10. The method according to claim 9, characterized in that The determining the preset threshold of the read data block based on the original bit error rate of the secondary data read in the read data block includes: Based on the to-be-confirmed threshold sequence, decoding the data in the read data block to obtain a decoded data sequence; Acquire original data corresponding to the data in the read data block, and respectively determine original bit error rates corresponding to each decoded data in the decoded data sequence and the original data; The to-be-confirmed threshold whose corresponding original bit error rate in the to-be-confirmed threshold sequence satisfies the bit error rate condition is determined as the preset threshold.
11. The method according to claim 10, characterized in that The step of decoding the data in the read data block based on the to-be-confirmed threshold sequence to obtain a decoded data sequence includes: Obtaining the number of simulations of the to-be-confirmed threshold sequence, and determining whether the number of simulations does not exceed the number of elements in the to-be-confirmed threshold sequence; If yes, decoding the data in the read data block based on the decoding mode corresponding to the read data block to obtain a decoded data sequence; If not, the data in the read data block is decoded based on the decoding mode corresponding to the write data block to obtain a decoded data sequence.
12. The method according to claim 1, characterized in that The step of determining a migration location for the application data in the flash memory includes: When the target data block includes a write data block, determining a migration location for the application data in the read data block; or When the target data block includes a read data block, the migration position is determined based on a target page of the write data block, wherein the target page includes: a middle valid bit and a low valid bit.
13. A flash memory data processing device, characterized in that: The device comprises: An acquisition module is used to acquire application data and store the application data into a target data block in a data block of a flash memory, wherein the data block in the flash memory includes: a read data block and / or a write data block, acquire a threshold sequence to be confirmed corresponding to the read data block, and decode the data in the read data block to obtain a decoded data sequence; acquire original data corresponding to the data in the read data block, and respectively determine an original bit error rate corresponding to each decoded data in the decoded data sequence and the original data; determine a threshold to be confirmed whose original bit error rate corresponding to the threshold sequence to be confirmed meets an error rate condition as a preset threshold; determine a read threshold of the read data block according to the preset threshold; a determination module, configured to determine a migration location for the application data in the flash memory when it is detected that the number of reads for the application data exceeds a read threshold of the target data block, wherein the number of reads is used to indicate the number of read operations on a preset page in the target data block; The encoding module is used to encode the application data based on a first encoding method corresponding to the data block matching the migration position, and store the encoded application data into the migration position.
14. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the flash memory data processing method according to any one of claims 1 to 12 by executing the computer instructions.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the flash memory data processing method according to any one of claims 1 to 12.
16. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the flash memory data processing method according to any one of claims 1 to 12.
