Lines Matching refs:dir
45 struct zfs_dsl_dir *dir; /* containing parent */ member
69 static zfs_dsl_dataset_t *dsl_dataset_alloc(zfs_opt_t *zfs, zfs_dsl_dir_t *dir);
99 dsl_dir_get_mountpoint(zfs_opt_t *zfs, zfs_dsl_dir_t *dir) in dsl_dir_get_mountpoint() argument
104 if (nvlist_find_string(dir->propsnv, "mountpoint", &mountpoint) == 0) { in dsl_dir_get_mountpoint()
114 for (pdir = dir->parent, mountpoint = estrdup(dir->name);; in dsl_dir_get_mountpoint()
142 dsl_dir_get_canmount(zfs_dsl_dir_t *dir, uint64_t *canmountp) in dsl_dir_get_canmount() argument
144 return (nvlist_find_uint64(dir->propsnv, "canmount", canmountp)); in dsl_dir_get_canmount()
155 dsl_dir_set_prop(zfs_opt_t *zfs, zfs_dsl_dir_t *dir, const char *key, in dsl_dir_set_prop() argument
160 nvl = dir->propsnv; in dsl_dir_set_prop()
204 zfs_dsl_dir_t *dir; in dsl_metadir_alloc() local
208 dir = dsl_dir_alloc(zfs, path); in dsl_metadir_alloc()
210 return (dir); in dsl_metadir_alloc()
231 zfs_dsl_dir_t *dir; in dsl_init() local
264 dir = zfs->rootdsldir; in dsl_init()
275 dir = dsl_dir_alloc(zfs, dsname); in dsl_init()
276 dir->headds = dsl_dataset_alloc(zfs, dir); in dsl_init()
286 dsl_dir_set_prop(zfs, dir, key, val); in dsl_init()
301 dsl_dir_id(zfs_dsl_dir_t *dir) in dsl_dir_id() argument
303 return (dir->dirid); in dsl_dir_id()
307 dsl_dir_dataset_id(zfs_dsl_dir_t *dir) in dsl_dir_dataset_id() argument
309 return (dir->headds->dsid); in dsl_dir_dataset_id()
335 dsl_dir_fullname(const zfs_dsl_dir_t *dir) in dsl_dir_fullname() argument
337 return (dir->fullname); in dsl_dir_fullname()
354 zfs_dsl_dir_t *dir, *parent; in dsl_dir_alloc() local
359 dir = ecalloc(1, sizeof(*dir)); in dsl_dir_alloc()
362 DMU_OT_DSL_DIR, sizeof(dsl_dir_phys_t), &dir->dirid); in dsl_dir_alloc()
363 dir->phys = (dsl_dir_phys_t *)DN_BONUS(dnode); in dsl_dir_alloc()
366 dir->propszap = zap_alloc(zfs->mos, dnode); in dsl_dir_alloc()
370 dir->childzap = zap_alloc(zfs->mos, dnode); in dsl_dir_alloc()
372 dir->propsnv = nvlist_create(NV_UNIQUE_NAME); in dsl_dir_alloc()
373 STAILQ_INIT(&dir->children); in dsl_dir_alloc()
375 dir->phys->dd_child_dir_zapobj = childid; in dsl_dir_alloc()
376 dir->phys->dd_props_zapobj = propsid; in dsl_dir_alloc()
382 dir->name = estrdup(zfs->poolname); in dsl_dir_alloc()
383 dir->fullname = estrdup(zfs->poolname); in dsl_dir_alloc()
384 dir->parent = NULL; in dsl_dir_alloc()
385 dir->phys->dd_parent_obj = 0; in dsl_dir_alloc()
388 zfs->rootdsldir = dir; in dsl_dir_alloc()
389 return (dir); in dsl_dir_alloc()
415 dir->fullname = estrdup(name); in dsl_dir_alloc()
416 dir->name = estrdup(dirname); in dsl_dir_alloc()
418 STAILQ_INSERT_TAIL(lp, dir, next); in dsl_dir_alloc()
419 zap_add_uint64(parent->childzap, dir->name, dir->dirid); in dsl_dir_alloc()
421 dir->parent = parent; in dsl_dir_alloc()
422 dir->phys->dd_parent_obj = parent->dirid; in dsl_dir_alloc()
423 return (dir); in dsl_dir_alloc()
427 dsl_dir_size_add(zfs_dsl_dir_t *dir, uint64_t bytes) in dsl_dir_size_add() argument
429 dir->phys->dd_used_bytes += bytes; in dsl_dir_size_add()
430 dir->phys->dd_compressed_bytes += bytes; in dsl_dir_size_add()
431 dir->phys->dd_uncompressed_bytes += bytes; in dsl_dir_size_add()
452 dsl_dir_finalize_props(zfs_dsl_dir_t *dir) in dsl_dir_finalize_props() argument
455 (nvh = nvlist_next_nvpair(dir->propsnv, nvh)) != NULL;) { in dsl_dir_finalize_props()
470 zap_add_uint64(dir->propszap, name, val); in dsl_dir_finalize_props()
479 zap_add_string(dir->propszap, name, val); in dsl_dir_finalize_props()
491 dsl_dir_finalize(zfs_opt_t *zfs, zfs_dsl_dir_t *dir, void *arg __unused) in dsl_dir_finalize() argument
499 dsl_dir_finalize_props(dir); in dsl_dir_finalize()
500 zap_write(zfs, dir->propszap); in dsl_dir_finalize()
501 zap_write(zfs, dir->childzap); in dsl_dir_finalize()
503 headds = dir->headds; in dsl_dir_finalize()
514 dir->phys->dd_head_dataset_obj = headds->dsid; in dsl_dir_finalize()
515 dir->phys->dd_clone_parent_obj = zfs->snapds->dsid; in dsl_dir_finalize()
529 STAILQ_FOREACH(cdir, &dir->children, next) { in dsl_dir_finalize()
537 if (dir == zfs->rootdsldir && cdir == zfs->mosdsldir) in dsl_dir_finalize()
541 dsl_dir_size_add(dir, bytes + childbytes); in dsl_dir_finalize()
543 dir->phys->dd_flags |= DD_FLAG_USED_BREAKDOWN; in dsl_dir_finalize()
544 dir->phys->dd_used_breakdown[DD_USED_HEAD] = bytes; in dsl_dir_finalize()
545 dir->phys->dd_used_breakdown[DD_USED_CHILD] = childbytes; in dsl_dir_finalize()
582 dsl_dir_dataset_write(zfs_opt_t *zfs, zfs_objset_t *os, zfs_dsl_dir_t *dir) in dsl_dir_dataset_write() argument
584 dir->headds->os = os; in dsl_dir_dataset_write()
589 dsl_dir_has_dataset(zfs_dsl_dir_t *dir) in dsl_dir_has_dataset() argument
591 return (dir->headds != NULL); in dsl_dir_has_dataset()
595 dsl_dir_dataset_has_objset(zfs_dsl_dir_t *dir) in dsl_dir_dataset_has_objset() argument
597 return (dsl_dir_has_dataset(dir) && dir->headds->os != NULL); in dsl_dir_dataset_has_objset()
601 dsl_dataset_alloc(zfs_opt_t *zfs, zfs_dsl_dir_t *dir) in dsl_dataset_alloc() argument
617 ds->phys->ds_dir_obj = dir->dirid; in dsl_dataset_alloc()
623 ds->dir = dir; in dsl_dataset_alloc()