diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-02-13 08:26:42 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2011-02-22 21:32:28 -0500 |
commit | ec3ba85f4083d10e32fe58b46db02d78ef71f6b8 (patch) | |
tree | bf8e3b41e913c80f24673b87fb390ce6903d82ac /fs/xfs/xfs_inode.c | |
parent | 1050c71e2925ab0cb025e4c89e08b15529a1ee36 (diff) |
xfs: more sensible inode refcounting for ialloc
Currently we return iodes from xfs_ialloc with just a single reference held.
But we need two references, as one is dropped during transaction commit and
the second needs to be transfered to the VFS. Change xfs_ialloc to use
xfs_iget plus xfs_trans_ijoin_ref to grab two references to the inode,
and remove the now superflous IHOLD calls from all callers. This also
greatly simplifies the error handling in xfs_create and also allow to remove
xfs_trans_iget as no other callers are left.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index be7cf625421f..c39278b6c871 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1016,8 +1016,8 @@ xfs_ialloc( | |||
1016 | * This is because we're setting fields here we need | 1016 | * This is because we're setting fields here we need |
1017 | * to prevent others from looking at until we're done. | 1017 | * to prevent others from looking at until we're done. |
1018 | */ | 1018 | */ |
1019 | error = xfs_trans_iget(tp->t_mountp, tp, ino, | 1019 | error = xfs_iget(tp->t_mountp, tp, ino, XFS_IGET_CREATE, |
1020 | XFS_IGET_CREATE, XFS_ILOCK_EXCL, &ip); | 1020 | XFS_ILOCK_EXCL, &ip); |
1021 | if (error) | 1021 | if (error) |
1022 | return error; | 1022 | return error; |
1023 | ASSERT(ip != NULL); | 1023 | ASSERT(ip != NULL); |
@@ -1166,6 +1166,7 @@ xfs_ialloc( | |||
1166 | /* | 1166 | /* |
1167 | * Log the new values stuffed into the inode. | 1167 | * Log the new values stuffed into the inode. |
1168 | */ | 1168 | */ |
1169 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | ||
1169 | xfs_trans_log_inode(tp, ip, flags); | 1170 | xfs_trans_log_inode(tp, ip, flags); |
1170 | 1171 | ||
1171 | /* now that we have an i_mode we can setup inode ops and unlock */ | 1172 | /* now that we have an i_mode we can setup inode ops and unlock */ |