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
@@ -178,7 +178,6 @@ xfs_symlink(
|
||||
struct xfs_bmap_free free_list;
|
||||
xfs_fsblock_t first_block;
|
||||
bool unlock_dp_on_error = false;
|
||||
uint cancel_flags;
|
||||
int committed;
|
||||
xfs_fileoff_t first_fsb;
|
||||
xfs_filblks_t fs_blocks;
|
||||
@@ -224,7 +223,6 @@ xfs_symlink(
|
||||
return error;
|
||||
|
||||
tp = xfs_trans_alloc(mp, XFS_TRANS_SYMLINK);
|
||||
cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
|
||||
/*
|
||||
* The symlink will fit into the inode data fork?
|
||||
* There can't be any attributes so we get the whole variable part.
|
||||
@@ -239,10 +237,8 @@ xfs_symlink(
|
||||
resblks = 0;
|
||||
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_symlink, 0, 0);
|
||||
}
|
||||
if (error) {
|
||||
cancel_flags = 0;
|
||||
if (error)
|
||||
goto out_trans_cancel;
|
||||
}
|
||||
|
||||
xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
|
||||
unlock_dp_on_error = true;
|
||||
@@ -407,9 +403,8 @@ xfs_symlink(
|
||||
|
||||
out_bmap_cancel:
|
||||
xfs_bmap_cancel(&free_list);
|
||||
cancel_flags |= XFS_TRANS_ABORT;
|
||||
out_trans_cancel:
|
||||
xfs_trans_cancel(tp, cancel_flags);
|
||||
xfs_trans_cancel(tp);
|
||||
out_release_inode:
|
||||
/*
|
||||
* Wait until after the current transaction is aborted to finish the
|
||||
@@ -464,7 +459,7 @@ xfs_inactive_symlink_rmt(
|
||||
tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE);
|
||||
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_itruncate, 0, 0);
|
||||
if (error) {
|
||||
xfs_trans_cancel(tp, 0);
|
||||
xfs_trans_cancel(tp);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -552,7 +547,7 @@ xfs_inactive_symlink_rmt(
|
||||
error_bmap_cancel:
|
||||
xfs_bmap_cancel(&free_list);
|
||||
error_trans_cancel:
|
||||
xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT);
|
||||
xfs_trans_cancel(tp);
|
||||
error_unlock:
|
||||
xfs_iunlock(ip, XFS_ILOCK_EXCL);
|
||||
return error;
|
||||
|
Reference in New Issue
Block a user