From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-f65.google.com ([209.85.166.65]:35666 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391651AbeLUTWs (ORCPT ); Fri, 21 Dec 2018 14:22:48 -0500 Received: by mail-io1-f65.google.com with SMTP id o13so3116669ioh.2 for ; Fri, 21 Dec 2018 11:22:48 -0800 (PST) From: Jens Axboe To: linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, linux-block@vger.kernel.org Cc: hch@lst.de, viro@zeniv.linux.org.uk, Jens Axboe Subject: [PATCH 05/22] block: use bio_set_polled() helper for O_DIRECT Date: Fri, 21 Dec 2018 12:22:19 -0700 Message-Id: <20181221192236.12866-6-axboe@kernel.dk> In-Reply-To: <20181221192236.12866-1-axboe@kernel.dk> References: <20181221192236.12866-1-axboe@kernel.dk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- 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