Commit 65945c02 authored by Ziye Yang's avatar Ziye Yang Committed by Tomasz Zawadzki
Browse files

bdev/rbd: Move bdev_rados_context_init to bdev_rbd_handle



According to customers's report, there still exists
the Rados related thread contention with SPDK's reactor thread.
So also meove bdev_rados_context_init into bdev_rbd_handle.

With this patch, QEMU + SPDK vhost + Bdev RBD 's performance
can be improved.

Change-Id: Ie26a140f8d2cfe1a98cd1737f4ff70e9319cdc11
Signed-off-by: default avatarYaowei Bai <baiyaowei_yewu@cmss.chinamobile.com>
Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3699


Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatar <dongx.yi@intel.com>
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 49904470
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -536,12 +536,24 @@ bdev_rbd_handle(void *arg)
{
	struct bdev_rbd_io_channel *ch = arg;
	void *ret = arg;
	int rc;

	rc = bdev_rados_context_init(ch->disk->user_id, ch->disk->pool_name,
				     (const char *const *)ch->disk->config,
				     &ch->cluster, &ch->io_ctx);
	if (rc < 0) {
		SPDK_ERRLOG("Failed to create rados context for user_id %s and rbd_pool=%s\n",
			    ch->disk->user_id ? ch->disk->user_id : "admin (the default)", ch->disk->pool_name);
		ret = NULL;
		goto end;
	}

	if (rbd_open(ch->io_ctx, ch->disk->rbd_name, &ch->image, NULL) < 0) {
		SPDK_ERRLOG("Failed to open specified rbd device\n");
		ret = NULL;
	}

end:
	return ret;
}

@@ -556,15 +568,6 @@ bdev_rbd_create_cb(void *io_device, void *ctx_buf)
	ch->io_ctx = NULL;
	ch->pfd.fd = -1;

	ret = bdev_rados_context_init(ch->disk->user_id, ch->disk->pool_name,
				      (const char *const *)ch->disk->config,
				      &ch->cluster, &ch->io_ctx);
	if (ret < 0) {
		SPDK_ERRLOG("Failed to create rados context for user_id %s and rbd_pool=%s\n",
			    ch->disk->user_id ? ch->disk->user_id : "admin (the default)", ch->disk->pool_name);
		goto err;
	}

	if (spdk_call_unaffinitized(bdev_rbd_handle, ch) == NULL) {
		goto err;
	}