Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332520
b: refs/heads/master
c: 54338b5
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Oct 1, 2012
1 parent bbbca63 commit 95438f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7c735313bd1277c2eb28421934d4c7a0fa7339f7
refs/heads/master: 54338b5cc4fa3cfe260e8e4ade8b62a9079ea3f9
12 changes: 3 additions & 9 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3504,7 +3504,8 @@ static int should_alloc_chunk(struct btrfs_root *root,
* and purposes it's used space. Don't worry about locking the
* global_rsv, it doesn't change except when the transaction commits.
*/
num_allocated += global_rsv->size;
if (sinfo->flags & BTRFS_BLOCK_GROUP_METADATA)
num_allocated += global_rsv->size;

/*
* in limited mode, we want to have some free space up to
Expand All @@ -3518,15 +3519,8 @@ static int should_alloc_chunk(struct btrfs_root *root,
if (num_bytes - num_allocated < thresh)
return 1;
}
thresh = btrfs_super_total_bytes(root->fs_info->super_copy);

/* 256MB or 2% of the FS */
thresh = max_t(u64, 256 * 1024 * 1024, div_factor_fine(thresh, 2));
/* system chunks need a much small threshold */
if (sinfo->flags & BTRFS_BLOCK_GROUP_SYSTEM)
thresh = 32 * 1024 * 1024;

if (num_bytes > thresh && sinfo->bytes_used < div_factor(num_bytes, 8))
if (num_allocated + alloc_bytes < div_factor(num_bytes, 8))
return 0;
return 1;
}
Expand Down

0 comments on commit 95438f3

Please sign in to comment.