reduce: add vol->backing_io_units_per_chunk

This can be derived from chunk_size and backing_io_unit_size
in the params, but saving this value explicitly in the vol
structure is helpful so we don't always have to calculate
it.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic389afcf60984ea431a6d1c7523005a368547447

Reviewed-on: https://review.gerrithub.io/434112
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2018-10-02 06:42:53 -07:00
parent d465a21a30
commit 7be176e1e6

View File

@ -81,6 +81,7 @@ struct spdk_reduce_vol_request {
struct spdk_reduce_vol { struct spdk_reduce_vol {
struct spdk_reduce_vol_params params; struct spdk_reduce_vol_params params;
uint32_t backing_io_units_per_chunk;
struct spdk_reduce_pm_file pm_file; struct spdk_reduce_pm_file pm_file;
struct spdk_reduce_backing_dev *backing_dev; struct spdk_reduce_backing_dev *backing_dev;
struct spdk_reduce_vol_superblock *backing_super; struct spdk_reduce_vol_superblock *backing_super;
@ -325,7 +326,7 @@ _allocate_bit_arrays(struct spdk_reduce_vol *vol)
return -ENOMEM; return -ENOMEM;
} }
/* Set backing block bits associated with metadata. */ /* Set backing io unit bits associated with metadata. */
spdk_bit_array_set(vol->allocated_backing_io_units, 0); spdk_bit_array_set(vol->allocated_backing_io_units, 0);
spdk_bit_array_set(vol->allocated_backing_io_units, 1); spdk_bit_array_set(vol->allocated_backing_io_units, 1);
@ -446,6 +447,7 @@ spdk_reduce_vol_init(struct spdk_reduce_vol_params *params,
return; return;
} }
vol->backing_io_units_per_chunk = params->chunk_size / params->backing_io_unit_size;
memcpy(&vol->params, params, sizeof(*params)); memcpy(&vol->params, params, sizeof(*params));
rc = _allocate_bit_arrays(vol); rc = _allocate_bit_arrays(vol);
@ -512,6 +514,7 @@ _load_read_super_and_path_cpl(void *cb_arg, int ziperrno)
} }
memcpy(&vol->params, &vol->backing_super->params, sizeof(vol->params)); memcpy(&vol->params, &vol->backing_super->params, sizeof(vol->params));
vol->backing_io_units_per_chunk = vol->params.chunk_size / vol->params.backing_io_unit_size;
rc = _allocate_bit_arrays(vol); rc = _allocate_bit_arrays(vol);
if (rc != 0) { if (rc != 0) {