public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.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: Mon, 9 Feb 2015 16:43:59 -0500	[thread overview]
Message-ID: <20150209214359.GN18336@laptop.bfoster> (raw)
In-Reply-To: <20150209211744.GT12722@dastard>

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.

Brian

> > Unfortunately, nothing shorter than the current naming immediately comes
> > to mind... :/ We could kill the XFS_ prefix I suppose or even invert the
> > logic of the calls, but that's certainly a more significant change.
> > Thoughts?
> 
> No logic changes, please.
> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2015-02-09 21:44 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 [this message]
2015-02-09 21:58         ` Dave Chinner
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=20150209214359.GN18336@laptop.bfoster \
    --to=bfoster@redhat.com \
    --cc=david@fromorbit.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