From: Arne Jansen Date: Fri, 12 Nov 2010 23:17:56 +0000 (+0000) Subject: btrfs: Fix early enospc because 'unused' calculated with wrong sign. X-Git-Tag: v2.6.37-rc4~6^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f33434850ed87dc5e56b60ebbad3d3cf405f296;p=profile%2Fcommon%2Fkernel-common.git btrfs: Fix early enospc because 'unused' calculated with wrong sign. 'unused' calculated with wrong sign in reserve_metadata_bytes(). This might have lead to unwanted over-reservations. Signed-off-by: Arne Jansen Reviewed-by: Josef Bacik Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a541bc8..ddaf634 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3413,7 +3413,7 @@ again: * our reservation. */ if (unused <= space_info->total_bytes) { - unused -= space_info->total_bytes; + unused = space_info->total_bytes - unused; if (unused >= num_bytes) { if (!reserved) space_info->bytes_reserved += orig_bytes;