diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-13 14:45:55 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:54 -0400 |
commit | 5bbe4bf95bdd18500c5de52e5d38a91fbb5f6234 (patch) | |
tree | 31c270a338a7ad298ec5029342e76ba46919e15f | |
parent | cb66fc5fe4cc806d60d8884cb82b67c357b49640 (diff) | |
download | lwn-5bbe4bf95bdd18500c5de52e5d38a91fbb5f6234.tar.gz lwn-5bbe4bf95bdd18500c5de52e5d38a91fbb5f6234.zip |
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: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/bcachefs.h | 1 | ||||
-rw-r--r-- | fs/bcachefs/movinggc.c | 3 | ||||
-rw-r--r-- | fs/bcachefs/sysfs.c | 5 |
3 files changed, 9 insertions, 0 deletions
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 76b72ed693a8..234918fdd717 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -773,6 +773,7 @@ mempool_t bio_bounce_pages; copygc_heap copygc_heap; struct bch_pd_controller copygc_pd; struct write_point copygc_write_point; + s64 copygc_wait; /* STRIPES: */ GENRADIX(struct stripe) stripes[2]; diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c index b8da600cdc53..113013d1fc48 100644 --- a/fs/bcachefs/movinggc.c +++ b/fs/bcachefs/movinggc.c @@ -311,11 +311,14 @@ static int bch2_copygc_thread(void *arg) wait = bch2_copygc_wait_amount(c); if (wait > clock->max_slop) { + c->copygc_wait = last + wait; bch2_kthread_io_clock_wait(clock, last + wait, MAX_SCHEDULE_TIMEOUT); continue; } + c->copygc_wait = 0; + if (bch2_copygc(c)) break; } diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 9f75f72f7b12..1f31458ffec9 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -188,6 +188,7 @@ rw_attribute(cache_replacement_policy); rw_attribute(label); rw_attribute(copy_gc_enabled); +read_attribute(copy_gc_wait); sysfs_pd_controller_attribute(copy_gc); rw_attribute(rebalance_enabled); @@ -336,6 +337,9 @@ SHOW(bch2_fs) sysfs_printf(rebalance_enabled, "%i", c->rebalance.enabled); sysfs_pd_controller_show(rebalance, &c->rebalance.pd); /* XXX */ 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) { bch2_rebalance_work_to_text(&out, c); @@ -563,6 +567,7 @@ struct attribute *bch2_fs_internal_files[] = { &sysfs_prune_cache, &sysfs_copy_gc_enabled, + &sysfs_copy_gc_wait, &sysfs_rebalance_enabled, &sysfs_rebalance_work, |