Data writing method and storage device
By calculating the wear value of storage blocks, the storage block with the least wear is selected for data writing, which solves the problem of uneven wear of storage blocks and improves the service life of the storage device.
Patent Information
- Application Number
- PCT/CN2024/094784
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2025-11-27
AI Technical Summary
In existing technologies, the maximum number of erase/write cycles for each storage block in a storage device is inconsistent, resulting in uneven wear, wasted storage capacity, and reduced lifespan.
By calculating the wear value of the storage blocks, and combining the actual number of erase/write cycles with the initial wear characteristics, the storage block with the least wear is selected for data writing, ensuring that the actual number of erase/write cycles of each storage block is balanced with the maximum number of erase/write cycles.
This enables full utilization of each storage block in the storage device and extends the lifespan of the storage device.
Smart Images

Figure CN2024094784_27112025_PF_FP_ABST
Abstract
Description
Data writing method and storage device
TECHNICAL FIELD
[0001] The present application relates to the field of storage, and in particular to a data writing method and a storage device.
BACKGROUND
[0002] In a storage device such as a NAND Flash, the minimum unit for performing an erase operation is usually referred to as a block. The maximum number of erase-write times of each block determines the service life of the block. The service life of the storage blocks in the storage device determines the service life of the storage device. In order to maximize the use of the number of erase-write times of all storage blocks and avoid some storage blocks reaching the service life of the block due to excessive number of erase-write times compared to other storage blocks, a wear leveling algorithm is usually used to balance the use of the storage blocks in the storage device. The idea of the algorithm is to select a storage block with the smallest number of erase-write times to perform the write when data writing is needed, so as to ensure that the number of erase-write times of all storage blocks is relatively average during the use of the entire storage device. However, the maximum number of erase-write times of each storage block in a storage device is not the same. If only the number of erase-write times of each storage block is ensured to be relatively average, the storage blocks with the maximum number of erase-write times cannot be fully utilized, which wastes the storage capacity of the storage device and reduces the service life of the storage device.
[0003]
SUMMARY
[0004] The main purpose of the present application is to provide a data writing method and a storage device, which can improve the service life of the storage device.
[0005] The first technical solution adopted by the present application is to provide a data writing method. The method is applied to a storage device. The storage device includes a control module and a plurality of storage blocks. The method includes that the control module, in response to obtaining to-be-written data, determines a target storage block from the plurality of storage blocks by using a wear value. The wear value of each storage block is obtained based on a corresponding first wear value and a second wear value. The first wear value is obtained based on the number of erase-write times of the storage block. The second wear value is obtained based on an initial wear representation of the storage block. The initial wear representation includes at least one of the following: a first failed bit position statistic of the storage block after a preset data retention time after writing, a second failed bit position statistic of the storage block after a preset first number of read times after writing, a first time consumed by the storage block in an erase process, a second time consumed by the storage block in a programming process during writing, and a voltage difference between the highest voltage of the storage block in an erased state after writing and a preset erased state read voltage threshold. The target storage block is selected to perform the writing of the to-be-written data.
[0006] The second technical solution adopted by the application is to provide a storage device, comprising a control module and a storage module, the storage module comprising a plurality of storage blocks, the control module and the storage module being connected to realize the data writing method as described in the first technical solution.
[0007] The application has the beneficial effect that when data is written into a storage block, the storage block currently performing data writing is selected according to the wear value corresponding to the storage block. The wear value of the storage block is related to a first wear value and a second wear value, the first wear value being related to the actual erase-write times of the storage block, and the second wear value being related to an initial wear representation. The initial wear representation represents the maximum erase-write times of the storage block to some extent. Taking both the actual erase-write times of the storage block and the maximum erase-write times of the storage block as the basis for judging whether the storage block performs data writing makes the ratio of the actual erase-write times of each storage block to the maximum erase-write times thereof more balanced in the storage device, and the selection of the storage block by the storage device is more reasonable. Whether the maximum erase-write times of the storage blocks in the device are the same or not, each storage block can be fully utilized, the performance of each storage block is fully utilized, and the service life of the storage device is improved. BRIEF DESCRIPTION OF DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative effort. Among them:
[0009] Fig. 1 is a flowchart of the first embodiment of the data writing method of the application;
[0010] Fig. 2 is a schematic diagram of TLC mode storage voltage;
[0011] Fig. 3 is a flowchart of the second embodiment of the data writing method of the application;
[0012] Fig. 4 is a flowchart of the third embodiment of the data writing method of the application;
[0013] Fig. 5 is a schematic diagram of the initial wear representation (voltage difference E0) and the second wear value (wear coefficient A) in a stepwise positive correlation;
[0014] Fig. 6 is a structural schematic diagram of an embodiment of the storage device of the application. DETAILED DESCRIPTION
[0015] With reference to the drawings, the technical solutions in the embodiments of the present application will be clearly and completely described below, obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0016] The terms "first", "second", and the like in the present application are used to distinguish different objects, rather than to describe a specific sequence. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally further include steps or units not listed, or can optionally further include other steps or units inherent to the process, method, product or device.
[0017] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearance of the phrase in various places in the specification does not necessarily all refer to the same embodiment, nor is it necessarily mutually exclusive of other embodiments. It is explicitly and implicitly understood that the embodiments described herein can be combined with other embodiments.
[0018] Referring to FIG. 1, FIG. 1 is a flowchart of a first embodiment of a data writing method of the present application. The method is applied to a storage device. The storage device includes a control module and a storage module. The storage module includes a plurality of storage blocks. The control module is used to connect the storage module for data writing to the storage module. The method includes but is not limited to the following steps.
[0019] S11: The control module determines a target storage block from the plurality of storage blocks using a wear value in response to obtaining data to be written, the wear value of each storage block being obtained based on a corresponding first wear value and a second wear value, the first wear value being obtained based on the number of erase-write times of the storage block, and the second wear value being obtained based on an initial wear representation of the storage block.
[0020] The initial wear representation includes at least one of the following: a first failed bit statistic of the storage block after a preset data retention time after writing, a second failed bit statistic of the storage block after a preset first number of read times after writing, a first time consumed by the storage block in an erase process, a second time consumed by the storage block in a programming process during writing, and a voltage difference between the highest voltage of the storage block in an erased state after writing and a preset erased state read voltage threshold.
[0021] Among the above characterizations, the voltage difference is usually the most accurate characterization because the first failed bit statistic, the second failed bit statistic, the first time, and the second time are all manifestations of the voltage difference under certain conditions.
[0022] The service life of a memory block is usually related to the storage voltage and its corresponding read voltage threshold.
[0023] Taking TLC as an example, referring to FIG. 2, which is a schematic diagram of the storage voltage of a TLC mode. In the figure, L0-L7 are the storage voltages of respective data states. L0 is the erase state voltage. Each data state has a corresponding read voltage threshold. When the voltage of a data state exceeds its corresponding read voltage threshold, it is considered that a data error has occurred. For example, Vrd1 is the read voltage threshold corresponding to the erase state. When L0 shifts to the right and exceeds Vrd1, the result of reading according to Vrd1 is no longer the data result corresponding to the erase state, and it is considered that a data error has occurred. If the storage voltage of the data state has already exceeded its corresponding read voltage threshold when the data is written into the memory, it is considered that the memory block has reached its service life and is not suitable for continued use for data storage. Therefore, the difference between the storage voltage and its corresponding read voltage threshold is considered to be the wear value of the memory block, which can represent the service life of the memory block. When the wear reaches a certain degree, the memory block can no longer be used.
[0024] There are many situations that cause voltage shift, such as the retention time of data in the memory block. The longer the retention time, the more serious the voltage shift. Or the more times the memory block is read, the more serious the read interference, and the more serious the shift of the storage voltage corresponding to the data in the memory block.
[0025] Because the situations that cause voltage shift usually have a more serious impact on the storage voltage of the low data state, the difference between the storage voltage of the erase state and its corresponding read voltage threshold is selected as the representation of the wear value of the memory block in this application.
[0026] Because data retention and read interference also cause the voltage shift of the erase state, the first failed bit statistic of the memory block after a predetermined data retention time after writing and the second failed bit statistic of the memory block after a predetermined first read number after writing can also represent the difference between the storage voltage of the erase state and its corresponding read voltage threshold to a certain extent, thereby representing the wear degree of the memory block.
[0027] If the wear is more serious, it means that the erase state voltage of the storage block is more rightward shifted, and the value is larger. The time needed for programming when the storage block performs data writing is shorter, and the time needed for erasing is longer. Therefore, the first time consumed by the storage block in the erasing process and the second time consumed by the storage block in the programming of the writing process can also represent the difference between the erase state storage voltage and the corresponding read voltage threshold to some extent, thereby representing the wear degree of the storage block.
[0028] S12: Selecting a target storage block to perform writing of the to-be-written data.
[0029] In the embodiment, when writing data into the storage block, the storage block currently performing data writing is selected according to the wear value corresponding to the storage block. The wear value of the storage block is related to a first wear value and a second wear value. The first wear value is related to the actual erase-write times of the storage block, and the second wear value is related to the initial wear representation. The initial wear representation represents the maximum erase-write times of the storage block to some extent. Taking both the actual erase-write times of the storage block and the maximum erase-write times of the storage block as the basis for judging the data writing of the storage block makes the ratio of the actual erase-write times of each storage block to the corresponding maximum erase-write times more balanced in the storage device, and the selection of the storage block by the storage device is more reasonable. Whether the maximum erase-write times of the storage blocks in the device are the same or not, each storage block can be fully utilized, the performance of each storage block is fully utilized, and the service life of the storage device is improved.
[0030] Referring to FIG. 3, FIG. 3 is a flowchart of a second embodiment of the data writing method of the application. The method is a further extension of step S11, and includes but is not limited to the following steps.
[0031] S21: Obtaining the wear values corresponding to all storage blocks.
[0032] S22: Determining that the storage block corresponding to the smallest wear value is the target storage block.
[0033] When selecting the target storage block, the wear values of all storage blocks need to be obtained, and then the storage block with the smallest wear value is selected.
[0034] The specific calculation method of the wear value can refer to the following embodiments.
[0035] Referring to FIG. 4, FIG. 4 is a flowchart of a third embodiment of the data writing method of the application. The method is a further extension of the wear value obtaining method, and includes but is not limited to the following steps.
[0036] S31: Obtaining the actual erase-write times of the storage block and the initial wear representation.
[0037] S32: determining the first wear value based on the actual erase-write times, and determining the second wear value based on the initial wear characterization and a preset correspondence between initial wear characterizations and second wear values.
[0038] S33: adding the corresponding first wear value and second wear value to obtain the wear value of the corresponding storage block, or multiplying the corresponding first wear value and second wear value to obtain the wear value of the corresponding storage block.
[0039] First, the actual erase-write times of the storage block and the initial wear characterization are obtained, and then the first wear value and the second wear value are determined. The first wear value is determined according to the value of the actual erase-write times, and the second wear value is determined according to the value of the initial wear characterization.
[0040] The first wear value is obtained from the actual erase-write times. In an embodiment, the first wear value is positively correlated with the erase-write times, for example, the actual erase-write times can be directly taken as the first wear value.
[0041] The preset correspondence between the initial wear characterization and the second wear value is used to find the value of the second wear value corresponding to the value of the initial wear characterization.
[0042] In an embodiment, in response to the initial wear characterization including the first failure bit statistics, the first failure bit statistics are positively correlated with the second wear value. The greater the first failure bit, the greater the corresponding second wear value. In response to the initial wear characterization including the second failure bit statistics, the second failure bit statistics are positively correlated with the second wear value. The greater the second failure bit, the greater the corresponding second wear value. In response to the initial wear characterization including the first time, the first time is positively correlated with the second wear value. The longer the first time, the greater the second wear value. In response to the initial wear characterization including the first time, the second time is inversely correlated with the second wear value. The longer the second time, the smaller the second wear value. In response to the initial wear characterization including the voltage difference value, the voltage difference value is inversely correlated with the second wear value. The greater the voltage difference value, the smaller the second wear value.
[0043] The positive correlation described in the above embodiments can include linear positive correlation and nonlinear positive correlation. The nonlinear positive correlation can also include stepwise positive correlation. Referring to FIG. 5, FIG. 5 is a schematic diagram of an initial wear characterization (voltage difference value E0) and a second wear value (wear coefficient A) in stepwise positive correlation.
[0044] After the first wear-out value is determined according to the relationship between the actual erase-write times and the first wear-out value, and the second wear-out value is determined according to the relationship between the initial wear-out representation and the second wear-out value, the first wear-out value and the second wear-out value corresponding to the same memory block are added or multiplied to obtain the wear-out value of the memory block. Thus, the memory block with the minimum wear-out value is determined as the memory block with the lowest wear-out degree, and then it is used as the target memory block for data writing. The initial wear-out representation can correspond to the following two meanings. One is the equivalent erase-write times. When the value of the initial wear-out representation is used as the equivalent erase-write times, if the first wear-out value is the actual erase-write times, the sum of the two is the wear-out value. The other is the wear-out degree coefficient. When the value of the initial wear-out representation is used as the wear-out degree coefficient, if the first wear-out value is the actual erase-write times, the product of the two is the wear-out value.
[0045] In some cases, the corresponding relationship between the first wear-out value and the actual erase-write times, and the corresponding relationship between the second wear-out value and the initial wear-out representation can be set according to actual conditions, and then the calculation method of the first wear-out value and the second wear-out value is selected, so that the memory block with the maximum wear-out value or the minimum wear-out value is selected as the target memory block.
[0046] For example, in the above embodiment, the positive correlation in the corresponding relationship between the initial wear-out representation and the second wear-out value is changed to negative correlation, and the negative correlation is changed to positive correlation. That is, according to the addition or multiplication method, the memory block with the maximum wear-out value can be used as the target memory block. At this time, the maximum wear-out value represents the minimum wear-out degree of the memory block. The remaining similar modifications are not described here.
[0047] In the above embodiment, the wear-out value obtained when the target memory block is selected is already calculated, or is calculated according to the first wear-out value and the second wear-out value which have been collected and determined.
[0048] In an embodiment, the initial wear-out representation can be obtained after each data writing is completed, or can be obtained after a preset number of data writings are performed. Because the influence of each writing on the wear-out degree of the memory block is not very large, in order to save the calculation resources of the storage device, the initial wear-out representation can be obtained at intervals of a preset number of writings with a certain degree of accuracy reduction. In this application, the voltage difference value and the failed bit statistics need to be obtained after data writing, while the first time and the second time can be obtained during the writing process. The voltage difference value is obtained by data reading, and the first failed bit statistics and the second failed bit statistics can also be obtained by data reading. The first time and the second time can be obtained by timing the erase process and the writing process during the data writing process of the memory block.
[0049] In an embodiment, the initial wear-out characteristics corresponding to all the storage blocks in the storage device are synchronously acquired and updated. In order to ensure the accuracy of the storage device in selecting the target storage block, the initial wear-out characteristics used to represent the wear-out degree of the storage blocks need to be acquired and updated at the same time. The initial wear-out characteristics acquired at the same time can be used for mutual comparison, and the storage block with lower wear-out degree can be more accurately selected.
[0050] In an embodiment, in response to the initial wear-out characteristic including the voltage difference value, the voltage difference value is acquired within a preset time after writing and / or within a preset second reading number. Since the data retention time and the read disturbance can both cause voltage offset, the acquisition of the voltage difference value corresponding to the erase state needs to be completed as soon as possible after the data is written, so as to avoid a large deviation between the acquired voltage difference value and the voltage difference value corresponding to the actual wear-out degree of the storage block at this time. For example, the acquisition of the voltage difference value can be performed before ten data readings of the storage block are completed after the data is written.
[0051] In an embodiment, in order to avoid the acquisition of the initial wear-out characteristic affecting the normal operation of the storage device, the initial wear-out characteristic is acquired when the storage device is in an idle state. The idle state can include that the storage device currently does not exist data writing or reading, the frequency of data writing or reading of the storage device is lower than a certain set threshold, and the like. Of course, the idle state described in the embodiment is the idle state of the storage device in the state of being powered on and having data processing capability.
[0052] In the above embodiment, in response to the number of storage modules being multiple, the correspondence relationship between the preset initial wear-out characteristic and the second wear-out value in the storage modules of the same storage type is the same. Because the correspondence relationship between the initial wear-out characteristic and the second wear-out value can be inconsistent in different types of storage blocks. Therefore, if the control module is connected to multiple storage modules of different storage types, the preset correspondence relationship in each storage module thereof needs to be independently set. The storage modules of the same type can determine the second wear-out value according to the same correspondence relationship.
[0053] The storage type can refer to that the storage block belongs to TLC, SLC or QLC, etc.
[0054] As shown in FIG. 6, FIG. 6 is a structural schematic diagram of an embodiment of the storage device of the present application.
[0055] The storage device includes a control module 110 and a storage module 120.
[0056] The control module 110 controls the operation of the storage device, and can also be referred to as a CPU (Central Processing Unit). The control module 110 can be an integrated circuit chip with signal sequence processing capability. The control module 110 can also be a general control module, a digital signal sequence control module (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The general control module can be a micro control module or it can also be any conventional control module, etc.
[0057] The storage module 120 can be a storage module composed of NAND Flash and the like. It can be a NAND Flash storage grain.
[0058] The control module 110 is connected with the storage module 120, and is used to execute instructions to implement the method provided by any one of the embodiments of the data writing method of the application and possible combinations.
[0059] In summary, when writing data into the storage block, the application selects the storage block currently performing data writing according to the wear value corresponding to the storage block. The wear value of the storage block is related to a first wear value and a second wear value. The first wear value is related to the actual erase-write times of the storage block, and the second wear value is related to an initial wear representation. The initial wear representation represents the maximum erase-write times of the storage block to some extent. Taking both the actual erase-write times of the storage block and the maximum erase-write times of the storage block as the basis for judging whether to perform data writing on the storage block makes the ratio of the actual erase-write times of each storage block to the corresponding maximum erase-write times more balanced in the storage device, and the selection of the storage block by the storage device is more reasonable. Whether the maximum erase-write times of the storage blocks in the device are the same or not, each storage block can be fully utilized, the performance of each storage block is fully utilized, and the service life of the storage device is improved.
[0060] In several embodiments provided in the application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are only schematic, and the division of the modules or units is only a logical function division. Actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0061] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e. may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment scheme.
[0062] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0063] The integrated unit in the above other embodiments, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical scheme of the present application, essentially or the part that contributes to the prior art, or all or part of the technical scheme can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.
[0064] The above is only an embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A data write method, characterized by, The application is applied to a storage device, the storage device comprises a control module and a storage module, the storage module comprises a plurality of storage blocks, the control module is connected to the storage module for data writing of the storage module, and the method comprises: The control module determines a target storage block from the plurality of storage blocks by using a wear value in response to obtaining to-be-written data, the wear value of each storage block is obtained based on a corresponding first wear value and a second wear value, the first wear value is obtained based on the erase-write times of the storage block, and the second wear value is obtained based on an initial wear representation of the storage block, the initial wear representation comprises at least one of the following: a first failed bit position statistic of the storage block after a preset data retention time after writing, a second failed bit position statistic of the storage block after a preset first reading times after writing, a first time consumed by the storage block in an erasing process, a second time consumed by the storage block in a programming process, and a voltage difference between an erase state maximum voltage of the storage block after writing and a preset erase state reading voltage threshold. The target storage block is selected to perform writing of the to-be-written data.
2. The data write method of claim 1, wherein, The target storage block is determined from the plurality of storage blocks by using a wear value, comprising: Obtaining the wear value corresponding to all the storage blocks; Determining the storage block corresponding to the minimum wear value as the target storage block.
3. The data write method of claim 2, wherein, The wear value obtaining method comprises: Obtaining the actual erase-write times of the storage block and the initial wear representation; Determining the first wear value based on the actual erase-write times, and determining the second wear value based on the initial wear representation and a preset corresponding relationship between the initial wear representation and the second wear value; Adding the corresponding first wear value and the second wear value to obtain the wear value corresponding to the storage block, or multiplying the corresponding first wear value and the second wear value to obtain the wear value corresponding to the storage block.
4. The data writing method according to claim 2, wherein: The first wear value is positively correlated with the erase-write times; in response to the initial wear representation comprising the first failed bit position statistic, the first failed bit position statistic is positively correlated with the second wear value; in response to the initial wear representation comprising the second failed bit position statistic, the second failed bit position statistic is positively correlated with the second wear value; in response to the initial wear representation comprising the first time, the first time is positively correlated with the second wear value; in response to the initial wear representation comprising the first time, the second time is negatively correlated with the second wear value; and in response to the initial wear representation comprising the voltage difference, the voltage difference is negatively correlated with the second wear value.
5. The data writing method according to claim 1, wherein: The initial wear representation is obtained after each writing or after each preset number of writings.
6. The data writing method according to claim 1, wherein: The collection time of the initial wear representation corresponding to all the storage blocks in the storage device is the same.
7. The data writing method of claim 1, wherein, in response to the initial wear characteristic comprising the voltage difference, the voltage difference is obtained within a preset time after writing and / or a preset second reading number of times.
8. The data writing method of claim 1, wherein, the initial wear characteristic is obtained when the storage device is in an idle state. In response to the number of storage modules being multiple, the corresponding relationship between the initial wear characteristic and the second wear value of the storage modules of the same storage type is the same. A control module and a storage module, the storage module comprising a plurality of storage blocks, the control module being connected with the storage module to implement the method of any one of claims 1-9.
9. The data write method of claim 1, wherein, 10. A memory device, comprising:
Citation Information
Patent Citations
Method for preventing reading error of flash memory data
CN110534152A
Method and device for evaluating wear degree of flash memory block
CN111078123A
Storage device block management method, memory storage device and memory controller
CN114281255A