projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c82ed30
)
bcachefs: Improve bkey_cached_lock_for_evict()
author
Kent Overstreet
<kent.overstreet@linux.dev>
Sun, 8 Jan 2023 05:05:30 +0000
(
00:05
-0500)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:49 +0000
(17:09 -0400)
We don't need a write lock to check if a key is dirty.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_key_cache.c
patch
|
blob
|
history
diff --git
a/fs/bcachefs/btree_key_cache.c
b/fs/bcachefs/btree_key_cache.c
index 4833cb4c7cf52ca42de00d9917f2ccf8d491a6e8..53b9f0825ec59594305db8f782b7d7fe7e917031 100644
(file)
--- a/
fs/bcachefs/btree_key_cache.c
+++ b/
fs/bcachefs/btree_key_cache.c
@@
-56,13
+56,12
@@
static bool bkey_cached_lock_for_evict(struct bkey_cached *ck)
if (!six_trylock_intent(&ck->c.lock))
return false;
- if (
!six_trylock_write(&ck->c.lock
)) {
+ if (
test_bit(BKEY_CACHED_DIRTY, &ck->flags
)) {
six_unlock_intent(&ck->c.lock);
return false;
}
- if (test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
- six_unlock_write(&ck->c.lock);
+ if (!six_trylock_write(&ck->c.lock)) {
six_unlock_intent(&ck->c.lock);
return false;
}