@@ -424,6 +424,9 @@ static void blkdev_bio_end_io(struct bio *bio)
if (!nr_pages) {
bool polled = false;
+ if (iocb->ki_flags & IOCB_NOWAIT)
+ bio->bi_opf |= REQ_NOWAIT;
+
if (iocb->ki_flags & IOCB_HIPRI) {
bio_set_polled(bio, iocb);
polled = true;
@@ -64,6 +64,9 @@ static void iomap_dio_submit_bio(struct iomap_dio *dio, struct iomap *iomap,
{
atomic_inc(&dio->ref);
+ if (dio->iocb->ki_flags & IOCB_NOWAIT)
+ bio->bi_opf |= REQ_NOWAIT;
+
if (dio->iocb->ki_flags & IOCB_HIPRI)
bio_set_polled(bio, dio->iocb);
Currently, IOCB_NOWAIT is ignored in direct io, REQ_NOWAIT is only set when IOCB_HIPRI is set. But REQ_NOWAIT should be set as well when IOCB_NOWAIT is set. Signed-off-by: Hao Xu <haoxu@linux.alibaba.com> --- Hi all, I tested fio io_uring direct read for a file on ext4 filesystem on a nvme ssd. I found that IOCB_NOWAIT is ignored in iomap layer, which means REQ_NOWAIT is not set in bio->bi_opf. This makes nowait IO a normal IO. Since I'm new to iomap and block layer, I sincerely ask yours opinions in case I misunderstand the code which is very likely to happen.:) fs/block_dev.c | 3 +++ fs/iomap/direct-io.c | 3 +++ 2 files changed, 6 insertions(+)