From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: Add new constant to mark start of xqmstat
Date: Thu, 4 Oct 2018 09:09:53 +1000 [thread overview]
Message-ID: <20181003230953.GS18567@dastard> (raw)
In-Reply-To: <b7b5bab1-5c6f-2bd8-2953-b6a7f95f4717@sandeen.net>
On Wed, Oct 03, 2018 at 09:04:16AM -0500, Eric Sandeen wrote:
>
>
> On 10/3/18 9:00 AM, Carlos Maiolino wrote:
> > On Wed, Oct 03, 2018 at 07:51:43AM -0500, Eric Sandeen wrote:
> >> On 10/3/18 7:35 AM, Carlos Maiolino wrote:
> >>> xqmstat information under __xfsstats is used directly by the
> >>> /proc/fs/xfs/xqmstat show method, which makes use of struct offsets to
> >>> print out the values.
> >>>
> >>> Currently, the function is setup to start printing values from the offset of
> >>> the last marker before xqmstat, so, an update to __xfsstats structure
> >>> may also require an update of xqmstat_proc_show() function.
> >>>
> >>> By adding a new constant, we concentrate any updates do __xfsstats
> >>> structure fields locally to the file xfs_stats.h, reducing the
> >>> likelyhood of future bugs if an update to xqmstat_proc_show is
> >>> forgotten as have happened before.
> >>
> >> did
> >>
> >> BUILD_BUG_ON(offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t)) != XFSSTAT_START_XQMSTAT);
> >>
> >> and/or
> >>
> >> #define XFSSTAT_START_XQMSTAT (offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t))
> >
> > Yup, it worked, although, it still doesn't really close the possibility for
> > mistakes here, the first field may change for example and we may end up in the
> > same situation.
> >
> > I think only the 2nd option (defining START via offsetof), doesn't differ much
> > from the approach in the patch, and, using the 1st option (BUILD_BUG_ON), will
> > require an update to xqmstat_proc_show() if by any reason we change the quota
> > values, so, I thought the simpler version as the patch would suffice and be a
> > bit less confusing. But well, feel free to disagree, it's my opinion only and
> > not written on stone :P
>
> I'd argue that the first field of xqmstats changing not possible, because
> this is essentially a userspacce API. If we're going to change the format
> of xqmstats, we should only add to the end of it.
That's correct. Once published, the stats in each line are fixed in
place forever. We can extend the stats by appending new stats to the
end of each line, or by adding new lines. But we can't change the
order or meaning of existing entries.
> The thing about using offsetof() is that we'll never have to update the START
> define again, even if we add more records to the larger stats structure.
I think the whole thing needs to be changed to use offsetof() rather
than the messy set of cascading defines we have now.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2018-10-04 6:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 12:35 [PATCH 0/2] xfs stats fixes Carlos Maiolino
2018-10-03 12:35 ` [PATCH 1/2] xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat Carlos Maiolino
2018-10-03 12:47 ` Eric Sandeen
2018-10-03 13:39 ` Carlos Maiolino
2018-10-03 13:59 ` Eric Sandeen
2018-10-04 8:01 ` Carlos Maiolino
2018-10-03 15:18 ` Darrick J. Wong
2018-10-03 15:20 ` Darrick J. Wong
2018-10-03 12:35 ` [PATCH 2/2] xfs: Add new constant to mark start of xqmstat Carlos Maiolino
2018-10-03 12:51 ` Eric Sandeen
2018-10-03 14:00 ` Carlos Maiolino
2018-10-03 14:04 ` Eric Sandeen
2018-10-03 23:09 ` Dave Chinner [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=20181003230953.GS18567@dastard \
--to=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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).