block: clear BIO_PERCPU_CACHE flag if polling isn't supported

The bio alloc cache relies on the fact that a polled bio will complete
in process context, clear the cacheable flag if we disable polling
for a given bio.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe 2021-08-11 10:19:06 -06:00
parent be4d234d7a
commit be863b9e43

View file

@ -832,8 +832,11 @@ static noinline_for_stack bool submit_bio_checks(struct bio *bio)
}
}
if (!test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
if (!test_bit(QUEUE_FLAG_POLL, &q->queue_flags)) {
/* can't support alloc cache if we turn off polling */
bio_clear_flag(bio, BIO_PERCPU_CACHE);
bio->bi_opf &= ~REQ_HIPRI;
}
switch (bio_op(bio)) {
case REQ_OP_DISCARD: