memory: return first translation from mem_map_translate

This should have always been the case with spdk_mem_map_translate. For
some memory maps (like RDMA) this doesn't matter, but for others like
our virtual to physical map, this is critical for retrieving valid
translations.

This behavior change will only affect maps that have a registered
contiguous memory callback.

Change-Id: I67517667f01d974702d7daa7c81238281aae0cf6
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/436562 (master)
Reviewed-on: https://review.gerrithub.io/437202
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Seth Howell 2018-12-07 15:33:38 -07:00 committed by Jim Harris
parent ffa07029b1
commit 34d47ecc35

View File

@ -594,6 +594,7 @@ spdk_mem_map_translate(const struct spdk_mem_map *map, uint64_t vaddr, uint64_t
uint64_t total_size = 0;
uint64_t cur_size;
uint64_t prev_translation;
uint64_t orig_translation;
if (size != NULL) {
total_size = *size;
@ -625,7 +626,8 @@ spdk_mem_map_translate(const struct spdk_mem_map *map, uint64_t vaddr, uint64_t
return map_2mb->translation_2mb;
}
prev_translation = map_2mb->translation_2mb;;
orig_translation = map_2mb->translation_2mb;
prev_translation = orig_translation;
while (cur_size < total_size) {
vfn_2mb++;
idx_256tb = MAP_256TB_IDX(vfn_2mb);
@ -646,7 +648,7 @@ spdk_mem_map_translate(const struct spdk_mem_map *map, uint64_t vaddr, uint64_t
}
*size = cur_size;
return prev_translation;
return orig_translation;
}
#if RTE_VERSION >= RTE_VERSION_NUM(18, 05, 0, 0)