ZNS SSD region recovery method, electronic equipment and storage medium
Through the calculation of regional scoring and adaptive selection mechanism, the problems of low space utilization and short service life of ZNS SSD are solved, and more efficient regional recycling and data management are achieved, which improves space utilization and service life.
Patent Information
- Application Number
- CN202411024639.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The ZNS SSD's regional recycling method has problems such as low space utilization and excessive area reset operations, resulting in space amplification and reduced service life.
By calculating the product of the space usage rate and data redundancy rate of each area as a score, select the area with high scores for recycling, and adaptively determine the number of areas to be recycled based on the remaining storage space to avoid secondary transfer and overflow of invalid data Many reset operations.
Improves the space utilization and service life of ZNS SSD, reduces the number of regional reset operations, ensures data security and consistency, and adapts to the needs of different storage spaces and workloads.
Smart Images

Figure CN118939195A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data storage, and more specifically, relates to a ZNS SSD regional recovery method, electronic equipment and storage medium. Background Art
[0002] As an emerging storage device, ZNS SSD has attracted wide attention due to its unique design and performance advantages. ZNS SSD divides the storage space into multiple independent zones, each of which can independently perform data writing and erasing operations.
[0003] The existing regional recycling method of ZNS SSD mainly recycles the areas in the Full state and where the invalid data occupies a high amount of space. If the regional recycling is not timely, it will also lead to the problem of space expansion, greatly reducing the space utilization rate of ZNS SSD; specifically, for some areas that are not in the Full state, if the invalid data occupies a high amount of space, even if it is not in the Full state, it is urgent to recycle, otherwise there will be a problem of space expansion; at the same time, the invalid data space occupancy rate is the size of the invalid data occupying the entire regional space. When the amount of invalid data in the area remains unchanged, the invalid data space occupancy rate will also remain unchanged. In other words, there is a situation where the area can never meet the cleaning requirements, there is accumulation of invalid data, and there is also a problem of space expansion. Summary of the invention
[0004] In view of the above defects or improvement needs of the prior art, the present invention provides a ZNS SSD regional recycling method, electronic device and storage medium to solve the technical problem of space utilization of ZNS SSD in the prior art.
[0005] In order to achieve the above object, in a first aspect, the present invention provides a regional recovery method of a ZNS SSD, comprising:
[0006] When the current remaining storage space of the ZNS SSD is less than the preset effective space threshold, the following area recovery operations are performed: obtain the effective data volume V, invalid data volume I and free space volume F of each area in the ZNS SSD; calculate the space utilization rate and data redundancy rate of each area, and calculate the product of the two as the score of the area; select the N areas with the highest scores, and filter out the areas with a score of 0 to obtain the area set to be recovered; clean up the areas to be recovered in the area set to be recovered; N≥1;
[0007] Among them, the space utilization rate is (V+I) / (V+I+F); the data redundancy rate is I / V.
[0008] Further preferably, the smaller the current remaining storage space is, the larger N is.
[0009] Further preferably, N is in a negative linear relationship with the current remaining storage space.
[0010] Further preferably, N=kx+b; wherein x is the difference between a preset effective space threshold and the current remaining storage space; k is a slope, which is a preset positive value; and b is a preset positive integer.
[0011] Further preferably, N is in a negative exponential relationship with the current remaining storage space.
[0012] Further preferably, N is in a negative logarithmic relationship with the current remaining storage space.
[0013] Further preferably, the process of clearing the area to be reclaimed includes: after transferring valid data in the area to be reclaimed, resetting the area to be reclaimed.
[0014] Further preferably, valid data in the to-be-reclaimed area is transferred to other areas of the ZNS SSD except the to-be-reclaimed areas in the to-be-reclaimed area set, so as to avoid secondary transfer of valid data.
[0015] In a second aspect, the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the regional recycling method of the ZNS SSD provided in the first aspect of the present invention is implemented.
[0016] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the regional recycling method of the ZNS SSD provided in the first aspect of the present invention is implemented.
[0017] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects:
[0018] 1. The present invention provides a regional recycling method for ZNS SSD. When the current remaining storage space of ZNS SSD is less than the preset effective space threshold, the space utilization rate and data redundancy rate of each region are calculated, and the product of the two is calculated as the score of the region, and the region with a higher score is selected for regional recycling; wherein the data redundancy rate is the ratio of the amount of invalid data to the amount of valid data. The present invention not only takes into account the region in the Full state, but also takes into account all regions, scores the region based on the space utilization rate and the data redundancy rate, and can timely recycle the region with a high space utilization rate and more invalid data, so as to release more space under the premise of transferring less effective data, solve the problems of untimely regional recycling and space enlargement in the prior art, improve the cleaning efficiency of ZNS SSD, and greatly improve the space utilization rate of ZNSSSD.
[0019] 2. The existing ZNS SSD regional recycling method mainly recycles the areas in the Full state and with a high space occupied by invalid data, which will lead to more ZNS SSD regional reset operations. However, the regional reset operation of the ZNS SSD has certain limitations, so more reset operations will reduce the life of the ZNS SSD. The ZNS SSD regional recycling method provided by the present invention uses the product of the space utilization rate and the data redundancy rate of the area as the score of the area, and preferentially recycles the areas with higher scores. The space utilization rate and the data redundancy rate indicators are decomposed, which can avoid excessive triggering of regional reset operations caused by the situation that the write amount in some spaces is small but the data redundancy rate is high during the regional recycling operation, thereby reducing the number of ZNS SSD regional reset operations and thereby improving the service life of the ZNS SSD.
[0020] 3. Furthermore, the regional recycling method of the ZNS SSD provided by the present invention adaptively determines the number of regions to be recycled according to the current remaining storage space. The smaller the current remaining storage space, the more regions to be recycled. It can adapt to different remaining storage space conditions, further improve the cleaning efficiency of the ZNS SSD, and further improve the space utilization of the ZNS SSD.
[0021] 4. Furthermore, in the regional recycling method of the ZNS SSD provided by the present invention, when cleaning the area to be recycled, the valid data in the area to be recycled is transferred to other areas of the ZNS SSD except the areas to be recycled in the area to be recycled set, and then the area to be recycled is reset. The areas to be recycled in the area to be recycled set are excluded from the destination area for the transfer of valid data, so that the destination areas are not areas that need to be recycled, the security of the data is fully considered, the loss and secondary transfer of valid data are avoided, and the integrity and consistency of the data are guaranteed.
[0022] 5. The regional recycling method of the ZNS SSD provided by the present invention is compatible with the existing ZNS SSD and file systems (such as ZenFS), and can be implemented through software upgrades without modifying the hardware. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flow chart of a ZNS SSD regional recycling method provided by an embodiment of the present invention;
[0024] Figure 2 A flowchart of scoring and adaptively selecting each region provided by an embodiment of the present invention;
[0025] Figure 3 The figure is a comparison diagram of the to-be-reclaimed areas selected by the regional recycling method of the ZNS SSD provided by the present invention and the original regional recycling method of the ZNS SSD. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0027] In order to achieve the above object, in a first aspect, the present invention provides a regional recovery method of a ZNS SSD, comprising:
[0028] When the current remaining storage space of the ZNS SSD is less than the preset effective space threshold, the following area recovery operations are performed: scan all areas in the ZNS SSD to obtain the effective data volume V, invalid data volume I and free space volume F of each area in the ZNS SSD; calculate the space utilization rate and data redundancy rate of each area, and calculate the product of the two as the score of the area; select the N areas with the highest scores, and filter out the areas with a score of 0 to obtain the area set to be recovered; clean up the areas to be recovered in the area set to be recovered; N≥1;
[0029] The space utilization rate is (V+I) / (V+I+F); the data redundancy rate is I / V. The above preset effective space threshold is αS; S is the entire storage space size of the ZNS SSD; α is a ratio value greater than 0 and less than 100%.
[0030] If the I / V value in a region is larger, it means that there are more invalid data relative to valid data in the region. In an ideal state, the region recovery operation is to release more space occupied by invalid data under the premise of transferring less valid data. Therefore, the larger the I / V value, the higher the cost-effectiveness of region recovery. At the same time, the space utilization rate is the ratio of the used space to the total space. The higher the space utilization rate, the more data is written in the region. This indicator is combined with the data redundancy rate indicator to avoid excessive triggering of region reset operations caused by the situation that the amount of writes in some spaces is small but the data redundancy rate is high during the region recovery operation, thereby improving the life of the ZNSSSD; it also avoids the problem that the absolute value of invalid data in a certain region is large, but the relative value is small, thereby alleviating the problem of space amplification to a certain extent.
[0031] It should be noted that the above N can be a preset constant, that is, an empirical value. In an optional implementation, the value is 32. In order to achieve better performance, preferably, the above N is adaptively determined according to the current remaining storage space of the ZNS SSD, and the smaller the current remaining storage space, the larger N; specifically:
[0032] In an optional implementation, N is negatively linearly related to the current remaining storage space. Specifically, in an optional implementation, N=kx+b; wherein x is the difference between the preset effective space threshold and the current remaining storage space; k is the slope, which is a preset positive value; and b is a preset positive integer.
[0033] In an optional implementation manner, N is in a negative exponential relationship with the current remaining storage space.
[0034] In an optional implementation manner, N is in a negative logarithmic relationship with the current remaining storage space.
[0035] It should be noted that there are more than one way to determine N. You can also select according to the workload of the ZNS SSD. The lower the current workload, the larger N. For example, according to the workload of the ZNS SSD, when the workload is high, fewer areas are selected for regional recycling operations, and when the workload is low, more areas are selected for regional recycling operations. There is no limitation here.
[0036] In an optional implementation manner, the process of clearing the area to be reclaimed includes: after transferring valid data in the area to be reclaimed, resetting the area to be reclaimed.
[0037] In an optional implementation, valid data in the to-be-reclaimed area is transferred to other areas of the ZNS SSD except the to-be-reclaimed areas in the to-be-reclaimed area set, so as to avoid secondary transfer of valid data.
[0038] In order to further illustrate the regional recycling method of the ZNS SSD provided by the present invention, a specific embodiment is described in detail below:
[0039] Each data placement unit in the ZNS SSD area has three states, namely valid data state, invalid data state, and free space state. These three states are respectively recorded as "valid", "invalid", and "free" states; different states can transition to each other.
[0040] Figure 1 This is a flow chart of the regional recycling method of the ZNS SSD provided in this embodiment.
[0041] First, the usage of ZNS SSD is monitored in real time. This monitoring process involves continuous detection of the current remaining space of ZNS SSD. When the monitoring system finds that the remaining storage space of ZNS SSD falls below a preset effective space threshold (for example, 20% of the entire storage space size of ZNS SSD), it indicates that the storage device is about to face the problem of insufficient space. At this time, the zone recovery operation (ZC operation) will be triggered to free up space and maintain the normal operation of ZNS SSD.
[0042] After a zone reclamation operation is triggered, a scan is performed on all zones in the ZNS SSD to collect information about the amount of valid data, invalid data, and free space in each zone. Specifically, the following three key parameters in each zone are identified and recorded:
[0043] Valid data volume V: indicates the size of the space currently storing valid data in the area.
[0044] Invalid data amount I: indicates the size of the space currently storing invalid data in the area, that is, the size of the space storing deleted or obsolete data, which needs to be cleared to reclaim space.
[0045] Free space amount F: indicates the size of the free space in the area, that is, the space that is not allocated to any data.
[0046] Based on the above information, the present invention calculates the space utilization rate and data redundancy rate of each area, and uses this as the basis for scoring. The specific scoring formula is as follows:
[0047] Space utilization rate UR = (V + I) / (V + I + F);
[0048] The data redundancy rate is the ratio of the amount of invalid data to the amount of valid data, specifically: IV = I / V.
[0049] Regional score Score = UR × IV.
[0050] This scoring formula combines space utilization and data redundancy, and aims to select those areas with high space utilization and a large ratio of invalid data to valid data for priority cleaning.
[0051] After the scoring is completed, the scores of each region are sorted in descending order to generate a region list. This list will be used as a reference for ZC operations to determine which regions should be cleaned up first. The sorting process ensures that regions with a higher proportion of invalid data or lower space usage can be selected first, thereby optimizing the space recovery efficiency and improving space utilization.
[0052] On the basis of the sorting, the area that needs to be reclaimed (ZC operation) is further adaptively selected according to the current remaining storage space of the ZNS SSD. This adaptive selection process takes into account the overall space usage of the ZNS SSD and dynamically adjusts the number N of areas to be reclaimed for each ZC operation. The present invention has a variety of adaptive selection functions for determining N, such as linear functions, exponential functions, and logarithmic functions, so that the smaller the current remaining storage space, the larger N is, thereby adapting to different remaining storage space conditions and performance requirements.
[0053] Figure 2 This embodiment shows a complete process of scoring each area and making adaptive selections. Each small square in the figure represents a specific area, and V, I and F represent the space where valid data is located, the space where invalid data is located and the free space in the area, respectively. Through the diagram, the spatial distribution of each area can be intuitively seen, which helps to more accurately evaluate the score of each area.
[0054] The present invention can dynamically adjust the ZC operation strategy according to the actual usage of the ZNS SSD. Compared with the traditional ZC method, the present invention can not only reduce the accumulation of invalid data and improve the space utilization of the ZNS SSD, but also intelligently select the most suitable area for recycling according to the remaining space and performance requirements of the ZNS SSD, effectively extending the service life of the ZNS SSD.
[0055] Through experiments conducted on a real ZNS SSD ZN540, the present invention reduces the space amplification rate by 16.94% to 46.94% compared with the original ZNS SSD regional recycling method under different workloads, and at the same time increases the service life of the ZNS SSD by 11.41% to 23.39%. These experimental results fully demonstrate the significant advantages of the present invention in improving the regional recycling efficiency and space utilization of ZNS SSD.
[0056] On the basis of the above process, this embodiment further transfers the valid data in the to-be-reclaimed area to other areas of the ZNS SSD except the to-be-reclaimed areas in the to-be-reclaimed area set when cleaning the to-be-reclaimed area, and then resets the to-be-reclaimed area. The to-be-reclaimed areas in the to-be-reclaimed area set are excluded from the destination area for the valid data transfer, thereby achieving that the destination area is not an area that needs to be recycled, further avoiding the secondary transfer of valid data.
[0057] like Figure 3 The figure shows a comparison of the areas to be recycled selected by the regional recycling method of the ZNS SSD provided by the present invention and the original regional recycling method of the ZNS SSD. It can be seen from the figure that the present invention releases more effective space while transferring less data, thereby reducing the space magnification rate, and can trigger fewer regional resets while releasing the same or more space, thereby significantly improving the service life of the ZNS SSD.
[0058] The regional recycling method of the ZNS SSD provided by the present invention effectively improves the space utilization and service life of the ZNS SSD by accurately evaluating the internal conditions of each area and scoring it, and then dynamically selecting the area to be recycled according to the score.
[0059] In addition, the regional recycling method of the ZNS SSD of the present invention also has the following advantages:
[0060] Flexibility: The present invention can dynamically adjust the region selection strategy of the region recycling operation according to the actual usage of the ZNS SSD to adapt to different workloads and performance requirements.
[0061] High efficiency: The present invention accurately evaluates the internal conditions of each area and selects the area that is most in need of recycling to perform operations, thereby reducing the accumulation of invalid data and improving space utilization.
[0062] Long-term effectiveness: The present invention effectively prolongs the service life of ZNSSSD and reduces the cost of long-term use by reducing the accumulation of invalid data and optimizing the area recovery operation.
[0063] Compatibility: The present invention is compatible with existing ZNS SSDs and file systems (such as ZenFS) without the need to modify the hardware, and can be implemented simply through software upgrades.
[0064] Scalability: The design of the present invention takes into account ZNS SSDs of different types and capacities, and can adapt to different devices and application scenarios by adjusting parameters.
[0065] Security: When performing regional recovery operations, the present invention fully considers the security of data, avoids the loss and secondary transfer of valid data, and ensures the integrity and consistency of data.
[0066] In summary, the regional recycling method of ZNS SSD provided by the present invention effectively improves the regional recycling efficiency and space utilization of ZNS SSD through adaptive scoring and regional selection mechanism, solves the problems existing in the prior art, and has broad application prospects and practical value.
[0067] In a second aspect, the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the regional recycling method of the ZNS SSD provided in the first aspect of the present invention is implemented.
[0068] The related technical solution is the same as the regional recycling method of the ZNS SSD provided in the first aspect of the present invention, and will not be described in detail here.
[0069] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the regional recycling method of the ZNS SSD provided in the first aspect of the present invention is implemented.
[0070] The related technical solution is the same as the regional recycling method of the ZNS SSD provided in the first aspect of the present invention, and will not be described in detail here.
[0071] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. 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 present invention.
Claims
1. A regional recycling method for ZNS SSD, characterized in that: include: When the current remaining storage space of the ZNS SSD is less than the preset effective space threshold, the following area recovery operations are performed: the effective data volume V, invalid data volume I and free space volume F of each area in the ZNS SSD are obtained; the space utilization rate and data redundancy rate of each area are calculated, and the product of the two is calculated as the score of the area; Select N areas with the highest scores, and filter out areas with a score of 0, to obtain a set of areas to be recycled; clean up the areas to be recycled in the set of areas to be recycled; N≥1; Among them, the space utilization rate is (V+I) / (V+I+F); the data redundancy rate is I / V.
2. The regional recycling method of ZNS SSD according to claim 1, characterized in that: The smaller the current remaining storage space is, the larger N is.
3. The regional recycling method of ZNS SSD according to claim 2, characterized in that: N is in a negative linear relationship with the current remaining storage space.
4. The regional recycling method of ZNS SSD according to claim 3, characterized in that: N=kx+b; wherein x is the difference between the preset effective space threshold and the current remaining storage space; k is the slope, which is a preset positive value; and b is a preset positive integer.
5. The regional recycling method of ZNS SSD according to claim 2, characterized in that: N is in a negative exponential relationship with the current remaining storage space.
6. The regional recycling method of ZNS SSD according to claim 2, characterized in that: N is in a negative logarithmic relationship with the current remaining storage space.
7. The regional recycling method of ZNS SSD according to any one of claims 1 to 6, characterized in that: The process of cleaning the area to be reclaimed includes: after transferring the valid data in the area to be reclaimed, resetting the area to be reclaimed.
8. The regional recycling method of ZNS SSD according to claim 7, characterized in that: The valid data in the to-be-reclaimed area is transferred to other areas of the ZNS SSD except the to-be-reclaimed areas in the to-be-reclaimed area set.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the ZNS SSD area recovery method according to any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the regional recycling method of the ZNS SSD described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Key value storage system based on SCM and SSD and read-write request processing method
CN110968269A
Storage block processing method, device and equipment and storage medium
CN112306408A
Resource processing method and device
CN114647384A
Data processing method and device
CN114741326A
Flow control method and device of solid state disk (SSD), storage medium and equipment
CN116126253A
Cited By
Storage space recovery method, electronic equipment, storage medium and program product
CN120335733A
