-
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
Support setting user properties in a channel program #9950
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9950 +/- ##
==========================================
+ Coverage 79.18% 79.21% +0.02%
==========================================
Files 385 386 +1
Lines 122382 122424 +42
==========================================
+ Hits 96904 96973 +69
+ Misses 25478 25451 -27
Continue to review full report at Codecov.
|
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. This looks good just a couple tiny nits.
tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.set_props.ksh
Outdated
Show resolved
Hide resolved
tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.set_props.ksh
Outdated
Show resolved
Hide resolved
tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.set_props.ksh
Show resolved
Hide resolved
tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.set_props.zcp
Outdated
Show resolved
Hide resolved
tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.set_props.zcp
Show resolved
Hide resolved
tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.set_props.zcp
Outdated
Show resolved
Hide resolved
module/zfs/zcp_set.c
Outdated
static int | ||
zcp_set_user_prop(lua_State *state, dsl_pool_t *dp, const char *dsname, |
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.
Since this is essentially a helper for the _sync() func, I'm not sure it makes sense for this to return a value, since it "can't fail" (except via longjmp)
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.
I'll change it to void
tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.set_props.zcp
Outdated
Show resolved
Hide resolved
bffa109
to
5ebc78e
Compare
This adds support for setting user properties in a zfs channel program by adding 'zfs.sync.set_prop' and 'zfs.check.set_prop' to the ZFS LUA API. Contributions-by: Jason King <jason.king@joyent.com> Signed-off-by: Sara Hartse <sara.hartse@delphix.com> Signed-off-by: Jason King <jason.king@joyent.com>
8d328b3
to
4d24afc
Compare
Should be all squashed and rebased to current now... I think I've addressed all the comments (at least so far).. |
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.
Looks good!
This adds support for setting user properties in a zfs channel program by adding 'zfs.sync.set_prop' and 'zfs.check.set_prop' to the ZFS LUA API. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matt Ahrens <matt@delphix.com> Co-authored-by: Sara Hartse <sara.hartse@delphix.com> Contributions-by: Jason King <jason.king@joyent.com> Signed-off-by: Sara Hartse <sara.hartse@delphix.com> Signed-off-by: Jason King <jason.king@joyent.com> Closes openzfs#9950
This adds support for setting user properties in a
zfs channel program by adding 'zfs.sync.set_prop'
and 'zfs.check.set_prop' to the ZFS LUA API.
Motivation and Context
Work in SmartOS utilities this features, and it seems generally useful enough that the broader ZFS community might also find it useful. This change is limited to only zfs user properties. Setting user properties is all our work required, and that seems a useful delineation point--handling non-user properties in a channel program is a far more complex proposition (though nothing in this work should preclude extending it to support non-user properties in the future).
Description
This just adds the two new channel programs
zfs.sync.set_prop
andzfs.check.set_prop
. They validate the property is a user property (and returnEINVAL
if the property is not a user property), and then set the property.How Has This Been Tested?
This has been in use in a SmartOS development branch for several months (aside from paths, the code is identical between OpenZFS and illumos ZFS) without issue. In addition, a new test for the zfs test suite has been added which sets and verifies a user property in a channel program.
Types of changes
Checklist:
Signed-off-by
.Contributions-by: Jason King jason.king@joyent.com
Signed-off-by: Sara Hartse sara.hartse@delphix.com
Signed-off-by: Jason King jason.king@joyent.com