mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
bcachefs: Improve bkey_cached_lock_for_evict()
We don't need a write lock to check if a key is dirty. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
c82ed3047b
commit
7af365eb36
1 changed files with 2 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue