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"
Unified · Split
| @@ -3839,7 +3839,6 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, · 3838 unmodified lines | ||
| 3839 | 3839 | rb_erase(&ref->rb_node, &head->ref_root); |
| 3840 | 3840 | atomic_dec(&delayed_refs->num_entries); |
| 3841 | 3841 | btrfs_put_delayed_ref(ref); |
| 3842 | − cond_resched_lock(&head->lock); | |
| 3843 | 3842 | } |
| 3844 | 3843 | if (head->must_insert_reserved) |
| 3845 | 3844 | pin_bytes = true; |
| @@ -5154,7 +5154,7 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, · 5153 unmodified lines | ||
| 5154 | 5154 | return ERR_CAST(inode); |
| 5155 | 5155 | } |
| 5156 | 5156 | |
| 5157 | − return d_splice_alias(inode, dentry); | |
| 5157 | + return d_materialise_unique(dentry, inode); | |
| 5158 | 5158 | } |
| 5159 | 5159 | |
| 5160 | 5160 | unsigned char btrfs_filetype_table[] = { |
| @@ -3537,20 +3537,6 @@ out: · 3536 unmodified lines | ||
| 3537 | 3537 | return ret; |
| 3538 | 3538 | } |
| 3539 | 3539 | |
| 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 | − | |
| 3554 | 3540 | /* |
| 3555 | 3541 | * there are many ways the trans_start and trans_end ioctls can lead |
| 3556 | 3542 | * to deadlocks. They should only be used by applications that |
| @@ -4757,8 +4743,6 @@ long btrfs_ioctl(struct file *file, unsigned int · 1200 unmodified lines | ||
| 4757 | 4743 | return btrfs_ioctl_logical_to_ino(root, argp); |
| 4758 | 4744 | case BTRFS_IOC_SPACE_INFO: |
| 4759 | 4745 | return btrfs_ioctl_space_info(root, argp); |
| 4760 | − case BTRFS_IOC_GLOBAL_RSV: | |
| 4761 | − return btrfs_ioctl_global_rsv(root, argp); | |
| 4762 | 4746 | case BTRFS_IOC_SYNC: { |
| 4763 | 4747 | int ret; |
| 4764 | 4748 | |
| @@ -1332,6 +1332,16 @@ verbose_printk(KERN_DEBUG "btrfs: find_extent_clone: data_offset=%llu, " · 1331 unmodified lines | ||
| 1332 | 1332 | } |
| 1333 | 1333 | |
| 1334 | 1334 | 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 | + } | |
| 1335 | 1345 | *found = cur_clone_root; |
| 1336 | 1346 | ret = 0; |
| 1337 | 1347 | } else { |
| @@ -566,7 +566,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) · 565 unmodified lines | ||
| 566 | 566 | kfree(num); |
| 567 | 567 | |
| 568 | 568 | if (info->max_inline) { |
| 569 | − info->max_inline = max_t(u64, | |
| 569 | + info->max_inline = min_t(u64, | |
| 570 | 570 | info->max_inline, |
| 571 | 571 | root->sectorsize); |
| 572 | 572 | } |
| @@ -855,6 +855,7 @@ static struct dentry *get_default_root(struct super_block *sb, · 282 unmodified lines | ||
| 855 | 855 | struct btrfs_path *path; |
| 856 | 856 | struct btrfs_key location; |
| 857 | 857 | struct inode *inode; |
| 858 | + struct dentry *dentry; | |
| 858 | 859 | u64 dir_id; |
| 859 | 860 | int new = 0; |
| 860 | 861 | |
| @@ -925,7 +926,13 @@ setup_root: · 64 unmodified lines | ||
| 925 | 926 | return dget(sb->s_root); |
| 926 | 927 | } |
| 927 | 928 | |
| 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; | |
| 929 | 936 | } |
| 930 | 937 | |
| 931 | 938 | static int btrfs_fill_super(struct super_block *sb, |
| @@ -578,8 +578,14 @@ static int add_device_membership(struct btrfs_fs_info *fs_info) · 577 unmodified lines | ||
| 578 | 578 | return -ENOMEM; |
| 579 | 579 | |
| 580 | 580 | 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; | |
| 583 | 589 | |
| 584 | 590 | error = sysfs_create_link(fs_info->device_dir_kobj, |
| 585 | 591 | disk_kobj, disk_kobj->name); |
| @@ -558,7 +558,6 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code) · 557 unmodified lines | ||
| 558 | 558 | #define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64) |
| 559 | 559 | #define BTRFS_IOC_SPACE_INFO _IOWR(BTRFS_IOCTL_MAGIC, 20, \ |
| 560 | 560 | struct btrfs_ioctl_space_args) |
| 561 | −#define BTRFS_IOC_GLOBAL_RSV _IOR(BTRFS_IOCTL_MAGIC, 20, __u64) | |
| 562 | 561 | #define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64) |
| 563 | 562 | #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64) |
| 564 | 563 | #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \ |