From b3a0dd50c3951ec1b9a12ec39034194022fd8693 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 22 Nov 2018 17:16:49 +0100 Subject: btrfs: replace btrfs_io_bio::end_io with a simple helper The end_io callback implemented as btrfs_io_bio_endio_readpage only calls kfree. Also the callback is set only in case the csum buffer is allocated and not pointing to the inline buffer. We can use that information to drop the indirection and call a helper that will free the csums only in the right case. This shrinks struct btrfs_io_bio by 8 bytes. Reviewed-by: Nikolay Borisov Reviewed-by: Johannes Thumshirn Signed-off-by: David Sterba --- fs/btrfs/file-item.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'fs/btrfs/file-item.c') diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 1f2d0a6ab634..920bf3b4b0ef 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -142,14 +142,6 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans, return ret; } -static void btrfs_io_bio_endio_readpage(struct btrfs_io_bio *bio, int err) -{ - if (bio->csum != bio->csum_inline) { - kfree(bio->csum); - bio->csum = NULL; - } -} - static blk_status_t __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio, u64 logical_offset, u32 *dst, int dio) { @@ -184,7 +176,6 @@ static blk_status_t __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio btrfs_free_path(path); return BLK_STS_RESOURCE; } - btrfs_bio->end_io = btrfs_io_bio_endio_readpage; } else { btrfs_bio->csum = btrfs_bio->csum_inline; } -- cgit v1.2.3