Allocate zap_attribute_t from kmem instead of stack

This patch is preparatory work for long name feature. It changes all
users of zap_attribute_t to allocate it from kmem instead of stack. It
also make zap_attribute_t and zap_name_t structure variable length.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #15921
This commit is contained in:
Sanjeev Bagewadi
2021-02-02 13:54:15 +00:00
committed by Brian Behlendorf
parent 141368a4b6
commit 3cf2bfa570
35 changed files with 513 additions and 365 deletions
+2 -2
View File
@@ -674,7 +674,7 @@ dsl_dataset_get_holds(const char *dsname, nvlist_t *nvl)
zap_attribute_t *za;
zap_cursor_t zc;
za = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP);
za = zap_attribute_alloc();
for (zap_cursor_init(&zc, ds->ds_dir->dd_pool->dp_meta_objset,
dsl_dataset_phys(ds)->ds_userrefs_obj);
zap_cursor_retrieve(&zc, za) == 0;
@@ -683,7 +683,7 @@ dsl_dataset_get_holds(const char *dsname, nvlist_t *nvl)
za->za_first_integer);
}
zap_cursor_fini(&zc);
kmem_free(za, sizeof (zap_attribute_t));
zap_attribute_free(za);
}
dsl_dataset_rele(ds, FTAG);
dsl_pool_rele(dp, FTAG);