Data storage method, device, storage medium and computer program product

By managing different versions of snapshot volume address mapping information in the metadata space of the source volume, the performance degradation caused by copying address mapping information in the redirected snapshot on write-time is solved, and efficient write performance and reliability are achieved. data storage solution.

CN118672516BActive Publication Date: 2024-11-12INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411149305.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-11-12
Estimated Expiration
2044-08-21

AI Technical Summary

Technical Problem

In the write-on-write redirect snapshot technology, the problem of copying address mapping information causes the source volume to be degraded in writing performance.

Method used

When the data of the source volume changes, determine the updated address mapping information based on the target write logical address and the target write physical address of the target write data, and associate it with the associated snapshot volume identifier into the metadata space of the source volume to avoid Copy the old address mapping information to the snapshot volume to implement redirected snapshots.

Benefits of technology

Improves the performance of redirected snapshots on write, reduces the number of metadata copies, improves the write performance of storage, and directly querys the metadata space of the source volume during the read and rollback process, improving read and rollback performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118672516B_ABST
    Figure CN118672516B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of storage technology, and specifically discloses a data storage method, device, storage medium and computer program product. When the data of a source volume changes, according to the target write logical address of the target write data and the target write physical address to which the target write data is redirected, the updated address mapping information corresponding to the target write logical address is determined, according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, the associated snapshot volume identifier associated with the updated address mapping information is determined, and the updated address mapping information is associated with the associated snapshot volume identifier and stored in the metadata space of the source volume, so that the write redirection snapshot can be realized without copying the old address mapping information to the metadata space of the snapshot volume, thereby improving the performance of the write redirection snapshot.
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 in particular to a data storage method, device, storage medium and computer program product. Background Art

[0002] Snapshot technology is a widely used data protection and data backup technology that can perform data protection and data backup based on a time point. For example, a snapshot of the data in a volume is generated at a certain moment, that is, a copy of the data in the volume at the current moment is generated. When the volume data is damaged and needs to be restored, the volume can be rolled back to restore the data in the volume to the state at the time when the snapshot data was generated.

[0003] Snapshots can be divided into two types: full snapshots and incremental snapshots. Incremental snapshots are mainly implemented in two ways: Copy On Write (COW) and Redirect On Write (ROW). The principle of Redirect On Write is that when the data of the source volume changes, the data is saved in a new physical address, that is, redirected write, and then the address mapping information between the logical address of the data and the physical address of the old data is written to the metadata space of the snapshot volume, and the address mapping information between the logical address of the data and the newly written physical address is written to the metadata space of the source volume, that is, redirected to the new storage location. When the snapshot volume is selected for rollback, the address mapping information in the snapshot volume also needs to be copied back to the source volume.

[0004] Compared with copy-on-write, redirect-on-write does not need to copy data to the snapshot volume, which improves the write performance to a certain extent. However, the copy of address mapping information will still reduce the write performance of the source volume.

[0005] How to solve the problem of decreased write performance of the snapshot source volume caused by copying address mapping information is a technical problem that those skilled in the art need to solve. Summary of the invention

[0006] The object of the present invention is to provide a data storage method, device, storage medium and computer program product, which are used to solve the problem of snapshot source volume write performance degradation caused by address mapping information copying and improve the snapshot source volume write performance.

[0007] In order to solve the above technical problems, the present invention provides a data storage method, comprising:

[0008] After creating a snapshot volume for the source volume, recording the snapshot volume identifier of the snapshot volume;

[0009] When the data of the source volume changes, determining updated address mapping information corresponding to the target write logical address according to the target write logical address of the target write data and the target write physical address to which the target write data is redirected;

[0010] Determine, according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, an associated snapshot volume identifier associated with the updated address mapping information;

[0011] The updated address mapping information is associated with the associated snapshot volume identifier and stored in the metadata space of the source volume.

[0012] On the one hand, it also includes:

[0013] When receiving a source volume rollback command for the source volume, determining a target snapshot volume identifier of a target snapshot volume to be rolled back to;

[0014] After re-determining the latest address mapping information corresponding to each logical address in the metadata space of the source volume according to the target snapshot volume identifier, the source volume rollback command is completed.

[0015] On the other hand, after re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, completing the source volume rollback command includes:

[0016] Creating a shadow snapshot volume for the source volume, where the shadow snapshot volume is an empty snapshot volume;

[0017] After establishing the jump association relationship between the shadow snapshot volume and the target snapshot volume, determining that the source volume rollback command is completed;

[0018] The jump association relationship is an association relationship that jumps access to the shadow snapshot volume to access to the target snapshot volume.

[0019] On the other hand, it also includes:

[0020] After completing the source volume rollback command, determining the to-be-deleted snapshot volume identifier of the to-be-deleted snapshot volume created after the target snapshot volume according to the target snapshot volume identifier;

[0021] The updated address mapping information between the target snapshot volume and the shadow snapshot volume is deleted according to the snapshot volume identifier to be deleted.

[0022] On the other hand, it also includes:

[0023] If the source volume has a historical shadow snapshot volume created before the shadow snapshot volume, and the creation time of the historical shadow snapshot volume is between the shadow snapshot volume and the target snapshot volume, then the historical shadow snapshot volume and the jump association relationship corresponding to the historical shadow snapshot volume are deleted;

[0024] If the source volume has the historical shadow snapshot volume but the creation time of the historical shadow snapshot volume is before the target snapshot volume, the historical shadow snapshot volume and the jump association relationship corresponding to the historical shadow snapshot volume are retained.

[0025] On the other hand, after re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, completing the source volume rollback command includes:

[0026] In the metadata space of the source volume, determining, according to the target snapshot volume identifier, a snapshot volume identifier to be deleted of a snapshot volume to be deleted that is created after the target snapshot volume;

[0027] After deleting the address mapping information corresponding to the snapshot volume identifier to be deleted, it is determined that the source volume rollback command is completed.

[0028] On the other hand, determining the associated snapshot volume identifier associated with the updated address mapping information according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment includes:

[0029] Using the latest snapshot volume identifier as the associated snapshot volume identifier;

[0030] After re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, completing the source volume rollback command includes:

[0031] If the address mapping information corresponding to the logical address contains the last snapshot volume identifier of the last snapshot volume created at the last moment of the target snapshot volume, the address mapping information corresponding to the last snapshot volume identifier is used as the latest address mapping information corresponding to the logical address;

[0032] If the last-time snapshot volume identifier does not exist in the address mapping information corresponding to the logical address, continue to query the last-time snapshot volume at the last time until the latest address mapping information corresponding to all logical addresses is obtained.

[0033] On the other hand, determining the associated snapshot volume identifier associated with the updated address mapping information according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment includes:

[0034] Determine, according to the latest snapshot volume identifier, a snapshot volume identifier of a first snapshot volume to be created in the future;

[0035] Taking the snapshot volume identifier to be created as the associated snapshot volume identifier;

[0036] After re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, completing the source volume rollback command includes:

[0037] If the target snapshot volume identifier exists in the address mapping information corresponding to the logical address, the target snapshot volume identifier is used as the latest address mapping information corresponding to the logical address;

[0038] If the target snapshot volume identifier does not exist in the address mapping information corresponding to the logical address, the target snapshot volume is queried at the previous moment until the latest address mapping information corresponding to all logical addresses is obtained.

[0039] On the other hand, it also includes:

[0040] If the source volume does not have the snapshot volume, when the data of the source volume changes, after determining the updated address mapping information, the updated address mapping information is associated with the generated initial snapshot volume identifier and stored in the metadata space of the source volume.

[0041] On the other hand, storing the updated address mapping information in association with the associated snapshot volume identifier in the metadata space of the source volume includes:

[0042] The address mapping information corresponding to the same logical address and the associated snapshot volume identifier are stored in adjacent positions in the metadata space of the source volume in order of update time.

[0043] On the other hand, it also includes:

[0044] When receiving a data read command for the source volume, querying the metadata space of the source volume for a latest read physical address in the address mapping information corresponding to the target read logical address according to the target read logical address of the target read data;

[0045] The target read data is read from the target read physical address using the latest read physical address as the target read physical address of the target read data.

[0046] On the other hand, the snapshot volume identifier is a snapshot volume version number sorted from small to large according to the creation order of the snapshot volumes;

[0047] Determining the associated snapshot volume identifier associated with the updated address mapping information according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment includes:

[0048] The largest snapshot volume identifier stored in the metadata space of the source volume is used as the latest snapshot volume identifier, and the associated snapshot volume identifier is determined according to the latest snapshot volume identifier.

[0049] In order to solve the above technical problems, the present invention further provides a data storage device, comprising:

[0050] Memory for storing computer programs;

[0051] A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of any one of the data storage methods described above are implemented.

[0052] In order to solve the above technical problems, the present invention also provides a non-volatile storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the data storage method as described in any one of the above items are implemented.

[0053] In order to solve the above technical problems, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of any of the above data storage methods when executed by a processor.

[0054] The data storage method provided by the present invention has the beneficial effect of performing metadata management of snapshot volumes of different versions in units of data in the metadata space of the source volume. When the data of the source volume changes, the updated address mapping information corresponding to the target write logical address is determined according to the target write logical address of the target write data and the target write physical address to which the target write data is redirected to be written. The associated snapshot volume identifier associated with the updated address mapping information is determined according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment. Then, the updated address mapping information is associated with the associated snapshot volume identifier and stored in the metadata space of the source volume. The redirected snapshot can be written without copying the old address mapping information to the metadata space of the snapshot volume, thereby speeding up the redirected write speed and improving the storage write performance. On this basis, whether it is a read or rollback process, it only needs to directly query the address mapping information in the metadata space of the source volume, which can also improve the storage read performance and rollback performance, and realize a data storage solution with both performance and reliability.

[0055] The present invention also provides a data storage device, a non-volatile storage medium and a computer program product, which have the above-mentioned beneficial effects and are not described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions of 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.

[0057] Figure 1It is a schematic diagram of the data update process of the traditional write-time redirection technology;

[0058] Figure 2 A flowchart of a data storage method provided by an embodiment of the present invention;

[0059] Figure 3 A schematic diagram of a data update process of a write-time redirection technology provided by an embodiment of the present invention;

[0060] Figure 4 A schematic diagram of a source volume rollback process provided by an embodiment of the present invention;

[0061] Figure 5 A schematic diagram of the structure of a data storage device provided by an embodiment of the present invention;

[0062] Figure 6 A schematic diagram of the structure of a data storage device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0063] The core of the present invention is to provide a data storage method, device, storage medium and computer program product, which are used to solve the problem of snapshot source volume write performance degradation caused by address mapping information copying and improve the snapshot source volume write performance.

[0064] 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.

[0065] Redirect On Write (ROW) is an incremental snapshot technology. Its snapshot principle is that when the data of the source volume changes, the updated data is written to the new physical address by redirecting the write. At this time, the address mapping information corresponding to the data in the metadata space of the source volume needs to be updated. At the same time, for backup, the old address mapping information of the data needs to be copied to the metadata space of the snapshot volume.

[0066] Figure 1 This is a schematic diagram of the data update process of the traditional write-time redirection technology. Figure 1As shown, it is assumed that the address mapping information corresponding to data A, B, and C in the source volume is L0-P0, L1-P1, and L2-P2, respectively, where L0, L1, and L2 represent logical addresses, and P0, P1, and P2 represent physical addresses. When the host updates data A, it uses redirected write to write the updated data A' to the new physical address P3. At this time, the address mapping information corresponding to the logical address L0 in the metadata space of the source volume needs to be changed to L0-P3, and the previous moment needs to be backed up, so the old address mapping information L0-P0 corresponding to the logical address L0 needs to be copied to the metadata space of the snapshot volume. And assuming that the source volume needs to be rolled back to the snapshot volume at a certain point in the future, it is necessary to take out all the address mapping information from the snapshot volume and copy it to the metadata space of the source volume.

[0067] It can be seen from this that the traditional write-time redirect snapshot needs to copy metadata from the source volume to the snapshot volume when the source volume data is updated, and also needs to copy metadata from the snapshot volume to the source volume when rolling back. Although the data protection and data backup of the source volume can be achieved, the storage performance of the source volume is reduced.

[0068] In order to improve the write performance of write-time redirected snapshots, the present invention provides a data storage solution. Based on the technology of traditional write-time redirected snapshots, an innovative management method for snapshot metadata is proposed. When the data of the source volume changes, the updated address mapping information corresponding to the target write logical address is determined according to the target write logical address of the target write data and the target write physical address to which the target write data is redirected to write. The associated snapshot volume identifier associated with the updated address mapping information is determined according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment. The updated address mapping information is associated with the associated snapshot volume identifier and stored in the metadata space of the source volume. The write-redirected snapshot can be implemented without copying the old address mapping information to the metadata space of the snapshot volume, thereby improving the performance of the write-redirected snapshot.

[0069] It should be noted that the data storage solution provided by the present invention is not limited to the storage system (such as distributed storage, centralized storage) or storage device (a single storage device or a storage cluster, not limited to storage media) used, that is, any storage solution that uses write-time redirection technology is applicable.

[0070] In the embodiments of the present invention, "data" refers to the original information data in the storage device, which is usually the content directly processed and analyzed by the user, such as text, numbers, images, videos, etc. "Metadata" refers to data that describes the data, which provides the context, structure, format, source and other relevant information about the data. In the embodiments of the present invention, the metadata of the data is the address mapping information of the data.

[0071] In the embodiments of the present invention, the address mapping information is the mapping relationship between the logical address (Logical Address) and the physical address (Physical Address). The logical address is the virtual address used by the program, and the physical address is the actual location of the data in the actual storage device. In some optional implementations of the embodiments of the present invention, the address mapping information can be represented by the mapping relationship (LP) between the logical block address (logic block address, LBA) and the physical block address (physical block address, PBA).

[0072] Based on the above architecture, the data storage method provided by the embodiment of the present invention is described below with reference to the accompanying drawings.

[0073] Figure 2 A flowchart of a data storage method provided by an embodiment of the present invention; Figure 3 A schematic diagram of a data update process of a write-time redirection technology provided in an embodiment of the present invention.

[0074] like Figure 2 As shown, the data storage method provided by the embodiment of the present invention includes:

[0075] S201: After creating a snapshot volume for a source volume, record the snapshot volume identifier of the snapshot volume;

[0076] S202: when data of the source volume changes, determining updated address mapping information corresponding to the target write logical address according to the target write logical address of the target write data and the target write physical address to which the target write data is redirected;

[0077] S203: determining an associated snapshot volume identifier associated with the updated address mapping information according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment;

[0078] S204: The updated address mapping information is associated with the associated snapshot volume identifier and stored in the metadata space of the source volume.

[0079] In a specific implementation, the data storage method provided by the embodiment of the present invention can be applied to a storage control host. The number of source volumes can be one or more, and one or more source volumes can be created for each source volume according to data protection and data backup requirements.

[0080] For S201, in the embodiment of the present invention, the snapshot volume identifier is a unique identifier of the snapshot volume, which is used to distinguish snapshot volumes of different versions, so the snapshot volume identifier can use the version number of the snapshot volume. For ease of management, 0, 1, 2, ..., N can be used as the version number of the snapshot volume, i.e., the snapshot volume identifier. Then, in some optional implementations of the embodiment of the present invention, the snapshot volume identifier can be the snapshot volume version numbers sorted from small to large according to the creation order of the snapshot volumes.

[0081] For S202, the data of the source volume changes, including adding data, deleting data, and modifying data. When adding data or modifying data, it is necessary to write the new data or updated data into a new physical address, which will cause the address mapping information of the logical address where the original data is located to be updated. At this time, if the traditional write-time redirection snapshot is adopted, the old address mapping information needs to be copied to the snapshot volume. In the embodiment of the present invention, an innovative snapshot volume metadata management method is adopted, that is, while managing the latest address mapping information of each logical address in the metadata space of the source volume, the address mapping information corresponding to each snapshot version is also managed. In the embodiment of the present invention, the updated address mapping information corresponding to the target write logical address is first determined to update the metadata space of the source volume, that is, for the source volume, the address mapping information used to provide the read function to the outside is the latest address mapping information corresponding to each logical address.

[0082] For S203 and S204, the associated snapshot volume identifier associated with the updated address mapping information is determined based on the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, and the updated address mapping information corresponding to each logical address is associated with the associated snapshot volume and stored in the metadata space of the source volume. This is the basis for managing the address mapping information corresponding to each snapshot version in the metadata space of the source volume proposed in an embodiment of the present invention.

[0083] When the snapshot volume identifier is a snapshot volume version number sorted from small to large according to the order in which the snapshot volumes are created, determining the associated snapshot volume identifier associated with the updated address mapping information according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment in S203 may include: taking the largest snapshot volume identifier stored in the metadata space of the source volume as the latest snapshot volume identifier, and determining the associated snapshot volume identifier according to the latest snapshot volume identifier.

[0084] In some optional implementations of the embodiments of the present invention, the associated snapshot volume identifier associated with the updated address mapping information is determined in S203 based on the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, and the latest snapshot volume identifier can be used as the associated snapshot volume identifier. That is, the latest snapshot volume can be determined based on the snapshot volume identifier of the created snapshot volume managed by S201. For example, the currently created snapshot volumes include snapshot volume 1 and snapshot volume 2. At this time, data is updated, and the updated address mapping information corresponding to the logical address where the data is located is associated with the snapshot volume identifier of snapshot volume 2 and stored in the metadata space of the source volume. At this time, the association relationship between the address mapping information and the snapshot volume identifier in the metadata space of the source volume is not the corresponding relationship between the address mapping information and the snapshot volume in the traditional write-time redirect snapshot. When reading the snapshot or rolling back, it is necessary to search the address mapping information at the previous moment for the address mapping information that actually corresponds to the snapshot version number.

[0085] In some other optional implementations of the embodiments of the present invention, in S203, the snapshot volume identifier associated with the updated address mapping information is determined based on the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, and the snapshot volume identifier to be created is also determined based on the latest snapshot volume identifier, and the snapshot volume identifier to be created is used as the associated snapshot volume identifier. That is, according to the generation rule of the snapshot volume identifier, the snapshot volume identifier to be created of the first snapshot volume to be generated in the future is determined from the latest snapshot volume as the associated snapshot volume identifier of the updated address mapping information. For example, the currently created snapshot volumes include snapshot volume 1 and snapshot volume 2. At this time, although snapshot volume 3 has not been created, the updated address mapping information corresponding to the logical address where the data is located is associated with the snapshot volume identifier of snapshot volume 3 and stored in the metadata space of the source volume. At this time, when reading the snapshot or rolling back, the address mapping information that actually corresponds to the snapshot version number can be searched from the address mapping information corresponding to the snapshot volume identifier to the previous moment.

[0086] In the embodiment of the present invention, for the convenience of management and query, in S204, the updated address mapping information and the associated snapshot volume identifier are stored in the metadata space of the source volume in association, which may include: storing the address mapping information and the associated snapshot volume identifier corresponding to the same logical address in adjacent positions in the metadata space of the source volume in the order of update time. That is, assuming that a certain logical address has been updated when the latest snapshot volume is snapshot volume 1, the latest snapshot volume is snapshot volume 2, and the latest snapshot volume is snapshot volume 3, that is, the address mapping information is updated three times, then the address mapping information of the logical address-snapshot volume version number are stored adjacently in order, such as in the order of LP0-snapshot volume 1, LP1-snapshot volume 2, and LP2-snapshot volume 3.

[0087] In addition, when the source volume does not have a snapshot volume, if the data is updated, snapshot metadata management can also be performed in advance. The data storage method provided by the embodiment of the present invention can also include: if the source volume does not have a snapshot volume, then when the data of the source volume changes, after determining the updated address mapping information, the updated address mapping information is associated with the generated initial snapshot volume identifier and stored in the metadata space of the source volume. For example, 0, 1, 2, ..., N is used as the version number of the snapshot volume, that is, the snapshot volume identifier, but the first created snapshot volume is recorded as snapshot volume 1, then a virtual snapshot volume 0 is generated as the snapshot volume identifier associated with the updated address mapping information when the source volume does not create a snapshot volume.

[0088] like Figure 3 As shown, the data storage method provided by the embodiment of the present invention is applied, assuming that the address mapping information corresponding to the data A, B, and C in the source volume is L0-P0, L1-P1, and L2-P2, respectively, where L0, L1, and L2 represent logical addresses, and P0, P1, and P2 represent physical addresses. Assuming that when these address mapping information are updated, the latest snapshot volume corresponding to the source volume is snapshot volume 0 (or can represent the virtual snapshot volume identifier when no snapshot volume is created), then the metadata table stored in the metadata space of the source volume is L0-P0-snapshot volume 0, L1-P1-snapshot volume 0, and L2-P2-snapshot volume 0. When the host updates data A, assuming that the latest snapshot volume at the current moment is snapshot volume 1, the updated data A' is written to the new physical address P3 by redirecting the write. At this time, the address mapping information L0-P3 is added to the metadata space of the source volume for the logical address L0. The updated address mapping information corresponds to snapshot volume 1, and then a L0-P3-snapshot volume 1 is inserted after the address mapping information of the logical address L0, indicating the metadata corresponding to snapshot volume 1. However, when reading the snapshot or rolling back the source volume, the data actually protected by snapshot volume 1 is the address mapping information corresponding to snapshot volume 0, which is the snapshot volume identifier minus 1.

[0089] The data storage method provided by the embodiment of the present invention performs metadata management of snapshot volumes of different versions in units of data in the metadata space of the source volume. When the data of the source volume changes, the updated address mapping information corresponding to the target write logical address is determined according to the target write logical address of the target write data and the target write physical address to which the target write data is redirected to be written. The associated snapshot volume identifier associated with the updated address mapping information is determined according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment. Then, the updated address mapping information is associated with the associated snapshot volume identifier and stored in the metadata space of the source volume. The redirected snapshot can be written without copying the old address mapping information to the metadata space of the snapshot volume, thereby speeding up the redirected write speed and improving the storage write performance. On this basis, no matter the read or rollback process, it is only necessary to directly query the address mapping information in the metadata space of the source volume, which can also improve the storage read performance and rollback performance, and realize a data storage solution with both performance and reliability.

[0090] By applying the data storage method provided by the above embodiment of the present invention, when implementing a redirect-on-write snapshot, the number of metadata copies can be reduced each time the data is updated. On this basis, when processing a read data command for a source volume, the data storage method provided by the embodiment of the present invention can also include: when receiving a read data command for a source volume, querying the latest read physical address in the address mapping information corresponding to the target read logical address from the metadata space of the source volume according to the target read logical address of the target read data; using the latest read physical address as the target read physical address of the target read data, and reading the target read data from the target read physical address.

[0091] In the embodiment of the present invention, when the address mapping information corresponding to each snapshot version is uniformly managed in the metadata space of the source volume, the update time of each address mapping information can be distinguished by the numerical size of the snapshot volume identifier or the associated recording time. Then, in the normal operation of the source volume, when executing the read data command, the storage control host only needs to query the latest address mapping information corresponding to the logical address where the data is located, and obtain the latest read physical address from it.

[0092] When the read data command is for a snapshot volume, the target read physical address corresponding to the snapshot volume version can be determined by searching the metadata space of the source volume for the target read data and finding the corresponding address mapping information according to the snapshot volume identifier.

[0093] As introduced in the above embodiment of the present invention, if in S203 the associated snapshot volume identifier associated with the updated address mapping information is determined based on the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment to use the latest snapshot volume identifier as the associated snapshot volume identifier, then the corresponding address mapping information is found based on the snapshot volume identifier, which should be the address mapping information associated with the snapshot volume identifier at the previous moment corresponding to the snapshot created at the previous moment of the snapshot volume determined based on the snapshot volume identifier.

[0094] If the associated snapshot volume identifier associated with the updated address mapping information is determined based on the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment in S203, and the to-be-created snapshot volume identifier of the first to-be-created snapshot volume to be created in the future is determined based on the latest snapshot volume identifier, the to-be-created snapshot volume identifier is used as the associated snapshot volume identifier. Then, the corresponding address mapping information is found based on the snapshot volume identifier, that is, the address mapping information corresponding to the snapshot volume identifier.

[0095] Therefore, with the write-time redirect snapshot implemented by the data storage method provided by the embodiment of the present invention, when the snapshot needs to be read, there is no need to first find the snapshot volume and then go to the metadata space of the snapshot volume and then traverse the logical address once to find the corresponding address mapping information as in the traditional write-time redirect snapshot technology. Instead, all the address mapping information of the target read data can be found in the metadata space of the source volume after one traversal, and then it can be selected whether to read the latest address mapping information or read the address mapping information corresponding to a certain snapshot volume, thereby improving the storage read performance.

[0096] In actual applications, when the data of the source volume is damaged, such as errors or omissions when writing data, or data tampering caused by virus attacks, the snapshot volume of the source volume can be used to roll back to a historical moment to achieve data recovery of the source volume.

[0097] By applying the data storage method provided in the above embodiment of the present invention, when implementing write-time redirection snapshot, the number of metadata copies can be reduced each time the data is updated. Accordingly, when rolling back, there is no need to copy the address mapping information from the metadata space of the target snapshot volume to the metadata space of the source volume, thereby achieving less resource usage and faster rollback.

[0098] The data storage method provided by an embodiment of the present invention may also include: when receiving a source volume rollback command for a source volume, determining the target snapshot volume identifier of the target snapshot volume to be rolled back to; in the metadata space of the source volume, re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, and then completing the source volume rollback command.

[0099] Referring to the records of the above embodiments of the present invention, when providing the read function of the source volume, the storage control host uses the latest address mapping information corresponding to each logical address to determine the read physical address. Therefore, when rolling back, it is only necessary to change the latest address mapping information of the source volume data to achieve the rollback.

[0100] In some optional implementations of the embodiments of the present invention, completing the source volume rollback command after re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier may include: determining, in the metadata space of the source volume, the snapshot volume identifier to be deleted of the snapshot volume to be deleted created after the target snapshot volume according to the target snapshot volume identifier; and determining that the source volume rollback command is completed after deleting the address mapping information corresponding to the snapshot volume identifier to be deleted.

[0101] Figure 4 A schematic diagram of a source volume rollback process provided by an embodiment of the present invention.

[0102] In the above rollback method, it is necessary to wait and check whether all logical addresses have address mapping information updated after the target snapshot volume before the source volume rollback command can be completed. In order to further speed up the rollback speed, in other optional implementations of the embodiments of the present invention, after re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, the source volume rollback command is completed, and it can also include: creating a shadow snapshot volume for the source volume, the shadow snapshot volume is an empty snapshot volume; after establishing a jump association relationship between the shadow snapshot volume and the target snapshot volume, determining that the source volume rollback command is completed; wherein the jump association relationship is an association relationship that jumps the access to the shadow snapshot volume to the access to the target snapshot volume. That is to say, by creating an empty shadow snapshot volume to maintain the linear update order of the snapshot volume, but the shadow snapshot volume is associated with the target snapshot volume, the access to the shadow snapshot volume will jump to the target snapshot volume, so as to achieve the effect of rolling back to the target snapshot volume, and the source volume rollback command can be quickly completed.

[0103] like Figure 4 As shown, assuming that the snapshot volumes corresponding to the source volume include snapshot volume 0, snapshot volume 1, snapshot volume 2, and snapshot volume 3, and the source volume needs to be rolled back, and the target snapshot volume is snapshot volume 1, a shadow snapshot volume is created and recorded as snapshot volume 4, and a jump association relationship is established between snapshot volume 4 and snapshot volume 1, and snapshot volume 1 is made the jump-associated snapshot volume of snapshot volume 4, thus completing the rollback of the source volume.

[0104] On this basis, the data storage method provided by the embodiment of the present invention may further include: after completing the source volume rollback command, determining the snapshot volume identifier of the snapshot volume to be deleted created after the target snapshot volume according to the target snapshot volume identifier; deleting the updated address mapping information between the target snapshot volume and the shadow snapshot volume according to the snapshot volume identifier. That is, after creating the shadow snapshot and associating it with the target snapshot volume, it can be determined that the rollback is completed, and thereafter the source volume can provide storage services normally, and at this time, the address mapping information corresponding to the snapshot volumes that have been jumped can be deleted.

[0105] The data storage method provided by the embodiment of the present invention may also include: if the source volume has a historical shadow snapshot volume created before the shadow snapshot volume, and the creation time of the historical shadow snapshot volume is between the shadow snapshot volume and the target snapshot volume, then the historical shadow snapshot volume and the jump association relationship corresponding to the historical shadow snapshot volume are deleted; if the source volume has a historical shadow snapshot volume but the creation time of the historical shadow snapshot volume is before the target snapshot volume, then the historical shadow snapshot volume and the jump association relationship corresponding to the historical shadow snapshot volume are retained. That is to say, if after the source volume is rolled back, if a rollback occurs again, it is necessary to create a new shadow snapshot volume and establish a new jump relationship at this time. If the previously created historical shadow snapshot volume is within the jump interval of the newly created shadow snapshot volume, then the historical shadow snapshot volume and its jump association relationship can be deleted.

[0106] In addition, with respect to the two methods for determining associated snapshot volume identifiers provided in the above embodiments of the present invention, in some optional implementations of the embodiments of the present invention, the associated snapshot volume identifier associated with the updated address mapping information is determined according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, including: using the latest snapshot volume identifier as the associated snapshot volume identifier. Then, after re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, the source volume rollback command is completed, including: if the address mapping information corresponding to the logical address contains the last-moment snapshot volume identifier of the last-moment snapshot volume created at the last moment of the target snapshot volume, the address mapping information corresponding to the last-moment snapshot volume identifier is used as the latest address mapping information corresponding to the data; if the last-moment snapshot volume identifier does not exist in the address mapping information corresponding to the logical address, the last-moment query of the last-moment snapshot volume is continued until the latest address mapping information corresponding to all logical addresses is obtained. That is to say, assuming that a certain logical address has been updated when the latest snapshot volume is snapshot volume 1, the latest snapshot volume is snapshot volume 2, and the latest snapshot volume is snapshot volume 3, that is, the address mapping information has been updated three times, namely L0-P0-snapshot volume 1, L0-P1-snapshot volume 2, and L0-P2-snapshot volume 3. When the target snapshot volume is snapshot volume 2, the address mapping information L0-P1-snapshot volume 2 and L0-P2-snapshot volume 3 corresponding to the logical address need to be deleted, because the address mapping information corresponding to snapshot volume 1, that is, the address mapping information corresponding to the logical address L0 is L0-P0. The data that can be queried is the data actually protected by snapshot volume 2.

[0107] In some other optional implementations of the embodiments of the present invention, the associated snapshot volume identifier associated with the updated address mapping information is determined according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, including: determining the snapshot volume identifier of the first snapshot volume to be created in the future according to the latest snapshot volume identifier; using the snapshot volume identifier to be created as the associated snapshot volume identifier. After re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, the source volume rollback command is completed, including: if the target snapshot volume identifier exists in the address mapping information corresponding to the logical address, using the target snapshot volume identifier as the latest address mapping information corresponding to the logical address; if the target snapshot volume identifier does not exist in the address mapping information corresponding to the logical address, querying the target snapshot volume at the previous moment until the latest address mapping information corresponding to all logical addresses is obtained. That is to say, assuming that a certain logical address has been updated when the latest snapshot volume is snapshot volume 1, the latest snapshot volume is snapshot volume 2, and the latest snapshot volume is snapshot volume 3, that is, the address mapping information has been updated three times, namely L0-P0-snapshot volume 2, L0-P1-snapshot volume 3, and L0-P2-snapshot volume 4. When the target snapshot volume is snapshot volume 2, the address mapping information L0-P1-snapshot volume 3 and L0-P2-snapshot volume 4 corresponding to the logical address need to be deleted, because the address mapping information corresponding to snapshot volume 2, that is, the address mapping information L0-P0 corresponding to the logical address L0, can query data that is actually protected by snapshot volume 2.

[0108] Based on the above embodiments, the data storage method provided by the embodiments of the present invention may further include: when receiving a snapshot deletion command for a source volume, determining the snapshot volume identifier to be deleted corresponding to the snapshot volume to be deleted; in the metadata space of the source volume, updating the address mapping information corresponding to each logical address according to the snapshot volume identifier to be deleted, and then completing the snapshot deletion command.

[0109] In actual applications, considering factors such as the capacity of the metadata space and the snapshot creation time, it is necessary to delete the snapshot volumes created historically. In addition, it is sometimes necessary to delete the newly created snapshot volumes.

[0110] By applying the data storage method provided by the above embodiment of the present invention, when implementing write-time redirection snapshot, the number of metadata copies can be reduced each time the data is updated. Accordingly, when deleting a snapshot volume, there is no need to find the snapshot volume to be deleted and then delete the metadata space of the snapshot volume to be deleted. Instead, the snapshot volume identifier to be deleted can be found in the metadata space of the source volume and the address mapping information corresponding to each logical address can be updated for processing.

[0111] When the snapshot volume to be deleted is a historical snapshot volume, the snapshot deletion command can be determined to be completed after all the snapshot volume identifiers to be deleted are updated and the address mapping information corresponding to each logical address is updated. When the snapshot volume to be deleted is a part of the historical snapshot volume, a jump relationship can also be achieved by creating a shadow snapshot volume, using the shadow snapshot volume to jump from after the snapshot volume to be deleted to the target snapshot volume before the snapshot volume to be deleted. After establishing the jump association relationship from the shadow snapshot volume to the target snapshot volume, the snapshot deletion command can be determined to be completed.

[0112] The specific implementation of the embodiment of the present invention may refer to the introduction of the above rollback process.

[0113] On the basis of the above embodiments, in the data storage method provided by the embodiments of the present invention, after creating a snapshot volume for the source volume in S201, recording the snapshot volume identifier of the snapshot volume may include: recording the snapshot volume identifiers of the snapshot volumes created from the source volume as 0, 1, 2, ..., N in order of creation time, that is, when the source volume is just created, the number of snapshot volumes is 0, and a virtual snapshot volume 0 is generated as the snapshot volume identifier associated with the updated address mapping information, and thereafter, each time a snapshot volume is created, the snapshot volume identifier is gradually increased by 1 starting from 0, and when a snapshot volume is deleted, the total number of snapshot volumes is not changed, that is, the snapshot volume identifier is always the number of snapshot volumes of the current source volume, and the snapshot volume identifier of the deleted snapshot volume is not used.

[0114] In S202, when the data of the source volume changes, the updated address mapping information corresponding to the target write logical address is determined according to the target write logical address of the target write data and the target write physical address to which the target write data is redirected to be written. This may include: when the data of the target write logical block address of the source volume changes, a target write physical block address other than the physical block address of the original data is allocated to the updated data, and the address mapping information between the target write logical block address and the target write physical block address is used as the updated address mapping information.

[0115] Determining the associated snapshot volume identifier associated with the updated address mapping information according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment in S203 may include: using the snapshot volume identifier of the latest snapshot volume of the current source volume as the associated snapshot volume identifier.

[0116] In S204, the updated address mapping information is associated with the associated snapshot volume identifier and stored in the metadata space of the source volume, which may include: saving the address mapping information between the target write logical block address and the target write physical block address and the snapshot volume identifier of the latest snapshot volume of the current source volume, and saving the address mapping information and the snapshot volume identifier as a whole. The change in the data of the target write logical block address of the source volume includes the storage control host newly writing data or updating data at the target write logical block address.

[0117] In this way, as snapshot volumes are continuously created, the same logical block address may correspond to multiple address mapping information, but the snapshot volume identifiers they carry are different. Among all the address mapping information of the same logical block address, the largest snapshot volume identifier is the latest data of the source volume at the logical block address. It should be noted that, since some logical block addresses are not updated when some snapshot volumes are created, not all the largest snapshot volume identifiers in the address mapping information corresponding to the logical block addresses are the current largest snapshot volume identifiers of the source volume.

[0118] When creating a snapshot, the snapshot volume protects the latest data of the source volume, that is, the data corresponding to the address mapping information of the largest snapshot volume identifier carried in the address mapping information of all logical block addresses. These snapshot volume identifiers must be smaller than the snapshot volume identifier of the newly created snapshot volume, that is, the snapshot volume protects the latest data in all address mapping information whose snapshot volume identifier in the address mapping information is smaller than the snapshot volume identifier of the snapshot volume.

[0119] When saving the address mapping information and the corresponding snapshot volume identifier, the address mapping information with the same logical block address but associated with different snapshot volume identifiers is saved together, so as to query all the address mapping information with different snapshot volume identifiers for the same logical block address.

[0120] The data storage method provided by an embodiment of the present invention may also include: when receiving a read data command for reading a target read logical block address of a source volume, selecting address mapping information associated with a maximum snapshot volume identifier from address mapping information of all different snapshot volume identifiers of the target read logical block address, the address mapping information being the address mapping information of the current latest data of the source volume, and reading the data stored at the target read physical block address location after finding the address mapping information.

[0121] When a problem occurs with the latest data and a snapshot volume with a snapshot volume ID is selected for rollback, the data storage method provided by the embodiment of the present invention may further include: upon receiving a source volume rollback command for a source volume, determining a target snapshot volume ID of the target snapshot volume to be rolled back to; creating an empty shadow snapshot volume, marking the shadow snapshot volume and the target snapshot volume as a jump association relationship, and determining that the source volume rollback command is completed. Afterwards, the address mapping information protected by the snapshot volume between the target snapshot volume and the shadow snapshot volume is deleted, that is, all snapshot volumes after the target snapshot volume whose snapshot volume ID is 1 less than the shadow snapshot volume are deleted.

[0122] After the source volume rollback command is completed, the shadow snapshot volume is the latest snapshot volume of the source volume. When the source volume needs to be read, first check whether there is address mapping information associated with the shadow snapshot volume. If not, skip the snapshot volume identifier between the target snapshot volumes associated with the shadow snapshot volume, and find the address mapping information of the snapshot volume identifier less than the snapshot volume identifier of the target snapshot volume. After finding it, read the data at the target read physical block address position. The data read is the data protected by the target snapshot volume associated with the shadow snapshot volume, which means that the source volume is rolled back to the target snapshot volume, that is, the snapshot volume specified when rolling back.

[0123] After the source volume rollback command is completed, when the source volume updates data again, the shadow snapshot volume is the latest snapshot volume of the source volume. After the data is redirected and saved, the updated address mapping information is saved together with the snapshot volume identifier of the shadow snapshot volume.

[0124] After the source volume rollback command is completed, if a new snapshot volume is created again, when the source volume updates data, the updated address mapping information is associated with the snapshot volume of the newly created snapshot volume. When searching for address mapping information when reading the source volume, if the snapshot volume ID of the latest snapshot volume and the snapshot volume ID of the shadow snapshot volume are not found, the snapshot volumes between the snapshot volume ID of the target snapshot volume of the shadow snapshot volume and the snapshot volume ID of the shadow snapshot volume are still skipped.

[0125] After the source volume rollback command is completed, if rollback occurs again, a new shadow snapshot volume is created, and a jump association relationship is established between the new shadow snapshot volume and the target snapshot volume newly selected for rollback. If the historical shadow snapshot volume at the time of the last rollback is the latest snapshot volume of the source volume when the new shadow snapshot volume is created, the historical shadow snapshot volume is deleted, and the jump association relationship between the historical snapshot volume and its associated target snapshot volume is deleted at the same time.

[0126] It should be noted that in the embodiments of the data storage method of the present invention, some of the steps or features may be ignored or not executed. The hardware or software functional modules divided for the convenience of description are not the only implementation form of the data storage method provided in the embodiments of the present invention.

[0127] The above describes in detail various embodiments corresponding to the data storage method. On this basis, the present invention also discloses a data storage device, equipment, non-volatile storage medium and computer program product corresponding to the above method.

[0128] Figure 5 A schematic diagram of the structure of a data storage device provided by an embodiment of the present invention.

[0129] like Figure 5 As shown, the data storage device provided by the embodiment of the present invention includes:

[0130] The recording unit 501 is used to record the snapshot volume identifier of the snapshot volume after creating the snapshot volume for the source volume;

[0131] The first determining unit 502 is used to determine updated address mapping information corresponding to the target write logical address according to the target write logical address of the target write data and the target write physical address to which the target write data is redirected when the data of the source volume changes;

[0132] The second determining unit 503 is used to determine the associated snapshot volume identifier associated with the updated address mapping information according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment;

[0133] The metadata updating unit 504 is used to associate the updated address mapping information with the associated snapshot volume identifier and store it in the metadata space of the source volume.

[0134] In some optional embodiments of the present invention, the data storage device may further include:

[0135] The rollback control unit is used to determine the target snapshot volume identifier of the target snapshot volume to be rolled back to when receiving a source volume rollback command for the source volume; in the metadata space of the source volume, after re-determining the latest address mapping information corresponding to each data according to the target snapshot volume identifier, complete the source volume rollback command.

[0136] In some other optional embodiments of the present invention, the data storage device may further include:

[0137] The first deleting unit is used to determine the snapshot volume identifier of the snapshot volume to be deleted created after the target snapshot volume after completing the source volume rollback command; and delete the updated address mapping information between the target snapshot volume and the shadow snapshot volume according to the snapshot volume identifier to be deleted.

[0138] In some other optional embodiments of the present invention, the data storage device may further include:

[0139] The second deletion unit is used to delete the historical shadow snapshot volume and the jump association relationship corresponding to the historical shadow snapshot volume if the source volume has a historical shadow snapshot volume created before the shadow snapshot volume, and the creation time of the historical shadow snapshot volume is between the shadow snapshot volume and the target snapshot volume; if the source volume has a historical shadow snapshot volume but the creation time of the historical shadow snapshot volume is before the target snapshot volume, the historical shadow snapshot volume and the jump association relationship corresponding to the historical shadow snapshot volume are retained.

[0140] In some other optional embodiments of the present invention, the metadata update unit 504 can also be used to, if the source volume does not have a snapshot volume, then when the data of the source volume changes, after determining the updated address mapping information, associate the updated address mapping information with the generated initial snapshot volume identifier and store it in the metadata space of the source volume.

[0141] In some other optional embodiments of the present invention, the data storage device may further include:

[0142] A read data unit is used to, when receiving a read data command for a source volume, query the latest read physical address in the address mapping information corresponding to the target read data from the metadata space of the source volume according to the target read logical address of the target read data; use the latest read physical address as the target read physical address of the target read data, and read the target read data from the target read physical address.

[0143] It should be noted that in each implementation of the data storage device provided in the embodiment of the present invention, the division of the unit is only a logical functional division, and other division methods can be used. The connection method between different units can be electrical, mechanical or other connection methods. The separated units can be located in the same physical location or distributed on multiple network nodes. Each unit can be implemented in the form of hardware or in the form of a software functional unit. That is, part or all of the units provided in the embodiment of the present invention can be selected according to actual needs and the corresponding connection method or integration method can be adopted to achieve the purpose of the embodiment of the present invention.

[0144] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0145] Figure 6 A schematic diagram of the structure of a data storage device provided by an embodiment of the present invention.

[0146] like Figure 6 As shown, the data storage device provided in an embodiment of the present invention includes: a memory 610, used to store a computer program 611; a processor 620, used to execute the computer program 611, and when the computer program 611 is executed by the processor 620, the steps of the data storage method provided in any of the above embodiments are implemented.

[0147] Among them, the processor 620 may include one or more processing cores, such as a 3-core processor, an 8-core processor, etc. The processor 620 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 620 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 620 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 620 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0148] The memory 610 may include one or more non-volatile storage media, which may be non-transitory. The memory 610 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 610 is at least used to store the following computer program 611, wherein the computer program 611, after being loaded and executed by the processor 620, can implement the relevant steps in the data storage method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 610 may also include an operating system 612 and data 613, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 612 may be Windows or other types of operating systems. Data 613 may include, but is not limited to, the data involved in the above method.

[0149] In some embodiments, the data storage device may further include a display screen 630 , a power supply 640 , a communication interface 650 , an input / output interface 660 , a sensor 670 , and a communication bus 680 .

[0150] Those skilled in the art will understand that Figure 6 The structure shown in the figure does not constitute a limitation of the data storage device, and may include more or fewer components than shown in the figure.

[0151] The data storage device provided in the embodiment of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the steps of the data storage method provided in the above embodiment, and the effect is the same as above.

[0152] An embodiment of the present invention provides a non-volatile storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the data storage method provided in any one of the above embodiments can be implemented.

[0153] The non-volatile 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.

[0154] For the introduction of the non-volatile storage medium provided in the embodiment of the present invention, please refer to the above method embodiment, and the effect thereof is the same as the data storage method provided in the embodiment of the present invention, and the present invention will not elaborate on it here.

[0155] An embodiment of the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the data storage method provided in any one of the above embodiments.

[0156] For an introduction to the computer program product provided by the embodiment of the present invention, please refer to the above method embodiment, and the effect thereof is the same as the data storage method provided by the embodiment of the present invention, and the present invention will not elaborate on it here.

[0157] The above is a detailed introduction to a data storage method, device, storage medium and computer program product provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referenced to each other. For the devices, equipment, non-volatile storage media and computer program products disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.

[0158] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A data storage method, characterized in that: include: After creating a snapshot volume for the source volume, recording the snapshot volume identifier of the snapshot volume; When the data of the source volume changes, determining updated address mapping information corresponding to the target write logical address according to the target write logical address of the target write data and the target write physical address to which the target write data is redirected; Determine, according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, an associated snapshot volume identifier associated with the updated address mapping information; storing the updated address mapping information and the associated snapshot volume identifier in the metadata space of the source volume in association with each other; When receiving a source volume rollback command for the source volume, determining a target snapshot volume identifier of a target snapshot volume to be rolled back to; After re-determining the latest address mapping information corresponding to each logical address in the metadata space of the source volume according to the target snapshot volume identifier, the source volume rollback command is completed.

2. The data storage method according to claim 1, characterized in that: After re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, completing the source volume rollback command includes: Creating a shadow snapshot volume for the source volume, where the shadow snapshot volume is an empty snapshot volume; After establishing the jump association relationship between the shadow snapshot volume and the target snapshot volume, determining that the source volume rollback command is completed; The jump association relationship is an association relationship that jumps access to the shadow snapshot volume to access to the target snapshot volume.

3. The data storage method according to claim 2, characterized in that: Also includes: After completing the source volume rollback command, determining the to-be-deleted snapshot volume identifier of the to-be-deleted snapshot volume created after the target snapshot volume according to the target snapshot volume identifier; The updated address mapping information between the target snapshot volume and the shadow snapshot volume is deleted according to the snapshot volume identifier to be deleted.

4. The data storage method according to claim 2, characterized in that: Also includes: If the source volume has a historical shadow snapshot volume created before the shadow snapshot volume, and the creation time of the historical shadow snapshot volume is between the shadow snapshot volume and the target snapshot volume, then the historical shadow snapshot volume and the jump association relationship corresponding to the historical shadow snapshot volume are deleted; If the source volume has the historical shadow snapshot volume but the creation time of the historical shadow snapshot volume is before the target snapshot volume, the historical shadow snapshot volume and the jump association relationship corresponding to the historical shadow snapshot volume are retained.

5. The data storage method according to claim 1, characterized in that: After re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, completing the source volume rollback command includes: In the metadata space of the source volume, determining, according to the target snapshot volume identifier, a snapshot volume identifier to be deleted of a snapshot volume to be deleted that is created after the target snapshot volume; After deleting the address mapping information corresponding to the snapshot volume identifier to be deleted, it is determined that the source volume rollback command is completed.

6. The data storage method according to claim 1, characterized in that: The determining, according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, the associated snapshot volume identifier associated with the updated address mapping information comprises: Using the latest snapshot volume identifier as the associated snapshot volume identifier; After re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, completing the source volume rollback command includes: If the address mapping information corresponding to the logical address contains the last snapshot volume identifier of the last snapshot volume created at the last moment of the target snapshot volume, the address mapping information corresponding to the last snapshot volume identifier is used as the latest address mapping information corresponding to the logical address; If the last-time snapshot volume identifier does not exist in the address mapping information corresponding to the logical address, continue to query the last-time snapshot volume at the last time until the latest address mapping information corresponding to all logical addresses is obtained.

7. The data storage method according to claim 1, characterized in that: The determining, according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment, the associated snapshot volume identifier associated with the updated address mapping information comprises: Determine, according to the latest snapshot volume identifier, a snapshot volume identifier of a first snapshot volume to be created in the future; Taking the snapshot volume identifier to be created as the associated snapshot volume identifier; After re-determining the latest address mapping information corresponding to each logical address according to the target snapshot volume identifier, completing the source volume rollback command includes: If the target snapshot volume identifier exists in the address mapping information corresponding to the logical address, the target snapshot volume identifier is used as the latest address mapping information corresponding to the logical address; If the target snapshot volume identifier does not exist in the address mapping information corresponding to the logical address, the target snapshot volume is queried at the previous moment until the latest address mapping information corresponding to all logical addresses is obtained.

8. The data storage method according to claim 1, characterized in that: Also includes: If the source volume does not have the snapshot volume, when the data of the source volume changes, after determining the updated address mapping information, the updated address mapping information is associated with the generated initial snapshot volume identifier and stored in the metadata space of the source volume.

9. The data storage method according to claim 1, characterized in that: The updated address mapping information is associated with the associated snapshot volume identifier and stored in the metadata space of the source volume, including: The address mapping information corresponding to the same logical address and the associated snapshot volume identifier are stored in adjacent positions in the metadata space of the source volume in order of update time.

10. The data storage method according to claim 1, characterized in that: Also includes: When receiving a data read command for the source volume, querying the metadata space of the source volume for a latest read physical address in the address mapping information corresponding to the target read logical address according to the target read logical address of the target read data; The target read data is read from the target read physical address using the latest read physical address as the target read physical address of the target read data.

11. The data storage method according to claim 1, characterized in that: The snapshot volume identifier is a snapshot volume version number sorted from small to large according to the creation order of the snapshot volumes; Determining the associated snapshot volume identifier associated with the updated address mapping information according to the latest snapshot volume identifier of the latest snapshot volume corresponding to the source volume at the current moment includes: The largest snapshot volume identifier stored in the metadata space of the source volume is used as the latest snapshot volume identifier, and the associated snapshot volume identifier is determined according to the latest snapshot volume identifier.

12. A data storage device, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of the data storage method according to any one of claims 1 to 11 are implemented.

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

14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the data storage method according to any one of claims 1 to 11 are implemented.