xfs: various unit conversions
Crafting the realtime file extent size hint fixes revealed various opportunities to clean up unit conversions, so now that gets its own series. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEUzaAxoMeQq6m2jMV+H93GTRKtOsFAmC5YvYACgkQ+H93GTRK tOtRihAAh5wKVV9Fwafkk3l2zTCw+K/SfciWvZqF8BClAjqzWUDaw4DJ2HS0lSmj ezOG+/HhJzZB4udC9WDM4TSFA/elR1pJBu5lSBpAt/K78Mpw/i1aFs1SyAfw6Qsp 1A8um80jaCyzvcSxU1Hx/35CN0MQwpjJ23LziEDUVBvj/qV7Qj8DmI61CfWWYzs9 jEJFzIvbKoRqs8Wqws7n4a7fw3VOyqC2EQV290xzumkYKOSAmpWQGkbiU2/YtqKY 7w/GvjS1zRE7o1cGeKBYRA/35zbw5mqoHD5vJmdlUIsWK22fnN8h5vqYo5dpFPiz nFyK+MHVrV6WxKBKECHtgm7Jya+jjH0TFu/9js4k31ehe4LJc/nhEqmSrFiH3eGS 4AXrhhZqtDZ1skjcPym83dCayW1uE2cWbHqYJ+ztQW5PrLafoWQ9Ld/vtrbL+b/U VIgh3LQmF371jGcE0twERNQPIb5F96w9mS6F+vq0JuvrGftxoa4tKVjE8jrNWJjo 750/KT0Nupti0AYKq9WMD47BiSf5BbdnhYTN15X0mc5TyHo/EyXIl/I/hFfEMFp9 AH/qWaQlt3LjMXvr1xF6R4RNSI+xxai7PHfW69Zi7tBea+7k9wTZjubgc2FFaMOQ Jf8n5L07IXVYDy0mGUGaokenQb2KPvfXVK7yYtaMj1qDh7Sjqjw= =HGL1 -----END PGP SIGNATURE----- Merge tag 'unit-conversion-cleanups-5.14_2021-06-03' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-5.14-merge2 xfs: various unit conversions Crafting the realtime file extent size hint fixes revealed various opportunities to clean up unit conversions, so now that gets its own series. * tag 'unit-conversion-cleanups-5.14_2021-06-03' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux: xfs: remove unnecessary shifts xfs: clean up open-coded fs block unit conversions
This commit is contained in:
commit
f52edf6c54
|
@ -612,7 +612,7 @@ xfs_inode_validate_extsize(
|
|||
*/
|
||||
|
||||
if (rt_flag)
|
||||
blocksize_bytes = mp->m_sb.sb_rextsize << mp->m_sb.sb_blocklog;
|
||||
blocksize_bytes = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize);
|
||||
else
|
||||
blocksize_bytes = mp->m_sb.sb_blocksize;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -543,7 +543,7 @@ xfs_stat_blksize(
|
|||
* always return the realtime extent size.
|
||||
*/
|
||||
if (XFS_IS_REALTIME_INODE(ip))
|
||||
return xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog;
|
||||
return XFS_FSB_TO_B(mp, xfs_get_extsz_hint(ip));
|
||||
|
||||
/*
|
||||
* Allow large block sizes to be reported to userspace programs if the
|
||||
|
@ -560,7 +560,7 @@ xfs_stat_blksize(
|
|||
*/
|
||||
if (mp->m_flags & XFS_MOUNT_LARGEIO) {
|
||||
if (mp->m_swidth)
|
||||
return mp->m_swidth << mp->m_sb.sb_blocklog;
|
||||
return XFS_FSB_TO_B(mp, mp->m_swidth);
|
||||
if (mp->m_flags & XFS_MOUNT_ALLOCSIZE)
|
||||
return 1U << mp->m_allocsize_log;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue