-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZTS: new kstat helper #16950
base: master
Are you sure you want to change the base?
ZTS: new kstat helper #16950
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this. Few issues I spotted:
tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh
Outdated
Show resolved
Hide resolved
02c914a
to
e8e8626
Compare
Nice cleanup! I suspect future generations will re-implement
|
e079b6f
to
e52acd7
Compare
Alright, here's v2, dealing with some of the complications. Top post updated. |
I did at first (as you see, it's removed in a separate commit). It seemed not worth keeping - it did nothing of interest, but looked different to other things, inviting questions like "why is this special?" and "why aren't other things not special?" I don't think anyone will bother implementing it, because there's nothing gained from doing so, and nothing in the existing code to even give the idea. But, if they do, at least it will work properly :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Just few comments:
The old kstat helper function was barely used, I suspect in part because it was very limited in the kinds of kstats it could gather. This adds new functions to replace it, for each kind of thing that can have stats: global, pool and dataset. There's options in there to get a single stat value, or all values within a group. Most importantly, the interface is the same for both platforms. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
Removes other custom helpers and direct accesses to /proc. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
It's now a simple wrapper, so lets just call kstat direct. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
[Sponsors: Klara, Inc., Wasabi Technology, Inc.]
Motivation and Context
Tests use a wide range of methods to get at kstat values. This is error prone, and usually ends up limiting the test to a single platform.
This came up again in #16947, and I decided to just fix it.
Description
libtest.shlib
had akstat
helper that was barely used, I suspect in part because it was very limited in the kinds of kstats it could gather. This adds new functions to replace it, for each kind of thing that can have stats: global, pool and dataset. There's options in there to get a single stat value, or all values within a group.Most importantly, the interface is the same for both platforms. This is quite complicated, but will be worth it when its very easy to use kstats from within test.
See comments at stop of
kstat.shlib
for the detail..After that, all existing uses of kstats, through either the old
kstat
orget_arcstat
helpers, or directly through/proc/spl/kstat/zfs
orsysctl
, have been updated to use the new functions.Actually, almost all. I've left the
procfs
test suite for now, since it is explicitly testing the/proc/spl/kstat/zfs
interface.Mostly this has been a mechanical conversion, but some tests have been adjusted slightly to not assume things about kstat name structure or data format.
I have not looked closely, but this also might make it easier for some of the platform-specific tests to work everywhere. That's an exercise for the future.
How Has This Been Tested?
All modified tests have passed on Linux and FreeBSD.
Types of changes
Checklist:
Signed-off-by
.