Non-transitory machine-readable storage medium, system, and method

By introducing a hint flag into the snapshot metadata, storage space calculation is optimized, solving the problem of low efficiency in determining snapshot storage space and achieving more efficient storage space management.

CN118860271BActive Publication Date: 2026-01-02HEWLETT PACKARD ENTERPRISE DEV LP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410149085.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2023-04-27
Filing Date
2024-02-02
Publication Date
2026-01-02
Estimated Expiration
2044-02-02

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently determine the storage space consumed by snapshots, especially when intermediate snapshots share storage space with other snapshots or base volumes, resulting in inefficient storage space accounting and analysis.

Method used

By introducing a hint flag in the snapshot's metadata, indicating that the metadata entries of the child or parent generation should be checked during storage space accounting, updating the statistics of storage space usage, and optimizing storage space accounting with a background process.

Benefits of technology

It improves the accuracy and efficiency of determining the unique storage space for snapshots, reduces data operation latency, and supports more efficient storage space management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860271B_ABST
    Figure CN118860271B_ABST
Patent Text Reader

Abstract

The present disclosure relates to storage space determination for snapshots. In some examples, a system maintains statistics related to usage of storage space for a base storage structure and a set of snapshots associated with the base storage structure based on data for the base storage structure and the set of snapshots. The system examines metadata of a first snapshot to determine validity of references in the metadata and existence of any children of the first snapshot or ancestors of the first snapshot. The system associates hints with metadata entries of parents of the first snapshot based on the validity of the references in the metadata and the existence of any children or ancestors of the first snapshot to indicate that metadata entries of the children or ancestors are to be examined. The system uses the hints to update the statistics related to usage of the storage space.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure generally relates to determining storage space for snapshots. BACKGROUND

[0002] A storage system can store data in storage volumes, which are logical containers of data that can be stored on one or more storage devices of the storage system. In some cases, snapshots of the storage volumes can be taken. A snapshot is a point-in-time copy of a storage volume. Different snapshots can be taken at different points in time. SUMMARY

[0003] According to an aspect of the present disclosure, a non-transitory machine-readable storage medium includes instructions that, when executed, cause a system to maintain statistics related to usage of storage space for a base storage structure and a set of snapshots associated with the base storage structure based on data of the base storage structure and the set of snapshots; check metadata of a first snapshot to determine validity of a reference in the metadata and existence of any children of the first snapshot or ancestors of the first snapshot; add a hint to a metadata entry of a parent of the first snapshot based on the validity of the reference in the metadata and the existence of any children or ancestors of the first snapshot, the hint including a flag set to a first value indicating that metadata entries of the children are to be checked to determine whether shared storage space becomes storage space that is unique to the children of the first snapshot or metadata entries of the ancestors are to be checked to determine whether shared storage space becomes storage space that is unique to the parent of the first snapshot; and update the statistics related to usage of storage space by checking metadata entries of the children or the ancestors based on the flag set to the first value.

[0004] According to another aspect of the present disclosure, a system for storage space determination for snapshots includes a processor and a non-transitory storage medium having stored machine-readable instructions executable on the processor to maintain statistics related to usage of storage space for a base storage structure and a set of snapshots associated with the base storage structure based on data for the base storage structure and the set of snapshots; examine metadata of a first snapshot to determine validity of references in entries of the metadata and existence of any children of the first snapshot or ancestors of the first snapshot; based on the validity of references in entries of the metadata and the existence of any children or ancestors of the first snapshot: associate a first hint with a first metadata entry of a parent of the first snapshot to indicate that metadata entries of the children are to be examined to determine whether shared storage space becomes storage space used exclusively by the children, wherein the first hint includes a first flag set to a first value, and associate a second hint with a second metadata entry of the parent of the first snapshot to indicate that metadata entries of the ancestors are to be examined to determine whether shared storage space becomes storage space used exclusively by the parent of the first snapshot, wherein the second hint includes a second flag set to the first value; and update the statistics related to usage of storage space during a background process that uses the first flag set to the first value and the second flag set to the first value.

[0005] According to another aspect of the present disclosure, a method of a system including a hardware processor includes maintaining statistics related to usage of storage space for a base storage structure and a set of snapshots associated with the base storage structure based on data for the base storage structure and the set of snapshots; in response to deletion of a first snapshot, examining, by the system, metadata of the first snapshot to determine validity of references in the metadata and existence of any children of the first snapshot or ancestors of the first snapshot; adding, by the system, based on the validity of references in the metadata and the existence of children and ancestors of the first snapshot, a hint to a metadata entry of a parent of the first snapshot to indicate that metadata entries of the children are to be examined to determine whether shared storage space becomes storage space used exclusively by the children of the first snapshot and metadata entries of the ancestors are to be examined to determine whether shared storage space becomes storage space used exclusively by the parent of the first snapshot, wherein the hint includes a first flag in a first metadata entry of the parent set to a first value and a second flag in a second metadata entry of the parent set to the first value; and updating, by the system, the statistics related to usage of storage space using the hint including the first flag set to the first value and the second flag set to the first value. Attached Figure Description

[0006] Some embodiments of this disclosure are described with reference to the following figures.

[0007] Figure 1 It is a block diagram of the layout of a storage system, including a storage space accounting engine, based on some examples.

[0008] Figures 2A-2G , Figures 3A-3B , Figures 4A-4B and Figures 5A-5B The illustration shows an example of maintaining statistics for base volumes and snapshots based on usage tips from several examples.

[0009] Figure 6 It is a block diagram of a storage medium with machine-readable instructions based on some examples of storage.

[0010] Figure 7 It is a block diagram of a system based on some examples.

[0011] Figure 8 It is a flowchart based on some examples.

[0012] Throughout the accompanying drawings, the same reference numerals denote similar but not necessarily identical elements. The drawings are not necessarily drawn to scale, and the dimensions of some parts may be enlarged to illustrate the examples more clearly. Furthermore, the drawings provide examples and / or embodiments consistent with the description; however, the description is not limited to the examples and / or embodiments provided in the drawings. Detailed Implementation

[0013] A storage volume for which a collection of snapshots has already been created can be referred to as a "base volume". As used herein, a "collection" of items can refer to a single item or multiple items. Therefore, a snapshot collection can include a single snapshot or multiple snapshots. A base volume comprises a collection of data pages, where each data page occupies a specified amount of storage space. A data "page" can refer to any unit of data of any specified size.

[0014] The first snapshot of the base volume taken at the first point in time can include copies of the data pages present in the base volume at the first point in time. Metadata can be maintained for the base volume to indicate the presence of data pages in the base volume. As described below, the base volume includes a reference table that includes valid entries that reference storage locations of data pages of the base volume and invalid entries that do not reference any storage location. In examples described herein, a snapshot of the base volume is taken by creating a new, empty reference table for the base volume (i.e., with all invalid entries), reassigning the reference table of the base volume (at the point in time at which the snapshot is taken) to the snapshot, and then assigning the empty reference table to the base volume. In such examples, an invalid entry in the reference table can cause a check of a corresponding entry of a reference table of an earlier snapshot to locate the data. Each time an invalid entry is found, an increasingly earlier snapshot can be checked until a valid entry is found or until the earliest snapshot is found to contain the invalid entry, indicating that the page corresponding to the entry is empty.

[0015] A second snapshot of the base volume can be taken at a later second point in time after the first snapshot at the first point in time. The second snapshot can be considered an incremental snapshot because the reference table included by the second snapshot has valid entries for data pages of the base volume that have changed since the first point in time at which the first snapshot was taken.

[0016] Each of the base volume, the first snapshot, and the second snapshot can consume a respective amount of storage space in the storage system. For a base volume without snapshots, as data is written to the base volume, the used storage space consumed by the base volume increases. When a snapshot is created based on the base volume, both the snapshot and the base volume can (directly or indirectly) reference at least one data page that occupies an amount of storage space. For example, the reference table of the snapshot can contain an entry with a valid reference to a data page (i.e., directly referencing the page), while the corresponding entry in the reference table of the base volume after the snapshot includes an invalid reference, thereby indirectly referencing the corresponding valid entry in the reference table of the snapshot (i.e., via the aforementioned progressive examination of earlier snapshots). Such storage space occupied by a data page that is directly referenced by one snapshot and indirectly referenced by the base volume (and / or another snapshot) is considered to be “shared” storage space between the snapshot and the base volume and / or other snapshot. As more snapshots are created based on the base volume, different snapshots can reference at least one data page that occupies storage space shared between the snapshots. A “shared data page” is a data page that is referenced (directly or indirectly) by multiple ones of the base volume and one or more snapshots. A “unique data page” (also referred to as a “non-shared data page”) is a data page that is referenced only by a single snapshot (i.e., “owned uniquely” by the snapshot) or only by the base volume (i.e., “owned uniquely” by the base volume). For example, a unique page of the base volume is referenced by the base volume but not by any snapshot of the base volume (i.e., indirectly). A unique page of a given snapshot is referenced by the given snapshot but not by the base volume or any other snapshot of the base volume (e.g., indirectly).

[0017] In some cases, it can be desirable to determine how much storage space is consumed by a given snapshot. However, due to the possibility that the given snapshot can share storage space with at least one other snapshot or the base volume, it can be difficult to efficiently determine the storage space occupied by data unique to the given snapshot (i.e., the amount of space that would be released by deleting the given snapshot) because the determination would exclude the storage space of data shared with at least one other snapshot or the base volume. Determining the storage space occupied by data unique to the given snapshot is even more challenging if the given snapshot is an intermediate snapshot (i.e., a snapshot taken at a point in time later than at least one other snapshot). Similarly, determining the storage space occupied by the base volume can be challenging because the base volume can include data unique to the base volume and can further share data with one or more snapshots.

[0018] Performing concatenated storage accounting analysis on metadata associated with each snapshot in a base volume and associated set of snapshots to determine an amount of storage uniquely consumed by each snapshot and / or base volume is inefficient. Concatenated storage accounting analysis refers to analysis performed as part of a data operation involving a base volume and its snapshots. Moreover, there can be constraints on availability of metadata for snapshots in a set. When an operation is being performed on a given snapshot (e.g., an operation to delete a given snapshot), metadata associated with later snapshots or earlier snapshots that can be involved in performing storage accounting analysis can not be readily accessible (e.g., in memory). As a result, performing analysis to determine an amount of storage uniquely consumed by a given snapshot and / or a base volume consistent with a data operation can not be practical or efficient. For example, copying metadata for snapshots not involved in a data operation for the purposes of storage accounting analysis can delay completion of the data operation.

[0019] According to some embodiments of the present disclosure, a system associates a hint with a base volume or snapshot to indicate which metadata entries of a child snapshot or parent (base volume or another snapshot) to consider when performing storage accounting in response to an operation involving a given snapshot (e.g., deletion of a given snapshot). A "hint" can refer to an indicator implemented such as using a flag, field, or any other information element. A "child" of a given snapshot refers to a snapshot taken at an earlier point in time than the given snapshot. A "parent" of a given snapshot refers to a base volume or a snapshot taken at a later point in time than the given snapshot. Storage accounting can be a background process that uses the hint to avoid having to consider all metadata entries of a child or parent when performing storage accounting analysis.

[0020] The system maintains statistics related to usage of storage for a base volume and a set of snapshots associated with the base volume based on data stored by the base volume and the set of snapshots. Statistics are computed based on metadata associated with the base volume and the snapshots. In some examples, the metadata includes a reference table (which is an example of a conversion table or an exception table). The reference table contains a plurality of entries, where an entry can include a valid reference or an invalid reference.

[0021] For a reference table of a base volume or snapshot, an entry in the reference table containing a valid reference indicates that a corresponding data page exists in the base volume or snapshot associated with the reference table. A reference table entry contains a valid reference if the reference table entry contains mapping information that maps between different storage address spaces, such as between a logical or virtual storage address space that includes logical storage addresses and a physical storage address space that includes physical storage addresses. For example, a reference table entry can contain mapping information that maps a virtual or logical storage address of a data page to a corresponding physical storage address in a storage system where the data page is stored. A reference table entry containing an invalid reference (i.e., a reference table entry that does not include mapping information) indicates that the corresponding data page is empty in the associated base volume or snapshot, or that the data page can be referenced by a reference table of a snapshot of an earlier point in time.

[0022] A“storage address” can refer to information that identifies a data storage location. A physical storage address refers to a physical storage location of data in a storage system. A logical storage address (also referred to as a virtual storage address) refers to a storage address used by machine-readable instructions of a system, such as a storage address used by an operating system (OS) or an application program.

[0023] In an example, in response to a read request for a base volume, the system queries a corresponding entry of the reference table of the base volume to determine whether the corresponding entry contains a valid reference or an invalid reference. If the corresponding entry contains a valid reference, the system retrieves the corresponding data page from the base volume for the read request. However, if the corresponding entry contains an invalid reference, the system queries a corresponding entry of a snapshot reference table associated with a latest snapshot to determine whether the corresponding snapshot reference table entry contains a valid reference. If so, the system retrieves the corresponding data page from the latest snapshot for the read request. If the corresponding snapshot reference table entry contains an invalid reference, the system queries a snapshot reference table of a second latest snapshot. This process continues to query reference tables of increasingly older snapshots until a valid reference is found, or until an invalid reference of an earliest snapshot is found.

[0024] In other examples, a read request can be for a snapshot. A read request for a snapshot is a request to read data of the snapshot. In response to such a read request, the system queries a corresponding entry of the snapshot reference table to determine whether a valid reference exists, and if not, can progressively query reference tables of snapshots created earlier.

[0025] The system checks the metadata (e.g., the reference table) of a given snapshot to determine the validity of the references in the metadata and the existence of any children of the given snapshot or ancestors of the given snapshot. An ancestor of a snapshot refers to the immediate parent of the immediate parent of the snapshot. The immediate parent of a snapshot is a parent that does not have an intermediate snapshot between the parent and the snapshot. Similarly, a direct child of a snapshot is a child that does not have an intermediate snapshot between the snapshot and the child. If at least one later snapshot of the same base volume was taken at a later point in time than the given snapshot, then an ancestor of the given snapshot will exist (if there is only one later snapshot, then the ancestor is the base volume). The system, based on the validity of the references in the metadata of the given snapshot and the existence of any children or ancestors, will prompt the metadata entry of the parent of the given snapshot to indicate that the corresponding metadata entry of the child or ancestor is to be checked to determine the storage space used exclusively by the given snapshot. Using the prompt, the system can perform a background process to determine the amount of storage space used exclusively by the given snapshot. A "background process" can refer to a process that can be initiated independently of data operations involving the base volume and / or the set of snapshots associated with the base volume. The background process can be performed at any time during or after the data operations, such as during periods of lower system resource usage (e.g., below a resource usage threshold).

[0026] Storage accounting can be used for various purposes. For example, the system can track the usage of storage space by the base volume and / or the snapshots. The system (or an administrator) can use the output of the storage accounting to determine how much space can be reclaimed if any given snapshot is to be deleted. Further, the system (or an administrator) can use the output of the storage accounting to decide whether to migrate the base volume or the snapshots from one location to another.

[0027] Figure 1 is a block diagram of an example arrangement including a storage system 102 that includes a storage accounting engine 104, in accordance with some embodiments of the present disclosure. Although Figure 1 The storage accounting engine 104 is shown as being in the storage system 102, but in other examples, the storage accounting engine 104 can be external to the storage system 102.

[0028] As used herein, an "engine" can refer to one or more hardware processing circuits, which can include any one or some combination of a microprocessor, a core of a multi-core microprocessor, a microcontroller, a programmable integrated circuit, a programmable gate array, or other hardware processing circuit. Alternatively, an "engine" can refer to a combination of one or more hardware processing circuits and machine-readable instructions (software and / or firmware) that are executable on the one or more hardware processing circuits. An engine can be part of a computer or arrangement of computers.

[0029] As discussed herein, storage space accounting engine 104 performs storage space accounting on snapshots. Storage space accounting can be based on metadata of the base volume stored in storage system 102 and the associated snapshot (a snapshot created from the base volume).

[0030] The metadata for the base volume and associated snapshots may include a reference table. The reference table may also be referred to as an exception table. A reference table consists of multiple entries. If a corresponding data page exists in the base volume or snapshot associated with the reference table, the reference table entry contains a valid reference. If the corresponding data page in the base volume or snapshot associated with the reference table is empty, or if the corresponding data page is referenced by the reference table of an earlier snapshot, the reference table entry does not contain a valid reference. In the following discussion, reference table entries that do not contain valid references are referred to as containing invalid references.

[0031] Storage system 102 includes storage medium 106, which can be implemented using a collection of storage devices. Examples of storage devices include any one or a combination of the following: disk-based storage devices, solid-state drives, etc.

[0032] Storage medium 106 stores a base volume 108 and a snapshot set 110 associated with the base volume 108. Snapshot set 110 includes snapshot 1 created at a first time point, snapshot 2 created at a second time point later than the first time point, and snapshot 3 created at a third time point later than the second time point. Snapshot set 110 forms a tree of snapshots created at increasingly earlier times (when...). Figure 1 (When viewed from left to right). Figure 1 In the example, three snapshots have been created directly or indirectly from base volume 108. In other examples, fewer or more than three snapshots can be created from base volume 108. Snapshots can be indirectly created from base volume 108 by taking a read-write snapshot of the base volume and then taking a read-only snapshot of that read-write snapshot. A read-write snapshot is a snapshot that can be read or written to. A read-only snapshot is a snapshot that can be read but not written to. In some examples, it is assumed that snapshots 1, 2, and 3 are read-only snapshots.

[0033] although Figure 1 An example is shown where only one basic volume is stored in storage medium 106, but in other examples, storage medium 106 may contain multiple basic volumes and associated collections of snapshots.

[0034] As described above, a given snapshot of a base volume at a given point in time can have a "parent," which can refer to a later snapshot or the base volume itself. When a base volume exists for a snapshot at a later point in time than the given point in time, a subsequent snapshot immediately following the given snapshot is the parent of the given snapshot. When no snapshot exists at a later point in time than the given point in time, the base volume is the parent of the given snapshot. In some cases, a given snapshot of a base volume at a given point in time can have a "child" snapshot. When a base volume exists for a snapshot at an earlier point in time than the given point in time, a previous snapshot immediately preceding the given snapshot is the child of the given snapshot. A snapshot immediately preceding a child snapshot of a given snapshot can be referred to herein as a "grandchild" of the given snapshot. For example, snapshot 3 has a parent of base volume 108 and a child of snapshot 2. Snapshot 1 is a child of snapshot 2 and a grandchild of snapshot 3 (a child of a child of snapshot 1). Snapshot 2 has a parent of snapshot 3 and a child of snapshot 1. Base volume 108 is a grandparent of snapshot 2. Snapshot 1 has a parent of snapshot 2 and no children (as there are no snapshots created earlier than snapshot 1).

[0035] As used herein, a "parent" can refer to a direct parent of a snapshot or an indirect parent, such as a "grandparent" (i.e., a parent of a parent). In the example above, a parent of snapshot 2 can refer to either snapshot 3 (a direct parent) or base volume 108 (a grandparent of snapshot 2). Similarly, a parent of snapshot 1 can include any of snapshot 2 (a direct parent), snapshot 3 (a grandparent), or base volume 108 (a great-grandparent). In other words, a parent of a given snapshot can refer to a base volume or any snapshot created later than the given snapshot. Figure 1

[0036] A "child" of a base volume can refer to any snapshot of the base volume. A "child" of a given snapshot can refer to a direct child snapshot or any indirect child snapshot created at an earlier point in time than the given volume. For example, a child of base volume 108 can refer to snapshot 3 (a direct child), snapshot 2 (a grandchild), or snapshot 3 (a great-grandchild). A child snapshot of snapshot 3 can refer to either of snapshots 2 and 1.

[0037] Each of base volume 108 and snapshots 1-3 stored in storage medium 106 can be associated with metadata in the form of a reference table stored in memory 112 of storage system 102. Memory 112 can be implemented using a collection of storage devices including any or some combination of dynamic random access memory (DRAM) devices, static random access memory (SRAM) devices, flash memory devices, and the like.

[0038] ​Storage system 102 also includes a snapshot engine 114 that manages the creation of snapshots of base volumes (such as base volume 108). Snapshot engine 114 can take snapshots of base volume 108 in response to events, such as write events that would overwrite existing data on base volume 108. In other examples, snapshot engine 114 can take snapshots in response to another event, such as a time-based event where snapshot engine 114 takes a snapshot at a predetermined time.

[0039] exist Figure 1 In this example, base volume reference table 116 is associated with base volume 108, snapshot 1 reference table 118-1 is associated with snapshot 1, snapshot 2 reference table 118-2 is associated with snapshot 2, and snapshot 3 reference table 118-3 is associated with snapshot 3. Reference tables 116 and 118-1 to 118-3 are stored in memory 112, and these reference tables are maintained by reference table maintenance engine 120. In some examples, reference table maintenance engine 120 may be part of or separate from snapshot engine 114.

[0040] although Figure 1 Reference tables 116 and 118-1 to 118-3 that coexist in memory 112 are shown. However, note that during operation, fewer than all of reference tables 116 and 118-1 to 118-3 may coexist in memory 112 at the same time (for example, some reference tables will not be added to memory 112 until one or more reference tables in memory 112 are removed).

[0041] The reference table maintenance engine 120 adds a reference to the reference table entry of the base volume or snapshot in response to writing the corresponding data page to the base volume (or writing a read-write snapshot). A reference added to a reference table entry is called a "valid reference". If no reference has been added to a reference table entry (i.e., the corresponding data page has not yet been written to the base volume or snapshot), the reference table entry has an "invalid reference".

[0042] The memory 112 also stores statistics 122 related to the use of storage space on the storage medium 106 by each of the base volume 108 and snapshots 1 to 3. The statistics 122 are maintained by a storage space accounting engine 104, which updates the statistics 122 when snapshots are created and deleted, and when writes are made to the base volume or any read / write snapshot. The following is in conjunction with... Figures 2A-2G Figure 3 Figures 4A-4B and Figures 5A-5B Discuss an example of statistic 122.

[0043] As used herein, a "deleted snapshot" can refer to a snapshot that has been deleted, a snapshot that is being deleted, or a snapshot that is the subject of a deletion request. A "deletion" of a snapshot can refer to a completed deletion, an ongoing deletion, a requested deletion, or a deletion under consideration.

[0044] Figure 2A An example of a basic volume reference table (RT) 116 associated with a basic volume 108 of Figure 1 In the examples discussed herein, each reference table is shown as having 12 entries (entries 0-11) corresponding to 12 data pages in the corresponding basic volume or snapshot for simplicity of illustration. In other examples, the reference tables can include a different number of entries (e.g., more entries). The basic volume reference table 116 has entries 202-0 through 202-11.

[0045] Figure 2A Further depicted are statistics 203 related to the used storage space of the basic volume 108. In the example of Figure 2A The statistics 203 take the form of a count of used pages, referred to as a "used page count," which indicates the amount of storage space in the basic volume 108 consumed by the specified count of used pages. In the example of Figure 2A The used page count is 8, which indicates that the basic volume has consumed storage space corresponding to 8 data pages. As data pages are written to the basic volume 108, the storage accounting engine 104 updates the statistics 203.

[0046] In other examples, different statistics can be employed, such as statistics specifying the amount of consumed storage space (e.g., expressed in megabits, gigabits, terabits, etc.).

[0047] The basic volume reference table entries 202-0, 202-2, 202-3, 202-4, 202-5, 202-8, 202-9, and 202-11 (shaded) contain valid references, while the basic volume reference table entries 202-1, 202-6, 202-7, and 202-10 (unshaded) contain invalid references (i.e., the corresponding pages are empty). As corresponding data pages are written to the basic volume 108, Figure 1 The reference table maintenance engine 120 adds references to the entries of the basic volume reference table 116.

[0048] Figure 2B An example of a snapshot 110 taken of the basic volume 108 is shown in FIG. 2B. The snapshot 110 is taken at a point in time when the basic volume 108 contains data pages as illustrated in Figure 2A Figure 1 ​of snapshot 1. In response to the creation of snapshot 1, the reference table maintenance engine 120 causes the base volume reference table 116 to be empty (i.e., all invalid entries) and provides the snapshot 1 with a reference table 118-1 that contains the previous contents of the base volume reference table 116 (as shown in Figure 2A FIG. 1 IB). The snapshot 1 reference table 118-1 includes entries 204-0 through 204-11, which are respectively equivalent to entries 202-0 through 202-11 of Figure 2A FIG. 1 IA. In some examples, the reference table maintenance engine 120 can first create an empty (all invalid) reference table for snapshot 1, and then swap the empty reference table for snapshot 1 with the base volume reference table 116 as shown in Figure 2A FIG. 1 IB to arrive at the configuration shown in Figure 2B FIG. 1 IB. In other examples, the reference table maintenance engine 120 can use any other suitable technique (such as by copying the reference table 116 to create the reference table 118-1, etc.) to arrive at the configuration of the reference tables 116 and 118-1 as shown in Figure 2B FIG. 1 IB. Although the configuration of the reference tables can be arrived at by swapping, for ease of understanding, each reference table will maintain its own unique numbering (i.e., the base volume reference table 116 will maintain entries 202-0 through 202-11, and the snapshot 1 reference table 118-1 entries are labeled 204-0 through 204-11, although they can be derived from entries 202-0 through 202-11).

[0049] The snapshot 1 reference table 118-1 is equivalent to the base volume reference table 116 as shown in Figure 2A FIG. 1 IA prior to the creation of snapshot 1. Snapshot 1 reference table entries 204-0, 204-2, 204-3, 204-4, 204-5, 204-8, 204-9, and 204-11 (hatched) contain valid references, while snapshot 1 reference table entries 204-1, 204-6, 204-7, and 204-10 (non-hatched) contain invalid references.

[0050] After the creation of snapshot 1, the entries of the base volume reference table 116 are all invalid references (depicted as non-hatched in Figure 2B FIG. 1 IB). After the creation of snapshot 1, a lookup operation for the base volume 108 (e.g., in response to a read for the base volume 108) will find that each entry of the base volume reference table 116 contains an invalid reference, and in response, the lookup operation will access the snapshot 1 reference table 118-1 to determine whether the requested data page is referenced by a valid entry in the reference table for snapshot 1.

[0051] Figure 2BStatistics 205 associated with base volume 108 and snapshot 1 updated by storage space accounting engine 104 are depicted. The used page count for base volume 108 remains at 8, while the used page count for snapshot 1 is 0. Note that the used page count for base volume 108 does not become zero simply because snapshot 1 was created and the entries of base volume reference table 116 are invalid. After snapshot 1 is created, base volume 108 and snapshot 1 share the storage space consumed by the data pages referenced in snapshot 1 (the data pages corresponding to snapshot 1 reference table entries 204-0, 204-2, 204-3, 204-4, 204-5, 204-8, 204-9, and 204-11).

[0052] The used page count for base volume 108 includes data pages (and the storage space consumed by those pages) that are uniquely owned by base volume 108 and data pages (and the storage space consumed by those pages) that are shared by any combination of base volume 108 and snapshots in the branches of base volume, regardless of whether base volume 108 itself shares those pages. Figure 2E An example of the used page count for base volume 108 is depicted in FIG. 2B, including pages that are shared among snapshots but not shared with base volume 108.

[0053] A snapshot can be a read-only snapshot or a read-write snapshot. The parent of a read-write snapshot is a read-only snapshot. The collection of a base volume and all of its snapshots is referred to as a volume tree. A "branch" of a volume tree includes a base volume or a read-write snapshot, and all read-only snapshots created from that base volume or read-write snapshot.

[0054] The used page count for a read-only snapshot represents the storage space that is uniquely consumed by the read-only snapshot. On the other hand, the used page count for a base volume or a read-write snapshot represents the storage space that is uniquely consumed by the base volume or read-write snapshot and any storage space consumed by shared pages in the branches of the base volume or read-write snapshot. The storage space consumed by shared pages can be referred to herein as "shared storage space."

[0055] Figure 2C An example is depicted in which several writes to base volume 108 after snapshot 1 is created result in base volume 108 uniquely owning new data pages (i.e., such new data pages are not shared with any snapshot). In this example, new pages 1, 4, 7, and 8 are written to base volume 108. Figure 2C In the example of FIG. 2D, reference table maintenance engine 120 adds valid references to the new data pages to shadow entries 202-1, 202-4, 202-7, and 202-8 of base volume reference table 116.

[0056] Figure 2C Entries 202-1, 202-4, 202-7, and 202-8 of base volume reference table 116 in FIG. 2D indicate that new pages 1, 4, 7, and 8 have been written to base volume 108. New pages 4 and 8 of base volume 108 correspond to data pages that are shared with snapshot 1 (the data pages corresponding to snapshot 1 reference table entries 204-0, 204-2, 204-3, 204-4, 204-5, 204-8, 204-9, and 204-11). Figure 2CSnapshot 1 in Figure 1 references table entries 204-4 and 204-8, which reference pages 4 and 8 of Snapshot 1. Since new pages 4 and 8 are written to base volume 108, pages 4 and 8 of Snapshot 1 contain data that is now unique to Snapshot 1, and thus occupy storage space that is consumed exclusively by Snapshot 1. Figure 2C Snapshot 1 in Figure 1 references table entries 204-4 and 204-8, which are depicted with thicker borders to indicate that these entries reference data pages that are unique to Snapshot 1. In the figure, any reference table entry shown with a thicker border indicates that the reference table entry references a data page that is unique to the corresponding snapshot.

[0057] In Figure 2C In Figure 1, in response to writing four new pages (1, 4, 7, and 8) to base volume 108, storage accounting engine 104 generates updated statistics 206 after each new page is written to base volume 108.

[0058] Storage accounting engine 104 can determine whether a new page write to base volume 108 constitutes an overwrite as follows. When a new page is written to base volume 108, storage accounting engine 104 determines whether Snapshot 1 reference table 118-1 (which has been added to memory 112) contains a valid reference in the entry for the same page in reference table 118-1. If the corresponding entry of Snapshot 1 reference table 118-1 contains a valid reference, then the new page write to base volume 108 is an overwrite, which results in Snapshot 1 exclusively owning the corresponding data page referenced by the corresponding entry in reference table 118-1.

[0059] More generally, a rule for determining whether a new write is an overwrite (i.e., an "overwrite determination rule") can be as follows: in response to writing a new page to a parent (e.g., a base volume or a read-write snapshot), check the corresponding entry for the same page in a child snapshot's reference table; if the corresponding entry contains a valid reference, then the write of the new page is an overwrite.

[0060] Each time a new base volume page is written, the update to statistics 206 is as follows:

[0061]

[0062]

[0063] The data pages of a snapshot can be indicated as shared or unique in the corresponding snapshot reference table entry. For example, snapshot 1 reference table entries 204-4 and 204-8 can each include a unique indicator specifying that pages 4 and 8 in snapshot 1 are owned exclusively by snapshot 1. On the other hand, snapshot 1 reference table entries 204-0, 204-2, 204-3, 204-5, 204-9, and 204-11 can each include a shared indicator specifying that pages 0, 2, 3, 5, 9, and 11 are shared (in this case, with base volume 108).

[0064] Figure 2D An example of taking snapshot 2 of base volume 108 at a second point in time after the first point in time of snapshot 1 is illustrated. At the time snapshot 2 is created, base volume 108 contains the data pages indicated by the valid references in base volume reference table 116 entries 202-1, 202-4, 202-7, and 202-8, as shown. In response to the creation of snapshot 2, reference table maintenance engine 120 creates snapshot 2 reference table 118-2 for snapshot 1 and configures reference table 116 to again contain an invalid reference in each entry (as described above with respect to the example of Figure 2C Figure 2C

[0065] The snapshot 2 reference table 118-2 created is equivalent to base volume reference table 116 shown in Figure 2C prior to the creation of snapshot 2. Snapshot 2 reference table 118-2 entries 208-1, 208-4, 208-7, and 208-8 (shaded) contain valid references, while the remaining snapshot 2 reference table entries (unshaded) contain invalid references.

[0066] After the creation of snapshot 2, the entries of base volume reference table 116 are invalid references (depicted as unshaded in Figure 2D After the creation of snapshot 2, a lookup operation on base volume 108 (e.g., in response to a read on base volume 108) will find that each entry of base volume reference table 116 contains an invalid reference, and in response, for each requested page, the lookup operation will access snapshot 2 reference table 118-2 to determine if the requested data page is referenced by a valid reference in snapshot 2, and if not, the lookup operation will access snapshot 1 reference table 118-1 to determine if the requested data page is referenced by a valid reference in snapshot 1.

[0067] Figure 2D Statistics 209 associated with base volume 108, snapshot 1, and snapshot 2 computed by storage space accounting engine 104 are depicted. The used page count for base volume 108 remains at 10, the used page count for snapshot 1 remains at 2, and the used page count for snapshot 2 is 0. ​​

[0068] After snapshot 2 is created, Figure 2E An example is depicted in which several writes to base volume 108 result in writing new data pages (0, 7, 8, 9, 10, and 11) to base volume 108 that are uniquely owned by base volume 108. The new data pages are associated with valid references in shadow entries 202-0, 202-7, 202-8, 202-9, 202-10, and 202-11 of base volume reference table 116 added to snapshot 2 reference table 118-2 by reference table maintenance engine 120. Figure 2E

[0069] New pages 7 and 8 of base volume 108 correspond to pages 7 and 8 of snapshot 2 that are associated with valid references in snapshot 2 reference table entries 208-7 and 208-8 in snapshot 2 reference table 118-2. Since new pages 7 and 8 are written to base volume 108 (the writes of new pages 7 and 8 are overwrites), pages 7 and 8 of snapshot 2 contain data unique to snapshot 2 and thus occupy storage space consumed exclusively by snapshot 2. Figure 2E Snapshot 2 reference table entries 208-7 and 208-8 in snapshot 2 reference table 118-2 are depicted with thicker borders to indicate that these entries reference data pages that are uniquely owned by snapshot 2. Figure 2E

[0070] In Figure 2E response to the five new pages (0, 7, 8, 9, 10, and 11) being written to base volume 108, storage accounting engine 104 produces updated statistics 210 after each new page is written to base volume 108.

[0071] Storage accounting engine 104 can determine whether a new page written to base volume 108 constitutes an overwrite as follows. For a new page written to base volume 108, storage accounting engine 104 accesses snapshot 2 reference table 118-2 (which has been added to memory 112) to determine whether the corresponding entry of snapshot 2 reference table 118-2 contains a valid reference. If the corresponding entry of snapshot 2 reference table 118-2 contains a valid reference, then the new page written to base volume 108 is an overwrite, which results in the corresponding data page in snapshot 2 being uniquely owned by snapshot 2.

[0072] Figure 2E The update to statistics 210 is shown for each new write to a base volume page as follows:

[0073]

[0074]

[0075] Note that in Figure 2E snapshot 1 statistics do not change as a result of new pages 0 and 7 through 11 being written to base volume 108.

[0076] ​​It should also be noted that pages 0, 9, and 11 of snapshot 1 (with valid references to these pages contained in snapshot 1 reference table entries 204-0, 204-9, and 204-11) are considered to be shared with base volume 108 (and are therefore taken into account in the used page count of base volume 108), even though base volume 108 does not reference pages 0, 9, and 11 of snapshot 1.

[0077] Deletion with snapshot handling of children

[0078] exist Figure 2E After writing a new page to base volume 108 as shown, Figure 2F The operation of deleting (in 212) snapshot 2 is shown. Note that the operation of deleting a snapshot can refer to a deletion operation that has started and is in progress, or a deletion operation that has been requested or planned. Figure 2F Statistics 213 associated with base volume 108, snapshot 1, and snapshot 2 are depicted when snapshot 2 is deleted (note that the storage space accounting engine 104 has not yet executed a background process to update statistics 213 because snapshot 2 was deleted). Therefore, the used page count of base volume 108 remains at 14, the used page count of snapshot 1 remains at 2, and the used page count of snapshot 2 remains at 2.

[0079] When a read-only snapshot (such as snapshot 2) is deleted, the reference table entries for the shared pages of the deleted snapshot (e.g., pages 1 and 4 of snapshot 2) are merged into the corresponding entries in the parent's reference table that contain invalid references (e.g., entries 202-1 and 202-4 of base volume 108). In such an example, the reference table entries for the shared pages of the deleted snapshot are not removed due to the deletion of the deleted snapshot, but are retained in the volume tree that includes the base volume and any snapshots of the base volume.

[0080] Note that deleting snapshot 2 may cause previously shared pages to become unique. To correctly adjust the used page count, up to three reference tables (such as in...) will need to be compared. Figure 2F In the example, there is a base volume 108 and two associated snapshots 1 and 2. If more snapshots are created, more reference tables will have to be compared. Performing an update of the used page count in conjunction with the deletion operation of snapshot 2 may be impractical, as the deletion operation may be delayed if there are a large number of entries to compare. According to some embodiments of this disclosure, the storage space accounting engine 104 invokes a background process to perform an update of the used page count in response to the deletion of snapshot 2. Note that "deletion" of a snapshot can refer to removing the snapshot so that it is no longer in use, or moving the snapshot from one location to another (e.g., migrating the snapshot from one storage system to another).

[0081] The storage space accounting engine 104 associates hints with the reference table entries of the parent for use by the background process in updating the statistics. The hints are used to indicate which other reference tables the background process is to check in updating the statistics in response to the snapshot deletion. The hints can be in the form of flags or any other type of indicator.

[0082] During the deletion of snapshot 2, the snapshot 2 reference table 118-2 and the reference table of the parent of snapshot 2 (which in the example at issue is the base volume reference table 116) are loaded into memory 112, and the storage space accounting engine 104 compares the entries of the snapshot 2 reference table 118-2 to the entries of the base volume reference table 116. Based on the comparison of the entries of the snapshot 2 reference table 118-2 to the entries of the base volume reference table 116, the storage space accounting engine 104, if authorized, adds a flag to the entries of the reference table of the parent (which in this example is the base volume reference table 116) to indicate that additional checks are to be performed by the storage space accounting background process.

[0083] The flags include a CHK_SHARED_CHILD flag and a CHK_SHARED_PARENT flag. A flag can be set (e.g., to a first value) to indicate that a check is to be performed on the corresponding reference table entry, and the flag can be cleared (e.g., to a second value) to indicate that a check need not be performed on the corresponding reference table entry. The CHK_SHARED_CHILD flag, when set, indicates that a reference table entry of a child of the deleted snapshot is to be checked, while the CHK_SHARED_PARENT flag, when set, indicates that a reference table entry of an ancestor of the deleted snapshot is to be checked.

[0084] The storage space accounting engine 104 controls the state of the CHK_SHARED_PARENT flag and CHK_SHARED_CHILD as follows. If the reference table entry of the deleted snapshot includes a valid reference (to a corresponding page of the deleted snapshot), the storage space accounting engine 104 will check the corresponding entry of the reference table of the parent of the deleted snapshot. If the corresponding entry of the reference table of the parent is valid, the storage space occupied by the corresponding page of the deleted snapshot is released (because the corresponding page of the deleted snapshot is owned exclusively by the deleted snapshot), and the flag will not be set.

[0085] If the given entry of the reference table of the deleted snapshot includes an invalid reference, and the corresponding entry of the reference table of the parent of the deleted snapshot includes a valid reference, it indicates that there can be shared storage space between the deleted snapshot and a child snapshot of the deleted snapshot (if a child snapshot exists). If the deleted snapshot has a child snapshot, the storage space accounting engine 104 will set the CHK_SHARED_CHILD flag in the entry of the reference table of the parent corresponding to the given entry of the deleted snapshot.

[0086] If the given entry of the reference table of the deleted snapshot includes a valid reference, and if the corresponding entry of the reference table of the parent is invalid, the storage accounting engine 104 will check if the deleted snapshot has an ancestor. If so, the storage accounting engine 104 will merge the given entry of the reference table of the deleted snapshot with the parent snapshot reference table entry, and the storage accounting engine 104 will set the CHK_SHARED_PARENT flag in the parent snapshot reference table entry. A check based on the CHK_SHARED_PARENT flag is performed because storage that was previously shared and thus accounted for by the base volume can now be unique to the parent of the deleted snapshot.

[0087] The storage accounting engine 104 also maintains two counters for each base volume or parent snapshot that has had the CHK_SHARED_CHILD flag and the CHK_SHARED_PARENT flag set. The CC counter (124 in FIG. 1) is incremented each time the CHK_SHARED_CHILD flag is set in an entry of the reference table of the parent, and the CP counter (126 in FIG. 1) is incremented each time the CHK_SHARED_PARENT is set in an entry of the reference table of the parent. The CC counter indicates how many reference table entries of the child to check (still pending resolution) to update statistics, and the CP counter indicates how many reference entries of the parent to check (still pending resolution) to update statistics. Note that multiple instances of the CC counter and the CP counter can be associated with multiple corresponding base volumes or parent snapshot reference tables that have had the CHK_SHARED_CHILD flag and the CHK_SHARED_PARENT flag set. Figure 1 Figure 1 The storage accounting engine 104 schedules a background process to process entries of the reference table of the parent that have the CHK_SHARED_CHILD flag or the CHK_PARENT_CHILD flag set. For example, the storage accounting engine 104 can add a representation of the background process to be processed on the reference table of the parent to a scheduling queue. Upon startup, the background process loads the reference table of the parent and the reference table of the ancestor or child into memory to determine statistics to update.

[0088] The background process invoked by the storage accounting engine 104 processes any set flags as follows.

[0089] The background process invoked by the storage accounting engine 104 processes any set flags as follows.

[0090] ​For each entry of the reference table of the parent that is set with the CHK_SHARED_CHILD flag, the background process checks whether the corresponding reference table entry of the child of the deleted snapshot has a valid reference, which indicates that the deleted snapshot shares the corresponding page with the child snapshot. Based on the corresponding reference table entry of the child of the deleted snapshot having a valid reference, the background process determines that the corresponding page is no longer shared, and the used page count of the base volume (or the parent read-write snapshot) is decremented and the used page count of the child snapshot is incremented. The CHK_SHARED_CHILD flag in the entry of the reference table of the parent is cleared, and the CC counter is decremented after the foregoing processing.

[0091] For each entry of the reference table of the parent that is set with the CHK_SHARED_PARENT, the background process checks whether the data page referenced by the entry of the reference table of the parent is unique to the parent snapshot. If the corresponding ancestor reference table entry has a valid reference, the data page referenced by the entry of the reference table of the parent is unique to the parent snapshot. The ancestor can be the base volume or the parent read-write snapshot. In this case, the used page count of the base volume (or the parent read-write snapshot) is decremented and the used page count of the parent snapshot is incremented. The CHK_SHARED_PARENT flag in the entry of the reference table of the parent is cleared, and the CP counter is decremented after the foregoing processing.

[0092] Reference is made to Figure 2F The following describes an example of how the storage space accounting engine 104 controls whether to set the flag (more specifically, the CHK_SHARED_CHILD flag) for the corresponding entry of the parent of the deleted snapshot 2. Due to the deletion of the snapshot 2, the snapshot 2 reference table 118-2 and the base volume reference table 116 (the parent of the snapshot 2) are loaded into the memory 112. The storage space accounting engine 104 can determine whether the deleted snapshot 2 has a child or an ancestor (based on the metadata indicating the existence of the snapshot of the base volume 108). However, the reference table of any child or ancestor of the deleted snapshot 2 has not yet been loaded into the memory 112 and is therefore not available to the storage space accounting engine 104.

[0093]

[0094]

[0095]

[0096] When the storage space accounting engine 104 sets the CHK_SHARED_CHILD flag in each entry of the base volume reference table 116, the storage space accounting engine 104 increments the CC counter of the base volume reference table 116. Since the CHK_SHARED_CHILD flag is set in each entry of the base volume reference table 116, the CC counter of the base volume reference table 116 is incremented by one. Figure 2FThe CC counter is incremented to four (as shown in 304) to indicate the number of child reference table entries to be checked in the background process. Since no CHK_SHARED_PARENT flag is set in any reference table entry, the CP counter remains at zero (also shown in 304). Figure 2F Figure 2F

[0097] The following describes the background process using the CHK_SHARED_CHILD flag set in the four entries of the base volume reference table 116 in 304. The background process has loaded into memory 112 the reference table of the child of the snapshot to be deleted (snapshot 2 reference table 118-2). Figure 2F The background process determines whether the shared space between snapshots has become storage space that is uniquely consumed by one snapshot as a result of the deletion of a different snapshot.

[0098]

[0099]

[0100] Once the CC counter reaches zero, the background process is complete (note that the CP counter is zero). The updated statistics for the base volume 108 and snapshot 1 are reflected in the statistics 214 shown in 306.

[0101] Figure 2G

[0102] Deletion with snapshot handling of ancestors and children

[0103] Figure 3A A read-write (RW) snapshot A is created based on the base volume, and a corresponding read-write (RW) snapshot A reference table 302 is created for the read-write snapshot A. In addition, snapshot 3 is a read-only snapshot created based on the read-write snapshot A. Snapshot 3 reference table 118-3 is associated with snapshot 3.

[0104] Starting from the state shown in 304, assume that an operation to delete snapshot 2 is performed. Since there is an intermediate snapshot 3 between the snapshot to be deleted (snapshot 2) and the base volume 108, the base volume 108 is the ancestor of the snapshot to be deleted (snapshot 2). Figure 3A The statistics 306 shown include the used page counts for the base volume 108, snapshot 1, snapshot 2, snapshot 3, and RW snapshot A. In 306, the base volume reference table 116 has entries 204-4 to 204-8 with valid references (shaded). Figure 3A Figure 3A Figure 3A ​​​​​​The remaining entries (without shading) in the basic volume reference table 116 have invalid references.

[0105] In response to the deletion of snapshot 2, reference tables 118-2 for snapshot 2 and 118-3 for snapshot 3 are loaded into memory 112. The following describes how the storage space accounting engine 104 controls whether flags are set for the corresponding entries in the parent of the deleted snapshot 2. Figure 3A In the example, snapshot 2's parent is snapshot 3.

[0106]

[0107]

[0108] exist Figure 3A In the example, the CHK_SHARED_CHILD flag is set in four snapshot 3 reference table entries, so the CC counter increments to 4. The CHK_SHARED_PARENT flag is set in two snapshot 3 reference table entries, so the CP counter is set to 2.

[0109] If a background process is invoked after the flag is set, the update of statistics for reference table entries with the CHK_SHARED_CHILD flag set is similar to the combination described above. Figure 2F and Figure 2G The subject of discussion.

[0110] To process Snapshot 3 reference table entry 310-1 with the CHK_SHARED_PARENT flag set, a background process checks whether the data page referenced by Snapshot 3 reference table entry 310-1 is specific to Snapshot 3. If the corresponding ancestor reference table entry (in this example, base volume reference table entry 202-1) has a valid reference, then the data page referenced by Snapshot 3 reference table entry 310-1 is specific to Snapshot 3. Figure 3A In the example, the background process determines that the data page referenced by snapshot 3 reference table entry 310-1 is not specific to snapshot 3 (i.e., it is shared) because the corresponding base volume reference table entry 202-1 has an invalid reference. Therefore, the background process does not update the statistics. After this determination, the background process decrements the CP counter from 2 to 1.

[0111] To process Snapshot 3 reference table entry 310-4 with the CHK_SHARED_PARENT flag set, a background process checks whether the data page referenced by Snapshot 3 reference table entry 310-4 is specific to Snapshot 3. If the corresponding ancestor reference table entry (in this example, base volume reference table entry 202-4) has a valid reference, then the data page referenced by Snapshot 3 reference table entry 310-4 is specific to Snapshot 3. Figure 3AIn the example of snapshot 3, the background process determines that the data page referenced by snapshot 3 reference table entry 310-4 is unique to snapshot 3 (i.e., it is not shared) because the corresponding base volume reference table entry 202-4 has a valid reference. Accordingly, the background process decrements the used page count of base volume 108 (the ancestor of deleted snapshot 2) and increments the used page count of snapshot 3 (the parent of deleted snapshot 2). After this determination, the background process decrements the CP counter from 1 to 0, which indicates that all parent reference table entries with the CHK_SHARED_PARENT flag set have been processed.

[0112] Special handling

[0113] There are various scenarios in which special processing of the storage space accounting engine 104 can be triggered, in which space accounting can be performed at the time of operations on snapshots, thereby reducing the amount of work to be performed by the background process.

[0114] Scenario 1. If an I / O operation is performed on a page of a parent snapshot or base volume associated with a reference table entry with the CHK_SHARED_CHILD flag set, the storage space accounting engine 104 can examine the entry of the child's reference table and adjust statistics based on that entry of the child's reference table. Based on this processing, the storage space accounting engine 104 can clear the CHK_SHARED_CHILD flag in the reference table entry and decrement the CC counter.

[0115] Scenario 2. When merging reference table entries of two reference tables during snapshot deletion, if the parent's reference table entry already has the CHK_SHARED_CHILD set and the corresponding reference table entry of the deleted snapshot has a valid reference, the used page count of the base volume (or another parent read-write volume) can be decremented. Note that because the used page count of the base volume (or another parent read-write volume) is updated during snapshot deletion, the used page count of the child snapshot does not have to be updated (as would be the case if the update were performed by the background process).Based on this processing, the storage space accounting engine 104 can clear the CHK_SHARED_CHILD flag and decrement the CC counter. Figure 2G

[0116] Scenario 3. When merging reference table entries of two reference tables during snapshot deletion, if the reference table entry of the deleted snapshot already has the CHK_SHARED_PARENT flag set and both the reference table entry of the deleted snapshot and the reference table entry of the parent of the deleted snapshot include a valid reference, the storage space accounting engine 104 decrements the used page count of the ancestor base volume (or read-write snapshot).

[0117] Scenario 2 special handling example

[0118] Figure 2F and Figure 2G Involves an example in which the CHK_CHILD_PARENT flag has been set in the corresponding entry of the base volume reference table 116 after which the background process to update the statistics is initiated by the storage accounting engine 104. In a different example, snapshot 2 and snapshot 1 can both be deleted before the background process begins.

[0119] Figure 4A The state of the base volume reference table 116 and the snapshot 1 reference table 118-1 after the deletion of snapshot 2 is shown. Note that because the background process has not yet been invoked by the storage accounting engine 104, the statistics 404 for the base volume and snapshot 1 shown are not yet updated (they are the same as the statistics 213 for the base volume and snapshot 1 depicted in Figure 4A Figure 2F The statistics 404 for the base volume and snapshot 1 shown are not yet updated (they are the same as the statistics 213 for the base volume and snapshot 1 depicted in

[0120] The operation to delete snapshot 1 (at 402) is performed before the background process is invoked. For the delete operation of snapshot 1, the base volume reference table 116 and the snapshot 1 reference table 118-1 are loaded into memory 112. Note that at this point, the base volume 108 and snapshot 1 make up the entire volume tree of the base volume 108.

[0121] The following are the tasks of the delete operation to delete snapshot 1.

[0122]

[0123]

[0124]

[0125] Figure 4B The statistics 406 including the used page count of the base volume 108 set to 11 is shown. Because all instances of the CHK_SHARED_CHILD flag have been cleared in the base volume reference table 116 (indicated by the CC counter being decremented to zero), the storage accounting engine 104 does not invoke the background process.

[0126] Scenario 1 special handling example

[0127] Figure 5A The state of the base volume reference table 116 and the snapshot 1 reference table 118-1 after the deletion of snapshot 2 is shown. Note that because the background process has not yet been invoked by the storage accounting engine 104, the statistics 502 for the base volume and snapshot 1 shown are not yet updated (they are the same as the statistics 213 for the base volume and snapshot 1 depicted in Figure 5A Figure 2F ​​The same as depicted by statistics 213 of base volume and snapshot 1. Note that statistics 502 no longer includes the used page count of snapshot 2, which has been deleted.

[0128] Statistics 502 includes the used page count of 14 of base volume 108 and the used page count of 2 of snapshot 1. The used page count of 2 of snapshot 1 is based on the fact that pages 4 and 8 of snapshot 1 contain data unique to snapshot 1 (as further explained above). Figure 5A Snapshot 1 reference table entries 204-4 and 204-8 in are depicted with thicker border to indicate that these entries reference data pages that are uniquely owned by snapshot 1.

[0129] Prior to invoking the background process, a new write to base volume 108 is performed (504), as shown in Figure 5B The new write (504) will write new base volume pages 0, 1, 2, 7, and 8, which are referenced by base volume reference table entries 202-0, 202-1, 202-2, 202-7, and 208-8, respectively, with modified shadow patterns as shown in Figure 5B

[0130] Processing base volume reference table entry 202-0 in response to the write of new base volume page 0 involves the special processing scenario 1 described above. Processing base volume reference table entry 202-0 in response to the write of new base volume page 0 also processes the CHK_SHARED_CHILD flag (indicated with "CC") set in base volume reference table entry 202-0 in Figure 5A

[0131] Because new base volume page 0 corresponds to base volume reference table entry 202-0, which already has a valid reference (see the shaded rectangle denoted 202-0 in Figure 5A The storage accounting engine 104 does not have to check the corresponding snapshot 1 reference table entry 204-1. The storage accounting engine 104 checks whether the CHK_SHARED_CHILD flag is set in base volume reference table entry 202-0 that references the new base volume page 0 being written. Because the CHK_SHARED_CHILD flag is set in base volume reference table entry 202-0, the storage accounting engine 104 increments the used page count of snapshot 1 from 2 to 3 and decrements the used page count of base volume 108 from 14 to 13. The used page count of snapshot 1 is incremented from 2 to 3 because page 0 of snapshot 1 is now unique to snapshot 1 as a result of overwriting new base volume page 0 to base volume 108. Figure 5B Snapshot 1 reference table entry 204-0 in is depicted with a thicker border to indicate that this entry references data pages that are uniquely owned by snapshot 1.

[0132] ​​Because the CHK_SHARED_CHILD flag in base volume reference table entry 202-0 has already been handled with the write of new base volume page 0, storage accounting engine 104 clears the CHK_SHARED_CHILD flag in base volume reference table entry 202-0 and decrements the CC counter from 4 to 3.

[0133] At this point, the statistics have already been updated in response to the write of new base volume page 0 before the background process (scheduled due to the deletion of snapshot 2) runs.

[0134] Continuing with the next write (of new base volume page 1 to base volume 108), storage accounting engine 104 determines that snapshot 1 reference table entry 204-1 contains an invalid reference for the portion of snapshot 1 corresponding to new base volume page 1. This means that the write of new base volume page 1 is not an overwrite. Thus, the used page count for snapshot 1 is not updated. Furthermore, because new base volume page 1 corresponds to base volume reference table entry 202-1, which already has a valid reference, the used page count for base volume 108 is not incremented.

[0135] Continuing with the next write (of new base volume page 2 to base volume 108), storage accounting engine 104 determines that the corresponding snapshot 1 reference table entry 204-2 contains a valid reference for the portion of snapshot 1 corresponding to new base volume page 2. This means that the write of new base volume page 2 is an overwrite, which results in snapshot 1 uniquely owning page 3 in snapshot 1 (indicated by the thicker border of snapshot 1 reference table entry 204-2). In response, storage accounting engine 104 increments the used page count for snapshot 1 from 3 to 4 (because page 2 of snapshot 1 is now uniquely owned by snapshot 1 as a result of writing new base volume page 2 to base volume 108). Because new base volume page 1 corresponds to base volume reference table entry 202-1, which already has a valid reference, the used page count for base volume 108 is not incremented.

[0136] Continuing with the next write (of new base volume page 7 to base volume 108), storage accounting engine 104 determines that snapshot 1 reference table entry 204-7 contains an invalid reference for the portion of snapshot 1 corresponding to new base volume page 7. This means that the write of new base volume page 7 is not an overwrite. Thus, the used page count for snapshot 1 is not updated. Furthermore, because new base volume page 7 corresponds to base volume reference table entry 202-7, which already has a valid reference, the used page count for base volume 108 is not incremented.

[0137] Continuing with the next write (of new base volume page 8 to base volume 108), the storage accounting engine 104 determines that the corresponding snapshot 1 reference table entry 204-8 contains a valid reference for the portion of snapshot 1 corresponding to the new base volume page 8. This means that the write of new base volume page 8 is an overwrite. However, page 8 of snapshot 1 is already uniquely owned by snapshot 1 (as indicated by the thicker border of snapshot 1 reference table entry 204-8 in Figure 5A and Figure 5B ). As a result, the storage accounting engine 104 does not increment the used page count of snapshot 1. In addition, because new base volume page 8 corresponds to a base volume reference table entry 202-8 that already has a valid reference, the used page count of base volume 108 is not incremented.

[0138] The statistics 506 in Figure 5B updated by the storage accounting engine 104 after the writes of new pages 0, 1, 2, 7, and 8 include the used page count of base volume 108, 13, and the used page count of snapshot 1, 4. The CHK_SHARED_CHILD flag set in base volume reference table entries 202-9, 202-10, and 202-11 remains unchanged because no writes were made to the pages corresponding to these entries.

[0139] Scenario 2 and scenario 3 special handling example

[0140] In the discussion above in connection with Figure 3A , the background process is invoked after the CHK_SHARED_CHILD flag and the CHK_SHARED_PARENT flag are set in the various snapshot 3 reference table entries.

[0141] In a different example, snapshot 1 can be deleted before the background process begins. The tasks performed in response to the deletion of snapshot 1, and after snapshot 2 is deleted, for snapshot 3 reference table entry 310-0 (which has the CHK_SHARED_CHILD flag set) and snapshot 3 reference table entries 310-1 and 310-4 (which have the CHK_SHARED_PARENT flag set) are described below.

[0142] The processing of snapshot 1 reference table entry 204-0 in response to the deletion of snapshot 1 involves the special processing scenario 2 described above. Because snapshot 1 reference table entry 204-0 has a valid reference, as indicated by the thick border of snapshot 1 reference table entry 204-0 in Figure 3BAs shown, the storage space accounting engine 104 checks the corresponding snapshot 3 reference table entry 310-0 (the corresponding entry of the reference table of the parent). The storage space accounting engine 104 determines that the snapshot 3 reference table entry 310-0 has a valid reference and that the CHK_SHARED_CHILD flag is set, which is an indication to check the child snapshot 1 of the previously deleted snapshot 2. Because the reference table entry for snapshot 1 is available (loaded into memory 112), the storage space accounting engine 104 is able to resolve the CHK_SHARED_CHILD flag before having to run the background process. The storage space accounting engine 104 decrements the used page count of the base volume 108 because the used page count of the base volume 108 accounts for the shared space between snapshots 1 and 2. After updating the statistics of the base volume 108, the CHK_SHARED_CHILD flag is cleared in the snapshot 3 reference table entry 310-0. The CC counter is also decremented.

[0143] The processing of the snapshot 1 reference table entry 204-1 in response to the deletion of snapshot 1 is performed as follows. Because the snapshot 1 reference table entry 204-1 has an invalid reference, as shown, the storage space accounting engine 104 checks the snapshot 3 reference table entry 310-1 (snapshot 3 is the parent of snapshot 1). Because the snapshot 3 reference table entry 310-1 includes a valid reference, the storage space accounting engine 104 checks whether snapshot 1 has a child. Because snapshot 1 has no child, this means that there is no shared data, and no storage space accounting change is performed. The CHK_SHARED_PARENT flag in the snapshot 3 reference table entry 310-1 is unchanged (i.e., remains set), and the CP counter is not decremented. Figure 3B

[0144] The snapshot 1 reference table entry 204-4 includes a valid reference, and the snapshot 3 reference table entry 310-4 also includes a valid reference; as a result, the corresponding storage space is freed because the storage space is owned exclusively by snapshot 1. Because the snapshot 1 reference table entry 204-4 is not merged with the snapshot reference table entry of the parent, the CHK_SHARED_PARENT flag of the snapshot 3 reference table entry 310-4 remains set (and the CP counter is not decremented).

[0145] Reference is made to Figure 3B ​In different examples, snapshot 3 (and possibly snapshot 1) can be deleted before the background process is initiated in response to the deletion of snapshot 2. This example involves special handling scenario 3. For example, if the reference table entry for the deleted snapshot (e.g., snapshot 3 reference table entry 310-4) has the CHK_SHARED_PARENT flag set, and both the reference table entry for the deleted snapshot 3 (310-4) and the corresponding reference table entry 202-4 for the parent of the deleted snapshot (base volume 108) include valid references (special handling scenario 3), then the storage accounting engine 104 decrements the used page count for the base volume 108 because the used page count for the base volume 108 accounted for the shared space between snapshots 3 and 2 before those snapshots were deleted. The CHK_SHARED_PARENT flag is not cleared and the CP counter for snapshot 3 is not changed because the snapshot 3 reference table entry 310-4 will be deleted anyway.

[0146] For snapshot 3 reference table entry 310-1, because the CHK_SHARED_PARENT flag is set, the storage accounting engine 104 checks the parent of snapshot 3 (base volume 108) and the corresponding base volume reference table entry 202-1, and sees that the base volume reference table entry 202-1 has an invalid reference. The CHK_SHARED_PARENT flag for snapshot 3 reference table entry 310-1 is cleared before snapshot 3 reference table entry 310-1 is merged with base volume reference table entry 202-1. The CP counter for snapshot 3 is not changed because snapshot 3 has been deleted.

[0147] Further examples

[0148] Figure 6 is a block diagram of a non-transitory machine-readable or computer- readable storage medium storing machine-readable instructions that, when executed, cause a system to perform various tasks. The system can include one computer or multiple computers. In some examples, these machine-readable instructions can be part of the storage accounting engine 104 and can be part of the reference table maintenance engine 120 of Figure 1 .

[0149] These machine-readable instructions include statistics maintenance instructions 602 to maintain statistics related to the use of storage for a base storage structure and a set of snapshots associated with the base storage structure based on data for the base storage structure and the set of snapshots. The base storage structure can be a base volume or a parent read-write snapshot from which read-only snapshots are created.

[0150] The machine-readable instructions include metadata checking instructions 604 to check metadata of the first snapshot to determine validity of references in the metadata and existence of any children of the first snapshot or ancestors of the first snapshot. The first snapshot can be a snapshot to be deleted. The metadata can include a reference table.

[0151] The machine-readable instructions include hint associating instructions 606 to associate a hint with a metadata entry of a parent of the first snapshot based on the validity of the references in the metadata and the existence of any children or ancestors of the first snapshot to indicate that metadata entries of the children or ancestors are to be checked to determine whether shared storage space becomes storage space that is uniquely used by a second snapshot. The hint can be the CHK_SHARED_CHILD flag or the CHK_SHARED_PARENT flag discussed further above. The shared storage space can be shared between the first snapshot (the snapshot to be deleted) and a child of the first snapshot. In this case, the second snapshot is the child. Alternatively, the shared storage space can be shared between a parent of the first snapshot and an ancestor of the first snapshot. In this alternative case, the second snapshot is the parent.

[0152] The machine-readable instructions include statistics updating instructions 608 to update statistics related to use of storage space using the hint. In some examples, the updating of the statistics is performed as a background process. The updated statistics can include statistics of the base storage structure and / or statistics of snapshots other than the first snapshot.

[0153] In some examples, the updating of the statistics is performed during I / O operations on the base storage structure or during deletion of another snapshot that is a parent of the first snapshot (e.g., the special handling scenarios 1, 2, and 3 discussed further above).

[0154] In some examples, the hint (e.g., the CHK_SHARED_CHILD flag) indicates that metadata entries of the child are to be checked to determine whether shared storage space shared between the first snapshot and the child becomes storage space that is uniquely used by the child. In such examples, associating the hint with the metadata entry of the parent is in response to the respective metadata entry of the first snapshot including an invalid reference and the metadata entry of the parent including a valid reference. The machine-readable instructions can check the metadata entries of the child in response to the hint and determine that the shared storage space shared between the first snapshot and the child becomes storage space that is uniquely used by the child in response to the metadata entry of the child containing a valid reference.

[0155] In a further example, a hint (e.g., a CHK_SHARED_PARENT flag) indicates that a metadata entry of an ancestor is to be checked to determine whether shared storage space shared between the ancestor and a parent becomes storage space used exclusively by the parent. In such a further example, associating the hint with the metadata entry of the parent is in response to the respective metadata entry of the first snapshot including a valid reference and the metadata entry of the parent including an invalid reference. The machine-readable instructions can check the metadata entry of the ancestor in response to the hint, and determine that shared storage space shared between the ancestor and the parent becomes storage space used exclusively by the parent in response to the metadata entry of the ancestor containing a valid reference.

[0156] Figure 7 FIG. 7 is a block diagram of a system 700 according to some examples. The system 700 includes a hardware processor 702 (or multiple hardware processors). The hardware processor can include a microprocessor, a core of a multi-core microprocessor, a microcontroller, a programmable integrated circuit, a programmable gate array, or another hardware processing circuit.

[0157] The system 700 includes a storage medium 704 that stores machine-readable instructions that are executable on the hardware processor 702 to perform various tasks. The machine-readable instructions that are executable on the hardware processor can refer to instructions that are executable on a single hardware processor or instructions that are executable on multiple hardware processors.

[0158] The machine-readable instructions in the storage medium 704 include statistics maintenance instructions 706 to maintain statistics related to usage of storage space for a base storage structure and a set of snapshots associated with the base storage structure based on data of the base storage structure and the set of snapshots. The statistics can include counts of used pages (further referred to as "used page counts" above) of the base storage structure and the snapshots.

[0159] The machine-readable instructions in the storage medium 704 include metadata checking instructions 708 to check metadata of a first snapshot to determine validity of references in entries of the metadata and existence of any children of the first snapshot or ancestors of the first snapshot. The metadata can include a reference table that includes entries, some of which can include valid references and others of which can include invalid references.

[0160] The machine-readable instructions in the storage medium 704 include hint association instructions 710 to associate, based on the validity of the references in the entries of the metadata and the existence of any children or ancestors of the first snapshot, a first hint with a first metadata entry of a parent of the first snapshot to indicate that metadata entries of children are to be checked to determine whether a shared storage space became a storage space used exclusively by the children, and a second hint with a second metadata entry of the parent of the first snapshot to indicate that metadata entries of ancestors are to be checked to determine whether a shared storage space became a storage space used exclusively by the parent of the first snapshot.

[0161] The machine-readable instructions in the storage medium 704 include statistics update instructions 712 to update statistics related to the use of storage space during a background process that uses the first hint and the second hint.

[0162] Figure 8 A flowchart of a process 800 according to some examples. The process 800 can be performed by a system that includes a hardware processor. The process 800 includes maintaining (at 802) statistics related to the use of storage space for a base storage structure and a set of snapshots associated with the base storage structure based on data of the base storage structure and the set of snapshots.

[0163] The process 800 includes, in response to a deletion of a first snapshot, checking (at 804) metadata of the first snapshot to determine the validity of references in the metadata and the existence of any children of the first snapshot or ancestors of the first snapshot.

[0164] The process 800 includes associating (at 806), based on the validity of the references in the metadata and the existence of the children and the ancestors of the first snapshot, hints with metadata entries of a parent of the first snapshot to indicate that metadata entries of the children and the ancestors are to be checked to determine whether a shared storage space became a storage space used exclusively by the respective snapshot. For example, the hints can include CHK_SHARED_CHILD flags and CHK_SHARED_PARENT flags that are included in the respective metadata entries.

[0165] The process 800 includes updating (at 808) statistics related to the use of storage space using the hints.

[0166] The storage medium (e.g., the storage medium 704) can include machine- readable instructions that, when executed by a machine (e.g., a hardware processor of a machine), cause the machine to perform operations such as those described herein. Figure 6 The storage medium (e.g., the storage medium 704) can include machine- readable instructions that, when executed by a machine (e.g., a hardware processor of a machine), cause the machine to perform operations such as those described herein. Figure 7The computer-readable or machine-readable storage medium 704 (see FIG. 7) can include any one or some combination of the following: semiconductor memory devices, such as DRAM or SRAM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) and flash memory; magnetic storage devices, including fixed disks, floppy disks, and tape; another magnetic medium such as tape; optical media such as compact disc (CD) or digital versatile disc (DVD); or another type of storage device. Note that instructions discussed above can be provided on one computer-readable or machine-readable storage medium, or alternatively, can be provided on multiple computer-readable or machine-readable storage media distributed in a large system having possibly plural nodes. Such computer-readable or machine-readable storage medium or media is (are) considered to be part of an article (or article of manufacture). An article or article of manufacture can refer to one or more computer programs that are fabricated or made available separately or collectively, in individual packages or on related media. A program in the present context can be a piece of software written in any appropriate computer language (e.g., Objective-C, Java, C, C++, Java, Visual Basic, Python, etc.) and / or a physical structure that can implement a process. The storage medium can include memory (e.g., read-only memory (ROM), flash memory, etc.), optical media (e.g., CD-ROM, etc.), magnetic media (e.g., floppy disks, magnetic tape, etc.), and / or other types of storage devices.

[0167] In this disclosure, the use of the term "a," "an," or "the" is intended to mean "one or more," unless the context clearly indicates otherwise. Likewise, the use of the term "includes," "including," "comprises," or "comprising" is intended to mean "one or more," but not "only" or "exclusively." The use of "based on" or "based upon" is intended to mean "based at least in part on."

[0168] In the foregoing description, numerous details are set forth to provide an understanding of the subject disclosed herein. However, implementations can be practiced without some or all of these details. Other implementations can include modifications and variations from the details discussed. It is intended that the appended claims cover such modifications and variations.

Claims

1. A non-transitory machine-readable storage medium comprising instructions that, when executed, cause a system to: maintain statistics related to usage of storage space for a base storage structure and a set of snapshots associated with the base storage structure based on data for the base storage structure and the set of snapshots; inspect metadata of a first snapshot to determine validity of a reference in the metadata and existence of any child of the first snapshot or an ancestor of the first snapshot; based on the validity of the reference in the metadata and the existence of any child or ancestor of the first snapshot, add a hint to a metadata entry of a parent of the first snapshot, the hint including a flag set to a first value indicating that a metadata entry of the child is to be inspected to determine whether shared storage space becomes storage space that is unique to the child of the first snapshot or a metadata entry of the ancestor is to be inspected to determine whether shared storage space becomes storage space that is unique to the parent of the first snapshot; and update the statistics related to usage of storage space by inspecting a metadata entry of the child or the ancestor based on the flag set to the first value. the reference in the metadata of the first snapshot includes:

2. The non-transitory machine-readable storage medium of claim 1, wherein, a valid reference to a first data page indicating that, in response to a read of the first data page, the first data page is to be fetched from the first snapshot, and an invalid reference to a second data page indicating that, in response to a read of the second data page, the second data page is to be fetched from an earlier snapshot. the inspecting, the adding, and the updating are in response to a deletion of the first snapshot.

3. The non-transitory machine-readable storage medium of claim 1, wherein, the updating of the statistics is performed during an input / output (I / O) operation on the base storage structure or during a deletion of another snapshot that is a parent of the first snapshot.

4. The non-transitory machine-readable storage medium of claim 3, wherein, the instructions, when executed, cause the system to:

5. The non-transitory machine-readable storage medium of claim 2, wherein, based on the invalid reference to the second data page in the metadata for the first snapshot and a valid reference to the second data page in metadata for the base storage structure, set the flag in the metadata entry of the parent to the first value, wherein the flag set to the first value indicates that a metadata entry of the child is to be inspected to determine whether the shared storage space shared between the first snapshot and the child becomes storage space that is unique to the child, and wherein the parent is the base storage structure. the valid reference to the second data page in the metadata for the base storage structure indicates that the second data page exists in the base storage structure, and 6. The non-transitory machine-readable storage medium of claim 5, wherein, wherein the metadata of the base storage structure further includes an invalid reference to the first data page to indicate that the first data page does not exist in the base storage structure. the instructions, when executed, cause the system to:

7. The non-transitory machine-readable storage medium of claim 5, wherein, in response to the flag set to the first value, inspect the metadata entry of the child; and ​ in response to the metadata entry of the child including a valid reference, determining that the shared storage space shared between the first snapshot and the child becomes storage space used exclusively by the child.

8. The non-transitory machine-readable storage medium of claim 7, wherein, The updating of the statistics includes one or more of updating statistics of the child or updating statistics of the parent.

9. The non-transitory machine-readable storage medium of claim 1, wherein, The flag set to the first value indicates that a metadata entry of the ancestor is to be checked to determine whether the shared storage space shared between the ancestor and the parent becomes storage space used exclusively by the parent.

10. The non-transitory machine-readable storage medium of claim 9, wherein, The instructions, when executed, cause the system to: set, based on a valid reference of a first data page in metadata for the first snapshot and an invalid reference of the first data page in metadata for the parent, the flag in a metadata entry of the parent to the first value, wherein the parent is an intermediate snapshot between the first snapshot and the base storage structure, the intermediate snapshot created later than the first snapshot.

11. The non-transitory machine-readable storage medium of claim 10, wherein, The instructions, when executed, cause the system to: in response to the flag set to the first value, check a metadata entry of the ancestor; and in response to the metadata entry of the ancestor including a valid reference, determine that the shared storage space shared between the ancestor and the parent becomes storage space used exclusively by the parent.

12. The non-transitory machine-readable storage medium of claim 11, wherein, The updating of the statistics includes one or more of updating statistics of the ancestor or updating statistics of the parent.

13. The non-transitory machine-readable storage medium of claim 10, wherein, The intermediate snapshot is created based on a read-write snapshot, and wherein the read-write snapshot is created based on the base storage structure.

14. The non-transitory machine-readable storage medium of claim 10, wherein, The checking of the metadata, the adding, and the updating are in response to deleting the first snapshot earlier than the intermediate snapshot.

15. The non-transitory machine-readable storage medium of claim 1, wherein, The instructions, when executed, cause the system to: based on validity of references in metadata of the first snapshot and existence of any child or ancestor, associate a plurality of hints with respective metadata entries of a parent of the first snapshot to indicate that a corresponding metadata entry of the child is to be checked to determine whether shared storage space becomes storage space used exclusively by the child of the first snapshot or a corresponding metadata entry of the ancestor is to be checked to determine whether shared storage space becomes storage space used exclusively by the parent of the first snapshot, wherein the updating of the statistics uses the plurality of hints.

16. The non-transitory machine-readable storage medium of claim 15, wherein, The instructions, when executed, cause the system to: maintain a count of how many hints of the plurality of hints remain to be resolved.

17. A system for storage space determination for snapshots, comprising: a processor; and a non-transitory storage medium having stored machine-readable instructions executable on the processor to: maintain statistics related to usage of storage space for a base storage structure and a set of snapshots associated with the base storage structure based on data of the base storage structure and the set of snapshots; checking metadata of a first snapshot to determine validity of references in entries of the metadata and existence of any children of the first snapshot or ancestors of the first snapshot; based on the validity of references in entries of the metadata and the existence of any children or ancestors of the first snapshot: associating a first hint with a first metadata entry of a parent of the first snapshot to indicate that metadata entries of the children are to be checked to determine whether shared storage space became storage space used exclusively by the children of the first snapshot, wherein the first hint includes a first flag set to a first value, and associating a second hint with a second metadata entry of the parent of the first snapshot to indicate that metadata entries of the ancestors are to be checked to determine whether shared storage space became storage space used exclusively by the parent of the first snapshot, wherein the second hint includes a second flag set to the first value; and updating, during a background process using the first flag set to the first value and the second flag set to the first value, the statistics related to usage of storage space.

18. The system of claim 17, wherein, the first flag set to the first value associated with the first metadata entry of the parent is in response to the respective metadata entry of the first snapshot including an invalid reference and the first metadata entry of the parent including a valid reference, and wherein the second flag set to the first value associated with the second metadata entry of the parent is in response to the respective metadata entry of the first snapshot including a valid reference and the second metadata entry of the parent including an invalid reference.

19. A method of a system comprising a hardware processor, the method comprising: maintaining, by the system, statistics related to usage of storage space for a base storage structure and a set of snapshots associated with the base storage structure based on data of the base storage structure and the set of snapshots; in response to a deletion of a first snapshot, checking, by the system, metadata of the first snapshot to determine validity of references in the metadata and existence of any children of the first snapshot or ancestors of the first snapshot; adding, by the system, based on the validity of references in the metadata and the existence of children and ancestors of the first snapshot, a hint to a metadata entry of a parent of the first snapshot to indicate that metadata entries of the children are to be checked to determine whether shared storage space became storage space used exclusively by the children of the first snapshot and that metadata entries of the ancestors are to be checked to determine whether shared storage space became storage space used exclusively by the parent of the first snapshot, wherein the hint includes a first flag set to a first value in a first metadata entry of the parent and a second flag set to the first value in a second metadata entry of the parent; and updating, by the system, using the hint including the first flag set to the first value and the second flag set to the first value, the statistics related to usage of storage space.

20. The method of claim 19, wherein: the first flag set to the first value indicates that the child's metadata entry is to be checked to determine whether shared storage space became storage space that is unique to the child, and the second flag set to the first value indicates that the parent's metadata entry is to be checked to determine whether shared storage space became storage space that is unique to the first snapshot's parent.

Citation Information

Patent Citations

  • Method and device for deleting snapshoot volumes in storage system

    CN106951375A

  • Systems, devices and methods for determining and reclaiming snapshot storage consumption in data storage systems

    US11169889B1