From 1676a398d37bffa29824f132a29f2836282940f3 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 14 Nov 2020 13:12:50 -0500 Subject: [PATCH] bcachefs: Delete dead journalling code Usage of the journal has gotten somewhat simpler over time - neat. Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- fs/bcachefs/journal.c | 112 ------------------------------------------ fs/bcachefs/journal.h | 5 -- fs/bcachefs/sysfs.c | 2 +- 3 files changed, 1 insertion(+), 118 deletions(-) diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index 1f7f3b96bd877..f57ab38847617 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -502,74 +502,6 @@ out: /* journal flushing: */ -u64 bch2_journal_last_unwritten_seq(struct journal *j) -{ - u64 seq; - - spin_lock(&j->lock); - seq = journal_cur_seq(j); - if (j->reservations.prev_buf_unwritten) - seq--; - spin_unlock(&j->lock); - - return seq; -} - -/** - * bch2_journal_open_seq_async - try to open a new journal entry if @seq isn't - * open yet, or wait if we cannot - * - * used by the btree interior update machinery, when it needs to write a new - * btree root - every journal entry contains the roots of all the btrees, so it - * doesn't need to bother with getting a journal reservation - */ -int bch2_journal_open_seq_async(struct journal *j, u64 seq, struct closure *cl) -{ - struct bch_fs *c = container_of(j, struct bch_fs, journal); - int ret; - - spin_lock(&j->lock); - - /* - * Can't try to open more than one sequence number ahead: - */ - BUG_ON(journal_cur_seq(j) < seq && !journal_entry_is_open(j)); - - if (journal_cur_seq(j) > seq || - journal_entry_is_open(j)) { - spin_unlock(&j->lock); - return 0; - } - - if (journal_cur_seq(j) < seq && - !__journal_entry_close(j)) { - /* haven't finished writing out the previous one: */ - trace_journal_entry_full(c); - ret = -EAGAIN; - } else { - BUG_ON(journal_cur_seq(j) != seq); - - ret = journal_entry_open(j); - } - - if ((ret == -EAGAIN || ret == -ENOSPC) && - !j->res_get_blocked_start) - j->res_get_blocked_start = local_clock() ?: 1; - - if (ret == -EAGAIN || ret == -ENOSPC) - closure_wait(&j->async_wait, cl); - - spin_unlock(&j->lock); - - if (ret == -ENOSPC) { - trace_journal_full(c); - bch2_journal_reclaim_work(&j->reclaim_work.work); - ret = -EAGAIN; - } - - return ret; -} - static int journal_seq_error(struct journal *j, u64 seq) { union journal_res_state state = READ_ONCE(j->reservations); @@ -601,35 +533,6 @@ journal_seq_to_buf(struct journal *j, u64 seq) return NULL; } -/** - * bch2_journal_wait_on_seq - wait for a journal entry to be written - * - * does _not_ cause @seq to be written immediately - if there is no other - * activity to cause the relevant journal entry to be filled up or flushed it - * can wait for an arbitrary amount of time (up to @j->write_delay_ms, which is - * configurable). - */ -void bch2_journal_wait_on_seq(struct journal *j, u64 seq, - struct closure *parent) -{ - struct journal_buf *buf; - - spin_lock(&j->lock); - - if ((buf = journal_seq_to_buf(j, seq))) { - if (!closure_wait(&buf->wait, parent)) - BUG(); - - if (seq == journal_cur_seq(j)) { - smp_mb(); - if (bch2_journal_error(j)) - closure_wake_up(&buf->wait); - } - } - - spin_unlock(&j->lock); -} - /** * bch2_journal_flush_seq_async - wait for a journal entry to be written * @@ -679,21 +582,6 @@ int bch2_journal_flush_seq(struct journal *j, u64 seq) return ret ?: ret2 < 0 ? ret2 : 0; } -/** - * bch2_journal_meta_async - force a journal entry to be written - */ -void bch2_journal_meta_async(struct journal *j, struct closure *parent) -{ - struct journal_res res; - - memset(&res, 0, sizeof(res)); - - bch2_journal_res_get(j, &res, jset_u64s(0), 0); - bch2_journal_res_put(j, &res); - - bch2_journal_flush_seq_async(j, res.seq, parent); -} - int bch2_journal_meta(struct journal *j) { struct journal_res res; diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h index b8e74c483a239..8931ff3627a82 100644 --- a/fs/bcachefs/journal.h +++ b/fs/bcachefs/journal.h @@ -466,13 +466,8 @@ void bch2_journal_entry_res_resize(struct journal *, struct journal_entry_res *, unsigned); -u64 bch2_journal_last_unwritten_seq(struct journal *); -int bch2_journal_open_seq_async(struct journal *, u64, struct closure *); - -void bch2_journal_wait_on_seq(struct journal *, u64, struct closure *); void bch2_journal_flush_seq_async(struct journal *, u64, struct closure *); void bch2_journal_flush_async(struct journal *, struct closure *); -void bch2_journal_meta_async(struct journal *, struct closure *); int bch2_journal_flush_seq(struct journal *, u64); int bch2_journal_flush(struct journal *); diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 598ad6bdd61b5..89287bfe31a78 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -458,7 +458,7 @@ STORE(bch2_fs) /* Debugging: */ if (attr == &sysfs_trigger_journal_flush) - bch2_journal_meta_async(&c->journal, NULL); + bch2_journal_meta(&c->journal); if (attr == &sysfs_trigger_btree_coalesce) bch2_coalesce(c); -- 2.30.2