mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
bcachefs: bch2_mark_btree_validate_failure()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
@@ -56,6 +56,14 @@ void bch2_io_failures_to_text(struct printbuf *out,
|
||||
for (struct bch_dev_io_failures *f = failed->devs;
|
||||
f < failed->devs + failed->nr;
|
||||
f++) {
|
||||
unsigned errflags =
|
||||
((!!f->failed_io) << 0) |
|
||||
((!!f->failed_csum_nr) << 1) |
|
||||
((!!f->failed_ec) << 2);
|
||||
|
||||
if (!errflags)
|
||||
continue;
|
||||
|
||||
bch2_printbuf_make_room(out, 1024);
|
||||
rcu_read_lock();
|
||||
out->atomic++;
|
||||
@@ -69,11 +77,6 @@ void bch2_io_failures_to_text(struct printbuf *out,
|
||||
|
||||
prt_char(out, ' ');
|
||||
|
||||
unsigned errflags =
|
||||
((!!f->failed_io) << 0) |
|
||||
((!!f->failed_csum_nr) << 1) |
|
||||
((!!f->failed_ec) << 2);
|
||||
|
||||
if (is_power_of_2(errflags)) {
|
||||
prt_bitflags(out, error_types, errflags);
|
||||
prt_str(out, " error");
|
||||
@@ -119,6 +122,22 @@ void bch2_mark_io_failure(struct bch_io_failures *failed,
|
||||
f->failed_csum_nr++;
|
||||
}
|
||||
|
||||
void bch2_mark_btree_validate_failure(struct bch_io_failures *failed,
|
||||
unsigned dev)
|
||||
{
|
||||
struct bch_dev_io_failures *f = bch2_dev_io_failures(failed, dev);
|
||||
|
||||
if (!f) {
|
||||
BUG_ON(failed->nr >= ARRAY_SIZE(failed->devs));
|
||||
|
||||
f = &failed->devs[failed->nr++];
|
||||
memset(f, 0, sizeof(*f));
|
||||
f->dev = dev;
|
||||
}
|
||||
|
||||
f->failed_btree_validate = true;
|
||||
}
|
||||
|
||||
static inline u64 dev_latency(struct bch_dev *ca)
|
||||
{
|
||||
return ca ? atomic64_read(&ca->cur_latency[READ]) : S64_MAX;
|
||||
@@ -219,6 +238,7 @@ int bch2_bkey_pick_read_device(struct bch_fs *c, struct bkey_s_c k,
|
||||
|
||||
if (ca && ca->mi.state != BCH_MEMBER_STATE_failed) {
|
||||
have_io_errors |= f->failed_io;
|
||||
have_io_errors |= f->failed_btree_validate;
|
||||
have_io_errors |= f->failed_ec;
|
||||
}
|
||||
have_csum_errors |= !!f->failed_csum_nr;
|
||||
@@ -226,6 +246,7 @@ int bch2_bkey_pick_read_device(struct bch_fs *c, struct bkey_s_c k,
|
||||
if (p.has_ec && (f->failed_io || f->failed_csum_nr))
|
||||
p.do_ec_reconstruct = true;
|
||||
else if (f->failed_io ||
|
||||
f->failed_btree_validate ||
|
||||
f->failed_csum_nr > c->opts.checksum_err_retry_nr)
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -398,6 +398,7 @@ struct bch_dev_io_failures *bch2_dev_io_failures(struct bch_io_failures *,
|
||||
unsigned);
|
||||
void bch2_mark_io_failure(struct bch_io_failures *,
|
||||
struct extent_ptr_decoded *, bool);
|
||||
void bch2_mark_btree_validate_failure(struct bch_io_failures *, unsigned);
|
||||
int bch2_bkey_pick_read_device(struct bch_fs *, struct bkey_s_c,
|
||||
struct bch_io_failures *,
|
||||
struct extent_ptr_decoded *, int);
|
||||
|
||||
@@ -34,6 +34,7 @@ struct bch_io_failures {
|
||||
u8 dev;
|
||||
unsigned failed_csum_nr:6,
|
||||
failed_io:1,
|
||||
failed_btree_validate:1,
|
||||
failed_ec:1;
|
||||
} devs[BCH_REPLICAS_MAX + 1];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user