Commit a9e484a6 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

memory: lock global mem_map only when necessary



Minor cleanup.

Change-Id: I9554163ae22836b50b954ec27ed27bcb848cb193
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/428883


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 438bae79
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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,9 +269,8 @@ 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);
	}

	return map;
}