Repository navigation
Read disk statistics from devstat on DragonFly BSD - #3791
Conversation
DragonFly BSD inherited FreeBSD's disk enumeration, which needs iostat -x and geom. DragonFly has neither, so getDiskStores returned no disks. Add DragonFlyBsdHWDiskStore in oshi-common, which parses the struct devstat records in the kern.devstat.all sysctl: an 8-byte generation counter, then one 200-byte record per device. The offsets are from sys/devicestat.h on x86_64, the only architecture DragonFly supports, and were checked against bytes read on a DragonFly 6.4 guest. A disk is reported when it appears in both kern.disks and devstat, so unconfigured vnode disks are skipped. Reads, writes, bytes, queue length and busy time come from the record. The JNA and FFM HALs only fetch the sysctl's bytes. The model, serial number, size and partitions are readable only through the disk devices, which are root-only on DragonFly, so they remain unknown. NativeComparisonTest no longer skips diskStoreUpdateAttributes on DragonFly. Verified on DragonFly BSD 6.4 (cfarm152), JNA and FFM: vbd0 and md0 listed with growing counters; oshi-common, oshi-core and oshi-core-ffm test suites and -Pnative-comparison pass.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Disks remain available, though transfer time can lag during sustained I/O and catch up afterward. This does not block merging. Pre-merge checks |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3791 +/- ##
============================================
- Coverage 80.61% 80.56% -0.05%
- Complexity 320 547 +227
============================================
Files 724 725 +1
Lines 26027 26066 +39
Branches 4401 4408 +7
============================================
+ Hits 20981 21001 +20
- Misses 2799 2819 +20
+ Partials 2247 2246 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes
getDiskStoreson DragonFly BSD, which returned no disks: the inherited FreeBSD code needsiostat -xandgeom, and DragonFly has neither.Change
DragonFlyBsdHWDiskStoreinoshi-common(new packageoshi.hardware.common.platform.unix.dragonflybsd) parses thestruct devstatrecords in thekern.devstat.allsysctl: an 8-byte generation counter, then one 200-byte record per device. Offsets are fromsys/devicestat.hon x86_64, the only architecture DragonFly supports, and were checked against bytes read on a live system.kern.disksand devstat, so unconfigured vnode disks (vn0–vn3) are skipped.getDiskStoresand only fetch the sysctl's bytes.NativeComparisonTest.diskStoreUpdateAttributesno longer skips DragonFly.Not covered
Model, serial number, size and partitions are only readable through the disk devices, which are
root:operator 0640on DragonFly, so they remainunknown/ 0 / empty. The boot log names the controller (vtblk0), not the disk (vbd0), so it can't fill these in reliably.Verification
DragonFly BSD 6.4 (cfarm152), JDK 25:
vbd0(87.6M reads / 5.2 TiB, 638M writes / 38 TiB) andmd0, with counters growing between runs.oshi-common,oshi-coreandoshi-core-ffmtest suites pass, includingDisksTest.-Pnative-comparison:diskStoresanddiskStoreUpdateAttributespass.Summary by CodeRabbit