From 7be176e1e627556f216632c5386ff748c09d9b98 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 2 Oct 2018 06:42:53 -0700 Subject: [PATCH] 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 Change-Id: Ic389afcf60984ea431a6d1c7523005a368547447 Reviewed-on: https://review.gerrithub.io/434112 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Paul Luse Reviewed-by: Ben Walker --- lib/reduce/reduce.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/reduce/reduce.c b/lib/reduce/reduce.c index d978d11c9..8d23f9754 100644 --- a/lib/reduce/reduce.c +++ b/lib/reduce/reduce.c @@ -81,6 +81,7 @@ struct spdk_reduce_vol_request { struct spdk_reduce_vol { struct spdk_reduce_vol_params params; + uint32_t backing_io_units_per_chunk; struct spdk_reduce_pm_file pm_file; struct spdk_reduce_backing_dev *backing_dev; struct spdk_reduce_vol_superblock *backing_super; @@ -325,7 +326,7 @@ _allocate_bit_arrays(struct spdk_reduce_vol *vol) 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, 1); @@ -446,6 +447,7 @@ spdk_reduce_vol_init(struct spdk_reduce_vol_params *params, return; } + vol->backing_io_units_per_chunk = params->chunk_size / params->backing_io_unit_size; memcpy(&vol->params, params, sizeof(*params)); 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)); + vol->backing_io_units_per_chunk = vol->params.chunk_size / vol->params.backing_io_unit_size; rc = _allocate_bit_arrays(vol); if (rc != 0) {