| 937 | } |
| 938 | |
| 939 | uint64_t |
| 940 | dsl_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 | |
| 981 | boolean_t |
| 982 | dsl_dir_is_clone(dsl_dir_t *dd) |
no test coverage detected