Skip to content

Commit 6e2985c

Browse files
author
Darrick J. Wong
committed
xfs: restore old agirotor behavior
Prior to the removal of xfs_ialloc_next_ag, we would increment the agi rotor and return the *old* value. atomic_inc_return returns the new value, which causes mkfs to allocate the root directory in AG 1. Put back the old behavior (at least for mkfs) by subtracting 1 here. Fixes: 20a5eab ("xfs: convert xfs_ialloc_next_ag() to an atomic") Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]>
1 parent 60b730a commit 6e2985c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/xfs/libxfs/xfs_ialloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,8 @@ xfs_dialloc(
17291729
* an AG has enough space for file creation.
17301730
*/
17311731
if (S_ISDIR(mode))
1732-
start_agno = atomic_inc_return(&mp->m_agirotor) % mp->m_maxagi;
1732+
start_agno = (atomic_inc_return(&mp->m_agirotor) - 1) %
1733+
mp->m_maxagi;
17331734
else {
17341735
start_agno = XFS_INO_TO_AGNO(mp, parent);
17351736
if (start_agno >= mp->m_maxagi)

0 commit comments

Comments
 (0)