public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH 4/4] xfs: preallocation throttling tracepoints
Date: Wed,  5 Dec 2012 11:47:58 -0500	[thread overview]
Message-ID: <1354726078-31793-5-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1354726078-31793-1-git-send-email-bfoster@redhat.com>

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@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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      parent reply	other threads:[~2012-12-05 16:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-05 16:47 [PATCH 0/4] speculative preallocation quota throttling Brian Foster
2012-12-05 16:47 ` [PATCH 1/4] xfs: reorganize xfs_iomap_prealloc_size to remove indentation Brian Foster
2012-12-05 16:47 ` [PATCH 2/4] xfs: push rounddown_pow_of_two() to after prealloc throttle Brian Foster
2012-12-05 16:47 ` [PATCH 3/4] xfs: add quota-driven speculative preallocation throttling Brian Foster
2012-12-05 16:47 ` Brian Foster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354726078-31793-5-git-send-email-bfoster@redhat.com \
    --to=bfoster@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox