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

Function dsl_dir_create_sync

freebsd/contrib/openzfs/module/zfs/dsl_dir.c:939–979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937}
938
939uint64_t
940dsl_dir_create_sync(dsl_pool_t *dp, dsl_dir_t *pds, const char *name,
941 dmu_tx_t *tx)
942{
943 objset_t *mos = dp->dp_meta_objset;
944 uint64_t ddobj;
945 dsl_dir_phys_t *ddphys;
946 dmu_buf_t *dbuf;
947
948 ddobj = dmu_object_alloc(mos, DMU_OT_DSL_DIR, 0,
949 DMU_OT_DSL_DIR, sizeof (dsl_dir_phys_t), tx);
950 if (pds) {
951 VERIFY0(zap_add(mos, dsl_dir_phys(pds)->dd_child_dir_zapobj,
952 name, sizeof (uint64_t), 1, &ddobj, tx));
953 } else {
954 /* it's the root dir */
955 VERIFY0(zap_add(mos, DMU_POOL_DIRECTORY_OBJECT,
956 DMU_POOL_ROOT_DATASET, sizeof (uint64_t), 1, &ddobj, tx));
957 }
958 VERIFY0(dmu_bonus_hold(mos, ddobj, FTAG, &dbuf));
959 dmu_buf_will_dirty(dbuf, tx);
960 ddphys = dbuf->db_data;
961
962 ddphys->dd_creation_time = gethrestime_sec();
963 if (pds) {
964 ddphys->dd_parent_obj = pds->dd_object;
965
966 /* update the filesystem counts */
967 dsl_fs_ss_count_adjust(pds, 1, DD_FIELD_FILESYSTEM_COUNT, tx);
968 }
969 ddphys->dd_props_zapobj = zap_create(mos,
970 DMU_OT_DSL_PROPS, DMU_OT_NONE, 0, tx);
971 ddphys->dd_child_dir_zapobj = zap_create(mos,
972 DMU_OT_DSL_DIR_CHILD_MAP, DMU_OT_NONE, 0, tx);
973 if (spa_version(dp->dp_spa) >= SPA_VERSION_USED_BREAKDOWN)
974 ddphys->dd_flags |= DD_FLAG_USED_BREAKDOWN;
975
976 dmu_buf_rele(dbuf, FTAG);
977
978 return (ddobj);
979}
980
981boolean_t
982dsl_dir_is_clone(dsl_dir_t *dd)

Callers 4

dsl_dataset_create_syncFunction · 0.85
dsl_pool_createFunction · 0.85

Calls 10

dmu_object_allocFunction · 0.85
zap_addFunction · 0.85
dmu_bonus_holdFunction · 0.85
dmu_buf_will_dirtyFunction · 0.85
dsl_fs_ss_count_adjustFunction · 0.85
zap_createFunction · 0.85
spa_versionFunction · 0.85
dmu_buf_releFunction · 0.85
dsl_dir_physFunction · 0.50
gethrestime_secFunction · 0.50

Tested by

no test coverage detected