mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
bcachefs: Flush fsck errors when looping in btree gc
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
5055b50939
commit
89b0511826
3 changed files with 9 additions and 4 deletions
|
@ -764,6 +764,8 @@ int bch2_gc(struct bch_fs *c, struct journal_keys *journal_keys,
|
||||||
percpu_down_write(&c->mark_lock);
|
percpu_down_write(&c->mark_lock);
|
||||||
bch2_gc_free(c);
|
bch2_gc_free(c);
|
||||||
percpu_up_write(&c->mark_lock);
|
percpu_up_write(&c->mark_lock);
|
||||||
|
/* flush fsck errors, reset counters */
|
||||||
|
bch2_flush_fsck_errs(c);
|
||||||
|
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "super.h"
|
#include "super.h"
|
||||||
|
|
||||||
|
#define FSCK_ERR_RATELIMIT_NR 10
|
||||||
|
|
||||||
bool bch2_inconsistent_error(struct bch_fs *c)
|
bool bch2_inconsistent_error(struct bch_fs *c)
|
||||||
{
|
{
|
||||||
set_bit(BCH_FS_ERROR, &c->flags);
|
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:
|
found:
|
||||||
list_move(&s->list, &c->fsck_errors);
|
list_move(&s->list, &c->fsck_errors);
|
||||||
s->nr++;
|
s->nr++;
|
||||||
suppressing = s->nr == 10;
|
suppressing = s->nr == FSCK_ERR_RATELIMIT_NR;
|
||||||
print = s->nr <= 10;
|
print = s->nr <= FSCK_ERR_RATELIMIT_NR;
|
||||||
buf = s->buf;
|
buf = s->buf;
|
||||||
print:
|
print:
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
@ -152,10 +154,9 @@ void bch2_flush_fsck_errs(struct bch_fs *c)
|
||||||
struct fsck_err_state *s, *n;
|
struct fsck_err_state *s, *n;
|
||||||
|
|
||||||
mutex_lock(&c->fsck_error_lock);
|
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) {
|
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);
|
bch_err(c, "Saw %llu errors like:\n %s", s->nr, s->buf);
|
||||||
|
|
||||||
list_del(&s->list);
|
list_del(&s->list);
|
||||||
|
|
|
@ -936,7 +936,9 @@ int bch2_fs_recovery(struct bch_fs *c)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
err:
|
err:
|
||||||
fsck_err:
|
fsck_err:
|
||||||
|
set_bit(BCH_FS_FSCK_DONE, &c->flags);
|
||||||
bch2_flush_fsck_errs(c);
|
bch2_flush_fsck_errs(c);
|
||||||
|
|
||||||
journal_keys_free(&journal_keys);
|
journal_keys_free(&journal_keys);
|
||||||
journal_entries_free(&journal_entries);
|
journal_entries_free(&journal_entries);
|
||||||
kfree(clean);
|
kfree(clean);
|
||||||
|
|
Loading…
Reference in a new issue