aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_attr.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_attr.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_attr.c')
-rw-r--r--fs/xfs/xfs_attr.c75
1 files changed, 25 insertions, 50 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index 8bde79785a75..f3ca7186155a 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -319,8 +319,7 @@ xfs_attr_set_int(
319 return (error); 319 return (error);
320 } 320 }
321 321
322 xfs_trans_ijoin(args.trans, dp, XFS_ILOCK_EXCL); 322 xfs_trans_ijoin(args.trans, dp);
323 xfs_trans_ihold(args.trans, dp);
324 323
325 /* 324 /*
326 * If the attribute list is non-existent or a shortform list, 325 * If the attribute list is non-existent or a shortform list,
@@ -390,10 +389,8 @@ xfs_attr_set_int(
390 * bmap_finish() may have committed the last trans and started 389 * bmap_finish() may have committed the last trans and started
391 * a new one. We need the inode to be in all transactions. 390 * a new one. We need the inode to be in all transactions.
392 */ 391 */
393 if (committed) { 392 if (committed)
394 xfs_trans_ijoin(args.trans, dp, XFS_ILOCK_EXCL); 393 xfs_trans_ijoin(args.trans, dp);
395 xfs_trans_ihold(args.trans, dp);
396 }
397 394
398 /* 395 /*
399 * Commit the leaf transformation. We'll need another (linked) 396 * Commit the leaf transformation. We'll need another (linked)
@@ -538,8 +535,7 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags)
538 * No need to make quota reservations here. We expect to release some 535 * No need to make quota reservations here. We expect to release some
539 * blocks not allocate in the common case. 536 * blocks not allocate in the common case.
540 */ 537 */
541 xfs_trans_ijoin(args.trans, dp, XFS_ILOCK_EXCL); 538 xfs_trans_ijoin(args.trans, dp);
542 xfs_trans_ihold(args.trans, dp);
543 539
544 /* 540 /*
545 * Decide on what work routines to call based on the inode size. 541 * Decide on what work routines to call based on the inode size.
@@ -815,8 +811,7 @@ xfs_attr_inactive(xfs_inode_t *dp)
815 * No need to make quota reservations here. We expect to release some 811 * No need to make quota reservations here. We expect to release some
816 * blocks, not allocate, in the common case. 812 * blocks, not allocate, in the common case.
817 */ 813 */
818 xfs_trans_ijoin(trans, dp, XFS_ILOCK_EXCL); 814 xfs_trans_ijoin(trans, dp);
819 xfs_trans_ihold(trans, dp);
820 815
821 /* 816 /*
822 * Decide on what work routines to call based on the inode size. 817 * Decide on what work routines to call based on the inode size.
@@ -975,10 +970,8 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
975 * bmap_finish() may have committed the last trans and started 970 * bmap_finish() may have committed the last trans and started
976 * a new one. We need the inode to be in all transactions. 971 * a new one. We need the inode to be in all transactions.
977 */ 972 */
978 if (committed) { 973 if (committed)
979 xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); 974 xfs_trans_ijoin(args->trans, dp);
980 xfs_trans_ihold(args->trans, dp);
981 }
982 975
983 /* 976 /*
984 * Commit the current trans (including the inode) and start 977 * Commit the current trans (including the inode) and start
@@ -1079,10 +1072,8 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
1079 * and started a new one. We need the inode to be 1072 * and started a new one. We need the inode to be
1080 * in all transactions. 1073 * in all transactions.
1081 */ 1074 */
1082 if (committed) { 1075 if (committed)
1083 xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); 1076 xfs_trans_ijoin(args->trans, dp);
1084 xfs_trans_ihold(args->trans, dp);
1085 }
1086 } else 1077 } else
1087 xfs_da_buf_done(bp); 1078 xfs_da_buf_done(bp);
1088 1079
@@ -1155,10 +1146,8 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
1155 * bmap_finish() may have committed the last trans and started 1146 * bmap_finish() may have committed the last trans and started
1156 * a new one. We need the inode to be in all transactions. 1147 * a new one. We need the inode to be in all transactions.
1157 */ 1148 */
1158 if (committed) { 1149 if (committed)
1159 xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); 1150 xfs_trans_ijoin(args->trans, dp);
1160 xfs_trans_ihold(args->trans, dp);
1161 }
1162 } else 1151 } else
1163 xfs_da_buf_done(bp); 1152 xfs_da_buf_done(bp);
1164 return(0); 1153 return(0);
@@ -1311,10 +1300,8 @@ restart:
1311 * and started a new one. We need the inode to be 1300 * and started a new one. We need the inode to be
1312 * in all transactions. 1301 * in all transactions.
1313 */ 1302 */
1314 if (committed) { 1303 if (committed)
1315 xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); 1304 xfs_trans_ijoin(args->trans, dp);
1316 xfs_trans_ihold(args->trans, dp);
1317 }
1318 1305
1319 /* 1306 /*
1320 * Commit the node conversion and start the next 1307 * Commit the node conversion and start the next
@@ -1350,10 +1337,8 @@ restart:
1350 * bmap_finish() may have committed the last trans and started 1337 * bmap_finish() may have committed the last trans and started
1351 * a new one. We need the inode to be in all transactions. 1338 * a new one. We need the inode to be in all transactions.
1352 */ 1339 */
1353 if (committed) { 1340 if (committed)
1354 xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); 1341 xfs_trans_ijoin(args->trans, dp);
1355 xfs_trans_ihold(args->trans, dp);
1356 }
1357 } else { 1342 } else {
1358 /* 1343 /*
1359 * Addition succeeded, update Btree hashvals. 1344 * Addition succeeded, update Btree hashvals.
@@ -1464,10 +1449,8 @@ restart:
1464 * and started a new one. We need the inode to be 1449 * and started a new one. We need the inode to be
1465 * in all transactions. 1450 * in all transactions.
1466 */ 1451 */
1467 if (committed) { 1452 if (committed)
1468 xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); 1453 xfs_trans_ijoin(args->trans, dp);
1469 xfs_trans_ihold(args->trans, dp);
1470 }
1471 } 1454 }
1472 1455
1473 /* 1456 /*
@@ -1598,10 +1581,8 @@ xfs_attr_node_removename(xfs_da_args_t *args)
1598 * bmap_finish() may have committed the last trans and started 1581 * bmap_finish() may have committed the last trans and started
1599 * a new one. We need the inode to be in all transactions. 1582 * a new one. We need the inode to be in all transactions.
1600 */ 1583 */
1601 if (committed) { 1584 if (committed)
1602 xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); 1585 xfs_trans_ijoin(args->trans, dp);
1603 xfs_trans_ihold(args->trans, dp);
1604 }
1605 1586
1606 /* 1587 /*
1607 * Commit the Btree join operation and start a new trans. 1588 * Commit the Btree join operation and start a new trans.
@@ -1652,10 +1633,8 @@ xfs_attr_node_removename(xfs_da_args_t *args)
1652 * and started a new one. We need the inode to be 1633 * and started a new one. We need the inode to be
1653 * in all transactions. 1634 * in all transactions.
1654 */ 1635 */
1655 if (committed) { 1636 if (committed)
1656 xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); 1637 xfs_trans_ijoin(args->trans, dp);
1657 xfs_trans_ihold(args->trans, dp);
1658 }
1659 } else 1638 } else
1660 xfs_da_brelse(args->trans, bp); 1639 xfs_da_brelse(args->trans, bp);
1661 } 1640 }
@@ -2093,10 +2072,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
2093 * bmap_finish() may have committed the last trans and started 2072 * bmap_finish() may have committed the last trans and started
2094 * a new one. We need the inode to be in all transactions. 2073 * a new one. We need the inode to be in all transactions.
2095 */ 2074 */
2096 if (committed) { 2075 if (committed)
2097 xfs_trans_ijoin(args->trans, dp, XFS_ILOCK_EXCL); 2076 xfs_trans_ijoin(args->trans, dp);
2098 xfs_trans_ihold(args->trans, dp);
2099 }
2100 2077
2101 ASSERT(nmap == 1); 2078 ASSERT(nmap == 1);
2102 ASSERT((map.br_startblock != DELAYSTARTBLOCK) && 2079 ASSERT((map.br_startblock != DELAYSTARTBLOCK) &&
@@ -2249,10 +2226,8 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
2249 * bmap_finish() may have committed the last trans and started 2226 * bmap_finish() may have committed the last trans and started
2250 * a new one. We need the inode to be in all transactions. 2227 * a new one. We need the inode to be in all transactions.
2251 */ 2228 */
2252 if (committed) { 2229 if (committed)
2253 xfs_trans_ijoin(args->trans, args->dp, XFS_ILOCK_EXCL); 2230 xfs_trans_ijoin(args->trans, args->dp);
2254 xfs_trans_ihold(args->trans, args->dp);
2255 }
2256 2231
2257 /* 2232 /*
2258 * Close out trans and start the next one in the chain. 2233 * Close out trans and start the next one in the chain.