-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expose dataset encryption status via fast stat path #17368
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
base: master
Are you sure you want to change the base?
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 posting the pahole output to confirm there was, just enough, padding available. My only concern is that when running the new library with old kmods zfs_is_encrypt()
will return 0 even for encrypted datasets. We should consider unconditionally setting one of the unused bits in dds_is_encrypted
to indicate the returned boolean is valid.
@behlendorf - That’s a great suggestion. I’ve incorporated it in the latest push! |
In truenas_pylibzfs, we query list of encrypted datasets several times, which is expensive. This commit exposes a public API zfs_is_encrypted() to get encryption status from fast stat path without having to refresh the properties. Signed-off-by: Ameer Hamza <[email protected]>
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.
This is basically setting up an extension mechanism for this object, and so I think I would prefer this to be (say) dds_flags
, with an enum:
typedef enum {
DDS_FLAG_ENCRYPTED = (1<<0),
DDS_FLAG_HAS_FLAGS = (1<<7),
} dmu_objset_flag_t;
I won't insist right now, but at the very least, please add comments to explain the magic constant 0x80.
Motivation and Context
In
truenas_pylibzfs
, we query list of encrypted datasets several times, which is expensive. This commit exposes a public APIzfs_is_encrypted()
to get encryption status from fast stat path without having to refresh the properties.Description
This change adds a new field,
dds_is_encrypted
, to thedmu_objset_stats
structure. The field is inserted into the existing padding afterdds_origin
and does not increase the structure size or alter the position of existing members. This ensures backward compatibility between kernel and user-space consumers ofdmu_objset_stats
, such aszfs_cmd_t
used by IOCTLs.Before this commit:
After this commit:
How Has This Been Tested?
Manually invoked
zfs_is_encrypted()
inzfs_main.c
to validate that it returns the correct encryption status.Types of changes
Checklist:
Signed-off-by
.