Those will go straight to issue inside blk-mq, so don't bother
setting up a block plug for them.

Signed-off-by: Jens Axboe <ax...@kernel.dk>
---
 fs/block_dev.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index c124982b810d..9dc695a3af4e 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -356,7 +356,13 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter 
*iter, int nr_pages)
        dio->multi_bio = false;
        dio->should_dirty = is_read && iter_is_iovec(iter);
 
-       blk_start_plug(&plug);
+       /*
+        * Don't plug for HIPRI/polled IO, as those should go straight
+        * to issue
+        */
+       if (!(iocb->ki_flags & IOCB_HIPRI))
+               blk_start_plug(&plug);
+
        for (;;) {
                bio_set_dev(bio, bdev);
                bio->bi_iter.bi_sector = pos >> 9;
@@ -403,7 +409,9 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter 
*iter, int nr_pages)
                submit_bio(bio);
                bio = bio_alloc(GFP_KERNEL, nr_pages);
        }
-       blk_finish_plug(&plug);
+
+       if (!(iocb->ki_flags & IOCB_HIPRI))
+               blk_finish_plug(&plug);
 
        if (!is_sync)
                return -EIOCBQUEUED;
-- 
2.17.1

Reply via email to