[SRU Xenial][PATCH 2/2] UBUNTU: SAUCE: (no-up) virtio-scsi: (cosmetic) reestablish virtscsi_pick_vq_mq() signature

Mauricio Faria de Oliveira mfo at canonical.com
Tue Oct 16 15:38:20 UTC 2018

BugLink: https://bugs.launchpad.net/bugs/1798110

The commit a6c038a533f3 ("UBUNTU: SAUCE: (no-up) virtio-scsi: Increment
reqs counter.") changed the upstream signature of virtscsi_pick_vq_mq()
just to pass the 'struct virtio_scsi_target_state *tgt' pointer, which
can be derived from the 'scsi_cmnd *sc' pointer with the scsi_target()
macro (it indeed is, in many sites in this source file.)

This doesn't functionally matter because that function is static, thus
not called externally, but in order to maintain/reestablish the same
signature as upstream (since it's not really required to change it),
revert that part of the commit and use the scsi_target() macro, as
used elsewhere, to get the 'tgt' pointer from 'sc'.

Signed-off-by: Mauricio Faria de Oliveira <mfo at canonical.com>
Tested-by: Mauricio Faria de Oliveira <mfo at canonical.com>
Tested-by: David Coronel <david.coronel at canonical.com>
 drivers/scsi/virtio_scsi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 572722e86bef..377ef50d57b4 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -592,10 +592,12 @@ static int virtscsi_queuecommand_single(struct Scsi_Host *sh,
 static struct virtio_scsi_vq *virtscsi_pick_vq_mq(struct virtio_scsi *vscsi,
-						  struct virtio_scsi_target_state *tgt, struct scsi_cmnd *sc)
+						  struct scsi_cmnd *sc)
 	u32 tag = blk_mq_unique_tag(sc->request);
 	u16 hwq = blk_mq_unique_tag_to_hwq(tag);
+	struct virtio_scsi_target_state *tgt =
+				scsi_target(sc->device)->hostdata;
 	return &vscsi->req_vqs[hwq];
@@ -647,7 +649,7 @@ static int virtscsi_queuecommand_multi(struct Scsi_Host *sh,
 	struct virtio_scsi_vq *req_vq;
 	if (shost_use_blk_mq(sh))
-		req_vq = virtscsi_pick_vq_mq(vscsi, tgt, sc);
+		req_vq = virtscsi_pick_vq_mq(vscsi, sc);
 		req_vq = virtscsi_pick_vq(vscsi, tgt);

More information about the kernel-team mailing list