MCPcopy Create free account
hub / github.com/F-Stack/f-stack / load_zfeature

Function load_zfeature

freebsd/contrib/openzfs/module/zfs/dsl_dataset.c:367–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367static int
368load_zfeature(objset_t *mos, dsl_dataset_t *ds, spa_feature_t f)
369{
370 int err = 0;
371 switch (spa_feature_table[f].fi_type) {
372 case ZFEATURE_TYPE_BOOLEAN:
373 err = zap_contains(mos, ds->ds_object,
374 spa_feature_table[f].fi_guid);
375 if (err == 0) {
376 ds->ds_feature[f] = (void *)B_TRUE;
377 } else {
378 ASSERT3U(err, ==, ENOENT);
379 err = 0;
380 }
381 break;
382 case ZFEATURE_TYPE_UINT64_ARRAY:
383 {
384 uint64_t int_size, num_int;
385 uint64_t *data;
386 err = zap_length(mos, ds->ds_object,
387 spa_feature_table[f].fi_guid, &int_size, &num_int);
388 if (err != 0) {
389 ASSERT3U(err, ==, ENOENT);
390 err = 0;
391 break;
392 }
393 ASSERT3U(int_size, ==, sizeof (uint64_t));
394 data = kmem_alloc(int_size * num_int, KM_SLEEP);
395 VERIFY0(zap_lookup(mos, ds->ds_object,
396 spa_feature_table[f].fi_guid, int_size, num_int, data));
397 struct feature_type_uint64_array_arg *ftuaa =
398 kmem_alloc(sizeof (*ftuaa), KM_SLEEP);
399 ftuaa->length = num_int;
400 ftuaa->array = data;
401 ds->ds_feature[f] = ftuaa;
402 break;
403 }
404 default:
405 panic("Invalid zfeature type %d", spa_feature_table[f].fi_type);
406 }
407 return (err);
408}
409
410/*
411 * We have to release the fsid synchronously or we risk that a subsequent

Callers 1

dsl_dataset_hold_objFunction · 0.85

Calls 4

zap_containsFunction · 0.85
zap_lengthFunction · 0.85
zap_lookupFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected