mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
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>
This commit is contained in:
parent
2e0464d48f
commit
5a473e8311
2 changed files with 7 additions and 0 deletions
|
@ -958,6 +958,7 @@ generic_make_request_checks(struct bio *bio)
|
||||||
struct request_queue *q;
|
struct request_queue *q;
|
||||||
int nr_sectors = bio_sectors(bio);
|
int nr_sectors = bio_sectors(bio);
|
||||||
blk_status_t status = BLK_STS_IOERR;
|
blk_status_t status = BLK_STS_IOERR;
|
||||||
|
struct blk_plug *plug;
|
||||||
char b[BDEVNAME_SIZE];
|
char b[BDEVNAME_SIZE];
|
||||||
|
|
||||||
might_sleep();
|
might_sleep();
|
||||||
|
@ -971,6 +972,10 @@ generic_make_request_checks(struct bio *bio)
|
||||||
goto end_io;
|
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
|
* For a REQ_NOWAIT based request, return -EOPNOTSUPP
|
||||||
* if queue is not a request based queue.
|
* 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);
|
INIT_LIST_HEAD(&plug->cb_list);
|
||||||
plug->rq_count = 0;
|
plug->rq_count = 0;
|
||||||
plug->multiple_queues = false;
|
plug->multiple_queues = false;
|
||||||
|
plug->nowait = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store ordering should not be needed here, since a potential
|
* Store ordering should not be needed here, since a potential
|
||||||
|
|
|
@ -1189,6 +1189,7 @@ struct blk_plug {
|
||||||
struct list_head cb_list; /* md requires an unplug callback */
|
struct list_head cb_list; /* md requires an unplug callback */
|
||||||
unsigned short rq_count;
|
unsigned short rq_count;
|
||||||
bool multiple_queues;
|
bool multiple_queues;
|
||||||
|
bool nowait;
|
||||||
};
|
};
|
||||||
#define BLK_MAX_REQUEST_COUNT 16
|
#define BLK_MAX_REQUEST_COUNT 16
|
||||||
#define BLK_PLUG_FLUSH_SIZE (128 * 1024)
|
#define BLK_PLUG_FLUSH_SIZE (128 * 1024)
|
||||||
|
|
Loading…
Add table
Reference in a new issue