mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00
bcachefs: trace_io_move_write_fail
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
76bc6e51cd
commit
fb8a9a32cc
@ -1742,20 +1742,26 @@ static const char * const bch2_write_flags[] = {
|
||||
|
||||
void bch2_write_op_to_text(struct printbuf *out, struct bch_write_op *op)
|
||||
{
|
||||
prt_str(out, "pos: ");
|
||||
if (!out->nr_tabstops)
|
||||
printbuf_tabstop_push(out, 32);
|
||||
|
||||
prt_printf(out, "pos:\t");
|
||||
bch2_bpos_to_text(out, op->pos);
|
||||
prt_newline(out);
|
||||
printbuf_indent_add(out, 2);
|
||||
|
||||
prt_str(out, "started: ");
|
||||
prt_printf(out, "started:\t");
|
||||
bch2_pr_time_units(out, local_clock() - op->start_time);
|
||||
prt_newline(out);
|
||||
|
||||
prt_str(out, "flags: ");
|
||||
prt_printf(out, "flags:\t");
|
||||
prt_bitflags(out, bch2_write_flags, op->flags);
|
||||
prt_newline(out);
|
||||
|
||||
prt_printf(out, "ref: %u\n", closure_nr_remaining(&op->cl));
|
||||
prt_printf(out, "nr_replicas:\t%u\n", op->nr_replicas);
|
||||
prt_printf(out, "nr_replicas_required:\t%u\n", op->nr_replicas_required);
|
||||
|
||||
prt_printf(out, "ref:\t%u\n", closure_nr_remaining(&op->cl));
|
||||
|
||||
printbuf_indent_sub(out, 2);
|
||||
}
|
||||
|
@ -101,13 +101,25 @@ static void move_free(struct moving_io *io)
|
||||
static void move_write_done(struct bch_write_op *op)
|
||||
{
|
||||
struct moving_io *io = container_of(op, struct moving_io, write.op);
|
||||
struct bch_fs *c = op->c;
|
||||
struct moving_context *ctxt = io->write.ctxt;
|
||||
|
||||
if (io->write.op.error)
|
||||
ctxt->write_error = true;
|
||||
if (op->error) {
|
||||
if (trace_io_move_write_fail_enabled()) {
|
||||
struct printbuf buf = PRINTBUF;
|
||||
|
||||
atomic_sub(io->write_sectors, &io->write.ctxt->write_sectors);
|
||||
atomic_dec(&io->write.ctxt->write_ios);
|
||||
bch2_write_op_to_text(&buf, op);
|
||||
prt_printf(&buf, "ret\t%s\n", bch2_err_str(op->error));
|
||||
trace_io_move_write_fail(c, buf.buf);
|
||||
printbuf_exit(&buf);
|
||||
}
|
||||
this_cpu_inc(c->counters[BCH_COUNTER_io_move_write_fail]);
|
||||
|
||||
ctxt->write_error = true;
|
||||
}
|
||||
|
||||
atomic_sub(io->write_sectors, &ctxt->write_sectors);
|
||||
atomic_dec(&ctxt->write_ios);
|
||||
move_free(io);
|
||||
closure_put(&ctxt->cl);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ enum counters_flags {
|
||||
x(io_move_write, 36, TYPE_SECTORS) \
|
||||
x(io_move_finish, 37, TYPE_SECTORS) \
|
||||
x(io_move_fail, 38, TYPE_COUNTER) \
|
||||
x(io_move_write_fail, 82, TYPE_COUNTER) \
|
||||
x(io_move_start_fail, 39, TYPE_COUNTER) \
|
||||
x(bucket_invalidate, 3, TYPE_COUNTER) \
|
||||
x(bucket_discard, 4, TYPE_COUNTER) \
|
||||
|
@ -846,6 +846,11 @@ DEFINE_EVENT(fs_str, io_move_fail,
|
||||
TP_ARGS(c, str)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(fs_str, io_move_write_fail,
|
||||
TP_PROTO(struct bch_fs *c, const char *str),
|
||||
TP_ARGS(c, str)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(fs_str, io_move_start_fail,
|
||||
TP_PROTO(struct bch_fs *c, const char *str),
|
||||
TP_ARGS(c, str)
|
||||
|
Loading…
x
Reference in New Issue
Block a user