Btrfs: honor nodatacow/sum mount options for new files

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Friday, July 3, 2009 - 5:59 pm

Gitweb:     http://git.kernel.org/linus/9427216476d4fa75103f39d4b228c47d56ba20da
Commit:     9427216476d4fa75103f39d4b228c47d56ba20da
Parent:     2c47e605a91dde6b0514f689645e7ab336c8592a
Author:     Chris Mason <chris.mason@oracle.com>
AuthorDate: Thu Jul 2 12:26:06 2009 -0400
Committer:  Chris Mason <chris.mason@oracle.com>
CommitDate: Thu Jul 2 13:41:17 2009 -0400

    Btrfs: honor nodatacow/sum mount options for new files
    
    The btrfs attr patches unconditionally inherited the inode flags field
    without honoring nodatacow and nodatasum.  This fix makes sure
    we properly record the nodatacow/sum mount options in new inodes.
    
    Signed-off-by: Chris Mason <chris.mason@oracle.com>
---
 fs/btrfs/inode.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1eacc78..a48c084 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3587,12 +3587,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
 		owner = 1;
 	BTRFS_I(inode)->block_group =
 			btrfs_find_block_group(root, 0, alloc_hint, owner);
-	if ((mode & S_IFREG)) {
-		if (btrfs_test_opt(root, NODATASUM))
-			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
-		if (btrfs_test_opt(root, NODATACOW))
-			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW;
-	}
 
 	key[0].objectid = objectid;
 	btrfs_set_key_type(&key[0], BTRFS_INODE_ITEM_KEY);
@@ -3647,6 +3641,13 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
 
 	btrfs_inherit_iflags(inode, dir);
 
+	if ((mode & S_IFREG)) {
+		if (btrfs_test_opt(root, NODATASUM))
+			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
+		if (btrfs_test_opt(root, NODATACOW))
+			BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW;
+	}
+
 	insert_inode_hash(inode);
 	inode_tree_add(inode);
 	return inode;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Btrfs: honor nodatacow/sum mount options for new files, Linux Kernel Mailing List..., (Fri Jul 3, 5:59 pm)