diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-09-19 11:00:54 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2011-10-11 22:15:08 -0400 |
commit | ddc3415aba1cb2f86d1fcad720cea834ee178f54 (patch) | |
tree | 7a31a932ce0b7080557be062ccc7c3c0e181b140 /fs/xfs | |
parent | 23bb0be1a237c8732ce1a43140e5cb103a676b92 (diff) |
xfs: simplify xfs_trans_ijoin* again
There is no reason to keep a reference to the inode even if we unlock
it during transaction commit because we never drop a reference between
the ijoin and commit. Also use this fact to merge xfs_trans_ijoin_ref
back into xfs_trans_ijoin - the third argument decides if an unlock
is needed now.
I'm actually starting to wonder if allowing inodes to be unlocked
at transaction commit really is worth the effort. The only real
benefit is that they can be unlocked earlier when commiting a
synchronous transactions, but that could be solved by doing the
log force manually after the unlock, too.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_attr.c | 28 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dfrag.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_iomap.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_iops.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_qm_syscalls.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_rename.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_rtalloc.c | 10 | ||||
-rw-r--r-- | fs/xfs/xfs_super.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_inode.c | 25 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 34 |
18 files changed, 65 insertions, 83 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 5484766938f9..981a0624f382 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -319,7 +319,7 @@ xfs_attr_set_int( | |||
319 | return (error); | 319 | return (error); |
320 | } | 320 | } |
321 | 321 | ||
322 | xfs_trans_ijoin(args.trans, dp); | 322 | xfs_trans_ijoin(args.trans, dp, 0); |
323 | 323 | ||
324 | /* | 324 | /* |
325 | * If the attribute list is non-existent or a shortform list, | 325 | * If the attribute list is non-existent or a shortform list, |
@@ -389,7 +389,7 @@ xfs_attr_set_int( | |||
389 | * a new one. We need the inode to be in all transactions. | 389 | * a new one. We need the inode to be in all transactions. |
390 | */ | 390 | */ |
391 | if (committed) | 391 | if (committed) |
392 | xfs_trans_ijoin(args.trans, dp); | 392 | xfs_trans_ijoin(args.trans, dp, 0); |
393 | 393 | ||
394 | /* | 394 | /* |
395 | * Commit the leaf transformation. We'll need another (linked) | 395 | * Commit the leaf transformation. We'll need another (linked) |
@@ -537,7 +537,7 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags) | |||
537 | * No need to make quota reservations here. We expect to release some | 537 | * No need to make quota reservations here. We expect to release some |
538 | * blocks not allocate in the common case. | 538 | * blocks not allocate in the common case. |
539 | */ | 539 | */ |
540 | xfs_trans_ijoin(args.trans, dp); | 540 | xfs_trans_ijoin(args.trans, dp, 0); |
541 | 541 | ||
542 | /* | 542 | /* |
543 | * Decide on what work routines to call based on the inode size. | 543 | * Decide on what work routines to call based on the inode size. |
@@ -809,7 +809,7 @@ xfs_attr_inactive(xfs_inode_t *dp) | |||
809 | * No need to make quota reservations here. We expect to release some | 809 | * No need to make quota reservations here. We expect to release some |
810 | * blocks, not allocate, in the common case. | 810 | * blocks, not allocate, in the common case. |
811 | */ | 811 | */ |
812 | xfs_trans_ijoin(trans, dp); | 812 | xfs_trans_ijoin(trans, dp, 0); |
813 | 813 | ||
814 | /* | 814 | /* |
815 | * Decide on what work routines to call based on the inode size. | 815 | * Decide on what work routines to call based on the inode size. |
@@ -961,7 +961,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
961 | * a new one. We need the inode to be in all transactions. | 961 | * a new one. We need the inode to be in all transactions. |
962 | */ | 962 | */ |
963 | if (committed) | 963 | if (committed) |
964 | xfs_trans_ijoin(args->trans, dp); | 964 | xfs_trans_ijoin(args->trans, dp, 0); |
965 | 965 | ||
966 | /* | 966 | /* |
967 | * Commit the current trans (including the inode) and start | 967 | * Commit the current trans (including the inode) and start |
@@ -1063,7 +1063,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) | |||
1063 | * in all transactions. | 1063 | * in all transactions. |
1064 | */ | 1064 | */ |
1065 | if (committed) | 1065 | if (committed) |
1066 | xfs_trans_ijoin(args->trans, dp); | 1066 | xfs_trans_ijoin(args->trans, dp, 0); |
1067 | } else | 1067 | } else |
1068 | xfs_da_buf_done(bp); | 1068 | xfs_da_buf_done(bp); |
1069 | 1069 | ||
@@ -1137,7 +1137,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) | |||
1137 | * a new one. We need the inode to be in all transactions. | 1137 | * a new one. We need the inode to be in all transactions. |
1138 | */ | 1138 | */ |
1139 | if (committed) | 1139 | if (committed) |
1140 | xfs_trans_ijoin(args->trans, dp); | 1140 | xfs_trans_ijoin(args->trans, dp, 0); |
1141 | } else | 1141 | } else |
1142 | xfs_da_buf_done(bp); | 1142 | xfs_da_buf_done(bp); |
1143 | return(0); | 1143 | return(0); |
@@ -1291,7 +1291,7 @@ restart: | |||
1291 | * in all transactions. | 1291 | * in all transactions. |
1292 | */ | 1292 | */ |
1293 | if (committed) | 1293 | if (committed) |
1294 | xfs_trans_ijoin(args->trans, dp); | 1294 | xfs_trans_ijoin(args->trans, dp, 0); |
1295 | 1295 | ||
1296 | /* | 1296 | /* |
1297 | * Commit the node conversion and start the next | 1297 | * Commit the node conversion and start the next |
@@ -1328,7 +1328,7 @@ restart: | |||
1328 | * a new one. We need the inode to be in all transactions. | 1328 | * a new one. We need the inode to be in all transactions. |
1329 | */ | 1329 | */ |
1330 | if (committed) | 1330 | if (committed) |
1331 | xfs_trans_ijoin(args->trans, dp); | 1331 | xfs_trans_ijoin(args->trans, dp, 0); |
1332 | } else { | 1332 | } else { |
1333 | /* | 1333 | /* |
1334 | * Addition succeeded, update Btree hashvals. | 1334 | * Addition succeeded, update Btree hashvals. |
@@ -1440,7 +1440,7 @@ restart: | |||
1440 | * in all transactions. | 1440 | * in all transactions. |
1441 | */ | 1441 | */ |
1442 | if (committed) | 1442 | if (committed) |
1443 | xfs_trans_ijoin(args->trans, dp); | 1443 | xfs_trans_ijoin(args->trans, dp, 0); |
1444 | } | 1444 | } |
1445 | 1445 | ||
1446 | /* | 1446 | /* |
@@ -1572,7 +1572,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1572 | * a new one. We need the inode to be in all transactions. | 1572 | * a new one. We need the inode to be in all transactions. |
1573 | */ | 1573 | */ |
1574 | if (committed) | 1574 | if (committed) |
1575 | xfs_trans_ijoin(args->trans, dp); | 1575 | xfs_trans_ijoin(args->trans, dp, 0); |
1576 | 1576 | ||
1577 | /* | 1577 | /* |
1578 | * Commit the Btree join operation and start a new trans. | 1578 | * Commit the Btree join operation and start a new trans. |
@@ -1623,7 +1623,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) | |||
1623 | * in all transactions. | 1623 | * in all transactions. |
1624 | */ | 1624 | */ |
1625 | if (committed) | 1625 | if (committed) |
1626 | xfs_trans_ijoin(args->trans, dp); | 1626 | xfs_trans_ijoin(args->trans, dp, 0); |
1627 | } else | 1627 | } else |
1628 | xfs_da_brelse(args->trans, bp); | 1628 | xfs_da_brelse(args->trans, bp); |
1629 | } | 1629 | } |
@@ -2060,7 +2060,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2060 | * a new one. We need the inode to be in all transactions. | 2060 | * a new one. We need the inode to be in all transactions. |
2061 | */ | 2061 | */ |
2062 | if (committed) | 2062 | if (committed) |
2063 | xfs_trans_ijoin(args->trans, dp); | 2063 | xfs_trans_ijoin(args->trans, dp, 0); |
2064 | 2064 | ||
2065 | ASSERT(nmap == 1); | 2065 | ASSERT(nmap == 1); |
2066 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && | 2066 | ASSERT((map.br_startblock != DELAYSTARTBLOCK) && |
@@ -2207,7 +2207,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2207 | * a new one. We need the inode to be in all transactions. | 2207 | * a new one. We need the inode to be in all transactions. |
2208 | */ | 2208 | */ |
2209 | if (committed) | 2209 | if (committed) |
2210 | xfs_trans_ijoin(args->trans, args->dp); | 2210 | xfs_trans_ijoin(args->trans, args->dp, 0); |
2211 | 2211 | ||
2212 | /* | 2212 | /* |
2213 | * Close out trans and start the next one in the chain. | 2213 | * Close out trans and start the next one in the chain. |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index bb31d37bf49b..c68baeb0974a 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -2195,7 +2195,7 @@ xfs_bmap_rtalloc( | |||
2195 | * Lock out other modifications to the RT bitmap inode. | 2195 | * Lock out other modifications to the RT bitmap inode. |
2196 | */ | 2196 | */ |
2197 | xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL); | 2197 | xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL); |
2198 | xfs_trans_ijoin_ref(ap->tp, mp->m_rbmip, XFS_ILOCK_EXCL); | 2198 | xfs_trans_ijoin(ap->tp, mp->m_rbmip, XFS_ILOCK_EXCL); |
2199 | 2199 | ||
2200 | /* | 2200 | /* |
2201 | * If it's an allocation to an empty file at offset 0, | 2201 | * If it's an allocation to an empty file at offset 0, |
@@ -3460,7 +3460,7 @@ xfs_bmap_add_attrfork( | |||
3460 | } | 3460 | } |
3461 | ASSERT(ip->i_d.di_anextents == 0); | 3461 | ASSERT(ip->i_d.di_anextents == 0); |
3462 | 3462 | ||
3463 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | 3463 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
3464 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 3464 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
3465 | 3465 | ||
3466 | switch (ip->i_d.di_format) { | 3466 | switch (ip->i_d.di_format) { |
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c index 645387b69738..654dc6f05bac 100644 --- a/fs/xfs/xfs_dfrag.c +++ b/fs/xfs/xfs_dfrag.c | |||
@@ -425,8 +425,8 @@ xfs_swap_extents( | |||
425 | } | 425 | } |
426 | 426 | ||
427 | 427 | ||
428 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 428 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
429 | xfs_trans_ijoin_ref(tp, tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 429 | xfs_trans_ijoin(tp, tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
430 | 430 | ||
431 | xfs_trans_log_inode(tp, ip, ilf_fields); | 431 | xfs_trans_log_inode(tp, ip, ilf_fields); |
432 | xfs_trans_log_inode(tp, tip, tilf_fields); | 432 | xfs_trans_log_inode(tp, tip, tilf_fields); |
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 179673531f20..c597bfe4ada0 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
@@ -377,7 +377,7 @@ xfs_qm_dqalloc( | |||
377 | return (ESRCH); | 377 | return (ESRCH); |
378 | } | 378 | } |
379 | 379 | ||
380 | xfs_trans_ijoin_ref(tp, quotip, XFS_ILOCK_EXCL); | 380 | xfs_trans_ijoin(tp, quotip, XFS_ILOCK_EXCL); |
381 | nmaps = 1; | 381 | nmaps = 1; |
382 | error = xfs_bmapi_write(tp, quotip, offset_fsb, | 382 | error = xfs_bmapi_write(tp, quotip, offset_fsb, |
383 | XFS_DQUOT_CLUSTER_SIZE_FSB, XFS_BMAPI_METADATA, | 383 | XFS_DQUOT_CLUSTER_SIZE_FSB, XFS_BMAPI_METADATA, |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index d8ef02eb178a..0b600b51778c 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -213,7 +213,7 @@ xfs_file_fsync( | |||
213 | * transaction. So we play it safe and fire off the | 213 | * transaction. So we play it safe and fire off the |
214 | * transaction anyway. | 214 | * transaction anyway. |
215 | */ | 215 | */ |
216 | xfs_trans_ijoin(tp, ip); | 216 | xfs_trans_ijoin(tp, ip, 0); |
217 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 217 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
218 | error = xfs_trans_commit(tp, 0); | 218 | error = xfs_trans_commit(tp, 0); |
219 | 219 | ||
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index f690d3a10b34..b676494a55ca 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1152,7 +1152,7 @@ xfs_ialloc( | |||
1152 | /* | 1152 | /* |
1153 | * Log the new values stuffed into the inode. | 1153 | * Log the new values stuffed into the inode. |
1154 | */ | 1154 | */ |
1155 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | 1155 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
1156 | xfs_trans_log_inode(tp, ip, flags); | 1156 | xfs_trans_log_inode(tp, ip, flags); |
1157 | 1157 | ||
1158 | /* now that we have an i_mode we can setup inode ops and unlock */ | 1158 | /* now that we have an i_mode we can setup inode ops and unlock */ |
@@ -1297,7 +1297,7 @@ xfs_itruncate_extents( | |||
1297 | */ | 1297 | */ |
1298 | error = xfs_bmap_finish(&tp, &free_list, &committed); | 1298 | error = xfs_bmap_finish(&tp, &free_list, &committed); |
1299 | if (committed) | 1299 | if (committed) |
1300 | xfs_trans_ijoin(tp, ip); | 1300 | xfs_trans_ijoin(tp, ip, 0); |
1301 | if (error) | 1301 | if (error) |
1302 | goto out_bmap_cancel; | 1302 | goto out_bmap_cancel; |
1303 | 1303 | ||
@@ -1313,7 +1313,7 @@ xfs_itruncate_extents( | |||
1313 | error = xfs_trans_commit(tp, 0); | 1313 | error = xfs_trans_commit(tp, 0); |
1314 | tp = ntp; | 1314 | tp = ntp; |
1315 | 1315 | ||
1316 | xfs_trans_ijoin(tp, ip); | 1316 | xfs_trans_ijoin(tp, ip, 0); |
1317 | 1317 | ||
1318 | if (error) | 1318 | if (error) |
1319 | goto out; | 1319 | goto out; |
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 588406dc6a35..8704a99241d7 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -658,10 +658,8 @@ xfs_inode_item_unlock( | |||
658 | 658 | ||
659 | lock_flags = iip->ili_lock_flags; | 659 | lock_flags = iip->ili_lock_flags; |
660 | iip->ili_lock_flags = 0; | 660 | iip->ili_lock_flags = 0; |
661 | if (lock_flags) { | 661 | if (lock_flags) |
662 | xfs_iunlock(ip, lock_flags); | 662 | xfs_iunlock(ip, lock_flags); |
663 | IRELE(ip); | ||
664 | } | ||
665 | } | 663 | } |
666 | 664 | ||
667 | /* | 665 | /* |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index f7ce7debe14c..d99a90518909 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
@@ -1069,7 +1069,7 @@ xfs_ioctl_setattr( | |||
1069 | } | 1069 | } |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | xfs_trans_ijoin(tp, ip); | 1072 | xfs_trans_ijoin(tp, ip, 0); |
1073 | 1073 | ||
1074 | /* | 1074 | /* |
1075 | * Change file ownership. Must be the owner or privileged. | 1075 | * Change file ownership. Must be the owner or privileged. |
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index da5bf05c5bb7..9afa282aa937 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -208,7 +208,7 @@ xfs_iomap_write_direct( | |||
208 | if (error) | 208 | if (error) |
209 | goto error1; | 209 | goto error1; |
210 | 210 | ||
211 | xfs_trans_ijoin(tp, ip); | 211 | xfs_trans_ijoin(tp, ip, 0); |
212 | 212 | ||
213 | bmapi_flag = 0; | 213 | bmapi_flag = 0; |
214 | if (offset < ip->i_size || extsz) | 214 | if (offset < ip->i_size || extsz) |
@@ -528,7 +528,7 @@ xfs_iomap_write_allocate( | |||
528 | return XFS_ERROR(error); | 528 | return XFS_ERROR(error); |
529 | } | 529 | } |
530 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 530 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
531 | xfs_trans_ijoin(tp, ip); | 531 | xfs_trans_ijoin(tp, ip, 0); |
532 | 532 | ||
533 | xfs_bmap_init(&free_list, &first_block); | 533 | xfs_bmap_init(&free_list, &first_block); |
534 | 534 | ||
@@ -692,7 +692,7 @@ xfs_iomap_write_unwritten( | |||
692 | } | 692 | } |
693 | 693 | ||
694 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 694 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
695 | xfs_trans_ijoin(tp, ip); | 695 | xfs_trans_ijoin(tp, ip, 0); |
696 | 696 | ||
697 | /* | 697 | /* |
698 | * Modify the unwritten extent state of the buffer. | 698 | * Modify the unwritten extent state of the buffer. |
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index e6b3e7620888..556bbe7751b7 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -611,7 +611,7 @@ xfs_setattr_nonsize( | |||
611 | } | 611 | } |
612 | } | 612 | } |
613 | 613 | ||
614 | xfs_trans_ijoin(tp, ip); | 614 | xfs_trans_ijoin(tp, ip, 0); |
615 | 615 | ||
616 | /* | 616 | /* |
617 | * Change file ownership. Must be the owner or privileged. | 617 | * Change file ownership. Must be the owner or privileged. |
@@ -863,7 +863,7 @@ xfs_setattr_size( | |||
863 | 863 | ||
864 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 864 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
865 | 865 | ||
866 | xfs_trans_ijoin(tp, ip); | 866 | xfs_trans_ijoin(tp, ip, 0); |
867 | 867 | ||
868 | /* | 868 | /* |
869 | * Only change the c/mtime if we are changing the size or we are | 869 | * Only change the c/mtime if we are changing the size or we are |
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index 609246f42e6c..5cc3dde1bc90 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c | |||
@@ -261,7 +261,7 @@ xfs_qm_scall_trunc_qfile( | |||
261 | } | 261 | } |
262 | 262 | ||
263 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 263 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
264 | xfs_trans_ijoin(tp, ip); | 264 | xfs_trans_ijoin(tp, ip, 0); |
265 | 265 | ||
266 | error = xfs_itruncate_data(&tp, ip, 0); | 266 | error = xfs_itruncate_data(&tp, ip, 0); |
267 | if (error) { | 267 | if (error) { |
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index df78c297d1a1..866de277079a 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
@@ -170,12 +170,12 @@ xfs_rename( | |||
170 | * we can rely on either trans_commit or trans_cancel to unlock | 170 | * we can rely on either trans_commit or trans_cancel to unlock |
171 | * them. | 171 | * them. |
172 | */ | 172 | */ |
173 | xfs_trans_ijoin_ref(tp, src_dp, XFS_ILOCK_EXCL); | 173 | xfs_trans_ijoin(tp, src_dp, XFS_ILOCK_EXCL); |
174 | if (new_parent) | 174 | if (new_parent) |
175 | xfs_trans_ijoin_ref(tp, target_dp, XFS_ILOCK_EXCL); | 175 | xfs_trans_ijoin(tp, target_dp, XFS_ILOCK_EXCL); |
176 | xfs_trans_ijoin_ref(tp, src_ip, XFS_ILOCK_EXCL); | 176 | xfs_trans_ijoin(tp, src_ip, XFS_ILOCK_EXCL); |
177 | if (target_ip) | 177 | if (target_ip) |
178 | xfs_trans_ijoin_ref(tp, target_ip, XFS_ILOCK_EXCL); | 178 | xfs_trans_ijoin(tp, target_ip, XFS_ILOCK_EXCL); |
179 | 179 | ||
180 | /* | 180 | /* |
181 | * If we are using project inheritance, we only allow renames | 181 | * If we are using project inheritance, we only allow renames |
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index f29424964521..87323f1ded64 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
@@ -112,7 +112,7 @@ xfs_growfs_rt_alloc( | |||
112 | * Lock the inode. | 112 | * Lock the inode. |
113 | */ | 113 | */ |
114 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 114 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
115 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | 115 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
116 | 116 | ||
117 | xfs_bmap_init(&flist, &firstblock); | 117 | xfs_bmap_init(&flist, &firstblock); |
118 | /* | 118 | /* |
@@ -155,7 +155,7 @@ xfs_growfs_rt_alloc( | |||
155 | * Lock the bitmap inode. | 155 | * Lock the bitmap inode. |
156 | */ | 156 | */ |
157 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 157 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
158 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | 158 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
159 | /* | 159 | /* |
160 | * Get a buffer for the block. | 160 | * Get a buffer for the block. |
161 | */ | 161 | */ |
@@ -1960,7 +1960,7 @@ xfs_growfs_rt( | |||
1960 | * Lock out other callers by grabbing the bitmap inode lock. | 1960 | * Lock out other callers by grabbing the bitmap inode lock. |
1961 | */ | 1961 | */ |
1962 | xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL); | 1962 | xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL); |
1963 | xfs_trans_ijoin_ref(tp, mp->m_rbmip, XFS_ILOCK_EXCL); | 1963 | xfs_trans_ijoin(tp, mp->m_rbmip, XFS_ILOCK_EXCL); |
1964 | /* | 1964 | /* |
1965 | * Update the bitmap inode's size. | 1965 | * Update the bitmap inode's size. |
1966 | */ | 1966 | */ |
@@ -1972,7 +1972,7 @@ xfs_growfs_rt( | |||
1972 | * Get the summary inode into the transaction. | 1972 | * Get the summary inode into the transaction. |
1973 | */ | 1973 | */ |
1974 | xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL); | 1974 | xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL); |
1975 | xfs_trans_ijoin_ref(tp, mp->m_rsumip, XFS_ILOCK_EXCL); | 1975 | xfs_trans_ijoin(tp, mp->m_rsumip, XFS_ILOCK_EXCL); |
1976 | /* | 1976 | /* |
1977 | * Update the summary inode's size. | 1977 | * Update the summary inode's size. |
1978 | */ | 1978 | */ |
@@ -2143,7 +2143,7 @@ xfs_rtfree_extent( | |||
2143 | * Synchronize by locking the bitmap inode. | 2143 | * Synchronize by locking the bitmap inode. |
2144 | */ | 2144 | */ |
2145 | xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL); | 2145 | xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL); |
2146 | xfs_trans_ijoin_ref(tp, mp->m_rbmip, XFS_ILOCK_EXCL); | 2146 | xfs_trans_ijoin(tp, mp->m_rbmip, XFS_ILOCK_EXCL); |
2147 | 2147 | ||
2148 | #if defined(__KERNEL__) && defined(DEBUG) | 2148 | #if defined(__KERNEL__) && defined(DEBUG) |
2149 | /* | 2149 | /* |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 54d5e102ffe1..6ad05e68abda 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -884,7 +884,7 @@ xfs_log_inode( | |||
884 | } | 884 | } |
885 | 885 | ||
886 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 886 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
887 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | 887 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
888 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 888 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
889 | return xfs_trans_commit(tp, 0); | 889 | return xfs_trans_commit(tp, 0); |
890 | } | 890 | } |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index b64c8c79736a..1f35b2feca97 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
@@ -2018,6 +2018,6 @@ xfs_trans_roll( | |||
2018 | if (error) | 2018 | if (error) |
2019 | return error; | 2019 | return error; |
2020 | 2020 | ||
2021 | xfs_trans_ijoin(trans, dp); | 2021 | xfs_trans_ijoin(trans, dp, 0); |
2022 | return 0; | 2022 | return 0; |
2023 | } | 2023 | } |
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 54b0b1cc3e3f..f5df16969f82 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
@@ -470,8 +470,7 @@ void xfs_trans_stale_inode_buf(xfs_trans_t *, struct xfs_buf *); | |||
470 | void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint); | 470 | void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint); |
471 | void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *); | 471 | void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *); |
472 | void xfs_trans_ichgtime(struct xfs_trans *, struct xfs_inode *, int); | 472 | void xfs_trans_ichgtime(struct xfs_trans *, struct xfs_inode *, int); |
473 | void xfs_trans_ijoin_ref(struct xfs_trans *, struct xfs_inode *, uint); | 473 | void xfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *, uint); |
474 | void xfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *); | ||
475 | void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint); | 474 | void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint); |
476 | void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint); | 475 | void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint); |
477 | struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint); | 476 | struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint); |
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c index c8dea2fd7e68..32f0288ae10f 100644 --- a/fs/xfs/xfs_trans_inode.c +++ b/fs/xfs/xfs_trans_inode.c | |||
@@ -47,11 +47,13 @@ xfs_trans_inode_broot_debug( | |||
47 | * Add a locked inode to the transaction. | 47 | * Add a locked inode to the transaction. |
48 | * | 48 | * |
49 | * The inode must be locked, and it cannot be associated with any transaction. | 49 | * The inode must be locked, and it cannot be associated with any transaction. |
50 | * If lock_flags is non-zero the inode will be unlocked on transaction commit. | ||
50 | */ | 51 | */ |
51 | void | 52 | void |
52 | xfs_trans_ijoin( | 53 | xfs_trans_ijoin( |
53 | struct xfs_trans *tp, | 54 | struct xfs_trans *tp, |
54 | struct xfs_inode *ip) | 55 | struct xfs_inode *ip, |
56 | uint lock_flags) | ||
55 | { | 57 | { |
56 | xfs_inode_log_item_t *iip; | 58 | xfs_inode_log_item_t *iip; |
57 | 59 | ||
@@ -59,7 +61,9 @@ xfs_trans_ijoin( | |||
59 | if (ip->i_itemp == NULL) | 61 | if (ip->i_itemp == NULL) |
60 | xfs_inode_item_init(ip, ip->i_mount); | 62 | xfs_inode_item_init(ip, ip->i_mount); |
61 | iip = ip->i_itemp; | 63 | iip = ip->i_itemp; |
64 | |||
62 | ASSERT(iip->ili_lock_flags == 0); | 65 | ASSERT(iip->ili_lock_flags == 0); |
66 | iip->ili_lock_flags = lock_flags; | ||
63 | 67 | ||
64 | /* | 68 | /* |
65 | * Get a log_item_desc to point at the new item. | 69 | * Get a log_item_desc to point at the new item. |
@@ -70,25 +74,6 @@ xfs_trans_ijoin( | |||
70 | } | 74 | } |
71 | 75 | ||
72 | /* | 76 | /* |
73 | * Add a locked inode to the transaction. | ||
74 | * | ||
75 | * | ||
76 | * Grabs a reference to the inode which will be dropped when the transaction | ||
77 | * is committed. The inode will also be unlocked at that point. The inode | ||
78 | * must be locked, and it cannot be associated with any transaction. | ||
79 | */ | ||
80 | void | ||
81 | xfs_trans_ijoin_ref( | ||
82 | struct xfs_trans *tp, | ||
83 | struct xfs_inode *ip, | ||
84 | uint lock_flags) | ||
85 | { | ||
86 | xfs_trans_ijoin(tp, ip); | ||
87 | IHOLD(ip); | ||
88 | ip->i_itemp->ili_lock_flags = lock_flags; | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * Transactional inode timestamp update. Requires the inode to be locked and | 77 | * Transactional inode timestamp update. Requires the inode to be locked and |
93 | * joined to the transaction supplied. Relies on the transaction subsystem to | 78 | * joined to the transaction supplied. Relies on the transaction subsystem to |
94 | * track dirty state and update/writeback the inode accordingly. | 79 | * track dirty state and update/writeback the inode accordingly. |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index c9c8e8230b21..fc38f15808c6 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -219,7 +219,7 @@ xfs_free_eofblocks( | |||
219 | } | 219 | } |
220 | 220 | ||
221 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 221 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
222 | xfs_trans_ijoin(tp, ip); | 222 | xfs_trans_ijoin(tp, ip, 0); |
223 | 223 | ||
224 | error = xfs_itruncate_data(&tp, ip, ip->i_size); | 224 | error = xfs_itruncate_data(&tp, ip, ip->i_size); |
225 | if (error) { | 225 | if (error) { |
@@ -288,7 +288,7 @@ xfs_inactive_symlink_rmt( | |||
288 | xfs_ilock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 288 | xfs_ilock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); |
289 | size = (int)ip->i_d.di_size; | 289 | size = (int)ip->i_d.di_size; |
290 | ip->i_d.di_size = 0; | 290 | ip->i_d.di_size = 0; |
291 | xfs_trans_ijoin(tp, ip); | 291 | xfs_trans_ijoin(tp, ip, 0); |
292 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 292 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
293 | /* | 293 | /* |
294 | * Find the block(s) so we can inval and unmap them. | 294 | * Find the block(s) so we can inval and unmap them. |
@@ -336,7 +336,7 @@ xfs_inactive_symlink_rmt( | |||
336 | * Mark it dirty so it will be logged and moved forward in the log as | 336 | * Mark it dirty so it will be logged and moved forward in the log as |
337 | * part of every commit. | 337 | * part of every commit. |
338 | */ | 338 | */ |
339 | xfs_trans_ijoin(tp, ip); | 339 | xfs_trans_ijoin(tp, ip, 0); |
340 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 340 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
341 | /* | 341 | /* |
342 | * Get a new, empty transaction to return to our caller. | 342 | * Get a new, empty transaction to return to our caller. |
@@ -469,7 +469,7 @@ xfs_inactive_attrs( | |||
469 | goto error_cancel; | 469 | goto error_cancel; |
470 | 470 | ||
471 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 471 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
472 | xfs_trans_ijoin(tp, ip); | 472 | xfs_trans_ijoin(tp, ip, 0); |
473 | xfs_idestroy_fork(ip, XFS_ATTR_FORK); | 473 | xfs_idestroy_fork(ip, XFS_ATTR_FORK); |
474 | 474 | ||
475 | ASSERT(ip->i_d.di_anextents == 0); | 475 | ASSERT(ip->i_d.di_anextents == 0); |
@@ -663,7 +663,7 @@ xfs_inactive( | |||
663 | } | 663 | } |
664 | 664 | ||
665 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 665 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
666 | xfs_trans_ijoin(tp, ip); | 666 | xfs_trans_ijoin(tp, ip, 0); |
667 | 667 | ||
668 | error = xfs_itruncate_data(&tp, ip, 0); | 668 | error = xfs_itruncate_data(&tp, ip, 0); |
669 | if (error) { | 669 | if (error) { |
@@ -687,7 +687,7 @@ xfs_inactive( | |||
687 | return VN_INACTIVE_CACHE; | 687 | return VN_INACTIVE_CACHE; |
688 | } | 688 | } |
689 | 689 | ||
690 | xfs_trans_ijoin(tp, ip); | 690 | xfs_trans_ijoin(tp, ip, 0); |
691 | } else { | 691 | } else { |
692 | error = xfs_trans_reserve(tp, 0, | 692 | error = xfs_trans_reserve(tp, 0, |
693 | XFS_IFREE_LOG_RES(mp), | 693 | XFS_IFREE_LOG_RES(mp), |
@@ -700,7 +700,7 @@ xfs_inactive( | |||
700 | } | 700 | } |
701 | 701 | ||
702 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 702 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
703 | xfs_trans_ijoin(tp, ip); | 703 | xfs_trans_ijoin(tp, ip, 0); |
704 | } | 704 | } |
705 | 705 | ||
706 | /* | 706 | /* |
@@ -940,7 +940,7 @@ xfs_create( | |||
940 | * the transaction cancel unlocking dp so don't do it explicitly in the | 940 | * the transaction cancel unlocking dp so don't do it explicitly in the |
941 | * error path. | 941 | * error path. |
942 | */ | 942 | */ |
943 | xfs_trans_ijoin_ref(tp, dp, XFS_ILOCK_EXCL); | 943 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
944 | unlock_dp_on_error = B_FALSE; | 944 | unlock_dp_on_error = B_FALSE; |
945 | 945 | ||
946 | error = xfs_dir_createname(tp, dp, name, ip->i_ino, | 946 | error = xfs_dir_createname(tp, dp, name, ip->i_ino, |
@@ -1261,8 +1261,8 @@ xfs_remove( | |||
1261 | 1261 | ||
1262 | xfs_lock_two_inodes(dp, ip, XFS_ILOCK_EXCL); | 1262 | xfs_lock_two_inodes(dp, ip, XFS_ILOCK_EXCL); |
1263 | 1263 | ||
1264 | xfs_trans_ijoin_ref(tp, dp, XFS_ILOCK_EXCL); | 1264 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
1265 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | 1265 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
1266 | 1266 | ||
1267 | /* | 1267 | /* |
1268 | * If we're removing a directory perform some additional validation. | 1268 | * If we're removing a directory perform some additional validation. |
@@ -1407,8 +1407,8 @@ xfs_link( | |||
1407 | 1407 | ||
1408 | xfs_lock_two_inodes(sip, tdp, XFS_ILOCK_EXCL); | 1408 | xfs_lock_two_inodes(sip, tdp, XFS_ILOCK_EXCL); |
1409 | 1409 | ||
1410 | xfs_trans_ijoin_ref(tp, sip, XFS_ILOCK_EXCL); | 1410 | xfs_trans_ijoin(tp, sip, XFS_ILOCK_EXCL); |
1411 | xfs_trans_ijoin_ref(tp, tdp, XFS_ILOCK_EXCL); | 1411 | xfs_trans_ijoin(tp, tdp, XFS_ILOCK_EXCL); |
1412 | 1412 | ||
1413 | /* | 1413 | /* |
1414 | * If the source has too many links, we can't make any more to it. | 1414 | * If the source has too many links, we can't make any more to it. |
@@ -1602,7 +1602,7 @@ xfs_symlink( | |||
1602 | * transaction cancel unlocking dp so don't do it explicitly in the | 1602 | * transaction cancel unlocking dp so don't do it explicitly in the |
1603 | * error path. | 1603 | * error path. |
1604 | */ | 1604 | */ |
1605 | xfs_trans_ijoin_ref(tp, dp, XFS_ILOCK_EXCL); | 1605 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
1606 | unlock_dp_on_error = B_FALSE; | 1606 | unlock_dp_on_error = B_FALSE; |
1607 | 1607 | ||
1608 | /* | 1608 | /* |
@@ -1735,7 +1735,7 @@ xfs_set_dmattrs( | |||
1735 | return error; | 1735 | return error; |
1736 | } | 1736 | } |
1737 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 1737 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
1738 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | 1738 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
1739 | 1739 | ||
1740 | ip->i_d.di_dmevmask = evmask; | 1740 | ip->i_d.di_dmevmask = evmask; |
1741 | ip->i_d.di_dmstate = state; | 1741 | ip->i_d.di_dmstate = state; |
@@ -1878,7 +1878,7 @@ xfs_alloc_file_space( | |||
1878 | if (error) | 1878 | if (error) |
1879 | goto error1; | 1879 | goto error1; |
1880 | 1880 | ||
1881 | xfs_trans_ijoin(tp, ip); | 1881 | xfs_trans_ijoin(tp, ip, 0); |
1882 | 1882 | ||
1883 | xfs_bmap_init(&free_list, &firstfsb); | 1883 | xfs_bmap_init(&free_list, &firstfsb); |
1884 | error = xfs_bmapi_write(tp, ip, startoffset_fsb, | 1884 | error = xfs_bmapi_write(tp, ip, startoffset_fsb, |
@@ -2176,7 +2176,7 @@ xfs_free_file_space( | |||
2176 | if (error) | 2176 | if (error) |
2177 | goto error1; | 2177 | goto error1; |
2178 | 2178 | ||
2179 | xfs_trans_ijoin(tp, ip); | 2179 | xfs_trans_ijoin(tp, ip, 0); |
2180 | 2180 | ||
2181 | /* | 2181 | /* |
2182 | * issue the bunmapi() call to free the blocks | 2182 | * issue the bunmapi() call to free the blocks |
@@ -2349,7 +2349,7 @@ xfs_change_file_space( | |||
2349 | } | 2349 | } |
2350 | 2350 | ||
2351 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 2351 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
2352 | xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL); | 2352 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
2353 | 2353 | ||
2354 | if ((attr_flags & XFS_ATTR_DMI) == 0) { | 2354 | if ((attr_flags & XFS_ATTR_DMI) == 0) { |
2355 | ip->i_d.di_mode &= ~S_ISUID; | 2355 | ip->i_d.di_mode &= ~S_ISUID; |