summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2020-12-09 10:05:16 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2020-12-12 10:48:24 -0800
commitf3bf6e0f1196c69a7b0412521596cd1cc7622a82 (patch)
tree74f1b2f638211db3e02c95c6cdde684ff72e5918 /fs/xfs/xfs_inode.c
parent1abcf261016e12246e1f0d2dada9c5c851a9ceb7 (diff)
xfs: move xfs_dialloc_roll() into xfs_dialloc()
Get rid of the confusing ialloc_context and failure handling around xfs_dialloc() by moving xfs_dialloc_roll() into xfs_dialloc(). Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Gao Xiang <hsiangkao@redhat.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index bc1027ce0d1f..3c4e7edec1f6 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -909,7 +909,6 @@ xfs_dir_ialloc(
prid_t prid,
struct xfs_inode **ipp)
{
- struct xfs_buf *ialloc_context = NULL;
xfs_ino_t parent_ino = dp ? dp->i_ino : 0;
xfs_ino_t ino;
int error;
@@ -918,43 +917,12 @@ xfs_dir_ialloc(
/*
* Call the space management code to pick the on-disk inode to be
- * allocated and replenish the freelist. Since we can only do one
- * allocation per transaction without deadlocks, we will need to
- * commit the current transaction and start a new one.
- * If xfs_dialloc did an allocation to replenish the freelist, it
- * returns the bp containing the head of the freelist as
- * ialloc_context. We will hold a lock on it across the transaction
- * commit so that no other process can steal the inode(s) that we've
- * just allocated.
- */
- error = xfs_dialloc(*tpp, parent_ino, mode, &ialloc_context, &ino);
+ * allocated.
+ */
+ error = xfs_dialloc(tpp, parent_ino, mode, &ino);
if (error)
return error;
- /*
- * If the AGI buffer is non-NULL, then we were unable to get an
- * inode in one operation. We need to commit the current
- * transaction and call xfs_dialloc() again. It is guaranteed
- * to succeed the second time.
- */
- if (ialloc_context) {
- error = xfs_dialloc_roll(tpp, ialloc_context);
- if (error) {
- xfs_buf_relse(ialloc_context);
- return error;
- }
- /*
- * Call dialloc again. Since we've locked out all other
- * allocations in this allocation group, this call should
- * always succeed.
- */
- error = xfs_dialloc(*tpp, parent_ino, mode, &ialloc_context,
- &ino);
- if (error)
- return error;
- ASSERT(!ialloc_context);
- }
-
if (ino == NULLFSINO)
return -ENOSPC;