Skip to content

Commit ffd3c02

Browse files
committed
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
2 parents 0891ad8 + 54563d4 commit ffd3c02

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎fs/btrfs/ctree.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3111,11 +3111,6 @@ static inline u32 btrfs_level_size(struct btrfs_root *root, int level)
31113111
((unsigned long)(btrfs_leaf_data(leaf) + \
31123112
btrfs_item_offset_nr(leaf, slot)))
31133113

3114-
static inline struct dentry *fdentry(struct file *file)
3115-
{
3116-
return file->f_path.dentry;
3117-
}
3118-
31193114
static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info)
31203115
{
31213116
return ((space_info->flags & BTRFS_BLOCK_GROUP_METADATA) &&

‎fs/btrfs/ioctl.c‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static int btrfs_ioctl_getversion(struct file *file, int __user *arg)
320320

321321
static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
322322
{
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);
324324
struct btrfs_device *device;
325325
struct request_queue *q;
326326
struct fstrim_range range;
@@ -368,8 +368,13 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
368368

369369
int btrfs_is_empty_uuid(u8 *uuid)
370370
{
371-
BUILD_BUG_ON(BTRFS_UUID_SIZE > PAGE_SIZE);
372-
return !memcmp(uuid, empty_zero_page, BTRFS_UUID_SIZE);
371+
int i;
372+
373+
for (i = 0; i < BTRFS_UUID_SIZE; i++) {
374+
if (uuid[i])
375+
return 0;
376+
}
377+
return 1;
373378
}
374379

375380
static noinline int create_subvol(struct inode *dir,
@@ -2084,7 +2089,7 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file,
20842089
static noinline int btrfs_ioctl_snap_destroy(struct file *file,
20852090
void __user *arg)
20862091
{
2087-
struct dentry *parent = fdentry(file);
2092+
struct dentry *parent = file->f_path.dentry;
20882093
struct dentry *dentry;
20892094
struct inode *dir = parent->d_inode;
20902095
struct inode *inode;
@@ -3100,7 +3105,7 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
31003105
static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
31013106
u64 off, u64 olen, u64 destoff)
31023107
{
3103-
struct inode *inode = fdentry(file)->d_inode;
3108+
struct inode *inode = file_inode(file);
31043109
struct btrfs_root *root = BTRFS_I(inode)->root;
31053110
struct fd src_file;
31063111
struct inode *src;
@@ -4299,7 +4304,7 @@ static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
42994304

43004305
static long btrfs_ioctl_quota_rescan_wait(struct file *file, void __user *arg)
43014306
{
4302-
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
4307+
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
43034308

43044309
if (!capable(CAP_SYS_ADMIN))
43054310
return -EPERM;

0 commit comments

Comments
 (0)