Skip to content

Commit 2a15e76

Browse files
author
Darrick J. Wong
committed
xfs: clean up bmap log intent item tracepoint callsites
Pass the incore bmap structure to the tracepoints instead of open-coding the argument passing. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent ef2d4a0 commit 2a15e76

4 files changed

Lines changed: 33 additions & 47 deletions

File tree

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6191,22 +6191,15 @@ __xfs_bmap_add(
61916191
{
61926192
struct xfs_bmap_intent *bi;
61936193

6194-
trace_xfs_bmap_defer(tp->t_mountp,
6195-
XFS_FSB_TO_AGNO(tp->t_mountp, bmap->br_startblock),
6196-
type,
6197-
XFS_FSB_TO_AGBNO(tp->t_mountp, bmap->br_startblock),
6198-
ip->i_ino, whichfork,
6199-
bmap->br_startoff,
6200-
bmap->br_blockcount,
6201-
bmap->br_state);
6202-
62036194
bi = kmem_cache_alloc(xfs_bmap_intent_cache, GFP_KERNEL | __GFP_NOFAIL);
62046195
INIT_LIST_HEAD(&bi->bi_list);
62056196
bi->bi_type = type;
62066197
bi->bi_owner = ip;
62076198
bi->bi_whichfork = whichfork;
62086199
bi->bi_bmap = *bmap;
62096200

6201+
trace_xfs_bmap_defer(bi);
6202+
62106203
xfs_bmap_update_get_group(tp->t_mountp, bi);
62116204
xfs_defer_add(tp, &bi->bi_list, &xfs_bmap_update_defer_type);
62126205
return 0;
@@ -6252,13 +6245,7 @@ xfs_bmap_finish_one(
62526245

62536246
ASSERT(tp->t_highest_agno == NULLAGNUMBER);
62546247

6255-
trace_xfs_bmap_deferred(tp->t_mountp,
6256-
XFS_FSB_TO_AGNO(tp->t_mountp, bmap->br_startblock),
6257-
bi->bi_type,
6258-
XFS_FSB_TO_AGBNO(tp->t_mountp, bmap->br_startblock),
6259-
bi->bi_owner->i_ino, bi->bi_whichfork,
6260-
bmap->br_startoff, bmap->br_blockcount,
6261-
bmap->br_state);
6248+
trace_xfs_bmap_deferred(bi);
62626249

62636250
if (WARN_ON_ONCE(bi->bi_whichfork != XFS_DATA_FORK)) {
62646251
xfs_bmap_mark_sick(bi->bi_owner, bi->bi_whichfork);

fs/xfs/libxfs/xfs_bmap.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ enum xfs_bmap_intent_type {
232232
XFS_BMAP_UNMAP,
233233
};
234234

235+
#define XFS_BMAP_INTENT_STRINGS \
236+
{ XFS_BMAP_MAP, "map" }, \
237+
{ XFS_BMAP_UNMAP, "unmap" }
238+
235239
struct xfs_bmap_intent {
236240
struct list_head bi_list;
237241
enum xfs_bmap_intent_type bi_type;

fs/xfs/xfs_trace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "xfs_iomap.h"
3939
#include "xfs_buf_mem.h"
4040
#include "xfs_btree_mem.h"
41+
#include "xfs_bmap.h"
4142

4243
/*
4344
* We include this last to have the helpers above available for the trace

fs/xfs/xfs_trace.h

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct xfs_icwalk;
8181
struct xfs_perag;
8282
struct xfbtree;
8383
struct xfs_btree_ops;
84+
struct xfs_bmap_intent;
8485

8586
#define XFS_ATTR_FILTER_FLAGS \
8687
{ XFS_ATTR_ROOT, "ROOT" }, \
@@ -2946,16 +2947,12 @@ DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
29462947
DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
29472948

29482949
/* deferred bmbt updates */
2950+
TRACE_DEFINE_ENUM(XFS_BMAP_MAP);
2951+
TRACE_DEFINE_ENUM(XFS_BMAP_UNMAP);
2952+
29492953
DECLARE_EVENT_CLASS(xfs_bmap_deferred_class,
2950-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2951-
int op,
2952-
xfs_agblock_t agbno,
2953-
xfs_ino_t ino,
2954-
int whichfork,
2955-
xfs_fileoff_t offset,
2956-
xfs_filblks_t len,
2957-
xfs_exntst_t state),
2958-
TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2954+
TP_PROTO(struct xfs_bmap_intent *bi),
2955+
TP_ARGS(bi),
29592956
TP_STRUCT__entry(
29602957
__field(dev_t, dev)
29612958
__field(xfs_agnumber_t, agno)
@@ -2968,38 +2965,35 @@ DECLARE_EVENT_CLASS(xfs_bmap_deferred_class,
29682965
__field(int, op)
29692966
),
29702967
TP_fast_assign(
2971-
__entry->dev = mp->m_super->s_dev;
2972-
__entry->agno = agno;
2973-
__entry->ino = ino;
2974-
__entry->agbno = agbno;
2975-
__entry->whichfork = whichfork;
2976-
__entry->l_loff = offset;
2977-
__entry->l_len = len;
2978-
__entry->l_state = state;
2979-
__entry->op = op;
2980-
),
2981-
TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x owner 0x%llx %s fileoff 0x%llx fsbcount 0x%llx state %d",
2968+
struct xfs_inode *ip = bi->bi_owner;
2969+
2970+
__entry->dev = ip->i_mount->m_super->s_dev;
2971+
__entry->agno = XFS_FSB_TO_AGNO(ip->i_mount,
2972+
bi->bi_bmap.br_startblock);
2973+
__entry->ino = ip->i_ino;
2974+
__entry->agbno = XFS_FSB_TO_AGBNO(ip->i_mount,
2975+
bi->bi_bmap.br_startblock);
2976+
__entry->whichfork = bi->bi_whichfork;
2977+
__entry->l_loff = bi->bi_bmap.br_startoff;
2978+
__entry->l_len = bi->bi_bmap.br_blockcount;
2979+
__entry->l_state = bi->bi_bmap.br_state;
2980+
__entry->op = bi->bi_type;
2981+
),
2982+
TP_printk("dev %d:%d op %s ino 0x%llx agno 0x%x agbno 0x%x %s fileoff 0x%llx fsbcount 0x%llx state %d",
29822983
MAJOR(__entry->dev), MINOR(__entry->dev),
2983-
__entry->op,
2984+
__print_symbolic(__entry->op, XFS_BMAP_INTENT_STRINGS),
2985+
__entry->ino,
29842986
__entry->agno,
29852987
__entry->agbno,
2986-
__entry->ino,
29872988
__print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
29882989
__entry->l_loff,
29892990
__entry->l_len,
29902991
__entry->l_state)
29912992
);
29922993
#define DEFINE_BMAP_DEFERRED_EVENT(name) \
29932994
DEFINE_EVENT(xfs_bmap_deferred_class, name, \
2994-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2995-
int op, \
2996-
xfs_agblock_t agbno, \
2997-
xfs_ino_t ino, \
2998-
int whichfork, \
2999-
xfs_fileoff_t offset, \
3000-
xfs_filblks_t len, \
3001-
xfs_exntst_t state), \
3002-
TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2995+
TP_PROTO(struct xfs_bmap_intent *bi), \
2996+
TP_ARGS(bi))
30032997
DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
30042998
DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
30052999

0 commit comments

Comments
 (0)