diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-31 18:16:17 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-02-07 14:49:48 -0500 |
commit | ae219951d28eb8e8ac2dc2ef22a654e7205ab046 (patch) | |
tree | 18e40195d33e1ae47f698b91d49fd2e1b048e45c | |
parent | 33afcbd817dc00e331aad598f89fbcd1fb475e6f (diff) |
bcachefs: bch2_data_update_inflight_to_text()
Add a new helper for bch2_moving_ctxt_to_text(), which may be used to
debug if moving_ios are getting stuck.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/data_update.c | 17 | ||||
-rw-r--r-- | fs/bcachefs/data_update.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/move.c | 5 |
3 files changed, 20 insertions, 4 deletions
diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c index 57f77f715c41..837e99c8cfc6 100644 --- a/fs/bcachefs/data_update.c +++ b/fs/bcachefs/data_update.c @@ -429,6 +429,8 @@ int bch2_data_update_index_update(struct bch_write_op *op) void bch2_data_update_read_done(struct data_update *m, struct bch_extent_crc_unpacked crc) { + m->read_done = true; + /* write bio must own pages: */ BUG_ON(!m->op.wbio.bio.bi_vcnt); @@ -540,7 +542,8 @@ void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c, struct bch_io_opts *io_opts, struct data_update_opts *data_opts) { - printbuf_tabstop_push(out, 20); + if (!out->nr_tabstops) + printbuf_tabstop_push(out, 20); prt_str_indented(out, "rewrite ptrs:\t"); bch2_prt_u64_base2(out, data_opts->rewrite_ptrs); @@ -564,6 +567,7 @@ void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c, prt_str_indented(out, "extra replicas:\t"); prt_u64(out, data_opts->extra_replicas); + prt_newline(out); } void bch2_data_update_to_text(struct printbuf *out, struct data_update *m) @@ -575,6 +579,17 @@ void bch2_data_update_to_text(struct printbuf *out, struct data_update *m) bch2_bkey_val_to_text(out, m->op.c, bkey_i_to_s_c(m->k.k)); } +void bch2_data_update_inflight_to_text(struct printbuf *out, struct data_update *m) +{ + bch2_bkey_val_to_text(out, m->op.c, bkey_i_to_s_c(m->k.k)); + prt_newline(out); + printbuf_indent_add(out, 2); + bch2_data_update_opts_to_text(out, m->op.c, &m->op.opts, &m->data_opts); + prt_printf(out, "read_done:\t\%u\n", m->read_done); + bch2_write_op_to_text(out, &m->op); + printbuf_indent_sub(out, 2); +} + int bch2_extent_drop_ptrs(struct btree_trans *trans, struct btree_iter *iter, struct bkey_s_c k, diff --git a/fs/bcachefs/data_update.h b/fs/bcachefs/data_update.h index e4b50723428e..7a200e6b770b 100644 --- a/fs/bcachefs/data_update.h +++ b/fs/bcachefs/data_update.h @@ -22,6 +22,7 @@ void bch2_data_update_opts_to_text(struct printbuf *, struct bch_fs *, struct data_update { /* extent being updated: */ + bool read_done; enum btree_id btree_id; struct bkey_buf k; struct data_update_opts data_opts; @@ -31,6 +32,7 @@ struct data_update { }; void bch2_data_update_to_text(struct printbuf *, struct data_update *); +void bch2_data_update_inflight_to_text(struct printbuf *, struct data_update *); int bch2_data_update_index_update(struct bch_write_op *); diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 160b4374160a..2e09f980f3f5 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -88,13 +88,12 @@ static void move_free(struct moving_io *io) if (io->b) atomic_dec(&io->b->count); - bch2_data_update_exit(&io->write); - mutex_lock(&ctxt->lock); list_del(&io->io_list); wake_up(&ctxt->wait); mutex_unlock(&ctxt->lock); + bch2_data_update_exit(&io->write); kfree(io); } @@ -1216,7 +1215,7 @@ static void bch2_moving_ctxt_to_text(struct printbuf *out, struct bch_fs *c, str mutex_lock(&ctxt->lock); list_for_each_entry(io, &ctxt->ios, io_list) - bch2_write_op_to_text(out, &io->write.op); + bch2_data_update_inflight_to_text(out, &io->write); mutex_unlock(&ctxt->lock); printbuf_indent_sub(out, 4); |