lib/vhost_blk: get bdev io_channels via vhost_blk functions
This patch adds vhost_blk_[get/put]_io_channel() to be used by virtio_blk transports. Functions related to vhost_user sessions were modified to use it. dummy_io_channel reference is managed at the vhost_blk layer and as such continues to use the spdk_[get/put]_io_channel() APIs. The description is updated to reflect its not specific to vhost_user transport. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I6644198da83bfa0210c167e203d3875e96f1e7ea Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11101 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
223f1f1446
commit
4f95fd7be6
@ -1006,7 +1006,7 @@ _no_bdev_vdev_vq_worker(struct spdk_vhost_virtqueue *vq)
|
|||||||
vhost_session_vq_used_signal(vq);
|
vhost_session_vq_used_signal(vq);
|
||||||
|
|
||||||
if (vsession->task_cnt == 0 && bvsession->io_channel) {
|
if (vsession->task_cnt == 0 && bvsession->io_channel) {
|
||||||
spdk_put_io_channel(bvsession->io_channel);
|
vhost_blk_put_io_channel(bvsession->io_channel);
|
||||||
bvsession->io_channel = NULL;
|
bvsession->io_channel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1307,7 +1307,7 @@ vhost_blk_start_cb(struct spdk_vhost_dev *vdev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bvdev->bdev) {
|
if (bvdev->bdev) {
|
||||||
bvsession->io_channel = spdk_bdev_get_io_channel(bvdev->bdev_desc);
|
bvsession->io_channel = vhost_blk_get_io_channel(vdev);
|
||||||
if (!bvsession->io_channel) {
|
if (!bvsession->io_channel) {
|
||||||
free_task_pool(bvsession);
|
free_task_pool(bvsession);
|
||||||
SPDK_ERRLOG("%s: I/O channel allocation failed\n", vsession->name);
|
SPDK_ERRLOG("%s: I/O channel allocation failed\n", vsession->name);
|
||||||
@ -1385,7 +1385,7 @@ destroy_session_poller_cb(void *arg)
|
|||||||
vsession->name, spdk_env_get_current_core());
|
vsession->name, spdk_env_get_current_core());
|
||||||
|
|
||||||
if (bvsession->io_channel) {
|
if (bvsession->io_channel) {
|
||||||
spdk_put_io_channel(bvsession->io_channel);
|
vhost_blk_put_io_channel(bvsession->io_channel);
|
||||||
bvsession->io_channel = NULL;
|
bvsession->io_channel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1610,11 +1610,10 @@ spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When starting qemu with vhost-user-blk multiqueue, the vhost device will
|
* When starting qemu with multiqueue enable, the vhost device will
|
||||||
* be started/stopped many times, related to the queues num, as the
|
* be started/stopped many times, related to the queues num, as the
|
||||||
* vhost-user backend doesn't know the exact number of queues used for this
|
* exact number of queues used for this device is not known at the time.
|
||||||
* device. The target have to stop and start the device once got a valid
|
* The target has to stop and start the device once got a valid IO queue.
|
||||||
* IO queue.
|
|
||||||
* When stoping and starting the vhost device, the backend bdev io device
|
* When stoping and starting the vhost device, the backend bdev io device
|
||||||
* will be deleted and created repeatedly.
|
* will be deleted and created repeatedly.
|
||||||
* Hold a bdev reference so that in the struct spdk_vhost_blk_dev, so that
|
* Hold a bdev reference so that in the struct spdk_vhost_blk_dev, so that
|
||||||
@ -1669,5 +1668,19 @@ vhost_blk_destroy(struct spdk_vhost_dev *vdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct spdk_io_channel *
|
||||||
|
vhost_blk_get_io_channel(struct spdk_vhost_dev *vdev)
|
||||||
|
{
|
||||||
|
struct spdk_vhost_blk_dev *bvdev = to_blk_dev(vdev);
|
||||||
|
|
||||||
|
return spdk_bdev_get_io_channel(bvdev->bdev_desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
vhost_blk_put_io_channel(struct spdk_io_channel *ch)
|
||||||
|
{
|
||||||
|
spdk_put_io_channel(ch);
|
||||||
|
}
|
||||||
|
|
||||||
SPDK_LOG_REGISTER_COMPONENT(vhost_blk)
|
SPDK_LOG_REGISTER_COMPONENT(vhost_blk)
|
||||||
SPDK_LOG_REGISTER_COMPONENT(vhost_blk_data)
|
SPDK_LOG_REGISTER_COMPONENT(vhost_blk_data)
|
||||||
|
@ -509,6 +509,9 @@ int vhost_get_negotiated_features(int vid, uint64_t *negotiated_features);
|
|||||||
|
|
||||||
int remove_vhost_controller(struct spdk_vhost_dev *vdev);
|
int remove_vhost_controller(struct spdk_vhost_dev *vdev);
|
||||||
|
|
||||||
|
struct spdk_io_channel *vhost_blk_get_io_channel(struct spdk_vhost_dev *vdev);
|
||||||
|
void vhost_blk_put_io_channel(struct spdk_io_channel *ch);
|
||||||
|
|
||||||
/* Function calls from vhost.c to rte_vhost_user.c,
|
/* Function calls from vhost.c to rte_vhost_user.c,
|
||||||
* shall removed once virtio transport abstraction is complete. */
|
* shall removed once virtio transport abstraction is complete. */
|
||||||
int vhost_user_session_set_coalescing(struct spdk_vhost_dev *dev,
|
int vhost_user_session_set_coalescing(struct spdk_vhost_dev *dev,
|
||||||
|
Loading…
Reference in New Issue
Block a user