summaryrefslogtreecommitdiffstats
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-06-04 11:23:39 -0600
committerJens Axboe <axboe@kernel.dk>2020-06-21 20:44:25 -0600
commit5a473e8311b582a40c10409a0f4bb39f42aa8123 (patch)
tree87f06802ab216f218f5d34d8c10323a3e580a736 /block/blk-core.c
parent2e0464d48f32a9e78e2aa85cbbedc77ecbb6ed60 (diff)
downloadlinux-5a473e8311b582a40c10409a0f4bb39f42aa8123.tar.gz
linux-5a473e8311b582a40c10409a0f4bb39f42aa8123.tar.xz
block: provide plug based way of signaling forced no-wait semantics
Provide a way for the caller to specify that IO should be marked with REQ_NOWAIT to avoid blocking on allocation. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 03252af8c82c..62a4904db921 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -958,6 +958,7 @@ generic_make_request_checks(struct bio *bio)
struct request_queue *q;
int nr_sectors = bio_sectors(bio);
blk_status_t status = BLK_STS_IOERR;
+ struct blk_plug *plug;
char b[BDEVNAME_SIZE];
might_sleep();
@@ -971,6 +972,10 @@ generic_make_request_checks(struct bio *bio)
goto end_io;
}
+ plug = blk_mq_plug(q, bio);
+ if (plug && plug->nowait)
+ bio->bi_opf |= REQ_NOWAIT;
+
/*
* For a REQ_NOWAIT based request, return -EOPNOTSUPP
* if queue is not a request based queue.
@@ -1800,6 +1805,7 @@ void blk_start_plug(struct blk_plug *plug)
INIT_LIST_HEAD(&plug->cb_list);
plug->rq_count = 0;
plug->multiple_queues = false;
+ plug->nowait = false;
/*
* Store ordering should not be needed here, since a potential