summaryrefslogtreecommitdiffstats
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:25 -0800
commit8d822dc38ad781b1bfa5c03227da80dbd87e9959 (patch)
tree1f0b1258241bbd07d19eaa546e126b149f7e89b4 /fs/xfs/xfs_inode.c
parentf3bf6e0f1196c69a7b0412521596cd1cc7622a82 (diff)
downloadlinux-8d822dc38ad781b1bfa5c03227da80dbd87e9959.tar.gz
linux-8d822dc38ad781b1bfa5c03227da80dbd87e9959.tar.bz2
linux-8d822dc38ad781b1bfa5c03227da80dbd87e9959.zip
xfs: spilt xfs_dialloc() into 2 functions
This patch explicitly separates free inode chunk allocation and inode allocation into two individual high level operations. 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.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);
}