Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: bch2_copygc_wait_to_text()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+18 -3
+12
fs/bcachefs/movinggc.c
··· 172 172 return wait; 173 173 } 174 174 175 + void bch2_copygc_wait_to_text(struct printbuf *out, struct bch_fs *c) 176 + { 177 + prt_printf(out, "Currently waiting for: "); 178 + prt_human_readable_u64(out, max(0LL, c->copygc_wait - 179 + atomic64_read(&c->io_clock[WRITE].now)) << 9); 180 + prt_newline(out); 181 + 182 + prt_printf(out, "Currently calculated wait: "); 183 + prt_human_readable_u64(out, bch2_copygc_wait_amount(c)); 184 + prt_newline(out); 185 + } 186 + 175 187 static int bch2_copygc_thread(void *arg) 176 188 { 177 189 struct bch_fs *c = arg;
+2
fs/bcachefs/movinggc.h
··· 3 3 #define _BCACHEFS_MOVINGGC_H 4 4 5 5 unsigned long bch2_copygc_wait_amount(struct bch_fs *); 6 + void bch2_copygc_wait_to_text(struct printbuf *, struct bch_fs *); 7 + 6 8 void bch2_copygc_stop(struct bch_fs *); 7 9 int bch2_copygc_start(struct bch_fs *); 8 10 void bch2_fs_copygc_init(struct bch_fs *);
+4 -3
fs/bcachefs/sysfs.c
··· 27 27 #include "journal.h" 28 28 #include "keylist.h" 29 29 #include "move.h" 30 + #include "movinggc.h" 30 31 #include "nocow_locking.h" 31 32 #include "opts.h" 32 33 #include "rebalance.h" ··· 428 427 429 428 sysfs_printf(rebalance_enabled, "%i", c->rebalance.enabled); 430 429 sysfs_pd_controller_show(rebalance, &c->rebalance.pd); /* XXX */ 431 - sysfs_hprint(copy_gc_wait, 432 - max(0LL, c->copygc_wait - 433 - atomic64_read(&c->io_clock[WRITE].now)) << 9); 430 + 431 + if (attr == &sysfs_copy_gc_wait) 432 + bch2_copygc_wait_to_text(out, c); 434 433 435 434 if (attr == &sysfs_rebalance_work) 436 435 bch2_rebalance_work_to_text(out, c);