Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a82ca65 authored by Josef Bacik's avatar Josef Bacik
Browse files

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: default avatarJosef Bacik <josef@redhat.com>
parent 549b4fdb
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -3521,7 +3521,7 @@ again:
			avail >>= 1;
			avail >>= 1;
		 spin_unlock(&root->fs_info->free_chunk_lock);
		 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;
			space_info->bytes_may_use += orig_bytes;
			ret = 0;
			ret = 0;
		}
		}