Fast switching method, system, device and storage medium for snapshot read-only attribute

CN115470042BActive Publication Date: 2026-09-08INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211110401.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-13
Publication Date
2026-09-08
Estimated Expiration
2042-09-13

AI Technical Summary

Technical Problem

另外,用户创建了可读写快照后想要修改为只读快照也是不被允许的,从而大大降低了快照管理的灵活性

Benefits of technology

[0035]本发明提供的快照只读属性的快速切换方法、系统、设备及存储介质,本发明对源卷主机业务无影响:通过缓存模块来进行卷只读和可读写的控制,快照模块中源卷到目标卷的COW和ROW完全不受影响,因此,在不影响源卷主机业务的情况下,可以实现快照只读属性的快速切换。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115470042B_ABST
    Figure CN115470042B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of storage devices, and in particular to a snapshot read-only attribute quick switching method, system, device and storage medium. The method comprises the following steps: creating a volume and marking a read-only flag of the volume; creating a snapshot and specifying a read-only attribute of the snapshot; supporting modification of a read-only snapshot into a read-write snapshot; supporting modification of a read-write snapshot into a read-only snapshot; and the volume performing write IO processing through the read-only flag. The present application greatly improves the flexibility of snapshot management: the read-only attribute of the snapshot can be modified at any time after creation, for example, after creating a read-only snapshot, the read-only attribute can be closed first, mounted to a host, and then the read-only attribute is opened again, so that it is very convenient to view the data of the read-only snapshot volume.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of storage device technology, and in particular to a method, system, device, and storage medium for quickly switching snapshot read-only attributes. Background Technology

[0002] Snapshot technology refers to the replication of a specific data set at a specific moment. Its main purpose is to achieve rapid data backup and recovery without affecting host operations. In storage technology, snapshots are performed on a volume basis. The data set used to receive host operations is called the source volume, and the data copy created by creating the snapshot is called the target volume. If the storage system is attacked by malware, both the source and target volumes of the snapshot may be corrupted, which defeats the purpose of snapshots for data protection. Unlike ordinary snapshots, in read-only snapshots, the target volume is read-only, meaning the data cannot be modified or deleted, thus improving the reliability of data protection.

[0003] In current technology, read-write snapshots and read-only snapshots must be specified at creation and cannot be changed subsequently. Since the target volume of a read-only snapshot cannot be modified or deleted, and mounting the volume to the host's file system requires some write I / O, users who want to view the contents of a read-only snapshot must create a new read-write snapshot for that volume and mount it to the host. Furthermore, users are not allowed to change a read-write snapshot to read-only after creating it, significantly reducing the flexibility of snapshot management. To address this technical problem, a method, system, device, and storage medium for quickly switching snapshot read-only attributes are proposed. Summary of the Invention

[0004] To address the technical problems existing in the prior art, this invention provides a method, system, device, and storage medium for quickly switching the read-only attribute of snapshots. This invention places the snapshot module below the cache module, utilizes the cache module's interception of IO to achieve read-only status of the snapshot target volume, and supports quick switching between read-only snapshots and read-write snapshots by adjusting the IO interception switch of the cache module.

[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0006] In a first aspect, in one embodiment of the present invention, a method for quickly switching snapshot read-only attributes is provided, the method comprising the following steps:

[0007] Create the volume and mark it as read-only;

[0008] Create a snapshot and specify its read-only attribute;

[0009] Supports changing a read-only snapshot to a read-write snapshot; supports changing a read-write snapshot to a read-only snapshot.

[0010] The volume uses a read-only flag to handle write I / O.

[0011] As a further aspect of the present invention, when creating a volume, the caching module sets a read-only flag for the volume, denoted as cache_read_only_flag, and cache_read_only_flag = off during initialization.

[0012] As a further aspect of the present invention, the creation of a snapshot specifically includes the following steps:

[0013] Create a snapshot mapping relationship between the source volume and the target volume;

[0014] The snapshot module sets a read-only flag for the mapping relationship, denoted as snapshot_read_only_flag, and sets the value of snapshot_read_only_flag according to the user's selection;

[0015] If snapshot_read_only_flag = on, then the caching module is notified to set cache_read_only_flag of the target volume to on.

[0016] As a further aspect of the present invention, setting the value of snapshot_read_only_flag according to the user's selection includes: if the user creates a read-only snapshot, then set snapshot_read_only_flag = on; if it is a read-write snapshot, then set snapshot_read_only_flag = off.

[0017] As a further aspect of the present invention, the support for modifying a read-only snapshot into a read-write snapshot includes the following steps:

[0018] The snapshot module will set the snapshot_read_only_flag of the snapshot mapping relationship to off;

[0019] The notification caching module sets the cache_read_only_flag of the target volume to off.

[0020] As a further aspect of the present invention, the snapshot module sets the snapshot_read_only_flag of the snapshot mapping relationship to on;

[0021] The notification caching module sets the cache_read_only_flag of the target volume to on;

[0022] Write I / O operations in the I / O queue are specially marked, denoted as writable_io_flag, so that the caching module can recognize them when performing I / O processing.

[0023] As a further aspect of the present invention, the volume performs write I / O processing through a read-only flag, including the following steps:

[0024] Write I / O first reaches the cache module, which checks the volume's `cache_read_only_flag`. If `cache_read_only_flag` is off, the I / O data is placed in the cache area. Otherwise, if `cache_read_only_flag` is on, the module continues to check the I / O's `writable_io_flag`. If `writable_io_flag` is false, the I / O is intercepted, and an I / O failure is returned to the host. If `writable_io_flag` is true, the I / O data is placed in the cache area.

[0025] For I / O in the cached area, if the cache is full, it will be submitted to the lower-level snapshot module for processing;

[0026] After write I / O reaches the snapshot module, it will first perform COW or ROW from the source volume to the target volume, and then perform host I / O processing.

[0027] Secondly, in another embodiment provided by the present invention, a fast switching system for snapshot read-only attributes is provided, the system comprising: a volume creation module, a snapshot creation module, a snapshot modification read-only attribute module, and an IO processing module;

[0028] The volume creation module is used to create volumes and mark the read-only flag of the volumes;

[0029] The snapshot creation module is used to create snapshots and specify the read-only attribute of the snapshots;

[0030] The module for modifying the read-only attribute of a snapshot is used to support modifying a read-only snapshot to a read-write snapshot; and to support modifying a read-write snapshot to a read-only snapshot.

[0031] The IO processing module is used for the volume to perform write IO processing through the read-only flag.

[0032] Thirdly, in yet another embodiment of the present invention, an apparatus is provided, including a memory and a processor, the memory storing a computer program, wherein the processor loads and executes the computer program to implement the steps of a method for quickly switching snapshot read-only attributes.

[0033] Fourthly, in another embodiment of the present invention, a storage medium is provided storing a computer program that, when loaded and executed by a processor, implements the steps of the fast switching method for the snapshot read-only attribute.

[0034] The technical solution provided by this invention has the following beneficial effects:

[0035] The present invention provides a method, system, device, and storage medium for fast switching of snapshot read-only attributes. The present invention has no impact on the source volume host service: the control of volume read-only and read-write is performed through the caching module, and the COW and ROW of the source volume to the target volume in the snapshot module are completely unaffected. Therefore, fast switching of snapshot read-only attributes can be achieved without affecting the source volume host service.

[0036] It greatly improves the flexibility of snapshot management: the read-only attribute of the snapshot can be modified at any time after creation. For example, after creating a read-only snapshot, you can first turn off the read-only attribute, mount it to the host, and then turn on the read-only attribute again, which makes it very convenient to view the data of the read-only snapshot volume.

[0037] This invention reduces the number of snapshots, minimizes resource waste, and eliminates the need to create new snapshots when switching between them: Traditional snapshots cannot modify their read-only attribute. Therefore, to view the content of a read-only snapshot, a new read-write snapshot must be created from the existing read-only snapshot; similarly, to improve snapshot security, a new read-only snapshot must be created from the existing read-write snapshot. This significantly increases the number of snapshots. In contrast, this invention allows direct modification of the read-only attribute of a snapshot, enabling the same snapshot to switch freely between read-only and read-write modes without creating new snapshots.

[0038] These or other aspects of the invention will become more apparent from the following description of embodiments. It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a flowchart of a method for quickly switching the snapshot read-only attribute according to an embodiment of the present invention.

[0041] Figure 2 This is a flowchart of step S20 in a fast switching method for snapshot read-only attributes according to an embodiment of the present invention.

[0042] Figure 3 The specific process of step S30 in the fast switching method for snapshot read-only attributes according to an embodiment of the present invention. Figure 1 .

[0043] Figure 4 The specific process of step S30 in the fast switching method for snapshot read-only attributes according to an embodiment of the present invention. Figure 2 .

[0044] Figure 5 This is a flowchart of step S40 in a fast switching method for snapshot read-only attributes according to an embodiment of the present invention.

[0045] Figure 6 This is a block diagram of a system architecture for fast switching of snapshot read-only attributes according to an embodiment of the present invention.

[0046] In the diagram: Create Volume module - 100, Create Snapshot module - 200, Modify Read-Only Attribute of Snapshot module - 300, IO Processing module - 400. Detailed Implementation

[0047] Various embodiments and / or forms are described below with reference to the accompanying drawings. In the following description, numerous specific details are disclosed for illustrative purposes to provide a general understanding of more than one form. However, those skilled in the art will understand that these forms can be implemented without specific details. Specific examples of more than one form will be described in detail in the following description and drawings. However, these forms are merely illustrative and may utilize a portion of the principles and methods of various forms; the descriptions are intended to encompass all forms and their equivalents. Specifically, the terms "embodiment," "example," "form," "illustration," etc., as used in this specification can be interpreted as meaning that any form or design described may be better or more advantageous than other forms or designs.

[0048] Furthermore, various forms and characteristics can be embodied in systems that include more than one device, terminal, server, equipment, component, and / or module. It should be understood and recognized that various systems may include additional devices, terminals, servers, equipment, components, and / or modules, and / or may not include all of the multiple devices, terminals, servers, equipment, components, and modules shown in the figure.

[0049] The terms "computer program," "component," "module," and "system" used in this specification are used interchangeably, and "computer" refers to related entities, hardware, firmware, software, combinations of software and hardware, or the execution of software. For example, a component can be a process executing on a processor, a processor, an object, a thread of execution, a program, and / or a computer, but is not limited thereto. For example, it can be an application program executing on a computer device and / or all components of the computing device. More than one component can be installed within a processor and / or a thread of execution. A component can be localized within a single computer. A component can also be distributed between two or more computers.

[0050] Furthermore, these components can be executed by various computer-readable media constructed to internally store various data. These components, for example, can communicate locally and / or remotely based on signals having more than one data packet (e.g., data emitted by a component interacting with other components on a local system or a distributed system, and data transmitted to other systems via networks such as the Internet).

[0051] Hereinafter, regardless of the symbols used in the drawings, the same or similar constituent elements will be assigned the same symbols, and repeated descriptions of these elements will be omitted. Furthermore, when describing the embodiments disclosed in this specification, detailed descriptions of well-known technologies will be omitted if it is determined that such detailed descriptions would obscure the essence of the invention. Moreover, the accompanying drawings are only for easier understanding of the embodiments disclosed in this specification, and the technical concepts disclosed in this specification are not limited to the drawings.

[0052] The terminology used in this specification is for illustrative purposes and not for limiting the invention. Unless otherwise specified, the singular includes the plural. The use of “comprises” and / or “comprising” in this specification does not exclude the presence or addition of more than one other constituent element in addition to the mentioned constituent elements.

[0053] The terms "first," "second," etc., can be used to describe various elements or components, but the elements or components are not limited to those terms. The terms are used to distinguish one element or component from others. Therefore, the first element or component mentioned below can also be a second element or component within the technical concept of this invention.

[0054] Unless otherwise defined, all terms used in this specification (including technical and scientific terms) are to be understood in the sense commonly understood by one of ordinary skill in the art to which this invention pertains. Furthermore, terms defined in commonly used dictionaries should not be interpreted ideally or excessively unless specifically defined otherwise.

[0055] Furthermore, the term "or" does not mean exclusive "or" but inclusive "or". That is, unless otherwise specific or contextually ambiguous, "X uses A or B" implies one of the natural connotations. That is, "X uses A or B" can be any of the above when X uses A or B; X uses B or X uses both A and B. And it should be understood that the term "and / or" as used in this specification refers to all possible combinations of more than one of the related items listed.

[0056] In addition, the terms “information” and “data” used in this specification are generally used interchangeably.

[0057] The suffixes “module” and “section” used in the following description of the constituent elements are merely assigned or used interchangeably for the convenience of writing the specification, and they do not have any distinguishing meaning or function in themselves.

[0058] Traditional snapshots require users to determine whether the snapshot is read-only or read-write at the time of creation, and modifications are not permitted after creation. Since the read-only attribute of a snapshot cannot be modified, users who want to view the content of a read-only snapshot must create a new read-write snapshot; similarly, improving snapshot security requires creating a new read-only snapshot from a read-write snapshot. This not only reduces snapshot flexibility but also significantly increases the number of snapshots, resulting in unnecessary resource waste.

[0059] The invention places the snapshot module below the cache module, uses the cache module to intercept IO to achieve read-only snapshot of the target volume, and supports fast switching between read-only snapshots and read-write snapshots by adjusting the IO interception switch of the cache module.

[0060] Specifically, the embodiments of the present invention will be further described below with reference to the accompanying drawings.

[0061] Please see Figure 1 , Figure 1 This is a flowchart of a method for quickly switching snapshot read-only attributes provided by an embodiment of the present invention, such as... Figure 1 As shown, the fast switching method for the snapshot read-only attribute includes steps S10 to S40.

[0062] S10. Create the volume and mark the volume as read-only.

[0063] In an embodiment of the present invention, when creating a volume, the caching module sets a read-only flag for the volume, denoted as cache_read_only_flag, and cache_read_only_flag = off during initialization.

[0064] S20. Create a snapshot and specify the read-only attribute of the snapshot.

[0065] In an embodiment of the present invention, please refer to Figure 2 , Figure 2 This is a flowchart of step S20 in a method for quickly switching snapshot read-only attributes provided in an embodiment of the present invention. Step S20, creating a snapshot, specifically includes the following steps:

[0066] S201. Create a snapshot mapping relationship between the source volume and the target volume;

[0067] S202. The snapshot module sets a read-only flag for the mapping relationship, denoted as snapshot_read_only_flag, and sets the value of snapshot_read_only_flag according to the user's selection.

[0068] Specifically, setting the value of snapshot_read_only_flag according to the user's choice includes: if the user creates a read-only snapshot, then set snapshot_read_only_flag = on; if it is a read-write snapshot, then set snapshot_read_only_flag = off.

[0069] S203. If snapshot_read_only_flag = on, then notify the caching module to set cache_read_only_flag of the target volume to on.

[0070] S30. Supports changing a read-only snapshot to a read-write snapshot; supports changing a read-write snapshot to a read-only snapshot.

[0071] In an embodiment of the present invention, please refer to Figure 3 , Figure 3 This is a detailed process of step S30 in a method for quickly switching snapshot read-only attributes provided in an embodiment of the present invention. Figure 1 In step S30, the ability to modify a read-only snapshot into a read-write snapshot is supported, specifically including the following steps:

[0072] S3011. The read-only attribute of the snapshot is enabled. The user chooses to disable the read-only attribute. The snapshot module will set the snapshot_read_only_flag of the snapshot mapping relationship to off.

[0073] S3012, The notification cache module sets the cache_read_only_flag of the target volume to off.

[0074] In an embodiment of the present invention, please refer to Figure 4 , Figure 4 This is a detailed process of step S30 in a method for quickly switching snapshot read-only attributes provided in an embodiment of the present invention. Figure 2In step S30, the read-write snapshot can be modified into a read-only snapshot, specifically including the following steps:

[0075] S3021. The read-only attribute of the snapshot is turned off. If the user chooses to enable the read-only attribute, the snapshot module will set the snapshot_read_only_flag of the snapshot mapping relationship to on.

[0076] S3022, The notification cache module sets the cache_read_only_flag of the target volume to on;

[0077] S3023. Write IOs in the IO queue are specially marked as writable_io_flag so that the cache module can recognize them when performing IO processing.

[0078] Specifically, the caching module is placed on top of the snapshot module, and the caching module is used to control the volume's read-only and read-write states. A fast switching method for the snapshot's read-only attribute is proposed, which aims to allow users to switch between read-only and read-write states at any time according to their needs.

[0079] S40. The volume uses the read-only flag to handle write I / O.

[0080] In an embodiment of the present invention, please refer to Figure 5 , Figure 5 This is a flowchart of step S40 in a fast switching method for snapshot read-only attributes provided in an embodiment of the present invention. Step S40 involves the volume performing write I / O processing using a read-only flag, and specifically includes the following steps:

[0081] S401. When writing I / O, the data first reaches the cache module, which checks the volume's `cache_read_only_flag`. If `cache_read_only_flag` is off, the I / O data is placed in the cache area; otherwise, if `cache_read_only_flag` is on, the `writable_io_flag` of the I / O is checked. If `writable_io_flag` is false, the I / O is intercepted, and an I / O failure is returned to the host; if `writable_io_flag` is true, the I / O data is placed in the cache area.

[0082] S402. For these I / O operations in the cache area, if the cache area is full, they will be submitted to the lower-level snapshot module for processing.

[0083] S403. After the write IO reaches the snapshot module, it will first perform COW or ROW from the source volume to the target volume, and then perform host IO processing.

[0084] This invention allows snapshots to be switched freely between read-only and read-write modes on the target volume; compared to traditional read-only snapshots that cannot be modified after creation, it allows for more flexible snapshot management.

[0085] This invention places the snapshot module below the cache module, utilizing the cache module's I / O interception to achieve read-only access to the snapshot target volume. The cache module's adjustment of the I / O interception switch supports rapid switching between read-only and read-write snapshots. Specifically, when creating a volume, the cache module sets a read-only flag, which is initially disabled. When creating a snapshot, the snapshot module sets a read-only flag for the snapshot mapping relationship. This flag is user-specified; enabling it indicates read-only access, while disabling it indicates read-write access. If the created snapshot is read-only, the cache module's read-only flag for the snapshot volume is enabled. After snapshot creation, the read-only flag for the snapshot relationship can be modified at any time. Disabling the read-only flag automatically triggers the disabling of the cache module's read-only flag in the corresponding snapshot target volume; enabling it automatically triggers the enabling of the cache module's read-only flag in the corresponding snapshot target volume. Simultaneously, unprocessed I / O in the cache module's I / O queue is marked. Subsequent written I / O with markings is processed normally, while unmarked written I / O is intercepted.

[0086] It should be understood that although the above description follows a certain order, these steps are not necessarily executed in that order. Unless otherwise expressly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, some steps in this embodiment may include multiple steps or multiple stages, which are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be performed alternately or in turn with other steps or at least a portion of the steps or stages in other steps.

[0087] In one embodiment, see Figure 6 As shown, an embodiment of the present invention also provides a fast switching system for snapshot read-only attributes, the system including a volume creation module 100, a snapshot creation module 200, a snapshot read-only attribute modification module 300, and an IO processing module 400.

[0088] The volume creation module 100 is used to create volumes and mark the read-only flag of the volumes.

[0089] In an embodiment of the present invention, when the volume creation module 100 creates a volume, the caching module sets a read-only flag for the volume, denoted as cache_read_only_flag, and cache_read_only_flag = off during initialization.

[0090] The snapshot creation module 200 is used to create snapshots and specify the read-only attribute of the snapshots.

[0091] In an embodiment of the present invention, the snapshot creation module 200 specifically includes the following steps:

[0092] Step 1: Create a snapshot mapping relationship between the source volume and the target volume;

[0093] Step 2: The snapshot module sets a read-only flag for the mapping relationship, denoted as snapshot_read_only_flag. The value of snapshot_read_only_flag is set according to the user's selection.

[0094] Specifically, setting the value of snapshot_read_only_flag according to the user's choice includes: if the user creates a read-only snapshot, then set snapshot_read_only_flag = on; if it is a read-write snapshot, then set snapshot_read_only_flag = off.

[0095] Step 3: If snapshot_read_only_flag = on, then notify the caching module to set cache_read_only_flag of the target volume to on.

[0096] The module 300 for modifying the read-only attribute of a snapshot is used to support modifying a read-only snapshot to a read-write snapshot; and to support modifying a read-write snapshot to a read-only snapshot.

[0097] In an embodiment of the present invention, the module 300 for modifying the read-only attribute of a snapshot, which supports modifying a read-only snapshot to a read-write snapshot, specifically includes the following steps:

[0098] Step 1: The read-only attribute of the snapshot is enabled. The user chooses to disable the read-only attribute; the snapshot module will set the snapshot_read_only_flag of the snapshot mapping relationship to off.

[0099] Step 2: Notify the caching module to set the cache_read_only_flag of the target volume to off.

[0100] In an embodiment of the present invention, the module 300 for modifying the read-only attribute of a snapshot, which supports modifying a read-write snapshot to a read-only snapshot, specifically includes the following steps:

[0101] Step 1: The read-only attribute of the snapshot is already turned off. If the user chooses to enable the read-only attribute, the snapshot module will set the snapshot_read_only_flag of the snapshot mapping relationship to on.

[0102] Step 2: Notify the caching module to set the cache_read_only_flag of the target volume to on;

[0103] Step 3: Mark the write IOs in the IO queue with a special flag, denoted as writable_io_flag, so that the caching module can recognize them when performing IO processing.

[0104] Specifically, the caching module is placed on top of the snapshot module, and the caching module is used to control the volume's read-only and read-write states. A fast switching method for the snapshot's read-only attribute is proposed, which aims to allow users to switch between read-only and read-write states at any time according to their needs.

[0105] The IO processing module 400 is used for the volume to perform write IO processing through the read-only flag.

[0106] In an embodiment of the present invention, step S40, where the volume performs write I / O processing using a read-only flag, specifically includes the following steps:

[0107] Step 1: Write I / O first reaches the cache module, which checks the volume's `cache_read_only_flag`. If `cache_read_only_flag` is off, the I / O data is placed in the cache area; otherwise, if `cache_read_only_flag` is on, the module continues to check the I / O's `writable_io_flag`. If `writable_io_flag` is false, the I / O is intercepted, and an I / O failure is returned to the host; if `writable_io_flag` is true, the I / O data is placed in the cache area.

[0108] Step 2: For these I / O operations in the cache area, if the cache area is full, they will be submitted to the lower-level snapshot module for processing;

[0109] Step 3: After the write I / O reaches the snapshot module, it will first perform COW or ROW from the source volume to the target volume, and then perform host I / O processing.

[0110] This invention has no impact on the source volume host's operations: By controlling the read-only and read-write permissions of a volume through a caching module, the COW and ROW operations from the source volume to the target volume in the snapshot module are completely unaffected. Therefore, rapid switching of the snapshot's read-only attribute can be achieved without impacting the source volume host's operations; it greatly improves the flexibility of snapshot management: the read-only attribute of a snapshot can be modified at any time after creation. For example, after creating a read-only snapshot, the read-only attribute can be disabled, mounted to the host, and then enabled again, making it convenient to view the data in the read-only snapshot volume; it reduces the number of snapshots, reduces resource waste, and switching does not generate new snapshots: Traditional snapshots cannot modify the read-only attribute, so to view the content of a read-only snapshot, a new read-write snapshot must be created; to improve snapshot security, a new read-only snapshot must be created for a read-write snapshot. This greatly increases the number of snapshots. This invention, however, allows direct modification of the snapshot's read-only attribute, and the same snapshot can be freely switched between read-only and read-write without creating new snapshots.

[0111] In one embodiment, an apparatus is also provided in the present invention, including at least one processor and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform the fast switching method for snapshot read-only attributes, the processor implementing the steps in the above method embodiment when executing the instructions.

[0112] The device includes user equipment and network equipment. The user equipment includes, but is not limited to, computers, smartphones, and PDAs. The network equipment includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing, which is a type of distributed computing consisting of a loosely coupled set of computers forming a super virtual computer. The device can operate independently to implement the invention, or it can connect to a network and interact with other devices within the network to implement the invention. The network in which the device operates includes, but is not limited to, the Internet, wide area networks (WANs), metropolitan area networks (MANs), local area networks (LANs), and VPN networks.

[0113] It should also be understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0114] In one embodiment of the present invention, a storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the steps in the above method embodiments.

[0115] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Furthermore, any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include at least one of non-volatile and volatile memory.

[0116] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0117] The above are exemplary embodiments disclosed in this invention. However, it should be noted that various changes and modifications can be made without departing from the scope of the embodiments of this invention as defined by the claims. The functions, steps, and / or actions of the methods according to the disclosed embodiments described herein do not need to be performed in any particular order. Furthermore, although the elements disclosed in the embodiments of this invention may be described or claimed individually, they may be understood as multiple unless explicitly limited to a singular number.

[0118] It should be understood that, as used herein, the singular form "a" is intended to include the plural form as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations of one or more of the associatedly listed items. The embodiment numbers disclosed above are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0119] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention (including the claims) is limited to these examples. Within the framework of the invention, technical features of the above embodiments or different embodiments can be combined, and many other variations of different aspects of the invention exist, which are not provided in the details for the sake of brevity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the protection scope of the invention.

Claims

1. A method for quickly switching snapshot read-only attributes, characterized in that, The method includes: Create a volume and mark the volume with a read-only flag; Create a snapshot and specify the read-only attribute of the snapshot, wherein the read-only attribute is configured to be modifiable by the user and the read-only flag can be controlled through the read-only attribute; A cache module is set up on top of the snapshot module. The cache module is controlled by the read-only flag to receive host I / O and supports modifying read-only snapshots into read-write snapshots, as well as modifying read-write snapshots into read-only snapshots. The volume uses a read-only flag for write I / O processing; The snapshot creation process specifically includes the following steps: creating a snapshot mapping relationship between the source volume and the target volume; the snapshot module sets a read-only flag, denoted as snapshot_read_only_flag, for the mapping relationship, and sets the value of snapshot_read_only_flag according to the user's selection; if snapshot_read_only_flag=on, the caching module sets the cache_read_only_flag of the target volume to on; The step of setting the value of snapshot_read_only_flag according to the user's choice includes: if the user creates a read-only snapshot, then set snapshot_read_only_flag=on; if it is a read-write snapshot, then set snapshot_read_only_flag=off. The support for modifying a read-write snapshot to a read-only snapshot includes the following steps: the snapshot module sets the snapshot_read_only_flag of the snapshot mapping relationship to on; the cache module is notified to set the cache_read_only_flag of the target volume to on; and the write IO in the IO queue is specially marked as writable_io_flag for the cache module to identify when performing IO processing. The volume handles write I / O using a read-only flag, including the following steps: Write I / O first reaches the caching module, which checks the volume's `cache_read_only_flag`. If `cache_read_only_flag` is off, the I / O data is placed in the cache area. Otherwise, if `cache_read_only_flag` is on, the module checks the I / O's `writable_io_flag`. If `writable_io_flag` is false, the I / O is intercepted, and an I / O failure is returned to the host. If `writable_io_flag` is true, the I / O data is placed in the cache area. For I / O in the cache area, if the cache area is full, it is submitted to the lower-level snapshot module for processing. After write I / O reaches the snapshot module, a COW or ROW operation is performed from the source volume to the target volume before host I / O processing.

2. The method for quickly switching snapshot read-only attributes as described in claim 1, characterized in that, When creating a volume, the caching module sets a read-only flag for the volume, denoted as cache_read_only_flag. During initialization, cache_read_only_flag is set to off.

3. The method for quickly switching snapshot read-only attributes as described in claim 1, characterized in that, The support for modifying a read-only snapshot into a read-write snapshot includes the following steps: The snapshot module sets the snapshot_read_only_flag of the snapshot mapping relationship to off; The notification caching module sets the cache_read_only_flag of the target volume to off.

4. A fast switching system for snapshot read-only attributes, characterized in that, The system includes: a volume creation module, a snapshot creation module, a snapshot read-only attribute modification module, and an I / O processing module; The volume creation module is used to create volumes and mark the read-only flag of the volumes; The snapshot creation module is used to create a snapshot and specify the read-only attribute of the snapshot. The read-only attribute is configured to be modifiable by the user and the read-only flag can be controlled through the read-only attribute. The module for modifying the read-only attribute of a snapshot is used to set up a cache module on top of the snapshot module. The cache module is controlled by the read-only flag to receive host I / O and supports modifying a read-only snapshot to a read-write snapshot; it also supports modifying a read-write snapshot to a read-only snapshot. The IO processing module is used for the volume to perform write IO through the read-only flag; The volume creation module is also used to create a snapshot mapping relationship between the source volume and the target volume; the snapshot module sets a read-only flag, denoted as snapshot_read_only_flag, for the mapping relationship, and sets the value of snapshot_read_only_flag according to the user's selection; if snapshot_read_only_flag=on, the caching module sets the cache_read_only_flag of the target volume to on; The step of setting the value of snapshot_read_only_flag according to the user's choice includes: if the user creates a read-only snapshot, then set snapshot_read_only_flag=on; if it is a read-write snapshot, then set snapshot_read_only_flag=off. The support for modifying a read-write snapshot to a read-only snapshot includes the following steps: the snapshot module sets the snapshot_read_only_flag of the snapshot mapping relationship to on; the cache module is notified to set the cache_read_only_flag of the target volume to on; and the write IO in the IO queue is specially marked as writable_io_flag for the cache module to identify when performing IO processing. The volume handles write I / O using a read-only flag, including the following steps: Write I / O first reaches the caching module, which checks the volume's `cache_read_only_flag`. If `cache_read_only_flag` is off, the I / O data is placed in the cache area. Otherwise, if `cache_read_only_flag` is on, the module checks the I / O's `writable_io_flag`. If `writable_io_flag` is false, the I / O is intercepted, and an I / O failure is returned to the host. If `writable_io_flag` is true, the I / O data is placed in the cache area. For I / O in the cache area, if the cache area is full, it is submitted to the lower-level snapshot module for processing. After write I / O reaches the snapshot module, a COW or ROW operation is performed from the source volume to the target volume before host I / O processing.

5. A computer device, comprising a memory and a processor, the memory storing a computer program, wherein the processor loads and executes the computer program to implement the steps of the fast switching method for snapshot read-only attributes as described in any one of claims 1-3.

6. A storage medium storing a computer program that, when loaded and executed by a processor, implements the steps of the fast switching method for snapshot read-only attributes as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Writable snapshot implementation method and device, equipment and readable storage medium

    CN110658992A