diff options
author | Christoph Hellwig <hch@lst.de> | 2023-03-07 17:39:44 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-04-17 18:01:17 +0200 |
commit | b41bbd293e64016b3bfad4e5f709fcc07f00b2c5 (patch) | |
tree | ad78e785167f044b855f3cf2b7fe4f8e9de5935d /fs/btrfs/bio.c | |
parent | 9dfde1b47b9d7e090d9bf34f8a7ef4d89735f9e6 (diff) |
btrfs: return a btrfs_bio from btrfs_bio_alloc
Return the containing struct btrfs_bio instead of the less type safe
struct bio from btrfs_bio_alloc.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/bio.c')
-rw-r--r-- | fs/btrfs/bio.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index c04e103f8768..527081abca02 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -48,15 +48,17 @@ void btrfs_bio_init(struct btrfs_bio *bbio, struct btrfs_inode *inode, * 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, blk_opf_t opf, - struct btrfs_inode *inode, - btrfs_bio_end_io_t end_io, void *private) +struct btrfs_bio *btrfs_bio_alloc(unsigned int nr_vecs, blk_opf_t opf, + struct btrfs_inode *inode, + btrfs_bio_end_io_t end_io, void *private) { + struct btrfs_bio *bbio; struct bio *bio; bio = bio_alloc_bioset(NULL, nr_vecs, opf, GFP_NOFS, &btrfs_bioset); - btrfs_bio_init(btrfs_bio(bio), inode, end_io, private); - return bio; + bbio = btrfs_bio(bio); + btrfs_bio_init(bbio, inode, end_io, private); + return bbio; } static struct bio *btrfs_split_bio(struct btrfs_fs_info *fs_info, |