bdev/compress: Populate params structure on load

On init, we pass reducelib the address of our params structure
so that the volume size is updated accordingly.  On load however,
there was nothing to set the volume size so any load of a previously
created compress volume would result in a 0 length bdev.

Change-Id: I7643c79fa2e664115fd25df064ff1c74d82e358b
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452906
Tested-by: SPDK CI Jenkins <sys_sgci@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:
paul luse 2019-05-02 15:05:10 -04:00 committed by Jim Harris
parent 6dc095c430
commit 024e89afb3
2 changed files with 6 additions and 0 deletions

View File

@ -1214,6 +1214,7 @@ vbdev_compress_claim(struct vbdev_compress *comp_bdev)
comp_bdev->comp_bdev.blocklen = comp_bdev->base_bdev->blocklen;
comp_bdev->comp_bdev.blockcnt = comp_bdev->params.vol_size / comp_bdev->comp_bdev.blocklen;
assert(comp_bdev->comp_bdev.blockcnt > 0);
/* This is the context that is passed to us when the bdev
* layer calls in so we'll save our comp_bdev node here.
@ -1312,7 +1313,10 @@ vbdev_reduce_load_cb(void *cb_arg, struct spdk_reduce_vol *vol, int reduce_errno
return;
}
/* Update information following volume load. */
meta_ctx->vol = vol;
memcpy(&meta_ctx->params, spdk_reduce_vol_get_params(vol),
sizeof(struct spdk_reduce_vol_params));
vbdev_compress_claim(meta_ctx);
spdk_bdev_module_examine_done(&compress_if);
}

View File

@ -146,6 +146,8 @@ DEFINE_STUB_V(spdk_reduce_vol_unload, (struct spdk_reduce_vol *vol,
spdk_reduce_vol_op_complete cb_fn, void *cb_arg));
DEFINE_STUB_V(spdk_reduce_vol_load, (struct spdk_reduce_backing_dev *backing_dev,
spdk_reduce_vol_op_with_handle_complete cb_fn, void *cb_arg));
DEFINE_STUB(spdk_reduce_vol_get_params, const struct spdk_reduce_vol_params *,
(struct spdk_reduce_vol *vol), NULL);
/* DPDK stubs */
DEFINE_STUB(rte_socket_id, unsigned, (void), 0);