Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: use end_pos variable where needed in btrfs_dirty_folio()

We have a couple places doing the computation "pos + write_bytes" when we
already have it in the local variable "end_pos". Change then to use the
variable instead and make source code smaller. Also make the variable
const since it's not supposed to change.

This also has a very slight reduction in the module size.

Before:

$ size fs/btrfs/btrfs.ko
text data bss dec hex filename
1915990 161647 15592 2093229 1ff0ad fs/btrfs/btrfs.ko

After:

$ size fs/btrfs/btrfs.ko
text data bss dec hex filename
1915974 161647 15592 2093213 1ff09d fs/btrfs/btrfs.ko

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Filipe Manana and committed by
David Sterba
892794c0 38e81871

+3 -4
+3 -4
fs/btrfs/file.c
··· 75 75 u64 num_bytes; 76 76 u64 start_pos; 77 77 u64 end_of_last_block; 78 - u64 end_pos = pos + write_bytes; 78 + const u64 end_pos = pos + write_bytes; 79 79 loff_t isize = i_size_read(&inode->vfs_inode); 80 80 unsigned int extra_bits = 0; 81 81 ··· 86 86 extra_bits |= EXTENT_NORESERVE; 87 87 88 88 start_pos = round_down(pos, fs_info->sectorsize); 89 - num_bytes = round_up(write_bytes + pos - start_pos, 90 - fs_info->sectorsize); 89 + num_bytes = round_up(end_pos - start_pos, fs_info->sectorsize); 91 90 ASSERT(num_bytes <= U32_MAX); 92 - ASSERT(folio_pos(folio) <= pos && folio_end(folio) >= pos + write_bytes); 91 + ASSERT(folio_pos(folio) <= pos && folio_end(folio) >= end_pos); 93 92 94 93 end_of_last_block = start_pos + num_bytes - 1; 95 94