From: Josef Bacik Date: Wed, 5 Oct 2011 20:35:28 +0000 (-0400) Subject: Btrfs: take overflow into account in reserving space X-Git-Tag: firefly_0821_release~3680^2~3894^2~78^2~12 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9a82ca659d8bfd99afc0e89bbde2202322df5755;p=firefly-linux-kernel-4.4.55.git Btrfs: take overflow into account in reserving space 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 --- diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f9711a82fc54..f95e55083bdb 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3521,7 +3521,7 @@ again: 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; }