Commit 25d1e39d authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Add a rebalance, data_update tracepoints

Add a tracepoint for rebalance, printing out
 - the target option
 - the compression option
 - the key being rebalanced
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent d05db127
...@@ -267,6 +267,20 @@ static int __bch2_data_update_index_update(struct btree_trans *trans, ...@@ -267,6 +267,20 @@ static int __bch2_data_update_index_update(struct btree_trans *trans,
goto out; goto out;
} }
if (trace_data_update_enabled()) {
struct printbuf buf = PRINTBUF;
prt_str(&buf, "\nold: ");
bch2_bkey_val_to_text(&buf, c, old);
prt_str(&buf, "\nk: ");
bch2_bkey_val_to_text(&buf, c, k);
prt_str(&buf, "\nnew: ");
bch2_bkey_val_to_text(&buf, c, bkey_i_to_s_c(insert));
trace_data_update(c, buf.buf);
printbuf_exit(&buf);
}
ret = bch2_insert_snapshot_whiteouts(trans, m->btree_id, ret = bch2_insert_snapshot_whiteouts(trans, m->btree_id,
k.k->p, bkey_start_pos(&insert->k)) ?: k.k->p, bkey_start_pos(&insert->k)) ?:
bch2_insert_snapshot_whiteouts(trans, m->btree_id, bch2_insert_snapshot_whiteouts(trans, m->btree_id,
......
...@@ -171,6 +171,21 @@ static struct bkey_s_c next_rebalance_extent(struct btree_trans *trans, ...@@ -171,6 +171,21 @@ static struct bkey_s_c next_rebalance_extent(struct btree_trans *trans,
return bkey_s_c_null; return bkey_s_c_null;
} }
if (trace_rebalance_extent_enabled()) {
struct printbuf buf = PRINTBUF;
prt_str(&buf, "target=");
bch2_target_to_text(&buf, c, r->target);
prt_str(&buf, " compression=");
struct bch_compression_opt opt = __bch2_compression_decode(r->compression);
prt_str(&buf, bch2_compression_opts[opt.type]);
prt_str(&buf, " ");
bch2_bkey_val_to_text(&buf, c, k);
trace_rebalance_extent(c, buf.buf);
printbuf_exit(&buf);
}
return k; return k;
} }
......
...@@ -32,19 +32,21 @@ DECLARE_EVENT_CLASS(bpos, ...@@ -32,19 +32,21 @@ DECLARE_EVENT_CLASS(bpos,
TP_printk("%llu:%llu:%u", __entry->p_inode, __entry->p_offset, __entry->p_snapshot) TP_printk("%llu:%llu:%u", __entry->p_inode, __entry->p_offset, __entry->p_snapshot)
); );
DECLARE_EVENT_CLASS(bkey, DECLARE_EVENT_CLASS(str,
TP_PROTO(struct bch_fs *c, const char *k), TP_PROTO(struct bch_fs *c, const char *str),
TP_ARGS(c, k), TP_ARGS(c, str),
TP_STRUCT__entry( TP_STRUCT__entry(
__string(k, k ) __field(dev_t, dev )
__string(str, str )
), ),
TP_fast_assign( TP_fast_assign(
__assign_str(k, k); __entry->dev = c->dev;
__assign_str(str, str);
), ),
TP_printk("%s", __get_str(k)) TP_printk("%d,%d %s", MAJOR(__entry->dev), MINOR(__entry->dev), __get_str(str))
); );
DECLARE_EVENT_CLASS(btree_node, DECLARE_EVENT_CLASS(btree_node,
...@@ -736,22 +738,22 @@ TRACE_EVENT(bucket_evacuate, ...@@ -736,22 +738,22 @@ TRACE_EVENT(bucket_evacuate,
__entry->dev_idx, __entry->bucket) __entry->dev_idx, __entry->bucket)
); );
DEFINE_EVENT(bkey, move_extent, DEFINE_EVENT(str, move_extent,
TP_PROTO(struct bch_fs *c, const char *k), TP_PROTO(struct bch_fs *c, const char *k),
TP_ARGS(c, k) TP_ARGS(c, k)
); );
DEFINE_EVENT(bkey, move_extent_read, DEFINE_EVENT(str, move_extent_read,
TP_PROTO(struct bch_fs *c, const char *k), TP_PROTO(struct bch_fs *c, const char *k),
TP_ARGS(c, k) TP_ARGS(c, k)
); );
DEFINE_EVENT(bkey, move_extent_write, DEFINE_EVENT(str, move_extent_write,
TP_PROTO(struct bch_fs *c, const char *k), TP_PROTO(struct bch_fs *c, const char *k),
TP_ARGS(c, k) TP_ARGS(c, k)
); );
DEFINE_EVENT(bkey, move_extent_finish, DEFINE_EVENT(str, move_extent_finish,
TP_PROTO(struct bch_fs *c, const char *k), TP_PROTO(struct bch_fs *c, const char *k),
TP_ARGS(c, k) TP_ARGS(c, k)
); );
...@@ -773,7 +775,7 @@ TRACE_EVENT(move_extent_fail, ...@@ -773,7 +775,7 @@ TRACE_EVENT(move_extent_fail,
TP_printk("%d:%d %s", MAJOR(__entry->dev), MINOR(__entry->dev), __get_str(msg)) TP_printk("%d:%d %s", MAJOR(__entry->dev), MINOR(__entry->dev), __get_str(msg))
); );
DEFINE_EVENT(bkey, move_extent_start_fail, DEFINE_EVENT(str, move_extent_start_fail,
TP_PROTO(struct bch_fs *c, const char *str), TP_PROTO(struct bch_fs *c, const char *str),
TP_ARGS(c, str) TP_ARGS(c, str)
); );
...@@ -1349,6 +1351,16 @@ TRACE_EVENT(write_buffer_flush_slowpath, ...@@ -1349,6 +1351,16 @@ TRACE_EVENT(write_buffer_flush_slowpath,
TP_printk("%zu/%zu", __entry->nr, __entry->size) TP_printk("%zu/%zu", __entry->nr, __entry->size)
); );
DEFINE_EVENT(str, rebalance_extent,
TP_PROTO(struct bch_fs *c, const char *str),
TP_ARGS(c, str)
);
DEFINE_EVENT(str, data_update,
TP_PROTO(struct bch_fs *c, const char *str),
TP_ARGS(c, str)
);
#endif /* _TRACE_BCACHEFS_H */ #endif /* _TRACE_BCACHEFS_H */
/* This part must be outside protection */ /* This part must be outside protection */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment