summaryrefslogtreecommitdiff
path: root/fs/bcachefs/journal_reclaim.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-12-01 19:48:08 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:48 +0300
commit231db03c571ba3065a32999f4f76a5482c6557e7 (patch)
tree65a538318f58cb35d6f9a3ecc9f846887f43d6d5 /fs/bcachefs/journal_reclaim.c
parent34c1cd6a59bf1a72bb1b672df35f9d819c81bfde (diff)
downloadlinux-231db03c571ba3065a32999f4f76a5482c6557e7.tar.xz
bcachefs: Journal pin refactoring
This deletes some duplicated code. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_reclaim.c')
-rw-r--r--fs/bcachefs/journal_reclaim.c64
1 files changed, 7 insertions, 57 deletions
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c
index c20f6de34730..1dabad618870 100644
--- a/fs/bcachefs/journal_reclaim.c
+++ b/fs/bcachefs/journal_reclaim.c
@@ -320,11 +320,14 @@ void bch2_journal_pin_drop(struct journal *j,
spin_unlock(&j->lock);
}
-static void bch2_journal_pin_add_locked(struct journal *j, u64 seq,
- struct journal_entry_pin *pin,
- journal_pin_flush_fn flush_fn)
+void bch2_journal_pin_set(struct journal *j, u64 seq,
+ struct journal_entry_pin *pin,
+ journal_pin_flush_fn flush_fn)
{
- struct journal_entry_pin_list *pin_list = journal_seq_pin(j, seq);
+ struct journal_entry_pin_list *pin_list;
+
+ spin_lock(&j->lock);
+ pin_list = journal_seq_pin(j, seq);
__journal_pin_drop(j, pin);
@@ -335,45 +338,6 @@ static void bch2_journal_pin_add_locked(struct journal *j, u64 seq,
pin->flush = flush_fn;
list_add(&pin->list, flush_fn ? &pin_list->list : &pin_list->flushed);
-}
-
-void __bch2_journal_pin_add(struct journal *j, u64 seq,
- struct journal_entry_pin *pin,
- journal_pin_flush_fn flush_fn)
-{
- spin_lock(&j->lock);
- bch2_journal_pin_add_locked(j, seq, pin, flush_fn);
- spin_unlock(&j->lock);
-
- /*
- * If the journal is currently full, we might want to call flush_fn
- * immediately:
- */
- journal_wake(j);
-}
-
-void bch2_journal_pin_update(struct journal *j, u64 seq,
- struct journal_entry_pin *pin,
- journal_pin_flush_fn flush_fn)
-{
- if (journal_pin_active(pin) && pin->seq < seq)
- return;
-
- spin_lock(&j->lock);
-
- if (pin->seq != seq) {
- bch2_journal_pin_add_locked(j, seq, pin, flush_fn);
- } else {
- struct journal_entry_pin_list *pin_list =
- journal_seq_pin(j, seq);
-
- /*
- * If the pin is already pinning the right sequence number, it
- * still might've already been flushed:
- */
- list_move(&pin->list, &pin_list->list);
- }
-
spin_unlock(&j->lock);
/*
@@ -383,20 +347,6 @@ void bch2_journal_pin_update(struct journal *j, u64 seq,
journal_wake(j);
}
-void bch2_journal_pin_copy(struct journal *j,
- struct journal_entry_pin *dst,
- struct journal_entry_pin *src,
- journal_pin_flush_fn flush_fn)
-{
- spin_lock(&j->lock);
-
- if (journal_pin_active(src) &&
- (!journal_pin_active(dst) || src->seq < dst->seq))
- bch2_journal_pin_add_locked(j, src->seq, dst, flush_fn);
-
- spin_unlock(&j->lock);
-}
-
/**
* bch2_journal_pin_flush: ensure journal pin callback is no longer running
*/