summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 3c4e7edec1f6..b7352bc4c815 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -909,6 +909,7 @@ xfs_dir_ialloc(
prid_t prid,
struct xfs_inode **ipp)
{
+ struct xfs_buf *agibp;
xfs_ino_t parent_ino = dp ? dp->i_ino : 0;
xfs_ino_t ino;
int error;
@@ -919,13 +920,19 @@ xfs_dir_ialloc(
* Call the space management code to pick the on-disk inode to be
* allocated.
*/
- error = xfs_dialloc(tpp, parent_ino, mode, &ino);
+ error = xfs_dialloc_select_ag(tpp, parent_ino, mode, &agibp);
if (error)
return error;
- if (ino == NULLFSINO)
+ if (!agibp)
return -ENOSPC;
+ /* Allocate an inode from the selected AG */
+ error = xfs_dialloc_ag(*tpp, agibp, parent_ino, &ino);
+ if (error)
+ return error;
+ ASSERT(ino != NULLFSINO);
+
return xfs_init_new_inode(*tpp, dp, ino, mode, nlink, rdev, prid, ipp);
}