Skip to content

Commit 3962dfb

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: "We have a small collection of fixes in my for-linus branch. The big thing that stands out is a revert of a new ioctl. Users haven't shipped yet in btrfs-progs, and Dave Sterba found a better way to export the information" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: Btrfs: use right clone root offset for compressed extents btrfs: fix null pointer deference at btrfs_sysfs_add_one+0x105 Btrfs: unset DCACHE_DISCONNECTED when mounting default subvol Btrfs: fix max_inline mount option Btrfs: fix a lockdep warning when cleaning up aborted transaction Revert "btrfs: add ioctl to export size of global metadata reservation"
2 parents 4302a87 + 93de4ba commit 3962dfb

File tree

7 files changed

+28
-23
lines changed

7 files changed

+28
-23
lines changed

fs/btrfs/disk-io.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3839,7 +3839,6 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
38393839
rb_erase(&ref->rb_node, &head->ref_root);
38403840
atomic_dec(&delayed_refs->num_entries);
38413841
btrfs_put_delayed_ref(ref);
3842-
cond_resched_lock(&head->lock);
38433842
}
38443843
if (head->must_insert_reserved)
38453844
pin_bytes = true;

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5154,7 +5154,7 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
51545154
return ERR_CAST(inode);
51555155
}
51565156

5157-
return d_splice_alias(inode, dentry);
5157+
return d_materialise_unique(dentry, inode);
51585158
}
51595159

51605160
unsigned char btrfs_filetype_table[] = {

fs/btrfs/ioctl.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3537,20 +3537,6 @@ static long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
35373537
return ret;
35383538
}
35393539

3540-
static long btrfs_ioctl_global_rsv(struct btrfs_root *root, void __user *arg)
3541-
{
3542-
struct btrfs_block_rsv *block_rsv = &root->fs_info->global_block_rsv;
3543-
u64 reserved;
3544-
3545-
spin_lock(&block_rsv->lock);
3546-
reserved = block_rsv->reserved;
3547-
spin_unlock(&block_rsv->lock);
3548-
3549-
if (arg && copy_to_user(arg, &reserved, sizeof(reserved)))
3550-
return -EFAULT;
3551-
return 0;
3552-
}
3553-
35543540
/*
35553541
* there are many ways the trans_start and trans_end ioctls can lead
35563542
* to deadlocks. They should only be used by applications that
@@ -4757,8 +4743,6 @@ long btrfs_ioctl(struct file *file, unsigned int
47574743
return btrfs_ioctl_logical_to_ino(root, argp);
47584744
case BTRFS_IOC_SPACE_INFO:
47594745
return btrfs_ioctl_space_info(root, argp);
4760-
case BTRFS_IOC_GLOBAL_RSV:
4761-
return btrfs_ioctl_global_rsv(root, argp);
47624746
case BTRFS_IOC_SYNC: {
47634747
int ret;
47644748

fs/btrfs/send.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,16 @@ verbose_printk(KERN_DEBUG "btrfs: find_extent_clone: data_offset=%llu, "
13321332
}
13331333

13341334
if (cur_clone_root) {
1335+
if (compressed != BTRFS_COMPRESS_NONE) {
1336+
/*
1337+
* Offsets given by iterate_extent_inodes() are relative
1338+
* to the start of the extent, we need to add logical
1339+
* offset from the file extent item.
1340+
* (See why at backref.c:check_extent_in_eb())
1341+
*/
1342+
cur_clone_root->offset += btrfs_file_extent_offset(eb,
1343+
fi);
1344+
}
13351345
*found = cur_clone_root;
13361346
ret = 0;
13371347
} else {

fs/btrfs/super.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
566566
kfree(num);
567567

568568
if (info->max_inline) {
569-
info->max_inline = max_t(u64,
569+
info->max_inline = min_t(u64,
570570
info->max_inline,
571571
root->sectorsize);
572572
}
@@ -855,6 +855,7 @@ static struct dentry *get_default_root(struct super_block *sb,
855855
struct btrfs_path *path;
856856
struct btrfs_key location;
857857
struct inode *inode;
858+
struct dentry *dentry;
858859
u64 dir_id;
859860
int new = 0;
860861

@@ -925,7 +926,13 @@ static struct dentry *get_default_root(struct super_block *sb,
925926
return dget(sb->s_root);
926927
}
927928

928-
return d_obtain_alias(inode);
929+
dentry = d_obtain_alias(inode);
930+
if (!IS_ERR(dentry)) {
931+
spin_lock(&dentry->d_lock);
932+
dentry->d_flags &= ~DCACHE_DISCONNECTED;
933+
spin_unlock(&dentry->d_lock);
934+
}
935+
return dentry;
929936
}
930937

931938
static int btrfs_fill_super(struct super_block *sb,

fs/btrfs/sysfs.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,14 @@ static int add_device_membership(struct btrfs_fs_info *fs_info)
578578
return -ENOMEM;
579579

580580
list_for_each_entry(dev, &fs_devices->devices, dev_list) {
581-
struct hd_struct *disk = dev->bdev->bd_part;
582-
struct kobject *disk_kobj = &part_to_dev(disk)->kobj;
581+
struct hd_struct *disk;
582+
struct kobject *disk_kobj;
583+
584+
if (!dev->bdev)
585+
continue;
586+
587+
disk = dev->bdev->bd_part;
588+
disk_kobj = &part_to_dev(disk)->kobj;
583589

584590
error = sysfs_create_link(fs_info->device_dir_kobj,
585591
disk_kobj, disk_kobj->name);

include/uapi/linux/btrfs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
558558
#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
559559
#define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \
560560
struct btrfs_ioctl_space_args)
561-
#define BTRFS_IOC_GLOBAL_RSV _IOR(BTRFS_IOCTL_MAGIC, 20, __u64)
562561
#define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64)
563562
#define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64)
564563
#define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \

0 commit comments

Comments
 (0)