All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dave@jikos.cz>
To: Liu Bo <bo.li.liu@oracle.com>
Cc: "David Sterba" <dave@jikos.cz>,
	"Lluís Batlle i Rossell" <viric@viric.name>,
	"Btrfs mailing list" <linux-btrfs@vger.kernel.org>,
	andrei.popa@i-neo.ro
Subject: Re: State of nocow file attribute
Date: Tue, 21 Aug 2012 16:33:04 +0200	[thread overview]
Message-ID: <20120821143304.GK17430@twin.jikos.cz> (raw)
In-Reply-To: <502E6386.700@oracle.com>

On Fri, Aug 17, 2012 at 11:30:14PM +0800, Liu Bo wrote:
> IMO the following is better, just make use of the original check.  If you agree with this,
> I'll send it as a patch :)

I think it's cleaner to keep all flags that get inherited from the
directory -> new file at one place, ie btrfs_inherit_iflags(), than
having them scattered over the code.

> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 6e8f416..d4e58df 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -4721,8 +4721,10 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
>  		if (btrfs_test_opt(root, NODATASUM))
>  			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
>  		if (btrfs_test_opt(root, NODATACOW) ||
> -		    (BTRFS_I(dir)->flags & BTRFS_INODE_NODATACOW))
> +		    (BTRFS_I(dir)->flags & BTRFS_INODE_NODATACOW)) {
>  			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW;
> +			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
> +		}
>  	}

And even better, this particular check of dir->flags should be removed
entirely, because it duplicates the equivalent in
btrfs_inherit_iflags().

>  
>  	insert_inode_hash(inode);


david

  reply	other threads:[~2012-08-21 14:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15 10:12 State of nocow file attribute Lluís Batlle i Rossell
     [not found] ` <COL113-W11E89280DE29846698B431B0B60@phx.gbl>
2012-08-15 17:19   ` Lluís Batlle i Rossell
2012-08-17  1:45 ` Liu Bo
2012-08-17 14:59   ` David Sterba
2012-08-17 15:30     ` Liu Bo
2012-08-21 14:33       ` David Sterba [this message]
2012-08-21 15:04         ` State of nocow file attribute Liu Bo

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=20120821143304.GK17430@twin.jikos.cz \
    --to=dave@jikos.cz \
    --cc=andrei.popa@i-neo.ro \
    --cc=bo.li.liu@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=viric@viric.name \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.