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>
This commit is contained in:
committed by
Alex Elder
parent
1050c71e29
commit
ec3ba85f40
@@ -1016,8 +1016,8 @@ xfs_ialloc(
|
||||
* This is because we're setting fields here we need
|
||||
* to prevent others from looking at until we're done.
|
||||
*/
|
||||
error = xfs_trans_iget(tp->t_mountp, tp, ino,
|
||||
XFS_IGET_CREATE, XFS_ILOCK_EXCL, &ip);
|
||||
error = xfs_iget(tp->t_mountp, tp, ino, XFS_IGET_CREATE,
|
||||
XFS_ILOCK_EXCL, &ip);
|
||||
if (error)
|
||||
return error;
|
||||
ASSERT(ip != NULL);
|
||||
@@ -1166,6 +1166,7 @@ xfs_ialloc(
|
||||
/*
|
||||
* Log the new values stuffed into the inode.
|
||||
*/
|
||||
xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
|
||||
xfs_trans_log_inode(tp, ip, flags);
|
||||
|
||||
/* now that we have an i_mode we can setup inode ops and unlock */
|
||||
|
Reference in New Issue
Block a user