Skip to content

Commit

Permalink
xfs: remove unnecessary shifts
Browse files Browse the repository at this point in the history
The superblock verifier already validates that (1 << blocklog) ==
blocksize, so use the value directly instead of doing math.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
  • Loading branch information
Darrick J. Wong committed Jun 1, 2021
1 parent a7bcb14 commit 20bd8e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/xfs/xfs_bmap_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ xfs_flush_unmap_range(
xfs_off_t rounding, start, end;
int error;

rounding = max_t(xfs_off_t, 1 << mp->m_sb.sb_blocklog, PAGE_SIZE);
rounding = max_t(xfs_off_t, mp->m_sb.sb_blocksize, PAGE_SIZE);
start = round_down(offset, rounding);
end = round_up(offset + len, rounding) - 1;

Expand Down Expand Up @@ -1053,9 +1053,9 @@ xfs_prepare_shift(
* extent (after split) during the shift and corrupt the file. Start
* with the block just prior to the start to stabilize the boundary.
*/
offset = round_down(offset, 1 << mp->m_sb.sb_blocklog);
offset = round_down(offset, mp->m_sb.sb_blocksize);
if (offset)
offset -= (1 << mp->m_sb.sb_blocklog);
offset -= mp->m_sb.sb_blocksize;

/*
* Writeback and invalidate cache for the remainder of the file as we're
Expand Down

0 comments on commit 20bd8e6

Please sign in to comment.