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
+1
View File
@@ -591,6 +591,7 @@ _LIBZFS_H int zfs_crypto_attempt_load_keys(libzfs_handle_t *, const char *);
_LIBZFS_H int zfs_crypto_load_key(zfs_handle_t *, boolean_t, const char *);
_LIBZFS_H int zfs_crypto_unload_key(zfs_handle_t *);
_LIBZFS_H int zfs_crypto_rewrap(zfs_handle_t *, nvlist_t *, boolean_t);
_LIBZFS_H boolean_t zfs_is_encrypted(zfs_handle_t *);
typedef struct zprop_list {
int pl_prop;
+6
View File
@@ -980,6 +980,11 @@ void dmu_object_size_from_db(dmu_buf_t *db, uint32_t *blksize,
void dmu_object_dnsize_from_db(dmu_buf_t *db, int *dnsize);
typedef enum {
DDS_FLAG_ENCRYPTED = (1<<0),
DDS_FLAG_HAS_ENCRYPTED = (1<<7),
} dmu_objset_flag_t;
typedef struct dmu_objset_stats {
uint64_t dds_num_clones; /* number of clones of this */
uint64_t dds_creation_txg;
@@ -989,6 +994,7 @@ typedef struct dmu_objset_stats {
uint8_t dds_inconsistent;
uint8_t dds_redacted;
char dds_origin[ZFS_MAX_DATASET_NAME_LEN];
uint8_t dds_flags; /* dmu_objset_flag_t */
} dmu_objset_stats_t;
/*