btrfs: collect commit stats, count, duration
authorIoannis Angelakopoulos <iangelak@fb.com>
Tue, 14 Jun 2022 22:22:32 +0000 (15:22 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 15:45:37 +0000 (17:45 +0200)
commite55958c8a0e4d12a5f1bc9942c52dd793dd2e8dd
treed75a9f1023629ed1337c3bdf45d2a38118c5302d
parentf3e90c1ca93d18d03188ea2c2ca9c2ccc7ffad04
btrfs: collect commit stats, count, duration

Track several stats about transaction commit, to be later exported via
sysfs:

- number of commits so far
- duration of the last commit in ns
- maximum commit duration seen so far in ns
- total duration for all commits so far in ns

The update of the commit stats occurs after the commit thread has gone
through all the logic that checks if there is another thread committing
at the same time. This means that we only account for actual commit work
in the commit stats we report and not the time the thread spends waiting
until it is ready to do the commit work.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Ioannis Angelakopoulos <iangelak@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/transaction.c