On 2022/3/22 23:55, Christoph Hellwig wrote:
Except for the spurious initialization of ->device just after allocation nothing uses the btrfs_bio, so just allocate a normal bio without extra data. Signed-off-by: Christoph Hellwig <hch@xxxxxx>
RAID56 layer doesn't need to bother special things like mirror_num nor checksum, as it's at a lower layer under logical layer. So this is completely fine, and save quite some cleanup I'm going to do related to RAID56. Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>
--- fs/btrfs/raid56.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 2f1f7ca27acd5..a0d65f4b2b258 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1103,11 +1103,8 @@ static int rbio_add_io_page(struct btrfs_raid_bio *rbio, } /* put a new bio on the list */ - bio = btrfs_bio_alloc(bio_max_len >> PAGE_SHIFT ?: 1); - btrfs_bio(bio)->device = stripe->dev; - bio->bi_iter.bi_size = 0; - bio_set_dev(bio, stripe->dev->bdev); - bio->bi_opf = opf; + bio = bio_alloc(stripe->dev->bdev, max(bio_max_len >> PAGE_SHIFT, 1UL), + opf, GFP_NOFS); bio->bi_iter.bi_sector = disk_start >> 9; bio->bi_private = rbio;