From 92b63f5bf0774eab2e62b86f85bb4efb915edef1 Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Fri, 15 Sep 2023 08:51:51 -0400 Subject: bcachefs: refactor pin put helpers We have a couple journal pin put helpers to handle cases where the journal lock is already held or not. Refactor the helpers to lock and reclaim from the highest level and open code the reclaim from the one caller of the internal variant. The latter call will be moved into the journal buf release helper in a later patch. Signed-off-by: Brian Foster Signed-off-by: Kent Overstreet --- fs/bcachefs/journal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/bcachefs/journal.c') diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index ad80618d1740..210a2b90bb50 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -204,7 +204,8 @@ static void __journal_entry_close(struct journal *j, unsigned closed_val) buf->data->last_seq = cpu_to_le64(buf->last_seq); BUG_ON(buf->last_seq > le64_to_cpu(buf->data->seq)); - __bch2_journal_pin_put(j, le64_to_cpu(buf->data->seq)); + if (__bch2_journal_pin_put(j, le64_to_cpu(buf->data->seq))) + bch2_journal_reclaim_fast(j); cancel_delayed_work(&j->write_work); -- cgit v1.2.3