From: Nikolay Borisov <nborisov@suse.com>
To: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/3] btrfs: switch extent_buffer write_locks from atomic to int
Date: Fri, 31 May 2019 12:20:41 +0300 [thread overview]
Message-ID: <0e3a01be-b02d-aca3-7a8d-04c86f0dde46@suse.com> (raw)
In-Reply-To: <6665a7f5b02d97bde4a1cadb2478bb6ba1a01cd0.1559233731.git.dsterba@suse.com>
On 30.05.19 г. 19:31 ч., David Sterba wrote:
> The write_locks is either 0 or 1 and always updated under the lock,
> so we don't need the atomic_t semantics.
>
> Signed-off-by: David Sterba <dsterba@suse.com>
Generally looks good, though my remark for patch2 remains.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/extent_io.c | 2 +-
> fs/btrfs/extent_io.h | 2 +-
> fs/btrfs/locking.c | 6 +++---
> fs/btrfs/print-tree.c | 2 +-
> 4 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 71ee9e976307..6d75d4dcf473 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -4845,7 +4845,7 @@ __alloc_extent_buffer(struct btrfs_fs_info *fs_info, u64 start,
> eb->spinning_writers = 0;
> atomic_set(&eb->spinning_readers, 0);
> atomic_set(&eb->read_locks, 0);
> - atomic_set(&eb->write_locks, 0);
> + eb->write_locks = 0;
> #endif
>
> return eb;
> diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> index 5616b96c365d..844e595cde5b 100644
> --- a/fs/btrfs/extent_io.h
> +++ b/fs/btrfs/extent_io.h
> @@ -190,7 +190,7 @@ struct extent_buffer {
> int spinning_writers;
> atomic_t spinning_readers;
> atomic_t read_locks;
> - atomic_t write_locks;
> + int write_locks;
> struct list_head leak_list;
> #endif
> };
> diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
> index 270667627977..98fccce4208c 100644
> --- a/fs/btrfs/locking.c
> +++ b/fs/btrfs/locking.c
> @@ -58,17 +58,17 @@ static void btrfs_assert_tree_read_locked(struct extent_buffer *eb)
>
> static void btrfs_assert_tree_write_locks_get(struct extent_buffer *eb)
> {
> - atomic_inc(&eb->write_locks);
> + eb->write_locks++;
> }
>
> static void btrfs_assert_tree_write_locks_put(struct extent_buffer *eb)
> {
> - atomic_dec(&eb->write_locks);
> + eb->write_locks--;
> }
>
> void btrfs_assert_tree_locked(struct extent_buffer *eb)
> {
> - BUG_ON(!atomic_read(&eb->write_locks));
> + BUG_ON(!eb->write_locks);
> }
>
> #else
> diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
> index c5cc435ed39a..9cb50577d982 100644
> --- a/fs/btrfs/print-tree.c
> +++ b/fs/btrfs/print-tree.c
> @@ -153,7 +153,7 @@ static void print_eb_refs_lock(struct extent_buffer *eb)
> #ifdef CONFIG_BTRFS_DEBUG
> btrfs_info(eb->fs_info,
> "refs %u lock (w:%d r:%d bw:%d br:%d sw:%d sr:%d) lock_owner %u current %u",
> - atomic_read(&eb->refs), atomic_read(&eb->write_locks),
> + atomic_read(&eb->refs), eb->write_locks,
> atomic_read(&eb->read_locks),
> eb->blocking_writers,
> atomic_read(&eb->blocking_readers),
>
next prev parent reply other threads:[~2019-05-31 9:20 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
2019-05-30 16:31 ` [PATCH 3/3] btrfs: switch extent_buffer write_locks " David Sterba
2019-05-31 9:20 ` Nikolay Borisov [this message]
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=0e3a01be-b02d-aca3-7a8d-04c86f0dde46@suse.com \
--to=nborisov@suse.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/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