aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Snitzer <snitzer@kernel.org> 2022-03-24 16:35:25 -0400
committerGravatar Jens Axboe <axboe@kernel.dk> 2022-04-17 16:49:40 -0600
commitb53f3dcd705e52a07bd0311870dbfb6842e88c91 (patch)
tree0178a6d8ffcda464a458ae3f6ba7a21b337c01f2 /include
parentblock: allow using the per-cpu bio cache from bio_alloc_bioset (diff)
downloadlinux-b53f3dcd705e52a07bd0311870dbfb6842e88c91.tar.gz
linux-b53f3dcd705e52a07bd0311870dbfb6842e88c91.tar.bz2
linux-b53f3dcd705e52a07bd0311870dbfb6842e88c91.zip
block: allow use of per-cpu bio alloc cache by block drivers
Refine per-cpu bio alloc cache interfaces so that DM and other block drivers can properly create and use the cache: DM uses bioset_init_from_src() to do its final bioset initialization, so must update bioset_init_from_src() to set BIOSET_PERCPU_CACHE if %src bioset has a cache. Also move bio_clear_polled() to include/linux/bio.h to allow users outside of block core. Signed-off-by: Mike Snitzer <snitzer@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20220324203526.62306-3-snitzer@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include')
-rw-r--r--include/linux/bio.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 0fe8a51a0778..8e87f3065042 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -780,6 +780,12 @@ static inline void bio_set_polled(struct bio *bio, struct kiocb *kiocb)
bio->bi_opf |= REQ_NOWAIT;
}
+static inline void bio_clear_polled(struct bio *bio)
+{
+ /* can't support alloc cache if we turn off polling */
+ bio->bi_opf &= ~(REQ_POLLED | REQ_ALLOC_CACHE);
+}
+
struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev,
unsigned int nr_pages, unsigned int opf, gfp_t gfp);