aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.h4
-rw-r--r--fs/btrfs/disk-io.c27
-rw-r--r--fs/btrfs/extent-tree.c3
-rw-r--r--fs/btrfs/inode.c44
-rw-r--r--fs/btrfs/super.c3
-rw-r--r--fs/btrfs/volumes.c22
-rw-r--r--fs/btrfs/volumes.h1
7 files changed, 47 insertions, 57 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 29c20092847e..eaf286abad17 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2389,13 +2389,13 @@ unsigned long btrfs_force_ra(struct address_space *mapping,
2389 pgoff_t offset, pgoff_t last_index); 2389 pgoff_t offset, pgoff_t last_index);
2390int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); 2390int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
2391int btrfs_readpage(struct file *file, struct page *page); 2391int btrfs_readpage(struct file *file, struct page *page);
2392void btrfs_delete_inode(struct inode *inode); 2392void btrfs_evict_inode(struct inode *inode);
2393void btrfs_put_inode(struct inode *inode); 2393void btrfs_put_inode(struct inode *inode);
2394int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); 2394int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc);
2395void btrfs_dirty_inode(struct inode *inode); 2395void btrfs_dirty_inode(struct inode *inode);
2396struct inode *btrfs_alloc_inode(struct super_block *sb); 2396struct inode *btrfs_alloc_inode(struct super_block *sb);
2397void btrfs_destroy_inode(struct inode *inode); 2397void btrfs_destroy_inode(struct inode *inode);
2398void btrfs_drop_inode(struct inode *inode); 2398int btrfs_drop_inode(struct inode *inode);
2399int btrfs_init_cachep(void); 2399int btrfs_init_cachep(void);
2400void btrfs_destroy_cachep(void); 2400void btrfs_destroy_cachep(void);
2401long btrfs_ioctl_trans_end(struct file *file); 2401long btrfs_ioctl_trans_end(struct file *file);
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 34f7c375567e..5e789f4a3ed0 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -480,7 +480,7 @@ static void end_workqueue_bio(struct bio *bio, int err)
480 end_io_wq->work.func = end_workqueue_fn; 480 end_io_wq->work.func = end_workqueue_fn;
481 end_io_wq->work.flags = 0; 481 end_io_wq->work.flags = 0;
482 482
483 if (bio->bi_rw & (1 << BIO_RW)) { 483 if (bio->bi_rw & REQ_WRITE) {
484 if (end_io_wq->metadata) 484 if (end_io_wq->metadata)
485 btrfs_queue_worker(&fs_info->endio_meta_write_workers, 485 btrfs_queue_worker(&fs_info->endio_meta_write_workers,
486 &end_io_wq->work); 486 &end_io_wq->work);
@@ -604,7 +604,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
604 604
605 atomic_inc(&fs_info->nr_async_submits); 605 atomic_inc(&fs_info->nr_async_submits);
606 606
607 if (rw & (1 << BIO_RW_SYNCIO)) 607 if (rw & REQ_SYNC)
608 btrfs_set_work_high_prio(&async->work); 608 btrfs_set_work_high_prio(&async->work);
609 609
610 btrfs_queue_worker(&fs_info->workers, &async->work); 610 btrfs_queue_worker(&fs_info->workers, &async->work);
@@ -668,7 +668,7 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
668 bio, 1); 668 bio, 1);
669 BUG_ON(ret); 669 BUG_ON(ret);
670 670
671 if (!(rw & (1 << BIO_RW))) { 671 if (!(rw & REQ_WRITE)) {
672 /* 672 /*
673 * called for a read, do the setup so that checksum validation 673 * called for a read, do the setup so that checksum validation
674 * can happen in the async kernel threads 674 * can happen in the async kernel threads
@@ -1427,7 +1427,7 @@ static void end_workqueue_fn(struct btrfs_work *work)
1427 * ram and up to date before trying to verify things. For 1427 * ram and up to date before trying to verify things. For
1428 * blocksize <= pagesize, it is basically a noop 1428 * blocksize <= pagesize, it is basically a noop
1429 */ 1429 */
1430 if (!(bio->bi_rw & (1 << BIO_RW)) && end_io_wq->metadata && 1430 if (!(bio->bi_rw & REQ_WRITE) && end_io_wq->metadata &&
1431 !bio_ready_for_csum(bio)) { 1431 !bio_ready_for_csum(bio)) {
1432 btrfs_queue_worker(&fs_info->endio_meta_workers, 1432 btrfs_queue_worker(&fs_info->endio_meta_workers,
1433 &end_io_wq->work); 1433 &end_io_wq->work);
@@ -2063,7 +2063,7 @@ static void btrfs_end_buffer_write_sync(struct buffer_head *bh, int uptodate)
2063 if (uptodate) { 2063 if (uptodate) {
2064 set_buffer_uptodate(bh); 2064 set_buffer_uptodate(bh);
2065 } else { 2065 } else {
2066 if (!buffer_eopnotsupp(bh) && printk_ratelimit()) { 2066 if (printk_ratelimit()) {
2067 printk(KERN_WARNING "lost page write due to " 2067 printk(KERN_WARNING "lost page write due to "
2068 "I/O error on %s\n", 2068 "I/O error on %s\n",
2069 bdevname(bh->b_bdev, b)); 2069 bdevname(bh->b_bdev, b));
@@ -2200,21 +2200,10 @@ static int write_dev_supers(struct btrfs_device *device,
2200 bh->b_end_io = btrfs_end_buffer_write_sync; 2200 bh->b_end_io = btrfs_end_buffer_write_sync;
2201 } 2201 }
2202 2202
2203 if (i == last_barrier && do_barriers && device->barriers) { 2203 if (i == last_barrier && do_barriers)
2204 ret = submit_bh(WRITE_BARRIER, bh); 2204 ret = submit_bh(WRITE_FLUSH_FUA, bh);
2205 if (ret == -EOPNOTSUPP) { 2205 else
2206 printk("btrfs: disabling barriers on dev %s\n",
2207 device->name);
2208 set_buffer_uptodate(bh);
2209 device->barriers = 0;
2210 /* one reference for submit_bh */
2211 get_bh(bh);
2212 lock_buffer(bh);
2213 ret = submit_bh(WRITE_SYNC, bh);
2214 }
2215 } else {
2216 ret = submit_bh(WRITE_SYNC, bh); 2206 ret = submit_bh(WRITE_SYNC, bh);
2217 }
2218 2207
2219 if (ret) 2208 if (ret)
2220 errors++; 2209 errors++;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 32d094002a57..0b81ecdb101c 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1695,8 +1695,7 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans,
1695static void btrfs_issue_discard(struct block_device *bdev, 1695static void btrfs_issue_discard(struct block_device *bdev,
1696 u64 start, u64 len) 1696 u64 start, u64 len)
1697{ 1697{
1698 blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, 1698 blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, 0);
1699 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
1700} 1699}
1701 1700
1702static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, 1701static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1bff92ad4744..64f99cf69ce0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1429,7 +1429,7 @@ static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
1429 ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0); 1429 ret = btrfs_bio_wq_end_io(root->fs_info, bio, 0);
1430 BUG_ON(ret); 1430 BUG_ON(ret);
1431 1431
1432 if (!(rw & (1 << BIO_RW))) { 1432 if (!(rw & REQ_WRITE)) {
1433 if (bio_flags & EXTENT_BIO_COMPRESSED) { 1433 if (bio_flags & EXTENT_BIO_COMPRESSED) {
1434 return btrfs_submit_compressed_read(inode, bio, 1434 return btrfs_submit_compressed_read(inode, bio,
1435 mirror_num, bio_flags); 1435 mirror_num, bio_flags);
@@ -1841,7 +1841,7 @@ static int btrfs_io_failed_hook(struct bio *failed_bio,
1841 bio->bi_size = 0; 1841 bio->bi_size = 0;
1842 1842
1843 bio_add_page(bio, page, failrec->len, start - page_offset(page)); 1843 bio_add_page(bio, page, failrec->len, start - page_offset(page));
1844 if (failed_bio->bi_rw & (1 << BIO_RW)) 1844 if (failed_bio->bi_rw & REQ_WRITE)
1845 rw = WRITE; 1845 rw = WRITE;
1846 else 1846 else
1847 rw = READ; 1847 rw = READ;
@@ -2938,7 +2938,6 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
2938 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 2938 dir->i_mtime = dir->i_ctime = CURRENT_TIME;
2939 ret = btrfs_update_inode(trans, root, dir); 2939 ret = btrfs_update_inode(trans, root, dir);
2940 BUG_ON(ret); 2940 BUG_ON(ret);
2941 dir->i_sb->s_dirt = 1;
2942 2941
2943 btrfs_free_path(path); 2942 btrfs_free_path(path);
2944 return 0; 2943 return 0;
@@ -3656,17 +3655,19 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr)
3656 if (err) 3655 if (err)
3657 return err; 3656 return err;
3658 } 3657 }
3659 attr->ia_valid &= ~ATTR_SIZE;
3660 3658
3661 if (attr->ia_valid) 3659 if (attr->ia_valid) {
3662 err = inode_setattr(inode, attr); 3660 setattr_copy(inode, attr);
3661 mark_inode_dirty(inode);
3662
3663 if (attr->ia_valid & ATTR_MODE)
3664 err = btrfs_acl_chmod(inode);
3665 }
3663 3666
3664 if (!err && ((attr->ia_valid & ATTR_MODE)))
3665 err = btrfs_acl_chmod(inode);
3666 return err; 3667 return err;
3667} 3668}
3668 3669
3669void btrfs_delete_inode(struct inode *inode) 3670void btrfs_evict_inode(struct inode *inode)
3670{ 3671{
3671 struct btrfs_trans_handle *trans; 3672 struct btrfs_trans_handle *trans;
3672 struct btrfs_root *root = BTRFS_I(inode)->root; 3673 struct btrfs_root *root = BTRFS_I(inode)->root;
@@ -3674,10 +3675,14 @@ void btrfs_delete_inode(struct inode *inode)
3674 int ret; 3675 int ret;
3675 3676
3676 truncate_inode_pages(&inode->i_data, 0); 3677 truncate_inode_pages(&inode->i_data, 0);
3678 if (inode->i_nlink && btrfs_root_refs(&root->root_item) != 0)
3679 goto no_delete;
3680
3677 if (is_bad_inode(inode)) { 3681 if (is_bad_inode(inode)) {
3678 btrfs_orphan_del(NULL, inode); 3682 btrfs_orphan_del(NULL, inode);
3679 goto no_delete; 3683 goto no_delete;
3680 } 3684 }
3685 /* do we really want it for ->i_nlink > 0 and zero btrfs_root_refs? */
3681 btrfs_wait_ordered_range(inode, 0, (u64)-1); 3686 btrfs_wait_ordered_range(inode, 0, (u64)-1);
3682 3687
3683 if (root->fs_info->log_root_recovering) { 3688 if (root->fs_info->log_root_recovering) {
@@ -3727,7 +3732,7 @@ void btrfs_delete_inode(struct inode *inode)
3727 btrfs_end_transaction(trans, root); 3732 btrfs_end_transaction(trans, root);
3728 btrfs_btree_balance_dirty(root, nr); 3733 btrfs_btree_balance_dirty(root, nr);
3729no_delete: 3734no_delete:
3730 clear_inode(inode); 3735 end_writeback(inode);
3731 return; 3736 return;
3732} 3737}
3733 3738
@@ -3844,7 +3849,7 @@ again:
3844 p = &root->inode_tree.rb_node; 3849 p = &root->inode_tree.rb_node;
3845 parent = NULL; 3850 parent = NULL;
3846 3851
3847 if (hlist_unhashed(&inode->i_hash)) 3852 if (inode_unhashed(inode))
3848 return; 3853 return;
3849 3854
3850 spin_lock(&root->inode_lock); 3855 spin_lock(&root->inode_lock);
@@ -3858,7 +3863,7 @@ again:
3858 p = &parent->rb_right; 3863 p = &parent->rb_right;
3859 else { 3864 else {
3860 WARN_ON(!(entry->vfs_inode.i_state & 3865 WARN_ON(!(entry->vfs_inode.i_state &
3861 (I_WILL_FREE | I_FREEING | I_CLEAR))); 3866 (I_WILL_FREE | I_FREEING)));
3862 rb_erase(parent, &root->inode_tree); 3867 rb_erase(parent, &root->inode_tree);
3863 RB_CLEAR_NODE(parent); 3868 RB_CLEAR_NODE(parent);
3864 spin_unlock(&root->inode_lock); 3869 spin_unlock(&root->inode_lock);
@@ -3937,7 +3942,7 @@ again:
3937 if (atomic_read(&inode->i_count) > 1) 3942 if (atomic_read(&inode->i_count) > 1)
3938 d_prune_aliases(inode); 3943 d_prune_aliases(inode);
3939 /* 3944 /*
3940 * btrfs_drop_inode will remove it from 3945 * btrfs_drop_inode will have it removed from
3941 * the inode cache when its usage count 3946 * the inode cache when its usage count
3942 * hits zero. 3947 * hits zero.
3943 */ 3948 */
@@ -4753,7 +4758,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
4753 } 4758 }
4754 4759
4755 btrfs_set_trans_block_group(trans, dir); 4760 btrfs_set_trans_block_group(trans, dir);
4756 atomic_inc(&inode->i_count); 4761 ihold(inode);
4757 4762
4758 err = btrfs_add_nondir(trans, dentry, inode, 1, index); 4763 err = btrfs_add_nondir(trans, dentry, inode, 1, index);
4759 4764
@@ -5642,7 +5647,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode,
5642 struct bio_vec *bvec = bio->bi_io_vec; 5647 struct bio_vec *bvec = bio->bi_io_vec;
5643 u64 start; 5648 u64 start;
5644 int skip_sum; 5649 int skip_sum;
5645 int write = rw & (1 << BIO_RW); 5650 int write = rw & REQ_WRITE;
5646 int ret = 0; 5651 int ret = 0;
5647 5652
5648 skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; 5653 skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
@@ -6331,13 +6336,14 @@ free:
6331 kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); 6336 kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
6332} 6337}
6333 6338
6334void btrfs_drop_inode(struct inode *inode) 6339int btrfs_drop_inode(struct inode *inode)
6335{ 6340{
6336 struct btrfs_root *root = BTRFS_I(inode)->root; 6341 struct btrfs_root *root = BTRFS_I(inode)->root;
6337 if (inode->i_nlink > 0 && btrfs_root_refs(&root->root_item) == 0) 6342
6338 generic_delete_inode(inode); 6343 if (btrfs_root_refs(&root->root_item) == 0)
6344 return 1;
6339 else 6345 else
6340 generic_drop_inode(inode); 6346 return generic_drop_inode(inode);
6341} 6347}
6342 6348
6343static void init_once(void *foo) 6349static void init_once(void *foo)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f2393b390318..144f8a5730f5 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -797,7 +797,7 @@ static int btrfs_unfreeze(struct super_block *sb)
797 797
798static const struct super_operations btrfs_super_ops = { 798static const struct super_operations btrfs_super_ops = {
799 .drop_inode = btrfs_drop_inode, 799 .drop_inode = btrfs_drop_inode,
800 .delete_inode = btrfs_delete_inode, 800 .evict_inode = btrfs_evict_inode,
801 .put_super = btrfs_put_super, 801 .put_super = btrfs_put_super,
802 .sync_fs = btrfs_sync_fs, 802 .sync_fs = btrfs_sync_fs,
803 .show_options = btrfs_show_options, 803 .show_options = btrfs_show_options,
@@ -815,6 +815,7 @@ static const struct file_operations btrfs_ctl_fops = {
815 .unlocked_ioctl = btrfs_control_ioctl, 815 .unlocked_ioctl = btrfs_control_ioctl,
816 .compat_ioctl = btrfs_control_ioctl, 816 .compat_ioctl = btrfs_control_ioctl,
817 .owner = THIS_MODULE, 817 .owner = THIS_MODULE,
818 .llseek = noop_llseek,
818}; 819};
819 820
820static struct miscdevice btrfs_misc = { 821static struct miscdevice btrfs_misc = {
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d6e3af8be95b..e25e46a8b4e2 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -258,7 +258,7 @@ loop_lock:
258 258
259 BUG_ON(atomic_read(&cur->bi_cnt) == 0); 259 BUG_ON(atomic_read(&cur->bi_cnt) == 0);
260 260
261 if (bio_rw_flagged(cur, BIO_RW_SYNCIO)) 261 if (cur->bi_rw & REQ_SYNC)
262 num_sync_run++; 262 num_sync_run++;
263 263
264 submit_bio(cur->bi_rw, cur); 264 submit_bio(cur->bi_rw, cur);
@@ -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);
@@ -2651,7 +2648,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
2651 int max_errors = 0; 2648 int max_errors = 0;
2652 struct btrfs_multi_bio *multi = NULL; 2649 struct btrfs_multi_bio *multi = NULL;
2653 2650
2654 if (multi_ret && !(rw & (1 << BIO_RW))) 2651 if (multi_ret && !(rw & REQ_WRITE))
2655 stripes_allocated = 1; 2652 stripes_allocated = 1;
2656again: 2653again:
2657 if (multi_ret) { 2654 if (multi_ret) {
@@ -2687,7 +2684,7 @@ again:
2687 mirror_num = 0; 2684 mirror_num = 0;
2688 2685
2689 /* if our multi bio struct is too small, back off and try again */ 2686 /* if our multi bio struct is too small, back off and try again */
2690 if (rw & (1 << BIO_RW)) { 2687 if (rw & REQ_WRITE) {
2691 if (map->type & (BTRFS_BLOCK_GROUP_RAID1 | 2688 if (map->type & (BTRFS_BLOCK_GROUP_RAID1 |
2692 BTRFS_BLOCK_GROUP_DUP)) { 2689 BTRFS_BLOCK_GROUP_DUP)) {
2693 stripes_required = map->num_stripes; 2690 stripes_required = map->num_stripes;
@@ -2697,7 +2694,7 @@ again:
2697 max_errors = 1; 2694 max_errors = 1;
2698 } 2695 }
2699 } 2696 }
2700 if (multi_ret && (rw & (1 << BIO_RW)) && 2697 if (multi_ret && (rw & REQ_WRITE) &&
2701 stripes_allocated < stripes_required) { 2698 stripes_allocated < stripes_required) {
2702 stripes_allocated = map->num_stripes; 2699 stripes_allocated = map->num_stripes;
2703 free_extent_map(em); 2700 free_extent_map(em);
@@ -2733,7 +2730,7 @@ again:
2733 num_stripes = 1; 2730 num_stripes = 1;
2734 stripe_index = 0; 2731 stripe_index = 0;
2735 if (map->type & BTRFS_BLOCK_GROUP_RAID1) { 2732 if (map->type & BTRFS_BLOCK_GROUP_RAID1) {
2736 if (unplug_page || (rw & (1 << BIO_RW))) 2733 if (unplug_page || (rw & REQ_WRITE))
2737 num_stripes = map->num_stripes; 2734 num_stripes = map->num_stripes;
2738 else if (mirror_num) 2735 else if (mirror_num)
2739 stripe_index = mirror_num - 1; 2736 stripe_index = mirror_num - 1;
@@ -2744,7 +2741,7 @@ again:
2744 } 2741 }
2745 2742
2746 } else if (map->type & BTRFS_BLOCK_GROUP_DUP) { 2743 } else if (map->type & BTRFS_BLOCK_GROUP_DUP) {
2747 if (rw & (1 << BIO_RW)) 2744 if (rw & REQ_WRITE)
2748 num_stripes = map->num_stripes; 2745 num_stripes = map->num_stripes;
2749 else if (mirror_num) 2746 else if (mirror_num)
2750 stripe_index = mirror_num - 1; 2747 stripe_index = mirror_num - 1;
@@ -2755,7 +2752,7 @@ again:
2755 stripe_index = do_div(stripe_nr, factor); 2752 stripe_index = do_div(stripe_nr, factor);
2756 stripe_index *= map->sub_stripes; 2753 stripe_index *= map->sub_stripes;
2757 2754
2758 if (unplug_page || (rw & (1 << BIO_RW))) 2755 if (unplug_page || (rw & REQ_WRITE))
2759 num_stripes = map->sub_stripes; 2756 num_stripes = map->sub_stripes;
2760 else if (mirror_num) 2757 else if (mirror_num)
2761 stripe_index += mirror_num - 1; 2758 stripe_index += mirror_num - 1;
@@ -2945,7 +2942,7 @@ static noinline int schedule_bio(struct btrfs_root *root,
2945 struct btrfs_pending_bios *pending_bios; 2942 struct btrfs_pending_bios *pending_bios;
2946 2943
2947 /* don't bother with additional async steps for reads, right now */ 2944 /* don't bother with additional async steps for reads, right now */
2948 if (!(rw & (1 << BIO_RW))) { 2945 if (!(rw & REQ_WRITE)) {
2949 bio_get(bio); 2946 bio_get(bio);
2950 submit_bio(rw, bio); 2947 submit_bio(rw, bio);
2951 bio_put(bio); 2948 bio_put(bio);
@@ -2964,7 +2961,7 @@ static noinline int schedule_bio(struct btrfs_root *root,
2964 bio->bi_rw |= rw; 2961 bio->bi_rw |= rw;
2965 2962
2966 spin_lock(&device->io_lock); 2963 spin_lock(&device->io_lock);
2967 if (bio_rw_flagged(bio, BIO_RW_SYNCIO)) 2964 if (bio->bi_rw & REQ_SYNC)
2968 pending_bios = &device->pending_sync_bios; 2965 pending_bios = &device->pending_sync_bios;
2969 else 2966 else
2970 pending_bios = &device->pending_bios; 2967 pending_bios = &device->pending_bios;
@@ -3084,7 +3081,6 @@ static struct btrfs_device *add_missing_dev(struct btrfs_root *root,
3084 return NULL; 3081 return NULL;
3085 list_add(&device->dev_list, 3082 list_add(&device->dev_list,
3086 &fs_devices->devices); 3083 &fs_devices->devices);
3087 device->barriers = 1;
3088 device->dev_root = root->fs_info->dev_root; 3084 device->dev_root = root->fs_info->dev_root;
3089 device->devid = devid; 3085 device->devid = devid;
3090 device->work.func = pending_bios_fn; 3086 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