Enable removal of a second disk even if that requires conversion of metadata from raid1 to dup, but not when data would lose replication.
Signed-off-by: Alexandre Oliva <ol...@lsd.ic.unicamp.br> --- fs/btrfs/volumes.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c37433d..7b348c2 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1290,12 +1290,16 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) goto out; } - if ((all_avail & BTRFS_BLOCK_GROUP_RAID1) && + if ((root->fs_info->avail_data_alloc_bits & BTRFS_BLOCK_GROUP_RAID1) && root->fs_info->fs_devices->num_devices <= 2) { printk(KERN_ERR "btrfs: unable to go below two " "devices on raid1\n"); ret = -EINVAL; goto out; + } else if ((all_avail & BTRFS_BLOCK_GROUP_RAID1) && + root->fs_info->fs_devices->num_devices <= 2) { + printk(KERN_ERR "btrfs: going below two devices " + "will switch metadata from raid1 to dup\n"); } if (strcmp(device_path, "missing") == 0) { -- 1.7.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html