Skip to content

Commit 89ce287

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: trace what memory backs a buffer
Add three trace points for the different backing memory allocators for buffers. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent e614a00 commit 89ce287

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

fs/xfs/xfs_buf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ xfs_buf_alloc_kmem(
240240
return -ENOMEM;
241241
}
242242
bp->b_flags |= _XBF_KMEM;
243+
trace_xfs_buf_backing_kmem(bp, _RET_IP_);
243244
return 0;
244245
}
245246

@@ -319,9 +320,11 @@ xfs_buf_alloc_backing_mem(
319320
if (!folio) {
320321
if (size <= PAGE_SIZE)
321322
return -ENOMEM;
323+
trace_xfs_buf_backing_fallback(bp, _RET_IP_);
322324
goto fallback;
323325
}
324326
bp->b_addr = folio_address(folio);
327+
trace_xfs_buf_backing_folio(bp, _RET_IP_);
325328
return 0;
326329

327330
fallback:
@@ -335,6 +338,7 @@ xfs_buf_alloc_backing_mem(
335338
memalloc_retry_wait(gfp_mask);
336339
}
337340

341+
trace_xfs_buf_backing_vmalloc(bp, _RET_IP_);
338342
return 0;
339343
}
340344

fs/xfs/xfs_trace.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,10 @@ DEFINE_BUF_EVENT(xfs_buf_iodone_async);
692692
DEFINE_BUF_EVENT(xfs_buf_error_relse);
693693
DEFINE_BUF_EVENT(xfs_buf_drain_buftarg);
694694
DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
695+
DEFINE_BUF_EVENT(xfs_buf_backing_folio);
696+
DEFINE_BUF_EVENT(xfs_buf_backing_kmem);
697+
DEFINE_BUF_EVENT(xfs_buf_backing_vmalloc);
698+
DEFINE_BUF_EVENT(xfs_buf_backing_fallback);
695699

696700
/* not really buffer traces, but the buf provides useful information */
697701
DEFINE_BUF_EVENT(xfs_btree_corrupt);

0 commit comments

Comments
 (0)