All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: dsterba@suse.cz, Nikolay Borisov <nborisov@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/4] btrfs: Rename EXTENT_BUFFER_DUMMY to EXTENT_BUFFER_PRIVATE
Date: Fri, 29 Jun 2018 15:53:08 +0200	[thread overview]
Message-ID: <20180629135308.GS2287@twin.jikos.cz> (raw)
In-Reply-To: <97349690-b129-1b5b-17c5-4363fe2a879d@gmx.com>

On Fri, Jun 29, 2018 at 09:07:12PM +0800, Qu Wenruo wrote:
> >> @@ -5117,7 +5117,7 @@ void free_extent_buffer(struct extent_buffer *eb)
> >>  
> >>  	spin_lock(&eb->refs_lock);
> >>  	if (atomic_read(&eb->refs) == 2 &&
> >> -	    test_bit(EXTENT_BUFFER_DUMMY, &eb->bflags))
> >> +	    test_bit(EXTENT_BUFFER_PRIVATE, &eb->bflags))
> >>  		atomic_dec(&eb->refs);
> 
> Also discussed in off list mail, this extra atomic_dec for cloned eb
> looks confusing.
> (That also explains why after cloning the eb, we call
> extent_buffer_get() and only frees it once, and still no eb leaking)
> What about just removing such special handling?

The extent_buffer_get can be moved to the cloning function, all callers
increase the reference but the missing dec is indeed confusing. However
I don't think we can remove it completely. We need to keep the eb::refs
at the same level for all eb types (regular, STALE, DUMMY), so we can
use eg. free_extent_buffer.

There may be other way how to clean it that I don't see now, so if you
think you can improve the reference handling, then go for it.

  parent reply	other threads:[~2018-06-29 13:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27 13:38 [PATCH 0/4] Misc cleanups Nikolay Borisov
2018-06-27 13:38 ` [PATCH 1/4] btrfs: Refactor loop in btrfs_release_extent_buffer_page Nikolay Borisov
2018-06-29 12:35   ` David Sterba
2018-07-02 10:03     ` Nikolay Borisov
2018-07-19 15:19       ` David Sterba
2018-06-27 13:38 ` [PATCH 2/4] btrfs: Document locking require via lockdep_assert_held Nikolay Borisov
2018-06-27 13:38 ` [PATCH 3/4] btrfs: Rename EXTENT_BUFFER_DUMMY to EXTENT_BUFFER_PRIVATE Nikolay Borisov
2018-06-29 12:46   ` David Sterba
2018-06-29 13:07     ` Qu Wenruo
2018-06-29 13:42       ` Nikolay Borisov
2018-07-19 15:40         ` David Sterba
2018-06-29 13:53       ` David Sterba [this message]
2018-06-27 13:38 ` [PATCH 4/4] btrfs: Remove unnecessary locking code in qgroup_rescan_leaf Nikolay Borisov
2018-07-02 13:32   ` Nikolay Borisov

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=20180629135308.GS2287@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=quwenruo.btrfs@gmx.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.