CN-121979460-A - Write-in balance optimization method for solid state disk
Abstract
The invention relates to a write-in balance optimization method of a solid state disk, which is applied to the solid state disk comprising a controller and a flash memory medium, wherein the controller maintains a mapping table of logical addresses to physical pages and information of erasing times, the method comprises the steps of calculating the difference between the maximum value and the minimum value of the erasing times of each erasing block in a preset statistical range as an abrasion difference index, dividing a logical interval according to the logical addresses, determining the logical interval as a candidate cold logical interval if a mapping failure update event does not occur in a time window of a certain logical interval, selecting a first candidate cold logical interval mapped to a high abrasion block and a second candidate cold logical interval mapped to a low abrasion block, and under the condition of not moving an existing valid user data page, exchanging physical page sets corresponding to the first candidate cold logical interval and the second candidate cold logical interval for subsequent writing only by updating physical page set identifiers or interval descriptors in the mapping table, and permanently writing the mapping table update record and relevant block states in a log mode.
Inventors
- WEI WEI
- Yang Xiaotu
- ZHU GUANGHUI
Assignees
- 慧镕电子系统工程股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260330
Claims (10)
- 1. The method for optimizing the write-in balance of the solid state disk is applied to the solid state disk comprising a controller and a flash memory medium, and the controller maintains a mapping table from a logical address to a physical page and erasing frequency information, and is characterized by comprising the following steps: The abrasion difference judging step is used for calculating the difference between the maximum value and the minimum value of the erasing times of each erasing block in a preset statistical range as an abrasion difference index, and triggering equalization when the abrasion difference index is not smaller than a first threshold value; dividing logic intervals according to logic addresses, defining an event of old physical page failure caused by host writing or garbage collection and updating the mapping table as a mapping failure updating event, and determining the logic intervals as candidate cold logic intervals if the mapping failure updating event does not occur in a time window in a certain logic interval; Selecting an exchange object, namely selecting a first candidate cold logic section mapped to a high abrasion block and a second candidate cold logic section mapped to a low abrasion block, wherein the erasing times of the high abrasion block are not less than a second threshold value, the erasing times of the low abrasion block are less than or equal to a third threshold value, and the second threshold value is greater than the third threshold value; And the interval mapping exchange step is to exchange the physical page set corresponding to the first candidate cold logic interval and the second candidate cold logic interval only by updating the physical page set identifier or interval descriptor used for the subsequent writing of the first candidate cold logic interval and the second candidate cold logic interval in the mapping table under the condition of not moving the prior effective user data page, and to permanently write the mapping table updating record and the related block state in a log mode.
- 2. The method for write equalization optimization of solid state disk according to claim 1, wherein said mapping table stores a section descriptor for each logical section, said section descriptor includes a physical page set identifier, a start physical address, and a section length, said section map exchanging step exchanges the section descriptors corresponding to said first candidate cold logical section and said second candidate cold logical section by updating the same metadata page, and writes check information in said metadata page.
- 3. The method for optimizing write balance of a solid state disk according to claim 2, wherein before executing the interval mapping exchange step, an exchange locking flag is set for the first candidate cold logical interval and the second candidate cold logical interval, when a host write request directed to the first candidate cold logical interval or the second candidate cold logical interval is received during the valid period of the exchange locking flag, the host write request is written into a third physical page set and a corresponding mapping relation is recorded in the log, when a host read request directed to the first candidate cold logical interval or the second candidate cold logical interval is received, a corresponding physical address is determined according to the mapping table and the log record to be read, and after exchange is completed, the mapping relation is written into the mapping table and the exchange locking flag is cleared.
- 4. The method for optimizing write equalization of a solid state disk according to claim 1, wherein the candidate cold logic section determining step sets a first time window and a second time window, and the second time window has a longer duration than the first time window, satisfies a logic section in which the map failure update event does not occur in the first time window and the map failure update event occurs in the second time window, is determined as a first cold logic section, satisfies a logic section in which the map failure update event does not occur in the second time window, is determined as a second cold logic section, and the interchange object selecting step selects the first candidate cold logic section from the first cold logic sections and selects the second candidate cold logic section from the second cold logic sections.
- 5. The method for optimizing write equalization of solid state disk according to claim 3, wherein after setting said interchange lock flag, writing a section descriptor corresponding to said first candidate cold logic section and said second candidate cold logic section into a reserved metadata section as a pre-interchange snapshot, and when power-down recovery or system reset occurs during the validity period of said interchange lock flag, executing rollback or replay update for said mapping table according to the mapping relation between said pre-interchange snapshot and said log record.
- 6. The method for balanced write optimization of solid state disk according to claim 3, wherein during the period when the interchange locking flag is valid, writing a host write request directed to the first candidate cold logical zone or the second candidate cold logical zone into the third physical page set, recording a corresponding relationship between a logical address and a physical address in the log according to a receiving order, and after interchange, merging and writing the corresponding relationship into the mapping table according to the log recording order.
- 7. The method for optimizing write equalization of a solid state disk according to claim 4, wherein the first time window and the second time window are determined by a global mapping failure update event count, the second count value is larger than the first count value, the first cold logic section satisfies that the number of mapping failure update events is zero in a first count value range, the number of mapping failure update events is non-zero in a second count value range, and the second cold logic section satisfies that the number of mapping failure update events is zero in a second count value range.
- 8. The method for optimizing write equalization of solid state disk according to claim 4, wherein when there are a plurality of logical sections satisfying the first cold logical section condition, selecting a logical section with the largest erasing frequency in the corresponding high wear block as the first candidate cold logical section, and when there are a plurality of logical sections satisfying the second cold logical section condition, selecting a logical section with the smallest erasing frequency in the corresponding low wear block as the second candidate cold logical section.
- 9. The method for write equalization optimization of a solid state disk according to claim 4, wherein when the first cold logical section and the second cold logical section are different in section length, dividing the logical section with a larger section length into a plurality of sub-sections, making the sub-sections identical in length to the logical section with a smaller section length, and determining the first cold logical section or the second cold logical section from the sub-sections according to the determination condition.
- 10. The method for write balancing optimization of solid state disk according to claim 9, wherein a subinterval descriptor is generated for each subinterval in the mapping table and a shared flag is set so that the subintervals with the same shared flag point to a continuous address range of the same physical page set, and the interval mapping exchange step is performed as a group of subintervals with the same shared flag when determining the first cold logical interval or the second cold logical interval.
Description
Write-in balance optimization method for solid state disk Technical Field The invention relates to the technical field of memory control and data management, in particular to a write-in balance optimization method for a solid state disk. Background The current solid state disk writing balance optimization method is still mainly focused on overall adjustment of wear balance force based on erasing times statistics, and the key idea is that the number of erasing times of each storage unit is obtained, a median and an average value are calculated, dynamic or static wear balance force is adjusted according to the difference value between the median and the average value, whether the wear balance adjustment flow is entered is determined by judging whether the median of the number of erasing times is larger than an empirical threshold value, and the number of storage units participating in balance is adjusted according to the absolute value of the difference between the median and the average value, so that a trade-off is achieved between performance and service life. The scheme has certain adjustment capability on the overall wear distribution statistics level, but the technical path is still limited to block level statistics and dynamics control, and can be seen by combining a patent document CN117275561A, the scheme mainly solves the problem of how to adjust the equalization intensity, and does not go deep into the logic mapping level to carry out structural optimization. Firstly, the method relies on a global statistical result as a triggering basis, and when the median of the erasing times does not reach an empirical threshold, the method directly returns to reckoning, lacks the fine recognition capability of local hot spot areas or local cold data distribution, and can not be intervened in time when the local abrasion is serious but the whole statistical index is not triggered, so that individual blocks reach the life limit in advance. Secondly, the scheme is still essentially to realize balanced adjustment by selecting more or fewer memory units to participate in dynamic or static wear balance, and the adjustment mode still needs to realize block-level data migration through a data migration or garbage collection mechanism, and the data migration inevitably brings additional write amplification and performance overhead, and particularly, performance fluctuation can be caused during the peak period of load. In addition, in the method, the dynamic and static wear balance combination strategy is flexibly adjusted according to the positive and negative of the difference value, the decision is still made on the basis of the erasure number distribution in the unit of a block, the optimization of the mapping structure of the logic section hierarchy is not involved, and the realization of wear redistribution through the reconstruction of the mapping table structure under the condition of not moving the effective user data page is not considered, so that the limitation still exists in the aspect of reducing the write amplification. Moreover, the control core of the scheme is the difference between the median and the mean of the erasing times, which belongs to distribution adjustment in the statistical sense, and the attention point is whether the distribution form is close to normal or concentrated, but the statistical control cannot accurately position the relation between a specific logic data area and a physical block, and lacks a recognition mechanism for updating behaviors of logic address continuous intervals, data cold and hot characteristics and mapping failure, so that the directional scheduling is difficult to carry out aiming at the updating frequency difference of different logic intervals. The processing of the high-frequency updating area and the long-term static area still depends on the traditional dynamic and static balancing mechanism, and a fine layering strategy at the logic interval level is not provided. Meanwhile, although the method improves the statistical efficiency by hardware acceleration calculation of the median and variance, the optimization direction is still concentrated on the improvement of the statistical calculation efficiency, and the essential mode of the equalization action which depends on data movement is not changed. In the aspect of power failure consistency, the document also does not relate to mechanisms such as log persistence, mapping table atomic updating or exchange locking control, and the like, and cannot guarantee accurate rollback or replay of a mapping relation when abnormal conditions are encountered in the balanced execution process, and the reliability level still needs to rely on a conventional FTL recovery mechanism, so that special consistency design for balanced operation is lacked. Disclosure of Invention The invention aims to provide a write-in balance optimization method for a solid state disk, so that part of defects and shortcomings pointed out in th