Capacity reduction method and device of storage system, electronic equipment and storage medium

By using hash functions and hash bucket search mechanism in the storage system, the problem of long-term volume reduction operation in the prior art is solved, the capacity reduction efficiency is improved, and the performance needs after the equipment configuration is improved.

CN119440413AActive Publication Date: 2025-02-14INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411515323.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-14
Estimated Expiration
2044-10-29

AI Technical Summary

Technical Problem

When performing volume reduction operations, existing storage systems repeatedly traverse cached data to determine whether the data needs to be discarded, resulting in a long time consumption, affecting the timely processing of front-end input and output. As the device configuration improves, the capacity reduction efficiency decreases. .

Method used

Provide a storage system to reduce the capacity by receiving the capacity reduction request, obtain the number of capacity reduction tasks to be processed and the capacity reduction capacity of the volume, compare it with the preset threshold value, determine the single volume or multiple volume reduction conditions, and use The hash function finds and discards the data blocks to be discarded in the hash bucket, improving the efficiency of shrinking.

Benefits of technology

Through the search and traversal mechanism of hash bucket, the amount of cached data that needs to be accessed is significantly reduced, the response time of capacity reduction requests is shortened, the efficiency of single volume and multiple volume reduction is improved, and the reduction efficiency of configuration is reduced after capacity reduction is avoided The problem.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440413A_ABST
    Figure CN119440413A_ABST
Patent Text Reader

Abstract

The invention relates to a capacity reduction method and device of a storage system, electronic equipment and a storage medium. The method comprises the following steps: receiving a volume shrinking request, wherein the volume shrinking request comprises logic block addresses before and after volume shrinking; obtaining the number of to-be-processed capacity reduction tasks in the storage system and / or the capacity reduction capacity of a volume in the capacity reduction request, and comparing the number of the to-be-processed capacity reduction tasks and / or the capacity reduction capacity with a preset capacity reduction number threshold value and / or a capacity reduction capacity threshold value to obtain a first comparison result; in response to the condition that the first comparison result meets the single-curl capacity condition, finding out a data block to be discarded in a hash bucket according to the logic block addresses before and after the curl capacity and the size of the data block, and discarding the data block to be discarded; and in response to the fact that the first comparison result meets the multi-volume shrinkage condition, traversing the data blocks in the hash bucket, determining the data blocks to be discarded according to the volume IDs of the data blocks, the logic block addresses and the sizes of the data blocks, and discarding the data blocks to be discarded. By adopting the method, the volume reduction efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for reducing the capacity of a storage system. Background Art

[0002] In a centralized storage system, when a user needs to write data to a disk device, the data will be temporarily stored in memory according to certain rules. This part of the memory used to temporarily store user data is called a write cache. When a user needs to read data from a disk device, some of the data will also be temporarily stored in memory according to certain rules. This part of the memory used to temporarily store user data is called a read cache. In the read cache, when the user can directly read this part of data from the memory the next time he accesses it, instead of reading it from the disk, this process is called a cache hit. A cache hit will improve the efficiency of reading data, thereby improving the overall performance of the centralized storage system.

[0003] When the volume capacity is reduced according to customer needs, or in certain scenarios, the volume shrinking operation is automatically triggered, such as compressing the volume to overwrite data with a higher compression ratio, the volume shrinking operation needs to be performed. The volume shrinking operation will reduce the volume's LAB (Logical Block Address) range from the original LBA1 to LBA2. At this time, the cached data between LBA2 and LBA1 is no longer valid data, so we need to discard this part of the data.

[0004] Currently, it is generally determined whether the data needs to be discarded by repeatedly traversing all cached data. The process of repeatedly traversing the cached data takes a long time, resulting in the front-end input and output not being processed in time, causing interruptions. In addition, as device configurations continue to improve, the increase in memory will lead to a large increase in the amount of cached data, resulting in a high configuration but lower shrinking efficiency.

[0005] Therefore, there is an urgent need to provide a storage system capacity reduction method, device, electronic device and storage medium that can improve the capacity reduction efficiency. Summary of the invention

[0006] Based on this, it is necessary to provide a storage system capacity reduction method, device, electronic device and storage medium that improve the capacity reduction efficiency in order to solve the above technical problems.

[0007] In a first aspect, a method for reducing the capacity of a storage system is provided, the method comprising:

[0008] receiving a shrink request, wherein the shrink request includes logical block addresses before and after the volume is shrunk;

[0009] Obtaining the number of pending shrinking tasks in the storage system and / or the shrinking capacity of the volume in the shrinking request, and comparing the number of pending shrinking tasks and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to obtain a first comparison result;

[0010] In response to the first comparison result satisfying the single volume shrinking condition, searching for the data blocks to be discarded in the hash bucket based on the hash function according to the logical block addresses and data block sizes before and after the volume shrinking, discarding the data blocks to be discarded, and ending the single volume shrinking operation;

[0011] In response to the first comparison result satisfying the multi-volume shrinking condition, traverse each data block in the hash bucket, determine the data block to be discarded according to the volume ID, logical block address and data block size of each data block, discard the data block to be discarded, and end the multi-volume shrinking operation.

[0012] In one embodiment,

[0013] The single volume shrinking condition is: the number of shrinking tasks to be processed is less than or equal to the shrinking quantity threshold, and / or the shrinking capacity of the volume is less than or equal to the shrinking capacity threshold;

[0014] The multi-volume shrinking condition is: the number of shrinking tasks to be processed is greater than the shrinking quantity threshold, and / or the shrinking capacity of the volume is greater than the shrinking capacity threshold.

[0015] In one embodiment, searching for the data blocks to be discarded in a hash bucket based on a hash function according to the logical block addresses and data block sizes before and after the volume is reduced, and discarding the data blocks to be discarded includes:

[0016] Calculating a range of logical block addresses to be discarded according to the logical block addresses before and after the volume is reduced in capacity;

[0017] Dividing the address range of the to-be-discarded logical blocks according to the size of the data blocks to obtain the number of the to-be-searched data blocks;

[0018] Calculate the hash value of each data block to be found based on the hash function according to the volume ID and the logical block address of each data block to be found;

[0019] According to the hash value of each data block to be found, the data block to be discarded is found in the hash bucket, and the data block to be discarded is discarded.

[0020] In one embodiment, traversing each data block in the hash bucket, determining the data block to be discarded according to the volume ID, logical block address and data block size of each data block, and discarding the data block to be discarded includes:

[0021] Traversing each data block in the hash bucket and screening out a data block to be determined, wherein the data block to be determined stores data;

[0022] Extracting the association identifier of the to-be-determined data block, wherein the association identifier includes a volume ID, a logical block address, and a data block size;

[0023] Obtaining a volume ID in the shrink request, and comparing the volume ID of the to-be-determined data block with the volume ID in the shrink request to obtain a second comparison result;

[0024] In response to the second comparison result being consistent, calculating a range of logical block addresses to be discarded according to the logical block addresses before and after the volume is reduced in capacity;

[0025] Comparing the logical block address of the to-be-determined data block with the to-be-discarded logical block address range to obtain a third comparison result;

[0026] In response to the third comparison result indicating that the logical block address of the to-be-determined data block is within the to-be-discarded logical block address range, comparing the data block size of the to-be-determined data block with the to-be-discarded logical block address range to obtain a fourth comparison result;

[0027] In response to the fourth comparison result indicating that the to-be-determined data block is completely or partially located within the to-be-discarded logical block address range, data in the to-be-determined data block that is within the to-be-discarded logical block address range is discarded.

[0028] In one of the embodiments, after discarding the data or data block, the method further comprises:

[0029] Recording the response time of the scaling-down request in real time, and comparing the response time with a preset time threshold to obtain a fifth comparison result;

[0030] In response to the fifth comparison result indicating that the response time is greater than or equal to the time threshold, setting the current scaling-down task to a waiting state until the next scheduling continues to execute;

[0031] In response to the fifth comparison result indicating that the response time is less than the time threshold, the capacity reduction task in the storage system continues to be executed.

[0032] In one of the embodiments, after discarding the data or data block, the method further comprises:

[0033] Recording the number of discarded data in real time, and comparing the number of discarded data with a preset data discard threshold to obtain a sixth comparison result;

[0034] In response to the sixth comparison result indicating that the number of discarded data is greater than or equal to the data discard threshold, setting the current shrinking task to a waiting state until the next scheduling continues to execute;

[0035] In response to the sixth comparison result indicating that the number of discarded data is less than the data discarding threshold, the capacity reduction task in the storage system continues to be executed.

[0036] In one embodiment, the method for constructing the hash bucket includes:

[0037] According to the requirements of the storage system, create an array with an initial capacity as a set of hash buckets;

[0038] A hash function is defined, and a volume ID, a logical block address, and a data block size of the cached data are calculated based on the hash function to obtain a hash value of the cached data;

[0039] The cached data and the hash value of the cached data are taken as a key-value pair and saved in a linked list at a corresponding position of the hash bucket.

[0040] In a second aspect, a storage system capacity reduction device is provided, the device comprising:

[0041] A receiving module, the receiving module is used to receive a shrink request, wherein the shrink request includes logical block addresses before and after the volume is shrunk;

[0042] An acquisition and comparison module, wherein the acquisition and comparison module is used to acquire the number of pending shrinking tasks in the storage system and / or the shrinking capacity of the volume in the shrinking request, and compare the number of pending shrinking tasks and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to obtain a first comparison result;

[0043] A search and discard module, wherein the search and discard module is used to search for data blocks to be discarded in a hash bucket based on a hash function according to the logical block addresses and data block sizes before and after the volume is reduced in response to the first comparison result satisfying the single volume reduction condition, and discard the data blocks to be discarded, thereby ending the single volume reduction operation;

[0044] A traversal and discarding module is used to traverse each data block in the hash bucket in response to the first comparison result satisfying the multi-volume shrinking condition, determine the data block to be discarded according to the volume ID, logical block address and data block size of each data block, and discard the data block to be discarded, thereby ending the multi-volume shrinking operation.

[0045] In a third aspect, an electronic device is provided, comprising one or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions, which, when read and executed by the one or more processors, execute the steps of the method described in any one of the first aspects above.

[0046] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in any one of the first aspects are performed.

[0047] In a fifth aspect, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the method described in any one of the above-mentioned first aspects are implemented.

[0048] The shrinking method, device, electronic device and storage medium of the storage system described above compare the number of shrinking tasks to be processed and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to determine whether to perform a single volume shrinking operation or a multi-volume shrinking operation, thereby improving the shrinking efficiency of single volumes and multiple volumes. According to the logical block address and data block size before and after the volume shrinking, the data blocks to be discarded are found in the hash bucket based on the hash function, thereby improving the shrinking efficiency of single volumes. Each data block in the hash bucket is traversed, and the data blocks to be discarded are determined according to the volume ID, logical block address and data block size of each data block, thereby improving the shrinking efficiency of multiple volumes. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 A schematic diagram of cache data organization and storage system scaling in one embodiment;

[0050] Figure 2 is a schematic flow chart of a method for reducing the capacity of a storage system in one embodiment;

[0051] Figure 3 A detailed schematic diagram of a method for reducing the capacity of a storage system;

[0052] Figure 4 is a structural block diagram of a capacity reduction device of a storage system in one embodiment;

[0053] Figure 5 FIG. 4 is a diagram showing the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application 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 application and are not used to limit the present application.

[0055] Embodiment 1

[0056] In one embodiment, Figure 1 , Figure 2 , Figure 3 As shown, a method for reducing the capacity of a storage system is provided, the method comprising:

[0057] receiving a shrink request, wherein the shrink request includes logical block addresses before and after the volume is shrunk;

[0058] Obtaining the number of pending shrinking tasks in the storage system and / or the shrinking capacity of the volume in the shrinking request, and comparing the number of pending shrinking tasks and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to obtain a first comparison result;

[0059] In response to the first comparison result satisfying the single volume shrinking condition, searching for the data blocks to be discarded in the hash bucket based on the hash function according to the logical block addresses and data block sizes before and after the volume shrinking, discarding the data blocks to be discarded, and ending the single volume shrinking operation;

[0060] In response to the first comparison result satisfying the multi-volume shrinking condition, traverse each data block in the hash bucket, determine the data block to be discarded according to the volume ID, logical block address and data block size of each data block, discard the data block to be discarded, and end the multi-volume shrinking operation.

[0061] In a specific embodiment, the reduction quantity threshold can be set according to the number of processors and performance parameters of the storage system; the reduction capacity represents the size of the capacity that needs to be discarded of the storage volume, and the reduction capacity threshold can also be set according to the number of processors and performance parameters of the storage system.

[0062] Specifically, the number of shrinking tasks to be processed and / or the shrinking capacity of the volume are compared with a preset shrinking quantity threshold and / or shrinking capacity threshold to determine whether to perform a single volume shrinking operation or a multi-volume shrinking operation, thereby improving the shrinking efficiency of single volumes and multiple volumes. According to the logical block address and data block size before and after the volume shrinking, the data block to be discarded is found in the hash bucket based on the hash function, thereby improving the shrinking efficiency of single volumes. Each data block in the hash bucket is traversed, and the data block to be discarded is determined according to the volume ID, logical block address and data block size of each data block, thereby improving the shrinking efficiency of multiple volumes.

[0063] In one embodiment,

[0064] The single volume shrinking condition is: the number of shrinking tasks to be processed is less than or equal to the shrinking quantity threshold, and / or the shrinking capacity of the volume is less than or equal to the shrinking capacity threshold;

[0065] The multi-volume shrinking condition is: the number of shrinking tasks to be processed is greater than the shrinking quantity threshold, and / or the shrinking capacity of the volume is greater than the shrinking capacity threshold.

[0066] In one embodiment, searching for the data blocks to be discarded in a hash bucket based on a hash function according to the logical block addresses and data block sizes before and after the volume is reduced, and discarding the data blocks to be discarded includes:

[0067] Calculating a range of logical block addresses to be discarded according to the logical block addresses before and after the volume is reduced in capacity;

[0068] Dividing the address range of the to-be-discarded logical blocks according to the size of the data blocks to obtain the number of the to-be-searched data blocks;

[0069] Calculate the hash value of each data block to be found based on the hash function according to the volume ID and the logical block address of each data block to be found;

[0070] According to the hash value of each data block to be found, the data block to be discarded is found in the hash bucket, and the data block to be discarded is discarded.

[0071] Specifically, by utilizing the search function of the hash bucket, data can be searched in a targeted manner within a range, which greatly reduces the amount of cache data that needs to be accessed, thereby shortening the response time of the shrinking request and improving the shrinking efficiency.

[0072] In one embodiment, traversing each data block in the hash bucket, determining the data block to be discarded according to the volume ID, logical block address and data block size of each data block, and discarding the data block to be discarded includes:

[0073] Traversing each data block in the hash bucket and screening out a data block to be determined, wherein the data block to be determined stores data;

[0074] Extracting the association identifier of the to-be-determined data block, wherein the association identifier includes a volume ID, a logical block address, and a data block size;

[0075] Obtaining a volume ID in the shrink request, and comparing the volume ID of the to-be-determined data block with the volume ID in the shrink request to obtain a second comparison result;

[0076] In response to the second comparison result being consistent, calculating a range of logical block addresses to be discarded according to the logical block addresses before and after the volume is reduced in capacity;

[0077] Comparing the logical block address of the to-be-determined data block with the to-be-discarded logical block address range to obtain a third comparison result;

[0078] In response to the third comparison result indicating that the logical block address of the to-be-determined data block is within the to-be-discarded logical block address range, comparing the data block size of the to-be-determined data block with the to-be-discarded logical block address range to obtain a fourth comparison result;

[0079] In response to the fourth comparison result indicating that the to-be-determined data block is completely or partially located within the to-be-discarded logical block address range, data in the to-be-determined data block that is within the to-be-discarded logical block address range is discarded.

[0080] Specifically, when the number of the to-be-processed shrinking tasks is greater than the shrinking quantity threshold, and / or the shrinking capacity of the volume is greater than the shrinking capacity threshold, by traversing each data block in the hash bucket, the overall time consumption of executing a large number of volume shrinking processes is reduced.

[0081] In one embodiment, after discarding the data or data block, the method further comprises:

[0082] Recording the response time of the scaling-down request in real time, and comparing the response time with a preset time threshold to obtain a fifth comparison result;

[0083] In response to the fifth comparison result indicating that the response time is greater than or equal to the time threshold, setting the current scaling-down task to a waiting state until the next scheduling continues to execute;

[0084] In response to the fifth comparison result indicating that the response time is less than the time threshold, the capacity reduction task in the storage system continues to be executed.

[0085] In a specific embodiment, the time threshold is generally set to 5 ms.

[0086] Specifically, the task switching control of the processor is performed based on the response time of the current scaling-down request, which can not only ensure that the scaling-down task does not take up too much time for the low-performance processor, but also improve the utilization rate of the high-performance processor.

[0087] In one embodiment, after discarding the data or data block, the method further comprises:

[0088] Recording the number of discarded data in real time, and comparing the number of discarded data with a preset data discard threshold to obtain a sixth comparison result;

[0089] In response to the sixth comparison result indicating that the number of discarded data is greater than or equal to the data discard threshold, setting the current shrinking task to a waiting state until the next scheduling continues to execute;

[0090] In response to the sixth comparison result indicating that the number of discarded data is less than the data discarding threshold, the capacity reduction task in the storage system continues to be executed.

[0091] In a specific embodiment, the data discarding threshold is generally set to 100.

[0092] In one embodiment, the method for constructing the hash bucket includes:

[0093] According to the requirements of the storage system, create an array with an initial capacity as a set of hash buckets;

[0094] A hash function is defined, and a volume ID, a logical block address, and a data block size of the cached data are calculated based on the hash function to obtain a hash value of the cached data;

[0095] The cached data and the hash value of the cached data are taken as a key-value pair and saved in a linked list at a corresponding position of the hash bucket.

[0096] Specifically, the cached data and the hash value of the cached data are taken as a key-value pair and saved in a linked list at a corresponding position of the hash bucket, so as to facilitate data search in a subsequent single volume shrinking operation.

[0097] In one embodiment, discarding data or data blocks includes:

[0098] Monitoring the usage of the storage system, wherein the usage includes the total amount of data to be discarded;

[0099] Calculate the maximum amount of discarded data in each batch according to the total amount of data to be discarded and a preset discarding threshold;

[0100] According to the preset elimination rules, the data to be discarded are sorted from high to low according to the priority, wherein the elimination rules include a first-in-first-out rule, a least recently used rule, and a least frequently used rule;

[0101] Based on the maximum amount of discarded data in each batch and the elimination rule, removing the data with the highest priority among the data to be discarded from the storage system in batches;

[0102] While removing the highest priority data from the storage system, continuously monitoring the operating status and performance data of the storage system;

[0103] In response to the storage system operating abnormally or the performance data decreasing, adjusting the maximum amount of discarded data in each batch until the storage system operates normally or the performance data remains unchanged or increases;

[0104] The detailed information of each discard operation is recorded, wherein the detailed information includes the discard time, discarded data volume, and discard reason, so as to facilitate subsequent performance analysis and troubleshooting.

[0105] Specifically, the discard threshold can be set according to the number of processors and performance parameters of the storage system. By selecting an appropriate elimination algorithm, determining a reasonable discard threshold and batch size, selecting the data to be discarded and performing the discard operation, and continuously monitoring and feeding back the system's performance and stability indicators, a balance between performance and stability can be achieved in the storage system.

[0106] It should be understood that although Figure 2 , Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , Figure 3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0107] Embodiment 2

[0108] In one embodiment, Figure 4 As shown, a storage system capacity reduction device is provided, the device comprising:

[0109] A receiving module, the receiving module is used to receive a shrink request, wherein the shrink request includes logical block addresses before and after the volume is shrunk;

[0110] An acquisition and comparison module, wherein the acquisition and comparison module is used to acquire the number of pending shrinking tasks in the storage system and / or the shrinking capacity of the volume in the shrinking request, and compare the number of pending shrinking tasks and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to obtain a first comparison result;

[0111] A search and discard module, wherein the search and discard module is used to search for data blocks to be discarded in a hash bucket based on a hash function according to the logical block addresses and data block sizes before and after the volume is reduced in response to the first comparison result satisfying the single volume reduction condition, and discard the data blocks to be discarded, thereby ending the single volume reduction operation;

[0112] A traversal and discarding module is used to traverse each data block in the hash bucket in response to the first comparison result satisfying the multi-volume shrinking condition, determine the data block to be discarded according to the volume ID, logical block address and data block size of each data block, and discard the data block to be discarded, thereby ending the multi-volume shrinking operation.

[0113] In one embodiment, the search and discard module is specifically used to:

[0114] Calculating a range of logical block addresses to be discarded according to the logical block addresses before and after the volume is reduced in capacity;

[0115] Dividing the address range of the to-be-discarded logical blocks according to the size of the data blocks to obtain the number of the to-be-searched data blocks;

[0116] Calculate the hash value of each data block to be found based on the hash function according to the volume ID and the logical block address of each data block to be found;

[0117] According to the hash value of each data block to be found, the data block to be discarded is found in the hash bucket, and the data block to be discarded is discarded.

[0118] In one embodiment, the traversal and discarding module is specifically used to:

[0119] Traversing each data block in the hash bucket and screening out a data block to be determined, wherein the data block to be determined stores data;

[0120] Extracting the association identifier of the to-be-determined data block, wherein the association identifier includes a volume ID, a logical block address, and a data block size;

[0121] Obtaining a volume ID in the shrink request, and comparing the volume ID of the to-be-determined data block with the volume ID in the shrink request to obtain a second comparison result;

[0122] In response to the second comparison result being consistent, calculating a range of logical block addresses to be discarded according to the logical block addresses before and after the volume is reduced in capacity;

[0123] Comparing the logical block address of the to-be-determined data block with the to-be-discarded logical block address range to obtain a third comparison result;

[0124] In response to the third comparison result indicating that the logical block address of the to-be-determined data block is within the to-be-discarded logical block address range, comparing the data block size of the to-be-determined data block with the to-be-discarded logical block address range to obtain a fourth comparison result;

[0125] In response to the fourth comparison result indicating that the to-be-determined data block is completely or partially located within the to-be-discarded logical block address range, data in the to-be-determined data block that is within the to-be-discarded logical block address range is discarded.

[0126] In one embodiment, after discarding the data or the data block, the apparatus further comprises:

[0127] a first recording and comparing module, the first recording and comparing module being used to record the response time of the shrink request in real time, and compare the response time with a preset time threshold to obtain a fifth comparison result;

[0128] A first setting module, the first setting module is used for setting the current scaling-down task to a waiting state in response to the fifth comparison result indicating that the response time is greater than or equal to the time threshold until the next scheduling continues to execute;

[0129] A first execution module, wherein the first execution module is used for continuing to execute the capacity reduction task in the storage system in response to the fifth comparison result indicating that the response time is less than the time threshold.

[0130] In one embodiment, after discarding the data or the data block, the apparatus further comprises:

[0131] a second recording and comparing module, the second recording and comparing module being used to record the number of discarded data in real time, and compare the number of discarded data with a preset data discarding threshold to obtain a sixth comparison result;

[0132] A second setting module, the second setting module is used for setting the current shrinking task to a waiting state until the next scheduling continues to be executed in response to the sixth comparison result indicating that the number of discarded data is greater than or equal to the data discarding threshold;

[0133] The second execution module is used for continuing to execute the shrinking task in the storage system in response to the sixth comparison result indicating that the number of discarded data is less than the data discarding threshold.

[0134] In one embodiment, the device further includes a construction module, and the construction module is used to construct the hash bucket, including:

[0135] According to the requirements of the storage system, create an array with an initial capacity as a set of hash buckets;

[0136] A hash function is defined, and a volume ID, a logical block address, and a data block size of the cached data are calculated based on the hash function to obtain a hash value of the cached data;

[0137] The cached data and the hash value of the cached data are taken as a key-value pair and saved in a linked list at a corresponding position of the hash bucket.

[0138] For the specific definition of the storage system's capacity reduction device, please refer to the definition of the storage system's capacity reduction method above, which will not be repeated here. Each module in the above-mentioned storage system's capacity reduction device can be implemented in whole or in part through software, hardware, and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0139] Embodiment 3

[0140] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0141] receiving a shrink request, wherein the shrink request includes logical block addresses before and after the volume is shrunk;

[0142] Obtaining the number of pending shrinking tasks in the storage system and / or the shrinking capacity of the volume in the shrinking request, and comparing the number of pending shrinking tasks and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to obtain a first comparison result;

[0143] In response to the first comparison result satisfying the single volume shrinking condition, searching for the data blocks to be discarded in the hash bucket based on the hash function according to the logical block addresses and data block sizes before and after the volume shrinking, discarding the data blocks to be discarded, and ending the single volume shrinking operation;

[0144] In response to the first comparison result satisfying the multi-volume shrinking condition, traverse each data block in the hash bucket, determine the data block to be discarded according to the volume ID, logical block address and data block size of each data block, discard the data block to be discarded, and end the multi-volume shrinking operation.

[0145] When the program instructions are read and executed by the one or more processors, the program instructions may also perform operations corresponding to the steps in the above method embodiments, and the above description may be referred to, which will not be repeated here. Figure 5 , which exemplarily shows the architecture of an electronic device, which may specifically include a processor 510, a video display adapter 511, a disk drive 512, an input / output interface 513, a network interface 514, and a memory 520. The processor 510, the video display adapter 511, the disk drive 512, the input / output interface 513, the network interface 514, and the memory 520 may be communicatively connected via a communication bus 530.

[0146] Among them, the processor 510 can be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solution provided in this application.

[0147] The memory 520 can be implemented in the form of a read-only memory (ROM), a random access memory (RAM), a static storage device, a dynamic storage device, etc. The memory 520 can store an operating system 521 for controlling the operation of the electronic device 500, and a basic input and output system (BIOS) 522 for controlling the low-level operation of the electronic device 500. In addition, a web browser 523, a data storage manager 524, and an icon font processing system 525, etc. can also be stored. The above-mentioned icon font processing system 525 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided in the present application is implemented by software or firmware, the relevant program code is stored in the memory 520 and is called and executed by the processor 510.

[0148] The input / output interface 513 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0149] The network interface 514 is used to connect to a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0150] The bus 530 comprises a pathway for transmitting information between the various components of the device (eg, the processor 510, the video display adapter 511, the disk drive 512, the input / output interface 513, the network interface 514, and the memory 520).

[0151] In addition, the electronic device 500 can also obtain information on specific collection conditions from the virtual resource object collection condition information database 541 for use in condition judgment, etc.

[0152] It should be noted that, although the electronic device 500 only shows a processor 510, a video display adapter 511, a disk drive 512, an input / output interface 513, a network interface 514, a memory 520, a bus 530, etc., in the specific implementation process, the electronic device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.

[0153] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., including several instructions for enabling an electronic device (which can be a personal computer, a cloud server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0154] Embodiment 4

[0155] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0156] receiving a shrink request, wherein the shrink request includes logical block addresses before and after the volume is shrunk;

[0157] Obtaining the number of pending shrinking tasks in the storage system and / or the shrinking capacity of the volume in the shrinking request, and comparing the number of pending shrinking tasks and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to obtain a first comparison result;

[0158] In response to the first comparison result satisfying the single volume shrinking condition, searching for the data blocks to be discarded in the hash bucket based on the hash function according to the logical block addresses and data block sizes before and after the volume shrinking, discarding the data blocks to be discarded, and ending the single volume shrinking operation;

[0159] In response to the first comparison result satisfying the multi-volume shrinking condition, traverse each data block in the hash bucket, determine the data block to be discarded according to the volume ID, logical block address and data block size of each data block, discard the data block to be discarded, and end the multi-volume shrinking operation.

[0160] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0161] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0162] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

[0163] Embodiment 5

[0164] In one embodiment, a computer program product is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0165] receiving a shrink request, wherein the shrink request includes logical block addresses before and after the volume is shrunk;

[0166] Obtaining the number of pending shrinking tasks in the storage system and / or the shrinking capacity of the volume in the shrinking request, and comparing the number of pending shrinking tasks and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to obtain a first comparison result;

[0167] In response to the first comparison result satisfying the single volume shrinking condition, searching for the data blocks to be discarded in the hash bucket based on the hash function according to the logical block addresses and data block sizes before and after the volume shrinking, discarding the data blocks to be discarded, and ending the single volume shrinking operation;

[0168] In response to the first comparison result satisfying the multi-volume shrinking condition, traverse each data block in the hash bucket, determine the data block to be discarded according to the volume ID, logical block address and data block size of each data block, discard the data block to be discarded, and end the multi-volume shrinking operation.

[0169] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program. The computer program can be stored in a computer program product. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods.

[0170] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0171] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for reducing the capacity of a storage system, characterized in that: The method comprises: receiving a shrink request, wherein the shrink request includes logical block addresses before and after the volume is shrunk; Obtaining the number of pending shrinking tasks in the storage system and / or the shrinking capacity of the volume in the shrinking request, and comparing the number of pending shrinking tasks and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to obtain a first comparison result; In response to the first comparison result satisfying the single volume shrinking condition, searching for the data blocks to be discarded in the hash bucket based on the hash function according to the logical block addresses and data block sizes before and after the volume shrinking, discarding the data blocks to be discarded, and ending the single volume shrinking operation; In response to the first comparison result satisfying the multi-volume shrinking condition, traverse each data block in the hash bucket, determine the data block to be discarded according to the volume ID, logical block address and data block size of each data block, discard the data block to be discarded, and end the multi-volume shrinking operation.

2. The method according to claim 1, characterized in that: The single volume shrinking condition is: the number of shrinking tasks to be processed is less than or equal to the shrinking quantity threshold, and / or the shrinking capacity of the volume is less than or equal to the shrinking capacity threshold; The multi-volume shrinking condition is: the number of shrinking tasks to be processed is greater than the shrinking quantity threshold, and / or the shrinking capacity of the volume is greater than the shrinking capacity threshold.

3. The method according to claim 1, characterized in that: The step of searching for the data blocks to be discarded in the hash bucket based on the hash function according to the logical block addresses and data block sizes before and after the volume is reduced, and discarding the data blocks to be discarded includes: Calculating a range of logical block addresses to be discarded according to the logical block addresses before and after the volume is reduced in capacity; Dividing the address range of the to-be-discarded logical blocks according to the size of the data blocks to obtain the number of the to-be-searched data blocks; Calculate the hash value of each data block to be found based on the hash function according to the volume ID and the logical block address of each data block to be found; According to the hash value of each data block to be found, the data block to be discarded is found in the hash bucket, and the data block to be discarded is discarded.

4. The method according to claim 1, characterized in that: The traversing each data block in the hash bucket, determining the data block to be discarded according to the volume ID, the logical block address and the data block size of each data block, and discarding the data block to be discarded includes: Traversing each data block in the hash bucket and screening out a data block to be determined, wherein the data block to be determined stores data; Extracting the association identifier of the to-be-determined data block, wherein the association identifier includes a volume ID, a logical block address, and a data block size; Obtaining a volume ID in the shrink request, and comparing the volume ID of the to-be-determined data block with the volume ID in the shrink request to obtain a second comparison result; In response to the second comparison result being consistent, calculating a range of logical block addresses to be discarded according to the logical block addresses before and after the volume is reduced in capacity; Comparing the logical block address of the to-be-determined data block with the to-be-discarded logical block address range to obtain a third comparison result; In response to the third comparison result indicating that the logical block address of the to-be-determined data block is within the to-be-discarded logical block address range, comparing the data block size of the to-be-determined data block with the to-be-discarded logical block address range to obtain a fourth comparison result; In response to the fourth comparison result indicating that the to-be-determined data block is completely or partially located within the to-be-discarded logical block address range, data in the to-be-determined data block that is within the to-be-discarded logical block address range is discarded.

5. The method according to claim 3 or 4, characterized in that: After discarding the data or data blocks, the method further comprises: Recording the response time of the scaling-down request in real time, and comparing the response time with a preset time threshold to obtain a fifth comparison result; In response to the fifth comparison result indicating that the response time is greater than or equal to the time threshold, setting the current scaling-down task to a waiting state until the next scheduling continues to execute; In response to the fifth comparison result indicating that the response time is less than the time threshold, the capacity reduction task in the storage system continues to be executed.

6. The method according to claim 3 or 4, characterized in that: After discarding the data or data blocks, the method further comprises: Recording the number of discarded data in real time, and comparing the number of discarded data with a preset data discarding threshold to obtain a sixth comparison result; In response to the sixth comparison result indicating that the number of discarded data is greater than or equal to the data discard threshold, setting the current shrinking task to a waiting state until the next scheduling continues to execute; In response to the sixth comparison result indicating that the number of discarded data is less than the data discard threshold, the capacity reduction task in the storage system continues to be executed.

7. The method according to claim 1, characterized in that: The method for constructing the hash bucket includes: According to the requirements of the storage system, create an array with an initial capacity as a set of hash buckets; A hash function is defined, and a volume ID, a logical block address, and a data block size of the cached data are calculated based on the hash function to obtain a hash value of the cached data; The cached data and the hash value of the cached data are taken as a key-value pair and saved in a linked list at a corresponding position of the hash bucket.

8. A storage system capacity reduction device, characterized in that: The device comprises: A receiving module, the receiving module is used to receive a shrink request, wherein the shrink request includes a logical block address before and after the volume is shrunk; An acquisition and comparison module, wherein the acquisition and comparison module is used to acquire the number of pending shrinking tasks in the storage system and / or the shrinking capacity of the volume in the shrinking request, and compare the number of pending shrinking tasks and / or the shrinking capacity of the volume with a preset shrinking quantity threshold and / or shrinking capacity threshold to obtain a first comparison result; A search and discard module, wherein the search and discard module is used to search for data blocks to be discarded in a hash bucket based on a hash function according to the logical block addresses and data block sizes before and after the volume is reduced in response to the first comparison result satisfying the single volume reduction condition, and discard the data blocks to be discarded, thereby ending the single volume reduction operation; A traversal and discarding module is used to traverse each data block in the hash bucket in response to the first comparison result satisfying the multi-volume shrinking condition, determine the data block to be discarded according to the volume ID, logical block address and data block size of each data block, and discard the data block to be discarded, thereby ending the multi-volume shrinking operation.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Container memory adjusting method and device

    CN112835685A

  • Resource management method and device, electronic equipment and storage medium

    CN114650392A

  • Data volume shrinking method and device and storage medium

    CN116048855A

  • Persistent volume capacity management processing method and device

    CN117806543A

  • Operation method and device of hybrid multi-volume structure key value storage system in cloud environment

    CN118838540A