summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 11:25:02 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-10-22 16:41:13 -0700
commit2463a42b4e735b9694b5a6d64839ae02c4a772aa (patch)
tree4c39cbab6624f364774d36438277a17c07560bc9 /fs/xfs/libxfs
parent67ef67459be06a84bec477a4558b29cae91f5c0e (diff)
xfs: track deferred ops statistics
Track some basic statistics on how hard we're pushing the defer ops. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r--fs/xfs/libxfs/xfs_defer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
index 0c34987773ad..3045ad184972 100644
--- a/fs/xfs/libxfs/xfs_defer.c
+++ b/fs/xfs/libxfs/xfs_defer.c
@@ -464,6 +464,8 @@ xfs_defer_finish_one(
/* Done with the dfp, free it. */
list_del(&dfp->dfp_list);
kmem_free(dfp);
+ tp->t_dfops_nr--;
+ tp->t_dfops_finished++;
out:
if (ops->finish_cleanup)
ops->finish_cleanup(tp, state, error);
@@ -504,6 +506,9 @@ xfs_defer_finish_noroll(
xfs_defer_create_intents(*tp);
list_splice_init(&(*tp)->t_dfops, &dop_pending);
+ (*tp)->t_dfops_nr_max = max((*tp)->t_dfops_nr,
+ (*tp)->t_dfops_nr_max);
+
error = xfs_defer_trans_roll(tp);
if (error)
goto out_shutdown;
@@ -528,6 +533,7 @@ out_shutdown:
xfs_force_shutdown((*tp)->t_mountp, SHUTDOWN_CORRUPT_INCORE);
trace_xfs_defer_finish_error(*tp, error);
xfs_defer_cancel_list((*tp)->t_mountp, &dop_pending);
+ (*tp)->t_dfops_nr = 0;
xfs_defer_cancel(*tp);
return error;
}
@@ -568,6 +574,7 @@ xfs_defer_cancel(
trace_xfs_defer_cancel(tp, _RET_IP_);
xfs_defer_cancel_list(mp, &tp->t_dfops);
+ tp->t_dfops_nr = 0;
}
/* Add an item for later deferred processing. */
@@ -605,6 +612,7 @@ xfs_defer_add(
dfp->dfp_count = 0;
INIT_LIST_HEAD(&dfp->dfp_work);
list_add_tail(&dfp->dfp_list, &tp->t_dfops);
+ tp->t_dfops_nr++;
}
list_add_tail(li, &dfp->dfp_work);
@@ -622,6 +630,12 @@ xfs_defer_move(
struct xfs_trans *stp)
{
list_splice_init(&stp->t_dfops, &dtp->t_dfops);
+ dtp->t_dfops_nr += stp->t_dfops_nr;
+ dtp->t_dfops_nr_max = stp->t_dfops_nr_max;
+ dtp->t_dfops_finished = stp->t_dfops_finished;
+ stp->t_dfops_nr = 0;
+ stp->t_dfops_nr_max = 0;
+ stp->t_dfops_finished = 0;
/*
* Low free space mode was historically controlled by a dfops field.