CN112835521B - Storage space allocation method and device - Google Patents

Storage space allocation method and device Download PDF

Info

Publication number
CN112835521B
CN112835521B CN202110137837.0A CN202110137837A CN112835521B CN 112835521 B CN112835521 B CN 112835521B CN 202110137837 A CN202110137837 A CN 202110137837A CN 112835521 B CN112835521 B CN 112835521B
Authority
CN
China
Prior art keywords
expansion
capacity
time
last
target lun
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110137837.0A
Other languages
Chinese (zh)
Other versions
CN112835521A (en
Inventor
上官应兰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Macrosan Technologies Co Ltd
Original Assignee
Macrosan Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Macrosan Technologies Co Ltd filed Critical Macrosan Technologies Co Ltd
Priority to CN202110137837.0A priority Critical patent/CN112835521B/en
Publication of CN112835521A publication Critical patent/CN112835521A/en
Application granted granted Critical
Publication of CN112835521B publication Critical patent/CN112835521B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1471Saving, restoring, recovering or retrying involving logging of persistent data for recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/065Replication mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application discloses a storage space allocation method and device. In the application, when the snapshot resource corresponding to the target LUN is detected to apply for capacity expansion, and a recorded last capacity expansion time value of the snapshot resource is queried to be a specified value, a pre-capacity expansion capacity is determined according to a relation between a time difference between a current time and the last capacity expansion time and a first preset value and a second preset value, and the current time and/or a working time period in which the target LUN is located at the last capacity expansion time, when the pre-capacity expansion capacity is larger than a minimum capacity expansion capacity and smaller than a maximum capacity expansion capacity, the pre-capacity expansion capacity is determined to be a capacity to be expanded of the snapshot resource, and an idle storage space in the device, which is consistent with the capacity to be expanded, is allocated to the snapshot resource. Finally, the storage space allocated to the snapshot resource is dynamically adjusted according to the capacity expansion record of the snapshot resource, so that the capacity expansion of the snapshot resource is more precise.

Description

Storage space allocation method and device
Technical Field
The present application relates to the field of storage, and in particular, to a method and an apparatus for allocating storage space.
Background
The snapshot is a common data protection feature of the storage device, and aims to avoid data loss caused by soft disasters, including misoperation, software bug and the like. After the snapshot is enabled for the LUN, the snapshot may be automatically created according to a preset policy, where each snapshot is used to record data of a time plane corresponding to the LUN, for example, a snapshot is created every 1 hour, and 128 snapshots are reserved at most. However, as the snapshot data becomes more and more, the utilization rate of the snapshot resource becomes higher and higher, and when the snapshot resource is fully written, the new data change of the LUN cannot be recorded any more, that is, the snapshot function will fail at this time.
In order to ensure availability of the snapshot function of the LUN, in the related art, a threshold is used to trigger automatic expansion of the snapshot resource, but how to reasonably allocate a storage space to the snapshot resource during expansion makes expansion of the snapshot resource more precise, so as to prevent the snapshot resource from occupying too much free storage space due to too large expansion step size or frequently affecting the performance of the device due to too small expansion step size, which is a problem to be solved urgently.
Disclosure of Invention
The application discloses a storage space distribution method, device and equipment, which are used for reasonably distributing storage space to snapshot resources during capacity expansion so that the capacity expansion of the snapshot resources is more precise.
According to a first aspect of the embodiments of the present application, there is provided a storage space allocation method, which is applied to a storage device, and includes:
when detecting that a snapshot resource corresponding to a target LUN applies for capacity expansion and querying that a recorded last capacity expansion time value of the snapshot resource is a specified value, comparing a time difference between current time and the last capacity expansion time with a first preset value and a second preset value respectively, wherein the second preset value is larger than the first preset value;
if the time difference is smaller than the first preset value, determining a pre-expansion capacity according to the current time and/or the working time period of the target LUN at the last expansion time, wherein the working time period of the target LUN is divided into a business busy time period and a business idle time period in advance, and the pre-expansion capacity is larger than the recorded last expansion step length of the snapshot resource;
if the time difference is greater than the second preset value, determining a pre-expansion capacity according to the current time and/or the working time period of the last expansion time target LUN, wherein the pre-expansion capacity is smaller than the recorded last expansion step length of the snapshot resource;
when the pre-expansion capacity is larger than the minimum expansion capacity of the snapshot resource and smaller than the maximum expansion capacity of the snapshot resource, determining the pre-expansion capacity as the capacity to be expanded of the snapshot resource, and allocating the free storage space in the device, which is consistent with the capacity to be expanded, to the snapshot resource.
Optionally, if the time difference is smaller than the first preset value, determining the pre-expansion capacity according to the current time and/or the working time period in which the last expansion time target LUN is located includes:
if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is N1 times of the last expansion step;
if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is N2 times of the last expansion step length;
and if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is N3 times of the last expansion step, wherein N1> N2> N3> 1.
Optionally, if the time difference is greater than the second preset value, determining the pre-expansion capacity according to the current time and/or the working time period in which the last expansion time target LUN is located includes:
if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is K1 times of the last expansion step;
if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is K2 times of the last expansion step length;
and if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is K3 times of the last expansion step length, wherein 0< K3< K2< K1< 1.
Optionally, when the last recorded value of the capacity expansion time of the snapshot resource is empty, the method further includes:
and determining the recorded last capacity expansion step length of the snapshot resource as the capacity to be expanded, and allocating the free storage space in the equipment, which is consistent with the capacity to be expanded, to the snapshot resource.
Optionally, if the time difference is greater than a first preset value and smaller than a second preset value, the method further includes:
determining the recorded last capacity expansion step length of the snapshot resource as a pre-capacity expansion capacity, determining the pre-capacity expansion capacity as the capacity to be expanded of the snapshot resource when the pre-capacity expansion capacity is larger than the minimum capacity expansion capacity and smaller than the maximum capacity expansion capacity, and allocating a free storage space in the device, which is consistent with the capacity to be expanded, to the snapshot resource.
Optionally, when the pre-expansion capacity is smaller than the minimum expansion capacity of the snapshot resource, determining the minimum expansion capacity as the capacity to be expanded of the snapshot resource;
and when the pre-expansion capacity is larger than the maximum expansion capacity of the snapshot resource, determining the maximum expansion capacity as the capacity to be expanded of the snapshot resource.
Optionally, the allocating a free storage space in the device, which is consistent with the size of the capacity to be expanded, to the snapshot resource includes:
and after the free storage space in the equipment, which is consistent with the capacity to be expanded, is allocated to the snapshot resource, the last expansion time is updated to be the current time, and the last expansion step length is updated to be the capacity to be expanded.
According to a second aspect of the embodiments of the present application, there is provided a storage space allocation apparatus, which is applied to a storage device, and includes:
the time difference comparison unit is used for comparing the time difference between the current time and the last expansion time with a first preset value and a second preset value respectively when the application expansion of the snapshot resource corresponding to the target LUN is detected and the recorded last expansion time value of the snapshot resource is inquired to be a specified value, wherein the second preset value is larger than the first preset value;
a pre-expansion capacity determining unit, configured to determine, when the time difference is smaller than the first preset value, a pre-expansion capacity according to a current time and/or a working time period in which the target LUN is located at the last expansion time, where the working time period of the target LUN is pre-divided into a business busy time period and a business idle time period, and the pre-expansion capacity is larger than a recorded last expansion step length of the snapshot resource; when the time difference is greater than the second preset value, determining a pre-expansion capacity according to the current time and/or the working time period of the last expansion time target LUN, wherein the pre-expansion capacity is smaller than the recorded last expansion step length of the snapshot resource;
and the storage space allocation unit is used for determining the pre-expansion capacity as the capacity to be expanded of the snapshot resource and allocating the free storage space in the equipment, which is consistent with the capacity to be expanded, to the snapshot resource when the pre-expansion capacity is larger than the minimum expansion capacity of the snapshot resource and is smaller than the maximum expansion capacity of the snapshot resource.
Optionally, when the time difference is smaller than the first preset value, the pre-expansion capacity determining unit determines the pre-expansion capacity according to the current time and/or the working time period in which the last expansion time target LUN is located:
if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is N1 times of the last expansion step;
if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is N2 times of the last expansion step length;
and if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is N3 times of the last expansion step, wherein N1> N2> N3> 1.
Optionally, when the time difference is greater than the second preset value, the pre-expansion capacity determining unit determines the pre-expansion capacity according to the current time and/or the working time period in which the last expansion time target LUN is located:
if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is K1 times of the last expansion step;
if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is K2 times of the last expansion step length;
and if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is K3 times of the last expansion step length, wherein 0< K3< K2< K1< 1.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
according to the technical scheme, when the volume expansion is applied for the snapshot resource corresponding to the target LUN is detected, and the recorded last value of the volume expansion time of the snapshot resource is inquired to be the designated value, the pre-volume expansion capacity is determined according to the relationship between the time difference between the current time and the last volume expansion time and the first preset value and the second preset value, and the current time and/or the working time period where the target LUN is located at the last volume expansion time, and when the pre-volume expansion capacity is larger than the minimum volume expansion capacity and smaller than the maximum volume expansion capacity, the pre-volume expansion capacity is determined to be the volume to be expanded of the snapshot resource, and the free storage space in the device, which is consistent with the volume to be expanded, is allocated to the snapshot resource. Finally, the storage space allocated to the snapshot resource is dynamically adjusted according to the capacity expansion record of the snapshot resource, so that the capacity expansion of the snapshot resource is more precise.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present specification and together with the description, serve to explain the principles of the specification.
FIG. 1 is a flowchart of a method for implementing storage space allocation according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a method for determining a pre-expansion capacity according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of another method for determining a pre-expansion capacity according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an apparatus for implementing storage space allocation according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In order to make those skilled in the art better understand the technical solution in the embodiment of the present application, the snapshot related technology related to the embodiment of the present application is briefly described below.
The snapshot is a common data protection feature of the storage device, and aims to avoid data loss caused by soft disasters, including misoperation, software bug and the like. After the snapshot is enabled for the LUN, the snapshot may be automatically created according to a preset policy, where each snapshot is used to record data of a corresponding time plane, for example, a snapshot is created every 1 hour, and 128 snapshots are reserved at most.
As for the snapshot resource, it is used to store snapshot data, such as cofw (copy On First write) snapshot is a traditional snapshot technology, and its principle is that after a new snapshot is created each time, before a certain address field of LUN is written with data for the First time, the existing data of the address field is copied to the snapshot resource, and then the data is written into LUN; when the address field is written with data for the second time, because the data corresponding to the new snapshot is already backed up, the new data can be directly written into the LUN. As the snapshot data becomes more and more, the utilization rate of the snapshot resources becomes higher and higher, and when the snapshot resources are fully written, the new data change of the LUN cannot be recorded any more, and the snapshot fails.
It can be seen that, in the process of using snapshot resources, the size of the needed snapshot resources is related to the snapshot policy, the maximum number of snapshots, and the data change amount, because the data change amount in the LUN is not a stable value, but changes with the actual traffic on the LUN, which also causes the snapshot data change amount of the LUN to be unstable, and thus it is difficult to configure a reasonable snapshot resource capacity. The current common practice is that the snapshot resource supports automatic capacity expansion, that is, a user specifies a capacity expansion threshold and a capacity expansion step of the snapshot resource. And when the free capacity of the snapshot resource is lower than a preset capacity expansion threshold, automatically triggering capacity expansion according to a preset capacity expansion step length. For example, the capacity expansion threshold is 10GB, the capacity expansion step is 10GB, and when the snapshot resource free capacity is lower than 10GB, the capacity expansion of 10GB space is automatically triggered.
However, in the above related art, the preset capacity expansion step size of the snapshot resource of multiple LUNs in one device is often a fixed value, and is not well adapted to the production services of multiple LUNs in different scenarios, for example, when the preset capacity expansion step size is too large, if multiple LUNs exist to start a snapshot, capacity expansion of a part of the snapshot resource of a LUN may be successful, and more idle capacity is occupied, which results in capacity expansion failure of the remaining LUN snapshot resource, or when the preset capacity expansion step size is too small, frequent capacity expansion of the snapshot resource of the LUN may occur, on one hand, the situation that capacity expansion is too late may occur, and on the other hand, frequent capacity expansion may affect the management performance of the device. Therefore, the present application provides a method for reasonably allocating storage space to snapshot resources of LUNs to solve the above problems, so that capacity expansion is more precise, and the above situations are avoided.
In order to make the aforementioned objects, features and advantages of the embodiments of the present application more comprehensible, embodiments of the present application are described in detail below with reference to the accompanying drawings. Referring to fig. 1, fig. 1 is a flowchart of a method for allocating a storage space according to an embodiment of the present application. As an embodiment, the flow shown in fig. 1 may be applied to a storage device.
Before the method flow shown in fig. 1 is executed, the following configuration needs to be performed on the storage device in the embodiment of the present application:
first, optionally, in order to implement the embodiment of the present application, the working time period of each LUN in the storage device may be pre-divided into a busy service time period and an idle service time period, which are generally divided in units of days, and the multiple LUNs may set different or the same busy service time period and idle service time period. For example, the traffic busy period of LUN1 may be set to 08: 00-20: 00, the service idle period is 20: 00-08: 00, the LUN2 has a busy period of 00:00-24:00, i.e. all day is a busy period.
The division of the working time periods of the LUNs can be further implemented according to the actual conditions of the previous services, a threshold value can be set in specific implementation, according to the frequency of reading and writing data on the LUNs in each time period of the previous LUNs, the time period in which the frequency of reading and writing data is greater than or equal to the threshold value is determined as a service busy time period, and the time period in which the frequency of reading and writing the remaining data is less than the threshold value is determined as a service idle time period.
The minimum capacity expansion capacity and the maximum capacity expansion capacity of the snapshot resource of each LUN can be set to limit the capacity expansion of the snapshot resource, and specific settings can be specified by developers in codes, for example, the minimum capacity expansion capacity is 10GB, and the maximum capacity expansion capacity is 1 TB; multiple options can also be set, and the minimum capacity expansion capacity and the maximum capacity expansion capacity are determined by the user according to the service condition on the target LUN.
As shown in fig. 1, the process may include the following steps:
step 101, detecting that a snapshot resource corresponding to a target LUN applies for capacity expansion, and querying that a recorded value of last capacity expansion time of the snapshot resource is an appointed value.
In a specific implementation, in the embodiment of the present application, the target LUN, that is, one LUN of the plurality of LUNs divided into a busy service period and an idle service period in the working period of the device, and the snapshot resource corresponding to the target LUN is used to store snapshot data corresponding to the target LUN.
And applying for capacity expansion of the detected snapshot resource corresponding to the target LUN, which may be to prevent the snapshot resource corresponding to the target LUN from being written with snapshot data, and using a threshold value for automatic capacity expansion of the triggered snapshot resource. For example, the utilization rate of snapshot resources can be monitored, and when the utilization rate of the snapshot resources reaches a threshold value, the snapshot resources are automatically triggered to apply for capacity expansion; the remaining capacity of the snapshot resource can also be monitored, and when the remaining capacity of the snapshot resource reaches a threshold value, the snapshot resource is automatically triggered to apply for capacity expansion. For a specific method for triggering snapshot resource expansion by a threshold, reference may be made to related technical solutions, which are not described herein again.
In addition, the specified value in this step 101 is the last time of capacity expansion of the snapshot resource, and the specified value is not empty, and if the last time of capacity expansion of the snapshot resource is empty, it may indicate that the current snapshot resource is the first time of capacity expansion application after the device is started, and a specific scheme of the first time of capacity expansion application after the device is started will be described in detail below.
And 102, comparing whether the time difference between the current time and the last expansion time is smaller than a first preset value.
In the embodiment of the application, two preset values are preset: the second preset value is greater than the first preset value, for example, the first preset value may be set to 30 minutes, and the second preset value may be set to 240 minutes.
When the time difference between the current time and the last expansion time is smaller than a first preset value, that is, after the last expansion of the snapshot resource of the target LUN, the expanded space of the snapshot resource is rapidly occupied in a short time, and since the snapshot resource is used for storing the snapshot data of the target LUN, when the time difference is smaller than the first preset value, the snapshot data of the target LUN may increase due to a large traffic volume on the target LUN at the current time, so that the expansion frequency of the snapshot resource of the target LUN increases.
When the time difference between the current time and the last expansion time is greater than the first preset value, that is, after the last expansion of the snapshot resource of the target LUN, the snapshot resource of the target LUN does not need to be expanded for a long time, which may be because the last expansion step size is too large, or after the last expansion of the snapshot resource, the traffic required to be processed on the target LUN is reduced, so that the snapshot data of the target LUN is reduced, and at this time, the step size of the target LUN needs to be controlled, so as to prevent the target LUN from occupying too much free storage space of the storage device, and thus the storage device does not have other free storage space to allocate to the snapshot resources of other LUNs.
Based on the first preset value and the second preset value set above, when the time difference is smaller than the first preset value, the embodiment of the present application performs step 103 to determine the pre-expansion capacity; when the time difference is greater than the first preset value, the embodiment of the present application compares the time difference with the second preset value by performing step 104 to determine the pre-expansion capacity, where the pre-expansion capacity is used to determine the expansion step size of the snapshot resource of the target LUN at this time.
Step 103, determining a pre-expansion capacity according to the current time and/or the working time period of the last expansion time target LUN, where the pre-expansion capacity is greater than the recorded last expansion step length of the snapshot resource.
It should be noted that, in this step 103, since the time difference between the current time and the last expansion time is smaller than the first preset value, it may be that the expansion frequency of the snapshot resource of the target LUN is increased due to a large traffic volume on the target LUN at the current time, so that to prevent the snapshot resource of the target LUN from being frequently expanded, the expansion at this time needs to allocate more storage space to the snapshot resource.
In the embodiment of the present application, the pre-expansion capacity is used to determine the expansion step size of the snapshot resource of the target LUN, so that the pre-expansion capacity determined in this step 103 may be larger than the recorded last expansion step size of the snapshot resource, where the last expansion step size of the snapshot resource is the size of the storage space allocated during the last expansion of the snapshot resource.
Further, in this step 103, the pre-expansion capacity is determined according to the current time and/or the working time period in which the last expansion time target LUN is located, where the working time period may be the above-mentioned busy service time period and idle service time period, and how to determine the pre-expansion capacity will be described in detail with reference to the flow of fig. 2, which is not described herein again. In addition, after the pre-expansion capacity is determined in this step, step 106 is further executed to expand the snapshot resource.
And 104, comparing whether the time difference between the current time and the last expansion time is greater than a second preset value.
As an embodiment, the second preset value is greater than the first preset value, and when the time difference is greater than the second preset value, the embodiment of the present application performs step 105 to determine the pre-expansion capacity.
As another embodiment, when the time difference is smaller than a second preset value, and the time difference is also larger than a first preset value, in this embodiment of the present application, a last capacity expansion step of the snapshot resource recorded in the device is determined as a pre-capacity expansion capacity, and when the pre-capacity expansion capacity is larger than a minimum capacity expansion capacity and smaller than a maximum capacity expansion capacity, the pre-capacity expansion capacity is determined as a capacity to be expanded of the snapshot resource, and a free storage space in the device, which is the same as the capacity to be expanded, is allocated to the snapshot resource.
And 105, determining a pre-expansion capacity according to the current time and/or the working time period of the last expansion time target LUN, wherein the pre-expansion capacity is smaller than the recorded last expansion step length of the snapshot resource.
When the time difference is greater than the second preset value, in this case, the last expansion step size of the snapshot resource of the target LUN may be too large, or the traffic volume that needs to be processed on the target LUN is reduced after the last expansion of the snapshot resource, at this time, in order to prevent the target LUN from occupying too much free storage space of the storage device, it is not necessary to allocate too much storage space to the snapshot resource, so the pre-expansion capacity determined in step 105 may be smaller than the recorded last expansion step size of the snapshot resource.
As for determining the pre-expansion capacity according to the current time and/or the working time period where the last expansion time target LUN is located in this step 105, the working time period may be the above-mentioned business busy time period and business idle time period, and how to determine the pre-expansion capacity will be described in detail with reference to the flow of fig. 3 below, and details thereof are not repeated. And after the pre-expansion capacity is determined in this step, step 106 is further executed to expand the snapshot resource.
And 106, when the pre-expansion capacity is larger than the minimum expansion capacity of the snapshot resource and smaller than the maximum expansion capacity of the snapshot resource, determining the pre-expansion capacity as the capacity to be expanded of the snapshot resource, and allocating a free storage space in the device, which is consistent with the capacity to be expanded, to the snapshot resource.
After the pre-expansion capacity is determined in step 103 or step 104, in the embodiment of the present application, the capacity to be expanded of the snapshot resource is further determined according to the pre-expansion capacity, the minimum expansion capacity and the maximum expansion capacity of the snapshot resource, where the capacity to be expanded is the size of the storage space to be allocated to the snapshot resource for the current expansion of the device.
In this step 106, when the pre-expansion capacity is larger than the minimum expansion capacity and smaller than the maximum expansion capacity, the capacity to be expanded is determined. When the pre-expansion capacity is smaller than the minimum expansion capacity of the snapshot resource, the embodiment of the present application may determine the minimum expansion capacity as the capacity to be expanded of the snapshot resource; when the pre-expansion capacity is larger than the maximum expansion capacity of the snapshot resource, the embodiment of the present application may determine the maximum expansion capacity as the capacity to be expanded of the snapshot resource.
Thus, the flow shown in fig. 1 is completed.
As can be seen from the process shown in fig. 1, in this embodiment, when it is detected that a snapshot resource corresponding to a target LUN applies for capacity expansion, and a recorded last value of capacity expansion time of the snapshot resource is a specified value, a pre-capacity expansion capacity is determined according to a relationship between a time difference between a current time and the last time capacity expansion time and a first preset value and a second preset value, and a working period in which the current time and/or the last time capacity expansion time target LUN is located, and when the pre-capacity expansion capacity is greater than a minimum capacity expansion capacity and smaller than a maximum capacity expansion capacity, the pre-capacity expansion capacity is determined as a capacity to be expanded of the snapshot resource, and a free storage space in the device, which is consistent with the capacity to be expanded, is allocated to the snapshot resource. Finally, the storage space allocated to the snapshot resource is dynamically adjusted according to the capacity expansion record of the snapshot resource, so that the capacity expansion of the snapshot resource is more precise.
In addition, it should be noted that, as another embodiment, in step 101, if it is detected that the snapshot resource corresponding to the target LUN applies for capacity expansion, but a value of last capacity expansion time of the recorded snapshot resource is queried to be empty, which indicates that the current snapshot resource is a first capacity expansion application after the device is powered on, then the recorded last capacity expansion step size is determined as a capacity to be expanded, a free storage space in the device, which is the same as the capacity to be expanded, is allocated to the snapshot resource, and the last capacity expansion time is updated to be the current time.
In this embodiment, when the device is restarted or shut down, because the length of the shutdown time is not determined and the service cannot be run during the shutdown process, the last expansion time and the last expansion step size of the snapshot resource that resets the target LUN are set to initial values, where the initial value of the last expansion time may be set to be null, and the initial value of the last expansion step size may be a fixed value, such as 10GB, and is determined by a developer in a code or specified by a user, which is not limited in this application.
In some embodiments, referring to fig. 2, in step 103, when a time difference between the current time and the last expansion time is smaller than a first preset value, determining a pre-expansion capacity according to the current time and/or a working time period where the last expansion time target LUN is located may be implemented by:
step 201, determining that the time difference between the current time and the last expansion time is smaller than the first preset value through step 103.
Step 201, if the target LUN at the current time is in a busy traffic period, determining that the pre-capacity expansion capacity is N1 times of the last capacity expansion step.
Step 202, if the current time target LUN is in a service idle period and the last capacity expansion time target LUN is in a service busy period, determining that the pre-capacity expansion capacity is N2 times of the last capacity expansion step length.
Step 203, if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is N3 times of the last expansion step, where N1> N2> N3> 1.
It should be noted that, when the target LUN is in a busy period of service at the current time, the traffic volume processed by the target LUN is generally large, and the demand for snapshot resources is also increased along with the increase of service data on the target LUN, so that the determined pre-expansion capacity is larger than that when the target LUN is in an idle period of service at the current time. However, when the target LUN at the current time is in the idle traffic time period, and when the target LUN at the last expansion time is in the busy traffic time period, in the process from the last expansion time to the current time, the service data on the target LUN may also be more than that when the target LUN at the last expansion time is in the idle traffic time period, so in this embodiment of the present application, the relationship among N1, N2, and N3 in steps 202 to 204 is N1> N2> N3, and in addition, N1, N2, and N3 are all set to be greater than 1, so as to ensure that the pre-expansion capacity obtained through the flow shown in fig. 3 is greater than the last expansion step size of the snapshot resource, for example, N1 may be set to 3, N2 may be set to 2, and N3 may be set to 1.5 in specific implementation. N1, N2 and N3 are given here for illustrative purposes only and do not limit the present application in any way.
In the above description, how to determine the pre-expansion capacity of the snapshot resource when the time difference is smaller than the first preset value is described, in step 105, when the time difference between the current time and the last expansion time is larger than the second preset value, the pre-expansion capacity is determined according to the current time and/or the working time period where the last expansion time target LUN is located, which may be implemented by the following steps:
step 301, determining that a time difference between the current time and the last expansion time is greater than the second preset value.
Step 302, if the target LUN at the current time is in the busy traffic period, determining that the pre-capacity expansion capacity is K1 times of the last capacity expansion step.
Step 303, if the current time target LUN is in the idle service period and the last expansion time target LUN is in the busy service period, determining that the pre-expansion capacity is K2 times of the last expansion step.
And 304, if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is K3 times of the last expansion step, where 0< K3< K2< K1< 1.
For the same reason as the relationship among N1, N2, and N3 is set in fig. 2, in the embodiment of the present application, the relationship among K1, K2, and K3 in the above steps 302 to 304 is K1> K2> K3. In addition, all of the settings K1, K2, and K3 must be smaller than 1 to ensure that the pre-expansion capacity obtained through the process shown in fig. 3 is smaller than the last expansion step of the snapshot resource, for example, in a specific implementation, K1 may be set to 0.8, K2 may be set to 0.6, and K3 may be set to 0.4. The K1, K2 and K3 are only examples for easy understanding and do not specifically limit the present application.
The above examples are merely for convenience of understanding, and the embodiments of the present application are not particularly limited.
The method provided by the embodiment of the application is described above. The following describes the apparatus provided in the embodiments of the present application:
referring to fig. 4, fig. 4 is a schematic diagram of an apparatus for allocating a storage space according to an embodiment of the present application, where the embodiment of the apparatus employs a storage device. The device includes:
the time difference comparing unit 401 is configured to, when it is detected that the snapshot resource corresponding to the target LUN applies for capacity expansion and it is queried that the recorded last capacity expansion time value of the snapshot resource is the specified value, compare a time difference between the current time and the last capacity expansion time with a first preset value and a second preset value, where the second preset value is greater than the first preset value.
A pre-expansion capacity determining unit 402, configured to determine, when the time difference is smaller than the first preset value, a pre-expansion capacity according to a current time and/or a working time period in which the target LUN is located at the last expansion time, where the working time period of the target LUN is pre-divided into a business busy time period and a business idle time period, and the pre-expansion capacity is larger than a recorded last expansion step length of the snapshot resource; and when the time difference is greater than the second preset value, determining the pre-expansion capacity according to the current time and/or the working time period of the last expansion time target LUN, wherein the pre-expansion capacity is smaller than the recorded last expansion step length of the snapshot resource.
Optionally, as an embodiment, when the time difference is smaller than the first preset value, the pre-expansion capacity determining unit 402 determines the pre-expansion capacity according to the current time and/or the working time period where the last expansion time target LUN is located: if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is N1 times of the last expansion step; if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is N2 times of the last expansion step length; if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is N3 times of the last expansion step length; the N1> N2> N3> 1.
Optionally, as another embodiment, when the time difference is greater than the second preset value, the pre-expansion capacity determining unit 402 determines the pre-expansion capacity according to the current time and/or the working time period where the last expansion time target LUN is located: if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is K1 times of the last expansion step; if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is K2 times of the last expansion step length; and if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is K3 times of the last expansion step length, wherein 0< K3< K2< K1< 1.
A storage space allocation unit 403, configured to determine, when the pre-expansion capacity is greater than the minimum expansion capacity of the snapshot resource and is less than the maximum expansion capacity of the snapshot resource, the pre-expansion capacity as the capacity to be expanded of the snapshot resource, and allocate, to the snapshot resource, a free storage space in the local device, where the size of the free storage space is consistent with the size of the capacity to be expanded.
Thus, the structure of the embodiment of the apparatus shown in FIG. 4 is completed.
The above is a description of an embodiment of the apparatus for implementing storage space allocation provided in the embodiment of the present application,
correspondingly, an embodiment of the present application further provides a hardware structure diagram of an electronic device, and specifically, as shown in fig. 5, the electronic device may be the device for implementing the storage space allocation method. As shown in fig. 5, the hardware structure includes: a processor and a memory.
Wherein the memory is to store machine executable instructions;
the processor is used for reading and executing the machine executable instructions stored by the memory so as to realize the method embodiment corresponding to the storage space allocation shown above.
For one embodiment, the memory may be any electronic, magnetic, optical, or other physical storage device that may contain or store information such as executable instructions, data, and the like. For example, the memory may be: volatile memory, non-volatile memory, or similar storage media. In particular, the Memory may be a RAM (random Access Memory), a flash Memory, a storage drive (e.g., a hard disk drive), a solid state disk, any type of storage disk (e.g., an optical disk, a DVD, etc.), or similar storage medium, or a combination thereof.
Up to this point, the description of the electronic apparatus shown in fig. 5 is completed.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (10)

1. A storage space allocation method is applied to a storage device and comprises the following steps:
when detecting that a snapshot resource corresponding to a target LUN applies for capacity expansion and querying that a recorded last capacity expansion time value of the snapshot resource is a specified value, comparing a time difference between current time and the last capacity expansion time with a first preset value and a second preset value respectively, wherein the second preset value is larger than the first preset value;
if the time difference is smaller than the first preset value, determining a pre-expansion capacity according to the current time and/or the working time period of the target LUN at the last expansion time, wherein the working time period of the target LUN is divided into a business busy time period and a business idle time period in advance, and the pre-expansion capacity is larger than the recorded last expansion step length of the snapshot resource;
if the time difference is greater than the second preset value, determining a pre-expansion capacity according to the current time and/or the working time period of the last expansion time target LUN, wherein the pre-expansion capacity is smaller than the recorded last expansion step length of the snapshot resource;
when the pre-expansion capacity is larger than the minimum expansion capacity of the snapshot resource and smaller than the maximum expansion capacity of the snapshot resource, determining the pre-expansion capacity as the capacity to be expanded of the snapshot resource, and allocating the free storage space in the device, which is consistent with the capacity to be expanded, to the snapshot resource.
2. The method according to claim 1, wherein if the time difference is smaller than the first preset value, determining the pre-expansion capacity according to the current time and/or the working period in which the last expansion time target LUN is located comprises:
if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is N1 times of the last expansion step;
if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is N2 times of the last expansion step length;
and if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is N3 times of the last expansion step, wherein N1> N2> N3> 1.
3. The method according to claim 1, wherein if the time difference is greater than the second preset value, determining the pre-expansion capacity according to the current time and/or the working period in which the last expansion time target LUN is located comprises:
if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is K1 times of the last expansion step;
if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is K2 times of the last expansion step length;
and if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is K3 times of the last expansion step length, wherein 0< K3< K2< K1< 1.
4. The method of claim 1, wherein when the last recorded value of the capacity expansion time of the snapshot resource is empty, the method further comprises:
and determining the recorded last capacity expansion step length of the snapshot resource as the capacity to be expanded, and allocating the free storage space in the equipment, which is consistent with the capacity to be expanded, to the snapshot resource.
5. The method of claim 1, wherein if the time difference is greater than a first preset value and less than a second preset value, the method further comprises:
determining the recorded last capacity expansion step length of the snapshot resource as a pre-capacity expansion capacity, determining the pre-capacity expansion capacity as the capacity to be expanded of the snapshot resource when the pre-capacity expansion capacity is larger than the minimum capacity expansion capacity and smaller than the maximum capacity expansion capacity, and allocating a free storage space in the device, which is consistent with the capacity to be expanded, to the snapshot resource.
6. The method according to any one of claims 1 to 5,
when the pre-expansion capacity is smaller than the minimum expansion capacity of the snapshot resource, determining the minimum expansion capacity as the capacity to be expanded of the snapshot resource;
and when the pre-expansion capacity is larger than the maximum expansion capacity of the snapshot resource, determining the maximum expansion capacity as the capacity to be expanded of the snapshot resource.
7. The method according to any one of claims 1 to 5, wherein the allocating free storage space in the local device that is consistent with the size of the capacity to be expanded to the snapshot resource includes:
and after the free storage space in the equipment, which is consistent with the capacity to be expanded, is allocated to the snapshot resource, the last expansion time is updated to be the current time, and the last expansion step length is updated to be the capacity to be expanded.
8. A storage space allocation device, which is applied to a storage device, comprises:
the time difference comparison unit is used for comparing the time difference between the current time and the last expansion time with a first preset value and a second preset value respectively when the application expansion of the snapshot resource corresponding to the target LUN is detected and the recorded last expansion time value of the snapshot resource is inquired to be a specified value, wherein the second preset value is larger than the first preset value;
a pre-expansion capacity determining unit, configured to determine, when the time difference is smaller than the first preset value, a pre-expansion capacity according to a current time and/or a working time period in which the target LUN is located at the last expansion time, where the working time period of the target LUN is pre-divided into a business busy time period and a business idle time period, and the pre-expansion capacity is larger than a recorded last expansion step length of the snapshot resource; when the time difference is greater than the second preset value, determining a pre-expansion capacity according to the current time and/or the working time period of the last expansion time target LUN, wherein the pre-expansion capacity is smaller than the recorded last expansion step length of the snapshot resource;
and the storage space allocation unit is used for determining the pre-expansion capacity as the capacity to be expanded of the snapshot resource and allocating the free storage space in the equipment, which is consistent with the capacity to be expanded, to the snapshot resource when the pre-expansion capacity is larger than the minimum expansion capacity of the snapshot resource and is smaller than the maximum expansion capacity of the snapshot resource.
9. The apparatus according to claim 8, wherein the pre-expansion-capacity determining unit determines the pre-expansion capacity according to the current time and/or the working period of the last expansion time target LUN when the time difference is smaller than the first preset value:
if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is N1 times of the last expansion step;
if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is N2 times of the last expansion step length;
and if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is N3 times of the last expansion step, wherein N1> N2> N3> 1.
10. The apparatus according to claim 8, wherein the pre-expansion-capacity determining unit determines the pre-expansion capacity according to the current time and/or the working period of the last expansion time target LUN when the time difference is greater than the second preset value:
if the current time target LUN is in a busy service period, determining that the pre-expansion capacity is K1 times of the last expansion step;
if the current time target LUN is in a service idle period and the last expansion time target LUN is in a service busy period, determining that the pre-expansion capacity is K2 times of the last expansion step length;
and if the current time and the last expansion time target LUN are both in the service idle period, determining that the pre-expansion capacity is K3 times of the last expansion step length, wherein 0< K3< K2< K1< 1.
CN202110137837.0A 2021-02-01 2021-02-01 Storage space allocation method and device Active CN112835521B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110137837.0A CN112835521B (en) 2021-02-01 2021-02-01 Storage space allocation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110137837.0A CN112835521B (en) 2021-02-01 2021-02-01 Storage space allocation method and device

Publications (2)

Publication Number Publication Date
CN112835521A CN112835521A (en) 2021-05-25
CN112835521B true CN112835521B (en) 2022-02-18

Family

ID=75931180

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110137837.0A Active CN112835521B (en) 2021-02-01 2021-02-01 Storage space allocation method and device

Country Status (1)

Country Link
CN (1) CN112835521B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200723108A (en) * 2005-12-15 2007-06-16 Inventec Corp System and method for expanding capacity of snapshots
CN105095102A (en) * 2015-08-12 2015-11-25 浪潮(北京)电子信息产业有限公司 Automatic expansion method and device for snapshot volume
CN107045530A (en) * 2017-01-20 2017-08-15 华中科技大学 A kind of method that object storage system is embodied as to local file system
CN107092442A (en) * 2017-04-24 2017-08-25 杭州宏杉科技股份有限公司 Storage system resources distribution method and device
WO2017144011A1 (en) * 2016-02-25 2017-08-31 腾讯科技(深圳)有限公司 Method and device for allocating resources
CN109684271A (en) * 2018-12-13 2019-04-26 杭州宏杉科技股份有限公司 Snapshot data management method, device, electronic equipment and machine readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200723108A (en) * 2005-12-15 2007-06-16 Inventec Corp System and method for expanding capacity of snapshots
CN105095102A (en) * 2015-08-12 2015-11-25 浪潮(北京)电子信息产业有限公司 Automatic expansion method and device for snapshot volume
WO2017144011A1 (en) * 2016-02-25 2017-08-31 腾讯科技(深圳)有限公司 Method and device for allocating resources
CN107045530A (en) * 2017-01-20 2017-08-15 华中科技大学 A kind of method that object storage system is embodied as to local file system
CN107092442A (en) * 2017-04-24 2017-08-25 杭州宏杉科技股份有限公司 Storage system resources distribution method and device
CN109684271A (en) * 2018-12-13 2019-04-26 杭州宏杉科技股份有限公司 Snapshot data management method, device, electronic equipment and machine readable storage medium

Also Published As

Publication number Publication date
CN112835521A (en) 2021-05-25

Similar Documents

Publication Publication Date Title
US9081702B2 (en) Working set swapping using a sequentially ordered swap file
US8438346B2 (en) Synchronization of a virtual storage system and an actual storage system
US9396353B2 (en) Data allocation among devices with different data rates
CN111488241A (en) Method and system for realizing agent-free backup and recovery operation on container arrangement platform
JP6064608B2 (en) Storage device, backup program, and backup method
EP2778889A1 (en) Dynamic storage device provisioning
US20140254042A1 (en) Dynamic allocation of lba to un-shingled media partition
EP2261790A2 (en) Method and apparatus for controlling data volume creation in data storage system with dynamic chunk allocation capability
US11099735B1 (en) Facilitating the recovery of full HCI clusters
CN108037894B (en) Disk space management method and device
CN109684271B (en) Snapshot data management method and device, electronic equipment and machine-readable storage medium
US20150293719A1 (en) Storage Space Processing Method and Apparatus, and Non-Volatile Computer Readable Storage Medium
CN114995771A (en) Formatting scheduling method, device, equipment and medium for redundant array of independent disks
JP2005208950A (en) Replicated data storage system, method and program of storage device
US8479040B2 (en) Storage system and control method
CN109739688B (en) Snapshot resource space management method and device and electronic equipment
CN112835521B (en) Storage space allocation method and device
CN111124294B (en) Sector mapping information management method and device, storage medium and equipment
US10235089B2 (en) Storage control device, method and storage system to backup data using allocation information
US9547450B2 (en) Method and apparatus to change tiers
US20240004563A1 (en) Performance Efficient and Resilient Creation of Network Attached Storage Obects
CN109508140B (en) Storage resource management method and device, electronic equipment and system
CN109558068B (en) Data migration method and migration system
US20070061530A1 (en) Method for storage of digital data in a mainframe data center and associated device
CN114721585A (en) Storage management method, apparatus and computer program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant