From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 6/6] btrfs: merge btrfs_set_lock_blocking_rw with it's caller
Date: Wed, 23 Jan 2019 18:38:20 +0100 [thread overview]
Message-ID: <5c85a32651721e9905f41c14dac4c084a9dd2517.1548264220.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1548264220.git.dsterba@suse.com>
The last caller that does not have a fixed value of lock is
btrfs_set_path_blocking, that actually does the same conditional swtich
by the lock type so we can merge the branches together and remove the
helper.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/ctree.c | 13 ++++++++++---
fs/btrfs/locking.h | 12 ------------
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index a482171fd710..1f2917da89ef 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -45,11 +45,18 @@ noinline void btrfs_set_path_blocking(struct btrfs_path *p)
for (i = 0; i < BTRFS_MAX_LEVEL; i++) {
if (!p->nodes[i] || !p->locks[i])
continue;
- btrfs_set_lock_blocking_rw(p->nodes[i], p->locks[i]);
- if (p->locks[i] == BTRFS_READ_LOCK)
+ /*
+ * If we currently have a spinning reader or writer lock this
+ * will bump the count of blocking holders and drop the
+ * spinlock.
+ */
+ if (p->locks[i] == BTRFS_READ_LOCK) {
+ btrfs_set_lock_blocking_read(p->nodes[i]);
p->locks[i] = BTRFS_READ_LOCK_BLOCKING;
- else if (p->locks[i] == BTRFS_WRITE_LOCK)
+ } else if (p->locks[i] == BTRFS_WRITE_LOCK) {
+ btrfs_set_lock_blocking_write(p->nodes[i]);
p->locks[i] = BTRFS_WRITE_LOCK_BLOCKING;
+ }
}
}
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h
index 84ea6ed60047..595014f64830 100644
--- a/fs/btrfs/locking.h
+++ b/fs/btrfs/locking.h
@@ -39,16 +39,4 @@ static inline void btrfs_tree_unlock_rw(struct extent_buffer *eb, int rw)
BUG();
}
-/*
- * If we currently have a spinning reader or writer lock (indicated by the rw
- * flag) this will bump the count of blocking holders and drop the spinlock.
- */
-static inline void btrfs_set_lock_blocking_rw(struct extent_buffer *eb, int rw)
-{
- if (rw == BTRFS_WRITE_LOCK)
- btrfs_set_lock_blocking_write(eb);
- else if (rw == BTRFS_READ_LOCK)
- btrfs_set_lock_blocking_read(eb);
-}
-
#endif
--
2.20.1
next prev parent reply other threads:[~2019-01-23 17:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 17:37 [PATCH 0/6] Extent buffer locking cleanups, part 1 David Sterba
2019-01-23 17:38 ` [PATCH 1/6] btrfs: split btrfs_set_lock_blocking_rw to read and write helpers David Sterba
2019-01-24 9:05 ` Johannes Thumshirn
2019-01-23 17:38 ` [PATCH 2/6] btrfs: split btrfs_clear_lock_blocking_rw " David Sterba
2019-01-24 9:06 ` Johannes Thumshirn
2019-01-23 17:38 ` [PATCH 3/6] btrfs: replace btrfs_set_lock_blocking_rw with appropriate helpers David Sterba
2019-01-24 9:06 ` Johannes Thumshirn
2019-01-23 17:38 ` [PATCH 4/6] btrfs: open code now trivial btrfs_set_lock_blocking David Sterba
2019-01-24 9:07 ` Johannes Thumshirn
2019-01-23 17:38 ` [PATCH 5/6] btrfs: simplify waiting loop in btrfs_tree_lock David Sterba
2019-01-24 9:08 ` Johannes Thumshirn
2019-01-23 17:38 ` David Sterba [this message]
2019-01-24 9:08 ` [PATCH 6/6] btrfs: merge btrfs_set_lock_blocking_rw with it's caller 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=5c85a32651721e9905f41c14dac4c084a9dd2517.1548264220.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).