Skip to content

feat(xfs): add Linux 7.0 XFS statistics fields#810

Open
dongjiang1989 wants to merge 1 commit into
prometheus:masterfrom
dongjiang1989:updata-xfs-for-7.0
Open

feat(xfs): add Linux 7.0 XFS statistics fields#810
dongjiang1989 wants to merge 1 commit into
prometheus:masterfrom
dongjiang1989:updata-xfs-for-7.0

Conversation

@dongjiang1989
Copy link
Copy Markdown
Contributor

ref: https://elixir.bootlin.com/linux/v7.0/source/fs/xfs/xfs_stats.c

Summary

  • Update XFS statistics parsing to match the Linux 7.0 kernel (fs/xfs/xfs_stats.c)
  • Add support for 9 new btree stat groups: fibt2, rmapbt, refcntbt, rmapbt_mem, rcbagbt, rtrmapbt, rtrmapbt_mem, rtrefcntbt, rtrefcntbt — each with 15
    counters (lookup, compare, insrec, delrec, newroot, killroot, increment, decrement, lshift, rshift, split, join, alloc, free, moves)
  • Add 2 new stat groups: zoned (gc_read_calls, gc_bytes) and metafile (inodes, meta)
  • Add defer_relog (uint64) and gc xpc (uint64) extended precision counters
  • Add trailing comments with proc label names to all Stats struct fields for easier reference
  • Update test fixtures (proc and sys) to include all new fields
  • Add unit tests for all new stat groups (happy path + invalid count cases)

Test plan

  • go vet ./xfs/... passes
  • go test ./xfs/... passes (TestParseStats, TestReadProcStat, TestReadSysStats)
  • New inline tests cover bad/good cases for: fibt2, rmapbt, refcntbt, rmapbt_mem, rcbagbt, rtrmapbt, rtrmapbt_mem, rtrefcntbt, zoned, metafile, defer_relog, gc xpc

@dongjiang1989
Copy link
Copy Markdown
Contributor Author

Hi @SuperQ , PTAL, thanks.

Signed-off-by: dongjiang <dongjiang1989@126.com>
@dongjiang1989
Copy link
Copy Markdown
Contributor Author

@discordianfish, @SuperQ Hi, I would appreciate your review of this PR. Thank you.

@stanhu
Copy link
Copy Markdown

stanhu commented May 22, 2026

@SuperQ Hope you are well. It looks like we received a bug report around this as well in https://gitlab.com/gitlab-org/omnibus-gitlab/-/work_items/9876.

@DragonWork
Copy link
Copy Markdown

@dongjiang1989 I just tested your PR. Thanks!

It does need some further adjustments though, I get this error with Linux 7.0.7:

level=ERROR source=collector.go:168 msg="collector failed" name=xfs duration_seconds=0.000168223 err="failed to retrieve XFS stats: incorrect number of values for zoned stats: 3"
# cat /sys/fs/xfs/stats/stats
extent_alloc 4841 1382197 3198 1341523
abt 0 0 0 0
blk_map 2115317 2567929 18137 12841 12363 5130917 0
bmbt 0 0 0 0
dir 669509 14982 13231 155344
trans 1 184826 0
ig 656660 133557 0 523103 0 269933 8926
log 6444 80186 36 6343 5938
push_ail 187025 0 123178 16362 0 2882 1133 318 0 318
xstrat 4612 0
rw 2516859 5862583
attr 43947 21 23 2446
icluster 0 6036 18228
vnodes 253170 0 0 0 278269 278269 278269 0
buf 2879784 35660 2844127 2677019 2487 35657 10 0 35347
abtb2 13643 138539 706 795 0 0 26 0 26 0 0 0 0 0 502133
abtc2 26954 261791 7513 7602 0 0 42 9 32 4 0 0 0 0 4377106
bmbt2 1139 7786 139 90 0 0 0 0 0 0 0 0 0 0 1307
ibt2 28009 311571 63 42 0 0 0 0 1 0 0 0 0 0 4354
fibt2 41067 163441 8178 8255 0 0 0 0 0 0 0 0 0 0 34399
rmapbt 27442 493733 6653 4919 0 0 1540 1437 1007 1063 22 5 22 5 1032463
refcntbt 17690 177736 1608 1608 0 0 82 13 13 66 1 1 1 1 468361
rmapbt_mem 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
rcbagbt 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
rtrmapbt 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
rtrmapbt_mem 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
rtrefcntbt 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
qm 0 0 0 0 0 0 0 0
zoned 0 0 0
metafile 0
xpc 5113102336 7894530294 22776079333
defer_relog 1
debug 0
gc xpc 0

@DragonWork
Copy link
Copy Markdown

@dongjiang1989 I sent you a PR on your fork to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants