Commit 20c74e0c authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

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: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I4b935c0cf08917e9ad7b9bbedac4781890626eec
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478974


Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 44502e42
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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);
}