All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: Arne Jansen <sensille@gmx.net>
Cc: linux-btrfs@vger.kernel.org, josef@redhat.com
Subject: Re: [PATCH] 'unused' calculated with wrong sign.
Date: Fri, 12 Nov 2010 16:53:13 -0500	[thread overview]
Message-ID: <20101112215312.GA2657@localhost.localdomain> (raw)
In-Reply-To: <1289603876-28542-1-git-send-email-sensille@gmx.net>

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

      reply	other threads:[~2010-11-12 21:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-12 23:17 [PATCH] 'unused' calculated with wrong sign Arne Jansen
2010-11-12 21:53 ` Josef Bacik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101112215312.GA2657@localhost.localdomain \
    --to=josef@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sensille@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.