diff options
-rw-r--r-- | fs/btrfs/volumes.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 9c84dbe64f18..469609838913 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -2614,7 +2614,14 @@ static int chunk_usage_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset, | |||
2614 | cache = btrfs_lookup_block_group(fs_info, chunk_offset); | 2614 | cache = btrfs_lookup_block_group(fs_info, chunk_offset); |
2615 | chunk_used = btrfs_block_group_used(&cache->item); | 2615 | chunk_used = btrfs_block_group_used(&cache->item); |
2616 | 2616 | ||
2617 | user_thresh = div_factor_fine(cache->key.offset, bargs->usage); | 2617 | if (bargs->usage == 0) |
2618 | user_thresh = 0; | ||
2619 | else if (bargs->usage > 100) | ||
2620 | user_thresh = cache->key.offset; | ||
2621 | else | ||
2622 | user_thresh = div_factor_fine(cache->key.offset, | ||
2623 | bargs->usage); | ||
2624 | |||
2618 | if (chunk_used < user_thresh) | 2625 | if (chunk_used < user_thresh) |
2619 | ret = 0; | 2626 | ret = 0; |
2620 | 2627 | ||