xfs: report "max_resp" used for min log size computation
authorDarrick J. Wong <djwong@kernel.org>
Tue, 26 Apr 2022 01:38:13 +0000 (18:38 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 28 Apr 2022 17:25:23 +0000 (10:25 -0700)
Move the tracepoint that computes the size of the transaction used to
compute the minimum log size into xfs_log_get_max_trans_res so that we
only have to compute this stuff once.

Leave xfs_log_get_max_trans_res as a non-static function so that xfs_db
can call it to report the results of the userspace computation of the
same value to diagnose mkfs/kernel misinteractions.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_log_rlimit.c
fs/xfs/xfs_trace.h
fs/xfs/xfs_trans.c

index 4d04568ab07ed4296b08145cf03d858925965831..1db27c3a1d16f1dfc501410d7aec6633854ddb35 100644 (file)
@@ -76,6 +76,7 @@ xfs_log_get_max_trans_res(
                *max_resp = resv.tr_attrsetm;   /* struct copy */
                max_resp->tr_logres = attr_space;
        }
+       trace_xfs_log_get_max_trans_res(mp, max_resp);
 }
 
 /*
index 9110bb5dd866619d3a4cec6ca46b23046a6ef4b7..a690987cc5f0126cba04dd4e1264d790183e7890 100644 (file)
@@ -3534,6 +3534,25 @@ DEFINE_EVENT(xfs_trans_resv_class, name, \
 DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc);
 DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc_minlogsize);
 
+TRACE_EVENT(xfs_log_get_max_trans_res,
+       TP_PROTO(struct xfs_mount *mp, const struct xfs_trans_res *res),
+       TP_ARGS(mp, res),
+       TP_STRUCT__entry(
+               __field(dev_t, dev)
+               __field(uint, logres)
+               __field(int, logcount)
+       ),
+       TP_fast_assign(
+               __entry->dev = mp->m_super->s_dev;
+               __entry->logres = res->tr_logres;
+               __entry->logcount = res->tr_logcount;
+       ),
+       TP_printk("dev %d:%d logres %u logcount %d",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
+                 __entry->logres,
+                 __entry->logcount)
+);
+
 DECLARE_EVENT_CLASS(xfs_trans_class,
        TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
        TP_ARGS(tp, caller_ip),
index 836ce2beac5309893d36717fa8c915df0281f064..82cf0189c0dbd5b44157a84a4fa9e3458c9217dd 100644 (file)
@@ -32,7 +32,6 @@ static void
 xfs_trans_trace_reservations(
        struct xfs_mount        *mp)
 {
-       struct xfs_trans_res    resv;
        struct xfs_trans_res    *res;
        struct xfs_trans_res    *end_res;
        int                     i;
@@ -41,8 +40,6 @@ xfs_trans_trace_reservations(
        end_res = (struct xfs_trans_res *)(M_RES(mp) + 1);
        for (i = 0; res < end_res; i++, res++)
                trace_xfs_trans_resv_calc(mp, i, res);
-       xfs_log_get_max_trans_res(mp, &resv);
-       trace_xfs_trans_resv_calc(mp, -1, &resv);
 }
 #else
 # define xfs_trans_trace_reservations(mp)