diff options
author | Christoph Hellwig <hch@lst.de> | 2015-06-03 23:47:56 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2015-06-03 23:47:56 -0400 |
commit | 4906e21545814e4129595118287a2f1415483c0b (patch) | |
tree | 1e07c3083a4d7c5f3c56d679f9b440c653a867b3 /fs/xfs/xfs_rtalloc.c | |
parent | eacb24e73424bdae4aa139ddd459f86ec46f0ad0 (diff) |
xfs: remove the flags argument to xfs_trans_cancel
xfs_trans_cancel takes two flags arguments: XFS_TRANS_RELEASE_LOG_RES and
XFS_TRANS_ABORT. Both of them are a direct product of the transaction
state, and can be deducted:
- any dirty transaction needs XFS_TRANS_ABORT to be properly canceled,
and XFS_TRANS_ABORT is a noop for a transaction that is not dirty.
- any transaction with a permanent log reservation needs
XFS_TRANS_RELEASE_LOG_RES to be properly canceled, and passing
XFS_TRANS_RELEASE_LOG_RES for a transaction without a permanent
log reservation is invalid.
So just remove the flags argument and do the right thing.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_rtalloc.c')
-rw-r--r-- | fs/xfs/xfs_rtalloc.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index f2079b6911cc..ff5af6693650 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
@@ -780,7 +780,6 @@ xfs_growfs_rt_alloc( | |||
780 | * Allocate space to the file, as necessary. | 780 | * Allocate space to the file, as necessary. |
781 | */ | 781 | */ |
782 | while (oblocks < nblocks) { | 782 | while (oblocks < nblocks) { |
783 | int cancelflags = 0; | ||
784 | xfs_trans_t *tp; | 783 | xfs_trans_t *tp; |
785 | 784 | ||
786 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_ALLOC); | 785 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_ALLOC); |
@@ -792,7 +791,6 @@ xfs_growfs_rt_alloc( | |||
792 | resblks, 0); | 791 | resblks, 0); |
793 | if (error) | 792 | if (error) |
794 | goto error_cancel; | 793 | goto error_cancel; |
795 | cancelflags = XFS_TRANS_RELEASE_LOG_RES; | ||
796 | /* | 794 | /* |
797 | * Lock the inode. | 795 | * Lock the inode. |
798 | */ | 796 | */ |
@@ -804,7 +802,6 @@ xfs_growfs_rt_alloc( | |||
804 | * Allocate blocks to the bitmap file. | 802 | * Allocate blocks to the bitmap file. |
805 | */ | 803 | */ |
806 | nmap = 1; | 804 | nmap = 1; |
807 | cancelflags |= XFS_TRANS_ABORT; | ||
808 | error = xfs_bmapi_write(tp, ip, oblocks, nblocks - oblocks, | 805 | error = xfs_bmapi_write(tp, ip, oblocks, nblocks - oblocks, |
809 | XFS_BMAPI_METADATA, &firstblock, | 806 | XFS_BMAPI_METADATA, &firstblock, |
810 | resblks, &map, &nmap, &flist); | 807 | resblks, &map, &nmap, &flist); |
@@ -825,7 +822,6 @@ xfs_growfs_rt_alloc( | |||
825 | * Now we need to clear the allocated blocks. | 822 | * Now we need to clear the allocated blocks. |
826 | * Do this one block per transaction, to keep it simple. | 823 | * Do this one block per transaction, to keep it simple. |
827 | */ | 824 | */ |
828 | cancelflags = 0; | ||
829 | for (bno = map.br_startoff, fsbno = map.br_startblock; | 825 | for (bno = map.br_startoff, fsbno = map.br_startblock; |
830 | bno < map.br_startoff + map.br_blockcount; | 826 | bno < map.br_startoff + map.br_blockcount; |
831 | bno++, fsbno++) { | 827 | bno++, fsbno++) { |
@@ -851,7 +847,7 @@ xfs_growfs_rt_alloc( | |||
851 | if (bp == NULL) { | 847 | if (bp == NULL) { |
852 | error = -EIO; | 848 | error = -EIO; |
853 | error_cancel: | 849 | error_cancel: |
854 | xfs_trans_cancel(tp, cancelflags); | 850 | xfs_trans_cancel(tp); |
855 | goto error; | 851 | goto error; |
856 | } | 852 | } |
857 | memset(bp->b_addr, 0, mp->m_sb.sb_blocksize); | 853 | memset(bp->b_addr, 0, mp->m_sb.sb_blocksize); |
@@ -973,7 +969,6 @@ xfs_growfs_rt( | |||
973 | bmbno < nrbmblocks; | 969 | bmbno < nrbmblocks; |
974 | bmbno++) { | 970 | bmbno++) { |
975 | xfs_trans_t *tp; | 971 | xfs_trans_t *tp; |
976 | int cancelflags = 0; | ||
977 | 972 | ||
978 | *nmp = *mp; | 973 | *nmp = *mp; |
979 | nsbp = &nmp->m_sb; | 974 | nsbp = &nmp->m_sb; |
@@ -1015,7 +1010,6 @@ xfs_growfs_rt( | |||
1015 | mp->m_rbmip->i_d.di_size = | 1010 | mp->m_rbmip->i_d.di_size = |
1016 | nsbp->sb_rbmblocks * nsbp->sb_blocksize; | 1011 | nsbp->sb_rbmblocks * nsbp->sb_blocksize; |
1017 | xfs_trans_log_inode(tp, mp->m_rbmip, XFS_ILOG_CORE); | 1012 | xfs_trans_log_inode(tp, mp->m_rbmip, XFS_ILOG_CORE); |
1018 | cancelflags |= XFS_TRANS_ABORT; | ||
1019 | /* | 1013 | /* |
1020 | * Get the summary inode into the transaction. | 1014 | * Get the summary inode into the transaction. |
1021 | */ | 1015 | */ |
@@ -1062,7 +1056,7 @@ xfs_growfs_rt( | |||
1062 | nsbp->sb_rextents - sbp->sb_rextents, &bp, &sumbno); | 1056 | nsbp->sb_rextents - sbp->sb_rextents, &bp, &sumbno); |
1063 | if (error) { | 1057 | if (error) { |
1064 | error_cancel: | 1058 | error_cancel: |
1065 | xfs_trans_cancel(tp, cancelflags); | 1059 | xfs_trans_cancel(tp); |
1066 | break; | 1060 | break; |
1067 | } | 1061 | } |
1068 | /* | 1062 | /* |