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: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465207
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
paul luse 2019-08-14 18:26:15 -04:00 committed by Jim Harris
parent 0fae4f64c4
commit cc6314a413

View File

@ -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