diff options
author | Josef Bacik <josef@redhat.com> | 2011-09-27 11:01:30 -0400 |
---|---|---|
committer | Josef Bacik <josef@redhat.com> | 2011-10-19 15:12:50 -0400 |
commit | e27425d614d68daa08f60735982a7c3a0230e855 (patch) | |
tree | 7f06f5576552498dd902860d77564436a2ef1606 /fs/btrfs/ioctl.c | |
parent | 2bf64758fd6290797a5ce97d4b9c698a4ed1cbad (diff) |
Btrfs: only inherit btrfs specific flags when creating files
Xfstests 79 was failing because we were inheriting the S_APPEND flag when we
weren't supposed to. There isn't any specific documentation on this so I'm
taking the test as the standard of how things work, and having S_APPEND set on a
directory doesn't mean that S_APPEND gets inherited by its children according to
this test. So only inherit btrfs specific things. This will let us set
compress/nocompress on specific directories and everything in the directories
will inherit this flag, same with nodatacow. With this patch test 79 passes.
Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 24fd75bb0f96..d2b53eb8a8c2 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -117,7 +117,7 @@ void btrfs_update_iflags(struct inode *inode) | |||
117 | /* | 117 | /* |
118 | * Inherit flags from the parent inode. | 118 | * Inherit flags from the parent inode. |
119 | * | 119 | * |
120 | * Unlike extN we don't have any flags we don't want to inherit currently. | 120 | * Currently only the compression flags and the cow flags are inherited. |
121 | */ | 121 | */ |
122 | void btrfs_inherit_iflags(struct inode *inode, struct inode *dir) | 122 | void btrfs_inherit_iflags(struct inode *inode, struct inode *dir) |
123 | { | 123 | { |
@@ -128,12 +128,17 @@ void btrfs_inherit_iflags(struct inode *inode, struct inode *dir) | |||
128 | 128 | ||
129 | flags = BTRFS_I(dir)->flags; | 129 | flags = BTRFS_I(dir)->flags; |
130 | 130 | ||
131 | if (S_ISREG(inode->i_mode)) | 131 | if (flags & BTRFS_INODE_NOCOMPRESS) { |
132 | flags &= ~BTRFS_INODE_DIRSYNC; | 132 | BTRFS_I(inode)->flags &= ~BTRFS_INODE_COMPRESS; |
133 | else if (!S_ISDIR(inode->i_mode)) | 133 | BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; |
134 | flags &= (BTRFS_INODE_NODUMP | BTRFS_INODE_NOATIME); | 134 | } else if (flags & BTRFS_INODE_COMPRESS) { |
135 | BTRFS_I(inode)->flags &= ~BTRFS_INODE_NOCOMPRESS; | ||
136 | BTRFS_I(inode)->flags |= BTRFS_INODE_COMPRESS; | ||
137 | } | ||
138 | |||
139 | if (flags & BTRFS_INODE_NODATACOW) | ||
140 | BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW; | ||
135 | 141 | ||
136 | BTRFS_I(inode)->flags = flags; | ||
137 | btrfs_update_iflags(inode); | 142 | btrfs_update_iflags(inode); |
138 | } | 143 | } |
139 | 144 | ||