Skip to content

btrfs: Expose commit stats through sysfs

Ioannis Angelakopoulos linux-btrfs 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 2 repliesIn review
  2. v32 patches 0 repliesSuperseded
  3. v22 patches 10 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches4 repliesSuperseded

Changes in v4 from the cover letter

1) Fixed a mistake when using div_u64 that would break the kernel build

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: Add the capability of getting commit statsfs/btrfs/ctree.h fs/btrfs/transaction.c+36 -00 replies
2/2btrfs: Expose the commit stats through sysfsfs/btrfs/sysfs.c+45 -00 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchNikolay Borisov
SeriesR-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/2] btrfs: Expose commit stats through sysfs

With this patch series we add the capability to btrfs to expose some commit stats through sysfs that might be useful for performance monitoring and debugging purposes.

Specifically, through sysfs we expose the following data:
1) A counter for the commits that occurred so far.
2) The duration in ms of the last commit.
3) The maximum commit duration in ms seen so far.
4) The total duration in ms of the commits seen so far.

The user also has the capability to reset the maximum commit duration back to zero, again through sysfs.

Changes from v3:

1) Fixed a mistake when using div_u64 that would break the kernel build

Changes from v2:

1) Only the maximum duration can now be zeroed out through sysfs to prevent loss of data if multiple threads try to reset the commit stats simultaneously
2) Removed the lock that protected the concurrent resetting and updating of the commit stats, since only the maximum commit duration can be cleared out now (any races can be ignored for this stat).
3) Added div_u64 when converting from ns to ms, to also support 32-bit
4) Made the output from sysfs easier to use with "grep"

Changes from v1:

1) Edited out unnecessary comments
2) Made the memory allocation of "btrfs_commit_stats" under "fs_info" in fs/btrfs/ctree.h static instead of dynamic
3) Transferred the conversion from ns to ms at the point where commit stats get printed in sysfs, for better precision
4) Changed the lock that protects the update of the commit stats from "trans_lock" to "super_lock"
5) Changed the printing of the commits stats in sysfs to conform with the sysfs output

Ioannis Angelakopoulos (2):
btrfs: Add the capability of getting commit stats
btrfs: Expose the commit stats through sysfs

 fs/btrfs/ctree.h       | 14 +++++++++++++
 fs/btrfs/sysfs.c       | 45 ++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/transaction.c | 22 +++++++++++++++++++++
 3 files changed, 81 insertions(+)
Signature · 1 line
2.30.2