Commit ffd3c026 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 0891ad82 54563d41
...@@ -3111,11 +3111,6 @@ static inline u32 btrfs_level_size(struct btrfs_root *root, int level) ...@@ -3111,11 +3111,6 @@ static inline u32 btrfs_level_size(struct btrfs_root *root, int level)
((unsigned long)(btrfs_leaf_data(leaf) + \ ((unsigned long)(btrfs_leaf_data(leaf) + \
btrfs_item_offset_nr(leaf, slot))) btrfs_item_offset_nr(leaf, slot)))
static inline struct dentry *fdentry(struct file *file)
{
return file->f_path.dentry;
}
static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info) static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info)
{ {
return ((space_info->flags & BTRFS_BLOCK_GROUP_METADATA) && return ((space_info->flags & BTRFS_BLOCK_GROUP_METADATA) &&
......
...@@ -320,7 +320,7 @@ static int btrfs_ioctl_getversion(struct file *file, int __user *arg) ...@@ -320,7 +320,7 @@ static int btrfs_ioctl_getversion(struct file *file, int __user *arg)
static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
{ {
struct btrfs_fs_info *fs_info = btrfs_sb(fdentry(file)->d_sb); struct btrfs_fs_info *fs_info = btrfs_sb(file_inode(file)->i_sb);
struct btrfs_device *device; struct btrfs_device *device;
struct request_queue *q; struct request_queue *q;
struct fstrim_range range; struct fstrim_range range;
...@@ -368,8 +368,13 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) ...@@ -368,8 +368,13 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
int btrfs_is_empty_uuid(u8 *uuid) int btrfs_is_empty_uuid(u8 *uuid)
{ {
BUILD_BUG_ON(BTRFS_UUID_SIZE > PAGE_SIZE); int i;
return !memcmp(uuid, empty_zero_page, BTRFS_UUID_SIZE);
for (i = 0; i < BTRFS_UUID_SIZE; i++) {
if (uuid[i])
return 0;
}
return 1;
} }
static noinline int create_subvol(struct inode *dir, static noinline int create_subvol(struct inode *dir,
...@@ -2084,7 +2089,7 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file, ...@@ -2084,7 +2089,7 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file,
static noinline int btrfs_ioctl_snap_destroy(struct file *file, static noinline int btrfs_ioctl_snap_destroy(struct file *file,
void __user *arg) void __user *arg)
{ {
struct dentry *parent = fdentry(file); struct dentry *parent = file->f_path.dentry;
struct dentry *dentry; struct dentry *dentry;
struct inode *dir = parent->d_inode; struct inode *dir = parent->d_inode;
struct inode *inode; struct inode *inode;
...@@ -3100,7 +3105,7 @@ static int btrfs_clone(struct inode *src, struct inode *inode, ...@@ -3100,7 +3105,7 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
u64 off, u64 olen, u64 destoff) u64 off, u64 olen, u64 destoff)
{ {
struct inode *inode = fdentry(file)->d_inode; struct inode *inode = file_inode(file);
struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_root *root = BTRFS_I(inode)->root;
struct fd src_file; struct fd src_file;
struct inode *src; struct inode *src;
...@@ -4299,7 +4304,7 @@ static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg) ...@@ -4299,7 +4304,7 @@ static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
static long btrfs_ioctl_quota_rescan_wait(struct file *file, void __user *arg) static long btrfs_ioctl_quota_rescan_wait(struct file *file, void __user *arg)
{ {
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root; struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment