bcachefs: Delete dead journalling code
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 14 Nov 2020 18:12:50 +0000 (13:12 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:47 +0000 (17:08 -0400)
Usage of the journal has gotten somewhat simpler over time - neat.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal.c
fs/bcachefs/journal.h
fs/bcachefs/sysfs.c

index 1f7f3b96bd87782a642d64e5d735edde1cb68167..f57ab388476172446e0684b43bd68b48c553c2fc 100644 (file)
@@ -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;
index b8e74c483a239f39bd760c2acb3e3a9b693430fe..8931ff3627a821cd9fa947977f67103f94b86ae3 100644 (file)
@@ -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 *);
index 598ad6bdd61b5c6dc7c80287ec574e1998589655..89287bfe31a78a1644ad0abb5bff33cb44d48c57 100644 (file)
@@ -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);