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: Yaowei Bai <baiyaowei_yewu@cmss.chinamobile.com>
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3699
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ziye Yang 2020-08-10 20:15:27 +08:00 committed by Tomasz Zawadzki
parent 49904470ba
commit 65945c0296

View File

@ -536,12 +536,24 @@ bdev_rbd_handle(void *arg)
{ {
struct bdev_rbd_io_channel *ch = arg; struct bdev_rbd_io_channel *ch = arg;
void *ret = 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) { if (rbd_open(ch->io_ctx, ch->disk->rbd_name, &ch->image, NULL) < 0) {
SPDK_ERRLOG("Failed to open specified rbd device\n"); SPDK_ERRLOG("Failed to open specified rbd device\n");
ret = NULL; ret = NULL;
} }
end:
return ret; return ret;
} }
@ -556,15 +568,6 @@ bdev_rbd_create_cb(void *io_device, void *ctx_buf)
ch->io_ctx = NULL; ch->io_ctx = NULL;
ch->pfd.fd = -1; 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) { if (spdk_call_unaffinitized(bdev_rbd_handle, ch) == NULL) {
goto err; goto err;
} }