diff options
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 53e12977bfd0..84e060eb0de8 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3452,7 +3452,7 @@ again: | |||
3452 | num_pages = 1; | 3452 | num_pages = 1; |
3453 | 3453 | ||
3454 | num_pages *= 16; | 3454 | num_pages *= 16; |
3455 | num_pages *= PAGE_CACHE_SIZE; | 3455 | num_pages *= PAGE_SIZE; |
3456 | 3456 | ||
3457 | ret = btrfs_check_data_free_space(inode, 0, num_pages); | 3457 | ret = btrfs_check_data_free_space(inode, 0, num_pages); |
3458 | if (ret) | 3458 | if (ret) |
@@ -4639,7 +4639,7 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig, | |||
4639 | loops = 0; | 4639 | loops = 0; |
4640 | while (delalloc_bytes && loops < 3) { | 4640 | while (delalloc_bytes && loops < 3) { |
4641 | max_reclaim = min(delalloc_bytes, to_reclaim); | 4641 | max_reclaim = min(delalloc_bytes, to_reclaim); |
4642 | nr_pages = max_reclaim >> PAGE_CACHE_SHIFT; | 4642 | nr_pages = max_reclaim >> PAGE_SHIFT; |
4643 | btrfs_writeback_inodes_sb_nr(root, nr_pages, items); | 4643 | btrfs_writeback_inodes_sb_nr(root, nr_pages, items); |
4644 | /* | 4644 | /* |
4645 | * We need to wait for the async pages to actually start before | 4645 | * We need to wait for the async pages to actually start before |
@@ -9386,15 +9386,23 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr) | |||
9386 | u64 dev_min = 1; | 9386 | u64 dev_min = 1; |
9387 | u64 dev_nr = 0; | 9387 | u64 dev_nr = 0; |
9388 | u64 target; | 9388 | u64 target; |
9389 | int debug; | ||
9389 | int index; | 9390 | int index; |
9390 | int full = 0; | 9391 | int full = 0; |
9391 | int ret = 0; | 9392 | int ret = 0; |
9392 | 9393 | ||
9394 | debug = btrfs_test_opt(root, ENOSPC_DEBUG); | ||
9395 | |||
9393 | block_group = btrfs_lookup_block_group(root->fs_info, bytenr); | 9396 | block_group = btrfs_lookup_block_group(root->fs_info, bytenr); |
9394 | 9397 | ||
9395 | /* odd, couldn't find the block group, leave it alone */ | 9398 | /* odd, couldn't find the block group, leave it alone */ |
9396 | if (!block_group) | 9399 | if (!block_group) { |
9400 | if (debug) | ||
9401 | btrfs_warn(root->fs_info, | ||
9402 | "can't find block group for bytenr %llu", | ||
9403 | bytenr); | ||
9397 | return -1; | 9404 | return -1; |
9405 | } | ||
9398 | 9406 | ||
9399 | min_free = btrfs_block_group_used(&block_group->item); | 9407 | min_free = btrfs_block_group_used(&block_group->item); |
9400 | 9408 | ||
@@ -9448,8 +9456,13 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr) | |||
9448 | * this is just a balance, so if we were marked as full | 9456 | * this is just a balance, so if we were marked as full |
9449 | * we know there is no space for a new chunk | 9457 | * we know there is no space for a new chunk |
9450 | */ | 9458 | */ |
9451 | if (full) | 9459 | if (full) { |
9460 | if (debug) | ||
9461 | btrfs_warn(root->fs_info, | ||
9462 | "no space to alloc new chunk for block group %llu", | ||
9463 | block_group->key.objectid); | ||
9452 | goto out; | 9464 | goto out; |
9465 | } | ||
9453 | 9466 | ||
9454 | index = get_block_group_index(block_group); | 9467 | index = get_block_group_index(block_group); |
9455 | } | 9468 | } |
@@ -9496,6 +9509,10 @@ int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr) | |||
9496 | ret = -1; | 9509 | ret = -1; |
9497 | } | 9510 | } |
9498 | } | 9511 | } |
9512 | if (debug && ret == -1) | ||
9513 | btrfs_warn(root->fs_info, | ||
9514 | "no space to allocate a new chunk for block group %llu", | ||
9515 | block_group->key.objectid); | ||
9499 | mutex_unlock(&root->fs_info->chunk_mutex); | 9516 | mutex_unlock(&root->fs_info->chunk_mutex); |
9500 | btrfs_end_transaction(trans, root); | 9517 | btrfs_end_transaction(trans, root); |
9501 | out: | 9518 | out: |