bcachefs: trace_stripe_create

Add a simple tracepoint for stripe creation, we'll want to expand this
later.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet
2025-03-07 14:30:29 -05:00
parent 6c336144b9
commit 434a3f2ffa
3 changed files with 31 additions and 0 deletions

View File

@@ -1486,6 +1486,7 @@ static void ec_stripe_create(struct ec_stripe_new *s)
if (s->err) {
if (!bch2_err_matches(s->err, EROFS))
bch_err(c, "error creating stripe: error writing data buckets");
ret = s->err;
goto err;
}
@@ -1494,6 +1495,7 @@ static void ec_stripe_create(struct ec_stripe_new *s)
if (ec_do_recov(c, &s->existing_stripe)) {
bch_err(c, "error creating stripe: error reading existing stripe");
ret = -BCH_ERR_ec_block_read;
goto err;
}
@@ -1519,6 +1521,7 @@ static void ec_stripe_create(struct ec_stripe_new *s)
if (ec_nr_failed(&s->new_stripe)) {
bch_err(c, "error creating stripe: error writing redundancy buckets");
ret = -BCH_ERR_ec_block_write;
goto err;
}
@@ -1540,6 +1543,8 @@ static void ec_stripe_create(struct ec_stripe_new *s)
if (ret)
goto err;
err:
trace_stripe_create(c, s->idx, ret);
bch2_disk_reservation_put(c, &s->res);
for (i = 0; i < v->nr_blocks; i++)

View File

@@ -280,6 +280,8 @@
x(EIO, insufficient_journal_devices) \
x(EIO, device_offline) \
x(EIO, EIO_fault_injected) \
x(EIO, ec_block_read) \
x(EIO, ec_block_write) \
x(BCH_ERR_btree_node_read_err, btree_node_read_err_fixable) \
x(BCH_ERR_btree_node_read_err, btree_node_read_err_want_retry) \
x(BCH_ERR_btree_node_read_err, btree_node_read_err_must_retry) \

View File

@@ -339,6 +339,30 @@ DEFINE_EVENT(bio, io_read_reuse_race,
TP_ARGS(bio)
);
/* ec.c */
TRACE_EVENT(stripe_create,
TP_PROTO(struct bch_fs *c, u64 idx, int ret),
TP_ARGS(c, idx, ret),
TP_STRUCT__entry(
__field(dev_t, dev )
__field(u64, idx )
__field(int, ret )
),
TP_fast_assign(
__entry->dev = c->dev;
__entry->idx = idx;
__entry->ret = ret;
),
TP_printk("%d,%d idx %llu ret %i",
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->idx,
__entry->ret)
);
/* Journal */
DEFINE_EVENT(bch_fs, journal_full,