Commit 4f70176c authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Kill unnecessary wakeups in journal reclaim

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 0be5b38b
......@@ -394,8 +394,6 @@ void bch2_journal_pin_copy(struct journal *j,
struct journal_entry_pin *src,
journal_pin_flush_fn flush_fn)
{
bool reclaim;
spin_lock(&j->lock);
u64 seq = READ_ONCE(src->seq);
......@@ -411,44 +409,44 @@ void bch2_journal_pin_copy(struct journal *j,
return;
}
reclaim = __journal_pin_drop(j, dst);
bool reclaim = __journal_pin_drop(j, dst);
bch2_journal_pin_set_locked(j, seq, dst, flush_fn, journal_pin_type(flush_fn));
if (reclaim)
bch2_journal_reclaim_fast(j);
spin_unlock(&j->lock);
/*
* If the journal is currently full, we might want to call flush_fn
* immediately:
*/
journal_wake(j);
if (seq == journal_last_seq(j))
journal_wake(j);
spin_unlock(&j->lock);
}
void bch2_journal_pin_set(struct journal *j, u64 seq,
struct journal_entry_pin *pin,
journal_pin_flush_fn flush_fn)
{
bool reclaim;
spin_lock(&j->lock);
BUG_ON(seq < journal_last_seq(j));
reclaim = __journal_pin_drop(j, pin);
bool reclaim = __journal_pin_drop(j, pin);
bch2_journal_pin_set_locked(j, seq, pin, flush_fn, journal_pin_type(flush_fn));
if (reclaim)
bch2_journal_reclaim_fast(j);
spin_unlock(&j->lock);
/*
* If the journal is currently full, we might want to call flush_fn
* immediately:
*/
journal_wake(j);
if (seq == journal_last_seq(j))
journal_wake(j);
spin_unlock(&j->lock);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment