aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-06-23 21:36:58 -0400
committerAlex Elder <aelder@sgi.com>2010-07-26 14:16:36 -0400
commit898621d5a72c6799a9a13fce20443b4b6699899c (patch)
tree6cd994bd8d24f4f4f6ac5b5b57e0b99ee02d4ba6 /fs/xfs/xfs_inode.c
parent4d16e9246fc3b3cf7bc95609eff66929a39daa06 (diff)
xfs: simplify inode to transaction joining
Currently we need to either call IHOLD or xfs_trans_ihold on an inode when joining it to a transaction via xfs_trans_ijoin. This patches instead makes xfs_trans_ijoin usable on it's own by doing an implicity xfs_trans_ihold, which also allows us to drop the third argument. For the case where we want to hold a reference on the inode a xfs_trans_ijoin_ref wrapper is added which does the IHOLD and marks the inode for needing an xfs_iput. In addition to the cleaner interface to the caller this also simplifies the implementation. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index c7c48da97ad4..d22b580162cc 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1456,7 +1456,7 @@ xfs_itruncate_finish(
1456 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES); 1456 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);
1457 ASSERT(ip->i_transp == *tp); 1457 ASSERT(ip->i_transp == *tp);
1458 ASSERT(ip->i_itemp != NULL); 1458 ASSERT(ip->i_itemp != NULL);
1459 ASSERT(ip->i_itemp->ili_flags & XFS_ILI_HOLD); 1459 ASSERT(ip->i_itemp->ili_lock_flags == 0);
1460 1460
1461 1461
1462 ntp = *tp; 1462 ntp = *tp;
@@ -1608,12 +1608,8 @@ xfs_itruncate_finish(
1608 */ 1608 */
1609 error = xfs_bmap_finish(tp, &free_list, &committed); 1609 error = xfs_bmap_finish(tp, &free_list, &committed);
1610 ntp = *tp; 1610 ntp = *tp;
1611 if (committed) { 1611 if (committed)
1612 /* link the inode into the next xact in the chain */ 1612 xfs_trans_ijoin(ntp, ip);
1613 xfs_trans_ijoin(ntp, ip,
1614 XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
1615 xfs_trans_ihold(ntp, ip);
1616 }
1617 1613
1618 if (error) { 1614 if (error) {
1619 /* 1615 /*
@@ -1642,9 +1638,7 @@ xfs_itruncate_finish(
1642 error = xfs_trans_commit(*tp, 0); 1638 error = xfs_trans_commit(*tp, 0);
1643 *tp = ntp; 1639 *tp = ntp;
1644 1640
1645 /* link the inode into the next transaction in the chain */ 1641 xfs_trans_ijoin(ntp, ip);
1646 xfs_trans_ijoin(ntp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
1647 xfs_trans_ihold(ntp, ip);
1648 1642
1649 if (error) 1643 if (error)
1650 return error; 1644 return error;