Volume snapshot difference fast calculation method, difference state machine and computer-readable storage medium

The iterative calculation method of snapshot bitmap and difference bitmap solves the problem of low efficiency of incremental migration of snapshot data in the existing technology, realizes fast and accurate difference calculation, and improves volume migration efficiency.

CN115328695BActive Publication Date: 2025-09-09CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210826342.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-14
Publication Date
2025-09-09
Estimated Expiration
2042-07-14

AI Technical Summary

Technical Problem

The existing method of incrementally migrating snapshot data is inefficient, resulting in a time-consuming and labor-intensive volume migration process.

Method used

By introducing snapshot bitmaps and difference bitmaps, the bitmaps of adjacent version snapshots are used to iteratively calculate differences and quickly determine the data differences between snapshots. This includes initializing the snapshot bitmap, determining the difference bitmap of the current snapshot and making corrections, and using the difference state machine for difference analysis.

Benefits of technology

It greatly improves the efficiency of difference calculation, ensures the accuracy and precision of the calculation results, reduces the amount of data read during the comparison process, and improves the efficiency of volume migration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115328695B_ABST
    Figure CN115328695B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for rapidly calculating volume snapshot differences, a difference state machine, and a computer-readable storage medium. The method for rapidly calculating volume snapshot differences includes: initializing a difference bitmap of the first snapshot based on a snapshot bitmap of the first snapshot; determining a difference bitmap of the current snapshot based on a difference bitmap of the previous snapshot and a snapshot bitmap of the current snapshot; correcting a difference bitmap of a target snapshot to be analyzed based on the snapshot bitmap of the initial snapshot to be analyzed; analyzing the difference between the target snapshot to be analyzed and the initial snapshot to be analyzed based on the corrected difference bitmap of the target snapshot to be analyzed; the snapshot bitmap includes multiple block bits, each block bit is used to mark the status of a data block in the snapshot; the difference bitmap includes multiple difference bits corresponding one-to-one to the multiple block bits, each difference bit is used to mark the change status of a data block in the snapshot. The present invention can greatly improve the efficiency of difference calculation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method for quickly calculating volume snapshot differences, a difference state machine, and a computer-readable storage medium. Background Art

[0002] Taking volume snapshots is a common method for backing up volume data. When migrating a volume, all snapshot data must also be migrated. Migrating all snapshot data in full is time-consuming and labor-intensive, so incremental migrations are commonly performed in the industry. Therefore, calculating the data differences between snapshot versions is crucial. A common approach involves fully reading different snapshots, comparing them, and exporting the differences, but this approach is inefficient. Summary of the Invention

[0003] Embodiments of the present invention provide a volume snapshot difference fast calculation method, a difference state machine, and a computer-readable storage medium, to solve the problem of low efficiency of the prior art method for incrementally migrating snapshot data.

[0004] A method for quickly calculating volume snapshot differences according to an embodiment of the present invention includes:

[0005] Initializing a difference bitmap of the first snapshot according to the snapshot bitmap of the first snapshot;

[0006] Determine a difference bitmap of the current snapshot based on a difference bitmap of the previous snapshot and a snapshot bitmap of the current snapshot;

[0007] Correcting the difference bitmap of the target snapshot to be analyzed based on the snapshot bitmap of the initial snapshot to be analyzed;

[0008] Analyze the difference between the target snapshot to be analyzed and the initial snapshot to be analyzed based on the corrected difference bitmap of the target snapshot to be analyzed;

[0009] The snapshot bitmap includes multiple block bits, each of which is used to mark the status of a data block in the snapshot; the difference bitmap includes multiple difference bits corresponding to the multiple block bits one by one, each of which is used to mark the change of a data block in the snapshot.

[0010] According to some embodiments of the present invention, the values ​​of the block bit include a first value, a second value, and a third value, which correspond to an empty state, a non-empty state, and a data unchanged state of the data block, respectively;

[0011] The values ​​of the difference bit include a fourth value, a fifth value, a sixth value, and a seventh value, which respectively correspond to the change situations of the data block being always empty, the change situation from having data to being empty, the change situation of having data all the time and the data not changing, and the change situation of having data now and having changed.

[0012] According to some embodiments of the present invention, initializing the difference bitmap of the first snapshot according to the snapshot bitmap of the first snapshot includes:

[0013] Initializing the difference bit corresponding to the first value of the block bit in the snapshot bitmap of the first snapshot to a fourth value;

[0014] Initializing the difference bit corresponding to the second value of the block bit in the snapshot bitmap of the first snapshot to a sixth value;

[0015] The difference bit corresponding to the block bit having the third value in the snapshot bitmap of the first snapshot is initialized to a sixth value.

[0016] According to some embodiments of the present invention, determining the difference bitmap of the current snapshot based on the difference bitmap of the previous snapshot and the snapshot bitmap of the current snapshot includes:

[0017] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fourth value and the block bit corresponding to the data block in the snapshot bitmap of the current snapshot is the first value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fourth value;

[0018] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fourth value and the block bit corresponding to the data block in the snapshot bitmap of the current snapshot is the second value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value;

[0019] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fifth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the first value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fifth value;

[0020] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fifth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the second value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value;

[0021] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the sixth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the first value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fifth value;

[0022] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the sixth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the second value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value;

[0023] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the sixth value and the block bit corresponding to the data block in the snapshot bitmap of the current snapshot is the third value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the sixth value;

[0024] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the seventh value and the block bit corresponding to the snapshot bitmap of the current snapshot is the first value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fifth value;

[0025] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the seventh value and the block bit corresponding to the snapshot bitmap of the current snapshot is the second value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value;

[0026] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the seventh value and the block bit corresponding to the snapshot bitmap of the current snapshot is the third value, the difference bit corresponding to the data block in the difference bitmap of the current snapshot is set to the seventh value.

[0027] According to some embodiments of the present invention, the modifying the difference bitmap of the target snapshot to be analyzed based on the snapshot bitmap of the initial snapshot to be analyzed includes:

[0028] When the difference bit corresponding to the data block in the difference bitmap of the target snapshot to be analyzed is the fifth value and the block bit corresponding to the data block in the snapshot bitmap of the initial snapshot to be analyzed is the first value, correcting the fifth value to the fourth value;

[0029] When the difference bit corresponding to the data block in the difference bitmap of the target snapshot to be analyzed is the seventh value, and the CRC check value in the target snapshot to be analyzed is consistent with the CRC check value in the initial snapshot to be analyzed, the seventh value is corrected to the sixth value.

[0030] According to an embodiment of the present invention, a difference state machine includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the method for quickly calculating volume snapshot differences are implemented.

[0031] According to a computer-readable storage medium of an embodiment of the present invention, a program for implementing information transmission is stored on the computer-readable storage medium. When the program is executed by a processor, the steps of the method for quickly calculating volume snapshot differences are implemented.

[0032] By using this embodiment of the present invention, the data differences between any two snapshot versions can be sequentially calculated by iteratively comparing the difference bitmap of the previous snapshot with the snapshot bitmap of the current snapshot. This eliminates the need to read all the data from both snapshots and then compare them bit by bit, greatly improving the efficiency of difference calculation.

[0033] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Various other advantages and benefits will become apparent to those skilled in the art by reading the detailed description of the embodiments below. The accompanying drawings are only for the purpose of illustrating preferred embodiments and are not to be considered as limiting the present invention. In the accompanying drawings:

[0035] Figure 1 This is a schematic diagram of the difference between two version snapshots in an embodiment of the present invention;

[0036] Figure 2 Schematic diagram of three states of a data block in an embodiment of the present invention;

[0037] Figure 3 This is a schematic diagram of a method for rapidly calculating volume snapshot differences according to an embodiment of the present invention. DETAILED DESCRIPTION

[0038] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art. In addition, in some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this specification.

[0039] A method for quickly calculating volume snapshot differences according to an embodiment of the present invention includes:

[0040] Initializing a difference bitmap of the first snapshot according to the snapshot bitmap of the first snapshot;

[0041] The snapshot bitmap includes multiple block bits, each of which is used to mark the status of a data block in the snapshot; the difference bitmap includes multiple difference bits corresponding to the multiple block bits one by one, each of which is used to mark the change of a data block in the snapshot.

[0042] As you can understand, a volume can be divided into multiple data blocks, and the granularity of the division can be set according to actual needs. Correspondingly, a snapshot also includes multiple data blocks. The status of each data block can be marked with a block bit. The multiple block bits corresponding to the multiple data blocks in a snapshot form a snapshot bitmap.

[0043] The difference bitmap marks the data state changes between two adjacent snapshots. Each data block in a snapshot requires a difference bit to mark the data state change. The multiple difference bits corresponding to multiple data blocks in a snapshot form a difference bitmap.

[0044] Since there is no snapshot before the first snapshot and no reference snapshot for comparison, the difference bitmap of the first snapshot is initialized.

[0045] Determine a difference bitmap of the current snapshot based on a difference bitmap of the previous snapshot and a snapshot bitmap of the current snapshot;

[0046] Here, "previous snapshot" and "current snapshot" generally refer to two adjacent snapshots. This step is applicable to determining the difference bitmaps of all snapshots except the first snapshot.

[0047] Correcting the difference bitmap of the target snapshot to be analyzed based on the snapshot bitmap of the initial snapshot to be analyzed;

[0048] The "initial snapshot to be analyzed" and "target snapshot to be analyzed" here generally refer to any two snapshots whose differences are to be analyzed.

[0049] Analyze the difference between the target snapshot to be analyzed and the initial snapshot to be analyzed based on the corrected difference bitmap of the target snapshot to be analyzed;

[0050] Since the difference bitmap marks the data difference between two adjacent snapshots, for the non-adjacent "initial snapshot to be analyzed" and "target snapshot to be analyzed", it is necessary to correct the difference bitmap of the target snapshot to be analyzed based on the snapshot bitmap of the initial snapshot to be analyzed, thereby accurately obtaining the difference between the "initial snapshot to be analyzed" and the "target snapshot to be analyzed".

[0051] To compare differences between snapshots of different volume versions, the traditional approach is to read all the data from both snapshots and then compare them, which is inefficient. To improve efficiency, the present invention uses bitmaps of adjacent snapshot versions to iterate and ultimately calculate the differences quickly and accurately.

[0052] Based on the above embodiment, various modified embodiments are further proposed. It should be noted that, in order to simplify the description, only the differences from the above embodiment are described in each modified embodiment.

[0053] According to some embodiments of the present invention, the values ​​of the block bit include a first value, a second value, and a third value, which correspond to an empty state, a non-empty state, and a data unchanged state of the data block, respectively;

[0054] There are three states of data blocks: the empty state indicates that the data block data is empty, the non-empty state indicates that the data block data is not empty and contains data, and the data unchanged state indicates that the data block data is not empty and no write operation has been performed on this data object since the last snapshot was created.

[0055] The first value can be 00, the second value can be 01, and the third value can be 10. "00" indicates that the data in the data block is empty (EMPTY), "01" indicates that the data in the data block is not empty (INFO), and "10" indicates that the data in the data block exists and no write operation has been performed on this data object (data block) since the last snapshot was created (CONST).

[0056] The values ​​of the difference bit include a fourth value, a fifth value, a sixth value, and a seventh value, which respectively correspond to the change situations of the data block being always empty, the change situation from having data to being empty, the change situation of having data all the time and the data not changing, and the change situation of having data now and having changed.

[0057] If the data block is always empty, it means that the data of the data block is always empty in the last snapshot and the current snapshot.

[0058] The change from data to empty means that the data of the data block is not empty in the last snapshot created, but is empty in the current snapshot created.

[0059] The change situation of always having data and the data not changing means that the data of the data block always has data and the data has not changed in the last snapshot and the current snapshot.

[0060] The change situation where data exists and changes occur indicates that the data block in the snapshot created this time has data and the state of the data block is different from that in the previously created snapshot.

[0061] Reference Figure 3 As shown, according to some embodiments of the present invention, initializing the difference bitmap of the first snapshot based on the snapshot bitmap of the first snapshot includes:

[0062] Initializing the difference bit corresponding to the first value of the block bit in the snapshot bitmap of the first snapshot to a fourth value;

[0063] Initializing the difference bit corresponding to the second value of the block bit in the snapshot bitmap of the first snapshot to a sixth value;

[0064] The difference bit corresponding to the block bit having the third value in the snapshot bitmap of the first snapshot is initialized to a sixth value.

[0065] According to some embodiments of the present invention, determining the difference bitmap of the current snapshot based on the difference bitmap of the previous snapshot and the snapshot bitmap of the current snapshot includes:

[0066] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fourth value and the block bit corresponding to the data block in the snapshot bitmap of the current snapshot is the first value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fourth value;

[0067] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fourth value and the block bit corresponding to the data block in the snapshot bitmap of the current snapshot is the second value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value;

[0068] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fifth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the first value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fifth value;

[0069] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fifth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the second value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value;

[0070] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the sixth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the first value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fifth value;

[0071] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the sixth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the second value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value;

[0072] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the sixth value and the block bit corresponding to the data block in the snapshot bitmap of the current snapshot is the third value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the sixth value;

[0073] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the seventh value and the block bit corresponding to the snapshot bitmap of the current snapshot is the first value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fifth value;

[0074] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the seventh value and the block bit corresponding to the snapshot bitmap of the current snapshot is the second value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value;

[0075] When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the seventh value and the block bit corresponding to the snapshot bitmap of the current snapshot is the third value, the difference bit corresponding to the data block in the difference bitmap of the current snapshot is set to the seventh value.

[0076] According to some embodiments of the present invention, the modifying the difference bitmap of the target snapshot to be analyzed based on the snapshot bitmap of the initial snapshot to be analyzed includes:

[0077] When the difference bit corresponding to the data block in the difference bitmap of the target snapshot to be analyzed is the fifth value and the block bit corresponding to the data block in the snapshot bitmap of the initial snapshot to be analyzed is the first value, correcting the fifth value to the fourth value;

[0078] When the difference bit corresponding to the data block in the difference bitmap of the target snapshot to be analyzed is the seventh value, and the CRC check value in the target snapshot to be analyzed is consistent with the CRC check value in the initial snapshot to be analyzed, the seventh value is corrected to the sixth value.

[0079] Refer to the following Figure 1-Figure 3 The following describes in detail a method for rapidly calculating volume snapshot differences according to an embodiment of the present invention using a specific example. It should be understood that the following description is merely illustrative and does not limit the present invention. Any similar structures and variations of the present invention should be included within the scope of protection of the present invention.

[0080] The method for quickly calculating the difference between volume snapshots in an embodiment of the present invention first introduces a bitmap to construct a data state, using every two bits to mark the data state of 1M data (the size of the data block can be dynamically adjusted). Three data states (EMPTY / INFO / CONST) are introduced to mark the states of the original volume data and the snapshot data. Four difference states (NONE UNCHANGED, DATA UNCHANGED, NONE CHANGED, DATA CHANGED) are derived from these three data states to mark the differences in data between snapshots of different versions. By switching the snapshot bitmap state machine of adjacent versions, the precise difference between the data of two adjacent snapshot versions is calculated, and the difference state result is iterated with the bitmap of the next version snapshot, and the data difference between any two versions can be calculated in turn. In this way, there is no need to read all the data of the two snapshots and then compare them bit by bit, which greatly improves the efficiency of the difference calculation. Coupled with the absolute accuracy of this solution, it achieves a high level of efficiency in scenarios such as cloud disk backup.

[0081] The concept of bitmap:

[0082] Assume a volume is 1024MB in size and is divided into 1MB chunks (which can be adjusted dynamically), for a total of 1024 chunks. Each chunk's data state (EMPTY / INFO / CONST) is represented by 2 bits, for a total of 2048 bits. Volume snapshots are the same size as the volume, and each snapshot has a 2048-bit bitmap. There are three data states: 00 for EMPTY, 01 for INFO, and 10 for CONST.

[0083] The concepts of difference state and data state:

[0084] To compare differences between snapshots of different volume versions, the traditional approach is to read all the data from both snapshots and then compare them, which is inefficient. To improve efficiency, the present invention uses bitmaps of adjacent snapshot versions to iterate and ultimately calculate the differences quickly and accurately.

[0085] Data differences refer to the data differences between two different snapshot versions. Let's call the first version prev and the second version now. After logical analysis, four difference states can be used to fully represent them:

[0086] 1.NONE UNCHANGED(0) means that the data from prev to now is always empty;

[0087] 2. NONE CHANGED (1) means that the prev version has data but the now version is empty;

[0088] 3. DATA UNCHANGED (2) means that data has existed from prev to now and the data has not changed;

[0089] 4. DATA CHANGED (3) means that both the prev version and the now version have data, but the data is different.

[0090] The specific relationship between the difference status of two version snapshots is as follows Figure 1 If the data states of volumes and snapshots are limited to 00 and 01, the four difference states described above cannot be calculated, such as the DATA UNCHANGED state. Therefore, a 10 (CONST) state is introduced to indicate that "the data between adjacent snapshot versions has not changed."

[0091] Each two-bit bitmap marks the data status of a data block. There are three states in total: "00" indicates that the object data is empty (EMPTY), "01" indicates that the object data is not empty (INFO), and "10" indicates that the data exists and no write operation has been performed on this data object since the last snapshot was created (CONST).

[0092] like Figure 2 As shown, the snapshot bitmap update logic is:

[0093] 1. Create a snapshot: copy the bitmap corresponding to its parent volume to the snapshot bitmap, and then convert the status of the bitmap corresponding to its parent volume that is INFO to CONST.

[0094] 2. Delete a snapshot: If the bitmap corresponding to the next snapshot is CONST and the snapshot itself is INFO, it is converted to INFO. If this is the last snapshot, the original volume's bitmap is modified using the same logic. If the next snapshot's bitmap is longer, all CONST bits are converted to INFO. Finally, the snapshot's own bitmap is deleted. Essentially, this eliminates the CONST state record generated by the currently deleted snapshot.

[0095] 3. Rollback snapshot: Completely overwrite the bitmap corresponding to the snapshot with the bitmap corresponding to its parent volume.

[0096] With the above three data states (EMPTY / INFO / CONST) and four difference states (NONE UNCHANGED, DATA UNCHANGED, NONE CHANGED, DATA CHANGED) as the basis, taking the calculation of the difference between two adjacent version snapshots as an example, we only need to read the bitmaps of the two snapshots and use the following method: Figure 3 The data difference can be quickly obtained by calculating the process shown (the white background is the data status of the snapshot, and the gray background is the calculated difference status).

[0097] The three lightly dashed lines in the figure are guaranteed to be accurate, but the two densely dashed lines are not. This is because the diff state machine switches iteratively, or in an overwriting fashion. For example, the data state bitmaps of three snapshots of a block of data change from EMPTY to INFO and then back to EMPTY. The final result should be NONE UNCHANGED. However, no matter how the state machine is designed, the intermediate INFO will inevitably lead to the deduced result of NONE CHANGED. This erroneous result will cause this unchanged data to be considered changed, leading to a copy. Deeming unchanged data when changed is unacceptable (resulting in under-copying and data errors), while deeming unchanged data as changed is acceptable (resulting in over-copying and data accuracy, but reduced efficiency). To achieve 100% accuracy, this patent adds correction logic. The two densely dashed lines are further optimized by recording the initial snapshot state. If the result is NONE CHANGED and the initial data state is EMPTY, it is corrected to NONE UNCHANGED. If the result is DATA CHANGED and matches the CRC checksum of the initial data, it is corrected to DATA UNCHANGED. In this way, the final data state will be accurate, and the efficiency of data difference comparison will be improved.

[0098] By adopting the embodiment of the present invention, the size of the content block for calculating the difference can be dynamically adjusted to adapt to different business scenarios; the complete state machine plus the correction of inaccurate states make the calculated difference results absolutely accurate and therefore highly efficient.

[0099] It should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that the present invention is susceptible to various modifications and variations. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.

[0100] Those skilled in the art will appreciate that the various steps of the present invention described above can be implemented using a general-purpose computing device, centralized on a single computing device, or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, which can then be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than that shown, or can be implemented as separate integrated circuit modules, or multiple modules or steps can be implemented as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0101] According to an embodiment of the present invention, a difference state machine includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the method for quickly calculating volume snapshot differences are implemented.

[0102] The processor may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

[0103] According to a computer-readable storage medium of an embodiment of the present invention, a program for implementing information transmission is stored on the computer-readable storage medium. When the program is executed by a processor, the steps of the method for quickly calculating volume snapshot differences are implemented.

[0104] The computer-readable storage medium of this embodiment includes but is not limited to: ROM, RAM, magnetic disk or optical disk, etc. The processor can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

[0105] It should be noted that, in the description of this specification, the serial numbers of the above-mentioned embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0106] Although some embodiments described herein include certain features included in other embodiments but not other features, combinations of features from different embodiments are intended to be within the scope of the present invention and to form different embodiments. The specific features, structures, materials, or characteristics described herein may be combined in any suitable manner in any one or more embodiments or examples. For example, in the claims, any of the claimed embodiments may be used in any combination.

[0107] The terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0108] Any reference signs placed between parentheses shall not be construed as limiting the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The use of the words first, second, and third, etc., is used to distinguish similar items and does not imply any order. These words may be interpreted as names.

[0109] "And / or" describes the relationship between associated objects, indicating that three possible relationships exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

Claims

1. A method for quickly calculating volume snapshot differences, characterized in that: include: Initializing a difference bitmap of the first snapshot according to the snapshot bitmap of the first snapshot; Determine a difference bitmap of the current snapshot based on a difference bitmap of the previous snapshot and a snapshot bitmap of the current snapshot; Correcting the difference bitmap of the target snapshot to be analyzed based on the snapshot bitmap of the initial snapshot to be analyzed; Analyze the difference between the target snapshot to be analyzed and the initial snapshot to be analyzed based on the corrected difference bitmap of the target snapshot to be analyzed; The snapshot bitmap includes a plurality of block bits, each of which is used to mark the status of a data block in the snapshot; the difference bitmap includes a plurality of difference bits corresponding to the plurality of block bits, each of which is used to mark the change of a data block in the snapshot; The values ​​of the block bit include a first value, a second value, and a third value, which correspond to an empty state, a non-empty state, and a data unchanged state of the data block, respectively; The values ​​of the difference bit include a fourth value, a fifth value, a sixth value, and a seventh value, which respectively correspond to a change situation in which the data block is always empty, a change situation from having data to being empty, a change situation in which there is data and the data has not changed, and a change situation in which there is data and a change has occurred; The modifying of the difference bitmap of the target snapshot to be analyzed based on the snapshot bitmap of the initial snapshot to be analyzed includes: When the difference bit corresponding to the data block in the difference bitmap of the target snapshot to be analyzed is the fifth value and the block bit corresponding to the data block in the snapshot bitmap of the initial snapshot to be analyzed is the first value, correcting the fifth value to the fourth value; When the difference bit corresponding to the data block in the difference bitmap of the target snapshot to be analyzed is the seventh value, and the CRC check value in the target snapshot to be analyzed is consistent with the CRC check value in the initial snapshot to be analyzed, the seventh value is corrected to the sixth value.

2. The method according to claim 1, wherein Initializing the difference bitmap of the first snapshot according to the snapshot bitmap of the first snapshot includes: Initializing the difference bit corresponding to the first value of the block bit in the snapshot bitmap of the first snapshot to a fourth value; Initializing the difference bit corresponding to the second value of the block bit in the snapshot bitmap of the first snapshot to a sixth value; The difference bit corresponding to the block bit having the third value in the snapshot bitmap of the first snapshot is initialized to a sixth value.

3. The method according to claim 2, wherein The determining the difference bitmap of the current snapshot based on the difference bitmap of the previous snapshot and the snapshot bitmap of the current snapshot includes: When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fourth value and the block bit corresponding to the data block in the snapshot bitmap of the current snapshot is the first value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fourth value; When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fourth value and the block bit corresponding to the data block in the snapshot bitmap of the current snapshot is the second value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value; When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fifth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the first value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fifth value; When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the fifth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the second value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value; When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the sixth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the first value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fifth value; When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the sixth value and the block bit corresponding to the snapshot bitmap of the current snapshot is the second value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value; When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the sixth value and the block bit corresponding to the data block in the snapshot bitmap of the current snapshot is the third value, setting the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the sixth value; When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the seventh value and the block bit corresponding to the snapshot bitmap of the current snapshot is the first value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the fifth value; When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the seventh value and the block bit corresponding to the snapshot bitmap of the current snapshot is the second value, set the difference bit corresponding to the data block in the difference bitmap of the current snapshot to the seventh value; When the difference bit corresponding to the data block in the difference bitmap of the previous snapshot is the seventh value and the block bit corresponding to the snapshot bitmap of the current snapshot is the third value, the difference bit corresponding to the data block in the difference bitmap of the current snapshot is set to the seventh value.

4. A difference state machine, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for quickly calculating volume snapshot differences are implemented as claimed in any one of claims 1 to 3.

5. A computer-readable storage medium, characterized in that The computer-readable storage medium stores an information transmission implementation program, which, when executed by a processor, implements the steps of the volume snapshot difference fast calculation method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Discrepant data backup method, storage system and discrepant data backup device

    CN107135662A

  • Snapshot rollback method of distributed storage system and related device

    CN110018996A