xfs: factor out a xfs_defer_create_intent helper
commit e046e949486ec92d83b2ccdf0e7e9144f74ef028 upstream. Create a helper that encapsulates the whole logic to create a defer intent. This reorders some of the work that was done, but none of that has an affect on the operation as only fields that don't directly interact are affected. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Chandan Babu R <chandan.babu@oracle.com> Acked-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d24633f3c2
commit
64b21eaa33
@ -178,6 +178,23 @@ static const struct xfs_defer_op_type *defer_op_types[] = {
|
|||||||
[XFS_DEFER_OPS_TYPE_AGFL_FREE] = &xfs_agfl_free_defer_type,
|
[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
|
* 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
|
* associated extents, then add the entire intake list to the end of
|
||||||
@ -187,17 +204,11 @@ STATIC void
|
|||||||
xfs_defer_create_intents(
|
xfs_defer_create_intents(
|
||||||
struct xfs_trans *tp)
|
struct xfs_trans *tp)
|
||||||
{
|
{
|
||||||
struct list_head *li;
|
|
||||||
struct xfs_defer_pending *dfp;
|
struct xfs_defer_pending *dfp;
|
||||||
const struct xfs_defer_op_type *ops;
|
|
||||||
|
|
||||||
list_for_each_entry(dfp, &tp->t_dfops, dfp_list) {
|
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);
|
trace_xfs_defer_create_intent(tp->t_mountp, dfp);
|
||||||
list_sort(tp->t_mountp, &dfp->dfp_work, ops->diff_items);
|
xfs_defer_create_intent(tp, dfp, true);
|
||||||
list_for_each(li, &dfp->dfp_work)
|
|
||||||
ops->log_item(tp, dfp->dfp_intent, li);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,17 +438,13 @@ xfs_defer_finish_noroll(
|
|||||||
}
|
}
|
||||||
if (error == -EAGAIN) {
|
if (error == -EAGAIN) {
|
||||||
/*
|
/*
|
||||||
* Caller wants a fresh transaction, so log a
|
* Caller wants a fresh transaction, so log a new log
|
||||||
* new log intent item to replace the old one
|
* intent item to replace the old one and roll the
|
||||||
* and roll the transaction. See "Requesting
|
* transaction. See "Requesting a Fresh Transaction
|
||||||
* a Fresh Transaction while Finishing
|
* while Finishing Deferred Work" above.
|
||||||
* Deferred Work" above.
|
|
||||||
*/
|
*/
|
||||||
dfp->dfp_intent = ops->create_intent(*tp,
|
|
||||||
dfp->dfp_count);
|
|
||||||
dfp->dfp_done = NULL;
|
dfp->dfp_done = NULL;
|
||||||
list_for_each(li, &dfp->dfp_work)
|
xfs_defer_create_intent(*tp, dfp, false);
|
||||||
ops->log_item(*tp, dfp->dfp_intent, li);
|
|
||||||
} else {
|
} else {
|
||||||
/* Done with the dfp, free it. */
|
/* Done with the dfp, free it. */
|
||||||
list_del(&dfp->dfp_list);
|
list_del(&dfp->dfp_list);
|
||||||
|
Loading…
Reference in New Issue
Block a user