Commit cc6314a4 authored by paul luse's avatar paul luse Committed by Jim Harris
Browse files

test/reduce: fix reduce UT pm file length calculation



First in a series to fix broken reduce unit tests, they have not
been running in CI for quite some time.  Once they are working
again, will have Jenkins udpated to make sure they are run per
patch.

Change-Id: I12767dfea61a2e9a1ced85b9b247b5aeadc1edde
Signed-off-by: default avatarpaul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465207


Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 0fae4f64
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -107,16 +107,18 @@ get_pm_file_size(void)
	expected_pm_size = sizeof(struct spdk_reduce_vol_superblock);
	/* 100 chunks in logical map * 8 bytes per chunk */
	expected_pm_size += 100 * sizeof(uint64_t);
	/* 100 chunks * 4 backing io units per chunk * 8 bytes per backing io unit */
	expected_pm_size += 100 * 4 * sizeof(uint64_t);
	/* 100 chunks * (chunk stuct size + 4 backing io units per chunk * 8 bytes per backing io unit) */
	expected_pm_size += 100 * (sizeof(struct spdk_reduce_chunk_map) + 4 * sizeof(uint64_t));
	/* reduce allocates some extra chunks too for in-flight writes when logical map
	 * is full.  REDUCE_EXTRA_CHUNKS is a private #ifdef in reduce.c.
	 * is full.  REDUCE_EXTRA_CHUNKS is a private #ifdef in reduce.c Here we need the num chunks
	 * times (chunk struct size + 4 backing io units per chunk * 8 bytes per backing io unit).
	 */
	expected_pm_size += REDUCE_NUM_EXTRA_CHUNKS * 4 * sizeof(uint64_t);
	expected_pm_size += REDUCE_NUM_EXTRA_CHUNKS *
			    (sizeof(struct spdk_reduce_chunk_map) + 4 * sizeof(uint64_t));
	/* reduce will add some padding so numbers may not match exactly.  Make sure
	 * they are close though.
	 */
	CU_ASSERT((pm_size - expected_pm_size) < REDUCE_PM_SIZE_ALIGNMENT);
	CU_ASSERT((pm_size - expected_pm_size) <= REDUCE_PM_SIZE_ALIGNMENT);
}

static void