bcachefs: Revert "Ensure journal doesn't get stuck in nochanges mode"
authorKent Overstreet <kent.overstreet@gmail.com>
Wed, 23 Feb 2022 11:56:35 +0000 (06:56 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:25 +0000 (17:09 -0400)
This patch was originally to work around the journal geting stuck in
nochanges mode - but that was just a hack, we needed to fix the actual
bug. It should be fixed now, so revert it.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/journal.h
fs/bcachefs/journal_io.c
fs/bcachefs/journal_reclaim.c
fs/bcachefs/journal_types.h
fs/bcachefs/super.c

index 9d4c6d86d5c1f9164d1bf4c01e70c77707306fd5..5d263a5b8685c7edabc89ed8edb2385ba5f4e460 100644 (file)
@@ -431,7 +431,6 @@ static inline int bch2_journal_preres_get_fast(struct journal *j,
                ret = 0;
 
                if ((flags & JOURNAL_RES_GET_RESERVED) ||
-                   test_bit(JOURNAL_NOCHANGES, &j->flags) ||
                    new.reserved + d < new.remaining) {
                        new.reserved += d;
                        ret = 1;
index 43a60f5c23b308af3d954f22fe0a289813c1f491..b8fcc801a6667ef776c72b7f8569cbbd7321b692 100644 (file)
@@ -1616,7 +1616,7 @@ retry_alloc:
 
        w->devs_written = bch2_bkey_devs(bkey_i_to_s_c(&w->key));
 
-       if (test_bit(JOURNAL_NOCHANGES, &j->flags))
+       if (c->opts.nochanges)
                goto no_io;
 
        for_each_rw_member(ca, c, i)
index 84cc952a7ac56a5db289627c43ab53e7072bb06e..c15b18831512571473e834fbf311e1b95b213e3a 100644 (file)
@@ -34,10 +34,8 @@ unsigned bch2_journal_dev_buckets_available(struct journal *j,
                                            struct journal_device *ja,
                                            enum journal_space_from from)
 {
-       unsigned available = !test_bit(JOURNAL_NOCHANGES, &j->flags)
-               ? ((journal_space_from(ja, from) -
-                   ja->cur_idx - 1 + ja->nr) % ja->nr)
-               : ja->nr;
+       unsigned available = (journal_space_from(ja, from) -
+                             ja->cur_idx - 1 + ja->nr) % ja->nr;
 
        /*
         * Don't use the last bucket unless writing the new last_seq
index 73e7fbc4f109221c368f5956bd4a833f54a7d0bf..9facd3f128bb292b697e94219862eb5886c044e6 100644 (file)
@@ -151,7 +151,6 @@ enum {
        JOURNAL_NEED_WRITE,
        JOURNAL_MAY_GET_UNRESERVED,
        JOURNAL_MAY_SKIP_FLUSH,
-       JOURNAL_NOCHANGES,
 };
 
 /* Embedded in struct bch_fs */
index 6a32b9a5dc0eded929ef76cba3330d9b1e4ea3f1..d9b69c4244d5b0ba9e6dd716cc7e88b95da6d8d8 100644 (file)
@@ -835,9 +835,6 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
        if (ret)
                goto err;
 
-       if (c->opts.nochanges)
-               set_bit(JOURNAL_NOCHANGES, &c->journal.flags);
-
        mi = bch2_sb_get_members(c->disk_sb.sb);
        for (i = 0; i < c->sb.nr_devices; i++)
                if (bch2_dev_exists(c->disk_sb.sb, mi, i) &&