Expose dataset encryption status via fast stat path

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.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #17368
This commit is contained in:
Ameer Hamza
2025-05-27 07:11:03 +05:00
committed by Brian Behlendorf
parent 2fe0d5df94
commit 1215c3b609
6 changed files with 32 additions and 0 deletions
+3
View File
@@ -2886,6 +2886,9 @@ dsl_dataset_fast_stat(dsl_dataset_t *ds, dmu_objset_stats_t *stat)
stat->dds_guid = dsl_get_guid(ds);
stat->dds_redacted = dsl_get_redacted(ds);
stat->dds_origin[0] = '\0';
stat->dds_flags = DDS_FLAG_HAS_ENCRYPTED;
if (ds->ds_dir->dd_crypto_obj != 0)
stat->dds_flags |= DDS_FLAG_ENCRYPTED;
if (ds->ds_is_snapshot) {
stat->dds_is_snapshot = B_TRUE;
stat->dds_num_clones = dsl_get_numclones(ds);