Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285948
b: refs/heads/master
c: cf1d72c
h: refs/heads/master
v: v3
  • Loading branch information
Chris Mason committed Jan 6, 2012
1 parent 7d91945 commit 1b2f71e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 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: 203bf287cb01a5dc26c20bd3737cecf3aeba1d48
refs/heads/master: cf1d72c9ceec391d34c48724da57282e97f01122
21 changes: 3 additions & 18 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3263,27 +3263,12 @@ static int should_alloc_chunk(struct btrfs_root *root,
if (num_bytes - num_allocated < thresh)
return 1;
}

/*
* we have two similar checks here, one based on percentage
* and once based on a hard number of 256MB. The idea
* is that if we have a good amount of free
* room, don't allocate a chunk. A good mount is
* less than 80% utilized of the chunks we have allocated,
* or more than 256MB free
*/
if (num_allocated + alloc_bytes + 256 * 1024 * 1024 < num_bytes)
return 0;

if (num_allocated + alloc_bytes < div_factor(num_bytes, 8))
return 0;

thresh = btrfs_super_total_bytes(root->fs_info->super_copy);

/* 256MB or 5% of the FS */
thresh = max_t(u64, 256 * 1024 * 1024, div_factor_fine(thresh, 5));
/* 256MB or 2% of the FS */
thresh = max_t(u64, 256 * 1024 * 1024, div_factor_fine(thresh, 2));

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

0 comments on commit 1b2f71e

Please sign in to comment.