diff options
author | David Sterba | 2020-06-30 18:04:02 +0200 |
---|---|---|
committer | David Sterba | 2020-12-08 15:54:00 +0100 |
commit | 713cebfb98915201a43ff4d01b0dbafecd50d8ae (patch) | |
tree | 1cedb3cf2a5359f452468cb20b3add52359c33af | |
parent | 223486c27b369a10ceb6180c40d7aa354e903446 (diff) |
btrfs: remove unnecessary local variables for checksum size
Remove local variable that is then used just once and replace it with
fs_info::csum_size.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/compression.c | 6 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 3 | ||||
-rw-r--r-- | fs/btrfs/file-item.c | 3 | ||||
-rw-r--r-- | fs/btrfs/ordered-data.h | 3 |
4 files changed, 5 insertions, 10 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index b2bb4681975e..4e022ed72d2f 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -131,9 +131,8 @@ static int btrfs_decompress_bio(struct compressed_bio *cb); static inline int compressed_bio_size(struct btrfs_fs_info *fs_info, unsigned long disk_size) { - const u32 csum_size = fs_info->csum_size; return sizeof(struct compressed_bio) + - (DIV_ROUND_UP(disk_size, fs_info->sectorsize)) * csum_size; + (DIV_ROUND_UP(disk_size, fs_info->sectorsize)) * fs_info->csum_size; } static int check_compressed_csum(struct btrfs_inode *inode, struct bio *bio, @@ -627,7 +626,6 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, struct extent_map *em; blk_status_t ret = BLK_STS_RESOURCE; int faili = 0; - const u32 csum_size = fs_info->csum_size; u8 *sums; em_tree = &BTRFS_I(inode)->extent_tree; @@ -727,7 +725,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, nr_sectors = DIV_ROUND_UP(comp_bio->bi_iter.bi_size, fs_info->sectorsize); - sums += csum_size * nr_sectors; + sums += fs_info->csum_size * nr_sectors; ret = btrfs_map_bio(fs_info, comp_bio, mirror_num); if (ret) { diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 02b36908327a..c70a52b44ceb 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -454,7 +454,6 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page) u64 start = page_offset(page); u64 found_start; u8 result[BTRFS_CSUM_SIZE]; - const u32 csum_size = fs_info->csum_size; struct extent_buffer *eb; int ret; @@ -491,7 +490,7 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page) WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG)); return ret; } - write_extent_buffer(eb, result, 0, csum_size); + write_extent_buffer(eb, result, 0, fs_info->csum_size); return 0; } diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 73ec6c5eadcb..5f3096ea69af 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -540,7 +540,6 @@ blk_status_t btrfs_csum_one_bio(struct btrfs_inode *inode, struct bio *bio, int i; u64 offset; unsigned nofs_flag; - const u32 csum_size = fs_info->csum_size; nofs_flag = memalloc_nofs_save(); sums = kvzalloc(btrfs_ordered_sum_size(fs_info, bio->bi_iter.bi_size), @@ -608,7 +607,7 @@ blk_status_t btrfs_csum_one_bio(struct btrfs_inode *inode, struct bio *bio, fs_info->sectorsize, sums->sums + index); kunmap_atomic(data); - index += csum_size; + index += fs_info->csum_size; offset += fs_info->sectorsize; this_sum_bytes += fs_info->sectorsize; total_bytes += fs_info->sectorsize; diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h index e48810104e4a..367269effd6a 100644 --- a/fs/btrfs/ordered-data.h +++ b/fs/btrfs/ordered-data.h @@ -137,9 +137,8 @@ static inline int btrfs_ordered_sum_size(struct btrfs_fs_info *fs_info, unsigned long bytes) { int num_sectors = (int)DIV_ROUND_UP(bytes, fs_info->sectorsize); - const u32 csum_size = fs_info->csum_size; - return sizeof(struct btrfs_ordered_sum) + num_sectors * csum_size; + return sizeof(struct btrfs_ordered_sum) + num_sectors * fs_info->csum_size; } static inline void |