Skip to content

Commit c4ae021

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: convert remaining trace points to pass pag structures
Convert all tracepoints that take [mp,agno] tuples to take a pag argument instead so that decoding only happens when tracepoints are enabled and to clean up the callers. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent dc8df7e commit c4ae021

14 files changed

+98
-106
lines changed

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3360,7 +3360,7 @@ xfs_read_agf(
33603360
struct xfs_mount *mp = pag->pag_mount;
33613361
int error;
33623362

3363-
trace_xfs_read_agf(pag->pag_mount, pag->pag_agno);
3363+
trace_xfs_read_agf(pag);
33643364

33653365
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
33663366
XFS_AG_DADDR(mp, pag->pag_agno, XFS_AGF_DADDR(mp)),
@@ -3391,7 +3391,7 @@ xfs_alloc_read_agf(
33913391
int error;
33923392
int allocbt_blks;
33933393

3394-
trace_xfs_alloc_read_agf(pag->pag_mount, pag->pag_agno);
3394+
trace_xfs_alloc_read_agf(pag);
33953395

33963396
/* We don't support trylock when freeing. */
33973397
ASSERT((flags & (XFS_ALLOC_FLAG_FREEING | XFS_ALLOC_FLAG_TRYLOCK)) !=

fs/xfs/libxfs/xfs_ialloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,7 +2729,7 @@ xfs_read_agi(
27292729
struct xfs_mount *mp = pag->pag_mount;
27302730
int error;
27312731

2732-
trace_xfs_read_agi(pag->pag_mount, pag->pag_agno);
2732+
trace_xfs_read_agi(pag);
27332733

27342734
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
27352735
XFS_AG_DADDR(mp, pag->pag_agno, XFS_AGI_DADDR(mp)),
@@ -2760,7 +2760,7 @@ xfs_ialloc_read_agi(
27602760
struct xfs_agi *agi;
27612761
int error;
27622762

2763-
trace_xfs_ialloc_read_agi(pag->pag_mount, pag->pag_agno);
2763+
trace_xfs_ialloc_read_agi(pag);
27642764

27652765
error = xfs_read_agi(pag, tp,
27662766
(flags & XFS_IALLOC_FLAG_TRYLOCK) ? XBF_TRYLOCK : 0,

fs/xfs/libxfs/xfs_inode_util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ xfs_iunlink_update_bucket(
442442
ASSERT(xfs_verify_agino_or_null(pag, new_agino));
443443

444444
old_value = be32_to_cpu(agi->agi_unlinked[bucket_index]);
445-
trace_xfs_iunlink_update_bucket(tp->t_mountp, pag->pag_agno, bucket_index,
446-
old_value, new_agino);
445+
trace_xfs_iunlink_update_bucket(pag, bucket_index, old_value,
446+
new_agino);
447447

448448
/*
449449
* We should never find the head of the list already set to the value

fs/xfs/scrub/alloc_repair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ xrep_abt_stash(
210210
if (error)
211211
return error;
212212

213-
trace_xrep_abt_found(sc->mp, sc->sa.pag->pag_agno, &arec);
213+
trace_xrep_abt_found(sc->sa.pag, &arec);
214214

215215
error = xfarray_append(ra->free_records, &arec);
216216
if (error)

fs/xfs/scrub/ialloc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ xchk_iallocbt_check_cluster(
367367
struct xfs_mount *mp = bs->cur->bc_mp;
368368
struct xfs_buf *cluster_bp;
369369
unsigned int nr_inodes;
370-
xfs_agnumber_t agno = bs->cur->bc_ag.pag->pag_agno;
371370
xfs_agblock_t agbno;
372371
unsigned int cluster_index;
373372
uint16_t cluster_mask = 0;
@@ -406,7 +405,7 @@ xchk_iallocbt_check_cluster(
406405
return 0;
407406
}
408407

409-
trace_xchk_iallocbt_check_cluster(mp, agno, irec->ir_startino,
408+
trace_xchk_iallocbt_check_cluster(bs->cur->bc_ag.pag, irec->ir_startino,
410409
imap.im_blkno, imap.im_len, cluster_base, nr_inodes,
411410
cluster_mask, ir_holemask,
412411
XFS_INO_TO_OFFSET(mp, irec->ir_startino +

fs/xfs/scrub/ialloc_repair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ xrep_ibt_stash(
192192
if (ri->rie.ir_freecount > 0)
193193
ri->finobt_recs++;
194194

195-
trace_xrep_ibt_found(ri->sc->mp, ri->sc->sa.pag->pag_agno, &ri->rie);
195+
trace_xrep_ibt_found(ri->sc->sa.pag, &ri->rie);
196196

197197
error = xfarray_append(ri->inode_records, &ri->rie);
198198
if (error)

fs/xfs/scrub/repair.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ xrep_findroot_block(
611611
else
612612
fab->root = NULLAGBLOCK;
613613

614-
trace_xrep_findroot_block(mp, ri->sc->sa.pag->pag_agno, agbno,
614+
trace_xrep_findroot_block(ri->sc->sa.pag, agbno,
615615
be32_to_cpu(btblock->bb_magic), fab->height - 1);
616616
out:
617617
xfs_trans_brelse(ri->sc->tp, bp);

fs/xfs/scrub/rmap_repair.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ xrep_rmap_stash(
231231
if (xchk_iscan_aborted(&rr->iscan))
232232
return -EFSCORRUPTED;
233233

234-
trace_xrep_rmap_found(sc->mp, sc->sa.pag->pag_agno, &rmap);
234+
trace_xrep_rmap_found(sc->sa.pag, &rmap);
235235

236236
mutex_lock(&rr->lock);
237237
mcur = xfs_rmapbt_mem_cursor(sc->sa.pag, sc->tp, &rr->rmap_btree);
@@ -1552,7 +1552,7 @@ xrep_rmapbt_live_update(
15521552
if (!xrep_rmapbt_want_live_update(&rr->iscan, &p->oinfo))
15531553
goto out_unlock;
15541554

1555-
trace_xrep_rmap_live_update(mp, rr->sc->sa.pag->pag_agno, action, p);
1555+
trace_xrep_rmap_live_update(rr->sc->sa.pag, action, p);
15561556

15571557
error = xrep_trans_alloc_hook_dummy(mp, &txcookie, &tp);
15581558
if (error)

fs/xfs/scrub/trace.h

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -772,12 +772,12 @@ TRACE_EVENT(xchk_xref_error,
772772
);
773773

774774
TRACE_EVENT(xchk_iallocbt_check_cluster,
775-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
776-
xfs_agino_t startino, xfs_daddr_t map_daddr,
777-
unsigned short map_len, unsigned int chunk_ino,
778-
unsigned int nr_inodes, uint16_t cluster_mask,
779-
uint16_t holemask, unsigned int cluster_ino),
780-
TP_ARGS(mp, agno, startino, map_daddr, map_len, chunk_ino, nr_inodes,
775+
TP_PROTO(const struct xfs_perag *pag, xfs_agino_t startino,
776+
xfs_daddr_t map_daddr, unsigned short map_len,
777+
unsigned int chunk_ino, unsigned int nr_inodes,
778+
uint16_t cluster_mask, uint16_t holemask,
779+
unsigned int cluster_ino),
780+
TP_ARGS(pag, startino, map_daddr, map_len, chunk_ino, nr_inodes,
781781
cluster_mask, holemask, cluster_ino),
782782
TP_STRUCT__entry(
783783
__field(dev_t, dev)
@@ -792,8 +792,8 @@ TRACE_EVENT(xchk_iallocbt_check_cluster,
792792
__field(uint16_t, holemask)
793793
),
794794
TP_fast_assign(
795-
__entry->dev = mp->m_super->s_dev;
796-
__entry->agno = agno;
795+
__entry->dev = pag->pag_mount->m_super->s_dev;
796+
__entry->agno = pag->pag_agno;
797797
__entry->startino = startino;
798798
__entry->map_daddr = map_daddr;
799799
__entry->map_len = map_len;
@@ -2016,18 +2016,18 @@ TRACE_EVENT(xrep_ibt_walk_rmap,
20162016
);
20172017

20182018
TRACE_EVENT(xrep_abt_found,
2019-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2019+
TP_PROTO(const struct xfs_perag *pag,
20202020
const struct xfs_alloc_rec_incore *rec),
2021-
TP_ARGS(mp, agno, rec),
2021+
TP_ARGS(pag, rec),
20222022
TP_STRUCT__entry(
20232023
__field(dev_t, dev)
20242024
__field(xfs_agnumber_t, agno)
20252025
__field(xfs_agblock_t, startblock)
20262026
__field(xfs_extlen_t, blockcount)
20272027
),
20282028
TP_fast_assign(
2029-
__entry->dev = mp->m_super->s_dev;
2030-
__entry->agno = agno;
2029+
__entry->dev = pag->pag_mount->m_super->s_dev;
2030+
__entry->agno = pag->pag_agno;
20312031
__entry->startblock = rec->ar_startblock;
20322032
__entry->blockcount = rec->ar_blockcount;
20332033
),
@@ -2039,9 +2039,9 @@ TRACE_EVENT(xrep_abt_found,
20392039
)
20402040

20412041
TRACE_EVENT(xrep_ibt_found,
2042-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2042+
TP_PROTO(const struct xfs_perag *pag,
20432043
const struct xfs_inobt_rec_incore *rec),
2044-
TP_ARGS(mp, agno, rec),
2044+
TP_ARGS(pag, rec),
20452045
TP_STRUCT__entry(
20462046
__field(dev_t, dev)
20472047
__field(xfs_agnumber_t, agno)
@@ -2052,8 +2052,8 @@ TRACE_EVENT(xrep_ibt_found,
20522052
__field(uint64_t, freemask)
20532053
),
20542054
TP_fast_assign(
2055-
__entry->dev = mp->m_super->s_dev;
2056-
__entry->agno = agno;
2055+
__entry->dev = pag->pag_mount->m_super->s_dev;
2056+
__entry->agno = pag->pag_agno;
20572057
__entry->startino = rec->ir_startino;
20582058
__entry->holemask = rec->ir_holemask;
20592059
__entry->count = rec->ir_count;
@@ -2132,9 +2132,8 @@ TRACE_EVENT(xrep_bmap_found,
21322132
);
21332133

21342134
TRACE_EVENT(xrep_rmap_found,
2135-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2136-
const struct xfs_rmap_irec *rec),
2137-
TP_ARGS(mp, agno, rec),
2135+
TP_PROTO(const struct xfs_perag *pag, const struct xfs_rmap_irec *rec),
2136+
TP_ARGS(pag, rec),
21382137
TP_STRUCT__entry(
21392138
__field(dev_t, dev)
21402139
__field(xfs_agnumber_t, agno)
@@ -2145,8 +2144,8 @@ TRACE_EVENT(xrep_rmap_found,
21452144
__field(unsigned int, flags)
21462145
),
21472146
TP_fast_assign(
2148-
__entry->dev = mp->m_super->s_dev;
2149-
__entry->agno = agno;
2147+
__entry->dev = pag->pag_mount->m_super->s_dev;
2148+
__entry->agno = pag->pag_agno;
21502149
__entry->agbno = rec->rm_startblock;
21512150
__entry->len = rec->rm_blockcount;
21522151
__entry->owner = rec->rm_owner;
@@ -2164,9 +2163,9 @@ TRACE_EVENT(xrep_rmap_found,
21642163
);
21652164

21662165
TRACE_EVENT(xrep_findroot_block,
2167-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
2166+
TP_PROTO(const struct xfs_perag *pag, xfs_agblock_t agbno,
21682167
uint32_t magic, uint16_t level),
2169-
TP_ARGS(mp, agno, agbno, magic, level),
2168+
TP_ARGS(pag, agbno, magic, level),
21702169
TP_STRUCT__entry(
21712170
__field(dev_t, dev)
21722171
__field(xfs_agnumber_t, agno)
@@ -2175,8 +2174,8 @@ TRACE_EVENT(xrep_findroot_block,
21752174
__field(uint16_t, level)
21762175
),
21772176
TP_fast_assign(
2178-
__entry->dev = mp->m_super->s_dev;
2179-
__entry->agno = agno;
2177+
__entry->dev = pag->pag_mount->m_super->s_dev;
2178+
__entry->agno = pag->pag_agno;
21802179
__entry->agbno = agbno;
21812180
__entry->magic = magic;
21822181
__entry->level = level;
@@ -2298,8 +2297,8 @@ DECLARE_EVENT_CLASS(xrep_newbt_extent_class,
22982297
);
22992298
#define DEFINE_NEWBT_EXTENT_EVENT(name) \
23002299
DEFINE_EVENT(xrep_newbt_extent_class, name, \
2301-
TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len, \
2302-
int64_t owner), \
2300+
TP_PROTO(const struct xfs_perag *pag, xfs_agblock_t agbno, \
2301+
xfs_extlen_t len, int64_t owner), \
23032302
TP_ARGS(pag, agbno, len, owner))
23042303
DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_alloc_ag_blocks);
23052304
DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_alloc_file_blocks);
@@ -2644,9 +2643,9 @@ DEFINE_SCRUB_NLINKS_DIFF_EVENT(xrep_nlinks_update_inode);
26442643
DEFINE_SCRUB_NLINKS_DIFF_EVENT(xrep_nlinks_unfixable_inode);
26452644

26462645
TRACE_EVENT(xrep_rmap_live_update,
2647-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int op,
2646+
TP_PROTO(const struct xfs_perag *pag, unsigned int op,
26482647
const struct xfs_rmap_update_params *p),
2649-
TP_ARGS(mp, agno, op, p),
2648+
TP_ARGS(pag, op, p),
26502649
TP_STRUCT__entry(
26512650
__field(dev_t, dev)
26522651
__field(xfs_agnumber_t, agno)
@@ -2658,8 +2657,8 @@ TRACE_EVENT(xrep_rmap_live_update,
26582657
__field(unsigned int, flags)
26592658
),
26602659
TP_fast_assign(
2661-
__entry->dev = mp->m_super->s_dev;
2662-
__entry->agno = agno;
2660+
__entry->dev = pag->pag_mount->m_super->s_dev;
2661+
__entry->agno = pag->pag_agno;
26632662
__entry->op = op;
26642663
__entry->agbno = p->startblock;
26652664
__entry->len = p->blockcount;

fs/xfs/xfs_discard.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ xfs_discard_extents(
117117

118118
blk_start_plug(&plug);
119119
list_for_each_entry(busyp, &extents->extent_list, list) {
120-
trace_xfs_discard_extent(mp, busyp->pag->pag_agno, busyp->bno,
121-
busyp->length);
120+
trace_xfs_discard_extent(busyp->pag, busyp->bno, busyp->length);
122121

123122
error = __blkdev_issue_discard(mp->m_ddev_targp->bt_bdev,
124123
xfs_agbno_to_daddr(busyp->pag, busyp->bno),
@@ -239,11 +238,11 @@ xfs_trim_gather_extents(
239238
* overlapping ranges for now.
240239
*/
241240
if (fbno + flen < tcur->start) {
242-
trace_xfs_discard_exclude(mp, pag->pag_agno, fbno, flen);
241+
trace_xfs_discard_exclude(pag, fbno, flen);
243242
goto next_extent;
244243
}
245244
if (fbno > tcur->end) {
246-
trace_xfs_discard_exclude(mp, pag->pag_agno, fbno, flen);
245+
trace_xfs_discard_exclude(pag, fbno, flen);
247246
if (tcur->by_bno) {
248247
tcur->count = 0;
249248
break;
@@ -261,7 +260,7 @@ xfs_trim_gather_extents(
261260

262261
/* Too small? Give up. */
263262
if (flen < tcur->minlen) {
264-
trace_xfs_discard_toosmall(mp, pag->pag_agno, fbno, flen);
263+
trace_xfs_discard_toosmall(pag, fbno, flen);
265264
if (tcur->by_bno)
266265
goto next_extent;
267266
tcur->count = 0;
@@ -273,7 +272,7 @@ xfs_trim_gather_extents(
273272
* discard and try again the next time.
274273
*/
275274
if (xfs_extent_busy_search(pag, fbno, flen)) {
276-
trace_xfs_discard_busy(mp, pag->pag_agno, fbno, flen);
275+
trace_xfs_discard_busy(pag, fbno, flen);
277276
goto next_extent;
278277
}
279278

0 commit comments

Comments
 (0)