DDT: Switch to using ZAP _by_dnode() interfaces

As was previously done for BRT, avoid holding/releasing DDT ZAP
dnodes for every access.  Instead hold the dnodes during all their
life time, never releasing.

While at this, add _by_dnode() interfaces for zap_length_uint64()
and zap_count(), actively used by DDT code.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com>
Closes #18047
This commit is contained in:
Alexander Motin
2025-12-15 12:49:14 -05:00
committed by GitHub
parent 46d6f1fe56
commit ff5414406f
6 changed files with 132 additions and 63 deletions
+1
View File
@@ -326,6 +326,7 @@ typedef struct {
/* per-type/per-class entry store objects */
uint64_t ddt_object[DDT_TYPES][DDT_CLASSES];
dnode_t *ddt_object_dnode[DDT_TYPES][DDT_CLASSES];
/* object ids for stored, logged and per-type/per-class stats */
uint64_t ddt_stat_object;
+11 -14
View File
@@ -163,21 +163,18 @@ typedef struct {
int (*ddt_op_create)(objset_t *os, uint64_t *object, dmu_tx_t *tx,
boolean_t prehash);
int (*ddt_op_destroy)(objset_t *os, uint64_t object, dmu_tx_t *tx);
int (*ddt_op_lookup)(objset_t *os, uint64_t object,
const ddt_key_t *ddk, void *phys, size_t psize);
int (*ddt_op_contains)(objset_t *os, uint64_t object,
const ddt_key_t *ddk);
void (*ddt_op_prefetch)(objset_t *os, uint64_t object,
const ddt_key_t *ddk);
void (*ddt_op_prefetch_all)(objset_t *os, uint64_t object);
int (*ddt_op_update)(objset_t *os, uint64_t object,
const ddt_key_t *ddk, const void *phys, size_t psize,
int (*ddt_op_lookup)(dnode_t *dn, const ddt_key_t *ddk,
void *phys, size_t psize);
int (*ddt_op_contains)(dnode_t *dn, const ddt_key_t *ddk);
void (*ddt_op_prefetch)(dnode_t *dn, const ddt_key_t *ddk);
void (*ddt_op_prefetch_all)(dnode_t *dn);
int (*ddt_op_update)(dnode_t *dn, const ddt_key_t *ddk,
const void *phys, size_t psize, dmu_tx_t *tx);
int (*ddt_op_remove)(dnode_t *dn, const ddt_key_t *ddk,
dmu_tx_t *tx);
int (*ddt_op_remove)(objset_t *os, uint64_t object,
const ddt_key_t *ddk, dmu_tx_t *tx);
int (*ddt_op_walk)(objset_t *os, uint64_t object, uint64_t *walk,
ddt_key_t *ddk, void *phys, size_t psize);
int (*ddt_op_count)(objset_t *os, uint64_t object, uint64_t *count);
int (*ddt_op_walk)(dnode_t *dn, uint64_t *walk, ddt_key_t *ddk,
void *phys, size_t psize);
int (*ddt_op_count)(dnode_t *dn, uint64_t *count);
} ddt_ops_t;
extern const ddt_ops_t ddt_zap_ops;
+3
View File
@@ -288,6 +288,8 @@ int zap_length(objset_t *ds, uint64_t zapobj, const char *name,
uint64_t *integer_size, uint64_t *num_integers);
int zap_length_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key,
int key_numints, uint64_t *integer_size, uint64_t *num_integers);
int zap_length_uint64_by_dnode(dnode_t *dn, const uint64_t *key,
int key_numints, uint64_t *integer_size, uint64_t *num_integers);
/*
* Remove the specified attribute.
@@ -309,6 +311,7 @@ int zap_remove_uint64_by_dnode(dnode_t *dn, const uint64_t *key,
* object.
*/
int zap_count(objset_t *ds, uint64_t zapobj, uint64_t *count);
int zap_count_by_dnode(dnode_t *dn, uint64_t *count);
/*
* Returns (in name) the name of the entry whose (value & mask)