[XFS_DEFER_OPS_TYPE_AGFL_FREE] = &xfs_agfl_free_defer_type,
};
+static void
+xfs_defer_create_intent(
+ struct xfs_trans *tp,
+ struct xfs_defer_pending *dfp,
+ bool sort)
+{
+ const struct xfs_defer_op_type *ops = defer_op_types[dfp->dfp_type];
+ struct list_head *li;
+
+ if (sort)
+ list_sort(tp->t_mountp, &dfp->dfp_work, ops->diff_items);
+
+ dfp->dfp_intent = ops->create_intent(tp, dfp->dfp_count);
+ list_for_each(li, &dfp->dfp_work)
+ ops->log_item(tp, dfp->dfp_intent, li);
+}
+
/*
* For each pending item in the intake list, log its intent item and the
* associated extents, then add the entire intake list to the end of
xfs_defer_create_intents(
struct xfs_trans *tp)
{
- struct list_head *li;
struct xfs_defer_pending *dfp;
- const struct xfs_defer_op_type *ops;
list_for_each_entry(dfp, &tp->t_dfops, dfp_list) {
- ops = defer_op_types[dfp->dfp_type];
- dfp->dfp_intent = ops->create_intent(tp, dfp->dfp_count);
trace_xfs_defer_create_intent(tp->t_mountp, dfp);
- list_sort(tp->t_mountp, &dfp->dfp_work, ops->diff_items);
- list_for_each(li, &dfp->dfp_work)
- ops->log_item(tp, dfp->dfp_intent, li);
+ xfs_defer_create_intent(tp, dfp, true);
}
}
}
if (error == -EAGAIN) {
/*
- * Caller wants a fresh transaction, so log a
- * new log intent item to replace the old one
- * and roll the transaction. See "Requesting
- * a Fresh Transaction while Finishing
- * Deferred Work" above.
+ * Caller wants a fresh transaction, so log a new log
+ * intent item to replace the old one and roll the
+ * transaction. See "Requesting a Fresh Transaction
+ * while Finishing Deferred Work" above.
*/
- dfp->dfp_intent = ops->create_intent(*tp,
- dfp->dfp_count);
dfp->dfp_done = NULL;
- list_for_each(li, &dfp->dfp_work)
- ops->log_item(*tp, dfp->dfp_intent, li);
+ xfs_defer_create_intent(*tp, dfp, false);
} else {
/* Done with the dfp, free it. */
list_del(&dfp->dfp_list);