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 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
54f6083a81
commit
7245134ab0
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user