memory: lock global mem_map only when necessary
Minor cleanup. Change-Id: I9554163ae22836b50b954ec27ed27bcb848cb193 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/428883 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
438bae7966
commit
a9e484a660
@ -258,9 +258,8 @@ spdk_mem_map_alloc(uint64_t default_translation, const struct spdk_mem_map_ops *
|
||||
map->ops = *ops;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_mem_map_mutex);
|
||||
|
||||
if (ops && ops->notify_cb) {
|
||||
pthread_mutex_lock(&g_spdk_mem_map_mutex);
|
||||
rc = spdk_mem_map_notify_walk(map, SPDK_MEM_MAP_NOTIFY_REGISTER);
|
||||
if (rc != 0) {
|
||||
pthread_mutex_unlock(&g_spdk_mem_map_mutex);
|
||||
@ -270,10 +269,9 @@ spdk_mem_map_alloc(uint64_t default_translation, const struct spdk_mem_map_ops *
|
||||
return NULL;
|
||||
}
|
||||
TAILQ_INSERT_TAIL(&g_spdk_mem_maps, map, tailq);
|
||||
pthread_mutex_unlock(&g_spdk_mem_map_mutex);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_mem_map_mutex);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user