btrfs: open code btrfs_bio_free_csum
authorChristoph Hellwig <hch@lst.de>
Sat, 21 Jan 2023 06:50:08 +0000 (07:50 +0100)
committerDavid Sterba <dsterba@suse.com>
Wed, 15 Feb 2023 18:38:51 +0000 (19:38 +0100)
btrfs_bio_free_csum has only one caller left, and that caller is always
for an data inode and doesn't need zeroing of the csum pointer as that
pointer will never be touched again.  Just open code the conditional
kfree there.

Reviewed-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/bio.c
fs/btrfs/bio.h

index 9bfdb90..6ef9532 100644 (file)
@@ -223,7 +223,8 @@ static void btrfs_check_read_bio(struct btrfs_bio *bbio, struct btrfs_device *de
                offset += sectorsize;
        }
 
-       btrfs_bio_free_csum(bbio);
+       if (bbio->csum != bbio->csum_inline)
+               kfree(bbio->csum);
 
        if (fbio)
                btrfs_repair_done(fbio);
index 8d69d0b..996275e 100644 (file)
@@ -94,16 +94,6 @@ static inline void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status)
        bbio->end_io(bbio);
 }
 
-static inline void btrfs_bio_free_csum(struct btrfs_bio *bbio)
-{
-       if (bbio->is_metadata)
-               return;
-       if (bbio->csum != bbio->csum_inline) {
-               kfree(bbio->csum);
-               bbio->csum = NULL;
-       }
-}
-
 /*
  * Iterate through a btrfs_bio (@bbio) on a per-sector basis.
  *