/* * The transaction passed to this routine must have * dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, ...) called and then assigned * to a transaction group. * * Using ZAP_FLAG_HASH64 will force the ZAP to always be a FAT ZAP. * This is fine for directories today, because storing the FID in the dirent * will also require a FAT ZAP. If there is a new type of micro ZAP created * then we might need to re-evaluate the use of this flag and instead do * a conversion from the different internal ZAP hash formats being used. */ int __osd_zap_create(const struct lu_env *env, udmu_objset_t *uos, dmu_buf_t **zap_dbp, dmu_tx_t *tx, struct lu_attr *la, void *tag, zap_flags_t flags) { uint64_t oid; int rc; LASSERT(tag); spin_lock(&uos->lock); uos->objects++; spin_unlock(&uos->lock); /* Assert that the transaction has been assigned to a transaction group. */ LASSERT(tx->tx_txg != 0); oid = zap_create_flags(uos->os, 0, flags | ZAP_FLAG_HASH64, DMU_OT_DIRECTORY_CONTENTS, 12, 12, DMU_OT_SA, DN_MAX_BONUSLEN, tx); rc = -sa_buf_hold(uos->os, oid, tag, zap_dbp); if (rc) return rc; LASSERT(la->la_valid & LA_MODE); la->la_size = 2; la->la_nlink = 1; return __osd_attr_init(env, uos, oid, tx, la); }
/* * The transaction passed to this routine must have * dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, ...) called and then assigned * to a transaction group. * * Using ZAP_FLAG_HASH64 will force the ZAP to always be a FAT ZAP. * This is fine for directories today, because storing the FID in the dirent * will also require a FAT ZAP. If there is a new type of micro ZAP created * then we might need to re-evaluate the use of this flag and instead do * a conversion from the different internal ZAP hash formats being used. */ int __osd_zap_create(const struct lu_env *env, struct osd_device *osd, dmu_buf_t **zap_dbp, dmu_tx_t *tx, struct lu_attr *la, uint64_t parent, zap_flags_t flags) { uint64_t oid; int rc; /* Assert that the transaction has been assigned to a transaction group. */ LASSERT(tx->tx_txg != 0); oid = zap_create_flags(osd->od_os, 0, flags | ZAP_FLAG_HASH64, DMU_OT_DIRECTORY_CONTENTS, 14, /* == ZFS fzap_default_block_shift */ DN_MAX_INDBLKSHIFT, /* indirect block shift */ DMU_OT_SA, DN_MAX_BONUSLEN, tx); rc = -sa_buf_hold(osd->od_os, oid, osd_obj_tag, zap_dbp); if (rc) return rc; LASSERT(la->la_valid & LA_MODE); la->la_size = 2; la->la_nlink = 1; return __osd_attr_init(env, osd, oid, tx, la, parent); }
static void dsl_keychain_create_obj(dsl_dir_t *dd, dmu_tx_t *tx) { objset_t *mos = dd->dd_pool->dp_meta_objset; dmu_buf_will_dirty(dd->dd_dbuf, tx); dsl_dir_phys(dd)->dd_keychain_obj = zap_create_flags(mos, 0, ZAP_FLAG_HASH64 | ZAP_FLAG_UINT64_KEY, DMU_OT_DSL_KEYCHAIN, SPA_MINBLOCKSHIFT, SPA_MINBLOCKSHIFT, DMU_OT_NONE, 0, tx); }
static int ddt_zap_create(objset_t *os, uint64_t *objectp, dmu_tx_t *tx, boolean_t prehash) { zap_flags_t flags = ZAP_FLAG_HASH64 | ZAP_FLAG_UINT64_KEY; if (prehash) flags |= ZAP_FLAG_PRE_HASHED_KEY; *objectp = zap_create_flags(os, 0, flags, DMU_OT_DDT_ZAP, ddt_zap_leaf_blockshift, ddt_zap_indirect_blockshift, DMU_OT_NONE, 0, tx); return (*objectp == 0 ? ENOTSUP : 0); }