Skip to content

Commit

Permalink
Btrfs: take overflow into account in reserving space
Browse files Browse the repository at this point in the history
My overcommit stuff can be a little racy when we're filling up the disk with
fs_mark and we overcommit into things that quickly get used up for data.  So use
num_bytes to see if we have enough available space so we're less likely to
overcommit ourselves out of the ability to make reservations.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
  • Loading branch information
Josef Bacik committed Oct 19, 2011
1 parent 549b4fd commit 9a82ca6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3521,7 +3521,7 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
avail >>= 1;
spin_unlock(&root->fs_info->free_chunk_lock);

if (used + orig_bytes < space_info->total_bytes + avail) {
if (used + num_bytes < space_info->total_bytes + avail) {
space_info->bytes_may_use += orig_bytes;
ret = 0;
}
Expand Down

0 comments on commit 9a82ca6

Please sign in to comment.