From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/3] xfs: trace log reservations at mount time
Date: Fri, 5 Jan 2018 08:08:23 -0500 [thread overview]
Message-ID: <20180105130822.GA27973@bfoster.bfoster> (raw)
In-Reply-To: <151512356737.14363.9190260401902946215.stgit@magnolia>
On Thu, Jan 04, 2018 at 07:39:27PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> At each mount, emit the transaction reservation type information via
> tracepoints. This makes it easier to compare the log reservation info
> calculated by the kernel and xfsprogs so that we can more easily diagnose
> minimum log size failures on freshly formatted filesystems.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Seems fine:
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/libxfs/xfs_log_rlimit.c | 2 +-
> fs/xfs/libxfs/xfs_shared.h | 3 +++
> fs/xfs/xfs_trace.h | 26 ++++++++++++++++++++++++++
> fs/xfs/xfs_trans.c | 22 ++++++++++++++++++++++
> 4 files changed, 52 insertions(+), 1 deletion(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_log_rlimit.c b/fs/xfs/libxfs/xfs_log_rlimit.c
> index c105979..cc4cbe2 100644
> --- a/fs/xfs/libxfs/xfs_log_rlimit.c
> +++ b/fs/xfs/libxfs/xfs_log_rlimit.c
> @@ -55,7 +55,7 @@ xfs_log_calc_max_attrsetm_res(
> * the maximum one in terms of the pre-calculated values which were done
> * at mount time.
> */
> -STATIC void
> +void
> xfs_log_get_max_trans_res(
> struct xfs_mount *mp,
> struct xfs_trans_res *max_resp)
> diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
> index 67ccb1a..d0b84da 100644
> --- a/fs/xfs/libxfs/xfs_shared.h
> +++ b/fs/xfs/libxfs/xfs_shared.h
> @@ -76,6 +76,9 @@ struct xfs_log_item_desc {
> int xfs_log_calc_unit_res(struct xfs_mount *mp, int unit_bytes);
> int xfs_log_calc_minimum_size(struct xfs_mount *);
>
> +struct xfs_trans_res;
> +void xfs_log_get_max_trans_res(struct xfs_mount *mp,
> + struct xfs_trans_res *max_resp);
>
> /*
> * Values for t_flags.
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index 9235b2c..b6251f8 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -3313,6 +3313,32 @@ DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
> DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
> DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
>
> +TRACE_EVENT(xfs_trans_resv_calc,
> + TP_PROTO(struct xfs_mount *mp, unsigned int type,
> + struct xfs_trans_res *res),
> + TP_ARGS(mp, type, res),
> + TP_STRUCT__entry(
> + __field(dev_t, dev)
> + __field(int, type)
> + __field(uint, logres)
> + __field(int, logcount)
> + __field(int, logflags)
> + ),
> + TP_fast_assign(
> + __entry->dev = mp->m_super->s_dev;
> + __entry->type = type;
> + __entry->logres = res->tr_logres;
> + __entry->logcount = res->tr_logcount;
> + __entry->logflags = res->tr_logflags;
> + ),
> + TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
> + MAJOR(__entry->dev), MINOR(__entry->dev),
> + __entry->type,
> + __entry->logres,
> + __entry->logcount,
> + __entry->logflags)
> +);
> +
> #endif /* _TRACE_XFS_H */
>
> #undef TRACE_INCLUDE_PATH
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index a87f657..86f92df 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -35,6 +35,27 @@
> kmem_zone_t *xfs_trans_zone;
> kmem_zone_t *xfs_log_item_desc_zone;
>
> +#if defined(CONFIG_TRACEPOINTS)
> +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;
> +
> + res = (struct xfs_trans_res *)M_RES(mp);
> + 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)
> +#endif
> +
> /*
> * Initialize the precomputed transaction reservation values
> * in the mount structure.
> @@ -44,6 +65,7 @@ xfs_trans_init(
> struct xfs_mount *mp)
> {
> xfs_trans_resv_calc(mp, M_RES(mp));
> + xfs_trans_trace_reservations(mp);
> }
>
> /*
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-05 13:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-05 3:39 [PATCH 0/3] xfs: refactors for xfsprogs Darrick J. Wong
2018-01-05 3:39 ` [PATCH 1/3] xfs: trace log reservations at mount time Darrick J. Wong
2018-01-05 13:08 ` Brian Foster [this message]
2018-01-05 3:39 ` [PATCH 2/3] xfs: hoist xfs_fs_geometry to libxfs Darrick J. Wong
2018-01-05 13:08 ` Brian Foster
2018-01-05 3:39 ` [PATCH 3/3] xfs: refactor the geometry structure filling function Darrick J. Wong
2018-01-05 13:08 ` Brian Foster
2018-01-05 17:25 ` Darrick J. Wong
2018-01-05 17:34 ` [PATCH v2 " Darrick J. Wong
2018-01-05 19:02 ` Brian Foster
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=20180105130822.GA27973@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).