Commit 5bbe4bf9 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Add copygc wait to sysfs

Currently debugging an issue with copygc not running when it's supposed
to, and this is an obvious first step.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent cb66fc5f
...@@ -773,6 +773,7 @@ mempool_t bio_bounce_pages; ...@@ -773,6 +773,7 @@ mempool_t bio_bounce_pages;
copygc_heap copygc_heap; copygc_heap copygc_heap;
struct bch_pd_controller copygc_pd; struct bch_pd_controller copygc_pd;
struct write_point copygc_write_point; struct write_point copygc_write_point;
s64 copygc_wait;
/* STRIPES: */ /* STRIPES: */
GENRADIX(struct stripe) stripes[2]; GENRADIX(struct stripe) stripes[2];
......
...@@ -311,11 +311,14 @@ static int bch2_copygc_thread(void *arg) ...@@ -311,11 +311,14 @@ static int bch2_copygc_thread(void *arg)
wait = bch2_copygc_wait_amount(c); wait = bch2_copygc_wait_amount(c);
if (wait > clock->max_slop) { if (wait > clock->max_slop) {
c->copygc_wait = last + wait;
bch2_kthread_io_clock_wait(clock, last + wait, bch2_kthread_io_clock_wait(clock, last + wait,
MAX_SCHEDULE_TIMEOUT); MAX_SCHEDULE_TIMEOUT);
continue; continue;
} }
c->copygc_wait = 0;
if (bch2_copygc(c)) if (bch2_copygc(c))
break; break;
} }
......
...@@ -188,6 +188,7 @@ rw_attribute(cache_replacement_policy); ...@@ -188,6 +188,7 @@ rw_attribute(cache_replacement_policy);
rw_attribute(label); rw_attribute(label);
rw_attribute(copy_gc_enabled); rw_attribute(copy_gc_enabled);
read_attribute(copy_gc_wait);
sysfs_pd_controller_attribute(copy_gc); sysfs_pd_controller_attribute(copy_gc);
rw_attribute(rebalance_enabled); rw_attribute(rebalance_enabled);
...@@ -336,6 +337,9 @@ SHOW(bch2_fs) ...@@ -336,6 +337,9 @@ SHOW(bch2_fs)
sysfs_printf(rebalance_enabled, "%i", c->rebalance.enabled); sysfs_printf(rebalance_enabled, "%i", c->rebalance.enabled);
sysfs_pd_controller_show(rebalance, &c->rebalance.pd); /* XXX */ sysfs_pd_controller_show(rebalance, &c->rebalance.pd); /* XXX */
sysfs_pd_controller_show(copy_gc, &c->copygc_pd); sysfs_pd_controller_show(copy_gc, &c->copygc_pd);
sysfs_hprint(copy_gc_wait,
max(0LL, c->copygc_wait -
atomic64_read(&c->io_clock[WRITE].now)) << 9);
if (attr == &sysfs_rebalance_work) { if (attr == &sysfs_rebalance_work) {
bch2_rebalance_work_to_text(&out, c); bch2_rebalance_work_to_text(&out, c);
...@@ -563,6 +567,7 @@ struct attribute *bch2_fs_internal_files[] = { ...@@ -563,6 +567,7 @@ struct attribute *bch2_fs_internal_files[] = {
&sysfs_prune_cache, &sysfs_prune_cache,
&sysfs_copy_gc_enabled, &sysfs_copy_gc_enabled,
&sysfs_copy_gc_wait,
&sysfs_rebalance_enabled, &sysfs_rebalance_enabled,
&sysfs_rebalance_work, &sysfs_rebalance_work,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment