Update bcachefs sources to c76f7e91e8 bcachefs: Fix btree node read retries

This commit is contained in:
Kent Overstreet 2022-06-14 01:44:59 -04:00
parent ffbf806d5c
commit 3a0ae34333
6 changed files with 22 additions and 6 deletions

View File

@ -1 +1 @@
3704d0779c7885dd74ab345aa7017a4430231e1a
c76f7e91e8939751ccc96ca2f8f6bfe6dd368d93

View File

@ -1173,11 +1173,16 @@ static void bch2_do_invalidates_work(struct work_struct *work)
s64 nr_to_invalidate =
should_invalidate_buckets(ca, bch2_dev_usage_read(ca));
while (!ret && nr_to_invalidate-- >= 0)
while (nr_to_invalidate-- >= 0) {
ret = __bch2_trans_do(&trans, NULL, NULL,
BTREE_INSERT_USE_RESERVE|
BTREE_INSERT_NOFAIL,
invalidate_one_bucket(&trans, ca));
if (ret)
break;
this_cpu_inc(c->counters[BCH_COUNTER_bucket_invalidate]);
}
}
bch2_trans_exit(&trans);

View File

@ -1322,10 +1322,11 @@ struct bch_sb_field_disk_groups {
/* BCH_SB_FIELD_counters */
#define BCH_PERSISTENT_COUNTERS() \
x(io_read, 0) \
x(io_write, 1) \
x(io_move, 2)
#define BCH_PERSISTENT_COUNTERS() \
x(io_read, 0) \
x(io_write, 1) \
x(io_move, 2) \
x(bucket_invalidate, 3)
enum bch_persistent_counters {
#define x(t, n, ...) BCH_COUNTER_##t,

View File

@ -884,6 +884,8 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
int ret, retry_read = 0, write = READ;
b->version_ondisk = U16_MAX;
/* We might get called multiple times on read retry: */
b->written = 0;
iter = mempool_alloc(&c->fill_iter, GFP_NOIO);
sort_iter_init(iter, b);

View File

@ -385,6 +385,7 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
bch2_recalc_capacity(c);
bch2_do_discards(c);
bch2_do_invalidates(c);
if (!early) {
ret = bch2_fs_read_write_late(c);

View File

@ -155,6 +155,7 @@ do { \
write_attribute(trigger_gc);
write_attribute(trigger_discards);
write_attribute(trigger_invalidates);
write_attribute(prune_cache);
rw_attribute(btree_gc_periodic);
rw_attribute(gc_gens_pos);
@ -513,6 +514,9 @@ STORE(bch2_fs)
if (attr == &sysfs_trigger_discards)
bch2_do_discards(c);
if (attr == &sysfs_trigger_invalidates)
bch2_do_invalidates(c);
#ifdef CONFIG_BCACHEFS_TESTS
if (attr == &sysfs_perf_test) {
char *tmp = kstrdup(buf, GFP_KERNEL), *p = tmp;
@ -622,6 +626,7 @@ struct attribute *bch2_fs_internal_files[] = {
&sysfs_trigger_gc,
&sysfs_trigger_discards,
&sysfs_trigger_invalidates,
&sysfs_prune_cache,
&sysfs_read_realloc_races,
@ -787,6 +792,7 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
"open_buckets_wait\t%s\n"
"open_buckets_btree\t%u\n"
"open_buckets_user\t%u\n"
"buckets_to_invalidate\t%llu\n"
"btree reserve cache\t%u\n",
stats.buckets_ec,
c->freelist_wait.list.first ? "waiting" : "empty",
@ -796,6 +802,7 @@ static void dev_alloc_debug_to_text(struct printbuf *out, struct bch_dev *ca)
c->open_buckets_wait.list.first ? "waiting" : "empty",
nr[BCH_DATA_btree],
nr[BCH_DATA_user],
should_invalidate_buckets(ca, stats),
c->btree_reserve_cache_nr);
}