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>
This commit is contained in:

committed by
Dave Chinner

parent
eacb24e734
commit
4906e21545
@@ -780,7 +780,6 @@ xfs_growfs_rt_alloc(
|
||||
* Allocate space to the file, as necessary.
|
||||
*/
|
||||
while (oblocks < nblocks) {
|
||||
int cancelflags = 0;
|
||||
xfs_trans_t *tp;
|
||||
|
||||
tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_ALLOC);
|
||||
@@ -792,7 +791,6 @@ xfs_growfs_rt_alloc(
|
||||
resblks, 0);
|
||||
if (error)
|
||||
goto error_cancel;
|
||||
cancelflags = XFS_TRANS_RELEASE_LOG_RES;
|
||||
/*
|
||||
* Lock the inode.
|
||||
*/
|
||||
@@ -804,7 +802,6 @@ xfs_growfs_rt_alloc(
|
||||
* Allocate blocks to the bitmap file.
|
||||
*/
|
||||
nmap = 1;
|
||||
cancelflags |= XFS_TRANS_ABORT;
|
||||
error = xfs_bmapi_write(tp, ip, oblocks, nblocks - oblocks,
|
||||
XFS_BMAPI_METADATA, &firstblock,
|
||||
resblks, &map, &nmap, &flist);
|
||||
@@ -825,7 +822,6 @@ xfs_growfs_rt_alloc(
|
||||
* Now we need to clear the allocated blocks.
|
||||
* Do this one block per transaction, to keep it simple.
|
||||
*/
|
||||
cancelflags = 0;
|
||||
for (bno = map.br_startoff, fsbno = map.br_startblock;
|
||||
bno < map.br_startoff + map.br_blockcount;
|
||||
bno++, fsbno++) {
|
||||
@@ -851,7 +847,7 @@ xfs_growfs_rt_alloc(
|
||||
if (bp == NULL) {
|
||||
error = -EIO;
|
||||
error_cancel:
|
||||
xfs_trans_cancel(tp, cancelflags);
|
||||
xfs_trans_cancel(tp);
|
||||
goto error;
|
||||
}
|
||||
memset(bp->b_addr, 0, mp->m_sb.sb_blocksize);
|
||||
@@ -973,7 +969,6 @@ xfs_growfs_rt(
|
||||
bmbno < nrbmblocks;
|
||||
bmbno++) {
|
||||
xfs_trans_t *tp;
|
||||
int cancelflags = 0;
|
||||
|
||||
*nmp = *mp;
|
||||
nsbp = &nmp->m_sb;
|
||||
@@ -1015,7 +1010,6 @@ xfs_growfs_rt(
|
||||
mp->m_rbmip->i_d.di_size =
|
||||
nsbp->sb_rbmblocks * nsbp->sb_blocksize;
|
||||
xfs_trans_log_inode(tp, mp->m_rbmip, XFS_ILOG_CORE);
|
||||
cancelflags |= XFS_TRANS_ABORT;
|
||||
/*
|
||||
* Get the summary inode into the transaction.
|
||||
*/
|
||||
@@ -1062,7 +1056,7 @@ xfs_growfs_rt(
|
||||
nsbp->sb_rextents - sbp->sb_rextents, &bp, &sumbno);
|
||||
if (error) {
|
||||
error_cancel:
|
||||
xfs_trans_cancel(tp, cancelflags);
|
||||
xfs_trans_cancel(tp);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
Reference in New Issue
Block a user