aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_defer.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2016-08-02 21:13:02 -0400
committerDave Chinner <david@fromorbit.com>2016-08-02 21:13:02 -0400
commit3cd48abcc1f76d6cd5ce61f3540801849a6c82e0 (patch)
treed58936b397d197f0ac27353a1dd2efdf3abe970d /fs/xfs/libxfs/xfs_defer.c
parent4e0cc29b91a8056f902f0974b49084b07491905f (diff)
xfs: add tracepoints for the deferred ops mechanism
Add tracepoints for the internals of the deferred ops mechanism and tracepoint classes for clients of the dops, to make debugging easier. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_defer.c')
-rw-r--r--fs/xfs/libxfs/xfs_defer.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
index 2809db75e0d3..054a2032fdb3 100644
--- a/fs/xfs/libxfs/xfs_defer.c
+++ b/fs/xfs/libxfs/xfs_defer.c
@@ -159,6 +159,7 @@ xfs_defer_intake_work(
159 struct xfs_defer_pending *dfp; 159 struct xfs_defer_pending *dfp;
160 160
161 list_for_each_entry(dfp, &dop->dop_intake, dfp_list) { 161 list_for_each_entry(dfp, &dop->dop_intake, dfp_list) {
162 trace_xfs_defer_intake_work(tp->t_mountp, dfp);
162 dfp->dfp_intent = dfp->dfp_type->create_intent(tp, 163 dfp->dfp_intent = dfp->dfp_type->create_intent(tp,
163 dfp->dfp_count); 164 dfp->dfp_count);
164 list_sort(tp->t_mountp, &dfp->dfp_work, 165 list_sort(tp->t_mountp, &dfp->dfp_work,
@@ -179,6 +180,7 @@ xfs_defer_trans_abort(
179{ 180{
180 struct xfs_defer_pending *dfp; 181 struct xfs_defer_pending *dfp;
181 182
183 trace_xfs_defer_trans_abort(tp->t_mountp, dop);
182 /* 184 /*
183 * If the transaction was committed, drop the intent reference 185 * If the transaction was committed, drop the intent reference
184 * since we're bailing out of here. The other reference is 186 * since we're bailing out of here. The other reference is
@@ -191,6 +193,7 @@ xfs_defer_trans_abort(
191 193
192 /* Abort intent items. */ 194 /* Abort intent items. */
193 list_for_each_entry(dfp, &dop->dop_pending, dfp_list) { 195 list_for_each_entry(dfp, &dop->dop_pending, dfp_list) {
196 trace_xfs_defer_pending_abort(tp->t_mountp, dfp);
194 if (dfp->dfp_committed) 197 if (dfp->dfp_committed)
195 dfp->dfp_type->abort_intent(dfp->dfp_intent); 198 dfp->dfp_type->abort_intent(dfp->dfp_intent);
196 } 199 }
@@ -217,9 +220,12 @@ xfs_defer_trans_roll(
217 xfs_trans_log_inode(*tp, dop->dop_inodes[i], XFS_ILOG_CORE); 220 xfs_trans_log_inode(*tp, dop->dop_inodes[i], XFS_ILOG_CORE);
218 } 221 }
219 222
223 trace_xfs_defer_trans_roll((*tp)->t_mountp, dop);
224
220 /* Roll the transaction. */ 225 /* Roll the transaction. */
221 error = xfs_trans_roll(tp, ip); 226 error = xfs_trans_roll(tp, ip);
222 if (error) { 227 if (error) {
228 trace_xfs_defer_trans_roll_error((*tp)->t_mountp, dop, error);
223 xfs_defer_trans_abort(*tp, dop, error); 229 xfs_defer_trans_abort(*tp, dop, error);
224 return error; 230 return error;
225 } 231 }
@@ -291,6 +297,8 @@ xfs_defer_finish(
291 297
292 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES); 298 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);
293 299
300 trace_xfs_defer_finish((*tp)->t_mountp, dop);
301
294 /* Until we run out of pending work to finish... */ 302 /* Until we run out of pending work to finish... */
295 while (xfs_defer_has_unfinished_work(dop)) { 303 while (xfs_defer_has_unfinished_work(dop)) {
296 /* Log intents for work items sitting in the intake. */ 304 /* Log intents for work items sitting in the intake. */
@@ -305,12 +313,14 @@ xfs_defer_finish(
305 list_for_each_entry_reverse(dfp, &dop->dop_pending, dfp_list) { 313 list_for_each_entry_reverse(dfp, &dop->dop_pending, dfp_list) {
306 if (dfp->dfp_committed) 314 if (dfp->dfp_committed)
307 break; 315 break;
316 trace_xfs_defer_pending_commit((*tp)->t_mountp, dfp);
308 dfp->dfp_committed = true; 317 dfp->dfp_committed = true;
309 } 318 }
310 319
311 /* Log an intent-done item for the first pending item. */ 320 /* Log an intent-done item for the first pending item. */
312 dfp = list_first_entry(&dop->dop_pending, 321 dfp = list_first_entry(&dop->dop_pending,
313 struct xfs_defer_pending, dfp_list); 322 struct xfs_defer_pending, dfp_list);
323 trace_xfs_defer_pending_finish((*tp)->t_mountp, dfp);
314 done_item = dfp->dfp_type->create_done(*tp, dfp->dfp_intent, 324 done_item = dfp->dfp_type->create_done(*tp, dfp->dfp_intent,
315 dfp->dfp_count); 325 dfp->dfp_count);
316 cleanup_fn = dfp->dfp_type->finish_cleanup; 326 cleanup_fn = dfp->dfp_type->finish_cleanup;
@@ -343,6 +353,10 @@ xfs_defer_finish(
343 } 353 }
344 354
345out: 355out:
356 if (error)
357 trace_xfs_defer_finish_error((*tp)->t_mountp, dop, error);
358 else
359 trace_xfs_defer_finish_done((*tp)->t_mountp, dop);
346 return error; 360 return error;
347} 361}
348 362
@@ -358,11 +372,14 @@ xfs_defer_cancel(
358 struct list_head *pwi; 372 struct list_head *pwi;
359 struct list_head *n; 373 struct list_head *n;
360 374
375 trace_xfs_defer_cancel(NULL, dop);
376
361 /* 377 /*
362 * Free the pending items. Caller should already have arranged 378 * Free the pending items. Caller should already have arranged
363 * for the intent items to be released. 379 * for the intent items to be released.
364 */ 380 */
365 list_for_each_entry_safe(dfp, pli, &dop->dop_intake, dfp_list) { 381 list_for_each_entry_safe(dfp, pli, &dop->dop_intake, dfp_list) {
382 trace_xfs_defer_intake_cancel(NULL, dfp);
366 list_del(&dfp->dfp_list); 383 list_del(&dfp->dfp_list);
367 list_for_each_safe(pwi, n, &dfp->dfp_work) { 384 list_for_each_safe(pwi, n, &dfp->dfp_work) {
368 list_del(pwi); 385 list_del(pwi);
@@ -373,6 +390,7 @@ xfs_defer_cancel(
373 kmem_free(dfp); 390 kmem_free(dfp);
374 } 391 }
375 list_for_each_entry_safe(dfp, pli, &dop->dop_pending, dfp_list) { 392 list_for_each_entry_safe(dfp, pli, &dop->dop_pending, dfp_list) {
393 trace_xfs_defer_pending_cancel(NULL, dfp);
376 list_del(&dfp->dfp_list); 394 list_del(&dfp->dfp_list);
377 list_for_each_safe(pwi, n, &dfp->dfp_work) { 395 list_for_each_safe(pwi, n, &dfp->dfp_work) {
378 list_del(pwi); 396 list_del(pwi);
@@ -441,4 +459,5 @@ xfs_defer_init(
441 *fbp = NULLFSBLOCK; 459 *fbp = NULLFSBLOCK;
442 INIT_LIST_HEAD(&dop->dop_intake); 460 INIT_LIST_HEAD(&dop->dop_intake);
443 INIT_LIST_HEAD(&dop->dop_pending); 461 INIT_LIST_HEAD(&dop->dop_pending);
462 trace_xfs_defer_init(NULL, dop);
444} 463}