Skip to content

Commit 38899f8

Browse files
author
Darrick J. Wong
committed
xfs: add a tracepoint for blockgc scans
Add some tracepoints so that we can observe when the speculative preallocation garbage collector runs. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com>
1 parent 758303d commit 38899f8

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

fs/xfs/xfs_ioctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,6 +2339,8 @@ xfs_file_ioctl(
23392339
if (error)
23402340
return error;
23412341

2342+
trace_xfs_ioc_free_eofblocks(mp, &keofb, _RET_IP_);
2343+
23422344
sb_start_write(mp->m_super);
23432345
error = xfs_icache_free_eofblocks(mp, &keofb);
23442346
sb_end_write(mp->m_super);

fs/xfs/xfs_trace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "xfs_filestream.h"
3030
#include "xfs_fsmap.h"
3131
#include "xfs_btree_staging.h"
32+
#include "xfs_icache.h"
3233

3334
/*
3435
* We include this last to have the helpers above available for the trace

fs/xfs/xfs_trace.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct xfs_trans_res;
3737
struct xfs_inobt_rec_incore;
3838
union xfs_btree_ptr;
3939
struct xfs_dqtrx;
40+
struct xfs_eofblocks;
4041

4142
#define XFS_ATTR_FILTER_FLAGS \
4243
{ XFS_ATTR_ROOT, "ROOT" }, \
@@ -3888,6 +3889,46 @@ DEFINE_EVENT(xfs_timestamp_range_class, name, \
38883889
DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range);
38893890
DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range);
38903891

3892+
DECLARE_EVENT_CLASS(xfs_eofblocks_class,
3893+
TP_PROTO(struct xfs_mount *mp, struct xfs_eofblocks *eofb,
3894+
unsigned long caller_ip),
3895+
TP_ARGS(mp, eofb, caller_ip),
3896+
TP_STRUCT__entry(
3897+
__field(dev_t, dev)
3898+
__field(__u32, flags)
3899+
__field(uint32_t, uid)
3900+
__field(uint32_t, gid)
3901+
__field(prid_t, prid)
3902+
__field(__u64, min_file_size)
3903+
__field(unsigned long, caller_ip)
3904+
),
3905+
TP_fast_assign(
3906+
__entry->dev = mp->m_super->s_dev;
3907+
__entry->flags = eofb ? eofb->eof_flags : 0;
3908+
__entry->uid = eofb ? from_kuid(mp->m_super->s_user_ns,
3909+
eofb->eof_uid) : 0;
3910+
__entry->gid = eofb ? from_kgid(mp->m_super->s_user_ns,
3911+
eofb->eof_gid) : 0;
3912+
__entry->prid = eofb ? eofb->eof_prid : 0;
3913+
__entry->min_file_size = eofb ? eofb->eof_min_file_size : 0;
3914+
__entry->caller_ip = caller_ip;
3915+
),
3916+
TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu caller %pS",
3917+
MAJOR(__entry->dev), MINOR(__entry->dev),
3918+
__entry->flags,
3919+
__entry->uid,
3920+
__entry->gid,
3921+
__entry->prid,
3922+
__entry->min_file_size,
3923+
(char *)__entry->caller_ip)
3924+
);
3925+
#define DEFINE_EOFBLOCKS_EVENT(name) \
3926+
DEFINE_EVENT(xfs_eofblocks_class, name, \
3927+
TP_PROTO(struct xfs_mount *mp, struct xfs_eofblocks *eofb, \
3928+
unsigned long caller_ip), \
3929+
TP_ARGS(mp, eofb, caller_ip))
3930+
DEFINE_EOFBLOCKS_EVENT(xfs_ioc_free_eofblocks);
3931+
38913932
#endif /* _TRACE_XFS_H */
38923933

38933934
#undef TRACE_INCLUDE_PATH

0 commit comments

Comments
 (0)