aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2025-06-10 14:17:48 +0200
committerDavid Sterba <dsterba@suse.com>2025-07-21 23:58:01 +0200
commite47c8a47670dbb71bbeeb6cd91f6697106acd742 (patch)
tree5aa56b0e11acb1582b65b86ef00f434b49083361
parentbtrfs: check BLOCK_GROUP_FLAG_NEEDS_FREE_SPACE at __add_block_group_free_space() (diff)
downloadwireguard-linux-e47c8a47670dbb71bbeeb6cd91f6697106acd742.tar.xz
wireguard-linux-e47c8a47670dbb71bbeeb6cd91f6697106acd742.zip
btrfs: simplify range end calculations in truncate_block_zero_beyond_eof()
The way zero_end is calculated and used does a -1 and +1 that effectively cancel out, so this can be simplified. This is also preparatory patch for using a helper for folio_pos + folio_size with the semantics of exclusive end of the range. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index cc176950e719..391a1f71d7b2 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4819,9 +4819,9 @@ again:
*/
zero_start = max_t(u64, folio_pos(folio), start);
- zero_end = folio_pos(folio) + folio_size(folio) - 1;
+ zero_end = folio_pos(folio) + folio_size(folio);
folio_zero_range(folio, zero_start - folio_pos(folio),
- zero_end - zero_start + 1);
+ zero_end - zero_start);
out_unlock:
folio_unlock(folio);