We need to treat sync and async IO differently. Use the provided helper
instead of setting it manually, then we also get the async case correct
by marking it NOWAIT.

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

diff --git a/fs/block_dev.c b/fs/block_dev.c
index b8f574615792..9d96c1e30854 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -232,8 +232,7 @@ __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_HIPRI)
-               bio.bi_opf |= REQ_HIPRI;
+       bio_set_polled(&bio, iocb);
 
        qc = submit_bio(&bio);
        for (;;) {
@@ -402,12 +401,8 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter 
*iter, int nr_pages)
 
                nr_pages = iov_iter_npages(iter, BIO_MAX_PAGES);
                if (!nr_pages) {
-                       if (iocb->ki_flags & IOCB_HIPRI) {
-                               if (!is_sync)
-                                       bio->bi_opf |= REQ_HIPRI_ASYNC;
-                               else
-                                       bio->bi_opf |= REQ_HIPRI;
-                       }
+                       if (iocb->ki_flags & IOCB_HIPRI)
+                               bio_set_polled(bio, iocb);
 
                        qc = submit_bio(bio);
                        WRITE_ONCE(iocb->ki_cookie, qc);
-- 
2.17.1

Reply via email to