A cascade snapshot processing method, device, equipment and storage medium

By setting different data block sizes and bitmaps for each snapshot in the cascade snapshot, the performance problem caused by the consistency of the data block size in the cascade snapshot is solved, and the background is improved without affecting the host read and write performance. Effect of copy speed.

CN114942863BActive Publication Date: 2024-10-18INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210465677.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-29
Publication Date
2024-10-18
Estimated Expiration
2042-04-29

AI Technical Summary

Technical Problem

In the existing technology, the data block sizes of cascaded snapshots must be consistent, which affects system performance when generating snapshots. It is impossible to reduce the impact on host read and write performance and improve the background copy speed at the same time.

Method used

By setting a different block size for each snapshot in a cascade and performing processing operations on the source or destination volume based on the block size and bitmap of each snapshot, including receiving background copy, read, and write instructions , find dependent data blocks, and perform equivalent expansion and copy operations to support the processing of data blocks of different sizes.

Benefits of technology

It is possible to increase the background copy speed of cascaded snapshots without affecting the read and write performance of the host, thereby improving the flexibility and performance of the storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114942863B_ABST
    Figure CN114942863B_ABST
Patent Text Reader

Abstract

The present invention discloses a cascade snapshot processing method, device, equipment and storage medium; in this scheme, after determining the source volume and the target volume, it is necessary to set the data block size of each snapshot in the cascade snapshot, create a bitmap of each snapshot according to the total size of the source volume and the data block size of each snapshot; perform processing operations on the source volume or the target volume according to the data block size and the bitmap of each snapshot. It can be seen that the data block sizes in this scheme are not exactly the same, so this scheme can set different data block sizes for each snapshot according to actual usage, so as to reduce the impact on the host read and write performance while upgrading the background copy speed of the cascade snapshot, such as: for snapshots with host read and write, a small data block size can be set to reduce the impact on the host read and write and improve the storage system performance; and for snapshots with background copy, a large data block size is set to increase the background copy speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage technology, and more specifically, to a cascade snapshot processing method, device, equipment and storage medium. Background Art

[0002] At present, snapshot technology divides volumes into data blocks (grains) of equal size. After a snapshot is generated for a volume, data synchronization from the source volume to the target volume is performed, which is divided into two copying methods: Copy On Write (COW) and background copy. The size of the data block (grainsize) has different effects on copy on write and background copy. The larger the grainsize, the more data needs to be copied from the source volume to the target volume each time the snapshot is synchronized. The scenario in which copy on write is triggered is that the host has IO (Input Output) to the source volume. Regardless of the amount of data corresponding to the IO, the entire data block needs to be COWed. The larger the grainsize, the more data needs to be copied. Assuming that the grainsize is 256KB and the IO sent by the host is 4KB, when doing COW, 256KB of data needs to be copied from the source volume to the target volume; in the background copy scenario, the number of background copy tasks that the storage system can support at the same time is limited. Therefore, the larger the grainsize, the more data is copied in the same background copy task, which means that a higher background copy speed can be supported.

[0003] In actual application scenarios, after the source volume generates a snapshot, you can continue to generate snapshots for the target volume of the snapshot. Cascading snapshots exist in the storage system in the form of a linked list; in most scenarios, the source volume will continue to be read and written by the host, so the snapshot of the source volume is usually not copied in the background, and a smaller grainsize is required to ensure the performance of the source volume; and the snapshot of the snapshot generally sets the background copy speed to obtain an independent copy of the data faster, and the current data synchronization mechanism requires that the number of bitmap bits of all snapshots in the cascade snapshot is consistent, and each bit corresponds to the same grainsize, which will inevitably affect the system performance. For example, if the grainsize is set too small, it will affect the background copy speed, and if the grainsize is set too large, it will affect the host read and write performance.

[0004] Therefore, how to reduce the impact on the host read and write performance, ensure the performance of the storage system, and improve the background copy speed of the cascade snapshot is a problem that technical personnel in this field need to solve. Summary of the invention

[0005] The object of the present invention is to provide a cascade snapshot processing method, device, equipment and storage medium, so as to improve the background copy speed of the cascade snapshot while reducing the impact on the host read and write performance and ensuring the performance of the storage system.

[0006] To achieve the above object, the present invention provides a cascade snapshot processing method, comprising:

[0007] Determine a source volume and each target volume created when the source volume is cascaded snapshot;

[0008] Set the data block size of each snapshot in the cascade snapshot. The data block sizes are not exactly the same.

[0009] Creating a bitmap for each snapshot according to the total size of the source volume and the data block size of each snapshot;

[0010] Perform processing operations on the source volume or target volume based on the data block size and bitmap of each snapshot.

[0011] The performing of processing operations on the source volume or the target volume according to the data block size and the bitmap of each snapshot includes:

[0012] Receiving a background copy instruction for a target data block; the target data block is a data block located on a source volume or a target volume;

[0013] Taking an upstream snapshot adjacent to the target data block as a target snapshot, and determining whether a bit value corresponding to the position of the target data block in a bitmap of the target snapshot is one;

[0014] If so, it is determined that the copy is completed;

[0015] If not, searching for a dependent data block corresponding to the target data block according to each upstream snapshot of the target snapshot, and copying the data stored in the dependent data block to the target data block.

[0016] The performing of processing operations on the source volume or the target volume according to the data block size and the bitmap of each snapshot includes:

[0017] Receiving a data read instruction for a target data block sent by a host; the target data block is a data block located on a source volume or a target volume;

[0018] Taking an upstream snapshot adjacent to the target data block as a target snapshot, and determining whether a bit value corresponding to the position of the target data block in a bitmap of the target snapshot is one;

[0019] If yes, directly read the data from the target data block and send it to the host;

[0020] If not, searching for a dependent data block corresponding to the target data block according to each upstream snapshot of the target snapshot, and sending the data stored in the dependent data block to the host.

[0021] The step of searching for a dependent data block corresponding to the target data block according to each upstream snapshot of the target snapshot includes:

[0022] Determining whether the target snapshot has an upstream snapshot;

[0023] If there is no upstream snapshot, taking the data block in the source volume at the same position as the target data block as the dependent data block;

[0024] If there are upstream snapshots, determining the bit value of the target data block at the corresponding position in the bitmap of each upstream snapshot and the maximum number of bit values ​​according to the bitmap and data block size of each upstream snapshot;

[0025] Performing equal value expansion on the bit values ​​of the corresponding positions of the target data block in the bitmap of each upstream snapshot, and dividing the target data block into a plurality of small data blocks; wherein the number of the bit values ​​after equal value expansion and the number of the small data blocks are both the maximum number of the bit values;

[0026] According to the snapshot linked list, the dependent data blocks having a bit value of 1 at the same position as each data block are searched in the bitmap of each upstream snapshot in turn.

[0027] The performing of processing operations on the source volume or the target volume according to the data block size and the bitmap of each snapshot includes:

[0028] Receiving a data write instruction for a target data block sent by a host;

[0029] Determine whether the target data block has an upstream snapshot;

[0030] If there is no upstream snapshot, determining whether the target data block has a downstream snapshot;

[0031] If there is an upstream snapshot, determining a first target position corresponding to the target data block according to the adjacent upstream snapshot, and determining whether a bit value of the first target position in the bitmap of the adjacent upstream snapshot is one;

[0032] If the bit value is one, continue to execute the step of determining whether the target data block has a downstream snapshot; if the bit value is not one, search for a dependent data block corresponding to the first target position according to each upstream snapshot, copy the data stored in the dependent data block to the first target position, and continue to execute the step of determining whether the target data block has a downstream snapshot;

[0033] If the target data block has a downstream snapshot, determine a second target position corresponding to the target data block according to the adjacent downstream snapshot; determine whether the bit value of the second target position in the bitmap of the adjacent downstream snapshot is one; if the bit value is one, write the host data carried in the data write instruction into the target data block; if the bit value is not one, copy the data in the target data block to the second target position of the adjacent downstream target volume, and continue to execute the step of writing the host data carried in the data write instruction into the target data block;

[0034] If the target data block has no downstream snapshot, the host data carried in the data write instruction is written into the target data block.

[0035] The searching for the dependent data block corresponding to the first target location according to each upstream snapshot includes:

[0036] Determine, according to the bitmaps and data block sizes of the upstream snapshots, the bit values ​​of the corresponding positions of the first target positions in the bitmaps of the upstream snapshots, and the maximum number of bit values;

[0037] Performing equal-value expansion on the bit values ​​of the corresponding positions of the first target position in the bitmaps of each upstream snapshot, and dividing the target data block into a plurality of small data blocks; wherein the number of the bit values ​​after equal-value expansion and the number of the small data blocks are both the maximum number of the bit values;

[0038] According to the snapshot linked list, the dependent data blocks having a bit value of 1 at the same position as each data block are searched in the bitmap of each upstream snapshot in turn.

[0039] The step of setting the data block size of each snapshot in the cascade snapshot includes:

[0040] Determine a first snapshot of a volume where a host processing operation is performed, and a second snapshot of a volume where a background copy processing operation is performed;

[0041] The data block size of the first snapshot is set to be smaller than the data block size of the second snapshot; wherein, among any two data block sizes, the data block size with a smaller value can divide the data block size with a larger value.

[0042] To achieve the above object, the present invention further provides a cascade snapshot processing device, comprising:

[0043] A determination module, used to determine a source volume and each target volume created when the source volume is cascaded snapshot;

[0044] The setting module is used to set the data block size of each snapshot in the cascade snapshot. The sizes of each data block are not exactly the same;

[0045] A creation module, used for creating a bitmap of each snapshot according to the total size of the source volume and the data block size of each snapshot;

[0046] The processing module is used to perform processing operations on the source volume or the target volume according to the data block size and the bitmap of each snapshot.

[0047] To achieve the above object, the present invention further provides an electronic device, comprising:

[0048] Memory for storing computer programs;

[0049] A processor is used to implement the steps of the above-mentioned cascade snapshot processing method when executing the computer program.

[0050] To achieve the above object, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above cascade snapshot processing method are implemented.

[0051] Through the above scheme, it can be known that the embodiment of the present invention provides a cascade snapshot processing method, device, equipment and storage medium; in this scheme, after determining the source volume and each target volume created when the source volume is cascaded snapshot, it is necessary to set the data block size of each snapshot in the cascade snapshot, and create a bitmap of each snapshot according to the total size of the source volume and the data block size of each snapshot; perform processing operations on the source volume or target volume according to the data block size and bitmap of each snapshot. It can be seen that in this scheme, the sizes of each data block are not exactly the same, so this scheme can set different data block sizes for each snapshot according to actual usage, so as to reduce the impact on the host read and write performance while upgrading the background copy speed of the cascade snapshot, such as: for snapshots with host read and write, a small data block size can be set to reduce the impact on the host read and write and improve the storage system performance; and for snapshots with background copy, a large data block size is set to increase the background copy speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0053] Figure 1 A schematic diagram of a cascade snapshot processing method disclosed in an embodiment of the present invention;

[0054] Figure 2 A schematic diagram of a copy process disclosed in an embodiment of the present invention;

[0055] Figure 3 A schematic diagram of another copying process disclosed in an embodiment of the present invention;

[0056] Figure 4 A schematic diagram of a data operation flow disclosed in an embodiment of the present invention;

[0057] Figure 5 A schematic diagram of another data operation flow disclosed in an embodiment of the present invention;

[0058] Figure 6 A schematic diagram of another data operation flow disclosed in an embodiment of the present invention;

[0059] Figure 7 A schematic diagram of another data operation flow disclosed in an embodiment of the present invention;

[0060] Figure 8 A schematic diagram of the structure of a cascade snapshot processing device disclosed in an embodiment of the present invention;

[0061] Fig. 9 The present invention is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0062] A snapshot is a copy of a specified data set at a specific point in time. It is a fully available copy. Snapshot technology can protect data and is widely used in the field of disaster recovery. Copy-on-write means that when the data of a data block of the source volume is modified for the first time, the data of the data block of the source volume is copied to the target volume, and then the data block in the source volume is modified; background copy means that the data blocks of the source volume are copied to the target volume in the order of their position in the volume from small to large according to the specified rate. Whether it is copy-on-write or background copy, a bitmap is required, and each bit corresponds to a data block of the volume to mark whether each data block has been copied (copied means that the data of the target volume can be used independently, and uncopied means that the data of the target volume depends on the source volume), so as to avoid duplicate copies of the same data block. After the source volume generates a snapshot, snapshots can be generated for the target volume of the snapshot. Cascade snapshots exist in the form of linked lists in the storage system.

[0063] For example, volume A generates snapshot 1 to get target volume B, then generates snapshot 2 for volume B to get target volume C, and then volume C generates snapshot 3 to get target volume D. Then the dependency relationship of the data on the volumes is A←B←C←D, that is, volume D depends on volume C, volume C depends on volume B, and volume B depends on volume A. The snapshot list is snapshot 1←snapshot 2←snapshot 3. When synchronizing the data from snapshot 3 volume C to volume D, it is necessary to first determine whether the current grain needs to be copied, and if so, from which volume to copy the data. Specifically, first determine whether the corresponding bit of the bitmap of snapshot 3 is 1. If it is 1, it means that no copy is required and the data is now on volume D; otherwise, it is considered that a copy is required, and continue to trace upstream until a snapshot with a bitmap corresponding to 1 is found, and then copy the data from the target volume of the snapshot to volume D; if the bitmap bits of all snapshots are 0 when tracing upstream, copy the data from the source volume A to volume D. This data synchronization mechanism requires that the number of bitmap bits in all snapshots in the cascade snapshot is consistent, and each bit corresponds to the same grain size, which will inevitably affect system performance.

[0064] Therefore, in an embodiment of the present invention, in order to solve the problem that the grainsize of all snapshots in the cascade snapshot must be the same in the current technology, a cascade snapshot processing method, apparatus, device and storage medium are provided. In this solution, different grainsizes can be set for different snapshots in a cascade snapshot, so that different requirements can be met, which not only reduces the impact of the source volume on receiving host IO and ensures the performance of the source volume, but also can improve the background copy speed of the cascade snapshot.

[0065] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0066] See also Figure 1 , a schematic flow chart of a cascade snapshot processing method provided by an embodiment of the present invention includes:

[0067] S101, determining a source volume and each target volume created when a cascade snapshot is performed on the source volume;

[0068] In this embodiment, it is first necessary to determine the source volume and each target volume created when performing cascading snapshots, such as: generating snapshot 1 for source volume A to obtain target volume B, generating snapshot 2 for volume B to obtain target volume C, generating snapshot 3 for volume C to obtain target volume D, and generating snapshot 4 for volume D to obtain target volume E.

[0069] S102, setting the data block size of each snapshot in the cascade snapshot, wherein the sizes of the data blocks are not completely the same;

[0070] In this embodiment, when setting the data block size of each snapshot, the data block sizes can be set to be different. Here, different means that there are at least two data block sizes in each data block size. For example, if there are 4 snapshots, the scheme can set the data block sizes of the 4 snapshots to be different, that is, there are 4 data block sizes in the 4 snapshots; or, 3 data block sizes are set in the 4 snapshots, or 2 data block sizes are set in the 4 snapshots; and, when setting the data block size of each snapshot in the cascade snapshot, the scheme can determine the first snapshot where the volume that performs the host processing operation is located, and the second snapshot where the volume that performs the background copy processing operation is located, and then set the data block size of the first snapshot to be smaller than the data block size of the second snapshot. By setting a smaller grainsize for the snapshot where the volume with host IO is located, the write amplification during COW operation can be reduced, the impact on the host IO can be reduced, and the performance of the storage system can be improved; and for the snapshot with background copy enabled, by setting a larger grainsize, more data can be copied in the background copy action of a grain, avoiding frequent thread switching, thereby supporting a higher background copy speed.

[0071] It should be noted that in actual application scenarios, usually only the source volume at the head of the linked list in the cascade snapshot needs to receive host IO, and the read and write IO performance of the source volume is more concerned; for the snapshot volume, it is hoped that a data copy independent of the source volume will be obtained more quickly, so the background copy speed of the snapshot is more concerned. This solution supports multi-grainsize cascade snapshots, which can meet the requirements of high background copy speed in cascade snapshots while minimizing the impact on host performance, greatly improving the flexibility of the storage system.

[0072] Furthermore, in this scheme, when setting the data block size, it is necessary to ensure that the data block size of the smaller value can divide the data block size of the larger value among any two data block sizes. For example, the data block size of snapshot 1 is set to 8, the data block size of snapshot 2 is set to 16, the data block size of snapshot 3 is set to 4, and the data block size of snapshot 4 is set to 8. This setting method can ensure that the subsequent processing operation process is executed smoothly.

[0073] S103, creating a bitmap for each snapshot according to the total size of the source volume and the data block size of each snapshot;

[0074] In this embodiment, after creating the snapshot mapping relationship between the source volume and the target volume, it is also necessary to calculate the size of each bitmap, that is, the number of bits in the bitmap, according to the total size of the volume and the data block size grainsize of each snapshot. The size of the bitmap indicates how many data blocks the data volume is divided into for data copying when copying data. In addition, different snapshots are allowed to have different grainsizes, but the grainsizes of the cascaded snapshots in the same linked list must be divisible. Then, a bitmap is created according to the calculated bitmap size, and all bits in the bitmap are initialized to 0. For example, if the total size of the source volume is 64, the data block size of snapshot 1 is set to 8, the data block size of snapshot 2 is set to 16, the data block size of snapshot 3 is set to 4, and the data block size of snapshot 4 is set to 8, then the bitmap size of snapshot 1 is 64 / 8=8, the bitmap size of snapshot 2 is 64 / 16=4, the bitmap size of snapshot 3 is 64 / 4=16, and the bitmap size of snapshot 4 is 64 / 8=16. A corresponding bitmap is created according to each bitmap size, and all bits in the bitmap are initialized to 0.

[0075] It should be noted that the value of the bit in the bitmap is updated in real time according to the copy status. This process is consistent with the update process in the related art, that is, if the data block corresponding to the bit is copied, the bit value is set to 1. For example, when the source volume A generates snapshot 1 to obtain the target volume B, the bit value is set to 1. Figure 1 is the bitmap corresponding to snapshot 1. If the data block size of snapshot 1 is 8 and the bitmap size is 8, it means that the source volume A with a size of 64 needs to be divided into 8 data blocks for data copying. The size of each data block is 8. When the source volume A copies the data of the third data block with a size of 8 to volume B, the bitmap size is 8. Figure 1 The value of the third position in should be 1, indicating that the data has been copied.

[0076] S104: Perform processing operations on the source volume or the target volume according to the data block size and the bitmap of each snapshot.

[0077] In this embodiment, different processing operations can be performed based on cascade snapshots of different data block sizes, such as: performing background copy processing operations, host read IO processing operations, host write IO processing operations, and the like. In addition, the data volume for performing the operation can be a source volume or a target volume, which is not specifically limited here. Specifically, for the IO sent by the host, the volume receiving the IO is defined as the client volume. For read IO, the dependent data corresponding to the client volume is queried, and then the dependent data is returned to the host; for write IO, the snapshot corresponding to the client volume as the source volume and the snapshot corresponding to the target volume are queried, and the data copy of the grains corresponding to the two snapshots is completed. If the corresponding snapshot is not queried, no data copy is performed, and then the data sent by the host is written to the clinet volume; for background copying, one grain is copied each time to complete the data copy of the grain.

[0078] In summary, in this solution, the data block sizes of each snapshot are not exactly the same. Therefore, this solution can set a different data block size for each snapshot according to actual usage to reduce the impact on the host read and write performance while upgrading the background copy speed of the snapshot. For example, for snapshots with host read and write, a small data block size can be set to reduce the impact on host read and write and improve storage system performance; and for snapshots with background copy, a large data block size is set to increase the background copy speed.

[0079] Based on the above embodiments, in this embodiment, when processing operations are performed on the source volume or target volume according to the data block size and bitmap of each snapshot, the processing operations are specifically divided into background copy processing operations, data read processing operations, and data write processing operations for explanation by way of example.

[0080] 1. If the processing operation is a background copy processing operation, then after receiving the background copy instruction for the target data block, this solution will use the upstream snapshot adjacent to the target data block as the target snapshot, and determine whether the bit value corresponding to the position of the target data block in the bitmap of the target snapshot is one; if so, it is determined that the copy is completed; if not, the dependent data block corresponding to the target data block is searched according to each upstream snapshot of the target snapshot, and the data stored in the dependent data block is copied to the target data block; the target data block is a data block located on the source volume or the target volume.

[0081] In this embodiment, after receiving the background copy instruction for the target data block, the following steps need to be performed:

[0082] 1) Start a thread to copy a data block grain in the snapshot. In this embodiment, the data block to be copied is called the target data block;

[0083] 2) Assuming that the target data block to be copied is the i-th grain (i ranges from 0 to n-1, and n is the total number of grains), define the target snapshot to be copied as tgtMap, the target volume as tgtLun, the corresponding location as tgtGrain, and define a cache space of size tgtGrainsize. Figure 2 , is a schematic diagram of a copy process provided by an embodiment of the present invention, through Figure 2 It can be seen that the source volume A generates snapshot 1 to obtain the target volume B, and snapshot 2 is generated for volume B to obtain the target volume C, and snapshot 3 is generated for volume C to obtain the target volume D, and snapshot 4 is generated for volume D to obtain the target volume E. The data block size and the corresponding bitmap are marked under each snapshot; and the target data block to be copied this time is the third data block in the snapshot volume E, i=2, then the upstream snapshot adjacent to the target data block is used as the target snapshot, that is: the target snapshot tgtMap to be copied is snapshot 4, the target volume tgtLun is snapshot volume E, and the corresponding position tgtGrain is the third data block position.

[0084] 3) Read the bit value corresponding to tgtGrain in the target snapshot tgtMap bitmap. If the bit value is 1, it means that the dependent data is on the target volume, and the copy is considered complete, ending the data copy; if the bit value is 0, it means that the target data block has not been copied, and continue to step 4).

[0085] 4) Determine whether the target snapshot tgtMap has an upstream snapshot; if there is no upstream snapshot, use the data block in the source volume at the same position as the target data block as the dependent data block, store the data in the dependent data block into the cache space, and execute step 8). If there is an upstream snapshot, continue to execute step 5).

[0086] It should be noted that in this solution, when judging whether the target snapshot has an upstream snapshot, the linked list will be searched to see whether the target snapshot tgtMap has an upstream snapshot upMap, such as Figure 2 As shown, the linked list refers to snapshot 1, snapshot 2, snapshot 3, and snapshot 4. If the target snapshot is snapshot 1, it means that the target snapshot has no upstream snapshot, and the data block corresponding to the target data block position tgtGrain is read from the source volume A of the target snapshot tgtMap as the dependent data block, and the data in the dependent data block is put into the cache space, and step 8 is continued; if the target snapshot is snapshot 4, it means that the target snapshot has an upstream snapshot, and step 5 can be continued at this time.

[0087] 5) If there are upstream snapshots, the bit value and the maximum number of bit values ​​of the corresponding position of the target data block in the bitmap of each upstream snapshot are determined according to the bitmap and data block size of each upstream snapshot.

[0088] In this embodiment, if the target snapshot tgtMap has an upstream snapshot, but since the number of upstream snapshots can be multiple, for the convenience of explanation, this embodiment uses the target snapshot tgtMap as curMap, determines the corresponding tgtGrain position in the upstream snapshot upMap bitmap of curMap, and reads the bit value of the position; wherein, when determining the position corresponding to the target data block in the upstream snapshot upMap, the specific determination method of the position can be determined according to the bitmap of the upstream snapshot upMap and the data block size. If the grainsize of the upstream snapshot upMap is equal to the grainsize of the target snapshot tgtMap, then directly read the value of the i-th bit; if the grainsize of the upstream snapshot upMap is less than the grainsize of the target snapshot tgtMap, then define ratio = tgtGrainsize / upGrainsize, and read the value of the i×ratio~(i+1)×ratio-1th bit; if the grainsize of the upstream snapshot upMap is greater than the grainsize of the target snapshot tgtMap, then define ratio = upGrainsize / tgtGrainsize, and read the value of the i / ratio (rounded down)th bit.

[0089] like Figure 2 As shown, the target snapshot tgtMap is snapshot 4, that is, curMap is snapshot 4, and the upstream snapshot upMap of curMap is snapshot 3, indicating that the i of the target data block position is 2. At this time, the grainsize of the target snapshot tgtMap is 8, and the grainsize of the upstream snapshot upMap is 4, that is, the grainsize (4) of the upstream snapshot upMap is smaller than the grainsize (8) of the target snapshot tgtMap, then ratio = tgtGrainsize / upGrainsize = 8 / 4 = 2, then the value of i of the target data block at the corresponding position of the upstream snapshot should be: 2×2~(2+1)×2-1=4~5, through Figure 2 It can be seen from the bitmap of snapshot 3 that the bit value of the corresponding position of the target data block in the bitmap of the upstream snapshot (snapshot 3) is [0 1], and the number of bit values ​​is 2. Similarly, the bit values ​​of the corresponding positions of the target data block in the bitmaps of each upstream snapshot can be read, and the maximum number of bit values ​​can be determined. Figure 2 In the example, the bit value read in snapshot 4 is [0], the bit value read in snapshot 3 is [0 1], the bit value read in snapshot 2 is [0], and the bit value read in snapshot 1 is [1].

[0090] 6) Determine whether the read upMap bitmap bit value is 1. If there are multiple upMap bitmap bit values, determine whether all the multiple bit values ​​are 1, save the read upMap index and the corresponding bit value. If curMap no longer has an upstream snapshot or the read bit values ​​are all 1, proceed to step 7); otherwise, proceed to step 5) and use upMap as curMap to continue executing subsequent steps.

[0091] 7) Since the grainsize of each snapshot in this scheme is different, it is necessary to perform equal value expansion on the bit values ​​of the corresponding positions of the target data block in the bitmap of each upstream snapshot in this scheme, and divide the target data block into a number of small data blocks; wherein the number of bit values ​​after equal value expansion and the number of small data blocks are both the maximum number of bit values; according to the snapshot linked list, search the bitmap of each upstream snapshot in turn for the dependent data block with the bit value of 1 at the same position as each small data block, read data from each dependent data block as the dependent data of the target data block, and store each dependent data in the cache space;

[0092] like Figure 2 As shown in the figure, the bit value read in snapshot 4 is [0], the bit value read in snapshot 3 is [0 1], the bit value read in snapshot 2 is [0], and the bit value read in snapshot 1 is [1]. The maximum value of the bit values ​​of all upMaps is 2. Therefore, when the target data block at position tgtGrain is split into r small blocks, r is 2. The expansion method is equal value filling. Therefore, the bit value read in snapshot 4 needs to be expanded to [0 0], the bit value read in snapshot 2 needs to be expanded to [0 0], and the bit value read in snapshot 1 needs to be expanded to

[11] . See Figure 3 , is another copy process diagram provided by an embodiment of the present invention, such as Figure 3 As shown, the expanded bit value has been added in each snapshot.

[0093] Furthermore, for each small data block, this solution needs to find the first upMap with a bit value of 1 in the corresponding position (in the order of reading upMap), and read the data corresponding to the tgtGrain position in the upMap target volume into the rth small block in the cache space; if the bit values ​​of all upMap corresponding positions are 0, then read the data corresponding to the tgtGrain position in the source volume of the linked list head into the rth small block in the cache space. When the traversal is completed, the dependent data of the r small blocks are all read into the cache space. Figure 3As shown, if the target data block is divided into two data blocks, for the first data block, the bitmap with a bit value of 1 is searched from the bitmaps of each upstream snapshot in turn according to the snapshot linked list, wherein the bit value of the same position as the first data block in snapshot 4 is 0, the bit value of the same position as the first data block in snapshot 3 is 0, the bit value of the same position as the first data block in snapshot 2 is 0, and the bit value of the same position as the first data block in snapshot 1 is 1, so the data A stored in the dependent data block at the same position as the first data block in snapshot 1 is stored in the cache as dependent data; for the second data block, the bitmap with a bit value of 1 is searched from the bitmaps of each upstream snapshot in turn according to the snapshot linked list, wherein the bit value of the same position as the second data block in snapshot 4 is 0, and the bit value of the same position as the second data block in snapshot 3 is 1, so the data C stored in the dependent data block at the same position as the second data block in snapshot 3 is stored in the cache as dependent data, as shown Figure 3 As shown, the data cached in the cache space is AC.

[0094] 8) Write the data in the cache space to the location of tgtGrain corresponding to the target volume of tgtMap. In other words, through the above process, the data AC can be copied to the target data block.

[0095] 2. If the processing operation is a data read processing operation, then after receiving the data read instruction for the target data block sent by the host, this solution will use the upstream snapshot adjacent to the target data block as the target snapshot, and determine whether the bit value corresponding to the position of the target data block in the bitmap of the target snapshot is one; if so, read the data directly from the target data block and send it to the host; if not, search for the dependent data block corresponding to the target data block according to each upstream snapshot of the target snapshot, and send the data stored in the dependent data block to the host; the target data block is a data block located on the source volume or the target volume.

[0096] In this embodiment, after receiving the data read instruction sent by the host, the volume where the data to be read is located can be used as tgtLun, the snapshot of the volume as the target volume can be used as tgtMap, and the grain position corresponding to the read data can be used as tgtGrain. The subsequent execution process is similar to the background copy process described above, and steps 3) to 7) in the background copy process need to be continued. That is, after receiving the data read instruction sent by the host, this solution needs to execute the following process:

[0097] 1) receiving a data read instruction for a target data block sent by a host, and taking an upstream snapshot adjacent to the target data block as a target snapshot;

[0098] 2) The volume where the data to be read is located is taken as tgtLun, the snapshot of the volume as the target volume is taken as the target snapshot tgtMap, the target snapshot is the upstream snapshot adjacent to the target data block, and the grain position corresponding to the read data is taken as tgtGrain.

[0099] 3) Read the bit value corresponding to tgtGrain in the target snapshot bitmap. If the bit value is 1, it means that the dependent data is on the target volume, then the data is directly read from the tgtGrain position and sent to the host, ending the process; if the bit value is 0, it means that the target data block has not copied the data, and the corresponding data cannot be directly read from the target data block, then continue to step 4).

[0100] 4) Determine whether the target snapshot tgtMap has an upstream snapshot; if there is no upstream snapshot, take the data block in the source volume at the same position as the target data block as the dependent data block, read the data in the dependent data block and send it to the host, ending the process; if there is an upstream snapshot, continue to step 5).

[0101] 5) If there is an upstream snapshot, the bit value and the maximum number of bit values ​​of the corresponding position of the target data block in the bitmap of each upstream snapshot are determined according to the bitmap and data block size of each upstream snapshot. Specifically, in this step, if the target snapshot tgtMap has an upstream snapshot, but the number of upstream snapshots can be multiple, for the convenience of explanation, this embodiment uses the target snapshot tgtMap as curMap, and determines the corresponding tgtGrain position in the upstream snapshot upMap bitmap of curMap, and reads the bit value of the position; wherein, when determining the position corresponding to the target data block in the upstream snapshot upMap, the specific determination method of the position can be determined according to the bitmap and data block size of the upstream snapshot upMap. If the grainsize of the upstream snapshot upMap is equal to the grainsize of the target snapshot tgtMap, the value of the i-th bit is read directly; if the grainsize of the upstream snapshot upMap is smaller than the grainsize of the target snapshot tgtMap, ratio = tgtGrainsize / upGrainsize is defined, and the value of the i×ratio~(i+1)×ratio-1th bit is read; if the grainsize of the upstream snapshot upMap is larger than the grainsize of the target snapshot tgtMap, ratio = upGrainsize / tgtGrainsize is defined, and the value of the i / ratio (rounded down)th bit is read.

[0102] 6) Determine whether the read upMap bitmap bit value is 1. If there are multiple upMap bitmap bit values, determine whether all the multiple bit values ​​are 1, save the read upMap index and the corresponding bit value. If curMap no longer has an upstream snapshot or the read bit values ​​are all 1, proceed to step 7); otherwise, proceed to step 5) and use upMap as curMap to continue executing subsequent steps.

[0103] 7) Since the grainsize of each snapshot in this scheme is different, it is necessary to equally expand the bit values ​​of the corresponding positions of the target data block in the bitmap of each upstream snapshot in this scheme, and divide the target data block into several small data blocks; wherein the number of bit values ​​after equal expansion and the number of small data blocks are both the maximum number of bit values; according to the snapshot linked list, search the bitmap of each upstream snapshot in turn for the dependent data block with the bit value of one at the same position as each small data block, read data from each dependent data block as the dependent data of the target data block, and send it to the host, ending the process.

[0104] 3. If the processing operation is a data write processing operation, after receiving the data write instruction for the target data block sent by the host, this solution determines whether the target data block has an upstream snapshot; if there is no upstream snapshot, it determines whether the target data block has a downstream snapshot; if there is an upstream snapshot, it determines the first target position corresponding to the target data block according to the adjacent upstream snapshots, and determines whether the bit value of the first target position in the bitmap of the adjacent upstream snapshot is one; if the bit value is one, the step of determining whether the target data block has a downstream snapshot is continued; if the bit value is not one, the dependent data block corresponding to the first target position is searched according to each upstream snapshot, and the data stored in the dependent data block is copied to the first target position, and the step of determining whether the target data block has a downstream snapshot is continued;

[0105] If the target data block has a downstream snapshot, determine the second target position corresponding to the target data block according to the adjacent downstream snapshot; determine whether the bit value of the second target position in the bitmap of the adjacent downstream snapshot is one; if the bit value is one, write the host data carried in the data write instruction into the target data block; if the bit value is not one, copy the data in the target data block to the second target position of the adjacent downstream target volume, and continue to execute the step of writing the host data carried in the data write instruction into the target data block; if the target data block has no downstream snapshot, write the host data carried in the data write instruction into the target data block.

[0106] It should be noted that when processing the data write instruction sent by the host, the general processing principle of this embodiment is: determine whether the current location to be written has been written with data. If no data has been written, search for dependent data from each upstream data volume and copy it to the location to be written; if data is to be written, determine whether the currently written data has been copied to the downstream data volume. If it has been copied to the downstream data volume, or there is no downstream data volume, directly write the data sent by the host to the location to be written. Based on the above principles, this embodiment provides a specific processing flow, and the steps of the flow are as follows:

[0107] 1)1.1: Define the volume to be written as the client volume, and determine whether the client volume has an upstream snapshot. If the client volume is the first volume in the linked list and has no upstream snapshot, skip step 1) and proceed to step 2). If there is an upstream snapshot, continue to step 1.2.

[0108] See also Figure 4 , is a data operation flow diagram provided by an embodiment of the present invention. It can be seen from the figure that there are 5 volumes, volume A to volume E, and 4 snapshots (volume A->volume B is snapshot ①, volume B->volume C is snapshot ②, volume C->volume D is snapshot ③, volume D->volume E is snapshot ④), the total size of all volumes = 64, the grainsize of snapshot ① = 8, the grainsize of snapshot ② = 16, the grainsize of snapshot ③ = 4, the grainsize of snapshot ④ = 8, and the bitmap of the snapshot is below each snapshot. Figure 4 As shown, if the volume to which data is to be written is volume A, it has no upstream snapshot, and step 2) is performed; if the volume to which data is to be written is volume C, it has an upstream snapshot, and its upstream snapshot is snapshot ②, and step 1.2 is continued.

[0109] 1.2: If there is an upstream snapshot, confirm the first target location (tgtGrain location) corresponding to the target data block based on the upstream snapshot of the client volume. Determine the bit value of the bitmap corresponding to tgtGrain of the upstream snapshot. If bit = 1, it means that the data on the source volume has been copied to the client volume, and you can skip step 1) and execute step 2); if the bit is not 1, execute step 1.3;

[0110] like Figure 4 As shown in the figure, if the client volume is volume C, then its upstream snapshot is snapshot ②, see Figure 5, is another data operation flow diagram provided by an embodiment of the present invention. At this time, the target data blocks to be written are the four target data blocks marked in dark colors in volume C, and at this time, the grainsize of snapshot ② is 16, so the first target position corresponding to the target data block is the position where the 16 data blocks marked by black boxes in volume C are located, and the bitmap bit value corresponding to the first target position in snapshot ② is 0, and step 1.3 is executed;

[0111] 1.3: If the bit is 0, it is necessary to search for the dependent data block corresponding to the first target location according to each upstream snapshot, copy the data stored in the dependent data block to the first target location, and continue to execute the step of determining whether the target data block has a downstream snapshot.

[0112] In this embodiment, when searching for the dependent data block corresponding to the first target position according to each upstream snapshot, the following operations need to be performed specifically: according to the bitmap and data block size of each upstream snapshot, determine the bit value of the corresponding position of the first target position in the bitmap of each upstream snapshot, and the maximum number of bit values; perform equal-value expansion on the bit value of the corresponding position of the first target position in the bitmap of each upstream snapshot, and divide the target data block into a number of small data blocks; wherein the number of bit values ​​after equal-value expansion and the number of small data blocks are both the maximum number of bit values; according to the snapshot linked list, search for the dependent data small block whose bit value is one at the same position as each small data block from the bitmap of each upstream snapshot in turn.

[0113] like Figure 5 As shown in FIG. 1 , when searching for dependent data upward and copying it to the client volume, the bitmap data corresponding to the tgtGrain position in all upstream snapshots of the client volume needs to be expanded to obtain the expanded tgtGrain bitmap. In this embodiment, firstly, according to the bitmap and data block size of each upstream snapshot, the bit value of the corresponding position of the first target position in the bitmap of each upstream snapshot and the maximum number of bit values ​​are determined, such as in Figure 5 In the example, snapshots ② and ① are upstream snapshots. The position corresponding to the first target position in snapshot ② is [0], and the number of place values ​​is 1. The position corresponding to the first target position in snapshot ① is [1 0], and the number of place values ​​is 2. Therefore, the maximum number of place values ​​is 2.

[0114] When the bit values ​​of the first target position in the bitmap of each upstream snapshot are equally expanded and the target data block is divided into several small data blocks, since the maximum number of bit values ​​is 2, the bit values ​​of the first target position in the bitmap of each upstream snapshot need to be equally expanded to two bits and the target data block needs to be divided into two small data blocks. Figure 6 , is another data operation flow diagram provided by an embodiment of the present invention, Figure 6The expanded tgtGrain bitmap is labeled. The position corresponding to the first target position in snapshot ② is [0], so after equal value expansion,

[00] is obtained. The position corresponding to the first target position in snapshot ① is [1 0], so no expansion is required.

[0115] In this embodiment, another expansion method is provided, specifically: find the snapshot with the smallest grainsize among all upstream snapshots, and use it as the benchmark grainsize for equal expansion. If the grainsize of an upstream snapshot is larger than the benchmark grainsize, the bitmap of the upstream snapshot is equally expanded, such as expanding one 0 into two 0s; if the grainsize of an upstream snapshot is less than or equal to the benchmark grainsize, the bit value corresponding to the position of the upstream snapshot is directly assigned to the expanded tgtGrain bitmap value. Figure 6 In , the smallest grainsize among all upstream snapshots is 8, so the expansion is based on grainsize=8. The grainsize of snapshot ② is 16, that is, the grainsize (16) of snapshot ② is larger than the base grainsize (8). At this time, it needs to be expanded, and the number of bits in the expanded bitmap should be equal to the grainsize (16) of the client volume's adjacent upstream snapshot divided by the smallest grainsize (8) among all upstream snapshots, that is, the number of expansions should be: 16 / 8=2, so the bit value [0] of snapshot ② is expanded to [0 0]. If the grainsize of snapshot ② is 32, it needs to be expanded to 32 / 8=4. Figure 6 The grainsize of snapshot ① is 8, so the bit value of snapshot ① is directly assigned to the expanded tgtGrain bitmap value. In this embodiment, the size of the expanded tgtGrain bitmap is 2, recorded as graincount, and the tgtGrain on the client volume is divided into graincount small blocks.

[0116] Furthermore, in this embodiment, after searching for dependent data blocks with a bit value of 1 at the same position as each data block from the bitmap of each upstream snapshot in turn according to the snapshot linked list, the dependent data stored in the dependent data block needs to be copied to the data block corresponding to the client volume. In this embodiment, the method for finding dependent data is to traverse upstream all the way to find the first bitmap (referring to the expanded tgtGrain bitmap) with bit=1 upMap, then the dependent data is on the target volume of the upMap. If all the bits of the upMap are 0, then the dependent data is on the first volume (source volume) at the head of the linked list. Figure 6As shown, according to the expanded bitmap, it can be seen that the first data block searches upstream for the snapshot with the bit value of 1 in the first bitmap, which is snapshot ①. Therefore, the dependent data of the first data block is on volume B, and it is copied to the corresponding position of the first data block; after the second data block searches upstream, it is found that there is no snapshot with the bit value of 1 in the bitmap, which means that the dependent data of the second data block is on volume A, and the dependent data of volume A is copied to the corresponding position of the second data block.

[0117] 2)2.1: Check whether the client volume has downstream snapshots; if the client volume is the last volume in the linked list, it means there is no downstream snapshot, so skip step 2) and go directly to step 3). If the client volume is not the last volume, it means there is a downstream snapshot, so go to step 2.2. Figure 4 As shown, if the client volume is volume E, it means that there is no downstream snapshot, and step 3) is executed at this time. If the client volume is volume C, it means that there is a downstream snapshot, and step 2.2 is executed.

[0118] 2.2: If there is a downstream snapshot, first determine the bit value of the second target position corresponding to the target data block based on the adjacent downstream snapshot. If the bit is 1, it indicates that the data on the client volume has been copied to the target volume of the downstream snapshot, and directly execute step 3); if the bit is not 1, it means that it has not been copied to the target volume, and then execute step 2.3.

[0119] See also Figure 7 , is another data operation flow diagram provided by an embodiment of the present invention, through Figure 7 It can be seen that the downstream snapshot of the client volume is snapshot ③. At this time, the target data blocks to be written are the four target data blocks marked in dark colors in volume C, and the grainsize of snapshot ③ is 4. Therefore, the second target position corresponding to the target data block is the position of the four target data blocks in volume C. The bit value of the bitmap corresponding to the second target position in snapshot ③ is 1, then execute step 3).

[0120] 2.3: Copy the data in the target data block to the second target location of the adjacent downstream target volume. Figure 7 As shown, if the bit value of the bitmap corresponding to the second target position in snapshot ③ is 0, the data in the four target data blocks need to be copied to the data blocks at the corresponding positions in volume D.

[0121] 3) The step of writing the host data carried in the data write instruction into the target data block. Figure 7 As shown, the data to be written sent by the host needs to be written into the four target data blocks in volume C.

[0122] From the above, it can be seen that this solution provides a multi-grainsize cascade snapshot processing method, which is designed to support different grainsizes for different snapshots in a cascade snapshot. In this solution, based on the expansion of bitmaps of different grainsizes, the query and merging of dependent data in the snapshot linked list can be realized, thereby supporting cascade snapshot processing of bitmaps of different grainsizes and different sizes. In this way, this solution can set different data block sizes for each snapshot according to actual usage, so as to reduce the impact on the host read and write performance while upgrading the background copy speed of the cascade snapshot.

[0123] The processing apparatus, device and medium provided in the embodiments of the present invention are introduced below. The processing apparatus, device and medium described below and the processing method described above can be referenced to each other.

[0124] See also Figure 8 , a schematic diagram of the structure of a cascade snapshot processing device provided by an embodiment of the present invention includes:

[0125] A determination module 11 is used to determine a source volume and each target volume created when the source volume is cascaded snapshot;

[0126] A setting module 12, used to set the data block size of each snapshot in the cascade snapshot, and the sizes of the data blocks are not completely the same;

[0127] A creation module 13, used to create a bitmap of each snapshot according to the total size of the source volume and the data block size of each snapshot;

[0128] The processing module 14 is used to perform processing operations on the source volume or the target volume according to the data block size and the bitmap of each snapshot.

[0129] Wherein, the processing module includes:

[0130] A first receiving unit is used to receive a background copy instruction for a target data block; the target data block is a data block located on a source volume or a target volume;

[0131] a first judgment unit, configured to take an upstream snapshot adjacent to the target data block as a target snapshot, and judge whether a bit value corresponding to the position of the target data block in a bitmap of the target snapshot is one; if so, determine that the copy is completed; if not, trigger the first search unit;

[0132] A first searching unit, configured to search for a dependent data block corresponding to the target data block according to each upstream snapshot of the target snapshot;

[0133] The first copy unit is used to copy the data stored in the dependent data block to the target data block.

[0134] Wherein, the processing module includes:

[0135] A second receiving unit is used to receive a data reading instruction for a target data block sent by a host; the target data block is a data block located on a source volume or a target volume;

[0136] a second judging unit, configured to take an upstream snapshot adjacent to the target data block as a target snapshot, and judge whether a bit value corresponding to the position of the target data block in the bitmap of the target snapshot is one; if so, trigger the first sending unit; if not, trigger the second searching unit;

[0137] A first sending unit, configured to read data from the target data block and send the data to the host;

[0138] A second searching unit, configured to search for a dependent data block corresponding to the target data block according to each upstream snapshot of the target snapshot, and trigger a second sending unit;

[0139] The second sending unit is used to send the data stored in the dependent data block to the host.

[0140] Wherein, the first search unit and the second search unit both include:

[0141] a judgment subunit, configured to judge whether the target snapshot has an upstream snapshot; if there is no upstream snapshot, taking a data block in the source volume at the same position as the target data block as a dependent data block; if there is an upstream snapshot, triggering a first determination subunit;

[0142] A first determining subunit, configured to determine, according to the bitmaps of the upstream snapshots and the data block sizes, the bit values ​​of the target data blocks at the corresponding positions in the bitmaps of the upstream snapshots and the maximum number of bit values;

[0143] A first expansion subunit is used to equally expand the bit values ​​of the corresponding positions of the target data block in the bitmap of each upstream snapshot, and divide the target data block into a plurality of small data blocks; wherein the number of the bit values ​​after the equally expanded bit values ​​and the number of the small data blocks are both the maximum number of the bit values;

[0144] The first search subunit is used to search the dependent data small blocks whose bit value is 1 at the same position as each data small block in the bitmap of each upstream snapshot in sequence according to the snapshot linked list.

[0145] Wherein, the processing module includes:

[0146] A third receiving unit, configured to receive a data write instruction for a target data block sent by a host;

[0147] a third judgment unit, configured to judge whether the target data block has an upstream snapshot; if there is no upstream snapshot, triggering the fifth judgment unit; if there is an upstream snapshot, triggering the first determination unit;

[0148] a first determining unit, configured to determine a first target position corresponding to the target data block according to the adjacent upstream snapshot, and trigger a fourth determining unit;

[0149] a fourth judgment unit, configured to judge whether the bit value of the first target position in the bitmap of the adjacent upstream snapshot is one; if the bit value is one, triggering the fifth judgment unit; if the bit value is not one, triggering the third search unit;

[0150] a third search unit, configured to search for a dependent data block corresponding to the first target location according to each upstream snapshot, and trigger a second copy unit;

[0151] a second copy unit, configured to copy the data stored in the dependent data block to the first target location, and trigger a fifth determination unit;

[0152] a fifth determining unit, configured to determine whether the target data block has a downstream snapshot; if the target data block has a downstream snapshot, triggering the second determining unit; if the target data block has no downstream snapshot, triggering the data writing unit;

[0153] A second determining unit, configured to determine a second target position corresponding to the target data block according to an adjacent downstream snapshot;

[0154] a sixth judgment unit, configured to judge whether the bit value of the second target position in the bitmap of the adjacent downstream snapshot is one; if the bit value is one, triggering the data writing unit; if the bit value is not one, triggering the third copying unit;

[0155] a third copy unit, configured to copy the data in the target data block to a second target location of an adjacent downstream target volume, and trigger a data writing unit;

[0156] A data writing unit is used to write the host data carried in the data writing instruction into the target data block.

[0157] Wherein, the third search unit includes:

[0158] a second determining subunit, configured to determine, according to the bitmaps and data block sizes of the upstream snapshots, the bit values ​​of the corresponding positions of the first target positions in the bitmaps of the upstream snapshots and the maximum number of bit values;

[0159] A second expansion subunit performs equal-value expansion on the bit values ​​of the corresponding positions of the first target position in the bitmaps of each upstream snapshot, and divides the target data block into a plurality of small data blocks; wherein the number of the bit values ​​after equal-value expansion and the number of the small data blocks are both the maximum number of the bit values;

[0160] The second search subunit is used to search the dependent data small blocks whose bit value is 1 at the same position as each data small block in the bitmap of each upstream snapshot in turn according to the snapshot linked list.

[0161] The setting module is specifically used to: determine a first snapshot of a volume where a host processing operation is performed, and a second snapshot of a volume where a background copy processing operation is performed; set a data block size of the first snapshot to be smaller than a data block size of the second snapshot; wherein, among any two data block sizes, a data block size with a smaller value can divide a data block size with a larger value.

[0162] See also Fig. 9 , an embodiment of the present invention further provides a schematic diagram of the structure of an electronic device, including:

[0163] A memory 21, used for storing computer programs;

[0164] The processor 22 is configured to implement the steps of the cascade snapshot processing method described in any of the above method embodiments when executing the computer program.

[0165] In this embodiment, the device may be a PC (Personal Computer), or may be a terminal device such as a smart phone, a tablet computer, a PDA, or a portable computer.

[0166] The device may include a memory 21 , a processor 22 , and a bus 23 .

[0167] Among them, the memory 21 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 21 can be an internal storage unit of the device, such as a hard disk of the device. In other embodiments, the memory 21 can also be an external storage device of the device, such as a plug-in hard disk equipped on the device, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Further, the memory 21 can also include both an internal storage unit of the device and an external storage device. The memory 21 can not only be used to store application software and various types of data installed in the device, such as program codes for executing processing methods, etc., but can also be used to temporarily store data that has been output or is to be output.

[0168] In some embodiments, the processor 22 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 21, such as program codes for executing processing methods.

[0169] The bus 23 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0170] Furthermore, the device may also include a network interface 24, which may optionally include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the device and other electronic devices.

[0171] Optionally, the device may further include a user interface 25, which may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 25 may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device, etc. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the device and to display a visual user interface.

[0172] Fig. 9 Only the device with components 21-25 is shown, and it can be understood by those skilled in the art that Fig. 9 The structure shown does not constitute a limitation of the device, and may include fewer or more components than shown, or combine certain components, or arrange the components differently.

[0173] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the cascade snapshot processing method described in any of the above method embodiments are implemented.

[0174] The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0175] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0176] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A cascade snapshot processing method, characterized in that: include: Determine a source volume and each target volume created when the source volume is cascaded snapshot; Set the data block size of each snapshot in the cascade snapshot. The data block sizes are not exactly the same. Creating a bitmap for each snapshot according to the total size of the source volume and the data block size of each snapshot; Perform processing operations on the source volume or target volume based on the data block size and bitmap of each snapshot.

2. The cascade snapshot processing method according to claim 1, characterized in that: The performing a processing operation on the source volume or the target volume according to the data block size and the bitmap of each snapshot includes: Receiving a background copy instruction for a target data block; the target data block is a data block located on a source volume or a target volume; Taking an upstream snapshot adjacent to the target data block as a target snapshot, and determining whether a bit value corresponding to the position of the target data block in a bitmap of the target snapshot is one; If so, it is determined that the copy is completed; If not, searching for a dependent data block corresponding to the target data block according to each upstream snapshot of the target snapshot, and copying the data stored in the dependent data block to the target data block.

3. The cascade snapshot processing method according to claim 1, characterized in that: The performing a processing operation on the source volume or the target volume according to the data block size and the bitmap of each snapshot includes: Receiving a data read instruction for a target data block sent by a host; the target data block is a data block located on a source volume or a target volume; Taking an upstream snapshot adjacent to the target data block as a target snapshot, and determining whether a bit value corresponding to the position of the target data block in a bitmap of the target snapshot is one; If yes, directly read the data from the target data block and send it to the host; If not, searching for a dependent data block corresponding to the target data block according to each upstream snapshot of the target snapshot, and sending the data stored in the dependent data block to the host.

4. The cascade snapshot processing method according to claim 2 or 3, characterized in that: Searching for a dependent data block corresponding to the target data block according to each upstream snapshot of the target snapshot includes: Determining whether the target snapshot has an upstream snapshot; If there is no upstream snapshot, taking the data block in the source volume at the same position as the target data block as the dependent data block; If there are upstream snapshots, determining the bit value of the target data block at the corresponding position in the bitmap of each upstream snapshot and the maximum number of bit values ​​according to the bitmap and data block size of each upstream snapshot; Performing equal value expansion on the bit values ​​of the corresponding positions of the target data block in the bitmap of each upstream snapshot, and dividing the target data block into a plurality of small data blocks; wherein the number of the bit values ​​after equal value expansion and the number of the small data blocks are both the maximum number of the bit values; According to the snapshot linked list, the dependent data blocks having a bit value of 1 at the same position as each data block are searched in the bitmap of each upstream snapshot in turn.

5. The cascade snapshot processing method according to claim 1, characterized in that: The performing a processing operation on the source volume or the target volume according to the data block size and the bitmap of each snapshot includes: Receiving a data write instruction for a target data block sent by a host; Determine whether the target data block has an upstream snapshot; If there is no upstream snapshot, determining whether the target data block has a downstream snapshot; If there is an upstream snapshot, determining a first target position corresponding to the target data block according to the adjacent upstream snapshot, and determining whether a bit value of the first target position in the bitmap of the adjacent upstream snapshot is one; If the bit value is one, continue to execute the step of determining whether the target data block has a downstream snapshot; if the bit value is not one, search for a dependent data block corresponding to the first target position according to each upstream snapshot, copy the data stored in the dependent data block to the first target position, and continue to execute the step of determining whether the target data block has a downstream snapshot; If the target data block has a downstream snapshot, determine a second target position corresponding to the target data block according to the adjacent downstream snapshot; determine whether the bit value of the second target position in the bitmap of the adjacent downstream snapshot is one; if the bit value is one, write the host data carried in the data write instruction into the target data block; if the bit value is not one, copy the data in the target data block to the second target position of the adjacent downstream target volume, and continue to execute the step of writing the host data carried in the data write instruction into the target data block; If the target data block has no downstream snapshot, the host data carried in the data write instruction is written into the target data block.

6. The cascade snapshot processing method according to claim 5, characterized in that: The searching for the dependent data block corresponding to the first target position according to each upstream snapshot includes: Determine, according to the bitmaps and data block sizes of the upstream snapshots, the bit values ​​of the corresponding positions of the first target positions in the bitmaps of the upstream snapshots, and the maximum number of bit values; Performing equal-value expansion on the bit values ​​of the corresponding positions of the first target position in the bitmaps of each upstream snapshot, and dividing the target data block into a plurality of small data blocks; wherein the number of the bit values ​​after equal-value expansion and the number of the small data blocks are both the maximum number of the bit values; According to the snapshot linked list, the dependent data blocks having a bit value of 1 at the same position as each data block are searched in the bitmap of each upstream snapshot in turn.

7. The cascade snapshot processing method according to claim 1, characterized in that: The step of setting the data block size of each snapshot in the cascade snapshot includes: Determine a first snapshot of a volume where a host processing operation is performed, and a second snapshot of a volume where a background copy processing operation is performed; The data block size of the first snapshot is set to be smaller than the data block size of the second snapshot; wherein, among any two data block sizes, the data block size with a smaller value can divide the data block size with a larger value.

8. A cascade snapshot processing device, characterized in that: include: A determination module, used to determine a source volume and each target volume created when the source volume is cascaded snapshot; The setting module is used to set the data block size of each snapshot in the cascade snapshot. The sizes of each data block are not exactly the same; A creation module, used for creating a bitmap of each snapshot according to the total size of the source volume and the data block size of each snapshot; The processing module is used to perform processing operations on the source volume or the target volume according to the data block size and the bitmap of each snapshot.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the cascade snapshot processing method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the cascade snapshot processing method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Snapshot volume data copying method

    CN102411524A

  • Data copying method and device

    CN104360953A