summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_alloc.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2019-10-14 03:10:34 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2019-10-21 19:04:58 +0300
commit4a65b7c2c72c3940a4472c49743fdb65a03a9935 (patch)
tree8552e8a82fc1c770a2fa8f5575ae24f1234bfd21 /fs/xfs/libxfs/xfs_alloc.c
parentfec0afdaf498a9a923c3688cc9f9c91a73f5bcd8 (diff)
downloadlinux-4a65b7c2c72c3940a4472c49743fdb65a03a9935.tar.xz
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: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_alloc.c')
-rw-r--r--fs/xfs/libxfs/xfs_alloc.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index 2b40842ef5f6..6428d0a79213 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -1333,23 +1333,8 @@ restart:
if (acur.len == 0)
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);
- goto out;
+ goto alloc;
}
/*
@@ -1434,6 +1419,7 @@ restart:
goto out;
}
+alloc:
args->agbno = acur.bno;
args->len = acur.len;
ASSERT(acur.bno >= acur.rec_bno);