@@ -767,13 +767,11 @@ xfs_inode_validate_extsize(
bool rt_flag;
bool hint_flag;
bool inherit_flag;
- uint32_t extsize_bytes;
- uint32_t blocksize_bytes;
+ uint32_t alloc_unit = 1;
rt_flag = (flags & XFS_DIFLAG_REALTIME);
hint_flag = (flags & XFS_DIFLAG_EXTSIZE);
inherit_flag = (flags & XFS_DIFLAG_EXTSZINHERIT);
- extsize_bytes = XFS_FSB_TO_B(mp, extsize);
/*
* This comment describes a historic gap in this verifier function.
@@ -802,9 +800,7 @@ xfs_inode_validate_extsize(
*/
if (rt_flag)
- blocksize_bytes = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize);
- else
- blocksize_bytes = mp->m_sb.sb_blocksize;
+ alloc_unit = mp->m_sb.sb_rextsize;
if ((hint_flag || inherit_flag) && !(S_ISDIR(mode) || S_ISREG(mode)))
return __this_address;
@@ -822,7 +818,7 @@ xfs_inode_validate_extsize(
if (mode && !(hint_flag || inherit_flag) && extsize != 0)
return __this_address;
- if (extsize_bytes % blocksize_bytes)
+ if (extsize % alloc_unit)
return __this_address;
if (extsize > XFS_MAX_BMBT_EXTLEN)
@@ -857,12 +853,10 @@ xfs_inode_validate_cowextsize(
{
bool rt_flag;
bool hint_flag;
- uint32_t cowextsize_bytes;
- uint32_t blocksize_bytes;
+ uint32_t alloc_unit = 1;
rt_flag = (flags & XFS_DIFLAG_REALTIME);
hint_flag = (flags2 & XFS_DIFLAG2_COWEXTSIZE);
- cowextsize_bytes = XFS_FSB_TO_B(mp, cowextsize);
/*
* Similar to extent size hints, a directory can be configured to
@@ -877,9 +871,7 @@ xfs_inode_validate_cowextsize(
*/
if (rt_flag)
- blocksize_bytes = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize);
- else
- blocksize_bytes = mp->m_sb.sb_blocksize;
+ alloc_unit = mp->m_sb.sb_rextsize;
if (hint_flag && !xfs_has_reflink(mp))
return __this_address;
@@ -894,7 +886,7 @@ xfs_inode_validate_cowextsize(
if (mode && !hint_flag && cowextsize != 0)
return __this_address;
- if (cowextsize_bytes % blocksize_bytes)
+ if (cowextsize % alloc_unit)
return __this_address;
if (cowextsize > XFS_MAX_BMBT_EXTLEN)