public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Duane Griffin" <duaneg@dghda.com>
To: akpm@linux-foundation.org
Cc: duaneg@dghda.com, linux-ext4@vger.kernel.org
Subject: Re: + ext3-handle-corrupted-orphan-list-at-mount-cleanup.patch added to -mm tree
Date: Tue, 24 Jun 2008 14:34:17 +0100	[thread overview]
Message-ID: <20080624133417.GA22898@dastardly> (raw)
In-Reply-To: <200806232343.m5NNhD2B022383@imap1.linux-foundation.org>

On Mon, Jun 23, 2008 at 04:43:13PM -0700, akpm@linux-foundation.org wrote:
> Subject: ext3-handle-corrupted-orphan-list-at-mount-cleanup
> From: Andrew Morton <akpm@linux-foundation.org>
> 
> Try to make that expression less mind-boggling.
> 
> Cc: <linux-ext4@vger.kernel.org>
> Cc: Duane Griffin <duaneg@dghda.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  fs/ext3/inode.c |   14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff -puN fs/ext3/inode.c~ext3-handle-corrupted-orphan-list-at-mount-cleanup fs/ext3/inode.c
> --- a/fs/ext3/inode.c~ext3-handle-corrupted-orphan-list-at-mount-cleanup
> +++ a/fs/ext3/inode.c
> @@ -2258,10 +2258,16 @@ static void ext3_free_branches(handle_t 
>  
>  int ext3_can_truncate(struct inode *inode)
>  {
> -	return (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
> -		S_ISLNK(inode->i_mode)) &&
> -		!ext3_inode_is_fast_symlink(inode) &&
> -		!(IS_APPEND(inode) || IS_IMMUTABLE(inode));
> +	if (S_ISREG(inode->i_mode))
> +		return 1;
> +	if (S_ISDIR(inode->i_mode))
> +		return 1;
> +	if (S_ISLNK(inode->i_mode)) {
> +		if (!ext3_inode_is_fast_symlink(inode) &&
> +				!(IS_APPEND(inode) || IS_IMMUTABLE(inode)))
> +			return 1;
> +	}
> +	return 0;
>  }
>  
>  /*

Proving your point, the cleanup above is wrong. It should be:

--- fs/ext3/inode.c.orig	2008-06-24 14:19:06.000000000 +0100
+++ fs/ext3/inode.c	2008-06-24 14:19:19.000000000 +0100
@@ -2255,10 +2255,15 @@ static void ext3_free_branches(handle_t 
 
 int ext3_can_truncate(struct inode *inode)
 {
-	return (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
-		S_ISLNK(inode->i_mode)) &&
-		!ext3_inode_is_fast_symlink(inode) &&
-		!(IS_APPEND(inode) || IS_IMMUTABLE(inode));
+        if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
+                return 0;
+        if (S_ISREG(inode->i_mode))
+                return 1;
+        if (S_ISDIR(inode->i_mode))
+                return 1;
+        if (S_ISLNK(inode->i_mode))
+                return !ext3_inode_is_fast_symlink(inode);
+        return 0;
 }
 
 /*

-- 
"I never could learn to drink that blood and call it wine" - Bob Dylan

      reply	other threads:[~2008-06-24 13:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-23 23:43 + ext3-handle-corrupted-orphan-list-at-mount-cleanup.patch added to -mm tree akpm
2008-06-24 13:34 ` Duane Griffin [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=20080624133417.GA22898@dastardly \
    --to=duaneg@dghda.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-ext4@vger.kernel.org \
    /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