mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-08 14:23:19 +00:00
bcachefs: Add time stats for btree updates
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
1a470560c9
commit
dc3b63dc33
@ -290,10 +290,11 @@ do { \
|
||||
|
||||
#define BCH_TIME_STATS() \
|
||||
x(btree_node_mem_alloc) \
|
||||
x(btree_node_split) \
|
||||
x(btree_node_sort) \
|
||||
x(btree_node_read) \
|
||||
x(btree_gc) \
|
||||
x(btree_split) \
|
||||
x(btree_sort) \
|
||||
x(btree_read) \
|
||||
x(btree_update) \
|
||||
x(btree_lock_contended_read) \
|
||||
x(btree_lock_contended_intent) \
|
||||
x(btree_lock_contended_write) \
|
||||
|
@ -327,7 +327,7 @@ static void btree_node_sort(struct bch_fs *c, struct btree *b,
|
||||
BUG_ON(vstruct_end(&out->keys) > (void *) out + (PAGE_SIZE << order));
|
||||
|
||||
if (sorting_entire_node)
|
||||
bch2_time_stats_update(&c->times[BCH_TIME_btree_sort],
|
||||
bch2_time_stats_update(&c->times[BCH_TIME_btree_node_sort],
|
||||
start_time);
|
||||
|
||||
/* Make sure we preserve bset journal_seq: */
|
||||
@ -403,7 +403,8 @@ void bch2_btree_sort_into(struct bch_fs *c,
|
||||
&dst->format,
|
||||
true);
|
||||
|
||||
bch2_time_stats_update(&c->times[BCH_TIME_btree_sort], start_time);
|
||||
bch2_time_stats_update(&c->times[BCH_TIME_btree_node_sort],
|
||||
start_time);
|
||||
|
||||
set_btree_bset_end(dst, dst->set);
|
||||
|
||||
@ -988,7 +989,8 @@ static void btree_node_read_work(struct work_struct *work)
|
||||
}
|
||||
}
|
||||
|
||||
bch2_time_stats_update(&c->times[BCH_TIME_btree_read], rb->start_time);
|
||||
bch2_time_stats_update(&c->times[BCH_TIME_btree_node_read],
|
||||
rb->start_time);
|
||||
bio_put(&rb->bio);
|
||||
clear_btree_node_read_in_flight(b);
|
||||
wake_up_bit(&b->flags, BTREE_NODE_read_in_flight);
|
||||
|
@ -274,6 +274,7 @@ struct btree_insert_entry {
|
||||
struct btree_trans {
|
||||
struct bch_fs *c;
|
||||
size_t nr_restarts;
|
||||
u64 commit_start;
|
||||
|
||||
u64 iters_live;
|
||||
u64 iters_linked;
|
||||
|
@ -1440,7 +1440,8 @@ static void btree_split(struct btree_update *as, struct btree *b,
|
||||
|
||||
bch2_btree_iter_verify_locks(iter);
|
||||
|
||||
bch2_time_stats_update(&c->times[BCH_TIME_btree_split], start_time);
|
||||
bch2_time_stats_update(&c->times[BCH_TIME_btree_node_split],
|
||||
start_time);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -824,10 +824,10 @@ int bch2_trans_commit(struct btree_trans *trans,
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
struct btree_insert_entry *i;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (!trans->nr_updates)
|
||||
return 0;
|
||||
goto out;
|
||||
|
||||
/* for the sake of sanity: */
|
||||
BUG_ON(trans->nr_updates > 1 && !(flags & BTREE_INSERT_ATOMIC));
|
||||
@ -850,6 +850,9 @@ int bch2_trans_commit(struct btree_trans *trans,
|
||||
!percpu_ref_tryget(&c->writes)))
|
||||
return -EROFS;
|
||||
|
||||
if (!trans->commit_start)
|
||||
trans->commit_start = local_clock();
|
||||
|
||||
ret = bch2_trans_journal_preres_get(trans);
|
||||
if (ret)
|
||||
goto err;
|
||||
@ -860,6 +863,12 @@ int bch2_trans_commit(struct btree_trans *trans,
|
||||
|
||||
if (unlikely(!(trans->flags & BTREE_INSERT_NOCHECK_RW)))
|
||||
percpu_ref_put(&c->writes);
|
||||
out:
|
||||
if (!ret && trans->commit_start) {
|
||||
bch2_time_stats_update(&c->times[BCH_TIME_btree_update],
|
||||
trans->commit_start);
|
||||
trans->commit_start = 0;
|
||||
}
|
||||
|
||||
trans->nr_updates = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user