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
+5 -3
View File
@@ -870,13 +870,14 @@ dsl_bookmark_init_ds(dsl_dataset_t *ds)
int err = 0;
zap_cursor_t zc;
zap_attribute_t attr;
zap_attribute_t *attr;
attr = zap_attribute_alloc();
for (zap_cursor_init(&zc, mos, ds->ds_bookmarks_obj);
(err = zap_cursor_retrieve(&zc, &attr)) == 0;
(err = zap_cursor_retrieve(&zc, attr)) == 0;
zap_cursor_advance(&zc)) {
dsl_bookmark_node_t *dbn =
dsl_bookmark_node_alloc(attr.za_name);
dsl_bookmark_node_alloc(attr->za_name);
err = dsl_bookmark_lookup_impl(ds,
dbn->dbn_name, &dbn->dbn_phys);
@@ -888,6 +889,7 @@ dsl_bookmark_init_ds(dsl_dataset_t *ds)
avl_add(&ds->ds_bookmarks, dbn);
}
zap_cursor_fini(&zc);
zap_attribute_free(attr);
if (err == ENOENT)
err = 0;
return (err);