bcachefs: trace_move_extent_start_fail() now includes errcode
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 27 Nov 2023 02:13:54 +0000 (21:13 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Tue, 28 Nov 2023 22:18:24 +0000 (17:18 -0500)
Renamed from trace_move_extent_alloc_mem_fail, because there are other
reasons we colud fail (disk space allocation failure).

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/bcachefs_format.h
fs/bcachefs/move.c
fs/bcachefs/trace.h

index ca0842f9b7e9033d4383244d9c9fa7bc651802c6..1ab1f08d763b02d03a28f9bbc7abc1dc6994b525 100644 (file)
@@ -1532,7 +1532,7 @@ struct bch_sb_field_disk_groups {
        x(move_extent_write,                            36)     \
        x(move_extent_finish,                           37)     \
        x(move_extent_fail,                             38)     \
-       x(move_extent_alloc_mem_fail,                   39)     \
+       x(move_extent_start_fail,                       39)     \
        x(copygc,                                       40)     \
        x(copygc_wait,                                  41)     \
        x(gc_gens_end,                                  42)     \
index 3b0a501b6baf0a35f1b288fcb5aa75409eb503fe..0a04adff1144165a3d05295709a1bb26163d36b2 100644 (file)
@@ -49,17 +49,6 @@ static void trace_move_extent_read2(struct bch_fs *c, struct bkey_s_c k)
        }
 }
 
-static void trace_move_extent_alloc_mem_fail2(struct bch_fs *c, struct bkey_s_c k)
-{
-       if (trace_move_extent_alloc_mem_fail_enabled()) {
-               struct printbuf buf = PRINTBUF;
-
-               bch2_bkey_val_to_text(&buf, c, k);
-               trace_move_extent_alloc_mem_fail(c, buf.buf);
-               printbuf_exit(&buf);
-       }
-}
-
 struct moving_io {
        struct list_head                read_list;
        struct list_head                io_list;
@@ -349,8 +338,16 @@ err:
        if (ret == -BCH_ERR_data_update_done)
                return 0;
 
-       this_cpu_inc(c->counters[BCH_COUNTER_move_extent_alloc_mem_fail]);
-       trace_move_extent_alloc_mem_fail2(c, k);
+       this_cpu_inc(c->counters[BCH_COUNTER_move_extent_start_fail]);
+       if (trace_move_extent_start_fail_enabled()) {
+               struct printbuf buf = PRINTBUF;
+
+               bch2_bkey_val_to_text(&buf, c, k);
+               prt_str(&buf, ": ");
+               prt_str(&buf, bch2_err_str(ret));
+               trace_move_extent_start_fail(c, buf.buf);
+               printbuf_exit(&buf);
+       }
        return ret;
 }
 
index 7857671159b491235a0bcdfe19f9b34a316a0126..fd49b63562c36cc4d2bedc1884be0815160ddb90 100644 (file)
@@ -754,9 +754,9 @@ TRACE_EVENT(move_extent_fail,
        TP_printk("%d:%d %s", MAJOR(__entry->dev), MINOR(__entry->dev), __get_str(msg))
 );
 
-DEFINE_EVENT(bkey, move_extent_alloc_mem_fail,
-       TP_PROTO(struct bch_fs *c, const char *k),
-       TP_ARGS(c, k)
+DEFINE_EVENT(bkey, move_extent_start_fail,
+       TP_PROTO(struct bch_fs *c, const char *str),
+       TP_ARGS(c, str)
 );
 
 TRACE_EVENT(move_data,