[PATCH 4/4] xfs: preallocation throttling tracepoints
Brian Foster
bfoster at redhat.com
Wed Dec 5 10:47:58 CST 2012
Define tracepoints for preallocation throttling. The
xfs_prealloc_dquot_max_pct() tracepoint provides data on the max
allowable prealloc for each quota. The xfs_iomap_prealloc_size()
tracepoint provides data on the overall prealloc.
Signed-off-by: Brian Foster <bfoster at redhat.com>
---
fs/xfs/xfs_iomap.c | 6 ++++-
fs/xfs/xfs_trace.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 1 deletions(-)
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index bbeec02..0d64055 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -369,6 +369,7 @@ xfs_prealloc_dquot_max(
do_div(free, 100);
free *= pct;
+ trace_xfs_prealloc_dquot_max_pct(dq, free, pct);
return free;
}
@@ -426,7 +427,7 @@ xfs_iomap_prealloc_size(
xfs_fsblock_t alloc_blocks = 0;
int shift = 0;
int64_t freesp;
- int64_t max_quota_prealloc;
+ int64_t max_quota_prealloc = -1;
if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
goto check_writeio;
@@ -469,6 +470,9 @@ check_writeio:
if (alloc_blocks < mp->m_writeio_blocks)
alloc_blocks = mp->m_writeio_blocks;
+ trace_xfs_iomap_prealloc_size(ip, alloc_blocks, shift, max_quota_prealloc,
+ mp->m_writeio_blocks);
+
return alloc_blocks;
}
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 2e137d4..2b28626 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -618,6 +618,33 @@ DECLARE_EVENT_CLASS(xfs_iref_class,
(char *)__entry->caller_ip)
)
+TRACE_EVENT(xfs_iomap_prealloc_size,
+ TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
+ int64_t qfreesp, unsigned int writeio_blocks),
+ TP_ARGS(ip, blocks, shift, qfreesp, writeio_blocks),
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(xfs_ino_t, ino)
+ __field(xfs_fsblock_t, blocks)
+ __field(int, shift)
+ __field(int64_t, qfreesp)
+ __field(unsigned int, writeio_blocks)
+ ),
+ TP_fast_assign(
+ __entry->dev = VFS_I(ip)->i_sb->s_dev;
+ __entry->ino = ip->i_ino;
+ __entry->blocks = blocks;
+ __entry->shift = shift;
+ __entry->qfreesp = qfreesp;
+ __entry->writeio_blocks = writeio_blocks;
+ ),
+ TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
+ "quota max %lld, m_writeio_blocks %u",
+ MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
+ __entry->blocks, __entry->shift, __entry->qfreesp,
+ __entry->writeio_blocks)
+)
+
#define DEFINE_IREF_EVENT(name) \
DEFINE_EVENT(xfs_iref_class, name, \
TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
@@ -770,6 +797,41 @@ DEFINE_DQUOT_EVENT(xfs_dqflush);
DEFINE_DQUOT_EVENT(xfs_dqflush_force);
DEFINE_DQUOT_EVENT(xfs_dqflush_done);
+TRACE_EVENT(xfs_prealloc_dquot_max_pct,
+ TP_PROTO(struct xfs_dquot *dqp, int64_t free, int pct),
+ TP_ARGS(dqp, free, pct),
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(u32, id)
+ __field(unsigned long long, res_bcount)
+ __field(unsigned long long, blk_hardlimit)
+ __field(unsigned long long, blk_softlimit)
+ __field(unsigned long long, free)
+ __field(int, pct)
+ ),
+ TP_fast_assign(
+ __entry->dev = dqp->q_mount->m_super->s_dev;
+ __entry->id = be32_to_cpu(dqp->q_core.d_id);
+ __entry->res_bcount = dqp->q_res_bcount;
+ __entry->blk_hardlimit =
+ be64_to_cpu(dqp->q_core.d_blk_hardlimit);
+ __entry->blk_softlimit =
+ be64_to_cpu(dqp->q_core.d_blk_softlimit);
+ __entry->free = free;
+ __entry->pct = pct;
+ ),
+ TP_printk("dev %d:%d id 0x%x res_bc 0x%llx "
+ "bhardlimit 0x%llx bsoftlimit 0x%llx "
+ "free 0x%llx (%d%%)",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ __entry->id,
+ __entry->res_bcount,
+ __entry->blk_hardlimit,
+ __entry->blk_softlimit,
+ __entry->free,
+ __entry->pct)
+)
+
DECLARE_EVENT_CLASS(xfs_loggrant_class,
TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
TP_ARGS(log, tic),
--
1.7.7.6
More information about the xfs
mailing list