linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] clear extents flag on inodes created in ext4_mknod
Date: Tue, 19 Feb 2008 11:15:04 -0600	[thread overview]
Message-ID: <47BB0E98.7090905@redhat.com> (raw)
In-Reply-To: <20080219170512.GC7177@skywalker>

Aneesh Kumar K.V wrote:

>> How about enabling it only for directory and regular files rather than
>> enabling it globally and then disabling the flag for  symlink and device
>> files ?
>>
> 
> how about something like below. There are two reason for not inheriting
> the i_flag from directory.

Looks about right to me... see below

> 
> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index d2c2e55..f430939 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -794,7 +794,12 @@ got:
>  	ei->i_dir_start_lookup = 0;
>  	ei->i_disksize = 0;
>  
> -	ei->i_flags = EXT4_I(dir)->i_flags & ~EXT4_INDEX_FL;
> +	/*
> +	 * Don't inherit extent flag from directory. We set extent flag on
> +	 * newly created directory and file only if -o extent mount option is
> +	 * specfied
 nitpick:  ^^^^ typo

> +	 */
> +	ei->i_flags = EXT4_I(dir)->i_flags & ~ (EXT4_INDEX_FL|EXT4_EXTENTS_FL);
>  	if (S_ISLNK(mode))
>  		ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL);
>  	/* dirsync only applies to directories */
> @@ -836,8 +841,10 @@ got:
>  		ext4_std_error(sb, err);
>  		goto fail_free_drop;
>  	}
> -	if (test_opt(sb, EXTENTS) && !S_ISLNK(mode)) {
> -		EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
> +	if (test_opt(sb, EXTENTS)) {
> +		/* set extent flag only for diretory and file */
> +		if (S_ISDIR(mode) || S_ISREG(mode))
> +			EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
>  		ext4_ext_tree_init(handle, inode);
>  		err = ext4_update_incompat_feature(handle, sb,
>  						EXT4_FEATURE_INCOMPAT_EXTENTS);

Hm you only set the extents flag for dir & reg, but you call the next
two functions for all files?  I think the next 2 lines need to be part
of the conditional, no? (and then there can be just one big test,
indentation can come out a bit...?)

But, the spirit of the patch looks right.

-Eric



> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 23902ba..da942bc 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -1771,7 +1771,6 @@ retry:
>  #ifdef CONFIG_EXT4DEV_FS_XATTR
>  		inode->i_op = &ext4_special_inode_operations;
>  #endif
> -		EXT4_I(inode)->i_flags &= ~EXT4_EXTENTS_FL;
>  		err = ext4_add_nondir(handle, dentry, inode);
>  	}
>  	ext4_journal_stop(handle);

      reply	other threads:[~2008-02-19 17:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-18 21:00 [PATCH] clear extents flag on inodes created in ext4_mknod Eric Sandeen
2008-02-19  5:22 ` Mingming Cao
2008-02-19 16:39 ` Eric Sandeen
2008-02-19 16:49   ` Aneesh Kumar K.V
2008-02-19 16:54     ` Eric Sandeen
2008-02-19 17:05     ` Aneesh Kumar K.V
2008-02-19 17:15       ` Eric Sandeen [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=47BB0E98.7090905@redhat.com \
    --to=sandeen@redhat.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --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;
as well as URLs for NNTP newsgroup(s).