From: Ferry Meng <mengferry@linux.alibaba.com>
To: "Michael S . Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
virtualization@lists.linux.dev
Cc: linux-kernel@vger.kernel.org, io-uring@vger.kernel.org,
Joseph Qi <joseph.qi@linux.alibaba.com>,
Jeffle Xu <jefflexu@linux.alibaba.com>,
Ferry Meng <mengferry@linux.alibaba.com>
Subject: [PATCH 3/3] virtio-blk: add uring_cmd iopoll support.
Date: Tue, 3 Dec 2024 20:14:24 +0800 [thread overview]
Message-ID: <20241203121424.19887-4-mengferry@linux.alibaba.com> (raw)
In-Reply-To: <20241203121424.19887-1-mengferry@linux.alibaba.com>
Add polling support for uring_cmd polling support for virtblk, which
will be called during completion-polling.
Signed-off-by: Ferry Meng <mengferry@linux.alibaba.com>
---
drivers/block/virtio_blk.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 1a4bac3dc044..7888789a3eb8 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -1469,6 +1469,18 @@ static int virtblk_chr_uring_cmd(struct io_uring_cmd *ioucmd, unsigned int issue
return virtblk_uring_cmd(vblk, ioucmd, issue_flags);
}
+static int virtblk_chr_uring_cmd_iopoll(struct io_uring_cmd *ioucmd,
+ struct io_comp_batch *iob,
+ unsigned int poll_flags)
+{
+ struct virtblk_uring_cmd_pdu *pdu = virtblk_get_uring_cmd_pdu(ioucmd);
+ struct request *req = pdu->req;
+
+ if (req && blk_rq_is_poll(req))
+ return blk_rq_poll(req, iob, poll_flags);
+ return 0;
+}
+
static void virtblk_cdev_rel(struct device *dev)
{
ida_free(&vd_chr_minor_ida, MINOR(dev->devt));
@@ -1517,6 +1529,7 @@ static int virtblk_cdev_add(struct virtio_blk *vblk,
static const struct file_operations virtblk_chr_fops = {
.owner = THIS_MODULE,
.uring_cmd = virtblk_chr_uring_cmd,
+ .uring_cmd_iopoll = virtblk_chr_uring_cmd_iopoll,
};
static unsigned int virtblk_queue_depth;
--
2.43.5
next prev parent reply other threads:[~2024-12-03 12:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 12:14 [PATCH 0/3][RFC] virtio-blk: add io_uring passthrough support for virtio-blk Ferry Meng
2024-12-03 12:14 ` [PATCH 1/3] virtio-blk: add virtio-blk chardev support Ferry Meng
2024-12-03 12:14 ` [PATCH 2/3] virtio-blk: add uring_cmd support for I/O passthru on chardev Ferry Meng
2024-12-04 15:19 ` kernel test robot
2024-12-03 12:14 ` Ferry Meng [this message]
2024-12-04 21:47 ` [PATCH 0/3][RFC] virtio-blk: add io_uring passthrough support for virtio-blk Stefan Hajnoczi
2024-12-05 9:51 ` [Resend]Re: " Ferry Meng
2024-12-16 2:01 ` Ferry Meng
2024-12-16 7:38 ` Jason Wang
2024-12-16 12:07 ` Ferry Meng
2024-12-17 2:08 ` Jason Wang
2024-12-17 6:04 ` Ferry Meng
2024-12-16 15:54 ` Christoph Hellwig
2024-12-16 16:13 ` Stefan Hajnoczi
2024-12-17 2:12 ` Jason Wang
2024-12-17 6:08 ` Jingbo Xu
2024-12-17 17:54 ` Jens Axboe
2024-12-17 21:00 ` Stefan Hajnoczi
2024-12-17 21:07 ` Jens Axboe
2024-12-18 3:35 ` Ferry Meng
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=20241203121424.19887-4-mengferry@linux.alibaba.com \
--to=mengferry@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=jasowang@redhat.com \
--cc=jefflexu@linux.alibaba.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux.dev \
/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.