summaryrefslogtreecommitdiff
path: root/fs/bcachefs/movinggc.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-17 09:59:17 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:58 -0400
commit0fb11e0801962007adef5b628fec0f334e5358f2 (patch)
treef7d68d18360f3c2600d572611d2457fb9bbfa066 /fs/bcachefs/movinggc.c
parent11f117374a2a353c378f8eccff8904d209643695 (diff)
bcachefs: Improved copygc wait debugging
This just adds a line for how long copygc has been waiting to sysfs copygc_wait, helpful for debugging why copygc isn't running. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/movinggc.c')
-rw-r--r--fs/bcachefs/movinggc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c
index 4762594f6287..e91067b428cd 100644
--- a/fs/bcachefs/movinggc.c
+++ b/fs/bcachefs/movinggc.c
@@ -269,6 +269,12 @@ void bch2_copygc_wait_to_text(struct printbuf *out, struct bch_fs *c)
atomic64_read(&c->io_clock[WRITE].now)) << 9);
prt_newline(out);
+ prt_printf(out, "Currently waiting since: ");
+ prt_human_readable_u64(out, max(0LL,
+ atomic64_read(&c->io_clock[WRITE].now) -
+ c->copygc_wait_at) << 9);
+ prt_newline(out);
+
prt_printf(out, "Currently calculated wait: ");
prt_human_readable_u64(out, bch2_copygc_wait_amount(c));
prt_newline(out);
@@ -317,9 +323,11 @@ static int bch2_copygc_thread(void *arg)
wait = bch2_copygc_wait_amount(c);
if (wait > clock->max_slop) {
+ c->copygc_wait_at = last;
+ c->copygc_wait = last + wait;
+
move_buckets_wait(&trans, &ctxt, &move_buckets, 0, true);
trace_and_count(c, copygc_wait, c, wait, last + wait);
- c->copygc_wait = last + wait;
bch2_kthread_io_clock_wait(clock, last + wait,
MAX_SCHEDULE_TIMEOUT);
continue;