diff options
-rw-r--r-- | fs/btrfs/extent-tree.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 45e3f086790b..0ec3acd14cbf 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -8829,6 +8829,24 @@ again: | |||
8829 | goto again; | 8829 | goto again; |
8830 | } | 8830 | } |
8831 | 8831 | ||
8832 | /* | ||
8833 | * if we are changing raid levels, try to allocate a corresponding | ||
8834 | * block group with the new raid level. | ||
8835 | */ | ||
8836 | alloc_flags = update_block_group_flags(root, cache->flags); | ||
8837 | if (alloc_flags != cache->flags) { | ||
8838 | ret = do_chunk_alloc(trans, root, alloc_flags, | ||
8839 | CHUNK_ALLOC_FORCE); | ||
8840 | /* | ||
8841 | * ENOSPC is allowed here, we may have enough space | ||
8842 | * already allocated at the new raid level to | ||
8843 | * carry on | ||
8844 | */ | ||
8845 | if (ret == -ENOSPC) | ||
8846 | ret = 0; | ||
8847 | if (ret < 0) | ||
8848 | goto out; | ||
8849 | } | ||
8832 | 8850 | ||
8833 | ret = set_block_group_ro(cache, 0); | 8851 | ret = set_block_group_ro(cache, 0); |
8834 | if (!ret) | 8852 | if (!ret) |