linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] 'unused' calculated with wrong sign.
  2010-11-12 23:17 [PATCH] 'unused' calculated with wrong sign Arne Jansen
@ 2010-11-12 21:53 ` Josef Bacik
  0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2010-11-12 21:53 UTC (permalink / raw)
  To: Arne Jansen; +Cc: linux-btrfs, josef

On Sat, Nov 13, 2010 at 12:17:56AM +0100, Arne Jansen wrote:
> 'unused' calculated with wrong sign in reserve_metadata_bytes().
> This might have lead to unwanted over-reservations.
> 
> Signed-off-by: Arne Jansen <sensille@gmx.net>
> ---
>  fs/btrfs/extent-tree.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> 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;
> -- 
> 1.7.2.2
> 

Good catch

Reviewed-by: Josef Bacik <josef@redhat.com>

Thanks,

Josef

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] 'unused' calculated with wrong sign.
@ 2010-11-12 23:17 Arne Jansen
  2010-11-12 21:53 ` Josef Bacik
  0 siblings, 1 reply; 2+ messages in thread
From: Arne Jansen @ 2010-11-12 23:17 UTC (permalink / raw)
  To: linux-btrfs; +Cc: josef

'unused' calculated with wrong sign in reserve_metadata_bytes().
This might have lead to unwanted over-reservations.

Signed-off-by: Arne Jansen <sensille@gmx.net>
---
 fs/btrfs/extent-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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;
-- 
1.7.2.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-12 23:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-12 23:17 [PATCH] 'unused' calculated with wrong sign Arne Jansen
2010-11-12 21:53 ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).