bcachefs: add time_stats for btree_node_read_done()
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 3 Jan 2024 21:42:33 +0000 (16:42 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 6 Jan 2024 04:24:20 +0000 (23:24 -0500)
Seeing weird latency issues in the btree node read path - add one
bch2_btree_node_read_done().

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

index c7ed097..dac383e 100644 (file)
@@ -425,6 +425,7 @@ BCH_DEBUG_PARAMS_DEBUG()
        x(btree_node_merge)                     \
        x(btree_node_sort)                      \
        x(btree_node_read)                      \
+       x(btree_node_read_done)                 \
        x(btree_interior_update_foreground)     \
        x(btree_interior_update_total)          \
        x(btree_gc)                             \
index 38d27ca..cf5089c 100644 (file)
@@ -942,6 +942,7 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
        unsigned ptr_written = btree_ptr_sectors_written(&b->key);
        struct printbuf buf = PRINTBUF;
        int ret = 0, retry_read = 0, write = READ;
+       u64 start_time = local_clock();
 
        b->version_ondisk = U16_MAX;
        /* We might get called multiple times on read retry: */
@@ -1209,6 +1210,7 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
 out:
        mempool_free(iter, &c->fill_iter);
        printbuf_exit(&buf);
+       bch2_time_stats_update(&c->times[BCH_TIME_btree_node_read_done], start_time);
        return retry_read;
 fsck_err:
        if (ret == -BCH_ERR_btree_node_read_err_want_retry ||