Skip to content

Commit dc8df7e

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: pass the pag to the xrep_newbt_extent_class tracepoints
This requires moving a few of the callsites a little bit to ensure that we already have the reference, but allows for the decoding to only happen when tracing is actually enabled, and cleans up the callsites a bit. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 934dde6 commit dc8df7e

File tree

3 files changed

+24
-29
lines changed

3 files changed

+24
-29
lines changed

fs/xfs/scrub/alloc_repair.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,8 @@ xrep_abt_reserve_space(
484484
ASSERT(arec.ar_blockcount <= UINT_MAX);
485485
len = min_t(unsigned int, arec.ar_blockcount, desired);
486486

487-
trace_xrep_newbt_alloc_ag_blocks(sc->mp, sc->sa.pag->pag_agno,
488-
arec.ar_startblock, len, XFS_RMAP_OWN_AG);
487+
trace_xrep_newbt_alloc_ag_blocks(sc->sa.pag, arec.ar_startblock,
488+
len, XFS_RMAP_OWN_AG);
489489

490490
error = xrep_newbt_add_extent(&ra->new_bnobt, sc->sa.pag,
491491
arec.ar_startblock, len);
@@ -554,8 +554,8 @@ xrep_abt_dispose_one(
554554
if (free_aglen == 0)
555555
return 0;
556556

557-
trace_xrep_newbt_free_blocks(sc->mp, resv->pag->pag_agno, free_agbno,
558-
free_aglen, ra->new_bnobt.oinfo.oi_owner);
557+
trace_xrep_newbt_free_blocks(resv->pag, free_agbno, free_aglen,
558+
ra->new_bnobt.oinfo.oi_owner);
559559

560560
error = __xfs_free_extent(sc->tp, resv->pag, free_agbno, free_aglen,
561561
&ra->new_bnobt.oinfo, XFS_AG_RESV_IGNORE, true);

fs/xfs/scrub/newbt.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,15 @@ xrep_newbt_alloc_ag_blocks(
250250
return -ENOSPC;
251251

252252
agno = XFS_FSB_TO_AGNO(mp, args.fsbno);
253-
254-
trace_xrep_newbt_alloc_ag_blocks(mp, agno,
255-
XFS_FSB_TO_AGBNO(mp, args.fsbno), args.len,
256-
xnr->oinfo.oi_owner);
257-
258253
if (agno != sc->sa.pag->pag_agno) {
259254
ASSERT(agno == sc->sa.pag->pag_agno);
260255
return -EFSCORRUPTED;
261256
}
262257

258+
trace_xrep_newbt_alloc_ag_blocks(sc->sa.pag,
259+
XFS_FSB_TO_AGBNO(mp, args.fsbno), args.len,
260+
xnr->oinfo.oi_owner);
261+
263262
error = xrep_newbt_add_blocks(xnr, sc->sa.pag, &args);
264263
if (error)
265264
return error;
@@ -325,16 +324,16 @@ xrep_newbt_alloc_file_blocks(
325324

326325
agno = XFS_FSB_TO_AGNO(mp, args.fsbno);
327326

328-
trace_xrep_newbt_alloc_file_blocks(mp, agno,
329-
XFS_FSB_TO_AGBNO(mp, args.fsbno), args.len,
330-
xnr->oinfo.oi_owner);
331-
332327
pag = xfs_perag_get(mp, agno);
333328
if (!pag) {
334329
ASSERT(0);
335330
return -EFSCORRUPTED;
336331
}
337332

333+
trace_xrep_newbt_alloc_file_blocks(pag,
334+
XFS_FSB_TO_AGBNO(mp, args.fsbno), args.len,
335+
xnr->oinfo.oi_owner);
336+
338337
error = xrep_newbt_add_blocks(xnr, pag, &args);
339338
xfs_perag_put(pag);
340339
if (error)
@@ -383,8 +382,8 @@ xrep_newbt_free_extent(
383382
* space reservation, let the existing EFI free the entire
384383
* space extent.
385384
*/
386-
trace_xrep_newbt_free_blocks(sc->mp, resv->pag->pag_agno,
387-
free_agbno, free_aglen, xnr->oinfo.oi_owner);
385+
trace_xrep_newbt_free_blocks(resv->pag, free_agbno, free_aglen,
386+
xnr->oinfo.oi_owner);
388387
xfs_alloc_commit_autoreap(sc->tp, &resv->autoreap);
389388
return 1;
390389
}
@@ -401,8 +400,8 @@ xrep_newbt_free_extent(
401400
if (free_aglen == 0)
402401
return 0;
403402

404-
trace_xrep_newbt_free_blocks(sc->mp, resv->pag->pag_agno, free_agbno,
405-
free_aglen, xnr->oinfo.oi_owner);
403+
trace_xrep_newbt_free_blocks(resv->pag, free_agbno, free_aglen,
404+
xnr->oinfo.oi_owner);
406405

407406
ASSERT(xnr->resv != XFS_AG_RESV_AGFL);
408407
ASSERT(xnr->resv != XFS_AG_RESV_IGNORE);
@@ -514,7 +513,6 @@ xrep_newbt_claim_block(
514513
union xfs_btree_ptr *ptr)
515514
{
516515
struct xrep_newbt_resv *resv;
517-
struct xfs_mount *mp = cur->bc_mp;
518516
xfs_agblock_t agbno;
519517

520518
/*
@@ -539,8 +537,7 @@ xrep_newbt_claim_block(
539537
if (resv->used == resv->len)
540538
list_move_tail(&resv->list, &xnr->resv_list);
541539

542-
trace_xrep_newbt_claim_block(mp, resv->pag->pag_agno, agbno, 1,
543-
xnr->oinfo.oi_owner);
540+
trace_xrep_newbt_claim_block(resv->pag, agbno, 1, xnr->oinfo.oi_owner);
544541

545542
if (cur->bc_ops->ptr_len == XFS_BTREE_LONG_PTR_LEN)
546543
ptr->l = cpu_to_be64(xfs_agbno_to_fsb(resv->pag, agbno));

fs/xfs/scrub/trace.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,10 +2272,9 @@ TRACE_EVENT(xrep_reset_counters,
22722272
)
22732273

22742274
DECLARE_EVENT_CLASS(xrep_newbt_extent_class,
2275-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2276-
xfs_agblock_t agbno, xfs_extlen_t len,
2277-
int64_t owner),
2278-
TP_ARGS(mp, agno, agbno, len, owner),
2275+
TP_PROTO(const struct xfs_perag *pag, xfs_agblock_t agbno,
2276+
xfs_extlen_t len, int64_t owner),
2277+
TP_ARGS(pag, agbno, len, owner),
22792278
TP_STRUCT__entry(
22802279
__field(dev_t, dev)
22812280
__field(xfs_agnumber_t, agno)
@@ -2284,8 +2283,8 @@ DECLARE_EVENT_CLASS(xrep_newbt_extent_class,
22842283
__field(int64_t, owner)
22852284
),
22862285
TP_fast_assign(
2287-
__entry->dev = mp->m_super->s_dev;
2288-
__entry->agno = agno;
2286+
__entry->dev = pag->pag_mount->m_super->s_dev;
2287+
__entry->agno = pag->pag_agno;
22892288
__entry->agbno = agbno;
22902289
__entry->len = len;
22912290
__entry->owner = owner;
@@ -2299,10 +2298,9 @@ DECLARE_EVENT_CLASS(xrep_newbt_extent_class,
22992298
);
23002299
#define DEFINE_NEWBT_EXTENT_EVENT(name) \
23012300
DEFINE_EVENT(xrep_newbt_extent_class, name, \
2302-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2303-
xfs_agblock_t agbno, xfs_extlen_t len, \
2301+
TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len, \
23042302
int64_t owner), \
2305-
TP_ARGS(mp, agno, agbno, len, owner))
2303+
TP_ARGS(pag, agbno, len, owner))
23062304
DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_alloc_ag_blocks);
23072305
DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_alloc_file_blocks);
23082306
DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_free_blocks);

0 commit comments

Comments
 (0)