bcachefs: trace_extent_trim_atomic

Add a tracepoint for when we insert only part of an extent, due to too
many overwrites.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-06-12 18:26:48 -04:00
parent e04c78d86a
commit 0f4dd2ce35
2 changed files with 17 additions and 1 deletions

View file

@ -139,6 +139,17 @@ int bch2_extent_trim_atomic(struct btree_trans *trans,
if (ret)
return ret;
bch2_cut_back(end, k);
/* tracepoint */
if (bpos_lt(end, k->k.p)) {
if (trace_extent_trim_atomic_enabled()) {
CLASS(printbuf, buf)();
bch2_bpos_to_text(&buf, end);
prt_newline(&buf);
bch2_bkey_val_to_text(&buf, trans->c, bkey_i_to_s_c(k));
trace_extent_trim_atomic(trans->c, buf.buf);
}
bch2_cut_back(end, k);
}
return 0;
}

View file

@ -1490,6 +1490,11 @@ DEFINE_EVENT(fs_str, io_move_evacuate_bucket,
TP_ARGS(c, str)
);
DEFINE_EVENT(fs_str, extent_trim_atomic,
TP_PROTO(struct bch_fs *c, const char *str),
TP_ARGS(c, str)
);
#ifdef CONFIG_BCACHEFS_PATH_TRACEPOINTS
TRACE_EVENT(update_by_path,