Skip to content

Commit 1892833

Browse files
committed
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>
1 parent 1309a6e commit 1892833

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/btrfs/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4819,9 +4819,9 @@ static int truncate_block_zero_beyond_eof(struct btrfs_inode *inode, u64 start)
48194819
*/
48204820

48214821
zero_start = max_t(u64, folio_pos(folio), start);
4822-
zero_end = folio_pos(folio) + folio_size(folio) - 1;
4822+
zero_end = folio_pos(folio) + folio_size(folio);
48234823
folio_zero_range(folio, zero_start - folio_pos(folio),
4824-
zero_end - zero_start + 1);
4824+
zero_end - zero_start);
48254825

48264826
out_unlock:
48274827
folio_unlock(folio);

0 commit comments

Comments
 (0)