From: Paolo Bonzini <pbonzini@redhat.com>
To: Ming Lei <ming.lei@canonical.com>,
James Bottomley <JBottomley@parallels.com>,
Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH V1] virtio_scsi: support multi hw queue of blk-mq
Date: Mon, 17 Nov 2014 12:05:01 +0100 [thread overview]
Message-ID: <5469D65D.1000709@redhat.com> (raw)
In-Reply-To: <1416023234-28003-1-git-send-email-ming.lei@canonical.com>
On 15/11/2014 04:47, Ming Lei wrote:
> Since virtio_scsi has supported multi virtqueue already,
> it is natural to map the virtque to hw-queue of blk-mq.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
> V1:
> - support non-mq too
>
> drivers/scsi/virtio_scsi.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
> index b83846f..d3af70e 100644
> --- a/drivers/scsi/virtio_scsi.c
> +++ b/drivers/scsi/virtio_scsi.c
> @@ -561,6 +561,15 @@ static int virtscsi_queuecommand_single(struct Scsi_Host *sh,
> return virtscsi_queuecommand(vscsi, &vscsi->req_vqs[0], sc);
> }
>
> +static struct virtio_scsi_vq *virtscsi_pick_vq_mq(struct virtio_scsi *vscsi,
> + struct scsi_cmnd *sc)
> +{
> + u32 tag = blk_mq_unique_tag(sc->request);
> + u16 hwq = blk_mq_unique_tag_to_hwq(tag);
> +
> + return &vscsi->req_vqs[hwq];
> +}
> +
> static struct virtio_scsi_vq *virtscsi_pick_vq(struct virtio_scsi *vscsi,
> struct virtio_scsi_target_state *tgt)
> {
> @@ -604,7 +613,12 @@ static int virtscsi_queuecommand_multi(struct Scsi_Host *sh,
> struct virtio_scsi *vscsi = shost_priv(sh);
> struct virtio_scsi_target_state *tgt =
> scsi_target(sc->device)->hostdata;
> - struct virtio_scsi_vq *req_vq = virtscsi_pick_vq(vscsi, tgt);
> + struct virtio_scsi_vq *req_vq;
> +
> + if (shost_use_blk_mq(sh))
> + req_vq = virtscsi_pick_vq_mq(vscsi, sc);
> + else
> + req_vq = virtscsi_pick_vq(vscsi, tgt);
>
> return virtscsi_queuecommand(vscsi, req_vq, sc);
> }
> @@ -983,6 +997,7 @@ static int virtscsi_probe(struct virtio_device *vdev)
> shost->max_id = num_targets;
> shost->max_channel = 0;
> shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE;
> + shost->nr_hw_queues = num_queues;
>
> if (virtio_has_feature(vdev, VIRTIO_SCSI_F_T10_PI)) {
> host_prot = SHOST_DIF_TYPE1_PROTECTION | SHOST_DIF_TYPE2_PROTECTION |
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
next prev parent reply other threads:[~2014-11-17 11:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-15 3:47 [PATCH V1] virtio_scsi: support multi hw queue of blk-mq Ming Lei
2014-11-17 11:05 ` Paolo Bonzini [this message]
2014-11-20 15:55 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5469D65D.1000709@redhat.com \
--to=pbonzini@redhat.com \
--cc=JBottomley@parallels.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=ming.lei@canonical.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.