aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-16 14:57:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-16 14:57:05 -0500
commitffd3c0260aeeb1fd4d36378d2e06e6410661dd0f (patch)
treeb9503b99442b9701fab49a83295e60256827cdd2 /fs
parent0891ad829d2a0501053703df66029e843e3b8365 (diff)
parent54563d41a58be77e9bd9ef7af1ea4026cf0e7e07 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason: "This pull fixes the empty_zero_page bug that Heiko reported, and includes one more cleanup from Al Viro" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: btrfs: get rid of fdentry() btrfs: fix empty_zero_page misusage
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.h5
-rw-r--r--fs/btrfs/ioctl.c17
2 files changed, 11 insertions, 11 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index aea4433081dc..f9aeb2759a64 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3111,11 +3111,6 @@ static inline u32 btrfs_level_size(struct btrfs_root *root, int level)
3111 ((unsigned long)(btrfs_leaf_data(leaf) + \ 3111 ((unsigned long)(btrfs_leaf_data(leaf) + \
3112 btrfs_item_offset_nr(leaf, slot))) 3112 btrfs_item_offset_nr(leaf, slot)))
3113 3113
3114static inline struct dentry *fdentry(struct file *file)
3115{
3116 return file->f_path.dentry;
3117}
3118
3119static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info) 3114static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info)
3120{ 3115{
3121 return ((space_info->flags & BTRFS_BLOCK_GROUP_METADATA) && 3116 return ((space_info->flags & BTRFS_BLOCK_GROUP_METADATA) &&
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 1d04b5559e61..a111622598b0 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -320,7 +320,7 @@ static int btrfs_ioctl_getversion(struct file *file, int __user *arg)
320 320
321static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) 321static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
322{ 322{
323 struct btrfs_fs_info *fs_info = btrfs_sb(fdentry(file)->d_sb); 323 struct btrfs_fs_info *fs_info = btrfs_sb(file_inode(file)->i_sb);
324 struct btrfs_device *device; 324 struct btrfs_device *device;
325 struct request_queue *q; 325 struct request_queue *q;
326 struct fstrim_range range; 326 struct fstrim_range range;
@@ -368,8 +368,13 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
368 368
369int btrfs_is_empty_uuid(u8 *uuid) 369int btrfs_is_empty_uuid(u8 *uuid)
370{ 370{
371 BUILD_BUG_ON(BTRFS_UUID_SIZE > PAGE_SIZE); 371 int i;
372 return !memcmp(uuid, empty_zero_page, BTRFS_UUID_SIZE); 372
373 for (i = 0; i < BTRFS_UUID_SIZE; i++) {
374 if (uuid[i])
375 return 0;
376 }
377 return 1;
373} 378}
374 379
375static noinline int create_subvol(struct inode *dir, 380static noinline int create_subvol(struct inode *dir,
@@ -2084,7 +2089,7 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file,
2084static noinline int btrfs_ioctl_snap_destroy(struct file *file, 2089static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2085 void __user *arg) 2090 void __user *arg)
2086{ 2091{
2087 struct dentry *parent = fdentry(file); 2092 struct dentry *parent = file->f_path.dentry;
2088 struct dentry *dentry; 2093 struct dentry *dentry;
2089 struct inode *dir = parent->d_inode; 2094 struct inode *dir = parent->d_inode;
2090 struct inode *inode; 2095 struct inode *inode;
@@ -3100,7 +3105,7 @@ out:
3100static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, 3105static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
3101 u64 off, u64 olen, u64 destoff) 3106 u64 off, u64 olen, u64 destoff)
3102{ 3107{
3103 struct inode *inode = fdentry(file)->d_inode; 3108 struct inode *inode = file_inode(file);
3104 struct btrfs_root *root = BTRFS_I(inode)->root; 3109 struct btrfs_root *root = BTRFS_I(inode)->root;
3105 struct fd src_file; 3110 struct fd src_file;
3106 struct inode *src; 3111 struct inode *src;
@@ -4299,7 +4304,7 @@ static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
4299 4304
4300static long btrfs_ioctl_quota_rescan_wait(struct file *file, void __user *arg) 4305static long btrfs_ioctl_quota_rescan_wait(struct file *file, void __user *arg)
4301{ 4306{
4302 struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; 4307 struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
4303 4308
4304 if (!capable(CAP_SYS_ADMIN)) 4309 if (!capable(CAP_SYS_ADMIN))
4305 return -EPERM; 4310 return -EPERM;