All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: Zach Brown <zab@redhat.com>
Cc: Josef Bacik <jbacik@fusionio.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: use a percpu to keep track of possibly pinned bytes
Date: Thu, 20 Jun 2013 13:28:47 -0400	[thread overview]
Message-ID: <20130620172847.GD4288@localhost.localdomain> (raw)
In-Reply-To: <20130620162615.GB32674@lenny.home.zabbo.net>

On Thu, Jun 20, 2013 at 09:26:15AM -0700, Zach Brown wrote:
> > @@ -3380,6 +3382,10 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags,
> >  	if (!found)
> >  		return -ENOMEM;
> >  
> > +	ret = percpu_counter_init(&found->total_bytes_pinned, 0);
> > +	if (ret)
> > +		return ret;
> > +
> 
> Leaks *found if percpu_counter_init() fails.
> 

Right thanks.

> > -	if (space_info->bytes_pinned + delayed_rsv->size < bytes) {
> > +	bytes_pinned = percpu_counter_sum(&space_info->total_bytes_pinned);
> > +	if (bytes_pinned + delayed_rsv->size < bytes) {
> 
> This stood out as being different from the rest of the comparisons.
> 
> Why manually sum the counters instead of letting _compare() optimize it
> away if it can?  _compare(&, bytes - delayed_rsv->size)?
> 

Cause negative numbers bother me?

Josef

      reply	other threads:[~2013-06-20 17:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19 19:37 [PATCH] Btrfs: use a percpu to keep track of possibly pinned bytes Josef Bacik
2013-06-20 16:26 ` Zach Brown
2013-06-20 17:28   ` 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=20130620172847.GD4288@localhost.localdomain \
    --to=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zab@redhat.com \
    /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.