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 <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: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Zawadzki 2019-12-31 08:33:29 -05:00
parent 44502e4293
commit 20c74e0c71

View File

@ -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);
}