Add a couple of tracepoints for the deferred extent free operation and
a site for injecting errors while finishing the operation. This makes
it easier to debug deferred ops and test log redo.
Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
include/xfs_trace.h | 3 +++
libxfs/xfs_alloc.c | 7 +++++++
libxfs/xfs_bmap.c | 2 ++
3 files changed, 12 insertions(+)
diff --git a/include/xfs_trace.h b/include/xfs_trace.h
index dd0d46f..cdabd18 100644
--- a/include/xfs_trace.h
+++ b/include/xfs_trace.h
@@ -184,6 +184,9 @@
#define trace_xfs_defer_pending_cancel(...) ((void) 0)
#define trace_xfs_defer_init(...) ((void) 0)
+#define trace_xfs_bmap_free_deferred(...) ((void) 0)
+#define trace_xfs_bmap_free_defer(...) ((void) 0)
+
/* set c = c to avoid unused var warnings */
#define trace_xfs_perag_get(a,b,c,d) ((c) = (c))
#define trace_xfs_perag_get_tag(a,b,c,d) ((c) = (c))
diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c
index 8454816..06133c0 100644
--- a/libxfs/xfs_alloc.c
+++ b/libxfs/xfs_alloc.c
@@ -2700,6 +2700,13 @@ xfs_free_extent(
ASSERT(len != 0);
+ trace_xfs_bmap_free_deferred(mp, agno, 0, agbno, len);
+
+ if (XFS_TEST_ERROR(false, mp,
+ XFS_ERRTAG_FREE_EXTENT,
+ XFS_RANDOM_FREE_EXTENT))
+ return -EIO;
+
error = xfs_free_extent_fix_freelist(tp, agno, &agbp);
if (error)
return error;
diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c
index 5385800..33e181c 100644
--- a/libxfs/xfs_bmap.c
+++ b/libxfs/xfs_bmap.c
@@ -588,6 +588,8 @@ xfs_bmap_add_free(
new = kmem_zone_alloc(xfs_bmap_free_item_zone, KM_SLEEP);
new->xbfi_startblock = bno;
new->xbfi_blockcount = (xfs_extlen_t)len;
+ trace_xfs_bmap_free_defer(mp, XFS_FSB_TO_AGNO(mp, bno), 0,
+ XFS_FSB_TO_AGBNO(mp, bno), len);
xfs_defer_add(dfops, XFS_DEFER_OPS_TYPE_FREE, &new->xbfi_list);
}
|