aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/ioctl.c15
-rw-r--r--include/linux/fs.h1
2 files changed, 6 insertions, 10 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index f580a3a5d2fc..3240dd90da42 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -144,16 +144,13 @@ static int check_flags(unsigned int flags)
144 if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \ 144 if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
145 FS_NOATIME_FL | FS_NODUMP_FL | \ 145 FS_NOATIME_FL | FS_NODUMP_FL | \
146 FS_SYNC_FL | FS_DIRSYNC_FL | \ 146 FS_SYNC_FL | FS_DIRSYNC_FL | \
147 FS_NOCOMP_FL | FS_COMPR_FL | \ 147 FS_NOCOMP_FL | FS_COMPR_FL |
148 FS_NOCOW_FL | FS_COW_FL)) 148 FS_NOCOW_FL))
149 return -EOPNOTSUPP; 149 return -EOPNOTSUPP;
150 150
151 if ((flags & FS_NOCOMP_FL) && (flags & FS_COMPR_FL)) 151 if ((flags & FS_NOCOMP_FL) && (flags & FS_COMPR_FL))
152 return -EINVAL; 152 return -EINVAL;
153 153
154 if ((flags & FS_NOCOW_FL) && (flags & FS_COW_FL))
155 return -EINVAL;
156
157 return 0; 154 return 0;
158} 155}
159 156
@@ -218,6 +215,10 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
218 ip->flags |= BTRFS_INODE_DIRSYNC; 215 ip->flags |= BTRFS_INODE_DIRSYNC;
219 else 216 else
220 ip->flags &= ~BTRFS_INODE_DIRSYNC; 217 ip->flags &= ~BTRFS_INODE_DIRSYNC;
218 if (flags & FS_NOCOW_FL)
219 ip->flags |= BTRFS_INODE_NODATACOW;
220 else
221 ip->flags &= ~BTRFS_INODE_NODATACOW;
221 222
222 /* 223 /*
223 * The COMPRESS flag can only be changed by users, while the NOCOMPRESS 224 * The COMPRESS flag can only be changed by users, while the NOCOMPRESS
@@ -231,10 +232,6 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
231 ip->flags |= BTRFS_INODE_COMPRESS; 232 ip->flags |= BTRFS_INODE_COMPRESS;
232 ip->flags &= ~BTRFS_INODE_NOCOMPRESS; 233 ip->flags &= ~BTRFS_INODE_NOCOMPRESS;
233 } 234 }
234 if (flags & FS_NOCOW_FL)
235 ip->flags |= BTRFS_INODE_NODATACOW;
236 else if (flags & FS_COW_FL)
237 ip->flags &= ~BTRFS_INODE_NODATACOW;
238 235
239 trans = btrfs_join_transaction(root, 1); 236 trans = btrfs_join_transaction(root, 1);
240 BUG_ON(IS_ERR(trans)); 237 BUG_ON(IS_ERR(trans));
diff --git a/include/linux/fs.h b/include/linux/fs.h
index de9dd8119b71..56a41412903d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -365,7 +365,6 @@ struct inodes_stat_t {
365#define FS_EXTENT_FL 0x00080000 /* Extents */ 365#define FS_EXTENT_FL 0x00080000 /* Extents */
366#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ 366#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
367#define FS_NOCOW_FL 0x00800000 /* Do not cow file */ 367#define FS_NOCOW_FL 0x00800000 /* Do not cow file */
368#define FS_COW_FL 0x02000000 /* Cow file */
369#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ 368#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
370 369
371#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ 370#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */