From f8df19a49f251bf9465bf79348411beabe308463 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 1 Sep 2022 10:06:56 +0000 Subject: [PATCH] vhost: assign svdev from spdk thread context Currently scsi sets it's svdev from the vhost thread context, while blk does it from the spdk thread context. Make scsi match what blk does, to make the code more consistent. This also will allow for an upcoming simplification. Signed-off-by: Jim Harris Change-Id: I609513bc8e05b49dd9455f2f61ba0cedc35236e6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14326 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Tomasz Zawadzki --- lib/vhost/vhost_scsi.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/vhost/vhost_scsi.c b/lib/vhost/vhost_scsi.c index 24b6cde1b..a7c75543b 100644 --- a/lib/vhost/vhost_scsi.c +++ b/lib/vhost/vhost_scsi.c @@ -1355,11 +1355,15 @@ vhost_scsi_start_cb(struct spdk_vhost_dev *vdev, struct spdk_vhost_session *vsession, void *unused) { struct spdk_vhost_scsi_session *svsession = to_scsi_session(vsession); - struct spdk_vhost_scsi_dev *svdev = svsession->svdev; + struct spdk_vhost_scsi_dev *svdev; struct spdk_scsi_dev_vhost_state *state; uint32_t i; int rc; + svdev = to_scsi_dev(vsession->vdev); + assert(svdev != NULL); + svsession->svdev = svdev; + /* validate all I/O queues are in a contiguous index range */ for (i = VIRTIO_SCSI_REQUESTQ; i < vsession->max_queues; i++) { if (vsession->virtqueue[i].vring.desc == NULL) { @@ -1411,13 +1415,6 @@ out: static int vhost_scsi_start(struct spdk_vhost_session *vsession) { - struct spdk_vhost_scsi_session *svsession = to_scsi_session(vsession); - struct spdk_vhost_scsi_dev *svdev; - - svdev = to_scsi_dev(vsession->vdev); - assert(svdev != NULL); - svsession->svdev = svdev; - return vhost_user_session_send_event(vsession, vhost_scsi_start_cb, 3, "start session"); }