public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/3] btrfs: switch extent_buffer spinning_writers from atomic to int
Date: Fri, 31 May 2019 13:28:41 +0200	[thread overview]
Message-ID: <20190531112841.GJ15290@twin.jikos.cz> (raw)
In-Reply-To: <41aca846-afb1-9b83-f442-d791eb929c36@suse.com>

On Fri, May 31, 2019 at 12:19:15PM +0300, Nikolay Borisov wrote:
> >  {
> > -	WARN_ON(atomic_read(&eb->spinning_writers));
> > -	atomic_inc(&eb->spinning_writers);
> > +	WARN_ON(eb->spinning_writers);
> > +	eb->spinning_writers++;
> >  }
> >  
> >  static void btrfs_assert_spinning_writers_put(struct extent_buffer *eb)
> >  {
> > -	WARN_ON(atomic_read(&eb->spinning_writers) != 1);
> > -	atomic_dec(&eb->spinning_writers);
> > +	WARN_ON(eb->spinning_writers != 1);
> > +	eb->spinning_writers--;
> >  }
> >  
> >  static void btrfs_assert_no_spinning_writers(struct extent_buffer *eb)
> >  {
> > -	WARN_ON(atomic_read(&eb->spinning_writers));
> > +	WARN_ON(eb->spinning_writers);
> >  }
> 
> IMO longterm  it will be good if those debug functions contained
> lockdep_assert_held_exclusive/read macros for posterity.

The functions are not public and used only inside implementation of
locks, so the chances of wrong use are low so I don't see much value
adding it.

  reply	other threads:[~2019-05-31 11:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 16:30 [PATCH 0/3] Extent buffer lock cleanups David Sterba
2019-05-30 16:31 ` [PATCH 1/3] btrfs: switch extent_buffer blocking_writers from atomic to int David Sterba
2019-05-31  8:29   ` Nikolay Borisov
2019-05-30 16:31 ` [PATCH 2/3] btrfs: switch extent_buffer spinning_writers " David Sterba
2019-05-31  9:19   ` Nikolay Borisov
2019-05-31 11:28     ` David Sterba [this message]
2019-05-30 16:31 ` [PATCH 3/3] btrfs: switch extent_buffer write_locks " David Sterba
2019-05-31  9:20   ` Nikolay Borisov
2019-06-07 13:31 ` [PATCH 0/3] Extent buffer lock cleanups David Sterba

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=20190531112841.GJ15290@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox