linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-ext4@vger.kernel.org, Eric Sandeen <sandeen@redhat.com>
Subject: Re: [PATCH v2] ext4: ignore EXT4_INODE_JOURNAL_DATA flag with delalloc
Date: Thu, 19 Jan 2012 11:50:07 -0500	[thread overview]
Message-ID: <20120119165007.GA32029@thunk.org> (raw)
In-Reply-To: <1326366224-22885-1-git-send-email-lczerner@redhat.com>

On Thu, Jan 12, 2012 at 12:03:44PM +0100, Lukas Czerner wrote:
> +	/* We do not support data journalling with delayed allocation */
> +	if (!S_ISREG(inode->i_mode) ||
> +	   (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) ||
> +	   (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) &&
> +	   !test_opt(inode->i_sb, DELALLOC)))
> +		return EXT4_INODE_JOURNAL_DATA_MODE;	/* journal data */

It's probably clearer to make avoid the complex boolean expression:

	if (!S_ISREG(inode->i_mode))
		return EXT4_INODE_JOURNAL_DATA_MODE;
	if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA))
		return EXT4_INODE_JOURNAL_DATA_MODE;
	if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) &&
	    !test_opt(inode->i_sb, DELALLOC)))
		return EXT4_INODE_JOURNAL_DATA_MODE;

You could combine the first two condiionals:

	if (!S_ISREG(inode->i_mode) ||
	    test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
		return EXT4_INODE_JOURNAL_DATA_MODE;
	if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) &&
	    !test_opt(inode->i_sb, DELALLOC)))
		return EXT4_INODE_JOURNAL_DATA_MODE;

... but combining || and && where someone has to squint and count
parenthesis can be error-prone.  I can look at either of the above two
and understand quickly what's going on.  With what you had (especially
since the identation of !test_opt(...) wasn't quite right, I had to
squint and think for a bit before I convince dmyself it was correct.

Otherwise, looks good!

					- Ted

  reply	other threads:[~2012-01-19 16:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  7:23 [PATCH] ext4: ignore EXT4_INODE_JOURNAL_DATA flag with delalloc Lukas Czerner
2012-01-11  9:20 ` Andreas Dilger
2012-01-11  9:51   ` Lukas Czerner
2012-01-11 18:13 ` Eric Sandeen
2012-01-12  7:12   ` Lukas Czerner
2012-01-12 11:03 ` [PATCH v2] " Lukas Czerner
2012-01-19 16:50   ` Ted Ts'o [this message]
2012-01-20 12:09     ` Lukas Czerner
2012-01-20 12:10     ` [PATCH v3] " Lukas Czerner
2012-01-23 22:47       ` Ted Ts'o

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=20120119165007.GA32029@thunk.org \
    --to=tytso@mit.edu \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.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;
as well as URLs for NNTP newsgroup(s).