]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs: Flush fsck errors when looping in btree gc
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 7 Sep 2019 16:42:27 +0000 (12:42 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:26 +0000 (17:08 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_gc.c
fs/bcachefs/error.c
fs/bcachefs/recovery.c

index c4a7ff5f8a089d925da0d3b4c874bf55f06bb12d..03a3d24d7451830ce222edfad48a89e1d32f4cc6 100644 (file)
@@ -764,6 +764,8 @@ out:
                        percpu_down_write(&c->mark_lock);
                        bch2_gc_free(c);
                        percpu_up_write(&c->mark_lock);
+                       /* flush fsck errors, reset counters */
+                       bch2_flush_fsck_errs(c);
 
                        goto again;
                }
index 1aaff44e18cf0047f8a677852990c165b003a7d4..304ff92500be917022bad5e70e6e4c2a1458d8d4 100644 (file)
@@ -4,6 +4,8 @@
 #include "io.h"
 #include "super.h"
 
+#define FSCK_ERR_RATELIMIT_NR  10
+
 bool bch2_inconsistent_error(struct bch_fs *c)
 {
        set_bit(BCH_FS_ERROR, &c->flags);
@@ -97,8 +99,8 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
 found:
        list_move(&s->list, &c->fsck_errors);
        s->nr++;
-       suppressing     = s->nr == 10;
-       print           = s->nr <= 10;
+       suppressing     = s->nr == FSCK_ERR_RATELIMIT_NR;
+       print           = s->nr <= FSCK_ERR_RATELIMIT_NR;
        buf             = s->buf;
 print:
        va_start(args, fmt);
@@ -152,10 +154,9 @@ void bch2_flush_fsck_errs(struct bch_fs *c)
        struct fsck_err_state *s, *n;
 
        mutex_lock(&c->fsck_error_lock);
-       set_bit(BCH_FS_FSCK_DONE, &c->flags);
 
        list_for_each_entry_safe(s, n, &c->fsck_errors, list) {
-               if (s->nr > 10)
+               if (s->nr > FSCK_ERR_RATELIMIT_NR)
                        bch_err(c, "Saw %llu errors like:\n    %s", s->nr, s->buf);
 
                list_del(&s->list);
index c9558ccb9a262001f3c0118c7fecdccbf7c5d619..5be34231a0c363ed0f21c0991c656d2cc2f6cac8 100644 (file)
@@ -936,7 +936,9 @@ out:
        ret = 0;
 err:
 fsck_err:
+       set_bit(BCH_FS_FSCK_DONE, &c->flags);
        bch2_flush_fsck_errs(c);
+
        journal_keys_free(&journal_keys);
        journal_entries_free(&journal_entries);
        kfree(clean);