]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: pass the operation to btrfs_bio_alloc
authorChristoph Hellwig <hch@lst.de>
Sat, 6 Aug 2022 08:03:22 +0000 (10:03 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Sep 2022 10:27:58 +0000 (12:27 +0200)
Pass the operation to btrfs_bio_alloc, matching what bio_alloc_bioset
set does.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Tested-by: Nikolay Borisov <nborisov@suse.com>
Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c
fs/btrfs/extent_io.c
fs/btrfs/inode.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h

index e84d22c5c6a833fa111e77ac6057513f0f243bd7..a7f8a09601c925e36dff90de46e08a38f8213839 100644 (file)
@@ -344,10 +344,8 @@ static struct bio *alloc_compressed_bio(struct compressed_bio *cb, u64 disk_byte
        struct bio *bio;
        int ret;
 
-       bio = btrfs_bio_alloc(BIO_MAX_VECS);
-
+       bio = btrfs_bio_alloc(BIO_MAX_VECS, opf);
        bio->bi_iter.bi_sector = disk_bytenr >> SECTOR_SHIFT;
-       bio->bi_opf = opf;
        bio->bi_private = cb;
        bio->bi_end_io = endio_func;
 
index 85569c0e1def0f4f3a145a56a06fea010e5a08ac..6280474d445a3ef80d3b2fb83d944fa207cbbaa8 100644 (file)
@@ -2626,10 +2626,9 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,
                return -EIO;
        }
 
-       repair_bio = btrfs_bio_alloc(1);
+       repair_bio = btrfs_bio_alloc(1, REQ_OP_READ);
        repair_bbio = btrfs_bio(repair_bio);
        repair_bbio->file_offset = start;
-       repair_bio->bi_opf = REQ_OP_READ;
        repair_bio->bi_end_io = failed_bio->bi_end_io;
        repair_bio->bi_iter.bi_sector = failrec->logical >> 9;
        repair_bio->bi_private = failed_bio->bi_private;
@@ -3288,7 +3287,7 @@ static int alloc_new_bio(struct btrfs_inode *inode,
        struct bio *bio;
        int ret;
 
-       bio = btrfs_bio_alloc(BIO_MAX_VECS);
+       bio = btrfs_bio_alloc(BIO_MAX_VECS, opf);
        /*
         * For compressed page range, its disk_bytenr is always @disk_bytenr
         * passed in, no matter if we have added any range into previous bio.
@@ -3300,7 +3299,6 @@ static int alloc_new_bio(struct btrfs_inode *inode,
        bio_ctrl->bio = bio;
        bio_ctrl->compress_type = compress_type;
        bio->bi_end_io = end_io_func;
-       bio->bi_opf = opf;
        ret = calc_bio_boundaries(bio_ctrl, inode, file_offset);
        if (ret < 0)
                goto error;
index 0a77705717294f1f357645a177585433ed25ead7..06f947aec5a00eec106147da3a7f250e1d0e43aa 100644 (file)
@@ -10494,12 +10494,11 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
                        size_t bytes = min_t(u64, remaining, PAGE_SIZE);
 
                        if (!bio) {
-                               bio = btrfs_bio_alloc(BIO_MAX_VECS);
+                               bio = btrfs_bio_alloc(BIO_MAX_VECS, REQ_OP_READ);
                                bio->bi_iter.bi_sector =
                                        (disk_bytenr + cur) >> SECTOR_SHIFT;
                                bio->bi_end_io = btrfs_encoded_read_endio;
                                bio->bi_private = &priv;
-                               bio->bi_opf = REQ_OP_READ;
                        }
 
                        if (!bytes ||
index 7c8a44d3dadc993bb400222bb06899ed0d626ec4..db333d1088587d69f796bc73f76d8a384e3f2f07 100644 (file)
@@ -6630,11 +6630,11 @@ static inline void btrfs_bio_init(struct btrfs_bio *bbio)
  * Just like the underlying bio_alloc_bioset it will not fail as it is backed by
  * a mempool.
  */
-struct bio *btrfs_bio_alloc(unsigned int nr_vecs)
+struct bio *btrfs_bio_alloc(unsigned int nr_vecs, blk_opf_t opf)
 {
        struct bio *bio;
 
-       bio = bio_alloc_bioset(NULL, nr_vecs, 0, GFP_NOFS, &btrfs_bioset);
+       bio = bio_alloc_bioset(NULL, nr_vecs, opf, GFP_NOFS, &btrfs_bioset);
        btrfs_bio_init(btrfs_bio(bio));
        return bio;
 }
index e1a74598947fb0ddf456e5484bdf559e4b58514f..149fb5d522d47454e5e7ff232e323836fe46469d 100644 (file)
@@ -396,7 +396,7 @@ static inline struct btrfs_bio *btrfs_bio(struct bio *bio)
 int __init btrfs_bioset_init(void);
 void __cold btrfs_bioset_exit(void);
 
-struct bio *btrfs_bio_alloc(unsigned int nr_vecs);
+struct bio *btrfs_bio_alloc(unsigned int nr_vecs, blk_opf_t opf);
 struct bio *btrfs_bio_clone_partial(struct bio *orig, u64 offset, u64 size);
 
 static inline void btrfs_bio_free_csum(struct btrfs_bio *bbio)