Skip to content

Commit

Permalink
block: add async version of bio_set_polled
Browse files Browse the repository at this point in the history
If we know that a iocb is async we can optimise bio_set_polled() a bit,
add a new helper bio_set_polled_async().

Signed-off-by: Pavel Begunkov <[email protected]>
Link: https://lore.kernel.org/r/8fa137885164a5d05fadcff4c3521da8d5a83d00.1635337135.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
isilence authored and axboe committed Oct 27, 2021
1 parent e71aa91 commit 842e39b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions block/fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,13 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
task_io_account_write(bio->bi_iter.bi_size);
}

if (iocb->ki_flags & IOCB_NOWAIT)
bio->bi_opf |= REQ_NOWAIT;

if (iocb->ki_flags & IOCB_HIPRI) {
bio_set_polled(bio, iocb);
bio->bi_opf |= REQ_POLLED | REQ_NOWAIT;
submit_bio(bio);
WRITE_ONCE(iocb->private, bio);
} else {
if (iocb->ki_flags & IOCB_NOWAIT)
bio->bi_opf |= REQ_NOWAIT;
submit_bio(bio);
}
return -EIOCBQUEUED;
Expand Down

0 comments on commit 842e39b

Please sign in to comment.