* transaction to add the new attribute to the leaf.
*/
- error = xfs_trans_roll(&args.trans, dp);
+ error = xfs_trans_roll_inode(&args.trans, dp);
if (error)
goto out;
* Commit the current trans (including the inode) and start
* a new one.
*/
- error = xfs_trans_roll(&args->trans, dp);
+ error = xfs_trans_roll_inode(&args->trans, dp);
if (error)
return error;
* Commit the transaction that added the attr name so that
* later routines can manage their own transactions.
*/
- error = xfs_trans_roll(&args->trans, dp);
+ error = xfs_trans_roll_inode(&args->trans, dp);
if (error)
return error;
/*
* Commit the remove and start the next trans in series.
*/
- error = xfs_trans_roll(&args->trans, dp);
+ error = xfs_trans_roll_inode(&args->trans, dp);
} else if (args->rmtblkno > 0) {
/*
* Commit the node conversion and start the next
* trans in the chain.
*/
- error = xfs_trans_roll(&args->trans, dp);
+ error = xfs_trans_roll_inode(&args->trans, dp);
if (error)
goto out;
* Commit the leaf addition or btree split and start the next
* trans in the chain.
*/
- error = xfs_trans_roll(&args->trans, dp);
+ error = xfs_trans_roll_inode(&args->trans, dp);
if (error)
goto out;
/*
* Commit and start the next trans in the chain.
*/
- error = xfs_trans_roll(&args->trans, dp);
+ error = xfs_trans_roll_inode(&args->trans, dp);
if (error)
goto out;
/*
* Commit the Btree join operation and start a new trans.
*/
- error = xfs_trans_roll(&args->trans, dp);
+ error = xfs_trans_roll_inode(&args->trans, dp);
if (error)
goto out;
}
/*
* Commit the flag value change and start the next trans in series.
*/
- return xfs_trans_roll(&args->trans, args->dp);
+ return xfs_trans_roll_inode(&args->trans, args->dp);
}
/*
/*
* Commit the flag value change and start the next trans in series.
*/
- return xfs_trans_roll(&args->trans, args->dp);
+ return xfs_trans_roll_inode(&args->trans, args->dp);
}
/*
/*
* Commit the flag value change and start the next trans in series.
*/
- error = xfs_trans_roll(&args->trans, args->dp);
+ error = xfs_trans_roll_inode(&args->trans, args->dp);
return error;
}
/*
* Start the next trans in the chain.
*/
- error = xfs_trans_roll(&args->trans, dp);
+ error = xfs_trans_roll_inode(&args->trans, dp);
if (error)
return error;
}
/*
* Close out trans and start the next one in the chain.
*/
- error = xfs_trans_roll(&args->trans, args->dp);
+ error = xfs_trans_roll_inode(&args->trans, args->dp);
if (error)
return error;
}
STATIC int
xfs_defer_trans_roll(
struct xfs_trans **tp,
- struct xfs_defer_ops *dop,
- struct xfs_inode *ip)
+ struct xfs_defer_ops *dop)
{
int i;
int error;
- /* Log all the joined inodes except the one we passed in. */
- for (i = 0; i < XFS_DEFER_OPS_NR_INODES && dop->dop_inodes[i]; i++) {
- if (dop->dop_inodes[i] == ip)
- continue;
+ /* Log all the joined inodes. */
+ for (i = 0; i < XFS_DEFER_OPS_NR_INODES && dop->dop_inodes[i]; i++)
xfs_trans_log_inode(*tp, dop->dop_inodes[i], XFS_ILOG_CORE);
- }
trace_xfs_defer_trans_roll((*tp)->t_mountp, dop);
/* Roll the transaction. */
- error = xfs_trans_roll(tp, ip);
+ error = xfs_trans_roll(tp);
if (error) {
trace_xfs_defer_trans_roll_error((*tp)->t_mountp, dop, error);
xfs_defer_trans_abort(*tp, dop, error);
}
dop->dop_committed = true;
- /* Rejoin the joined inodes except the one we passed in. */
- for (i = 0; i < XFS_DEFER_OPS_NR_INODES && dop->dop_inodes[i]; i++) {
- if (dop->dop_inodes[i] == ip)
- continue;
+ /* Rejoin the joined inodes. */
+ for (i = 0; i < XFS_DEFER_OPS_NR_INODES && dop->dop_inodes[i]; i++)
xfs_trans_ijoin(*tp, dop->dop_inodes[i], 0);
- }
return error;
}
trace_xfs_defer_finish((*tp)->t_mountp, dop);
+ xfs_defer_join(dop, ip);
+
/* Until we run out of pending work to finish... */
while (xfs_defer_has_unfinished_work(dop)) {
/* Log intents for work items sitting in the intake. */
xfs_defer_intake_work(*tp, dop);
/* Roll the transaction. */
- error = xfs_defer_trans_roll(tp, dop, ip);
+ error = xfs_defer_trans_roll(tp, dop);
if (error)
goto out;
/*
* Roll to next transaction.
*/
- error = xfs_trans_roll(trans, dp);
+ error = xfs_trans_roll_inode(trans, dp);
if (error)
return error;
}
/*
* Atomically commit the whole invalidate stuff.
*/
- error = xfs_trans_roll(trans, dp);
+ error = xfs_trans_roll_inode(trans, dp);
if (error)
return error;
}
/*
* Commit the invalidate and start the next transaction.
*/
- error = xfs_trans_roll(trans, dp);
+ error = xfs_trans_roll_inode(trans, dp);
return error;
}
tp->t_flags &= ~(XFS_TRANS_DQ_DIRTY);
}
- code = xfs_trans_roll(&tp, NULL);
+ code = xfs_trans_roll(&tp);
if (committed != NULL)
*committed = 1;
if (error)
goto out_bmap_cancel;
- error = xfs_trans_roll(&tp, ip);
+ error = xfs_trans_roll_inode(&tp, ip);
if (error)
goto out;
}
*/
int
xfs_trans_roll(
- struct xfs_trans **tpp,
- struct xfs_inode *dp)
+ struct xfs_trans **tpp)
{
- struct xfs_trans *trans;
+ struct xfs_trans *trans = *tpp;
struct xfs_trans_res tres;
int error;
- /*
- * Ensure that the inode is always logged.
- */
- trans = *tpp;
- if (dp)
- xfs_trans_log_inode(trans, dp, XFS_ILOG_CORE);
-
/*
* Copy the critical parameters from one trans to the next.
*/
tres.tr_logres = trans->t_log_res;
tres.tr_logcount = trans->t_log_count;
+
*tpp = xfs_trans_dup(trans);
/*
if (error)
return error;
- trans = *tpp;
-
/*
- * Reserve space in the log for th next transaction.
+ * Reserve space in the log for the next transaction.
* This also pushes items in the "AIL", the list of logged items,
* out to disk if they are taking up space at the tail of the log
* that we want to use. This requires that either nothing be locked
* the prior and the next transactions.
*/
tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
- error = xfs_trans_reserve(trans, &tres, 0, 0);
- /*
- * Ensure that the inode is in the new transaction and locked.
- */
- if (error)
- return error;
-
- if (dp)
- xfs_trans_ijoin(trans, dp, 0);
- return 0;
+ return xfs_trans_reserve(*tpp, &tres, 0, 0);
}
struct xfs_efd_log_item *, xfs_fsblock_t,
xfs_extlen_t, struct xfs_owner_info *);
int xfs_trans_commit(struct xfs_trans *);
-int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
+int xfs_trans_roll(struct xfs_trans **);
+int xfs_trans_roll_inode(struct xfs_trans **, struct xfs_inode *);
void xfs_trans_cancel(xfs_trans_t *);
int xfs_trans_ail_init(struct xfs_mount *);
void xfs_trans_ail_destroy(struct xfs_mount *);
flags |= ip->i_itemp->ili_last_fields;
ip->i_itemp->ili_fields |= flags;
}
+
+int
+xfs_trans_roll_inode(
+ struct xfs_trans **tpp,
+ struct xfs_inode *ip)
+{
+ int error;
+
+ xfs_trans_log_inode(*tpp, ip, XFS_ILOG_CORE);
+ error = xfs_trans_roll(tpp);
+ if (!error)
+ xfs_trans_ijoin(*tpp, ip, 0);
+ return error;
+}