diff options
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 8db7b14bbae8..dd318ff280b2 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); |
@@ -1097,7 +1097,7 @@ static int btrfs_rm_dev_item(struct btrfs_root *root, | |||
1097 | if (!path) | 1097 | if (!path) |
1098 | return -ENOMEM; | 1098 | return -ENOMEM; |
1099 | 1099 | ||
1100 | trans = btrfs_start_transaction(root, 1); | 1100 | trans = btrfs_start_transaction(root, 0); |
1101 | key.objectid = BTRFS_DEV_ITEMS_OBJECTID; | 1101 | key.objectid = BTRFS_DEV_ITEMS_OBJECTID; |
1102 | key.type = BTRFS_DEV_ITEM_KEY; | 1102 | key.type = BTRFS_DEV_ITEM_KEY; |
1103 | key.offset = device->devid; | 1103 | key.offset = device->devid; |
@@ -1486,7 +1486,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1486 | goto error; | 1486 | goto error; |
1487 | } | 1487 | } |
1488 | 1488 | ||
1489 | trans = btrfs_start_transaction(root, 1); | 1489 | trans = btrfs_start_transaction(root, 0); |
1490 | lock_chunks(root); | 1490 | lock_chunks(root); |
1491 | 1491 | ||
1492 | device->barriers = 1; | 1492 | device->barriers = 1; |
@@ -1751,9 +1751,10 @@ static int btrfs_relocate_chunk(struct btrfs_root *root, | |||
1751 | 1751 | ||
1752 | /* step one, relocate all the extents inside this chunk */ | 1752 | /* step one, relocate all the extents inside this chunk */ |
1753 | ret = btrfs_relocate_block_group(extent_root, chunk_offset); | 1753 | ret = btrfs_relocate_block_group(extent_root, chunk_offset); |
1754 | BUG_ON(ret); | 1754 | if (ret) |
1755 | return ret; | ||
1755 | 1756 | ||
1756 | trans = btrfs_start_transaction(root, 1); | 1757 | trans = btrfs_start_transaction(root, 0); |
1757 | BUG_ON(!trans); | 1758 | BUG_ON(!trans); |
1758 | 1759 | ||
1759 | lock_chunks(root); | 1760 | lock_chunks(root); |
@@ -1925,7 +1926,7 @@ int btrfs_balance(struct btrfs_root *dev_root) | |||
1925 | break; | 1926 | break; |
1926 | BUG_ON(ret); | 1927 | BUG_ON(ret); |
1927 | 1928 | ||
1928 | trans = btrfs_start_transaction(dev_root, 1); | 1929 | trans = btrfs_start_transaction(dev_root, 0); |
1929 | BUG_ON(!trans); | 1930 | BUG_ON(!trans); |
1930 | 1931 | ||
1931 | ret = btrfs_grow_device(trans, device, old_size); | 1932 | ret = btrfs_grow_device(trans, device, old_size); |
@@ -2094,11 +2095,7 @@ again: | |||
2094 | } | 2095 | } |
2095 | 2096 | ||
2096 | /* Shrinking succeeded, else we would be at "done". */ | 2097 | /* Shrinking succeeded, else we would be at "done". */ |
2097 | trans = btrfs_start_transaction(root, 1); | 2098 | trans = btrfs_start_transaction(root, 0); |
2098 | if (!trans) { | ||
2099 | ret = -ENOMEM; | ||
2100 | goto done; | ||
2101 | } | ||
2102 | lock_chunks(root); | 2099 | lock_chunks(root); |
2103 | 2100 | ||
2104 | device->disk_total_bytes = new_size; | 2101 | device->disk_total_bytes = new_size; |
@@ -2654,7 +2651,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, | |||
2654 | int max_errors = 0; | 2651 | int max_errors = 0; |
2655 | struct btrfs_multi_bio *multi = NULL; | 2652 | struct btrfs_multi_bio *multi = NULL; |
2656 | 2653 | ||
2657 | if (multi_ret && !(rw & (1 << BIO_RW))) | 2654 | if (multi_ret && !(rw & REQ_WRITE)) |
2658 | stripes_allocated = 1; | 2655 | stripes_allocated = 1; |
2659 | again: | 2656 | again: |
2660 | if (multi_ret) { | 2657 | if (multi_ret) { |
@@ -2690,7 +2687,7 @@ again: | |||
2690 | mirror_num = 0; | 2687 | mirror_num = 0; |
2691 | 2688 | ||
2692 | /* if our multi bio struct is too small, back off and try again */ | 2689 | /* if our multi bio struct is too small, back off and try again */ |
2693 | if (rw & (1 << BIO_RW)) { | 2690 | if (rw & REQ_WRITE) { |
2694 | if (map->type & (BTRFS_BLOCK_GROUP_RAID1 | | 2691 | if (map->type & (BTRFS_BLOCK_GROUP_RAID1 | |
2695 | BTRFS_BLOCK_GROUP_DUP)) { | 2692 | BTRFS_BLOCK_GROUP_DUP)) { |
2696 | stripes_required = map->num_stripes; | 2693 | stripes_required = map->num_stripes; |
@@ -2700,7 +2697,7 @@ again: | |||
2700 | max_errors = 1; | 2697 | max_errors = 1; |
2701 | } | 2698 | } |
2702 | } | 2699 | } |
2703 | if (multi_ret && (rw & (1 << BIO_RW)) && | 2700 | if (multi_ret && (rw & REQ_WRITE) && |
2704 | stripes_allocated < stripes_required) { | 2701 | stripes_allocated < stripes_required) { |
2705 | stripes_allocated = map->num_stripes; | 2702 | stripes_allocated = map->num_stripes; |
2706 | free_extent_map(em); | 2703 | free_extent_map(em); |
@@ -2736,7 +2733,7 @@ again: | |||
2736 | num_stripes = 1; | 2733 | num_stripes = 1; |
2737 | stripe_index = 0; | 2734 | stripe_index = 0; |
2738 | if (map->type & BTRFS_BLOCK_GROUP_RAID1) { | 2735 | if (map->type & BTRFS_BLOCK_GROUP_RAID1) { |
2739 | if (unplug_page || (rw & (1 << BIO_RW))) | 2736 | if (unplug_page || (rw & REQ_WRITE)) |
2740 | num_stripes = map->num_stripes; | 2737 | num_stripes = map->num_stripes; |
2741 | else if (mirror_num) | 2738 | else if (mirror_num) |
2742 | stripe_index = mirror_num - 1; | 2739 | stripe_index = mirror_num - 1; |
@@ -2747,7 +2744,7 @@ again: | |||
2747 | } | 2744 | } |
2748 | 2745 | ||
2749 | } else if (map->type & BTRFS_BLOCK_GROUP_DUP) { | 2746 | } else if (map->type & BTRFS_BLOCK_GROUP_DUP) { |
2750 | if (rw & (1 << BIO_RW)) | 2747 | if (rw & REQ_WRITE) |
2751 | num_stripes = map->num_stripes; | 2748 | num_stripes = map->num_stripes; |
2752 | else if (mirror_num) | 2749 | else if (mirror_num) |
2753 | stripe_index = mirror_num - 1; | 2750 | stripe_index = mirror_num - 1; |
@@ -2758,7 +2755,7 @@ again: | |||
2758 | stripe_index = do_div(stripe_nr, factor); | 2755 | stripe_index = do_div(stripe_nr, factor); |
2759 | stripe_index *= map->sub_stripes; | 2756 | stripe_index *= map->sub_stripes; |
2760 | 2757 | ||
2761 | if (unplug_page || (rw & (1 << BIO_RW))) | 2758 | if (unplug_page || (rw & REQ_WRITE)) |
2762 | num_stripes = map->sub_stripes; | 2759 | num_stripes = map->sub_stripes; |
2763 | else if (mirror_num) | 2760 | else if (mirror_num) |
2764 | stripe_index += mirror_num - 1; | 2761 | stripe_index += mirror_num - 1; |
@@ -2948,7 +2945,7 @@ static noinline int schedule_bio(struct btrfs_root *root, | |||
2948 | struct btrfs_pending_bios *pending_bios; | 2945 | struct btrfs_pending_bios *pending_bios; |
2949 | 2946 | ||
2950 | /* don't bother with additional async steps for reads, right now */ | 2947 | /* don't bother with additional async steps for reads, right now */ |
2951 | if (!(rw & (1 << BIO_RW))) { | 2948 | if (!(rw & REQ_WRITE)) { |
2952 | bio_get(bio); | 2949 | bio_get(bio); |
2953 | submit_bio(rw, bio); | 2950 | submit_bio(rw, bio); |
2954 | bio_put(bio); | 2951 | bio_put(bio); |
@@ -2967,7 +2964,7 @@ static noinline int schedule_bio(struct btrfs_root *root, | |||
2967 | bio->bi_rw |= rw; | 2964 | bio->bi_rw |= rw; |
2968 | 2965 | ||
2969 | spin_lock(&device->io_lock); | 2966 | spin_lock(&device->io_lock); |
2970 | if (bio_rw_flagged(bio, BIO_RW_SYNCIO)) | 2967 | if (bio->bi_rw & REQ_SYNC) |
2971 | pending_bios = &device->pending_sync_bios; | 2968 | pending_bios = &device->pending_sync_bios; |
2972 | else | 2969 | else |
2973 | pending_bios = &device->pending_bios; | 2970 | pending_bios = &device->pending_bios; |