Loading fs/bcachefs/move.c +60 −26 Original line number Diff line number Diff line Loading @@ -38,11 +38,22 @@ const char * const bch2_data_ops_strs[] = { NULL }; static void trace_io_move2(struct bch_fs *c, struct bkey_s_c k, struct evacuate_bucket_arg { struct bpos bucket; int gen; struct data_update_opts data_opts; }; static bool evacuate_bucket_pred(struct bch_fs *, void *, enum btree_id, struct bkey_s_c, struct bch_io_opts *, struct data_update_opts *); static noinline void trace_io_move2(struct bch_fs *c, struct bkey_s_c k, struct bch_io_opts *io_opts, struct data_update_opts *data_opts) { if (trace_io_move_enabled()) { struct printbuf buf = PRINTBUF; bch2_bkey_val_to_text(&buf, c, k); Loading @@ -51,17 +62,37 @@ static void trace_io_move2(struct bch_fs *c, struct bkey_s_c k, trace_io_move(c, buf.buf); printbuf_exit(&buf); } } static void trace_io_move_read2(struct bch_fs *c, struct bkey_s_c k) static noinline void trace_io_move_read2(struct bch_fs *c, struct bkey_s_c k) { if (trace_io_move_read_enabled()) { struct printbuf buf = PRINTBUF; bch2_bkey_val_to_text(&buf, c, k); trace_io_move_read(c, buf.buf); printbuf_exit(&buf); } static noinline void trace_io_move_pred2(struct bch_fs *c, struct bkey_s_c k, struct bch_io_opts *io_opts, struct data_update_opts *data_opts, move_pred_fn pred, void *_arg, bool p) { struct printbuf buf = PRINTBUF; prt_printf(&buf, "%ps: %u", pred, p); if (pred == evacuate_bucket_pred) { struct evacuate_bucket_arg *arg = _arg; prt_printf(&buf, " gen=%u", arg->gen); } prt_newline(&buf); bch2_bkey_val_to_text(&buf, c, k); prt_newline(&buf); bch2_data_update_opts_to_text(&buf, c, io_opts, data_opts); trace_io_move_pred(c, buf.buf); printbuf_exit(&buf); } struct moving_io { Loading Loading @@ -298,6 +329,7 @@ int bch2_move_extent(struct moving_context *ctxt, struct bch_fs *c = trans->c; int ret = -ENOMEM; if (trace_io_move_enabled()) trace_io_move2(c, k, &io_opts, &data_opts); this_cpu_add(c->counters[BCH_COUNTER_io_move], k.k->size); Loading Loading @@ -364,6 +396,7 @@ int bch2_move_extent(struct moving_context *ctxt, atomic_inc(&io->b->count); } if (trace_io_move_read_enabled()) trace_io_move_read2(c, k); mutex_lock(&ctxt->lock); Loading Loading @@ -496,6 +529,7 @@ int bch2_move_get_io_opts_one(struct btree_trans *trans, bch2_inode_opts_get(io_opts, c, &inode); } bch2_trans_iter_exit(trans, &inode_iter); /* seem to be spinning here? */ out: return bch2_get_update_rebalance_opts(trans, io_opts, extent_iter, extent_k); } Loading Loading @@ -910,7 +944,13 @@ static int __bch2_move_data_phys(struct moving_context *ctxt, } struct data_update_opts data_opts = {}; if (!pred(c, arg, bp.v->btree_id, k, &io_opts, &data_opts)) { bool p = pred(c, arg, bp.v->btree_id, k, &io_opts, &data_opts); if (trace_io_move_pred_enabled()) trace_io_move_pred2(c, k, &io_opts, &data_opts, pred, arg, p); if (!p) { bch2_trans_iter_exit(trans, &iter); goto next; } Loading Loading @@ -993,12 +1033,6 @@ int bch2_move_data_phys(struct bch_fs *c, return ret; } struct evacuate_bucket_arg { struct bpos bucket; int gen; struct data_update_opts data_opts; }; static bool evacuate_bucket_pred(struct bch_fs *c, void *_arg, enum btree_id btree, struct bkey_s_c k, struct bch_io_opts *io_opts, Loading fs/bcachefs/trace.h +5 −0 Original line number Diff line number Diff line Loading @@ -1431,6 +1431,11 @@ DEFINE_EVENT(fs_str, data_update, TP_ARGS(c, str) ); DEFINE_EVENT(fs_str, io_move_pred, TP_PROTO(struct bch_fs *c, const char *str), TP_ARGS(c, str) ); DEFINE_EVENT(fs_str, io_move_created_rebalance, TP_PROTO(struct bch_fs *c, const char *str), TP_ARGS(c, str) Loading Loading
fs/bcachefs/move.c +60 −26 Original line number Diff line number Diff line Loading @@ -38,11 +38,22 @@ const char * const bch2_data_ops_strs[] = { NULL }; static void trace_io_move2(struct bch_fs *c, struct bkey_s_c k, struct evacuate_bucket_arg { struct bpos bucket; int gen; struct data_update_opts data_opts; }; static bool evacuate_bucket_pred(struct bch_fs *, void *, enum btree_id, struct bkey_s_c, struct bch_io_opts *, struct data_update_opts *); static noinline void trace_io_move2(struct bch_fs *c, struct bkey_s_c k, struct bch_io_opts *io_opts, struct data_update_opts *data_opts) { if (trace_io_move_enabled()) { struct printbuf buf = PRINTBUF; bch2_bkey_val_to_text(&buf, c, k); Loading @@ -51,17 +62,37 @@ static void trace_io_move2(struct bch_fs *c, struct bkey_s_c k, trace_io_move(c, buf.buf); printbuf_exit(&buf); } } static void trace_io_move_read2(struct bch_fs *c, struct bkey_s_c k) static noinline void trace_io_move_read2(struct bch_fs *c, struct bkey_s_c k) { if (trace_io_move_read_enabled()) { struct printbuf buf = PRINTBUF; bch2_bkey_val_to_text(&buf, c, k); trace_io_move_read(c, buf.buf); printbuf_exit(&buf); } static noinline void trace_io_move_pred2(struct bch_fs *c, struct bkey_s_c k, struct bch_io_opts *io_opts, struct data_update_opts *data_opts, move_pred_fn pred, void *_arg, bool p) { struct printbuf buf = PRINTBUF; prt_printf(&buf, "%ps: %u", pred, p); if (pred == evacuate_bucket_pred) { struct evacuate_bucket_arg *arg = _arg; prt_printf(&buf, " gen=%u", arg->gen); } prt_newline(&buf); bch2_bkey_val_to_text(&buf, c, k); prt_newline(&buf); bch2_data_update_opts_to_text(&buf, c, io_opts, data_opts); trace_io_move_pred(c, buf.buf); printbuf_exit(&buf); } struct moving_io { Loading Loading @@ -298,6 +329,7 @@ int bch2_move_extent(struct moving_context *ctxt, struct bch_fs *c = trans->c; int ret = -ENOMEM; if (trace_io_move_enabled()) trace_io_move2(c, k, &io_opts, &data_opts); this_cpu_add(c->counters[BCH_COUNTER_io_move], k.k->size); Loading Loading @@ -364,6 +396,7 @@ int bch2_move_extent(struct moving_context *ctxt, atomic_inc(&io->b->count); } if (trace_io_move_read_enabled()) trace_io_move_read2(c, k); mutex_lock(&ctxt->lock); Loading Loading @@ -496,6 +529,7 @@ int bch2_move_get_io_opts_one(struct btree_trans *trans, bch2_inode_opts_get(io_opts, c, &inode); } bch2_trans_iter_exit(trans, &inode_iter); /* seem to be spinning here? */ out: return bch2_get_update_rebalance_opts(trans, io_opts, extent_iter, extent_k); } Loading Loading @@ -910,7 +944,13 @@ static int __bch2_move_data_phys(struct moving_context *ctxt, } struct data_update_opts data_opts = {}; if (!pred(c, arg, bp.v->btree_id, k, &io_opts, &data_opts)) { bool p = pred(c, arg, bp.v->btree_id, k, &io_opts, &data_opts); if (trace_io_move_pred_enabled()) trace_io_move_pred2(c, k, &io_opts, &data_opts, pred, arg, p); if (!p) { bch2_trans_iter_exit(trans, &iter); goto next; } Loading Loading @@ -993,12 +1033,6 @@ int bch2_move_data_phys(struct bch_fs *c, return ret; } struct evacuate_bucket_arg { struct bpos bucket; int gen; struct data_update_opts data_opts; }; static bool evacuate_bucket_pred(struct bch_fs *c, void *_arg, enum btree_id btree, struct bkey_s_c k, struct bch_io_opts *io_opts, Loading
fs/bcachefs/trace.h +5 −0 Original line number Diff line number Diff line Loading @@ -1431,6 +1431,11 @@ DEFINE_EVENT(fs_str, data_update, TP_ARGS(c, str) ); DEFINE_EVENT(fs_str, io_move_pred, TP_PROTO(struct bch_fs *c, const char *str), TP_ARGS(c, str) ); DEFINE_EVENT(fs_str, io_move_created_rebalance, TP_PROTO(struct bch_fs *c, const char *str), TP_ARGS(c, str) Loading