A static wear leveling method, system, device and storage medium
Through dynamic threshold model and physical block selection optimization, the wear equalization problem caused by fixed thresholds in solid-state drives is solved, extending the service life of the solid-state drive and improving performance.
Patent Information
- Application Number
- CN202210081032.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-24
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2042-01-24
AI Technical Summary
In the existing static wear equalization algorithm, the use of fixed thresholds leads to unnecessary wear equalization triggers, which increases data migration overhead and impact on read and write performance, and the problem of wear imbalance still exists.
The dynamic threshold model is adopted to calculate the wear equalization trigger threshold through the functional model, and combine the average erasing times and usage stage of the physical block to optimize the target physical block selection and data migration to reduce unnecessary wear equalization operations.
It reduces unnecessary wear equalization triggering, extends the service life of the solid-state drive, improves read and write performance, ensures wear equalization, and avoids multiple triggering problems caused by threshold setting in the later use of the solid-state drive.
Smart Images

Figure CN114415962B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of solid state hard disks, and more specifically, to a static wear leveling method, system, device and storage medium. Background Art
[0002] With the rapid development and widespread application of computer technologies such as the Internet, cloud computing, and the Internet of Things, massive amounts of data are generated at all times in daily work or life and need to be processed and stored. The explosive growth of data, the increasing requirements of users for data security, and the rapid development of information technology have put forward higher requirements on the performance of storage systems.
[0003] SSD (Solid State Drives), also known as solid-state disk, is a hard disk made of a solid-state electronic storage chip array, which consists of a control unit and a solid-state storage unit (FLASH chip or DRAM chip). Flash memory is a commonly used storage medium in embedded systems. It is a non-volatile or solid-state memory, that is, it does not contain moving parts, which is very important for portable devices with high mobility. In addition, flash memory has many advantages such as fast reading and writing speed, power saving, high temperature resistance and no noise. Due to its stable performance (such as fast reading and writing speed, low energy consumption), it effectively overcomes many shortcomings of mechanical hard disks, and the cost is decreasing year by year. Solid-state hard disks with flash memory as storage medium are widely used.
[0004] The solid-state drive storage medium flash memory consists of five levels: chip - wafer - group - block - page.
[0005] The chip layer is the outermost structure. Usually, the chip layer has a complete set of peripheral circuits and signal processing modules. In many cases, flash memory manufacturers will physically stack the chips to save costs and space. Each stacked chip has its corresponding independent chip select signal and working status line. From the outside, these chips are a whole, called a particle.
[0006] The wafer (die) layer is the second-level structure of flash memory. The physical architecture combines multiple wafers together to share a set of peripheral circuits and signal lines. However, in order to execute advanced instructions, each wafer has an internal working status signal line to query the current status of each wafer.
[0007] The plane layer is a key layer in flash memory. One or more registers are set in each plane to improve the read and write speed of flash memory. Data is temporarily stored in the register and gradually transmitted in or out through the I / O signal line.
[0008] The block layer is the most basic unit of the erase operation in flash memory. Due to the physical characteristics of flash memory, data is stored in the basic storage unit cell, which is essentially a double-layer floating gate MOS tube similar to NMOS. Therefore, there is no rewrite mechanism. When a physical block is full of data and the data of the physical block is updated, the data on the data block needs to be erased before new data can be written. The number of erases for each data block is limited. The life of the solid-state drive depends on the data block with the shortest life. In order to extend the service life of the solid-state drive and prevent a series of problems caused by frequent erasure / programming of some physical blocks, the erase operations of each physical block need to be balanced to ensure that the number of erase operations of each physical block is close to the maximum before the service life. This balancing of the number of erase operations of each data block is called wear leveling.
[0009] The page layer is the most basic unit of read and write operations in flash memory. Physical pages usually have three states: valid physical page, invalid physical page, and idle physical page. A valid physical page is a physical page that currently stores data. An invalid physical page is a physical page that stores data and is converted from a valid physical page to an invalid physical page due to data update. An idle physical page is a physical page that is idle and waiting to store data. For flash memory, an off-site update strategy is adopted, and the updated data will be placed on other idle physical pages instead of overwriting the original data. This is very different from a mechanical hard disk.
[0010] Since there is a limit on the number of erase times for this physical block, if some physical blocks reach the erase time limit ahead of time, it will have a great impact on the entire SSD. In order to balance the number of erase times for each physical block, wear leveling is particularly important in the flash conversion layer of the SSD.
[0011] Currently in academic research and industrial production, wear leveling algorithms can be roughly divided into two directions: static wear leveling and dynamic wear leveling.
[0012] The main idea of the dynamic wear leveling algorithm is: when the data in a page needs to be changed, the new data is written to the physical page with fewer erase times, and the original page is marked as an invalid page. The disadvantage of the dynamic wear leveling algorithm is that if the data just written is updated soon, then the data block just updated will soon become an invalid page. If it is updated frequently, the block storing cold data will undoubtedly be rarely erased, which will have an adverse effect on the overall life of the flash memory.
[0013] The main idea of the static wear leveling algorithm is: under artificially set conditions, when a physical block completes the erase operation, if the conditions are met, a target physical block will be selected. The selection of the target physical block is mainly affected by whether the data stored in the physical block is cold data, that is, data that is rarely updated. The purpose is to exchange cold and hot data, migrate the data of the target physical block to the physical block to cool down its wear growth rate, and at the same time recycle the target block to make it a free physical block and enter the pool of physical blocks to be written, so as to control wear leveling.
[0014] In the existing technology, a static wear leveling strategy based on hot data rotation placement reduces the data migration overhead in the static wear leveling process from two aspects: reducing the data migration amount and improving the data migration efficiency. The solid-state disk space is divided into multiple domains and static wear leveling is performed in a rotation manner. When static wear leveling is performed on a domain, the hot data in the load is written to the domain in a centralized manner, so that the hot data can be used to improve the aggregation of cold data in low-wear blocks and reduce the cold data migration amount. The internal parallelism of the flash memory is used to improve the cold data migration efficiency in the static wear leveling process. When the total amount of data migration is certain, the data migration task is completed quickly and efficiently. The hot data is used to accelerate the wear of low-wear blocks, improve the efficiency of garbage collection of low-wear blocks in this process, and further reduce the data migration amount in the static wear leveling process. Summary of the invention
[0015] The present invention provides a static wear leveling method, system, device and storage medium to solve the technical defects of unnecessary triggering in the early stage, fast wear growth rate and uneven wear when converting fixed thresholds into dynamic thresholds.
[0016] In order to achieve the above invention purpose, the technical solution adopted is:
[0017] A static wear leveling method comprises the following steps:
[0018] S1: After the solid-state drive garbage collection performs an erase operation on a physical block, the physical block performs a wear leveling strategy to determine whether it needs to perform a wear leveling to slow down its wear growth rate;
[0019] S2: If the physical block meets the static wear leveling strategy triggering threshold, determine whether to select the target physical block according to the corresponding interval of the average number of erase times of all physical blocks;
[0020] S3: When selecting a target physical block, select a target physical block that meets the conditions;
[0021] S4: Migrate the data on the target physical block to the current physical block, and exchange the mapping addresses of the target physical block and the current physical block to achieve wear leveling.
[0022] In the above scheme, in the early stage of the use of the solid-state hard disk, the overhead of data migration and the impact on read and write performance caused by unnecessary wear leveling caused by the previous static wear leveling algorithm with a fixed threshold are reduced. In order to better optimize the wear leveling strategy and reduce unnecessary triggers in the early stage, the fixed threshold is converted into a dynamic threshold, which improves the service life of the solid-state hard disk and reduces the impact on read and write performance while ensuring wear leveling.
[0023] Preferably, in step S1, the wear leveling determination strategy is:
[0024] current_Erase_Count>threshold*Erase_limit,
[0025] Among them, current_Erase_Count is the number of erases of the current physical block, threshold is the static wear leveling trigger threshold of the proposed function model, and Erase_limit is the average usage upper limit of the physical block. The threshold function model is as follows:
[0026] threshold = Sin(W*erase avg +t)
[0027] The coordinate axis is normalized by Erase_limit, and we define the initial threshold for triggering wear leveling as THR init , the impact factor is THR init Determined by the formula THR in i t =Sin(t), and then the coefficient W in the function is calculated by the following formula:
[0028] acSin(1)=(wx+t)=Π / 2, W=Π / 2-t
[0029] Among them, erase avg is the total average erase count of physical blocks in the SSD, which is determined by our initial trigger threshold THR init Set the parameters W and t, and use the variable erase avg Get the dynamic threshold for wear leveling triggering.
[0030] Preferably, in step S2, if the physical block enters the current stage determination module, the stage determination module characteristics include: the interval (0, 0.35*Erase_limit) is the early stage of use of the solid state drive;
[0031] (0.35*Erase_limit, 0.83*Erase_limit) is the middle stage of SSD use; (0.83*Erase_limit, 1*Erase_limit) is the late stage of SSD use; and get the average erase count of all current physical blocks avg , the corresponding interval of the erase count of the physical block is combined with the erase avg Comprehensively determine whether to enter the target physical block selection module;
[0032] The comprehensive judgment condition is: if erase avg The corresponding is the later stage of the solid state drive use. The minimum erase count erase_min in the physical block is obtained by traversing and making the following judgment:
[0033] (current_Erase_Count-erase_min) / Erase_limit>q
[0034] If it is satisfied, go to the next module; if erase avg The corresponding SSD will directly enter the physical block selection module when it is in the middle or early stage of use, otherwise it will exit the wear leveling strategy system;
[0035] The preset value q is the average erase count as a percentage of the difference between the current erase count current_Erase_Count and the target physical block target_Erase_Count, and q is 0.15.
[0036] Preferably, in step S3, the screening process is as follows: define the states of the target physical block candidate blocks as cold and ready, distinguish the physical blocks by these two states, and classify the physical blocks in the ready state as the target candidate block set, and then traverse the ready state queue to select the physical block with the least number of erases for determination, and the determination condition is:
[0037] (current_Erase_Count-target__Erase_Count) / Erase_limit>q
[0038] If the conditions are met, the selected physical block is used as the target physical block, where q is a preset value; the data on the target physical block is migrated to the current physical block, and the mapping addresses of the target physical block and the current physical block are exchanged to achieve wear leveling.
[0039] Preferably, there are two types of state transitions of the target physical block, the first being a cool-to-ready transition, and the second being a ready-to-cool transition;
[0040] The transfer conditions are specifically as follows: define each physical block to have a value representing the state of the physical block as a target physical block, a negative number represents a cooling state, and a positive number represents a ready state, wherein the initial value of all physical blocks is set to 0 by default, and when the system performs each p erasing operations, the value of each corresponding physical block is increased by 1, that is, when the value is greater than 0, the state transition from cooling to ready is completed, and each time an erasing operation is performed, the corresponding physical block is reset to -x, that is, the state transition from ready to cooling is completed; p is an adjustment value, and the value is determined by Erase_limit; x is a range value, the minimum boundary value of the cooling state, and the value is 0.8*the 4 preset values p, wherein 0.8 as a numerical coefficient should ensure that after each p erasing times, when the state value of the target block in the cooling state is +1, the conversion scale from cooling to ready can be reached.
[0041] Preferably, a static wear leveling system, applying the static wear leveling method, comprises a threshold setting module, a phase determination module, a physical block selection module and a migration module;
[0042] The output end of the threshold setting module is electrically connected to the input end of the stage determination module, the output end of the stage determination module is electrically connected to the input end of the physical block selection module, and the output end of the physical block selection module is electrically connected to the output end of the migration module;
[0043] In the threshold setting module, after the solid-state drive garbage collection performs an erase operation on a physical block, the physical block performs a wear leveling strategy determination to determine whether it needs to perform a wear leveling to slow down its wear growth rate;
[0044] In the stage determination module, if the physical block meets the static wear leveling strategy triggering threshold, it is determined whether to select the target physical block according to the corresponding interval of the average number of erase times of all physical blocks;
[0045] When the physical block selection module selects the target physical block, it selects the target physical block that meets the conditions;
[0046] The migration module migrates the data on the target physical block to the current physical block, and exchanges the mapping addresses of the target physical block and the current physical block to achieve wear leveling.
[0047] Preferably, the trigger threshold condition in the threshold setting module is:
[0048] current_Erase_Count>threshold*Erase_limit;
[0049] The conditions in the stage determination module are as follows:
[0050] current_Erase_Count-erase_min / Erase_limit>q;
[0051] The filter conditions for the physical block selection module are as follows:
[0052] (current_Erase_Count-target__Erase_Count) / Erase_limit>q.
[0053] A static wear leveling device, comprising:
[0054] Memory: used to store computer programs;
[0055] Processor: used for executing the computer program to implement the steps of the static wear leveling method.
[0056] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the static wear leveling method are implemented.
[0057] Compared with the prior art, the present invention has the following beneficial effects:
[0058] The present invention provides a static wear leveling method, system, device and storage medium, which reduce the overhead of data migration and the impact on read and write performance caused by unnecessary wear leveling caused by the previous static wear leveling algorithm with a fixed threshold in the early stage of use of the solid-state hard disk. In order to better optimize the wear leveling strategy and reduce unnecessary triggering in the early stage, the fixed threshold is converted into a dynamic threshold, which improves the service life of the solid-state hard disk and reduces the impact on read and write performance while ensuring wear leveling. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 A flow chart of the method provided by the present invention;
[0060] Figure 2 A system module diagram provided by the present invention;
[0061] Figure 3 A schematic diagram of the algorithm flow of the threshold setting module provided by the present invention;
[0062] Figure 4 This is a schematic diagram of the algorithm flow of the stage determination module provided by the present invention;
[0063] Figure 5 A schematic diagram of the algorithm flow of the target physical block selection module provided by the present invention;
[0064] Figure 6 The overall process diagram provided by the present invention is shown in FIG. DETAILED DESCRIPTION
[0065] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0066] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0067] Example 1
[0068] like Figure 1 As shown, a static wear leveling method comprises the following steps:
[0069] S1: After the solid-state drive garbage collection performs an erase operation on a physical block, the physical block performs a wear leveling strategy to determine whether it needs to perform a wear leveling to slow down its wear growth rate;
[0070] S2: If the physical block meets the static wear leveling strategy triggering threshold, determine whether to select the target physical block according to the corresponding interval of the average number of erase times of all physical blocks;
[0071] S3: When selecting a target physical block, select a target physical block that meets the conditions;
[0072] S4: Migrate the data on the target physical block to the current physical block, and exchange the mapping addresses of the target physical block and the current physical block to achieve wear leveling.
[0073] In the above scheme, in the early stage of the use of the solid-state hard disk, the overhead of data migration and the impact on read and write performance caused by unnecessary wear leveling caused by the previous static wear leveling algorithm with a fixed threshold are reduced. In order to better optimize the wear leveling strategy and reduce unnecessary triggers in the early stage, the fixed threshold is converted into a dynamic threshold, which improves the service life of the solid-state hard disk and reduces the impact on read and write performance while ensuring wear leveling.
[0074] Preferably, in step S1, the wear leveling determination strategy is:
[0075] current_Erase_Count>threshold*Erase_limit,
[0076] Among them, current_Erase_Count is the number of erases of the current physical block, threshold is the static wear leveling trigger threshold of the proposed function model, and Erase_limit is the average usage upper limit of the physical block. The threshold function model is as follows:
[0077] threshold = Sin(W*erase avg +t)
[0078] The coordinate axis is normalized by Erase_limit, and we define the initial threshold for triggering wear leveling as THR in i t , the impact factor is THR init Determined by the formula THR in i t =Sin(t), and then the coefficient W in the function is calculated by the following formula:
[0079] acSin(1)=(wx+t)=Π / 2, W=Π / 2-t
[0080] Among them, erase avg is the total average erase count of physical blocks in the SSD, which is determined by our initial trigger threshold THR init Set the parameters W and t, and use the variable erase avg Get the dynamic threshold for wear leveling triggering.
[0081] Preferably, in step S2, if the physical block enters the current stage determination module, the stage determination module characteristics include: the interval (0, 0.35*Erase_limit) is the early stage of use of the solid state drive;
[0082] (0.35*Erase_limit, 0.83*Erase_limit) is the middle stage of SSD use; (0.83*Erase_limit, 1*Erase_limit) is the late stage of SSD use; and get the average erase count of all current physical blocks avg , the corresponding interval of the erase count of the physical block is combined with the erase avg Comprehensively determine whether to enter the target physical block selection module;
[0083] The comprehensive judgment condition is: if erase avg The corresponding is the later stage of the solid state drive use. The minimum erase count erase_min in the physical block is obtained by traversing and making the following judgment:
[0084] (current_Erase_Count-erase_min) / Erase_limit>q
[0085] If it is satisfied, go to the next module; if erase avg The corresponding SSD will directly enter the physical block selection module when it is in the middle or early stage of use, otherwise it will exit the wear leveling strategy system;
[0086] The preset value q is the average erase count as a percentage of the difference between the current erase count current_Erase_Count and the target physical block target_Erase_Count, and q is 0.15.
[0087] Preferably, in step S3, the screening process is as follows: define the states of the target physical block candidate blocks as cold and ready, distinguish the physical blocks by these two states, and classify the physical blocks in the ready state as the target candidate block set, and then traverse the ready state queue to select the physical block with the least number of erases for determination, and the determination condition is:
[0088] (current_Erase_Count-target__Erase_Count) / Erase_limit>q
[0089] If the conditions are met, the selected physical block is used as the target physical block, where q is a preset value; the data on the target physical block is migrated to the current physical block, and the mapping addresses of the target physical block and the current physical block are exchanged to achieve wear leveling.
[0090] Preferably, there are two types of state transitions of the target physical block, the first being a cool-to-ready transition, and the second being a ready-to-cool transition;
[0091] The transfer conditions are specifically as follows: define each physical block to have a value representing the state of the physical block as a target physical block, a negative number represents a cooling state, and a positive number represents a ready state, wherein the initial value of all physical blocks is set to 0 by default, and when the system performs each p erasing operations, the value of each corresponding physical block is increased by 1, that is, when the value is greater than 0, the state transition from cooling to ready is completed, and each time an erasing operation is performed, the corresponding physical block is reset to -x, that is, the state transition from ready to cooling is completed; p is an adjustment value, and the value is determined by Erase_limit; x is a range value, the minimum boundary value of the cooling state, and the value is 0.8*the 4 preset values p, wherein 0.8 as a numerical coefficient should ensure that after each p erasing times, when the state value of the target block in the cooling state is +1, the conversion scale from cooling to ready can be reached.
[0092] Example 2
[0093] like Figure 2 As shown, a static wear leveling system applies the static wear leveling method, including a threshold setting module, a stage determination module, a physical block selection module and a migration module;
[0094] The output end of the threshold setting module is electrically connected to the input end of the stage determination module, the output end of the stage determination module is electrically connected to the input end of the physical block selection module, and the output end of the physical block selection module is electrically connected to the output end of the migration module;
[0095] In the threshold setting module, after the solid-state drive garbage collection performs an erase operation on a physical block, the physical block performs a wear leveling strategy determination to determine whether it needs to perform a wear leveling to slow down its wear growth rate;
[0096] In the stage determination module, if the physical block meets the static wear leveling strategy triggering threshold, it is determined whether to select the target physical block according to the corresponding interval of the average number of erase times of all physical blocks;
[0097] When the physical block selection module selects the target physical block, it selects the target physical block that meets the conditions;
[0098] The migration module migrates the data on the target physical block to the current physical block, and exchanges the mapping addresses of the target physical block and the current physical block to achieve wear leveling.
[0099] Preferably, the trigger threshold condition in the threshold setting module is:
[0100] current_Erase_Count>threshold*Erase_limit;
[0101] The conditions in the stage determination module are as follows:
[0102] current_Erase_Count-erase_min / Erase_limit>q;
[0103] The filter conditions for the physical block selection module are as follows:
[0104] (current_Erase_Count-target__Erase_Count) / Erase_limit>q.
[0105] Example 3
[0106] like Figure 3 to Figure 6 As shown, the present invention provides a static wear leveling method embodiment with a nonlinear threshold value dynamically changing. The overall framework of the static wear leveling method with a nonlinear threshold value dynamically changing mainly consists of four parts corresponding to the above four modules. The overall idea is as follows:
[0107] When an erase operation is performed on a physical block in the solid state drive garbage collection, a wear leveling strategy is determined for the physical block after the erase operation to determine whether a wear leveling operation is required to slow down its wear growth rate.
[0108] The wear leveling judgment strategy is: current_erase_count>threshold*erase_limit, where current_erase_count is the number of erases of the current physical block, threshold is the static wear leveling trigger threshold of the proposed function model, and Erase_limit is the average upper limit of the physical block usage. The trigger threshold is threshold=Sin(W*erase avg +t).
[0109] The overall flow chart of the wear leveling threshold setting module is as follows: Figure 3 shown.
[0110] If the physical block reaches the trigger threshold, it enters the current stage determination module.
[0111] In the main body of the current stage determination module: if the number of erase times of the physical block reaches the trigger threshold condition obtained by the function model, a current stage determination is performed, and the use stage determination module obtains the current use stage and whether to enter wear leveling.
[0112] The characteristics of the physical block stage determination module include: we define the interval [0, 0.35Erase_limit] as the early stage of SSD use, (0.35Erase_limit, 0.83Erase_limit] as the middle stage of SSD use, and (0.83Erase_limit, 1Erase_limit) as the late stage of SSD use.
[0113] Get the average erase count of all current physical blocks avg , the current corresponding interval is obtained from the number of erase times of the physical block to represent the current stage, and combined with erase avg Comprehensively determine whether to enter the target physical block selection module.
[0114] The comprehensive judgment condition is: if erase avg The corresponding is the later stage of SSD use. The minimum erase count erase_min in the physical block is obtained by traversing, and current_Erase_Count-erase_min / Erase_limit>q is determined. If it is satisfied, it will enter the next module. avg If the SSD is in the middle or early stages of use, go directly to the next module.
[0115] The detailed design of the current stage judgment module is as follows Figure 4 shown.
[0116] If the physical block enters the target physical block selection module, the target physical block is selected, and the target physical block that meets the conditions is screened.
[0117] The main design of the target physical block selection module is shown in Figure 1 -S02: If the physical block meets the above requirements, the target physical block is selected and a target physical block screening judgment is performed.
[0118] The screening conditions of this module are as follows: we define the candidate states of the target physical block as cooling and ready. In the ready state queue, we traverse and select the physical block with the least number of erases for judgment.
[0119] The judgment condition is: (current_Erase_Count-target__Erase_Count) / Erase_limit>q. If the condition is met, the selected physical block is used as the target physical block, where q is a preset value.
[0120] Regarding the design of state transfer conditions and the ready state queue pool, when the ready queue is transferred to the cooling queue, the physical block is erased and the state of the physical block is reset to -x. When the cooling queue is transferred to the ready queue, the physical block is erased p times, and the other state bits are +1. When the value is greater than 0, it enters the ready queue.
[0121] If the physical block meets the above-mentioned requirements and the target physical block can be selected, the last module data migration module is entered to migrate the data on the target physical block to the current physical block, and exchange the mapping address of the target physical block with that of the current physical block to achieve wear leveling.
[0122] It should be noted that there are two types of state transitions of the target physical block, the first is from cooling to ready, and the second is from ready to cooling. The specific transition conditions are as follows: we define each physical block to have a value representing the state of the physical block as a target physical block, a negative number represents cooling, and a positive number represents ready, where the initial value is 0. When the system performs every p erase operations, the corresponding value of each physical block is increased by 1, that is, when the value is greater than 0, it is a transition from cooling to ready state. For each erase operation, the corresponding physical block is reset to -x, that is, a transition from ready to cooling.
[0123] Optionally, the preset value q is the average erase count range of the percentage of the difference between the current erase count current_Erase_Count and the target physical block target_Erase_Count. When the two are close, the target physical block is unfavorable, and q is 0.15.
[0124] Optional, p is the adjustment value, the value is determined by Erase_limit, here it is 0.1*Erase_limit;
[0125] Optionally, x is a range value, the minimum boundary value of the cooling state, which is 0.8*the 4 preset values p, wherein the numerical coefficient 0.8 cannot be taken randomly, otherwise all physical blocks will be in the cooling state without the ready state, causing the wear leveling strategy system to crash. This coefficient should ensure that after every p erases, the conversion scale from cooling to ready can be reached when the target block state value in the cooling state is +1.
[0126] From the above, it can be seen that the embodiment of the present invention uses the proposed function model to progressively set and adjust the static wear leveling threshold to reduce the data migration and read and write performance overhead caused by frequent triggering of static wear leveling in the early stage of solid-state hard disk use, and balances the number of erase times between physical blocks. At the same time, it fixes the multiple triggering problem caused by the characteristics of such threshold setting of progressive thresholds in the later stage of solid-state hard disk use, minimizes unnecessary triggering, and optimizes the selection of target physical blocks to better delay the wear growth rate of physical blocks with a high number of erase times. In short, it optimizes the use performance of the solid-state hard disk, improves the stability and reliability of the solid-state hard disk, and extends the life of the solid-state hard disk.
[0127] The embodiment of the present invention also provides a corresponding implementation device for the wear leveling method of the solid state drive, which further makes the method more practical. The wear leveling device of the solid state drive provided by the embodiment of the present invention is introduced below. The wear leveling device of the solid state drive described below and the wear leveling method of the solid state drive described above can be referred to each other.
[0128] The system includes:
[0129] Threshold setting module: used to set the threshold for triggering wear leveling after the physical block of the solid state drive is erased. The triggering conditions are as follows:
[0130] current_Erase_Count>threshold*Erase_limit
[0131] Stage determination module: used to determine the current use period of the solid-state drive if the physical block reaches the threshold requirement for triggering static wear leveling, and divide the use period of the solid-state drive into three stages. If it is in the later stage of use, it is determined by current_Erase_Count-erase_min / Erase_limit>q. The purpose is to repair the frequent wear leveling strategy determination in the later stage of solid-state drive use due to threshold setting; its determination and data migration for wear leveling are completely unnecessary when the number of erase times of two physical blocks is extremely close, and it is harmful to performance overhead and life loss.
[0132] Physical block selection module: used to select the target physical block if the above physical block reaches the trigger threshold and passes the current stage judgment, and enter this module. Each physical block has a current value to represent the current state. For the physical block in the ready state, it is judged according to (current_Erase_Count-target__Erase_Count) / Erase_limit>q, and selected from the ready state pool.
[0133] Migration module: used to migrate the data on the target physical block to the current physical block, and exchange the mapping address of the target physical block with that of the current physical block to achieve wear leveling.
[0134] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A static wear leveling method, characterized in that: The following steps are involved: S1: After the solid-state drive garbage collection performs an erase operation on the current physical block, it determines the static wear leveling strategy for the current physical block to determine whether it needs to perform a static wear leveling to slow down its wear growth rate; S2: If it is determined that the current physical block meets the static wear leveling strategy, determine whether to select a target physical block based on the corresponding interval of the average number of erase times of all physical blocks; S3: If target physical block selection is performed, a target physical block that meets the conditions is selected; S4: Migrate the data on the target physical block to the current physical block, and exchange the mapping addresses of the target physical block and the current physical block to achieve static wear leveling; In step S1, the static wear leveling strategy is: current_Erase_Count>threshold*Erase_limit, Where current_erase_count is the number of erases of the current physical block, threshold is the static wear leveling triggering threshold of the proposed function model, and Erase_limit is the average upper limit of the use of the physical block. The static wear leveling triggering threshold of the proposed function model is calculated as follows: threshold=Sin(W*erase avg +t) The coordinate axis is normalized to Erase_limit, and the initial threshold for triggering static wear leveling is defined as THR init , according to THR init =Sin(t) to calculate the impact factor t, and then use the following formula to find the coefficient W: W=Π / 2-t Among them, erase avg is the total average erase count of all physical blocks; In step S2, whether to select a target physical block is determined according to the corresponding interval of the average number of erase times of all physical blocks, including: the interval includes: (0, 0.35*Erase_limit) for the early use of the solid state drive; (0.35*Erase_limit, 0.83*Erase_limit) for the middle use of the solid state drive; (0.83*Erase_limit, 1*Erase_limit) for the late use of the solid state drive; the corresponding interval of the average number of erase times of all physical blocks and the combination of erase_limit and erase_limit are used to determine whether to select a target physical block. avg Comprehensively determine whether to select a target physical block; The comprehensive judgment is: if erase avg The corresponding interval is the later period of use of the solid-state drive. The minimum erase count erase_min in all physical blocks is obtained by traversing and making the following judgments: (current_Erase_Count-erase_min) / Erase_limit>q If it is satisfied, the target physical block is selected; if erase avg If the corresponding interval is the middle or early use period of the solid state drive, the target physical block selection is performed directly, and q is 0.15; In step S3, the target physical blocks that meet the conditions are selected, including: each physical block is in a ready state after every p erase operations, where p is determined by Erase_limit, and the physical blocks in the ready state are classified as a target physical block set, and the target physical block set is traversed to select the physical block with the least number of erase operations to make the following determination: (current_Erase_Count-target__Erase_Count) / Erase_limit>q target__Erase_Count is the number of erases of the physical block selected from the target physical block set; If the conditions are met, the selected physical block is used as the target physical block, the data on the target physical block is migrated to the current physical block, and the mapping addresses of the target physical block and the current physical block are exchanged to achieve static wear leveling.
2. A static wear leveling system, applying the static wear leveling method according to claim 1, characterized in that: It includes a threshold setting module, a stage determination module, a physical block selection module and a migration module; The output end of the threshold setting module is electrically connected to the input end of the stage determination module, the output end of the stage determination module is electrically connected to the input end of the physical block selection module, and the output end of the physical block selection module is electrically connected to the output end of the migration module; In the threshold setting module, after the solid-state drive garbage collection performs an erase operation on the current physical block, a static wear leveling strategy is determined for the current physical block to determine whether it needs a static wear leveling to slow down its wear growth rate; In the stage determination module, if it is determined that the current physical block meets the static wear leveling strategy, it is determined whether to select the target physical block according to the corresponding interval of the average number of erase times of all physical blocks; In the physical block selection module, if a target physical block selection is performed, a target physical block that meets the conditions is selected; The migration module migrates the data on the target physical block to the current physical block, and exchanges the mapping addresses of the target physical block and the current physical block to achieve static wear leveling.
3. A static wear leveling device, characterized in that: include: Memory: used to store computer programs; Processor: used for executing the computer program to implement the steps of a static wear leveling method as claimed in claim 1.
4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of a static wear leveling method as claimed in claim 1 are implemented.
