aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2011-04-14 23:02:49 -0400
committerChris Mason <chris.mason@oracle.com>2011-05-14 16:10:26 -0400
commite1e8fb6a1ff3f9487e03a4cbf85b81d1316068ce (patch)
treea7cd1ba1f93d163e2ca02b8172888f43e444713f /fs/btrfs
parent1aba86d67f340a8001d67183ec32e8a62e3ec658 (diff)
fs: remove FS_COW_FL
FS_COW_FL and FS_NOCOW_FL were newly introduced to control per file COW in btrfs, but FS_NOCOW_FL is sufficient. The fact is we don't have corresponding BTRFS_INODE_COW flag. COW is default, and FS_NOCOW_FL can be used to switch off COW for a single file. If we mount btrfs with nodatacow, a newly created file will be set with the FS_NOCOW_FL flag. So to turn on COW for it, we can just clear the FS_NOCOW_FL flag. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ioctl.c15
1 files changed, 6 insertions, 9 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));