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 1/9] btrfs: add assertion helpers for spinning writers
Date: Wed, 13 Mar 2019 16:47:01 +0100	[thread overview]
Message-ID: <060bc258993c6a701383361466b62ad13d9ce7e8.1552489554.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1552489554.git.dsterba@suse.com>

Add helpers for conditional DEBUG build to assert that the extent buffer
spinning_writers constraints are met. Will be used in followup patches.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/locking.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index 82b84e4daad1..13ef1decdea6 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -14,6 +14,30 @@
 
 static void btrfs_assert_tree_read_locked(struct extent_buffer *eb);
 
+#ifdef CONFIG_BTRFS_DEBUG
+static void btrfs_assert_spinning_writers_get(struct extent_buffer *eb)
+{
+	WARN_ON(atomic_read(&eb->spinning_writers));
+	atomic_inc(&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);
+}
+
+static void btrfs_assert_no_spinning_writers(struct extent_buffer *eb)
+{
+	WARN_ON(atomic_read(&eb->spinning_writers));
+}
+
+#else
+static void btrfs_assert_spinning_writers_get(struct extent_buffer *eb) { }
+static void btrfs_assert_spinning_writers_put(struct extent_buffer *eb) { }
+static void btrfs_assert_no_spinning_writers(struct extent_buffer *eb) { }
+#endif
+
 void btrfs_set_lock_blocking_read(struct extent_buffer *eb)
 {
 	/*
-- 
2.20.1


  reply	other threads:[~2019-03-13 15:45 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 ` David Sterba [this message]
2019-03-13 15:47 ` [PATCH 2/9] btrfs: use assertion helpers for spinning writers 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 ` [PATCH 9/9] btrfs: switch extent_buffer::lock_nested to bool David Sterba
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=060bc258993c6a701383361466b62ad13d9ce7e8.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).