Skip to content

Commit fbe8c7e

Browse files
author
Darrick J. Wong
committed
xfs: clean up rmap log intent item tracepoint callsites
Pass the incore rmap structure to the tracepoints instead of open-coding the argument passing. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 47492ed commit fbe8c7e

File tree

4 files changed

+44
-48
lines changed

4 files changed

+44
-48
lines changed

fs/xfs/libxfs/xfs_rmap.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,20 +2585,15 @@ xfs_rmap_finish_one(
25852585
struct xfs_rmap_intent *ri,
25862586
struct xfs_btree_cur **pcur)
25872587
{
2588+
struct xfs_owner_info oinfo;
25882589
struct xfs_mount *mp = tp->t_mountp;
25892590
struct xfs_btree_cur *rcur;
25902591
struct xfs_buf *agbp = NULL;
2591-
int error = 0;
2592-
struct xfs_owner_info oinfo;
25932592
xfs_agblock_t bno;
25942593
bool unwritten;
2594+
int error = 0;
25952595

2596-
bno = XFS_FSB_TO_AGBNO(mp, ri->ri_bmap.br_startblock);
2597-
2598-
trace_xfs_rmap_deferred(mp, ri->ri_pag->pag_agno, ri->ri_type, bno,
2599-
ri->ri_owner, ri->ri_whichfork,
2600-
ri->ri_bmap.br_startoff, ri->ri_bmap.br_blockcount,
2601-
ri->ri_bmap.br_state);
2596+
trace_xfs_rmap_deferred(mp, ri);
26022597

26032598
if (XFS_TEST_ERROR(false, mp, XFS_ERRTAG_RMAP_FINISH_ONE))
26042599
return -EIO;
@@ -2673,22 +2668,15 @@ __xfs_rmap_add(
26732668
{
26742669
struct xfs_rmap_intent *ri;
26752670

2676-
trace_xfs_rmap_defer(tp->t_mountp,
2677-
XFS_FSB_TO_AGNO(tp->t_mountp, bmap->br_startblock),
2678-
type,
2679-
XFS_FSB_TO_AGBNO(tp->t_mountp, bmap->br_startblock),
2680-
owner, whichfork,
2681-
bmap->br_startoff,
2682-
bmap->br_blockcount,
2683-
bmap->br_state);
2684-
26852671
ri = kmem_cache_alloc(xfs_rmap_intent_cache, GFP_KERNEL | __GFP_NOFAIL);
26862672
INIT_LIST_HEAD(&ri->ri_list);
26872673
ri->ri_type = type;
26882674
ri->ri_owner = owner;
26892675
ri->ri_whichfork = whichfork;
26902676
ri->ri_bmap = *bmap;
26912677

2678+
trace_xfs_rmap_defer(tp->t_mountp, ri);
2679+
26922680
xfs_rmap_update_get_group(tp->t_mountp, ri);
26932681
xfs_defer_add(tp, &ri->ri_list, &xfs_rmap_update_defer_type);
26942682
}

fs/xfs/libxfs/xfs_rmap.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ enum xfs_rmap_intent_type {
157157
XFS_RMAP_FREE,
158158
};
159159

160+
#define XFS_RMAP_INTENT_STRINGS \
161+
{ XFS_RMAP_MAP, "map" }, \
162+
{ XFS_RMAP_MAP_SHARED, "map_shared" }, \
163+
{ XFS_RMAP_UNMAP, "unmap" }, \
164+
{ XFS_RMAP_UNMAP_SHARED, "unmap_shared" }, \
165+
{ XFS_RMAP_CONVERT, "cvt" }, \
166+
{ XFS_RMAP_CONVERT_SHARED, "cvt_shared" }, \
167+
{ XFS_RMAP_ALLOC, "alloc" }, \
168+
{ XFS_RMAP_FREE, "free" }
169+
160170
struct xfs_rmap_intent {
161171
struct list_head ri_list;
162172
enum xfs_rmap_intent_type ri_type;

fs/xfs/xfs_trace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "xfs_exchmaps.h"
4242
#include "xfs_exchrange.h"
4343
#include "xfs_parent.h"
44+
#include "xfs_rmap.h"
4445

4546
/*
4647
* We include this last to have the helpers above available for the trace

fs/xfs/xfs_trace.h

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ struct xfs_getparents;
9191
struct xfs_parent_irec;
9292
struct xfs_attrlist_cursor_kern;
9393
struct xfs_extent_free_item;
94+
struct xfs_rmap_intent;
9495

9596
#define XFS_ATTR_FILTER_FLAGS \
9697
{ XFS_ATTR_ROOT, "ROOT" }, \
@@ -2958,20 +2959,22 @@ DEFINE_EVENT(xfs_rmapbt_class, name, \
29582959
uint64_t owner, uint64_t offset, unsigned int flags), \
29592960
TP_ARGS(cur, agbno, len, owner, offset, flags))
29602961

2962+
TRACE_DEFINE_ENUM(XFS_RMAP_MAP);
2963+
TRACE_DEFINE_ENUM(XFS_RMAP_MAP_SHARED);
2964+
TRACE_DEFINE_ENUM(XFS_RMAP_UNMAP);
2965+
TRACE_DEFINE_ENUM(XFS_RMAP_UNMAP_SHARED);
2966+
TRACE_DEFINE_ENUM(XFS_RMAP_CONVERT);
2967+
TRACE_DEFINE_ENUM(XFS_RMAP_CONVERT_SHARED);
2968+
TRACE_DEFINE_ENUM(XFS_RMAP_ALLOC);
2969+
TRACE_DEFINE_ENUM(XFS_RMAP_FREE);
2970+
29612971
DECLARE_EVENT_CLASS(xfs_rmap_deferred_class,
2962-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2963-
int op,
2964-
xfs_agblock_t agbno,
2965-
xfs_ino_t ino,
2966-
int whichfork,
2967-
xfs_fileoff_t offset,
2968-
xfs_filblks_t len,
2969-
xfs_exntst_t state),
2970-
TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2972+
TP_PROTO(struct xfs_mount *mp, struct xfs_rmap_intent *ri),
2973+
TP_ARGS(mp, ri),
29712974
TP_STRUCT__entry(
29722975
__field(dev_t, dev)
2976+
__field(unsigned long long, owner)
29732977
__field(xfs_agnumber_t, agno)
2974-
__field(xfs_ino_t, ino)
29752978
__field(xfs_agblock_t, agbno)
29762979
__field(int, whichfork)
29772980
__field(xfs_fileoff_t, l_loff)
@@ -2981,37 +2984,31 @@ DECLARE_EVENT_CLASS(xfs_rmap_deferred_class,
29812984
),
29822985
TP_fast_assign(
29832986
__entry->dev = mp->m_super->s_dev;
2984-
__entry->agno = agno;
2985-
__entry->ino = ino;
2986-
__entry->agbno = agbno;
2987-
__entry->whichfork = whichfork;
2988-
__entry->l_loff = offset;
2989-
__entry->l_len = len;
2990-
__entry->l_state = state;
2991-
__entry->op = op;
2992-
),
2993-
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",
2987+
__entry->agno = XFS_FSB_TO_AGNO(mp, ri->ri_bmap.br_startblock);
2988+
__entry->agbno = XFS_FSB_TO_AGBNO(mp,
2989+
ri->ri_bmap.br_startblock);
2990+
__entry->owner = ri->ri_owner;
2991+
__entry->whichfork = ri->ri_whichfork;
2992+
__entry->l_loff = ri->ri_bmap.br_startoff;
2993+
__entry->l_len = ri->ri_bmap.br_blockcount;
2994+
__entry->l_state = ri->ri_bmap.br_state;
2995+
__entry->op = ri->ri_type;
2996+
),
2997+
TP_printk("dev %d:%d op %s agno 0x%x agbno 0x%x owner 0x%llx %s fileoff 0x%llx fsbcount 0x%llx state %d",
29942998
MAJOR(__entry->dev), MINOR(__entry->dev),
2995-
__entry->op,
2999+
__print_symbolic(__entry->op, XFS_RMAP_INTENT_STRINGS),
29963000
__entry->agno,
29973001
__entry->agbno,
2998-
__entry->ino,
3002+
__entry->owner,
29993003
__print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
30003004
__entry->l_loff,
30013005
__entry->l_len,
30023006
__entry->l_state)
30033007
);
30043008
#define DEFINE_RMAP_DEFERRED_EVENT(name) \
30053009
DEFINE_EVENT(xfs_rmap_deferred_class, name, \
3006-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3007-
int op, \
3008-
xfs_agblock_t agbno, \
3009-
xfs_ino_t ino, \
3010-
int whichfork, \
3011-
xfs_fileoff_t offset, \
3012-
xfs_filblks_t len, \
3013-
xfs_exntst_t state), \
3014-
TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
3010+
TP_PROTO(struct xfs_mount *mp, struct xfs_rmap_intent *ri), \
3011+
TP_ARGS(mp, ri))
30153012
DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
30163013
DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
30173014

0 commit comments

Comments
 (0)