@@ -819,13 +819,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.
@@ -854,9 +852,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;
@@ -874,7 +870,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)
@@ -909,12 +905,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
@@ -929,9 +923,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;
@@ -946,7 +938,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)