[PATCH 1/5] xfs: clean up bmap log intent item tracepoint callsites

Darrick J. Wong
2023-12-31T22:23:56Z

Pass the incore bmap structure to the tracepoints instead of open-coding
the argument passing.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
libxfs/xfs_bmap.c | 19 +++----------------
libxfs/xfs_bmap.h | 4 ++++
2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c
index 9a2cb5662d1..6b0d6d2e635 100644
--- a/libxfs/xfs_bmap.c
+++ b/libxfs/xfs_bmap.c
@@ -6163,15 +6163,6 @@ __xfs_bmap_add(
{
struct xfs_bmap_intent *bi;

- trace_xfs_bmap_defer(tp->t_mountp,
- XFS_FSB_TO_AGNO(tp->t_mountp, bmap->br_startblock),
- type,
- XFS_FSB_TO_AGBNO(tp->t_mountp, bmap->br_startblock),
- ip->i_ino, whichfork,
- bmap->br_startoff,
- bmap->br_blockcount,
- bmap->br_state);
-
bi = kmem_cache_alloc(xfs_bmap_intent_cache, GFP_NOFS | __GFP_NOFAIL);
INIT_LIST_HEAD(&bi->bi_list);
bi->bi_type = type;
@@ -6179,6 +6170,8 @@ __xfs_bmap_add(
bi->bi_whichfork = whichfork;
bi->bi_bmap = *bmap;

+ trace_xfs_bmap_defer(bi);
+
xfs_bmap_update_get_group(tp->t_mountp, bi);
xfs_defer_add(tp, &bi->bi_list, &xfs_bmap_update_defer_type);
return 0;
@@ -6224,13 +6217,7 @@ xfs_bmap_finish_one(

ASSERT(tp->t_highest_agno == NULLAGNUMBER);

- trace_xfs_bmap_deferred(tp->t_mountp,
- XFS_FSB_TO_AGNO(tp->t_mountp, bmap->br_startblock),
- bi->bi_type,
- XFS_FSB_TO_AGBNO(tp->t_mountp, bmap->br_startblock),
- bi->bi_owner->i_ino, bi->bi_whichfork,
- bmap->br_startoff, bmap->br_blockcount,
- bmap->br_state);
+ trace_xfs_bmap_deferred(bi);

if (WARN_ON_ONCE(bi->bi_whichfork != XFS_DATA_FORK)) {
xfs_bmap_mark_sick(bi->bi_owner, bi->bi_whichfork);
diff --git a/libxfs/xfs_bmap.h b/libxfs/xfs_bmap.h
index 9dd631bc2dc..b477f92c850 100644
--- a/libxfs/xfs_bmap.h
+++ b/libxfs/xfs_bmap.h
@@ -230,6 +230,10 @@ enum xfs_bmap_intent_type {
XFS_BMAP_UNMAP,
};

+#define XFS_BMAP_INTENT_STRINGS \
+ { XFS_BMAP_MAP, "map" }, \
+ { XFS_BMAP_UNMAP, "unmap" }
+
struct xfs_bmap_intent {
struct list_head bi_list;
enum xfs_bmap_intent_type bi_type;