linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 9/9] btrfs: switch extent_buffer::lock_nested to bool
Date: Wed, 13 Mar 2019 16:47:19 +0100	[thread overview]
Message-ID: <2ae7b54e7fdafaf752aaffeec1487e0dcac3c824.1552489554.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1552489554.git.dsterba@suse.com>

The member is tracking simple status of the lock, we can use bool for
that and make some room for further space reduction in the structure.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/extent_io.c | 2 +-
 fs/btrfs/extent_io.h | 2 +-
 fs/btrfs/locking.c   | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index a9ae476c7502..388466b8cde9 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4670,7 +4670,7 @@ __alloc_extent_buffer(struct btrfs_fs_info *fs_info, u64 start,
 	rwlock_init(&eb->lock);
 	atomic_set(&eb->blocking_readers, 0);
 	atomic_set(&eb->blocking_writers, 0);
-	eb->lock_nested = 0;
+	eb->lock_nested = false;
 	init_waitqueue_head(&eb->write_lock_wq);
 	init_waitqueue_head(&eb->read_lock_wq);
 
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index b2640db8821e..0f2aa7e5adc1 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -148,7 +148,7 @@ struct extent_buffer {
 
 	atomic_t blocking_writers;
 	atomic_t blocking_readers;
-	short lock_nested;
+	bool lock_nested;
 	/* >= 0 if eb belongs to a log tree, -1 otherwise */
 	short log_index;
 
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index e595e6541770..1b65b7ba9df8 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -172,7 +172,7 @@ void btrfs_tree_read_lock(struct extent_buffer *eb)
 		 * called on a partly (write-)locked tree.
 		 */
 		BUG_ON(eb->lock_nested);
-		eb->lock_nested = 1;
+		eb->lock_nested = true;
 		read_unlock(&eb->lock);
 		return;
 	}
@@ -261,7 +261,7 @@ void btrfs_tree_read_unlock(struct extent_buffer *eb)
 	 * field only matters to the lock owner.
 	 */
 	if (eb->lock_nested && current->pid == eb->lock_owner) {
-		eb->lock_nested = 0;
+		eb->lock_nested = false;
 		return;
 	}
 	btrfs_assert_tree_read_locked(eb);
@@ -282,7 +282,7 @@ void btrfs_tree_read_unlock_blocking(struct extent_buffer *eb)
 	 * field only matters to the lock owner.
 	 */
 	if (eb->lock_nested && current->pid == eb->lock_owner) {
-		eb->lock_nested = 0;
+		eb->lock_nested = false;
 		return;
 	}
 	btrfs_assert_tree_read_locked(eb);
-- 
2.20.1


  parent reply	other threads:[~2019-03-13 15:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 15:46 [PATCH 0/9] Extent buffer locking cleanups David Sterba
2019-03-13 15:47 ` [PATCH 1/9] btrfs: add assertion helpers for spinning writers David Sterba
2019-03-13 15:47 ` [PATCH 2/9] btrfs: use " David Sterba
2019-03-13 15:47 ` [PATCH 3/9] btrfs: add assertion helpers for spinning readers David Sterba
2019-03-13 15:47 ` [PATCH 4/9] btrfs: use " David Sterba
2019-03-15 16:18   ` kbuild test robot
2019-03-15 21:43     ` David Sterba
2019-03-15 17:13   ` kbuild test robot
2019-03-13 15:47 ` [PATCH 5/9] btrfs: add assertion helpers for extent buffer read lock counters David Sterba
2019-03-13 15:47 ` [PATCH 6/9] btrfs: use " David Sterba
2019-03-13 15:47 ` [PATCH 7/9] btrfs: add assertion helpers for extent buffer write " David Sterba
2019-03-13 15:47 ` [PATCH 8/9] btrfs: use " David Sterba
2019-03-13 15:47 ` David Sterba [this message]
2019-03-14  7:26 ` [PATCH 0/9] Extent buffer locking cleanups Nikolay Borisov
2019-03-18 19:29   ` David Sterba
2019-03-18 19:43     ` Nikolay Borisov
2019-03-14 13:15 ` Johannes Thumshirn

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=2ae7b54e7fdafaf752aaffeec1487e0dcac3c824.1552489554.git.dsterba@suse.com \
    --to=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;
as well as URLs for NNTP newsgroup(s).