diff options
author | Christoph Hellwig <hch@lst.de> | 2015-06-03 23:48:08 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2015-06-03 23:48:08 -0400 |
commit | 70393313dd0b26a6a79e2737b6dff1f1937b936d (patch) | |
tree | d7113f5a6a07e6eb234e73a4c153731b3e8e3aa5 | |
parent | 4906e21545814e4129595118287a2f1415483c0b (diff) |
xfs: saner xfs_trans_commit interface
The flags argument to xfs_trans_commit is not useful for most callers, as
a commit of a transaction without a permanent log reservation must pass
0 here, and all callers for a transaction with a permanent log reservation
except for xfs_trans_roll must pass XFS_TRANS_RELEASE_LOG_RES. So remove
the flags argument from the public xfs_trans_commit interfaces, and
introduce low-level __xfs_trans_commit variant just for xfs_trans_roll
that regrants a log reservation instead of releasing it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r-- | fs/xfs/libxfs/xfs_attr.c | 7 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 5 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_sb.c | 2 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_shared.h | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_aops.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_inactive.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 11 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_fsops.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_iomap.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_iops.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_log.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_log_cil.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_pnfs.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_qm.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_qm_syscalls.c | 9 | ||||
-rw-r--r-- | fs/xfs/xfs_rtalloc.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_symlink.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.c | 35 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.h | 2 |
24 files changed, 68 insertions, 74 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 126da7fc5ded..3349c9a1e845 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c | |||
@@ -320,8 +320,7 @@ xfs_attr_set( | |||
320 | xfs_trans_ichgtime(args.trans, dp, | 320 | xfs_trans_ichgtime(args.trans, dp, |
321 | XFS_ICHGTIME_CHG); | 321 | XFS_ICHGTIME_CHG); |
322 | } | 322 | } |
323 | err2 = xfs_trans_commit(args.trans, | 323 | err2 = xfs_trans_commit(args.trans); |
324 | XFS_TRANS_RELEASE_LOG_RES); | ||
325 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 324 | xfs_iunlock(dp, XFS_ILOCK_EXCL); |
326 | 325 | ||
327 | return error ? error : err2; | 326 | return error ? error : err2; |
@@ -383,7 +382,7 @@ xfs_attr_set( | |||
383 | * Commit the last in the sequence of transactions. | 382 | * Commit the last in the sequence of transactions. |
384 | */ | 383 | */ |
385 | xfs_trans_log_inode(args.trans, dp, XFS_ILOG_CORE); | 384 | xfs_trans_log_inode(args.trans, dp, XFS_ILOG_CORE); |
386 | error = xfs_trans_commit(args.trans, XFS_TRANS_RELEASE_LOG_RES); | 385 | error = xfs_trans_commit(args.trans); |
387 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 386 | xfs_iunlock(dp, XFS_ILOCK_EXCL); |
388 | 387 | ||
389 | return error; | 388 | return error; |
@@ -499,7 +498,7 @@ xfs_attr_remove( | |||
499 | * Commit the last in the sequence of transactions. | 498 | * Commit the last in the sequence of transactions. |
500 | */ | 499 | */ |
501 | xfs_trans_log_inode(args.trans, dp, XFS_ILOG_CORE); | 500 | xfs_trans_log_inode(args.trans, dp, XFS_ILOG_CORE); |
502 | error = xfs_trans_commit(args.trans, XFS_TRANS_RELEASE_LOG_RES); | 501 | error = xfs_trans_commit(args.trans); |
503 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 502 | xfs_iunlock(dp, XFS_ILOCK_EXCL); |
504 | 503 | ||
505 | return error; | 504 | return error; |
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index a07055aaf433..caca2c59de96 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -1215,7 +1215,7 @@ xfs_bmap_add_attrfork( | |||
1215 | error = xfs_bmap_finish(&tp, &flist, &committed); | 1215 | error = xfs_bmap_finish(&tp, &flist, &committed); |
1216 | if (error) | 1216 | if (error) |
1217 | goto bmap_cancel; | 1217 | goto bmap_cancel; |
1218 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1218 | error = xfs_trans_commit(tp); |
1219 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 1219 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
1220 | return error; | 1220 | return error; |
1221 | 1221 | ||
@@ -5926,8 +5926,7 @@ xfs_bmap_split_extent( | |||
5926 | if (error) | 5926 | if (error) |
5927 | goto out; | 5927 | goto out; |
5928 | 5928 | ||
5929 | return xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 5929 | return xfs_trans_commit(tp); |
5930 | |||
5931 | 5930 | ||
5932 | out: | 5931 | out: |
5933 | xfs_trans_cancel(tp); | 5932 | xfs_trans_cancel(tp); |
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index 3a5667d7cf24..fcc151f69a75 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c | |||
@@ -799,5 +799,5 @@ xfs_sync_sb( | |||
799 | xfs_log_sb(tp); | 799 | xfs_log_sb(tp); |
800 | if (wait) | 800 | if (wait) |
801 | xfs_trans_set_sync(tp); | 801 | xfs_trans_set_sync(tp); |
802 | return xfs_trans_commit(tp, 0); | 802 | return xfs_trans_commit(tp); |
803 | } | 803 | } |
diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h index 930cc7d295ec..5be529707903 100644 --- a/fs/xfs/libxfs/xfs_shared.h +++ b/fs/xfs/libxfs/xfs_shared.h | |||
@@ -182,11 +182,6 @@ int xfs_log_calc_minimum_size(struct xfs_mount *); | |||
182 | #define XFS_TRANS_FREEZE_PROT 0x40 /* Transaction has elevated writer | 182 | #define XFS_TRANS_FREEZE_PROT 0x40 /* Transaction has elevated writer |
183 | count in superblock */ | 183 | count in superblock */ |
184 | /* | 184 | /* |
185 | * Values for call flags parameter. | ||
186 | */ | ||
187 | #define XFS_TRANS_RELEASE_LOG_RES 0x4 | ||
188 | |||
189 | /* | ||
190 | * Field values for xfs_trans_mod_sb. | 185 | * Field values for xfs_trans_mod_sb. |
191 | */ | 186 | */ |
192 | #define XFS_TRANS_SB_ICOUNT 0x00000001 | 187 | #define XFS_TRANS_SB_ICOUNT 0x00000001 |
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 3890a38a0f26..7246a3936c6f 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -155,7 +155,7 @@ xfs_setfilesize( | |||
155 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 155 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
156 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 156 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
157 | 157 | ||
158 | return xfs_trans_commit(tp, 0); | 158 | return xfs_trans_commit(tp); |
159 | } | 159 | } |
160 | 160 | ||
161 | STATIC int | 161 | STATIC int |
diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c index af7fce33ae52..48f26ff08880 100644 --- a/fs/xfs/xfs_attr_inactive.c +++ b/fs/xfs/xfs_attr_inactive.c | |||
@@ -438,7 +438,7 @@ xfs_attr_inactive(xfs_inode_t *dp) | |||
438 | if (error) | 438 | if (error) |
439 | goto out; | 439 | goto out; |
440 | 440 | ||
441 | error = xfs_trans_commit(trans, XFS_TRANS_RELEASE_LOG_RES); | 441 | error = xfs_trans_commit(trans); |
442 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 442 | xfs_iunlock(dp, XFS_ILOCK_EXCL); |
443 | 443 | ||
444 | return error; | 444 | return error; |
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 7e795cf60bd0..1f0215d9a471 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c | |||
@@ -893,8 +893,7 @@ xfs_free_eofblocks( | |||
893 | */ | 893 | */ |
894 | xfs_trans_cancel(tp); | 894 | xfs_trans_cancel(tp); |
895 | } else { | 895 | } else { |
896 | error = xfs_trans_commit(tp, | 896 | error = xfs_trans_commit(tp); |
897 | XFS_TRANS_RELEASE_LOG_RES); | ||
898 | if (!error) | 897 | if (!error) |
899 | xfs_inode_clear_eofblocks_tag(ip); | 898 | xfs_inode_clear_eofblocks_tag(ip); |
900 | } | 899 | } |
@@ -1034,7 +1033,7 @@ xfs_alloc_file_space( | |||
1034 | goto error0; | 1033 | goto error0; |
1035 | } | 1034 | } |
1036 | 1035 | ||
1037 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1036 | error = xfs_trans_commit(tp); |
1038 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 1037 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
1039 | if (error) { | 1038 | if (error) { |
1040 | break; | 1039 | break; |
@@ -1301,7 +1300,7 @@ xfs_free_file_space( | |||
1301 | goto error0; | 1300 | goto error0; |
1302 | } | 1301 | } |
1303 | 1302 | ||
1304 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1303 | error = xfs_trans_commit(tp); |
1305 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 1304 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
1306 | } | 1305 | } |
1307 | 1306 | ||
@@ -1473,7 +1472,7 @@ xfs_shift_file_space( | |||
1473 | if (error) | 1472 | if (error) |
1474 | goto out; | 1473 | goto out; |
1475 | 1474 | ||
1476 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1475 | error = xfs_trans_commit(tp); |
1477 | } | 1476 | } |
1478 | 1477 | ||
1479 | return error; | 1478 | return error; |
@@ -1882,7 +1881,7 @@ xfs_swap_extents( | |||
1882 | if (mp->m_flags & XFS_MOUNT_WSYNC) | 1881 | if (mp->m_flags & XFS_MOUNT_WSYNC) |
1883 | xfs_trans_set_sync(tp); | 1882 | xfs_trans_set_sync(tp); |
1884 | 1883 | ||
1885 | error = xfs_trans_commit(tp, 0); | 1884 | error = xfs_trans_commit(tp); |
1886 | 1885 | ||
1887 | trace_xfs_swap_extent_after(ip, 0); | 1886 | trace_xfs_swap_extent_after(ip, 0); |
1888 | trace_xfs_swap_extent_after(tip, 1); | 1887 | trace_xfs_swap_extent_after(tip, 1); |
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index ab0ae1f8b0ea..4143dc75dca4 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
@@ -666,7 +666,7 @@ xfs_qm_dqread( | |||
666 | xfs_trans_brelse(tp, bp); | 666 | xfs_trans_brelse(tp, bp); |
667 | 667 | ||
668 | if (tp) { | 668 | if (tp) { |
669 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 669 | error = xfs_trans_commit(tp); |
670 | if (error) | 670 | if (error) |
671 | goto error0; | 671 | goto error0; |
672 | } | 672 | } |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 46598b7bce86..0dec85865ce4 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -160,7 +160,7 @@ xfs_update_prealloc_flags( | |||
160 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 160 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
161 | if (flags & XFS_PREALLOC_SYNC) | 161 | if (flags & XFS_PREALLOC_SYNC) |
162 | xfs_trans_set_sync(tp); | 162 | xfs_trans_set_sync(tp); |
163 | return xfs_trans_commit(tp, 0); | 163 | return xfs_trans_commit(tp); |
164 | } | 164 | } |
165 | 165 | ||
166 | /* | 166 | /* |
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 0bdcdb74fc76..0932c15acb74 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -489,7 +489,7 @@ xfs_growfs_data_private( | |||
489 | if (dpct) | 489 | if (dpct) |
490 | xfs_trans_mod_sb(tp, XFS_TRANS_SB_IMAXPCT, dpct); | 490 | xfs_trans_mod_sb(tp, XFS_TRANS_SB_IMAXPCT, dpct); |
491 | xfs_trans_set_sync(tp); | 491 | xfs_trans_set_sync(tp); |
492 | error = xfs_trans_commit(tp, 0); | 492 | error = xfs_trans_commit(tp); |
493 | if (error) | 493 | if (error) |
494 | return error; | 494 | return error; |
495 | 495 | ||
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 3f3f8a0e7837..63cd40022bf4 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1230,7 +1230,7 @@ xfs_create( | |||
1230 | if (error) | 1230 | if (error) |
1231 | goto out_bmap_cancel; | 1231 | goto out_bmap_cancel; |
1232 | 1232 | ||
1233 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1233 | error = xfs_trans_commit(tp); |
1234 | if (error) | 1234 | if (error) |
1235 | goto out_release_inode; | 1235 | goto out_release_inode; |
1236 | 1236 | ||
@@ -1339,7 +1339,7 @@ xfs_create_tmpfile( | |||
1339 | if (error) | 1339 | if (error) |
1340 | goto out_trans_cancel; | 1340 | goto out_trans_cancel; |
1341 | 1341 | ||
1342 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1342 | error = xfs_trans_commit(tp); |
1343 | if (error) | 1343 | if (error) |
1344 | goto out_release_inode; | 1344 | goto out_release_inode; |
1345 | 1345 | ||
@@ -1465,7 +1465,7 @@ xfs_link( | |||
1465 | goto error_return; | 1465 | goto error_return; |
1466 | } | 1466 | } |
1467 | 1467 | ||
1468 | return xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1468 | return xfs_trans_commit(tp); |
1469 | 1469 | ||
1470 | error_return: | 1470 | error_return: |
1471 | xfs_trans_cancel(tp); | 1471 | xfs_trans_cancel(tp); |
@@ -1702,7 +1702,7 @@ xfs_inactive_truncate( | |||
1702 | 1702 | ||
1703 | ASSERT(ip->i_d.di_nextents == 0); | 1703 | ASSERT(ip->i_d.di_nextents == 0); |
1704 | 1704 | ||
1705 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1705 | error = xfs_trans_commit(tp); |
1706 | if (error) | 1706 | if (error) |
1707 | goto error_unlock; | 1707 | goto error_unlock; |
1708 | 1708 | ||
@@ -1799,7 +1799,7 @@ xfs_inactive_ifree( | |||
1799 | if (error) | 1799 | if (error) |
1800 | xfs_notice(mp, "%s: xfs_bmap_finish returned error %d", | 1800 | xfs_notice(mp, "%s: xfs_bmap_finish returned error %d", |
1801 | __func__, error); | 1801 | __func__, error); |
1802 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 1802 | error = xfs_trans_commit(tp); |
1803 | if (error) | 1803 | if (error) |
1804 | xfs_notice(mp, "%s: xfs_trans_commit returned error %d", | 1804 | xfs_notice(mp, "%s: xfs_trans_commit returned error %d", |
1805 | __func__, error); | 1805 | __func__, error); |
@@ -2569,7 +2569,7 @@ xfs_remove( | |||
2569 | if (error) | 2569 | if (error) |
2570 | goto out_bmap_cancel; | 2570 | goto out_bmap_cancel; |
2571 | 2571 | ||
2572 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 2572 | error = xfs_trans_commit(tp); |
2573 | if (error) | 2573 | if (error) |
2574 | goto std_return; | 2574 | goto std_return; |
2575 | 2575 | ||
@@ -2659,7 +2659,7 @@ xfs_finish_rename( | |||
2659 | return error; | 2659 | return error; |
2660 | } | 2660 | } |
2661 | 2661 | ||
2662 | return xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 2662 | return xfs_trans_commit(tp); |
2663 | } | 2663 | } |
2664 | 2664 | ||
2665 | /* | 2665 | /* |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 3abd3c45b019..ea7d85af5310 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
@@ -346,7 +346,7 @@ xfs_set_dmattrs( | |||
346 | ip->i_d.di_dmstate = state; | 346 | ip->i_d.di_dmstate = state; |
347 | 347 | ||
348 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 348 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
349 | error = xfs_trans_commit(tp, 0); | 349 | error = xfs_trans_commit(tp); |
350 | 350 | ||
351 | return error; | 351 | return error; |
352 | } | 352 | } |
@@ -1253,7 +1253,7 @@ xfs_ioctl_setattr( | |||
1253 | else | 1253 | else |
1254 | ip->i_d.di_extsize = 0; | 1254 | ip->i_d.di_extsize = 0; |
1255 | 1255 | ||
1256 | code = xfs_trans_commit(tp, 0); | 1256 | code = xfs_trans_commit(tp); |
1257 | 1257 | ||
1258 | /* | 1258 | /* |
1259 | * Release any dquot(s) the inode had kept before chown. | 1259 | * Release any dquot(s) the inode had kept before chown. |
@@ -1342,7 +1342,7 @@ xfs_ioc_setxflags( | |||
1342 | goto out_drop_write; | 1342 | goto out_drop_write; |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | error = xfs_trans_commit(tp, 0); | 1345 | error = xfs_trans_commit(tp); |
1346 | out_drop_write: | 1346 | out_drop_write: |
1347 | mnt_drop_write_file(filp); | 1347 | mnt_drop_write_file(filp); |
1348 | return error; | 1348 | return error; |
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 6ca842abae10..1f86033171c8 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -213,7 +213,7 @@ xfs_iomap_write_direct( | |||
213 | error = xfs_bmap_finish(&tp, &free_list, &committed); | 213 | error = xfs_bmap_finish(&tp, &free_list, &committed); |
214 | if (error) | 214 | if (error) |
215 | goto out_bmap_cancel; | 215 | goto out_bmap_cancel; |
216 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 216 | error = xfs_trans_commit(tp); |
217 | if (error) | 217 | if (error) |
218 | goto out_unlock; | 218 | goto out_unlock; |
219 | 219 | ||
@@ -760,7 +760,7 @@ xfs_iomap_write_allocate( | |||
760 | if (error) | 760 | if (error) |
761 | goto trans_cancel; | 761 | goto trans_cancel; |
762 | 762 | ||
763 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 763 | error = xfs_trans_commit(tp); |
764 | if (error) | 764 | if (error) |
765 | goto error0; | 765 | goto error0; |
766 | 766 | ||
@@ -890,7 +890,7 @@ xfs_iomap_write_unwritten( | |||
890 | if (error) | 890 | if (error) |
891 | goto error_on_bmapi_transaction; | 891 | goto error_on_bmapi_transaction; |
892 | 892 | ||
893 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 893 | error = xfs_trans_commit(tp); |
894 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 894 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
895 | if (error) | 895 | if (error) |
896 | return error; | 896 | return error; |
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 8bd71f17f8b4..e440aed89c82 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -702,7 +702,7 @@ xfs_setattr_nonsize( | |||
702 | 702 | ||
703 | if (mp->m_flags & XFS_MOUNT_WSYNC) | 703 | if (mp->m_flags & XFS_MOUNT_WSYNC) |
704 | xfs_trans_set_sync(tp); | 704 | xfs_trans_set_sync(tp); |
705 | error = xfs_trans_commit(tp, 0); | 705 | error = xfs_trans_commit(tp); |
706 | 706 | ||
707 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 707 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
708 | 708 | ||
@@ -926,7 +926,7 @@ xfs_setattr_size( | |||
926 | if (mp->m_flags & XFS_MOUNT_WSYNC) | 926 | if (mp->m_flags & XFS_MOUNT_WSYNC) |
927 | xfs_trans_set_sync(tp); | 927 | xfs_trans_set_sync(tp); |
928 | 928 | ||
929 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 929 | error = xfs_trans_commit(tp); |
930 | out_unlock: | 930 | out_unlock: |
931 | if (lock_flags) | 931 | if (lock_flags) |
932 | xfs_iunlock(ip, lock_flags); | 932 | xfs_iunlock(ip, lock_flags); |
@@ -1002,7 +1002,7 @@ xfs_vn_update_time( | |||
1002 | } | 1002 | } |
1003 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 1003 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
1004 | xfs_trans_log_inode(tp, ip, XFS_ILOG_TIMESTAMP); | 1004 | xfs_trans_log_inode(tp, ip, XFS_ILOG_TIMESTAMP); |
1005 | return xfs_trans_commit(tp, 0); | 1005 | return xfs_trans_commit(tp); |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | #define XFS_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR) | 1008 | #define XFS_FIEMAP_FLAGS (FIEMAP_FLAG_SYNC|FIEMAP_FLAG_XATTR) |
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h index 84e0deb95abd..4040c477892f 100644 --- a/fs/xfs/xfs_log.h +++ b/fs/xfs/xfs_log.h | |||
@@ -183,7 +183,7 @@ struct xlog_ticket *xfs_log_ticket_get(struct xlog_ticket *ticket); | |||
183 | void xfs_log_ticket_put(struct xlog_ticket *ticket); | 183 | void xfs_log_ticket_put(struct xlog_ticket *ticket); |
184 | 184 | ||
185 | void xfs_log_commit_cil(struct xfs_mount *mp, struct xfs_trans *tp, | 185 | void xfs_log_commit_cil(struct xfs_mount *mp, struct xfs_trans *tp, |
186 | xfs_lsn_t *commit_lsn, int flags); | 186 | xfs_lsn_t *commit_lsn, bool regrant); |
187 | bool xfs_log_item_in_current_chkpt(struct xfs_log_item *lip); | 187 | bool xfs_log_item_in_current_chkpt(struct xfs_log_item *lip); |
188 | 188 | ||
189 | void xfs_log_work_queue(struct xfs_mount *mp); | 189 | void xfs_log_work_queue(struct xfs_mount *mp); |
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c index 7e0e63eb4802..d6f26d7d0ce5 100644 --- a/fs/xfs/xfs_log_cil.c +++ b/fs/xfs/xfs_log_cil.c | |||
@@ -773,13 +773,13 @@ xfs_log_commit_cil( | |||
773 | struct xfs_mount *mp, | 773 | struct xfs_mount *mp, |
774 | struct xfs_trans *tp, | 774 | struct xfs_trans *tp, |
775 | xfs_lsn_t *commit_lsn, | 775 | xfs_lsn_t *commit_lsn, |
776 | int flags) | 776 | bool regrant) |
777 | { | 777 | { |
778 | struct xlog *log = mp->m_log; | 778 | struct xlog *log = mp->m_log; |
779 | struct xfs_cil *cil = log->l_cilp; | 779 | struct xfs_cil *cil = log->l_cilp; |
780 | int log_flags = 0; | 780 | int log_flags = 0; |
781 | 781 | ||
782 | if (flags & XFS_TRANS_RELEASE_LOG_RES) | 782 | if (!regrant) |
783 | log_flags = XFS_LOG_REL_PERM_RESERV; | 783 | log_flags = XFS_LOG_REL_PERM_RESERV; |
784 | 784 | ||
785 | /* lock out background commit */ | 785 | /* lock out background commit */ |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 8f2923fab17b..599de7248e21 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -3751,7 +3751,7 @@ xlog_recover_process_efi( | |||
3751 | } | 3751 | } |
3752 | 3752 | ||
3753 | set_bit(XFS_EFI_RECOVERED, &efip->efi_flags); | 3753 | set_bit(XFS_EFI_RECOVERED, &efip->efi_flags); |
3754 | error = xfs_trans_commit(tp, 0); | 3754 | error = xfs_trans_commit(tp); |
3755 | return error; | 3755 | return error; |
3756 | 3756 | ||
3757 | abort_error: | 3757 | abort_error: |
@@ -3857,7 +3857,7 @@ xlog_recover_clear_agi_bucket( | |||
3857 | xfs_trans_log_buf(tp, agibp, offset, | 3857 | xfs_trans_log_buf(tp, agibp, offset, |
3858 | (offset + sizeof(xfs_agino_t) - 1)); | 3858 | (offset + sizeof(xfs_agino_t) - 1)); |
3859 | 3859 | ||
3860 | error = xfs_trans_commit(tp, 0); | 3860 | error = xfs_trans_commit(tp); |
3861 | if (error) | 3861 | if (error) |
3862 | goto out_error; | 3862 | goto out_error; |
3863 | return; | 3863 | return; |
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c index 3bb6097c7dd3..ab4a6066f7ca 100644 --- a/fs/xfs/xfs_pnfs.c +++ b/fs/xfs/xfs_pnfs.c | |||
@@ -321,7 +321,7 @@ xfs_fs_commit_blocks( | |||
321 | } | 321 | } |
322 | 322 | ||
323 | xfs_trans_set_sync(tp); | 323 | xfs_trans_set_sync(tp); |
324 | error = xfs_trans_commit(tp, 0); | 324 | error = xfs_trans_commit(tp); |
325 | 325 | ||
326 | out_drop_iolock: | 326 | out_drop_iolock: |
327 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 327 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index c4ba36dfb49c..eac9549efd52 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
@@ -795,7 +795,7 @@ xfs_qm_qino_alloc( | |||
795 | spin_unlock(&mp->m_sb_lock); | 795 | spin_unlock(&mp->m_sb_lock); |
796 | xfs_log_sb(tp); | 796 | xfs_log_sb(tp); |
797 | 797 | ||
798 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 798 | error = xfs_trans_commit(tp); |
799 | if (error) { | 799 | if (error) { |
800 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); | 800 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); |
801 | xfs_alert(mp, "%s failed (error %d)!", __func__, error); | 801 | xfs_alert(mp, "%s failed (error %d)!", __func__, error); |
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index 92ad24f9e5be..3640c6e896af 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c | |||
@@ -259,7 +259,7 @@ xfs_qm_scall_trunc_qfile( | |||
259 | ASSERT(ip->i_d.di_nextents == 0); | 259 | ASSERT(ip->i_d.di_nextents == 0); |
260 | 260 | ||
261 | xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 261 | xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
262 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 262 | error = xfs_trans_commit(tp); |
263 | 263 | ||
264 | out_unlock: | 264 | out_unlock: |
265 | xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 265 | xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
@@ -547,7 +547,7 @@ xfs_qm_scall_setqlim( | |||
547 | dqp->dq_flags |= XFS_DQ_DIRTY; | 547 | dqp->dq_flags |= XFS_DQ_DIRTY; |
548 | xfs_trans_log_dquot(tp, dqp); | 548 | xfs_trans_log_dquot(tp, dqp); |
549 | 549 | ||
550 | error = xfs_trans_commit(tp, 0); | 550 | error = xfs_trans_commit(tp); |
551 | 551 | ||
552 | out_rele: | 552 | out_rele: |
553 | xfs_qm_dqrele(dqp); | 553 | xfs_qm_dqrele(dqp); |
@@ -584,8 +584,7 @@ xfs_qm_log_quotaoff_end( | |||
584 | * We don't care about quotoff's performance. | 584 | * We don't care about quotoff's performance. |
585 | */ | 585 | */ |
586 | xfs_trans_set_sync(tp); | 586 | xfs_trans_set_sync(tp); |
587 | error = xfs_trans_commit(tp, 0); | 587 | return xfs_trans_commit(tp); |
588 | return error; | ||
589 | } | 588 | } |
590 | 589 | ||
591 | 590 | ||
@@ -623,7 +622,7 @@ xfs_qm_log_quotaoff( | |||
623 | * We don't care about quotoff's performance. | 622 | * We don't care about quotoff's performance. |
624 | */ | 623 | */ |
625 | xfs_trans_set_sync(tp); | 624 | xfs_trans_set_sync(tp); |
626 | error = xfs_trans_commit(tp, 0); | 625 | error = xfs_trans_commit(tp); |
627 | if (error) | 626 | if (error) |
628 | goto out; | 627 | goto out; |
629 | 628 | ||
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index ff5af6693650..f4e8c06eee26 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
@@ -815,7 +815,7 @@ xfs_growfs_rt_alloc( | |||
815 | error = xfs_bmap_finish(&tp, &flist, &committed); | 815 | error = xfs_bmap_finish(&tp, &flist, &committed); |
816 | if (error) | 816 | if (error) |
817 | goto error_cancel; | 817 | goto error_cancel; |
818 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 818 | error = xfs_trans_commit(tp); |
819 | if (error) | 819 | if (error) |
820 | goto error; | 820 | goto error; |
821 | /* | 821 | /* |
@@ -855,7 +855,7 @@ error_cancel: | |||
855 | /* | 855 | /* |
856 | * Commit the transaction. | 856 | * Commit the transaction. |
857 | */ | 857 | */ |
858 | error = xfs_trans_commit(tp, 0); | 858 | error = xfs_trans_commit(tp); |
859 | if (error) | 859 | if (error) |
860 | goto error; | 860 | goto error; |
861 | } | 861 | } |
@@ -1070,7 +1070,7 @@ error_cancel: | |||
1070 | mp->m_rsumlevels = nrsumlevels; | 1070 | mp->m_rsumlevels = nrsumlevels; |
1071 | mp->m_rsumsize = nrsumsize; | 1071 | mp->m_rsumsize = nrsumsize; |
1072 | 1072 | ||
1073 | error = xfs_trans_commit(tp, 0); | 1073 | error = xfs_trans_commit(tp); |
1074 | if (error) | 1074 | if (error) |
1075 | break; | 1075 | break; |
1076 | } | 1076 | } |
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c index b5573bf45ca1..2d90452062b0 100644 --- a/fs/xfs/xfs_symlink.c +++ b/fs/xfs/xfs_symlink.c | |||
@@ -390,7 +390,7 @@ xfs_symlink( | |||
390 | if (error) | 390 | if (error) |
391 | goto out_bmap_cancel; | 391 | goto out_bmap_cancel; |
392 | 392 | ||
393 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 393 | error = xfs_trans_commit(tp); |
394 | if (error) | 394 | if (error) |
395 | goto out_release_inode; | 395 | goto out_release_inode; |
396 | 396 | ||
@@ -528,7 +528,7 @@ xfs_inactive_symlink_rmt( | |||
528 | /* | 528 | /* |
529 | * Commit the transaction containing extent freeing and EFDs. | 529 | * Commit the transaction containing extent freeing and EFDs. |
530 | */ | 530 | */ |
531 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 531 | error = xfs_trans_commit(tp); |
532 | if (error) { | 532 | if (error) { |
533 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); | 533 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); |
534 | goto error_unlock; | 534 | goto error_unlock; |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 6cca99640d1a..fb1bd17ea8ce 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
@@ -892,27 +892,17 @@ xfs_trans_committed_bulk( | |||
892 | * have already been unlocked as if the commit had succeeded. | 892 | * have already been unlocked as if the commit had succeeded. |
893 | * Do not reference the transaction structure after this call. | 893 | * Do not reference the transaction structure after this call. |
894 | */ | 894 | */ |
895 | int | 895 | static int |
896 | xfs_trans_commit( | 896 | __xfs_trans_commit( |
897 | struct xfs_trans *tp, | 897 | struct xfs_trans *tp, |
898 | uint flags) | 898 | bool regrant) |
899 | { | 899 | { |
900 | struct xfs_mount *mp = tp->t_mountp; | 900 | struct xfs_mount *mp = tp->t_mountp; |
901 | xfs_lsn_t commit_lsn = -1; | 901 | xfs_lsn_t commit_lsn = -1; |
902 | int error = 0; | 902 | int error = 0; |
903 | int log_flags = 0; | ||
904 | int sync = tp->t_flags & XFS_TRANS_SYNC; | 903 | int sync = tp->t_flags & XFS_TRANS_SYNC; |
905 | 904 | ||
906 | /* | 905 | /* |
907 | * Determine whether this commit is releasing a permanent | ||
908 | * log reservation or not. | ||
909 | */ | ||
910 | if (flags & XFS_TRANS_RELEASE_LOG_RES) { | ||
911 | ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); | ||
912 | log_flags = XFS_LOG_REL_PERM_RESERV; | ||
913 | } | ||
914 | |||
915 | /* | ||
916 | * If there is nothing to be logged by the transaction, | 906 | * If there is nothing to be logged by the transaction, |
917 | * then unlock all of the items associated with the | 907 | * then unlock all of the items associated with the |
918 | * transaction and free the transaction structure. | 908 | * transaction and free the transaction structure. |
@@ -936,7 +926,7 @@ xfs_trans_commit( | |||
936 | xfs_trans_apply_sb_deltas(tp); | 926 | xfs_trans_apply_sb_deltas(tp); |
937 | xfs_trans_apply_dquot_deltas(tp); | 927 | xfs_trans_apply_dquot_deltas(tp); |
938 | 928 | ||
939 | xfs_log_commit_cil(mp, tp, &commit_lsn, flags); | 929 | xfs_log_commit_cil(mp, tp, &commit_lsn, regrant); |
940 | 930 | ||
941 | current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); | 931 | current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); |
942 | xfs_trans_free(tp); | 932 | xfs_trans_free(tp); |
@@ -964,6 +954,12 @@ out_unreserve: | |||
964 | */ | 954 | */ |
965 | xfs_trans_unreserve_and_mod_dquots(tp); | 955 | xfs_trans_unreserve_and_mod_dquots(tp); |
966 | if (tp->t_ticket) { | 956 | if (tp->t_ticket) { |
957 | int log_flags = 0; | ||
958 | |||
959 | if (regrant) | ||
960 | ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); | ||
961 | else | ||
962 | log_flags = XFS_LOG_REL_PERM_RESERV; | ||
967 | commit_lsn = xfs_log_done(mp, tp->t_ticket, NULL, log_flags); | 963 | commit_lsn = xfs_log_done(mp, tp->t_ticket, NULL, log_flags); |
968 | if (commit_lsn == -1 && !error) | 964 | if (commit_lsn == -1 && !error) |
969 | error = -EIO; | 965 | error = -EIO; |
@@ -976,6 +972,13 @@ out_unreserve: | |||
976 | return error; | 972 | return error; |
977 | } | 973 | } |
978 | 974 | ||
975 | int | ||
976 | xfs_trans_commit( | ||
977 | struct xfs_trans *tp) | ||
978 | { | ||
979 | return __xfs_trans_commit(tp, false); | ||
980 | } | ||
981 | |||
979 | /* | 982 | /* |
980 | * Unlock all of the transaction's items and free the transaction. | 983 | * Unlock all of the transaction's items and free the transaction. |
981 | * The transaction must not have modified any of its items, because | 984 | * The transaction must not have modified any of its items, because |
@@ -1029,7 +1032,7 @@ xfs_trans_cancel( | |||
1029 | /* | 1032 | /* |
1030 | * Roll from one trans in the sequence of PERMANENT transactions to | 1033 | * Roll from one trans in the sequence of PERMANENT transactions to |
1031 | * the next: permanent transactions are only flushed out when | 1034 | * the next: permanent transactions are only flushed out when |
1032 | * committed with XFS_TRANS_RELEASE_LOG_RES, but we still want as soon | 1035 | * committed with xfs_trans_commit(), but we still want as soon |
1033 | * as possible to let chunks of it go to the log. So we commit the | 1036 | * as possible to let chunks of it go to the log. So we commit the |
1034 | * chunk we've been working on and get a new transaction to continue. | 1037 | * chunk we've been working on and get a new transaction to continue. |
1035 | */ | 1038 | */ |
@@ -1063,7 +1066,7 @@ xfs_trans_roll( | |||
1063 | * is in progress. The caller takes the responsibility to cancel | 1066 | * is in progress. The caller takes the responsibility to cancel |
1064 | * the duplicate transaction that gets returned. | 1067 | * the duplicate transaction that gets returned. |
1065 | */ | 1068 | */ |
1066 | error = xfs_trans_commit(trans, 0); | 1069 | error = __xfs_trans_commit(trans, true); |
1067 | if (error) | 1070 | if (error) |
1068 | return error; | 1071 | return error; |
1069 | 1072 | ||
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index ca95b92a40a5..3b21b4e5e467 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
@@ -225,7 +225,7 @@ void xfs_trans_log_efd_extent(xfs_trans_t *, | |||
225 | struct xfs_efd_log_item *, | 225 | struct xfs_efd_log_item *, |
226 | xfs_fsblock_t, | 226 | xfs_fsblock_t, |
227 | xfs_extlen_t); | 227 | xfs_extlen_t); |
228 | int xfs_trans_commit(xfs_trans_t *, uint flags); | 228 | int xfs_trans_commit(struct xfs_trans *); |
229 | int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); | 229 | int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *); |
230 | void xfs_trans_cancel(xfs_trans_t *); | 230 | void xfs_trans_cancel(xfs_trans_t *); |
231 | int xfs_trans_ail_init(struct xfs_mount *); | 231 | int xfs_trans_ail_init(struct xfs_mount *); |