lib/reduce: use helper function to get correct length of logical map

When setting the offset into pmem for the chunk mamps, the wrong
value was used for the length of the logical map resulting in
map corruption after extended fio run.

Fixes issue #813

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Icb51cf8f38a04f05f69595ebd510ced7f1b608f3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457818
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
paul luse 2019-06-12 08:48:33 -04:00 committed by Darek Stojaczyk
parent d571336b4b
commit 11bbb26e4f

View File

@ -291,6 +291,8 @@ spdk_reduce_vol_get_uuid(struct spdk_reduce_vol *vol)
static void static void
_initialize_vol_pm_pointers(struct spdk_reduce_vol *vol) _initialize_vol_pm_pointers(struct spdk_reduce_vol *vol)
{ {
uint64_t logical_map_size;
/* Superblock is at the beginning of the pm file. */ /* Superblock is at the beginning of the pm file. */
vol->pm_super = (struct spdk_reduce_vol_superblock *)vol->pm_file.pm_buf; vol->pm_super = (struct spdk_reduce_vol_superblock *)vol->pm_file.pm_buf;
@ -298,7 +300,8 @@ _initialize_vol_pm_pointers(struct spdk_reduce_vol *vol)
vol->pm_logical_map = (uint64_t *)(vol->pm_super + 1); vol->pm_logical_map = (uint64_t *)(vol->pm_super + 1);
/* Chunks maps follow the logical map. */ /* Chunks maps follow the logical map. */
vol->pm_chunk_maps = vol->pm_logical_map + (vol->params.vol_size / vol->params.chunk_size); logical_map_size = _get_pm_logical_map_size(vol->params.vol_size, vol->params.chunk_size);
vol->pm_chunk_maps = (uint64_t *)((uint8_t *)vol->pm_logical_map + logical_map_size);
} }
/* We need 2 iovs during load - one for the superblock, another for the path */ /* We need 2 iovs during load - one for the superblock, another for the path */