Commit 4a65b7c2 authored by Brian Foster's avatar Brian Foster Committed by Darrick J. Wong

xfs: refactor allocation tree fixup code

Both algorithms duplicate the same btree allocation code. Eliminate
the duplication and reuse the fallback algorithm codepath.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent fec0afda
...@@ -1333,23 +1333,8 @@ xfs_alloc_ag_vextent_near( ...@@ -1333,23 +1333,8 @@ xfs_alloc_ag_vextent_near(
if (acur.len == 0) if (acur.len == 0)
break; break;
/*
* Allocate at the bno/len tracked in the cursor.
*/
args->agbno = acur.bno;
args->len = acur.len;
ASSERT(acur.bno >= acur.rec_bno);
ASSERT(acur.bno + acur.len <= acur.rec_bno + acur.rec_len);
ASSERT(acur.rec_bno + acur.rec_len <=
be32_to_cpu(XFS_BUF_TO_AGF(args->agbp)->agf_length));
error = xfs_alloc_fixup_trees(acur.cnt, acur.bnolt,
acur.rec_bno, acur.rec_len, acur.bno, acur.len,
0);
if (error)
goto out;
trace_xfs_alloc_near_first(args); trace_xfs_alloc_near_first(args);
goto out; goto alloc;
} }
/* /*
...@@ -1434,6 +1419,7 @@ xfs_alloc_ag_vextent_near( ...@@ -1434,6 +1419,7 @@ xfs_alloc_ag_vextent_near(
goto out; goto out;
} }
alloc:
args->agbno = acur.bno; args->agbno = acur.bno;
args->len = acur.len; args->len = acur.len;
ASSERT(acur.bno >= acur.rec_bno); ASSERT(acur.bno >= acur.rec_bno);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment