lib/blob: merge EP of a clone when deleting a snapshot
In general it is not possible to delete snapshot when
there are clones on top of it.
There is special case when there is just a single clone
on top that snapshot.
In such case the clone is 'merged' with snapshot.
Unallocated clusters in clone, are filled with the ones
in snapshot (if allocated there).
Similar behavior should have occurred for extent pages.
This patch adds the implementation for moving EP from
snapshot to clone along with UT.
The UT exposes the issue by allowing delete_blob
to proceed beyond just unrecoverable snapshot blob.
Fixes #1291
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1163 (master)
Removed changes in UT since it requires couple multiple UT refactoring
changes before it.
(cherry picked from commit 0f5157377f
)
Change-Id: Ib2824c5737021f8e8d9b533a4cd245c12e6fe9fa
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2599
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
ae0db495fb
commit
90501268d6
@ -6210,7 +6210,14 @@ _spdk_delete_snapshot_sync_clone_cpl(void *cb_arg, int bserrno)
|
||||
ctx->snapshot->active.clusters[i] = 0;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ctx->snapshot->active.num_extent_pages &&
|
||||
i < ctx->clone->active.num_extent_pages; i++) {
|
||||
if (ctx->clone->active.extent_pages[i] == ctx->snapshot->active.extent_pages[i]) {
|
||||
ctx->snapshot->active.extent_pages[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
_spdk_blob_set_thin_provision(ctx->snapshot);
|
||||
ctx->snapshot->state = SPDK_BLOB_STATE_DIRTY;
|
||||
|
||||
if (ctx->parent_snapshot_entry != NULL) {
|
||||
@ -6243,6 +6250,12 @@ _spdk_delete_snapshot_sync_snapshot_xattr_cpl(void *cb_arg, int bserrno)
|
||||
ctx->clone->active.clusters[i] = ctx->snapshot->active.clusters[i];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ctx->snapshot->active.num_extent_pages &&
|
||||
i < ctx->clone->active.num_extent_pages; i++) {
|
||||
if (ctx->clone->active.extent_pages[i] == 0) {
|
||||
ctx->clone->active.extent_pages[i] = ctx->snapshot->active.extent_pages[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete old backing bs_dev from clone (related to snapshot that will be removed) */
|
||||
ctx->clone->back_bs_dev->destroy(ctx->clone->back_bs_dev);
|
||||
|
Loading…
Reference in New Issue
Block a user