From 20c74e0c719268e884ec462ce48276499adce9e9 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Tue, 31 Dec 2019 08:33:29 -0500 Subject: [PATCH] lib/blob: do not zero out cluster map for snapshot blob Always when creating a snapshot, new blob is created. That blob is explcitly set as thin provisioned with size of the original blob in _spdk_bs_snapshot_origblob_open_cpl(). Thus it should always contain empty cluster map, as API user has to interaction with it yet. As sanity check for debug builds, verification if all clusters are 0's is added. This empty cluster map is later swapped into the original blob in _spdk_bs_snapshot_swap_cluster_maps(). Signed-off-by: Tomasz Zawadzki Change-Id: I4b935c0cf08917e9ad7b9bbedac4781890626eec Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478974 Community-CI: SPDK CI Jenkins Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/blob/blobstore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index f062b6a81..bce5a1bbf 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -41,6 +41,7 @@ #include "spdk/bit_array.h" #include "spdk/likely.h" #include "spdk/util.h" +#include "spdk/string.h" #include "spdk_internal/assert.h" #include "spdk_internal/log.h" @@ -4632,10 +4633,9 @@ _spdk_bs_snapshot_newblob_open_cpl(void *cb_arg, struct spdk_blob *_blob, int bs } ctx->new.blob = newblob; - - /* Zero out newblob cluster map */ - memset(newblob->active.clusters, 0, - newblob->active.num_clusters * sizeof(newblob->active.clusters)); + assert(spdk_blob_is_thin_provisioned(newblob)); + assert(spdk_mem_all_zero(newblob->active.clusters, + newblob->active.num_clusters * sizeof(newblob->active.clusters))); _spdk_blob_freeze_io(origblob, _spdk_bs_snapshot_freeze_cpl, ctx); }