diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-05-09 11:30:48 +0200 |
---|---|---|
committer | Carlos Maiolino <cem@kernel.org> | 2023-05-10 15:01:10 +0200 |
commit | 36076dc9a1e8ae003256617c94ae9dacbd707047 (patch) | |
tree | 07afc462b01ed40a05c0efd19219a7e2e970c9bf | |
parent | c371ca854a96a99f0b94e1f431975cefd88d60cd (diff) | |
download | xfsprogs-dev-36076dc9a1e8ae003256617c94ae9dacbd707047.tar.gz |
xfs: restore old agirotor behavior
Source kernel commit: 6e2985c938e8b765b3de299c561d87f98330c546
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: 20a5eab49d35 ("xfs: convert xfs_ialloc_next_ag() to an atomic")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r-- | libxfs/xfs_ialloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index 791880a30e..50ffa82034 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -1724,7 +1724,8 @@ xfs_dialloc( * an AG has enough space for file creation. */ if (S_ISDIR(mode)) - start_agno = atomic_inc_return(&mp->m_agirotor) % mp->m_maxagi; + start_agno = (atomic_inc_return(&mp->m_agirotor) - 1) % + mp->m_maxagi; else { start_agno = XFS_INO_TO_AGNO(mp, parent); if (start_agno >= mp->m_maxagi) |