From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: Eric Sandeen <sandeen@redhat.com>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH 0/2] xfs: pass mp to XFS_WANT_CORRUPTED_*
Date: Tue, 10 Feb 2015 08:58:27 +1100 [thread overview]
Message-ID: <20150209215827.GW12722@dastard> (raw)
In-Reply-To: <20150209214359.GN18336@laptop.bfoster>
On Mon, Feb 09, 2015 at 04:43:59PM -0500, Brian Foster wrote:
> On Tue, Feb 10, 2015 at 08:17:44AM +1100, Dave Chinner wrote:
> > On Mon, Feb 09, 2015 at 08:09:26AM -0500, Brian Foster wrote:
> > > On Mon, Feb 09, 2015 at 08:35:02AM +1100, Dave Chinner wrote:
> > > > On Fri, Feb 06, 2015 at 04:22:04PM -0600, Eric Sandeen wrote:
> > > > > These 2 patches provide information about which filesystem
> > > > > hit the error...
> > > >
> > > > If we are going to touch every one of these macros, then can we
> > > > rename them to something a little shorter like XFS_CORRUPT_GOTO()
> > > > and XFS_CORRUPT_RETURN() at the same time? That will make the code a
> > > > little less eye-bleedy where there are lots of these statements,
> > > > and make formatting of complex checks a bit easier, too...
> > > >
> > >
> > > XFS_CORRUPT_DOSOMETHING() jumps out to me as indicate corruption if the
> > > logic statement evaluates as true rather than false. The latter (e.g.,
> > > assert-like logic) is how they work today, so that could be a bit
> > > confusing to somebody who isn't already familiar with how these macros
> > > work.
> >
> > Someone not familiar with XFS conventions is already going to get
> > caught by "should be true" logic of these statements anyway as the
> > logic is the opposite of BUG_ON() and WARN_ON(). i.e. BUG_ON(1)
> > will kill the kernel, while ASSERT(1) indicates everything is fine.
> >
>
> BUG_ON() and ASSERT() are self-explanatory, the latter being a pretty
> standard/common thing ('man assert'). As Eric mentioned, the WANT bit of
> the macro is what suggests assert-like semantics.
>
> > I suggested shortening the macro because it makes the code that uses
> > it extensively shouty and hard to read because it splits logic
> > statements across lines regularly (e.g __xfs_dir3_data_check). I
> > want to use this more extensively in verifiers to give better
> > corruption detection reporting, but the current macro will make the
> > verifier code rather ugly. Hence my suggestion to make it shorter,
> > neater and a little less shouty...
> >
>
> Sure, but ASSERT_CORRUPT_RET() is the same length as the example above.
> ASSERT_CORRUPT_GOTO() is only a few chars longer than the associated
> example. We could still use WANT over ASSERT I suppose to shorten it up
> further. Either of those are at least still self-explanatory in my
> opinion.
Thinking on it a bit further, the XFS_WANT_CORRUPTED macros have an
internal ASSERT in them, so they are effectively an ASSERT
statement. I could live with those names, especially as ASSERT is
something that can be compiled into production kernels via
CONFIG_XFS_WARN=y to turn them into error messages...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-02-09 21:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 22:22 [PATCH 0/2] xfs: pass mp to XFS_WANT_CORRUPTED_* Eric Sandeen
2015-02-06 22:22 ` [PATCH 1/2] xfs: pass mp to XFS_WANT_CORRUPTED_GOTO Eric Sandeen
2015-02-06 22:23 ` [PATCH 2/2] xfs: pass mp to XFS_WANT_CORRUPTED_RETURN Eric Sandeen
2015-02-08 21:35 ` [PATCH 0/2] xfs: pass mp to XFS_WANT_CORRUPTED_* Dave Chinner
2015-02-09 13:09 ` Brian Foster
2015-02-09 16:42 ` Eric Sandeen
2015-02-09 21:17 ` Dave Chinner
2015-02-09 21:43 ` Brian Foster
2015-02-09 21:58 ` Dave Chinner [this message]
2015-02-10 0:00 ` Eric Sandeen
2015-02-10 10:06 ` Carlos Maiolino
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=20150209215827.GW12722@dastard \
--to=david@fromorbit.com \
--cc=bfoster@redhat.com \
--cc=sandeen@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