Commit 2cb91bab authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: add more dquot tracepoints

Add all the xfs_dquot fields to the tracepoint for that type; add a new
tracepoint type for the qtrx structure (dquot transaction deltas); and
use our new tracepoints.  This makes it easier for the author to trace
changes to dquot counters for debugging.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarAllison Collins <allison.henderson@oracle.com>
Reviewed-by: default avatarChandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 4b8628d5
......@@ -36,6 +36,7 @@ struct xfs_owner_info;
struct xfs_trans_res;
struct xfs_inobt_rec_incore;
union xfs_btree_ptr;
struct xfs_dqtrx;
#define XFS_ATTR_FILTER_FLAGS \
{ XFS_ATTR_ROOT, "ROOT" }, \
......@@ -867,37 +868,59 @@ DECLARE_EVENT_CLASS(xfs_dquot_class,
__field(unsigned, flags)
__field(unsigned, nrefs)
__field(unsigned long long, res_bcount)
__field(unsigned long long, res_rtbcount)
__field(unsigned long long, res_icount)
__field(unsigned long long, bcount)
__field(unsigned long long, rtbcount)
__field(unsigned long long, icount)
__field(unsigned long long, blk_hardlimit)
__field(unsigned long long, blk_softlimit)
__field(unsigned long long, rtb_hardlimit)
__field(unsigned long long, rtb_softlimit)
__field(unsigned long long, ino_hardlimit)
__field(unsigned long long, ino_softlimit)
), \
),
TP_fast_assign(
__entry->dev = dqp->q_mount->m_super->s_dev;
__entry->id = dqp->q_id;
__entry->flags = dqp->dq_flags | dqp->q_flags;
__entry->nrefs = dqp->q_nrefs;
__entry->res_bcount = dqp->q_blk.reserved;
__entry->res_rtbcount = dqp->q_rtb.reserved;
__entry->res_icount = dqp->q_ino.reserved;
__entry->bcount = dqp->q_blk.count;
__entry->rtbcount = dqp->q_rtb.count;
__entry->icount = dqp->q_ino.count;
__entry->blk_hardlimit = dqp->q_blk.hardlimit;
__entry->blk_softlimit = dqp->q_blk.softlimit;
__entry->rtb_hardlimit = dqp->q_rtb.hardlimit;
__entry->rtb_softlimit = dqp->q_rtb.softlimit;
__entry->ino_hardlimit = dqp->q_ino.hardlimit;
__entry->ino_softlimit = dqp->q_ino.softlimit;
),
TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
TP_printk("dev %d:%d id 0x%x flags %s nrefs %u "
"res_bc 0x%llx res_rtbc 0x%llx res_ic 0x%llx "
"bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
"rtbcnt 0x%llx rtbhardlimit 0x%llx rtbsoftlimit 0x%llx "
"icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->id,
__print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
__entry->nrefs,
__entry->res_bcount,
__entry->res_rtbcount,
__entry->res_icount,
__entry->bcount,
__entry->blk_hardlimit,
__entry->blk_softlimit,
__entry->rtbcount,
__entry->rtb_hardlimit,
__entry->rtb_softlimit,
__entry->icount,
__entry->ino_hardlimit,
__entry->ino_softlimit)
......@@ -928,6 +951,119 @@ DEFINE_DQUOT_EVENT(xfs_dqrele);
DEFINE_DQUOT_EVENT(xfs_dqflush);
DEFINE_DQUOT_EVENT(xfs_dqflush_force);
DEFINE_DQUOT_EVENT(xfs_dqflush_done);
DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_before);
DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_after);
#define XFS_QMOPT_FLAGS \
{ XFS_QMOPT_UQUOTA, "UQUOTA" }, \
{ XFS_QMOPT_PQUOTA, "PQUOTA" }, \
{ XFS_QMOPT_FORCE_RES, "FORCE_RES" }, \
{ XFS_QMOPT_SBVERSION, "SBVERSION" }, \
{ XFS_QMOPT_GQUOTA, "GQUOTA" }, \
{ XFS_QMOPT_INHERIT, "INHERIT" }, \
{ XFS_QMOPT_RES_REGBLKS, "RES_REGBLKS" }, \
{ XFS_QMOPT_RES_RTBLKS, "RES_RTBLKS" }, \
{ XFS_QMOPT_BCOUNT, "BCOUNT" }, \
{ XFS_QMOPT_ICOUNT, "ICOUNT" }, \
{ XFS_QMOPT_RTBCOUNT, "RTBCOUNT" }, \
{ XFS_QMOPT_DELBCOUNT, "DELBCOUNT" }, \
{ XFS_QMOPT_DELRTBCOUNT, "DELRTBCOUNT" }, \
{ XFS_QMOPT_RES_INOS, "RES_INOS" }
TRACE_EVENT(xfs_trans_mod_dquot,
TP_PROTO(struct xfs_trans *tp, struct xfs_dquot *dqp,
unsigned int field, int64_t delta),
TP_ARGS(tp, dqp, field, delta),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(unsigned int, flags)
__field(unsigned int, dqid)
__field(unsigned int, field)
__field(int64_t, delta)
),
TP_fast_assign(
__entry->dev = tp->t_mountp->m_super->s_dev;
__entry->flags = dqp->dq_flags | dqp->q_flags;
__entry->dqid = dqp->q_id;
__entry->field = field;
__entry->delta = delta;
),
TP_printk("dev %d:%d dquot id 0x%x flags %s field %s delta %lld",
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->dqid,
__print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
__print_flags(__entry->field, "|", XFS_QMOPT_FLAGS),
__entry->delta)
);
DECLARE_EVENT_CLASS(xfs_dqtrx_class,
TP_PROTO(struct xfs_dqtrx *qtrx),
TP_ARGS(qtrx),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(unsigned int, flags)
__field(u32, dqid)
__field(uint64_t, blk_res)
__field(int64_t, bcount_delta)
__field(int64_t, delbcnt_delta)
__field(uint64_t, rtblk_res)
__field(uint64_t, rtblk_res_used)
__field(int64_t, rtbcount_delta)
__field(int64_t, delrtb_delta)
__field(uint64_t, ino_res)
__field(uint64_t, ino_res_used)
__field(int64_t, icount_delta)
),
TP_fast_assign(
__entry->dev = qtrx->qt_dquot->q_mount->m_super->s_dev;
__entry->flags = qtrx->qt_dquot->dq_flags | qtrx->qt_dquot->q_flags;
__entry->dqid = qtrx->qt_dquot->q_id;
__entry->blk_res = qtrx->qt_blk_res;
__entry->bcount_delta = qtrx->qt_bcount_delta;
__entry->delbcnt_delta = qtrx->qt_delbcnt_delta;
__entry->rtblk_res = qtrx->qt_rtblk_res;
__entry->rtblk_res_used = qtrx->qt_rtblk_res_used;
__entry->rtbcount_delta = qtrx->qt_rtbcount_delta;
__entry->delrtb_delta = qtrx->qt_delrtb_delta;
__entry->ino_res = qtrx->qt_ino_res;
__entry->ino_res_used = qtrx->qt_ino_res_used;
__entry->icount_delta = qtrx->qt_icount_delta;
),
TP_printk("dev %d:%d dquot id 0x%x flags %s"
"blk_res %llu bcount_delta %lld delbcnt_delta %lld "
"rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld "
"ino_res %llu ino_res_used %llu icount_delta %lld",
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->dqid,
__print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
__entry->blk_res,
__entry->bcount_delta,
__entry->delbcnt_delta,
__entry->rtblk_res,
__entry->rtblk_res_used,
__entry->rtbcount_delta,
__entry->delrtb_delta,
__entry->ino_res,
__entry->ino_res_used,
__entry->icount_delta)
)
#define DEFINE_DQTRX_EVENT(name) \
DEFINE_EVENT(xfs_dqtrx_class, name, \
TP_PROTO(struct xfs_dqtrx *qtrx), \
TP_ARGS(qtrx))
DEFINE_DQTRX_EVENT(xfs_trans_apply_dquot_deltas);
DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_before);
DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_after);
DECLARE_EVENT_CLASS(xfs_loggrant_class,
TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
......
......@@ -15,6 +15,7 @@
#include "xfs_trans_priv.h"
#include "xfs_quota.h"
#include "xfs_qm.h"
#include "xfs_trace.h"
STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *);
......@@ -203,6 +204,11 @@ xfs_trans_mod_dquot(
if (qtrx->qt_dquot == NULL)
qtrx->qt_dquot = dqp;
if (delta) {
trace_xfs_trans_mod_dquot_before(qtrx);
trace_xfs_trans_mod_dquot(tp, dqp, field, delta);
}
switch (field) {
/*
......@@ -266,6 +272,10 @@ xfs_trans_mod_dquot(
default:
ASSERT(0);
}
if (delta)
trace_xfs_trans_mod_dquot_after(qtrx);
tp->t_flags |= XFS_TRANS_DQ_DIRTY;
}
......@@ -391,6 +401,13 @@ xfs_trans_apply_dquot_deltas(
qtrx->qt_delbcnt_delta;
totalrtbdelta = qtrx->qt_rtbcount_delta +
qtrx->qt_delrtb_delta;
if (totalbdelta != 0 || totalrtbdelta != 0 ||
qtrx->qt_icount_delta != 0) {
trace_xfs_trans_apply_dquot_deltas_before(dqp);
trace_xfs_trans_apply_dquot_deltas(qtrx);
}
#ifdef DEBUG
if (totalbdelta < 0)
ASSERT(dqp->q_blk.count >= -totalbdelta);
......@@ -410,6 +427,10 @@ xfs_trans_apply_dquot_deltas(
if (totalrtbdelta)
dqp->q_rtb.count += totalrtbdelta;
if (totalbdelta != 0 || totalrtbdelta != 0 ||
qtrx->qt_icount_delta != 0)
trace_xfs_trans_apply_dquot_deltas_after(dqp);
/*
* Get any default limits in use.
* Start/reset the timer(s) if needed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment