diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-24 06:43:33 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-06 07:24:19 +0300 |
commit | 89056f245bce2cb833726927783337c5dc59eac0 (patch) | |
tree | 18c9fbcece8b7322d7e215057077f2b762acba99 /fs/bcachefs/btree_iter.c | |
parent | 83322e8ca8b687528765d7f4acf55ef3855004c4 (diff) | |
download | linux-89056f245bce2cb833726927783337c5dc59eac0.tar.xz |
bcachefs: track transaction durations
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_iter.c')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index fa29f00e9350..7e5c797cfaf2 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -2894,9 +2894,15 @@ u32 bch2_trans_begin(struct btree_trans *trans) } now = local_clock(); + + if (!IS_ENABLED(CONFIG_BCACHEFS_NO_LATENCY_ACCT) && + time_after64(now, trans->last_begin_time + 10)) + __bch2_time_stats_update(&btree_trans_stats(trans)->duration, + trans->last_begin_time, now); + if (!trans->restarted && (need_resched() || - now - trans->last_begin_time > BTREE_TRANS_MAX_LOCK_HOLD_TIME_NS)) { + time_after64(now, trans->last_begin_time + BTREE_TRANS_MAX_LOCK_HOLD_TIME_NS))) { drop_locks_do(trans, (cond_resched(), 0)); now = local_clock(); } @@ -3232,6 +3238,7 @@ void bch2_fs_btree_iter_init_early(struct bch_fs *c) for (s = c->btree_transaction_stats; s < c->btree_transaction_stats + ARRAY_SIZE(c->btree_transaction_stats); s++) { + bch2_time_stats_init(&s->duration); bch2_time_stats_init(&s->lock_hold_times); mutex_init(&s->lock); } |