xfs: switch remaining xfs_trans_dup users to xfs_trans_roll
We have three remaining callers of xfs_trans_dup: - xfs_itruncate_extents which open codes xfs_trans_roll - xfs_bmap_finish doesn't have an xfs_inode argument and thus leaves attaching them to it's callers, but otherwise is identical to xfs_trans_roll - xfs_dir_ialloc looks at the log reservations in the old xfs_trans structure instead of the log reservation parameters, but otherwise is identical to xfs_trans_roll. By allowing a NULL xfs_inode argument to xfs_trans_roll we can switch these three remaining users over to xfs_trans_roll and mark xfs_trans_dup static. 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
5ebe6afaf0
commit
2e6db6c4c1
@@ -905,7 +905,6 @@ xfs_dir_ialloc(
|
||||
|
||||
{
|
||||
xfs_trans_t *tp;
|
||||
xfs_trans_t *ntp;
|
||||
xfs_inode_t *ip;
|
||||
xfs_buf_t *ialloc_context = NULL;
|
||||
int code;
|
||||
@@ -954,8 +953,6 @@ xfs_dir_ialloc(
|
||||
* to succeed the second time.
|
||||
*/
|
||||
if (ialloc_context) {
|
||||
struct xfs_trans_res tres;
|
||||
|
||||
/*
|
||||
* Normally, xfs_trans_commit releases all the locks.
|
||||
* We call bhold to hang on to the ialloc_context across
|
||||
@@ -964,12 +961,6 @@ xfs_dir_ialloc(
|
||||
* allocation group.
|
||||
*/
|
||||
xfs_trans_bhold(tp, ialloc_context);
|
||||
/*
|
||||
* Save the log reservation so we can use
|
||||
* them in the next transaction.
|
||||
*/
|
||||
tres.tr_logres = xfs_trans_get_log_res(tp);
|
||||
tres.tr_logcount = xfs_trans_get_log_count(tp);
|
||||
|
||||
/*
|
||||
* We want the quota changes to be associated with the next
|
||||
@@ -985,35 +976,9 @@ xfs_dir_ialloc(
|
||||
tp->t_flags &= ~(XFS_TRANS_DQ_DIRTY);
|
||||
}
|
||||
|
||||
ntp = xfs_trans_dup(tp);
|
||||
code = xfs_trans_commit(tp, 0);
|
||||
tp = ntp;
|
||||
if (committed != NULL) {
|
||||
code = xfs_trans_roll(&tp, 0);
|
||||
if (committed != NULL)
|
||||
*committed = 1;
|
||||
}
|
||||
/*
|
||||
* If we get an error during the commit processing,
|
||||
* release the buffer that is still held and return
|
||||
* to the caller.
|
||||
*/
|
||||
if (code) {
|
||||
xfs_buf_relse(ialloc_context);
|
||||
if (dqinfo) {
|
||||
tp->t_dqinfo = dqinfo;
|
||||
xfs_trans_free_dqinfo(tp);
|
||||
}
|
||||
*tpp = ntp;
|
||||
*ipp = NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
* transaction commit worked ok so we can drop the extra ticket
|
||||
* reference that we gained in xfs_trans_dup()
|
||||
*/
|
||||
xfs_log_ticket_put(tp->t_ticket);
|
||||
tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
|
||||
code = xfs_trans_reserve(tp, &tres, 0, 0);
|
||||
|
||||
/*
|
||||
* Re-attach the quota info that we detached from prev trx.
|
||||
@@ -1025,7 +990,7 @@ xfs_dir_ialloc(
|
||||
|
||||
if (code) {
|
||||
xfs_buf_relse(ialloc_context);
|
||||
*tpp = ntp;
|
||||
*tpp = tp;
|
||||
*ipp = NULL;
|
||||
return code;
|
||||
}
|
||||
@@ -1555,7 +1520,6 @@ xfs_itruncate_extents(
|
||||
{
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
struct xfs_trans *tp = *tpp;
|
||||
struct xfs_trans *ntp;
|
||||
xfs_bmap_free_t free_list;
|
||||
xfs_fsblock_t first_block;
|
||||
xfs_fileoff_t first_unmap_block;
|
||||
@@ -1613,29 +1577,7 @@ xfs_itruncate_extents(
|
||||
if (error)
|
||||
goto out_bmap_cancel;
|
||||
|
||||
if (committed) {
|
||||
/*
|
||||
* Mark the inode dirty so it will be logged and
|
||||
* moved forward in the log as part of every commit.
|
||||
*/
|
||||
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
|
||||
}
|
||||
|
||||
ntp = xfs_trans_dup(tp);
|
||||
error = xfs_trans_commit(tp, 0);
|
||||
tp = ntp;
|
||||
|
||||
xfs_trans_ijoin(tp, ip, 0);
|
||||
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Transaction commit worked ok so we can drop the extra ticket
|
||||
* reference that we gained in xfs_trans_dup()
|
||||
*/
|
||||
xfs_log_ticket_put(tp->t_ticket);
|
||||
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_itruncate, 0, 0);
|
||||
error = xfs_trans_roll(&tp, ip);
|
||||
if (error)
|
||||
goto out;
|
||||
}
|
||||
|
Reference in New Issue
Block a user