Linux-XFS Archive on
 help / color / Atom feed
From: Dave Chinner <>
To: "Darrick J. Wong" <>
Subject: Re: [PATCH 2/2] xfs: convert open coded corruption check to use XFS_IS_CORRUPT
Date: Sun, 10 Nov 2019 09:32:38 +1100
Message-ID: <20191109223238.GH4614@dread.disaster.area> (raw)
In-Reply-To: <157319672136.834699.13051359836285578031.stgit@magnolia>

On Thu, Nov 07, 2019 at 11:05:21PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <>
> Convert the last of the open coded corruption check and report idioms to
> use the XFS_IS_CORRUPT macro.


> +	if (XFS_IS_CORRUPT(mp,
> +	    ir.loaded != XFS_IFORK_NEXTENTS(ip, whichfork))) {

This pattern is weird. It looks like there are two separate logic
statements to the if() condition, when in fact the second line is
part of the XFS_IS_CORRUPT() macro.

It just looks wrong to me, especially when everything other
multi-line macro is indented based on the indenting of the macro

Yes, in this case it looks a bit strange, too:

			   ir.loaded != XFS_IFORK_NEXTENTS(ip, whichfork))) {

but there is no mistaking it for separate logic statements.

I kinda value being able to glance at the indent levels to see
separate logic elements....

> -		if (unlikely(
> -		       be32_to_cpu(sib_info->back) != last_blkno ||
> -		       sib_info->magic != dead_info->magic)) {
> -			XFS_ERROR_REPORT("xfs_da_swap_lastblock(3)",
> -					 XFS_ERRLEVEL_LOW, mp);
> +		if (XFS_IS_CORRUPT(mp,
> +		    be32_to_cpu(sib_info->back) != last_blkno ||
> +		    sib_info->magic != dead_info->magic)) {
>  			error = -EFSCORRUPTED;
>  			goto done;
>  		}

This is kind of what I mean - is it two or three  logic statments
here? No, it's actually one, but it has two nested checks...

There's a few other list this that are somewhat non-obvious as to
the logic...


Dave Chinner

  parent reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08  7:05 [PATCH v3 0/2] xfs: refactor corruption checking and reporting Darrick J. Wong
2019-11-08  7:05 ` [PATCH 1/2] xfs: refactor "does this fork map blocks" predicate Darrick J. Wong
2019-11-08  7:15   ` Christoph Hellwig
2019-11-08  7:05 ` [PATCH 2/2] xfs: convert open coded corruption check to use XFS_IS_CORRUPT Darrick J. Wong
2019-11-08  7:21   ` Christoph Hellwig
2019-11-09 22:32   ` Dave Chinner [this message]
2019-11-10  0:18     ` Darrick J. Wong
2019-11-10  2:49       ` Dave Chinner
2019-11-10 18:20         ` Darrick J. Wong

Reply instructions:

You may reply publically 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191109223238.GH4614@dread.disaster.area \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-XFS Archive on

Archives are clonable:
	git clone --mirror linux-xfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-xfs linux-xfs/ \
	public-inbox-index linux-xfs

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone