]> www.infradead.org Git - users/hch/block.git/commitdiff
block: use the percpu bio cache in __blkdev_direct_IO bio-cache
authorChristoph Hellwig <hch@lst.de>
Wed, 11 Aug 2021 09:54:06 +0000 (11:54 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 11 Aug 2021 11:06:57 +0000 (13:06 +0200)
Use bio_alloc_iocb to dip into the percpu cache of bios when the
caller asks for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/block_dev.c

index e1c14c2e0504d4f9ea23b1ba08deb31598dc9df6..a2c3d11eda5e8386a68200fab357c673b0ddcc58 100644 (file)
@@ -385,8 +385,7 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
            (bdev_logical_block_size(bdev) - 1))
                return -EINVAL;
 
-       bio = bio_alloc_bioset(GFP_KERNEL, nr_pages, &blkdev_dio_pool);
-
+       bio = bio_alloc_iocb(iocb, nr_pages, &blkdev_dio_pool);
        dio = container_of(bio, struct blkdev_dio, bio);
        dio->is_sync = is_sync = is_sync_kiocb(iocb);
        if (dio->is_sync) {
@@ -513,7 +512,9 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 
 static __init int blkdev_init(void)
 {
-       return bioset_init(&blkdev_dio_pool, 4, offsetof(struct blkdev_dio, bio), BIOSET_NEED_BVECS);
+       return bioset_init(&blkdev_dio_pool, 4,
+                          offsetof(struct blkdev_dio, bio),
+                          BIOSET_NEED_BVECS | BIOSET_PERCPU_CACHE);
 }
 module_init(blkdev_init);