A method and apparatus for adjusting the life of a memory block
By actively reading the error count and historical data of storage blocks, the lifespan of storage blocks is dynamically adjusted, solving the problems of waste and data loss caused by individual durability differences of storage blocks, and realizing efficient utilization and improved reliability of memory.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 合肥康芯威存储技术有限公司
- Filing Date
- 2026-05-06
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, storage block lifetime management suffers from waste and data loss risks due to individual durability differences, and cannot achieve precise lifetime adjustment.
By actively reading the number of errors in all pages of the storage block, calculating the current health data, and combining historical health data with the number of programming/erasing operations, the maximum number of programming/erasing operations for the storage block is dynamically adjusted to achieve personalized lifetime management.
It improves the utilization rate of storage blocks, reduces the risk of data loss, and enables precise lifespan planning and data protection for storage.
Smart Images

Figure CN122131987A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage, and more particularly to a method and apparatus for adjusting the lifetime of a storage block. Background Technology
[0002] In existing technologies, there are two main approaches to managing the lifetime of storage blocks in non-volatile memories such as flash memory: One method is the static threshold method, which pre-determines a fixed nominal number of program / erase cycles for all memory blocks. Once a memory block reaches this nominal number of program / erase cycles, it is forcibly marked as a bad block and discarded, regardless of its current physical condition. While this method is simple to implement, it fails to consider the individual durability differences of memory blocks caused by manufacturing process variations. This results in the premature elimination of memory blocks with inherently superior quality that can withstand more program / erase cycles, wasting the potential lifespan of the storage medium and limiting the optimization of the overall lifespan of the memory.
[0003] The second approach is a passive response method based on error-correcting code (ECC) failures. This method only detects errors through a real-time error correction mechanism when the host initiates a data read operation. Remedial measures such as data migration are only passively implemented after a serious error that ECC cannot correct, leading to read failure. This "post-event processing" model lacks proactive monitoring and early warning of storage block performance degradation. It cannot identify storage blocks with declining health before the number of errors accumulates to an uncorrectable level, thus posing a high risk of data loss and making it difficult to reliably predict and plan the entire memory lifespan.
[0004] In summary, existing technical solutions either rely on a nominal number of programming / erase cycles, resulting in insufficient utilization of the storage life, or depend on passive handling after errors occur. Especially in application scenarios that require high reliability and long lifespan guarantees, how to achieve individualized and precise lifespan adjustment of storage blocks has become an urgent technical problem to be solved. Summary of the Invention
[0005] This invention provides a method and apparatus for adjusting the lifetime of a storage block, which can realize individualized and precise lifetime adjustment of the storage block.
[0006] This invention provides a method for adjusting the lifetime of a memory block, comprising: From all storage blocks, select the storage block where all pages store valid data as the target block; Perform read operations on all target blocks in a preset order to obtain the number of bit errors for each page in each target block; Based on the number of bit errors in each page of each target block, the current status data of the target block is determined, and based on the current status data and the most recent historical health data of the target block arranged in chronological order, the current health data reflecting the current health status of the target block is calculated. Based on the cumulative number of programming / erasing operations for each target block, it is determined whether to perform a lifetime adjustment operation on its maximum number of programming / erasing operations. When it is determined that the lifetime adjustment operation needs to be performed, the lifetime adjustment operation is performed based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order.
[0007] In one embodiment of the present invention, determining the current status data of the target block based on the number of bit errors in each page of each target block, and calculating current health data reflecting the current health status of the target block based on the current status data and at least one most recent historical health data of the target block arranged in chronological order, includes: For each of the target blocks: Sort all pages according to the number of errors on each page, and then select the pages used for health assessment. Based on the number of errors in each selected page, calculate the current status data of the target block; Based on the current status data and the most recent historical health data of the target block arranged in chronological order, the current health data reflecting the current health status of the target block is calculated.
[0008] In one embodiment of the present invention, the step of sorting all pages according to the number of errors on each page and selecting pages for health assessment includes: Sort all pages according to the number of errors on each page to obtain a sorted sequence; Several pages are removed from both ends of the sorting sequence, and the remaining pages are used for health assessment.
[0009] In one embodiment of the present invention, the calculation formula for the current state data is as follows:
[0010] in, This is the current state data. The number of pages selected. For the selected first Page 1 For the selected first Page weight, For the selected first Number of errors per page.
[0011] In one embodiment of the present invention, the weight of each page is determined according to the sorting position of the page after sorting based on the number of errors, and according to a preset weight distribution rule.
[0012] In one embodiment of the present invention, the current health data is obtained by weighted summation of at least one most recent historical health data arranged in chronological order and the current status data.
[0013] In one embodiment of the present invention, determining whether to perform a lifetime adjustment operation on the maximum number of programming / erasing operations for each target block based on the cumulative number of programming / erasing operations, and when it is determined that the lifetime adjustment operation needs to be performed, performing the lifetime adjustment operation based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order, includes: For each of the target blocks: Obtain the maximum number of program / erase cycles for the target block; the initial value of the maximum number of program / erase cycles is the nominal number of program / erase cycles; Determine whether the cumulative number of program / erase cycles for the target block is less than the nominal number of program / erase cycles: If the cumulative number of programming / erasing operations is less than the nominal number of programming / erasing operations, then the maximum number of programming / erasing operations for the target block is maintained. Otherwise, based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order, a lifetime adjustment operation is performed to update the maximum number of programming / erasing operations.
[0014] In one embodiment of the present invention, the step of performing a lifetime adjustment operation based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order, and updating the maximum programming / erasing count, includes: Obtain the most recent consecutive historical health data in chronological order, sort the consecutive historical health data of the target block and the current health data in chronological order, and calculate the difference between two adjacent health data to obtain the corresponding health difference. Determine if all health differences are greater than a preset threshold: If all health differences are greater than the preset threshold, the target block is marked as end-of-life; the end-of-life state includes prohibiting data writing, allowing reading of stored data and triggering data migration; Otherwise, update the maximum number of program / erase cycles for the target block based on its current health data.
[0015] In one embodiment of the present invention, updating the maximum number of programmable / erase cycles of the target block based on the current health data of the target block includes: The current health data is compared with preset first health thresholds and second health thresholds; If the current health data is less than or equal to the first health threshold, the maximum number of programming / erasing attempts for the target block is increased by a preset fixed increment; If the current health data is greater than the first health threshold and less than the second health threshold, then the maximum number of programming / erasing operations for the target block is maintained. If the current health data is greater than or equal to the second health threshold, then the target block is marked as end-of-life.
[0016] The present invention also provides a storage block lifetime adjustment device, comprising: The block filtering module is used to filter out storage blocks from all storage blocks, selecting those where all pages contain valid data as target blocks. The bit error statistics module is used to perform read operations on all target blocks in a preset order to obtain the bit error count of each page in each target block; The status calculation module is used to determine the current status data of the target block based on the number of bit errors of each page in each target block, and to calculate the current health data reflecting the current health status of the target block based on the current status data and the most recent historical health data of the target block arranged in chronological order. The lifetime adjustment module is used to determine whether to perform a lifetime adjustment operation on the maximum number of programming / erasing operations for each target block based on the cumulative number of programming / erasing operations, and when it is determined that the lifetime adjustment operation needs to be performed, the lifetime adjustment operation is performed based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order.
[0017] The beneficial effects of this invention are as follows: By periodically and proactively reading the error count of all pages in a target block (i.e., a block full of valid data) and calculating the current health data reflecting its true health status, individualized and proactive assessment of the physical state of storage blocks is achieved. This directly overcomes the drawbacks of the static threshold method's "one-size-fits-all" approach, providing a data foundation for precise lifetime management based on the actual state of each block. This allows for the full utilization of the potential of storage blocks with above-average durability, preventing their premature abandonment. When determining whether lifetime adjustment is necessary, not only current health data is considered, but also multiple recent consecutive historical health data are combined, and a comprehensive decision is made by analyzing health change trends. This early warning mechanism based on time-series data analysis can identify blocks whose health is rapidly deteriorating in advance. This is significantly superior to schemes that only passively respond to eventual read failures, effectively reducing the risk of data loss and achieving proactive lifetime planning and data protection. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0019] In the attached diagram: Figure 1 A flowchart illustrating a method for adjusting the lifetime of a storage block according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a memory block lifetime adjustment device provided in one embodiment of the present invention. Detailed Implementation
[0020] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0021] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. The drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0022] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.
[0023] This invention discloses a method for adjusting the lifetime of storage blocks, primarily applied to non-volatile memories such as flash memory and UFS. This lifetime adjustment method addresses the problems of overly conservative static threshold management and the lack of early warning in passive error responses. Its applications include, but are not limited to, smartphones, tablets, data center storage systems, and various embedded devices. In these embedded devices, memory lifetime and data reliability are core indicators. This invention actively monitors the health status of each storage block within the memory, enabling individualized and precise lifetime prediction and management of the storage blocks. This allows for a more comprehensive exploration of the storage blocks' potential lifetime while ensuring data security, thereby improving the overall reliability and lifespan of the memory.
[0024] Please see Figure 1 The lifetime adjustment method includes the following steps: S10, from all storage blocks, select the storage block in which all pages store valid data as the target block.
[0025] First, when the memory is idle, a periodic inspection task is initiated to identify and read a target set of blocks. The purpose of this process is to proactively assess the health of the memory blocks while avoiding interference with the host's normal data access operations.
[0026] Therefore, it is necessary to traverse all currently used storage blocks. Each storage block consists of multiple pages, which may be in different states: storing valid data, marked as invalid data, or completely free. To ensure that the number of bit errors obtained through read operations accurately reflects the true physical condition of the storage block under its programmed / erase cycles, a block with stable data state and consistent readability must be selected as the evaluation object. Therefore, every page within the selected target storage block must store valid data.
[0027] If a storage block contains any free pages or pages storing invalid data, that storage block will not be included in the target block set for the current inspection task. This is because performing a full block read on a storage block containing pages with incompletely written data will not yield a valid error count for those pages, which would not represent the physical characteristics of the storage block under the same level of wear and tear. This would introduce bias and uncertainty into subsequent health assessments. Conversely, a storage block where all pages store valid data indicates that all its physical units have undergone a complete programming operation, and the error count read from these pages can reflect the actual health level of the storage block within the current inspection task.
[0028] Please see Figure 1 The lifetime adjustment method also includes the following steps: S20, performing read operations on all target blocks in a preset order to obtain the number of bit errors in each page of each target block.
[0029] After identifying the storage blocks where all pages contain valid data as the target block set, the next step is to perform read operations on these target blocks sequentially in a preset order to obtain the number of bit errors for each page that makes up each target block.
[0030] Specifically, the preset order can be determined based on the physical address numbers of the target blocks in memory. For example, each target block in the target block set can be read sequentially according to its physical address number, either from low to high or from high to low. For each selected target block, a complete read operation needs to be performed on all pages within it. This read operation is initiated by the memory controller, and its purpose is to read the stored data from each page. At the same time, the error correction code unit integrated in the memory works synchronously to perform real-time verification on the read data. After completing the error correction process, the error correction code unit outputs the number of bit errors that occurred in that page during the read. This process is repeated, traversing every page within the target block, until the total number of bit errors for all pages of the target block can be obtained.
[0031] Given the potentially enormous number of target blocks, reading all of them would be a time-consuming process. During this time, the memory controller needs to be ready to respond to data access requests from the host, such as writing new data. To ensure uninterrupted normal host operation, the background inspection task is designed to be interruptible. When the host initiates a command requiring an immediate response, such as a write operation, the current inspection task is immediately paused. During the pause, the controller records the number of the target block currently being read. Subsequently, the memory will fully serve the host's data access requests.
[0032] Once the host's data access request is completed and the memory returns to an idle state, the inspection task resumes from where it was interrupted. The controller locates the target block that was not fully read last time based on the previously recorded number, and continues reading subsequent target blocks in a preset order, starting from that block. This process may involve multiple interruption and resumption cycles. The inspection task is considered complete only when all pages of the last target block in the target block set have been read in the preset order and the error count has been recorded. This design ensures the integrity and continuity of data acquisition while also guaranteeing the memory's real-time response capability to external host requests.
[0033] Please see Figure 1 The lifetime adjustment method further includes the following steps: S30, determining the current status data of the target block based on the number of bit errors in each page of each target block, and calculating the current health data reflecting the current health status of the target block based on the current status data and at least one most recent historical health data of the target block arranged in chronological order. S30 includes: For each target block: Sort all pages according to the number of errors on each page, and then select the pages used for health assessment. Based on the number of errors in each selected page, calculate the current status data of the target block; Based on the current status data and the most recent historical health data of the target block arranged in chronological order, the current health data reflecting the current health status of the target block is calculated.
[0034] The step of sorting all pages according to the number of errors on each page and selecting the pages for health assessment may include the following steps: Sort all pages according to the number of errors on each page to obtain a sorted sequence; Remove a certain number of pages from both ends of the sorted sequence, and use the remaining pages for health assessment.
[0035] After obtaining the number of errors for all pages within a target block, this data needs to be processed to filter out the data samples that best represent the health status of the target block, thereby eliminating extreme data interference.
[0036] First, based on the number of bit errors read and recorded from each page of the target block, all pages are sorted according to their error counts. For example, the sorting method is from smallest to largest, with the page with the fewest errors at the beginning of the sequence and the page with the most errors at the end, resulting in a sorted sequence. This sorting allows for a visual observation of the error distribution across all pages within the target block.
[0037] Secondly, to eliminate the bias caused by accidental factors or local physical defects on the overall evaluation results, the error count of all pages in the sorted sequence cannot be used directly for calculation. Instead, extreme data at both ends of the sorted sequence needs to be removed. Specifically, a certain proportion of pages are removed from both ends of the sorted sequence. For example, from the minimum end of the sorted sequence, the pages with the lowest error count are removed, such as a certain proportion of the total number of pages; simultaneously, from the maximum end of the sorted sequence, the pages with the highest error count are removed, such as a certain proportion of the total number of pages. After removing these two extreme data, most of the pages remaining in the middle of the sorted sequence are retained as valid data samples for subsequent calculation of the target block's health status.
[0038] The advantage of this approach is that the portion with the highest number of bit errors removed may correspond to individual physical pages within the target block that have minor defects or have been subjected to sudden read interference. Their abnormally high bit error rates are not representative of the overall performance, and including them in the calculation would exaggerate the wear level of the target block. Conversely, the portion with the lowest number of bit errors removed may correspond to pages with special write states or that have not yet experienced sufficient programming pressure. Their excessively low bit error rates do not accurately reflect the state of the target block under the current programming / erase cycle, and including them in the calculation would underestimate their wear level. By symmetrically removing a certain proportion of extreme values at both ends, the remaining bit error rate can more stably reflect the general performance of the vast majority of storage units in the target block, thus making the health status indicators calculated based on this data more accurate and reliable.
[0039] When performing the step of calculating the current status data of the target block based on the number of bit errors in each page selected, the formula for calculating the current status data is as follows:
[0040] in, This is the current state data. The number of pages selected. For the selected first Page 1 For the selected first Page weight, For the selected first The number of errors per page. The weight of each page is determined according to its sorting position based on the number of errors, following a preset weight distribution rule.
[0041] After obtaining all pages and their error counts remaining for health assessment after extreme value removal, it is necessary to calculate a current state data that can quantitatively characterize the current condition of the target block based on this data. In the calculation, a non-uniform weighted averaging strategy can be used to make the final result more sensitive to the trend of performance degradation within the storage block.
[0042] First, all the filtered pages are sorted in ascending order of error count. Based on this sorting sequence, the error level range of each page can be determined according to a preset weight distribution rule. For example, the pages in the top 25% (i.e., those with the fewest errors) are assigned to the first range; the pages in the middle 50% (i.e., those from the 25th to the 75th percentile) are assigned to the second range; and the pages in the bottom 25% (i.e., those with the highest error count) are assigned to the third range.
[0043] Secondly, based on the aforementioned interval division, a corresponding weight is assigned to each page. The weight allocation rule is that pages with higher error rates are given greater weight, because the error rates of these pages are more indicative of the end-of-life of the entire target block. According to the weight distribution rule, pages assigned to the first interval (the lowest 25% of error rates) have a base weight, such as 1. Pages assigned to the second interval (the middle 50% of error rates) have a higher weight, such as 2. Pages assigned to the third interval (the highest 25% of error rates) have the highest weight, such as 4. In this way, each page receives a specific weight based on its relative position in the overall error rate. It should be noted that the percentage boundaries and corresponding weight values for interval division are not fixed. For example, the weight can be set as follows: the first 30% has a weight of 1, the middle 40% (30% to 70%) has a weight of 2, and the last 30% has a weight of 4; or the interval can be divided into four segments, such as the first 25% having a weight of 1, the next 25% (25% to 50%) having a weight of 2, the next 25% (50% to 75%) having a weight of 3, and the last 25% having a weight of 4. The specific interval division rules and weight allocation rules can be set and adjusted according to the different sensitivity and stability requirements in actual applications.
[0044] Finally, based on the number of errors per page and its assigned weight, the current state data is calculated. The calculation formula is as follows: multiply the number of errors per page by its weight to obtain the weighted error contribution value for that page; then sum the weighted error contribution values of all pages to obtain the total weighted error count; simultaneously, sum the weight values of all pages to obtain the total weight. The current state data is the quotient obtained by dividing the total weighted error count by the total weight. This weighted average calculation method, by assigning higher weights to pages with high error counts, allows the calculated current state data to be more significantly affected by the poorly performing parts within the target block, thus enabling an earlier and more sensitive response to the overall degradation trend. Furthermore, since the calculation is based on filtered data representing the majority of pages, and the weight allocation is based on relative position rather than absolute value, the result avoids being overly dominated by individual extreme values and effectively smooths out the influence of pages with extremely low error counts and weak representativeness, ultimately yielding a robust current state data that accurately reflects changes in the health of the target block.
[0045] When performing the step of calculating current health data reflecting the current health status of the target block based on the current status data and the most recent historical health data arranged in chronological order, the current health data is obtained by weighted summation of the most recent historical health data arranged in chronological order and the current status data.
[0046] For example, when only the most recent historical health data is used to perform a weighted sum with the current status data, the formula for calculating the current health data is as follows:
[0047] in, For current health data, This is the current state data. This is the most recent historical health data arranged in chronological order. , For smoothing coefficients, .
[0048] For example, when using a weighted sum of the two most recent historical health data points and the current status data, the formula for calculating the current health data is as follows:
[0049] in, For current health data, This is the current state data. and These are the two most recent historical health data points arranged in chronological order. , , For smoothing coefficients, .
[0050] After obtaining the current status data reflecting the target block, it cannot be directly equated with the final health assessment standard for the target block. This is because a single data acquisition may be affected by temporary factors, such as instantaneous noise, brief voltage fluctuations, or accidental read interference, leading to occasional fluctuations or deviations in the reading results. To eliminate the influence of these random noises and obtain a smoother, more stable indicator that better reflects the true long-term health trend of the target block, it is necessary to comprehensively process the current status data of this inspection task with the historical health data of the target block from previous inspection tasks.
[0051] First, the current status data is obtained by weighted averaging the number of errors on pages selected in this inspection task, representing the instantaneous health characteristics of the target block observed during this inspection task. Historical health data reflects the past health status of the target block in previous inspection tasks, and it includes at least the most recently calculated historical health data. For time-series smoothing, the most recent or several recent historical health data points need to be obtained in chronological order.
[0052] Next, a calculation process is performed to obtain the current health data. Specifically, the current health data is calculated using a weighted summation formula. This formula consists of two parts: one part is the current state data multiplied by a smoothing coefficient between 0 and 1; the other part is the most recent historical health data multiplied by "one minus the smoothing coefficient". For example, if the smoothing coefficient is set to 0.5, the calculation method is: current health data equals current state data multiplied by 0.5, plus historical health data multiplied by 0.5. If there are multiple historical health data points, different smoothing coefficients can be assigned to each for weighted summation.
[0053] Finally, by combining current status data with historical health data, the calculated current health data possesses the following characteristics: it includes the latest status change information captured by this inspection task, thus enabling a response to performance degradation of the target block; simultaneously, it inherits the smoothness of historical health data, effectively filtering out accidental noise and abnormal fluctuations that may exist in a single measurement. The value of the smoothing coefficient determines the relative importance of current status data and historical health data in the fusion process.
[0054] The closer the smoothing coefficient associated with current health data is to 1, the closer the current health data is to the current state data, the more sensitive it is to the latest changes, but also more susceptible to noise. The closer the smoothing coefficient associated with current health data is to 0, the more the current health data tends to maintain the level of historical health data, the smoother and more stable it is, but the slower it responds to the latest changes.
[0055] By appropriately setting the smoothing coefficient, a current health data that strikes a good balance between response speed and noise resistance stability can be obtained. This current health data is more reliable than a single current state data. After calculation, this newly generated current health data will be stored as new historical health data for the target block, providing input for the next inspection task calculation.
[0056] Please see Figure 1 The lifetime adjustment method further includes the following steps: S40, determining whether to perform a lifetime adjustment operation on the maximum programming / erasing count of each target block based on the cumulative programming / erasing count, and when it is determined that a lifetime adjustment operation needs to be performed, performing the lifetime adjustment operation based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order. S40 includes the following steps: For each target block: S41. Obtain the maximum number of program / erase cycles for the target block; the initial value of the maximum number of program / erase cycles is the nominal number of program / erase cycles; S42. Determine whether the cumulative number of programming / erasing operations for the target block is less than the nominal number of programming / erasing operations: S43. If the cumulative number of programming / erasing operations is less than the nominal number of programming / erasing operations, then the maximum number of programming / erasing operations for the target block shall be maintained. S44. Otherwise, perform a lifetime adjustment operation based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order, and update the maximum number of programming / erasing operations.
[0057] Specifically, during step S41, the maximum program / erase count defines the maximum cumulative number of operations the target block can withstand. In the initial use phase of the flash memory chip, each memory block has a nominal program / erase count set based on conservative process and reliability models, such as 3000 or 5000 times. During the initial use phase, the initial value of the maximum program / erase count for each target block is set to this nominal program / erase count. This initial value serves as the baseline starting point for all subsequent dynamic adjustment operations and is also the basis for the initial determination of whether an adjustment operation is needed.
[0058] In step S42, specifically, a pre-judgment logic needs to be executed first to determine whether the maximum number of write / erase operations for the target block needs to be evaluated and possibly adjusted. The judgment is based on the actual usage of the target block, specifically quantified by its cumulative number of write / erase operations. The cumulative number of write / erase operations is a real-time recorded runtime parameter reflecting the total number of write and erase operations experienced since the target block was put into use. The judgment condition is to compare the cumulative number of write / erase operations of the target block with its initial maximum number of write / erase operations.
[0059] In step S43, specifically, if the cumulative number of program / erase operations for the target block is still less than its nominal number of program / erase operations, it indicates that the actual usage of the target block has not yet reached the preset maximum number of cumulative operations. From the perspective of reliability and conservative management, there is no need to readjust the lifetime potential of the target block at this time. Therefore, the existing maximum number of program / erase operations for the target block is maintained unchanged, and its value remains equal to the initial nominal number of program / erase operations. The target block will continue to participate in data storage operations normally, and its lifetime management strategy remains static until its cumulative number of program / erase operations grows to the nominal number of program / erase operations.
[0060] When performing step S44, specifically, S44 includes the following steps: Obtain the most recent consecutive historical health data in chronological order, sort the consecutive historical health data of the target block and the current health data in chronological order, and calculate the difference between two adjacent health data to obtain the corresponding health difference. Determine if all health differences are greater than a preset threshold: If all health differences exceed the preset threshold, the target block is marked as end-of-life. End-of-life states include prohibiting data writing, allowing reading of stored data, and triggering data migration. Otherwise, update the maximum number of program / erase cycles for the target block based on its current health data.
[0061] Once it is determined that the cumulative number of program / erase cycles for a target block has reached or exceeded its initial nominal number of program / erase cycles, a lifetime adjustment operation needs to be initiated. The core objective of the lifetime adjustment operation is to dynamically reassess the remaining lifetime potential based on the actual health performance of the target block and update its maximum allowed number of program / erase cycles accordingly, or, in some extreme cases, directly determine that its lifetime has ended.
[0062] First, it is necessary to obtain the most recent consecutive historical health data and current health data arranged in chronological order. These historical health data are obtained through smoothing calculations from several past inspection tasks and record the historical evolution of the target block's health.
[0063] Subsequently, the acquired health data is sorted according to its generation time to form a time series, with the latest current health data at the end of the time series. Then, calculations are performed on this time series, specifically calculating the difference between two adjacent health data points. For example, if the time series contains five data points, four adjacent differences will be calculated. These calculated differences are the health differences, which quantify the magnitude of change in the target block's health status between two consecutive inspection tasks. A positive health difference typically indicates a decrease in health, while a negative value indicates improvement.
[0064] Next, all calculated health differences are checked to determine if they all meet a preset condition. This preset condition is a pre-defined degradation threshold, and the judgment logic is: check if each health difference is greater than this preset threshold. The "greater than" logic is used here, requiring that all adjacent health data in the sequence show a continuous and significant downward trend, and that the amount of health data decay exceeds a preset warning line. This judgment condition is very stringent, and its purpose is to identify target blocks whose health status is rapidly and irreversibly deteriorating.
[0065] If all health discrepancies exceed the preset threshold, it indicates that the health of the target block has been continuously deteriorating at a rate exceeding the warning line over multiple consecutive inspection tasks. This continuous and significant degradation trend strongly suggests that the intrinsic physical performance of the target block may have suffered irreversible and severe decline, and its reliability has dropped to an extremely low level. Continuing to use it to store new data will face an extremely high risk of data loss. Therefore, instead of attempting to extend its lifespan, it will be directly marked as end-of-life. Once marked as end-of-life, the management strategy for the target block will change: any new data writes or programming operations will be prohibited to prevent the storage of valid data in unreliable storage units; however, read operations are still allowed for the valid data already stored within it, so that users or upper-level systems can reclaim the data; simultaneously, a data migration process will be triggered to safely migrate the still readable valid data in the target block to other healthy storage blocks. After the valid data is preserved, the target block can be finally retired or marked as a bad block.
[0066] When performing the step of updating the maximum number of programmable / erase cycles for the target block based on its current health data, this step includes the following steps: Compare the current health data with the preset first health threshold and second health threshold; If the current health data is less than or equal to the first health threshold, the maximum number of programming / erasing attempts for the target block will be increased by a preset fixed increment. If the current health data is greater than the first health threshold and less than the second health threshold, then maintain the maximum number of programming / erasing times for the target block; If the current health data is greater than or equal to the second health threshold, then the target block is marked as end-of-life.
[0067] After determining the health difference, if the target block is not determined to be in an end-of-life state immediately, the process proceeds to adjust the maximum number of programming / erasing operations based on the current health data.
[0068] First, a first health threshold and a second health threshold need to be introduced. These two thresholds are fixed values pre-set based on the reliability model of the flash memory chip, the characteristics of bit error rate growth, and the data retention requirements in practical applications. For example, the first health threshold can be 70, and the second health threshold can be 120. The current health data is a quantitative value that best represents the overall health status of the target block after a series of processes, including extreme value removal, weighted moving average, and historical time-series smoothing. By comparing this current health data with the first and second health thresholds, the specific range in which the current health data falls is determined, thus providing a clear basis for subsequent decisions.
[0069] When the current health data is less than or equal to the first health threshold, it means that the target block, after exceeding the nominal number of program / erase cycles, still maintains an excellent health status, indicating slow oxide layer degradation and high data reliability. This proves that the target block has high actual durability and the potential for continued safe use. Therefore, an active lifetime extension strategy is needed for this target block. Specifically, the maximum number of program / erase cycles for the target block is increased by a preset fixed increment based on its current value. This fixed increment is a predetermined value, such as 100 cycles. This means that the target block is allowed to undergo more program / erase operations beyond its original lifetime limit. This operation proactively explores and fully utilizes the remaining lifetime of high-quality storage blocks, improving the overall lifespan and utilization rate of the storage medium.
[0070] When the current health data is greater than the first health threshold but less than the second health threshold, it indicates that the target block's health status has declined to some extent, falling into an intermediate or "normal use" range. Its health status is at an excellent level and has not yet reached the critical degradation threshold requiring immediate retirement. This reflects that the target block is undergoing an expected and controllable wear process. In this case, the maximum number of program / erase cycles for the target block needs to be maintained unchanged. The target block will continue to operate within the currently set maximum program / erase cycle limit, its lifespan upper limit will remain stable, and it will be reassessed based on new current health data when the next inspection task arrives.
[0071] When the current health data is greater than or equal to the second health threshold, it indicates that the target block's health has deteriorated to a very serious level. The oxide layer of the target block may have shown significant degradation or local defects, and the data reliability is at a critical or unacceptable level. Continuing to write data will face an extremely high risk of errors. Even if its historical health difference trend does not show a continuous acceleration of degradation, the current health state has reached the safety threshold. Therefore, no further lifetime adjustment will be attempted for this target block. Instead, the most conservative safety strategy will be implemented: the target block will be marked as having reached the end of its lifetime.
[0072] As can be seen, the above scheme achieves individualized and proactive assessment of the physical state of storage blocks by periodically and proactively reading the error count of all pages in the target block (i.e., the block full of valid data) and calculating the current health data reflecting its true health status. This directly overcomes the drawbacks of the static threshold method's "one-size-fits-all" approach, providing a data foundation for precise lifetime management based on the actual state of each block. This allows for the full utilization of the potential of storage blocks with above-average durability, preventing their premature abandonment. When determining when lifetime adjustment is necessary, not only current health data is considered, but also multiple recent historical health data points are combined, and a comprehensive decision is made by analyzing health change trends. This early warning mechanism based on time-series data analysis can identify blocks whose health is rapidly deteriorating. This is significantly superior to schemes that only passively respond to eventual read failures, effectively reducing the risk of data loss and achieving proactive lifetime planning and data protection.
[0073] Please see Figure 2 The present invention also provides a storage block lifetime adjustment device, which can apply the above-mentioned lifetime adjustment method. The lifetime adjustment device may include a block screening module 100, an error statistics module 200, a status calculation module 300, and a lifetime adjustment module 400.
[0074] The block filtering module 100 is used to filter out storage blocks from all storage blocks, selecting those where all pages store valid data as target blocks. The bit error statistics module 200 is used to perform read operations on all target blocks in a preset order to obtain the bit error count of each page in each target block. The status calculation module 300 is used to determine the current status data of each target block based on the bit error count of each page in each target block, and to calculate the current health data reflecting the current health status of the target block based on the current status data and at least one recent historical health data of the target block arranged in chronological order. The lifetime adjustment module 400 is used to determine whether to perform a lifetime adjustment operation on the maximum number of programming / erasing operations for each target block based on the cumulative number of programming / erasing operations, and when it is determined that a lifetime adjustment operation needs to be performed, it performs the lifetime adjustment operation based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order. Specific limitations on the lifetime adjustment device can be found in the limitations on the lifetime adjustment method above, and will not be repeated here.
[0075] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.
Claims
1. A method for adjusting the lifetime of a storage block, characterized in that, include: From all storage blocks, select the storage block where all pages store valid data as the target block; Perform read operations on all target blocks in a preset order to obtain the number of bit errors for each page in each target block; Based on the number of bit errors in each page of each target block, the current status data of the target block is determined, and based on the current status data and the most recent historical health data of the target block arranged in chronological order, the current health data reflecting the current health status of the target block is calculated. Based on the cumulative number of programming / erasing operations for each target block, it is determined whether to perform a lifetime adjustment operation on its maximum number of programming / erasing operations. When it is determined that the lifetime adjustment operation needs to be performed, the lifetime adjustment operation is performed based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order.
2. The method for adjusting the lifetime of a storage block according to claim 1, characterized in that, The step of determining the current status data of a target block based on the number of bit errors in each page of each target block, and calculating current health data reflecting the current health status of the target block based on the current status data and at least one most recent historical health data of the target block arranged in chronological order, includes: For each of the target blocks: Sort all pages according to the number of errors on each page, and then select the pages used for health assessment. Based on the number of errors in each selected page, calculate the current status data of the target block; Based on the current status data and the most recent historical health data of the target block arranged in chronological order, the current health data reflecting the current health status of the target block is calculated.
3. The method for adjusting the lifetime of a storage block according to claim 2, characterized in that, The process of sorting all pages according to the number of errors on each page and selecting pages for health assessment includes: Sort all pages according to the number of errors on each page to obtain a sorted sequence; Several pages are removed from both ends of the sorting sequence, and the remaining pages are used for health assessment.
4. The method for adjusting the lifetime of a storage block according to claim 2, characterized in that, The formula for calculating the current state data is as follows: in, This is the current state data. The number of pages selected. For the selected first Page 1 For the selected first Page weight, For the selected first Number of errors per page.
5. The method for adjusting the lifetime of a storage block according to claim 4, characterized in that, The weight of each page is determined according to its sorting position based on the number of errors, following a preset weight distribution rule.
6. The method for adjusting the lifetime of a storage block according to claim 2, characterized in that, The current health data is obtained by weighted summation of the most recent historical health data arranged in chronological order and the current status data.
7. The method for adjusting the lifetime of a storage block according to claim 1, characterized in that, The step of determining whether to perform a lifetime adjustment operation on the maximum number of programming / erasing operations for each target block based on its cumulative programming / erasing count, and performing the lifetime adjustment operation based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order when it is determined that the lifetime adjustment operation needs to be performed, includes: For each of the target blocks: Obtain the maximum number of program / erase cycles for the target block; the initial value of the maximum number of program / erase cycles is the nominal number of program / erase cycles; Determine whether the cumulative number of program / erase cycles for the target block is less than the nominal number of program / erase cycles: If the cumulative number of programming / erasing operations is less than the nominal number of programming / erasing operations, then the maximum number of programming / erasing operations for the target block is maintained. Otherwise, based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order, a lifetime adjustment operation is performed to update the maximum number of programming / erasing operations.
8. The method for adjusting the lifetime of a storage block according to claim 7, characterized in that, The step of performing a lifetime adjustment operation based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order, and updating the maximum number of programming / erasing operations, includes: Obtain the most recent consecutive historical health data in chronological order, sort the consecutive historical health data of the target block and the current health data in chronological order, and calculate the difference between two adjacent health data to obtain the corresponding health difference. Determine if all health differences are greater than a preset threshold: If all health differences are greater than the preset threshold, the target block is marked as end-of-life; the end-of-life state includes prohibiting data writing, allowing reading of stored data and triggering data migration; Otherwise, update the maximum number of program / erase cycles for the target block based on its current health data.
9. The method for adjusting the lifetime of a storage block according to claim 8, characterized in that, The step of updating the maximum number of programmable / erase cycles for the target block based on its current health data includes: The current health data is compared with preset first health thresholds and second health thresholds; If the current health data is less than or equal to the first health threshold, the maximum number of programming / erasing attempts for the target block is increased by a preset fixed increment; If the current health data is greater than the first health threshold and less than the second health threshold, then the maximum number of programming / erasing operations for the target block is maintained. If the current health data is greater than or equal to the second health threshold, then the target block is marked as end-of-life.
10. A storage block lifetime adjustment device, characterized in that, include: The block filtering module is used to filter out storage blocks from all storage blocks, selecting those where all pages contain valid data as target blocks. The bit error statistics module is used to perform read operations on all target blocks in a preset order to obtain the bit error count of each page in each target block; The status calculation module is used to determine the current status data of the target block based on the number of bit errors of each page in each target block, and to calculate the current health data reflecting the current health status of the target block based on the current status data and the most recent historical health data of the target block arranged in chronological order. The lifetime adjustment module is used to determine whether to perform a lifetime adjustment operation on the maximum number of programming / erasing operations for each target block based on the cumulative number of programming / erasing operations, and when it is determined that the lifetime adjustment operation needs to be performed, the lifetime adjustment operation is performed based on the current health data of the target block and the most recent consecutive historical health data arranged in chronological order.