aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/disk-io.c19
-rw-r--r--fs/btrfs/extent-tree.c3
-rw-r--r--fs/btrfs/extent_io.c1
-rw-r--r--fs/btrfs/inode.c4
-rw-r--r--fs/btrfs/super.c16
-rw-r--r--fs/btrfs/volumes.c4
-rw-r--r--fs/btrfs/volumes.h1
7 files changed, 14 insertions, 34 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 33b6d459494c..c547cca26a26 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2093,7 +2093,7 @@ static void btrfs_end_buffer_write_sync(struct buffer_head *bh, int uptodate)
2093 if (uptodate) { 2093 if (uptodate) {
2094 set_buffer_uptodate(bh); 2094 set_buffer_uptodate(bh);
2095 } else { 2095 } else {
2096 if (!buffer_eopnotsupp(bh) && printk_ratelimit()) { 2096 if (printk_ratelimit()) {
2097 printk(KERN_WARNING "lost page write due to " 2097 printk(KERN_WARNING "lost page write due to "
2098 "I/O error on %s\n", 2098 "I/O error on %s\n",
2099 bdevname(bh->b_bdev, b)); 2099 bdevname(bh->b_bdev, b));
@@ -2230,21 +2230,10 @@ static int write_dev_supers(struct btrfs_device *device,
2230 bh->b_end_io = btrfs_end_buffer_write_sync; 2230 bh->b_end_io = btrfs_end_buffer_write_sync;
2231 } 2231 }
2232 2232
2233 if (i == last_barrier && do_barriers && device->barriers) { 2233 if (i == last_barrier && do_barriers)
2234 ret = submit_bh(WRITE_BARRIER, bh); 2234 ret = submit_bh(WRITE_FLUSH_FUA, bh);
2235 if (ret == -EOPNOTSUPP) { 2235 else
2236 printk("btrfs: disabling barriers on dev %s\n",
2237 device->name);
2238 set_buffer_uptodate(bh);
2239 device->barriers = 0;
2240 /* one reference for submit_bh */
2241 get_bh(bh);
2242 lock_buffer(bh);
2243 ret = submit_bh(WRITE_SYNC, bh);
2244 }
2245 } else {
2246 ret = submit_bh(WRITE_SYNC, bh); 2236 ret = submit_bh(WRITE_SYNC, bh);
2247 }
2248 2237
2249 if (ret) 2238 if (ret)
2250 errors++; 2239 errors++;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index ddaf6340fe7f..bcd59c7dfb57 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1742,8 +1742,7 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans,
1742static void btrfs_issue_discard(struct block_device *bdev, 1742static void btrfs_issue_discard(struct block_device *bdev,
1743 u64 start, u64 len) 1743 u64 start, u64 len)
1744{ 1744{
1745 blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, 1745 blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, 0);
1746 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
1747} 1746}
1748 1747
1749static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, 1748static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 5e7a94d7da89..3e86b9f36507 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3076,7 +3076,6 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree,
3076 eb->len = len; 3076 eb->len = len;
3077 spin_lock_init(&eb->lock); 3077 spin_lock_init(&eb->lock);
3078 init_waitqueue_head(&eb->lock_wq); 3078 init_waitqueue_head(&eb->lock_wq);
3079 INIT_RCU_HEAD(&eb->rcu_head);
3080 3079
3081#if LEAK_DEBUG 3080#if LEAK_DEBUG
3082 spin_lock_irqsave(&leak_lock, flags); 3081 spin_lock_irqsave(&leak_lock, flags);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 0f34cae0a633..8039390bd6a6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3877,7 +3877,7 @@ again:
3877 p = &root->inode_tree.rb_node; 3877 p = &root->inode_tree.rb_node;
3878 parent = NULL; 3878 parent = NULL;
3879 3879
3880 if (hlist_unhashed(&inode->i_hash)) 3880 if (inode_unhashed(inode))
3881 return; 3881 return;
3882 3882
3883 spin_lock(&root->inode_lock); 3883 spin_lock(&root->inode_lock);
@@ -4802,7 +4802,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
4802 } 4802 }
4803 4803
4804 btrfs_set_trans_block_group(trans, dir); 4804 btrfs_set_trans_block_group(trans, dir);
4805 atomic_inc(&inode->i_count); 4805 ihold(inode);
4806 4806
4807 err = btrfs_add_nondir(trans, dir, dentry, inode, 1, index); 4807 err = btrfs_add_nondir(trans, dir, dentry, inode, 1, index);
4808 4808
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 47bf67cbe6bf..dbb51ea7a13c 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -589,8 +589,8 @@ static int btrfs_set_super(struct super_block *s, void *data)
589 * Note: This is based on get_sb_bdev from fs/super.c with a few additions 589 * Note: This is based on get_sb_bdev from fs/super.c with a few additions
590 * for multiple device setup. Make sure to keep it in sync. 590 * for multiple device setup. Make sure to keep it in sync.
591 */ 591 */
592static int btrfs_get_sb(struct file_system_type *fs_type, int flags, 592static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
593 const char *dev_name, void *data, struct vfsmount *mnt) 593 const char *dev_name, void *data)
594{ 594{
595 struct block_device *bdev = NULL; 595 struct block_device *bdev = NULL;
596 struct super_block *s; 596 struct super_block *s;
@@ -610,7 +610,7 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
610 &subvol_name, &subvol_objectid, 610 &subvol_name, &subvol_objectid,
611 &fs_devices); 611 &fs_devices);
612 if (error) 612 if (error)
613 return error; 613 return ERR_PTR(error);
614 614
615 error = btrfs_scan_one_device(dev_name, mode, fs_type, &fs_devices); 615 error = btrfs_scan_one_device(dev_name, mode, fs_type, &fs_devices);
616 if (error) 616 if (error)
@@ -701,11 +701,8 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
701 root = new_root; 701 root = new_root;
702 } 702 }
703 703
704 mnt->mnt_sb = s;
705 mnt->mnt_root = root;
706
707 kfree(subvol_name); 704 kfree(subvol_name);
708 return 0; 705 return root;
709 706
710error_s: 707error_s:
711 error = PTR_ERR(s); 708 error = PTR_ERR(s);
@@ -715,7 +712,7 @@ error_close_devices:
715 kfree(tree_root); 712 kfree(tree_root);
716error_free_subvol_name: 713error_free_subvol_name:
717 kfree(subvol_name); 714 kfree(subvol_name);
718 return error; 715 return ERR_PTR(error);
719} 716}
720 717
721static int btrfs_remount(struct super_block *sb, int *flags, char *data) 718static int btrfs_remount(struct super_block *sb, int *flags, char *data)
@@ -799,7 +796,7 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
799static struct file_system_type btrfs_fs_type = { 796static struct file_system_type btrfs_fs_type = {
800 .owner = THIS_MODULE, 797 .owner = THIS_MODULE,
801 .name = "btrfs", 798 .name = "btrfs",
802 .get_sb = btrfs_get_sb, 799 .mount = btrfs_mount,
803 .kill_sb = kill_anon_super, 800 .kill_sb = kill_anon_super,
804 .fs_flags = FS_REQUIRES_DEV, 801 .fs_flags = FS_REQUIRES_DEV,
805}; 802};
@@ -868,6 +865,7 @@ static const struct file_operations btrfs_ctl_fops = {
868 .unlocked_ioctl = btrfs_control_ioctl, 865 .unlocked_ioctl = btrfs_control_ioctl,
869 .compat_ioctl = btrfs_control_ioctl, 866 .compat_ioctl = btrfs_control_ioctl,
870 .owner = THIS_MODULE, 867 .owner = THIS_MODULE,
868 .llseek = noop_llseek,
871}; 869};
872 870
873static struct miscdevice btrfs_misc = { 871static struct miscdevice btrfs_misc = {
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 91851b555e2e..cc04dc1445d6 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -398,7 +398,6 @@ static noinline int device_list_add(const char *path,
398 device->work.func = pending_bios_fn; 398 device->work.func = pending_bios_fn;
399 memcpy(device->uuid, disk_super->dev_item.uuid, 399 memcpy(device->uuid, disk_super->dev_item.uuid,
400 BTRFS_UUID_SIZE); 400 BTRFS_UUID_SIZE);
401 device->barriers = 1;
402 spin_lock_init(&device->io_lock); 401 spin_lock_init(&device->io_lock);
403 device->name = kstrdup(path, GFP_NOFS); 402 device->name = kstrdup(path, GFP_NOFS);
404 if (!device->name) { 403 if (!device->name) {
@@ -462,7 +461,6 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
462 device->devid = orig_dev->devid; 461 device->devid = orig_dev->devid;
463 device->work.func = pending_bios_fn; 462 device->work.func = pending_bios_fn;
464 memcpy(device->uuid, orig_dev->uuid, sizeof(device->uuid)); 463 memcpy(device->uuid, orig_dev->uuid, sizeof(device->uuid));
465 device->barriers = 1;
466 spin_lock_init(&device->io_lock); 464 spin_lock_init(&device->io_lock);
467 INIT_LIST_HEAD(&device->dev_list); 465 INIT_LIST_HEAD(&device->dev_list);
468 INIT_LIST_HEAD(&device->dev_alloc_list); 466 INIT_LIST_HEAD(&device->dev_alloc_list);
@@ -1489,7 +1487,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
1489 trans = btrfs_start_transaction(root, 0); 1487 trans = btrfs_start_transaction(root, 0);
1490 lock_chunks(root); 1488 lock_chunks(root);
1491 1489
1492 device->barriers = 1;
1493 device->writeable = 1; 1490 device->writeable = 1;
1494 device->work.func = pending_bios_fn; 1491 device->work.func = pending_bios_fn;
1495 generate_random_uuid(device->uuid); 1492 generate_random_uuid(device->uuid);
@@ -3079,7 +3076,6 @@ static struct btrfs_device *add_missing_dev(struct btrfs_root *root,
3079 return NULL; 3076 return NULL;
3080 list_add(&device->dev_list, 3077 list_add(&device->dev_list,
3081 &fs_devices->devices); 3078 &fs_devices->devices);
3082 device->barriers = 1;
3083 device->dev_root = root->fs_info->dev_root; 3079 device->dev_root = root->fs_info->dev_root;
3084 device->devid = devid; 3080 device->devid = devid;
3085 device->work.func = pending_bios_fn; 3081 device->work.func = pending_bios_fn;
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 31b0fabdd2ea..2b638b6e4eea 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -42,7 +42,6 @@ struct btrfs_device {
42 int running_pending; 42 int running_pending;
43 u64 generation; 43 u64 generation;
44 44
45 int barriers;
46 int writeable; 45 int writeable;
47 int in_fs_metadata; 46 int in_fs_metadata;
48 47