[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20241218092435.21671-4-mengferry@linux.alibaba.com>
Date: Wed, 18 Dec 2024 17:24:35 +0800
From: Ferry Meng <mengferry@...ux.alibaba.com>
To: "Michael S . Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
linux-block@...r.kernel.org,
Jens Axboe <axboe@...nel.dk>,
virtualization@...ts.linux.dev
Cc: linux-kernel@...r.kernel.org,
io-uring@...r.kernel.org,
Stefan Hajnoczi <stefanha@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
Joseph Qi <joseph.qi@...ux.alibaba.com>,
Jeffle Xu <jefflexu@...ux.alibaba.com>,
Ferry Meng <mengferry@...ux.alibaba.com>
Subject: [PATCH v1 3/3] virtio-blk: add uring_cmd iopoll support.
Add polling support for uring_cmd polling support for virtblk, which
will be called during completion-polling.
Signed-off-by: Ferry Meng <mengferry@...ux.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 cd88cf939144..cd4c74e06107 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -1464,6 +1464,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));
@@ -1512,6 +1524,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
Powered by blists - more mailing lists