diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-24 04:20:42 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:10:11 +0300 |
commit | 9d2a7bd8b7f747c85a113a4967ffd5d65ef72dfa (patch) | |
tree | 37ae0680a46eaedb8271462846d3cb80c2dc12f2 | |
parent | cc07773f158331b5a9f5401e8d50cd7ed43c90ba (diff) | |
download | linux-9d2a7bd8b7f747c85a113a4967ffd5d65ef72dfa.tar.xz |
bcachefs: Improve bch2_moving_ctxt_to_text()
Print more information out about moving contexts - fold in the output of
the redundant bch2_data_jobs_to_text(), and also include information
relevant to whether move_data() should be blocked.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/move.c | 44 | ||||
-rw-r--r-- | fs/bcachefs/move.h | 1 | ||||
-rw-r--r-- | fs/bcachefs/sysfs.c | 5 |
3 files changed, 19 insertions, 31 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 05272673901d..fb76a1dac74e 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -1103,46 +1103,40 @@ int bch2_data_job(struct bch_fs *c, return ret; } -void bch2_data_jobs_to_text(struct printbuf *out, struct bch_fs *c) -{ - struct bch_move_stats *stats; - - mutex_lock(&c->data_progress_lock); - list_for_each_entry(stats, &c->data_progress_list, list) { - prt_printf(out, "%s: data type %s btree_id %s position: ", - stats->name, - bch2_data_types[stats->data_type], - bch2_btree_ids[stats->btree_id]); - bch2_bpos_to_text(out, stats->pos); - prt_printf(out, "%s", "\n"); - } - mutex_unlock(&c->data_progress_lock); -} - -static void bch2_moving_ctxt_to_text(struct printbuf *out, struct moving_context *ctxt) +static void bch2_moving_ctxt_to_text(struct printbuf *out, struct bch_fs *c, struct moving_context *ctxt) { + struct bch_move_stats *stats = ctxt->stats; struct moving_io *io; - prt_printf(out, "%ps:", ctxt->fn); + prt_printf(out, "%s (%ps):", stats->name, ctxt->fn); + prt_newline(out); + + prt_printf(out, " data type %s btree_id %s position: ", + bch2_data_types[stats->data_type], + bch2_btree_ids[stats->btree_id]); + bch2_bpos_to_text(out, stats->pos); prt_newline(out); printbuf_indent_add(out, 2); - prt_printf(out, "reads: %u sectors %u", + prt_printf(out, "reads: ios %u/%u sectors %u/%u", atomic_read(&ctxt->read_ios), - atomic_read(&ctxt->read_sectors)); + c->opts.move_ios_in_flight, + atomic_read(&ctxt->read_sectors), + c->opts.move_bytes_in_flight >> 9); prt_newline(out); - prt_printf(out, "writes: %u sectors %u", + prt_printf(out, "writes: ios %u/%u sectors %u/%u", atomic_read(&ctxt->write_ios), - atomic_read(&ctxt->write_sectors)); + c->opts.move_ios_in_flight, + atomic_read(&ctxt->write_sectors), + c->opts.move_bytes_in_flight >> 9); prt_newline(out); printbuf_indent_add(out, 2); mutex_lock(&ctxt->lock); - list_for_each_entry(io, &ctxt->ios, io_list) { + list_for_each_entry(io, &ctxt->ios, io_list) bch2_write_op_to_text(out, &io->write.op); - } mutex_unlock(&ctxt->lock); printbuf_indent_sub(out, 4); @@ -1154,7 +1148,7 @@ void bch2_fs_moving_ctxts_to_text(struct printbuf *out, struct bch_fs *c) mutex_lock(&c->moving_context_lock); list_for_each_entry(ctxt, &c->moving_context_list, list) - bch2_moving_ctxt_to_text(out, ctxt); + bch2_moving_ctxt_to_text(out, c, ctxt); mutex_unlock(&c->moving_context_lock); } diff --git a/fs/bcachefs/move.h b/fs/bcachefs/move.h index 547ee7b72c16..c3136abe8587 100644 --- a/fs/bcachefs/move.h +++ b/fs/bcachefs/move.h @@ -88,7 +88,6 @@ int bch2_data_job(struct bch_fs *, struct bch_ioctl_data); void bch2_move_stats_init(struct bch_move_stats *stats, char *name); -void bch2_data_jobs_to_text(struct printbuf *, struct bch_fs *); void bch2_fs_moving_ctxts_to_text(struct printbuf *, struct bch_fs *); void bch2_fs_move_init(struct bch_fs *); diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index ef02e346e334..41c6900c34c1 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -248,7 +248,6 @@ read_attribute(new_stripes); read_attribute(io_timers_read); read_attribute(io_timers_write); -read_attribute(data_jobs); read_attribute(moving_ctxts); #ifdef CONFIG_BCACHEFS_TESTS @@ -458,9 +457,6 @@ SHOW(bch2_fs) if (attr == &sysfs_io_timers_write) bch2_io_timers_to_text(out, &c->io_clock[WRITE]); - if (attr == &sysfs_data_jobs) - bch2_data_jobs_to_text(out, c); - if (attr == &sysfs_moving_ctxts) bch2_fs_moving_ctxts_to_text(out, c); @@ -681,7 +677,6 @@ struct attribute *bch2_fs_internal_files[] = { &sysfs_rebalance_work, sysfs_pd_controller_files(rebalance), - &sysfs_data_jobs, &sysfs_moving_ctxts, &sysfs_internal_uuid, |