diff options
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 198cff28766d..41ecbb2347f2 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1135,7 +1135,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1135 | root->fs_info->avail_metadata_alloc_bits; | 1135 | root->fs_info->avail_metadata_alloc_bits; |
1136 | 1136 | ||
1137 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID10) && | 1137 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID10) && |
1138 | root->fs_info->fs_devices->rw_devices <= 4) { | 1138 | root->fs_info->fs_devices->num_devices <= 4) { |
1139 | printk(KERN_ERR "btrfs: unable to go below four devices " | 1139 | printk(KERN_ERR "btrfs: unable to go below four devices " |
1140 | "on raid10\n"); | 1140 | "on raid10\n"); |
1141 | ret = -EINVAL; | 1141 | ret = -EINVAL; |
@@ -1143,7 +1143,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID1) && | 1145 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID1) && |
1146 | root->fs_info->fs_devices->rw_devices <= 2) { | 1146 | root->fs_info->fs_devices->num_devices <= 2) { |
1147 | printk(KERN_ERR "btrfs: unable to go below two " | 1147 | printk(KERN_ERR "btrfs: unable to go below two " |
1148 | "devices on raid1\n"); | 1148 | "devices on raid1\n"); |
1149 | ret = -EINVAL; | 1149 | ret = -EINVAL; |
@@ -1434,8 +1434,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1434 | return -EINVAL; | 1434 | return -EINVAL; |
1435 | 1435 | ||
1436 | bdev = open_bdev_exclusive(device_path, 0, root->fs_info->bdev_holder); | 1436 | bdev = open_bdev_exclusive(device_path, 0, root->fs_info->bdev_holder); |
1437 | if (!bdev) | 1437 | if (IS_ERR(bdev)) |
1438 | return -EIO; | 1438 | return PTR_ERR(bdev); |
1439 | 1439 | ||
1440 | if (root->fs_info->fs_devices->seeding) { | 1440 | if (root->fs_info->fs_devices->seeding) { |
1441 | seeding_dev = 1; | 1441 | seeding_dev = 1; |
@@ -2538,6 +2538,11 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset) | |||
2538 | if (!em) | 2538 | if (!em) |
2539 | return 1; | 2539 | return 1; |
2540 | 2540 | ||
2541 | if (btrfs_test_opt(root, DEGRADED)) { | ||
2542 | free_extent_map(em); | ||
2543 | return 0; | ||
2544 | } | ||
2545 | |||
2541 | map = (struct map_lookup *)em->bdev; | 2546 | map = (struct map_lookup *)em->bdev; |
2542 | for (i = 0; i < map->num_stripes; i++) { | 2547 | for (i = 0; i < map->num_stripes; i++) { |
2543 | if (!map->stripes[i].dev->writeable) { | 2548 | if (!map->stripes[i].dev->writeable) { |
@@ -2649,8 +2654,10 @@ again: | |||
2649 | em = lookup_extent_mapping(em_tree, logical, *length); | 2654 | em = lookup_extent_mapping(em_tree, logical, *length); |
2650 | read_unlock(&em_tree->lock); | 2655 | read_unlock(&em_tree->lock); |
2651 | 2656 | ||
2652 | if (!em && unplug_page) | 2657 | if (!em && unplug_page) { |
2658 | kfree(multi); | ||
2653 | return 0; | 2659 | return 0; |
2660 | } | ||
2654 | 2661 | ||
2655 | if (!em) { | 2662 | if (!em) { |
2656 | printk(KERN_CRIT "unable to find logical %llu len %llu\n", | 2663 | printk(KERN_CRIT "unable to find logical %llu len %llu\n", |