public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: don't ignore REQ_NOWAIT for direct IO
@ 2020-11-20 17:10 Pavel Begunkov
  2020-11-20 17:13 ` Pavel Begunkov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Pavel Begunkov @ 2020-11-20 17:10 UTC (permalink / raw)
  To: Jens Axboe, linux-block, linux-kernel

io_uring's direct nowait requests end up waiting on io_schedule() in
sbitmap, that's seems to be so because blkdev_direct_IO() fails to
propagate IOCB_NOWAIT to a bio and hence to blk-mq.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/block_dev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 9e84b1928b94..e7e860c78d93 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -263,6 +263,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
 		bio.bi_opf = dio_bio_write_op(iocb);
 		task_io_account_write(ret);
 	}
+	if (iocb->ki_flags & IOCB_NOWAIT)
+		bio.bi_opf |= REQ_NOWAIT;
 	if (iocb->ki_flags & IOCB_HIPRI)
 		bio_set_polled(&bio, iocb);
 
@@ -416,6 +418,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
 			bio->bi_opf = dio_bio_write_op(iocb);
 			task_io_account_write(bio->bi_iter.bi_size);
 		}
+		if (iocb->ki_flags & IOCB_NOWAIT)
+			bio->bi_opf |= REQ_NOWAIT;
 
 		dio->size += bio->bi_iter.bi_size;
 		pos += bio->bi_iter.bi_size;
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-02 14:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-20 17:10 [PATCH] block: don't ignore REQ_NOWAIT for direct IO Pavel Begunkov
2020-11-20 17:13 ` Pavel Begunkov
2020-11-20 19:13 ` Jens Axboe
2021-04-02 14:24   ` Pavel Begunkov
2021-04-02 14:34 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox