A method, apparatus, electronic device, and storage medium for reducing the size of a storage system.

By using hash functions and hash bucket technology in the storage system, the data blocks to be discarded are efficiently determined based on the logical block address and data block size, which solves the problem of low scaling efficiency in the existing technology and achieves faster response time and higher device performance.

CN119440413BActive Publication Date: 2026-04-03INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies suffer from low scaling efficiency when performing volume reduction operations, leading to interruptions in front-end input and output, especially when the amount of cached data increases with improved device configuration.

Method used

By receiving a shrinkage request, the system uses a hash function to search for data blocks to be discarded in the hash bucket, and compares the logical block address and data block size to determine the data blocks to be discarded. The system then performs efficient discarding operations using single-volume or multi-volume shrinkage conditions.

Benefits of technology

It improves the efficiency of single-volume and multi-volume scaling down, reduces the amount of cached data, shortens the response time of scaling down requests, and avoids device performance degradation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440413B_ABST
    Figure CN119440413B_ABST
Patent Text Reader

Abstract

This application relates to a method, apparatus, electronic device, and storage medium for scaling down a storage system. The method includes: receiving a scaling down request, the request including logical block addresses before and after volume scaling down; obtaining the number of unprocessed scaling down tasks in the storage system and / or the scaling down capacity of the volume in the scaling down request, and comparing them with preset scaling down quantity thresholds and / or scaling down capacity thresholds respectively to obtain a first comparison result; in response to the first comparison result satisfying a single-volume scaling down condition, searching for data blocks to be discarded in a hash bucket based on the logical block addresses before and after volume scaling down and the data block size, and discarding the data blocks to be discarded; in response to the first comparison result satisfying a multi-volume scaling down condition, traversing the data blocks in the hash bucket, determining the data blocks to be discarded based on the volume ID, logical block address, and data block size of the data blocks, and discarding the data blocks to be discarded. This method can improve scaling down efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, electronic device and storage medium for reducing the size of a storage system. Background Technology

[0002] In a centralized storage system, when a user needs to write data to a disk device, the data is temporarily stored in memory according to certain rules. This portion of memory used for temporarily storing user data is called the write cache. Similarly, when a user needs to read data from a disk device, some data is also temporarily stored in memory according to certain rules. This portion of memory used for temporarily storing user data is called the read cache. When a user can directly read this data from memory the next time they access it, without needing to read it from the disk, this process is called a cache hit. Cache hits improve data read efficiency, thereby improving the overall performance of the centralized storage system.

[0003] When reducing volume capacity based on customer needs, or when automatically triggering volume shrinking operations in certain scenarios, such as compressing a volume to overwrite data with a higher compression ratio, a volume shrinking operation is required. The volume shrinking operation reduces the volume's LAB (Logical Block Address) range from LBA1 to LBA2. At this point, cached data located between LBA2 and LBA1 is no longer valid, so we need to discard this data.

[0004] Currently, the determination of whether data needs to be discarded is generally done by repeatedly traversing all cached data. This process of repeatedly traversing cached data takes a long time, which leads to the front-end input and output not being processed in a timely manner, causing interruptions. Furthermore, as device configurations continue to improve, the increase in memory will lead to a significant increase in the amount of cached data, resulting in a situation where the configuration is high but the scaling efficiency is lower.

[0005] Therefore, there is an urgent need to propose a method, device, electronic device, and storage medium for reducing the capacity of storage systems that can improve the efficiency of capacity reduction. Summary of the Invention

[0006] Therefore, it is necessary to provide a method, apparatus, electronic device, and storage medium for reducing the capacity of a storage system to improve the efficiency of capacity reduction, in order to address the above-mentioned technical problems.

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

[0008] Receive a scaling-down request, wherein the scaling-down request includes the logical block addresses before and after the volume scaling-down;

[0009] Obtain the number of shrinkage tasks to be processed in the storage system and / or the shrinkage capacity of the volume in the shrinkage request, and compare the number of shrinkage tasks to be processed and / or the shrinkage capacity of the volume with a preset shrinkage quantity threshold and / or shrinkage capacity threshold to obtain a first comparison result;

[0010] In response to the first comparison result satisfying the single-volume shrinkage condition, based on the logical block address and data block size before and after the volume shrinkage, the data block to be discarded is found in the hash bucket based on the hash function, and the data block to be discarded is discarded, thus ending the single-volume shrinkage operation;

[0011] In response to the first comparison result satisfying the multi-volume shrinkage condition, 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, and the data block to be discarded is discarded, thus ending the multi-volume shrinkage operation.

[0012] In one embodiment,

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

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

[0015] In one embodiment, the step of finding the data block to be discarded in the hash bucket based on the logical block address and data block size before and after the shrinking and resizing, and then discarding the data block to be discarded, includes:

[0016] Based on the logical block addresses before and after the shrinking, calculate the range of logical block addresses to be discarded;

[0017] The range of logical blocks to be discarded is divided according to the size of the data blocks to obtain the number of data blocks to be searched;

[0018] The hash value of each data block to be searched is calculated based on the volume ID and logical block address of each data block to be searched, using the hash function.

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

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

[0021] Traverse each data block in the hash bucket and filter out the data blocks to be determined, wherein the data blocks to be determined contain data;

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

[0023] Obtain the volume ID from the scaling-down request, and compare the volume ID of the data block to be determined with the volume ID from the scaling-down request to obtain a second comparison result;

[0024] In response to the second comparison result being consistent, the range of logical block addresses to be discarded is calculated based on the logical block addresses before and after the shrinking and resizing.

[0025] The logical block address of the data block to be determined is compared with the range of logical block addresses to be discarded to obtain a third comparison result;

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

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

[0028] In one embodiment, after discarding the data or data blocks, the method further includes:

[0029] The response time of the scaling-down request is recorded in real time, and the response time is compared 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, the current scaling-down task is set 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 scaling-down task in the storage system continues to be executed.

[0032] In one embodiment, after discarding the data or data blocks, the method further includes:

[0033] The number of data items that have been discarded is recorded in real time, and the number of discarded data items is compared with a preset data discarding threshold to obtain a sixth comparison result;

[0034] In response to the sixth comparison result indicating that the number of data that has been discarded is greater than or equal to the data discard threshold, the current scaling-down task is set 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 discard threshold, the shrinkage task in the storage system continues to be executed.

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

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

[0038] Define a hash function, and calculate the hash value of the cached data based on the volume ID, logical block address, and data block size of the cached data using the hash function;

[0039] The cached data and its hash value are used as key-value pairs and stored in the linked list at the corresponding position of the hash bucket.

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

[0041] A receiving module is used to receive a scaling-down request, wherein the scaling-down request includes the logical block addresses before and after scaling-down.

[0042] The acquisition and comparison module is used to acquire the number of shrinkage tasks to be processed in the storage system and / or the shrinkage capacity of the volume in the shrinkage request, and compare the number of shrinkage tasks to be processed and / or the shrinkage capacity of the volume with a preset shrinkage quantity threshold and / or shrinkage capacity threshold to obtain a first comparison result.

[0043] The search and discard module is used to respond to the first comparison result satisfying the single-volume shrinkage condition, and to find the data block to be discarded in the hash bucket based on the logical block address and data block size before and after the shrinkage, and discard the data block to be discarded, thereby ending the single-volume shrinkage operation.

[0044] The traversal and discard module is used to traverse each data block in the hash bucket in response to the first comparison result satisfying the multi-volume shrinkage condition, 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 shrinkage operation.

[0045] Thirdly, an electronic device is provided, the electronic device including one or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method as described in any one of the first aspects above.

[0046] Fourthly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the steps of the method as described in any one of the first aspects above.

[0047] Fifthly, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the steps of the method as described in any one of the first aspects above.

[0048] The aforementioned storage system's scaling-down method, apparatus, electronic device, and storage medium compare the number of scaling-down tasks to be processed and / or the volume's scaling-down capacity with a preset scaling-down quantity threshold and / or scaling-down capacity threshold to determine whether to perform a single-volume scaling-down operation or a multi-volume scaling-down operation, thus improving the efficiency of both single-volume and multi-volume scaling-down. Based on the logical block addresses and data block sizes before and after the volume scaling-down, a hash function is used to find the data blocks to be discarded in a hash bucket, further improving single-volume scaling-down efficiency. By traversing each data block in the hash bucket and determining the data blocks to be discarded based on the volume ID, logical block address, and data block size of each data block, multi-volume scaling-down efficiency is further improved. Attached Figure Description

[0049] Figure 1 This is a schematic diagram of the scaling down of a cache data organization and storage system in one embodiment;

[0050] Figure 2 This is a flowchart illustrating a method for reducing the size of a storage system in one embodiment;

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

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

[0053] Figure 5 This is a diagram of the internal structure of an electronic device in one embodiment. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0055] Example 1

[0056] In one embodiment, such as Figure 1 , Figure 2 , Figure 3 As shown, a method for downsizing a storage system is provided, the method comprising:

[0057] Receive a scaling-down request, wherein the scaling-down request includes the logical block addresses before and after the volume scaling-down;

[0058] Obtain the number of shrinkage tasks to be processed in the storage system and / or the shrinkage capacity of the volume in the shrinkage request, and compare the number of shrinkage tasks to be processed and / or the shrinkage capacity of the volume with a preset shrinkage quantity threshold and / or shrinkage capacity threshold to obtain a first comparison result;

[0059] In response to the first comparison result satisfying the single-volume shrinkage condition, based on the logical block address and data block size before and after the volume shrinkage, the data block to be discarded is found in the hash bucket based on the hash function, and the data block to be discarded is discarded, thus ending the single-volume shrinkage operation;

[0060] In response to the first comparison result satisfying the multi-volume shrinkage condition, 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, and the data block to be discarded is discarded, thus ending the multi-volume shrinkage 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 amount of storage volume that needs to be discarded, 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 unprocessed scaling-down tasks and / or the scaling-down capacity of the volume are compared with preset scaling-down quantity thresholds and / or scaling-down capacity thresholds to determine whether to perform a single-volume scaling-down operation or a multi-volume scaling-down operation, thus improving the efficiency of both single-volume and multi-volume scaling-down. Based on the logical block addresses and data block sizes before and after the volume scaling-down, data blocks to be discarded are located in the hash bucket using a hash function, further improving the efficiency of single-volume scaling-down. By traversing each data block in the hash bucket and determining the data blocks to be discarded based on the volume ID, logical block address, and data block size of each data block, the efficiency of multi-volume scaling-down is improved.

[0063] In one embodiment,

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

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

[0066] In one embodiment, the step of finding the data block to be discarded in the hash bucket based on the logical block address and data block size before and after the shrinking and resizing, and then discarding the data block to be discarded, includes:

[0067] Based on the logical block addresses before and after the shrinking, calculate the range of logical block addresses to be discarded;

[0068] The range of logical blocks to be discarded is divided according to the size of the data blocks to obtain the number of data blocks to be searched;

[0069] The hash value of each data block to be searched is calculated based on the volume ID and logical block address of each data block to be searched, using the hash function.

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

[0071] Specifically, by utilizing the lookup function of the hash bucket, data can be searched in a targeted manner within a specific range, which greatly reduces the amount of cached data that needs to be accessed, thereby shortening the response time of scaling down requests and improving scaling down efficiency.

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

[0073] Traverse each data block in the hash bucket and filter out the data blocks to be determined, wherein the data blocks to be determined contain data;

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

[0075] Obtain the volume ID from the scaling-down request, and compare the volume ID of the data block to be determined with the volume ID from the scaling-down request to obtain a second comparison result;

[0076] In response to the second comparison result being consistent, the range of logical block addresses to be discarded is calculated based on the logical block addresses before and after the shrinking and resizing.

[0077] The logical block address of the data block to be determined is compared with the range of logical block addresses to be discarded to obtain a third comparison result;

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

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

[0080] Specifically, when the number of pending shrinkage tasks is greater than the shrinkage quantity threshold, and / or the shrinkage capacity of the volume is greater than the shrinkage capacity threshold, the overall time spent on the large volume shrinkage process is reduced by traversing each data block in the hash bucket.

[0081] In one embodiment, after discarding the data or data blocks, the method further includes:

[0082] The response time of the scaling-down request is recorded in real time, and the response time is compared 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, the current scaling-down task is set 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 scaling-down task in the storage system continues to be executed.

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

[0086] Specifically, by using the response time of this scaling-down request as the standard for controlling processor task switching, we can not only ensure that low-performance processors do not spend too much time on scaling-down tasks, but also improve the utilization of high-performance processors.

[0087] In one embodiment, after discarding the data or data blocks, the method further includes:

[0088] The number of data items that have been discarded is recorded in real time, and the number of discarded data items is compared with a preset data discarding threshold to obtain a sixth comparison result;

[0089] In response to the sixth comparison result indicating that the number of data that has been discarded is greater than or equal to the data discard threshold, the current scaling-down task is set 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 discard threshold, the shrinkage task in the storage system continues to be executed.

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

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

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

[0094] Define a hash function, and calculate the hash value of the cached data based on the volume ID, logical block address, and data block size of the cached data using the hash function;

[0095] The cached data and its hash value are used as key-value pairs and stored in the linked list at the corresponding position of the hash bucket.

[0096] Specifically, the cached data and its hash value are stored as key-value pairs in the linked list at the corresponding position of the hash bucket, so that the data can be retrieved during subsequent single-volume scaling-down operations.

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

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

[0099] Based on the total amount of data to be discarded and the preset discard threshold, the maximum amount of data to be discarded in each batch is calculated.

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

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

[0102] While removing the highest priority data from the storage system, the operating status and performance data of the storage system are continuously monitored.

[0103] In response to abnormal operation of the storage system or a decline in performance data, the maximum value of the amount of data to be discarded in each batch is adjusted until the storage system operates normally, the performance data remains unchanged, or the performance data increases.

[0104] Record detailed information for each data discard operation, including the discard time, the amount of data discarded, and the reason for discarding, for 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 eviction algorithm, determining a reasonable discard threshold and batch size, selecting the data to be discarded and executing the discard operation, and continuously monitoring and providing feedback on the system's performance and stability metrics, 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 sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 , Figure 3 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed 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 some of the sub-steps or stages of other steps.

[0107] Example 2

[0108] In one embodiment, such as Figure 4 As shown, a storage system scaling-down device is provided, the device comprising:

[0109] A receiving module is used to receive a scaling-down request, wherein the scaling-down request includes the logical block addresses before and after scaling-down.

[0110] The acquisition and comparison module is used to acquire the number of shrinkage tasks to be processed in the storage system and / or the shrinkage capacity of the volume in the shrinkage request, and compare the number of shrinkage tasks to be processed and / or the shrinkage capacity of the volume with a preset shrinkage quantity threshold and / or shrinkage capacity threshold to obtain a first comparison result.

[0111] The search and discard module is used to respond to the first comparison result satisfying the single-volume shrinkage condition, and to find the data block to be discarded in the hash bucket based on the logical block address and data block size before and after the shrinkage, and discard the data block to be discarded, thereby ending the single-volume shrinkage operation.

[0112] The traversal and discard module is used to traverse each data block in the hash bucket in response to the first comparison result satisfying the multi-volume shrinkage condition, 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 shrinkage operation.

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

[0114] Based on the logical block addresses before and after the shrinking, calculate the range of logical block addresses to be discarded;

[0115] The range of logical blocks to be discarded is divided according to the size of the data blocks to obtain the number of data blocks to be searched;

[0116] The hash value of each data block to be searched is calculated based on the volume ID and logical block address of each data block to be searched, using the hash function.

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

[0118] In one embodiment, the traversal and discard module is specifically used for:

[0119] Traverse each data block in the hash bucket and filter out the data blocks to be determined, wherein the data blocks to be determined contain data;

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

[0121] Obtain the volume ID from the scaling-down request, and compare the volume ID of the data block to be determined with the volume ID from the scaling-down request to obtain a second comparison result;

[0122] In response to the second comparison result being consistent, the range of logical block addresses to be discarded is calculated based on the logical block addresses before and after the shrinking and resizing.

[0123] The logical block address of the data block to be determined is compared with the range of logical block addresses to be discarded to obtain a third comparison result;

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

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

[0126] In one embodiment, after the data or data block is discarded, the apparatus further includes:

[0127] The first recording and comparison module is used to record the response time of the scaling-down request in real time and compare the response time with a preset time threshold to obtain a fifth comparison result.

[0128] The first setting module is configured to set 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] The first execution module is configured to continue executing the scaling-down 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 the data or data block is discarded, the apparatus further includes:

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

[0132] The second setting module is used to set the current scaling down task to a waiting state in response to the sixth comparison result indicating that the number of data that has been discarded is greater than or equal to the data discard threshold, until the next scheduling continues to execute.

[0133] The second execution module is configured to continue executing the scaling-down task in the storage system in response to the sixth comparison result indicating that the number of discarded data is less than the data discard threshold.

[0134] In one embodiment, the apparatus further includes a construction module for constructing the hash bucket, comprising:

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

[0136] Define a hash function, and calculate the hash value of the cached data based on the volume ID, logical block address, and data block size of the cached data using the hash function;

[0137] The cached data and its hash value are used as key-value pairs and stored in the linked list at the corresponding position of the hash bucket.

[0138] Specific limitations regarding the storage system scaling-down device can be found in the limitations of the storage system scaling-down method described above, and will not be repeated here. Each module in the aforementioned storage system scaling-down device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware within or independently of the processor in the electronic device, or stored in software within the memory of the electronic device, so that the processor can call and execute the operations corresponding to each module.

[0139] Example 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 executes the computer program to perform the following steps:

[0141] Receive a scaling-down request, wherein the scaling-down request includes the logical block addresses before and after the volume scaling-down;

[0142] Obtain the number of shrinkage tasks to be processed in the storage system and / or the shrinkage capacity of the volume in the shrinkage request, and compare the number of shrinkage tasks to be processed and / or the shrinkage capacity of the volume with a preset shrinkage quantity threshold and / or shrinkage capacity threshold to obtain a first comparison result;

[0143] In response to the first comparison result satisfying the single-volume shrinkage condition, based on the logical block address and data block size before and after the volume shrinkage, the data block to be discarded is found in the hash bucket based on the hash function, and the data block to be discarded is discarded, thus ending the single-volume shrinkage operation;

[0144] In response to the first comparison result satisfying the multi-volume shrinkage condition, 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, and the data block to be discarded is discarded, thus ending the multi-volume shrinkage operation.

[0145] When the program instructions are read and executed by the one or more processors, they can also perform operations corresponding to the steps in the above method embodiments, as described above, and will not be repeated here. (Reference) Figure 5 This exemplifies the architecture of an electronic device, which may 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, video display adapter 511, disk drive 512, input / output interface 513, network interface 514, and memory 520 can communicate with each other via a communication bus 530.

[0146] The processor 510 can be implemented using a general-purpose central processing unit (CPU), microprocessor, 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 as a read-only memory (ROM), random access memory (RAM), static storage device, dynamic storage device, etc. The memory 520 can store the operating system 521 for controlling the operation of the electronic device 500, and the basic input / output system (BIOS) 522 for controlling the low-level operations of the electronic device 500. Additionally, it can store a web browser 523, data storage management 524, and an icon / font processing system 525, etc. The aforementioned icon / font processing system 525 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when implementing the technical solution provided in this application through software or firmware, the relevant program code is stored in the memory 520 and executed by the processor 510.

[0148] Input / output interface 513 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.

[0149] Network interface 514 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0150] Bus 530 includes a pathway for transmitting information between various components of the device, such as processor 510, video display adapter 511, disk drive 512, input / output interface 513, network interface 514, and memory 520.

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

[0152] It should be noted that although the above-described 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, and a bus 530, in specific implementations, the electronic device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.

[0153] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause an electronic device (which may be a personal computer, cloud server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0154] Example 4

[0155] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0156] Receive a scaling-down request, wherein the scaling-down request includes the logical block addresses before and after the volume scaling-down;

[0157] Obtain the number of shrinkage tasks to be processed in the storage system and / or the shrinkage capacity of the volume in the shrinkage request, and compare the number of shrinkage tasks to be processed and / or the shrinkage capacity of the volume with a preset shrinkage quantity threshold and / or shrinkage capacity threshold to obtain a first comparison result;

[0158] In response to the first comparison result satisfying the single-volume shrinkage condition, based on the logical block address and data block size before and after the volume shrinkage, the data block to be discarded is found in the hash bucket based on the hash function, and the data block to be discarded is discarded, thus ending the single-volume shrinkage operation;

[0159] In response to the first comparison result satisfying the multi-volume shrinkage condition, 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, and the data block to be discarded is discarded, thus ending the multi-volume shrinkage operation.

[0160] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, 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. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0161] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

[0163] Example 5

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

[0165] Receive a scaling-down request, wherein the scaling-down request includes the logical block addresses before and after the volume scaling-down;

[0166] Obtain the number of shrinkage tasks to be processed in the storage system and / or the shrinkage capacity of the volume in the shrinkage request, and compare the number of shrinkage tasks to be processed and / or the shrinkage capacity of the volume with a preset shrinkage quantity threshold and / or shrinkage capacity threshold to obtain a first comparison result;

[0167] In response to the first comparison result satisfying the single-volume shrinkage condition, based on the logical block address and data block size before and after the volume shrinkage, the data block to be discarded is found in the hash bucket based on the hash function, and the data block to be discarded is discarded, thus ending the single-volume shrinkage operation;

[0168] In response to the first comparison result satisfying the multi-volume shrinkage condition, 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, and the data block to be discarded is discarded, thus ending the multi-volume shrinkage operation.

[0169] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer program product, and when the computer program is executed, it can include the processes of the embodiments of the above methods.

[0170] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for reducing the size of a storage system, characterized in that, The method includes: Receive a scaling-down request, wherein the scaling-down request includes the logical block addresses before and after the volume scaling-down; Obtain the number of shrinkage tasks to be processed in the storage system and / or the shrinkage capacity of the volume in the shrinkage request, and compare the number of shrinkage tasks to be processed and / or the shrinkage capacity of the volume with a preset shrinkage quantity threshold and / or shrinkage capacity threshold to obtain a first comparison result; In response to the first comparison result satisfying the single-volume shrinkage condition, based on the logical block address and data block size before and after the volume shrinkage, the data block to be discarded is found in the hash bucket based on the hash function, and the data block to be discarded is discarded, thus ending the single-volume shrinkage operation; In response to the first comparison result satisfying the multi-volume shrinkage condition, 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, and the data block to be discarded is discarded, thus ending the multi-volume shrinkage operation.

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

3. The method according to claim 1, characterized in that, The step of finding the data block to be discarded in the hash bucket based on the logical block address and data block size before and after the shrinking and resizing, and then discarding the data block to be discarded, includes: Based on the logical block addresses before and after the shrinking, calculate the range of logical block addresses to be discarded; The range of logical blocks to be discarded is divided according to the size of the data blocks to obtain the number of data blocks to be searched; The hash value of each data block to be searched is calculated based on the volume ID and logical block address of each data block to be searched, using the hash function. Based on the hash value of each data block to be searched, the data block to be discarded is found in the hash bucket and then discarded.

4. The method according to claim 1, characterized in that, The process of traversing each data block in the hash bucket, determining the data blocks to be discarded based on the volume ID, logical block address, and data block size of each data block, and discarding the data blocks to be discarded includes: Traverse each data block in the hash bucket and filter out the data blocks to be determined, wherein the data blocks to be determined contain data; Extract the association identifier of the data block to be determined, wherein the association identifier includes the volume ID, logical block address, and data block size; Obtain the volume ID from the scaling-down request, and compare the volume ID of the data block to be determined with the volume ID from the scaling-down request to obtain a second comparison result; In response to the second comparison result being consistent, the range of logical block addresses to be discarded is calculated based on the logical block addresses before and after the shrinking and resizing. The logical block address of the data block to be determined is compared with the range of logical block addresses to be discarded to obtain a third comparison result; In response to the third comparison result indicating that the logical block address of the data block to be determined is within the range of the logical block address to be discarded, the data block size of the data block to be determined is compared with the range of the logical block address to be discarded to obtain a fourth comparison result; In response to the fourth comparison result indicating that the data block to be determined is entirely or partially within the address range of the logical block to be discarded, the data in the data block to be determined that is within the address range of the logical block to be discarded is discarded.

5. The method according to claim 3 or 4, characterized in that, After discarding the data or data blocks, the method further includes: The response time of the scaling-down request is recorded in real time, and the response time is compared 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, the current scaling-down task is set 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 scaling-down 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 includes: The number of data items that have been discarded is recorded in real time, and the number of discarded data items is compared with a preset data discarding threshold to obtain a sixth comparison result; In response to the sixth comparison result indicating that the number of data that has been discarded is greater than or equal to the data discard threshold, the current scaling-down task is set 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 shrinkage 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: Based on the requirements of the storage system, create an array with an initial capacity as a set of hash buckets; Define a hash function, and calculate the hash value of the cached data based on the volume ID, logical block address, and data block size of the cached data using the hash function; The cached data and its hash value are used as key-value pairs and stored in the linked list at the corresponding position of the hash bucket.

8. A capacity reduction device for a storage system, characterized in that, The device includes: A receiving module is used to receive a scaling-down request, wherein the scaling-down request includes the logical block addresses before and after scaling-down. The acquisition and comparison module is used to acquire the number of shrinkage tasks to be processed in the storage system and / or the shrinkage capacity of the volume in the shrinkage request, and compare the number of shrinkage tasks to be processed and / or the shrinkage capacity of the volume with a preset shrinkage quantity threshold and / or shrinkage capacity threshold to obtain a first comparison result. The search and discard module is used to respond to the first comparison result satisfying the single-volume shrinkage condition, and to find the data block to be discarded in the hash bucket based on the logical block address and data block size before and after the shrinkage, and discard the data block to be discarded, thereby ending the single-volume shrinkage operation. The traversal and discard module is used to traverse each data block in the hash bucket in response to the first comparison result satisfying the multi-volume shrinkage condition, 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 shrinkage 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, it implements the steps of the method according to any one of claims 1 to 7.

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

Citation Information

Patent Citations

  • Container memory adjusting method and device

    CN112835685A

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

    CN114650392A