diff options
| -rw-r--r-- | fs/btrfs/extent-tree.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 857a859948a3..50de1fa6fc9e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -8482,14 +8482,6 @@ int btrfs_set_block_group_ro(struct btrfs_root *root, | |||
| 8482 | if (IS_ERR(trans)) | 8482 | if (IS_ERR(trans)) |
| 8483 | return PTR_ERR(trans); | 8483 | return PTR_ERR(trans); |
| 8484 | 8484 | ||
| 8485 | alloc_flags = update_block_group_flags(root, cache->flags); | ||
| 8486 | if (alloc_flags != cache->flags) { | ||
| 8487 | ret = do_chunk_alloc(trans, root, alloc_flags, | ||
| 8488 | CHUNK_ALLOC_FORCE); | ||
| 8489 | if (ret < 0) | ||
| 8490 | goto out; | ||
| 8491 | } | ||
| 8492 | |||
| 8493 | ret = set_block_group_ro(cache, 0); | 8485 | ret = set_block_group_ro(cache, 0); |
| 8494 | if (!ret) | 8486 | if (!ret) |
| 8495 | goto out; | 8487 | goto out; |
| @@ -8500,6 +8492,11 @@ int btrfs_set_block_group_ro(struct btrfs_root *root, | |||
| 8500 | goto out; | 8492 | goto out; |
| 8501 | ret = set_block_group_ro(cache, 0); | 8493 | ret = set_block_group_ro(cache, 0); |
| 8502 | out: | 8494 | out: |
| 8495 | if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) { | ||
| 8496 | alloc_flags = update_block_group_flags(root, cache->flags); | ||
| 8497 | check_system_chunk(trans, root, alloc_flags); | ||
| 8498 | } | ||
| 8499 | |||
| 8503 | btrfs_end_transaction(trans, root); | 8500 | btrfs_end_transaction(trans, root); |
| 8504 | return ret; | 8501 | return ret; |
| 8505 | } | 8502 | } |
