summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2020-10-25 17:15:54 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2020-10-26 18:32:27 -0700
commita3ced9f36afc66e028d4c4861c9c1f2afc069aab (patch)
tree4716918808766311b9c6dd046c1eb64ef9f3795f
parent886bb8aee82cbcd139f8e96b03e6b66f72d72d34 (diff)
xfs: delegate post-allocation iget
Create a post-allocation iget helper so that the upcoming libxfs hoist doesn't have to determine the xfs_iget interface. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r--fs/xfs/xfs_inode.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 6d97389209fe..64fbcee8d2ae 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -664,6 +664,21 @@ xfs_inode_inherit_flags2(
}
/*
+ * Create in-core inode for a newly allocated on-disk inode. Get the in-core
+ * inode with the lock held exclusively because we're setting fields here and
+ * need to prevent others from looking at the inode until we're done.
+ */
+static int
+xfs_ialloc_iget(
+ struct xfs_trans *tp,
+ xfs_ino_t ino,
+ struct xfs_inode **ipp)
+{
+ return xfs_iget(tp->t_mountp, tp, ino, XFS_IGET_CREATE, XFS_ILOCK_EXCL,
+ ipp);
+}
+
+/*
* Initialize a newly allocated inode with the given arguments. Heritable
* inode properties will be copied from the parent if one is supplied and the
* appropriate inode flags are set on the parent.
@@ -836,8 +851,7 @@ xfs_ialloc(
* This is because we're setting fields here we need
* to prevent others from looking at until we're done.
*/
- error = xfs_iget(mp, tp, ino, XFS_IGET_CREATE,
- XFS_ILOCK_EXCL, &ip);
+ error = xfs_ialloc_iget(tp, ino, &ip);
if (error)
return error;
ASSERT(ip != NULL);