zfs_znode.c revision 72fc53bc90bd3b199d29d03ee68adb4a5a17d35b
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Common Development and Distribution License (the "License").
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * You may not use this file except in compliance with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
8ef9dde03e938929ceec1291f40c6a4e644e6783marks * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens#pragma ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*ARGSUSED*/
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock /* signal force unmount that this znode can be freed */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*ARGSUSED*/
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_znode_cache_constructor(void *buf, void *cdrarg, int kmflags)
fa9e4066f08beec538e775443c5be79dd423fcabahrens mutex_init(&zp->z_acl_lock, NULL, MUTEX_DEFAULT, NULL);
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin mutex_init(&zp->z_range_lock, NULL, MUTEX_DEFAULT, NULL);
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*ARGSUSED*/
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Initialize zcache
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Cleanup vfs & vnode ops
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Cleanup zcache
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Remove vfs ops
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Remove vnode ops
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern const fs_operation_def_t zfs_dvnodeops_template[];
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern const fs_operation_def_t zfs_fvnodeops_template[];
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern const fs_operation_def_t zfs_xdvnodeops_template[];
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern const fs_operation_def_t zfs_symvnodeops_template[];
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern const fs_operation_def_t zfs_evnodeops_template[];
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_dvnodeops can be set if mod_remove() calls mod_installfs()
fa9e4066f08beec538e775443c5be79dd423fcabahrens * due to a failure to remove the the 2nd modlinkage (zfs_modldrv).
fa9e4066f08beec538e775443c5be79dd423fcabahrens * In this case we just return as the ops vectors are already set up.
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens error = vn_make_ops(MNTTYPE_ZFS, zfs_dvnodeops_template,
fa9e4066f08beec538e775443c5be79dd423fcabahrens error = vn_make_ops(MNTTYPE_ZFS, zfs_fvnodeops_template,
fa9e4066f08beec538e775443c5be79dd423fcabahrens error = vn_make_ops(MNTTYPE_ZFS, zfs_symvnodeops_template,
fa9e4066f08beec538e775443c5be79dd423fcabahrens error = vn_make_ops(MNTTYPE_ZFS, zfs_xdvnodeops_template,
fa9e4066f08beec538e775443c5be79dd423fcabahrens error = vn_make_ops(MNTTYPE_ZFS, zfs_evnodeops_template,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * zfs_init_fs - Initialize the zfsvfs struct and the file system
fa9e4066f08beec538e775443c5be79dd423fcabahrens * incore "master" object. Verify version compatibility.
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_init_fs(zfsvfs_t *zfsvfs, znode_t **zpp, cred_t *cr)
fa9e4066f08beec538e775443c5be79dd423fcabahrens * XXX - hack to auto-create the pool root filesystem at
fa9e4066f08beec538e775443c5be79dd423fcabahrens * the first attempted mount.
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (dmu_object_info(os, MASTER_NODE_OBJ, &doi) == ENOENT) {
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* master */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock dmu_tx_hold_zap(tx, DMU_NEW_OBJECT, TRUE, NULL); /* del queue */
fa9e4066f08beec538e775443c5be79dd423fcabahrens dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT); /* root node */
eaca9bbd5f5d1e4e554da4c7108e8a03c8c33481eschrock error = zap_lookup(os, MASTER_NODE_OBJ, ZPL_VERSION_OBJ, 8, 1,
fa9e4066f08beec538e775443c5be79dd423fcabahrens "is version %lld on-disk format, which is "
fa9e4066f08beec538e775443c5be79dd423fcabahrens "incompatible with this software version %lld!",
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The fsid is 64 bits, composed of an 8-bit fs type, which
fa9e4066f08beec538e775443c5be79dd423fcabahrens * separates our fsid from any other filesystem types, and a
fa9e4066f08beec538e775443c5be79dd423fcabahrens * 56-bit objset unique ID. The objset unique ID is unique to
fa9e4066f08beec538e775443c5be79dd423fcabahrens * all objsets open on this system, provided by unique_create().
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The 8-bit fs type must be put in the low bits of fsid[1]
fa9e4066f08beec538e775443c5be79dd423fcabahrens * because that's where other Solaris filesystems put it.
fa9e4066f08beec538e775443c5be79dd423fcabahrens stats = kmem_alloc(sizeof (dmu_objset_stats_t), KM_SLEEP);
fa9e4066f08beec538e775443c5be79dd423fcabahrens ASSERT((stats->dds_fsid_guid & ~((1ULL<<56)-1)) == 0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens zfsvfs->z_vfs->vfs_fsid.val[0] = stats->dds_fsid_guid;
fa9e4066f08beec538e775443c5be79dd423fcabahrens zfsvfs->z_vfs->vfs_fsid.val[1] = ((stats->dds_fsid_guid>>32) << 8) |
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock error = zap_lookup(os, MASTER_NODE_OBJ, ZFS_ROOT_OBJ, 8, 1, &zoid);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Create the per mount vop tables.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Initialize zget mutex's
fa9e4066f08beec538e775443c5be79dd423fcabahrens for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
fa9e4066f08beec538e775443c5be79dd423fcabahrens mutex_init(&zfsvfs->z_hold_mtx[i], NULL, MUTEX_DEFAULT, NULL);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock error = zap_lookup(os, MASTER_NODE_OBJ, ZFS_DELETE_QUEUE, 8, 1, &zoid);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Initialize delete head structure
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Thread(s) will be started/stopped via
fa9e4066f08beec538e775443c5be79dd423fcabahrens * readonly_changed_cb() depending
fa9e4066f08beec538e775443c5be79dd423fcabahrens * on whether this is rw/ro mount.
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * define a couple of values we need available
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * for both 64 and 32 bit environments.
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * Create special expldev for ZFS private use.
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * Can't use standard expldev since it doesn't do
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * what we want. The standard expldev() takes a
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * dev32_t in LP64 and expands it to a long dev_t.
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * We need an interface that takes a dev32_t in ILP32
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * and expands it to a long dev_t.
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks major_t major = (major_t)dev >> NBITSMINOR32 & MAXMAJ32;
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * Special cmpldev for ZFS private use.
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * Can't use standard cmpldev since it takes
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * a long dev_t and compresses it to dev32_t in
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * LP64. We need to do a compaction of a long dev_t
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks * to a dev32_t in ILP32.
72fc53bc90bd3b199d29d03ee68adb4a5a17d35bmarks major_t major = (major_t)(dev >> NBITSMINOR64) & MAXMAJ64;
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Construct a new znode/vnode and intialize.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * This does not do a call to dmu_set_user() that is
fa9e4066f08beec538e775443c5be79dd423fcabahrens * up to the caller to do, in case you don't want to
fa9e4066f08beec538e775443c5be79dd423fcabahrens * return the znode
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, uint64_t obj_num, int blksz)
7f6e3e7d4ebf3d6d45073854bef004ca26f8e918perrin zp->z_zn_prefetch = B_TRUE; /* z_prefetch default is enabled */
fa9e4066f08beec538e775443c5be79dd423fcabahrens /*FALLTHROUGH*/
fa9e4066f08beec538e775443c5be79dd423fcabahrens nzp = dmu_buf_set_user(db, zp, &zp->z_phys, znode_pageout_func);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * there should be no
fa9e4066f08beec538e775443c5be79dd423fcabahrens * concurrent zgets on this object.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Slap on VROOT if we are the root znode
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Create a new DMU object to hold a zfs znode.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * IN: dzp - parent directory for new znode
fa9e4066f08beec538e775443c5be79dd423fcabahrens * vap - file attributes for new znode
fa9e4066f08beec538e775443c5be79dd423fcabahrens * tx - dmu transaction id for zap operations
fa9e4066f08beec538e775443c5be79dd423fcabahrens * cr - credentials of caller
fa9e4066f08beec538e775443c5be79dd423fcabahrens * flag - flags:
fa9e4066f08beec538e775443c5be79dd423fcabahrens * IS_ROOT_NODE - new object will be root
fa9e4066f08beec538e775443c5be79dd423fcabahrens * IS_XATTR - new object is an attribute
fa9e4066f08beec538e775443c5be79dd423fcabahrens * IS_REPLAY - intent log replay
fa9e4066f08beec538e775443c5be79dd423fcabahrens * OUT: oid - ID of created object
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_mknode(znode_t *dzp, vattr_t *vap, uint64_t *oid, dmu_tx_t *tx, cred_t *cr,
fa9e4066f08beec538e775443c5be79dd423fcabahrens ASSERT(vap && (vap->va_mask & (AT_TYPE|AT_MODE)) == (AT_TYPE|AT_MODE));
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (zfsvfs->z_assign >= TXG_INITIAL) { /* ZIL replay */
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Create a new DMU object.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * There's currently no mechanism for pre-reading the blocks that will
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * be to needed allocate a new object, so we accept the small chance
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * that there will be an i/o error and we will fail one of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * assertions below.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock VERIFY(0 == dmu_bonus_hold(zfsvfs->z_os, *oid, NULL, &dbp));
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Initialize the znode physical data to zero.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If this is the root, fix up the half-initialized parent pointer
fa9e4066f08beec538e775443c5be79dd423fcabahrens * to reference the just-allocated physical data area.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If parent is an xattr, so am I.
fa9e4066f08beec538e775443c5be79dd423fcabahrens pzp->zp_links = (flag & (IS_ROOT_NODE | IS_XATTR)) ? 2 : 1;
fa9e4066f08beec538e775443c5be79dd423fcabahrens pzp->zp_mode = MAKEIMODE(vap->va_type, vap->va_mode);
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp)
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock err = dmu_bonus_hold(zfsvfs->z_os, obj_num, NULL, &db);
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Not found create new znode/vnode
fa9e4066f08beec538e775443c5be79dd423fcabahrens zp = zfs_znode_alloc(zfsvfs, db, obj_num, doi.doi_data_block_size);
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Don't allow a zfs_zget() while were trying to release this znode
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If the hold count is greater than zero, somebody has
fa9e4066f08beec538e775443c5be79dd423fcabahrens * obtained a new reference on this znode while we were
fa9e4066f08beec538e775443c5be79dd423fcabahrens * processing it here, so we are done. If we still have
fa9e4066f08beec538e775443c5be79dd423fcabahrens * mapped pages then we are also done, since we don't
fa9e4066f08beec538e775443c5be79dd423fcabahrens * want to inactivate the znode until the pages get pushed.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * XXX - if vn_has_cached_data(vp) is true, but count == 0,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * this seems like it would leave the znode hanging with
fa9e4066f08beec538e775443c5be79dd423fcabahrens * no chance to go inactive...
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If this was the last reference to a file with no links,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * remove the file from the file system.
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* XATTR files are not put on the delete queue */
fa9e4066f08beec538e775443c5be79dd423fcabahrens list_insert_tail(&zfsvfs->z_delete_head.z_znodes, zp);
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_time_stamper_locked(znode_t *zp, uint_t flag, dmu_tx_t *tx)
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Update the requested znode timestamps with the current time.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If we are in a transaction, then go ahead and mark the znode
fa9e4066f08beec538e775443c5be79dd423fcabahrens * dirty in the transaction so the timestamps will go to disk.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Otherwise, we will get pushed next time the znode is updated
fa9e4066f08beec538e775443c5be79dd423fcabahrens * in a transaction, or when this znode eventually goes inactive.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Why is this OK?
fa9e4066f08beec538e775443c5be79dd423fcabahrens * 1 - Only the ACCESS time is ever updated outside of a transaction.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * 2 - Multiple consecutive updates will be collapsed into a single
fa9e4066f08beec538e775443c5be79dd423fcabahrens * znode update by the transaction grouping semantics of the DMU.
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_time_stamper(znode_t *zp, uint_t flag, dmu_tx_t *tx)
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * Grow the block size for a file.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * IN: zp - znode of file to free data in.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * size - requested block size
fa9e4066f08beec538e775443c5be79dd423fcabahrens * tx - open transaction.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * NOTE: this function assumes that the znode is write locked.
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_grow_blocksize(znode_t *zp, uint64_t size, dmu_tx_t *tx)
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If the file size is already greater than the current blocksize,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * we will not grow. If there is more than one block in a file,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * the blocksize cannot change.
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (zp->z_blksz && zp->z_phys->zp_size > zp->z_blksz)
fa9e4066f08beec538e775443c5be79dd423fcabahrens error = dmu_object_set_blocksize(zp->z_zfsvfs->z_os, zp->z_id,
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* What blocksize did we actually get? */
fa9e4066f08beec538e775443c5be79dd423fcabahrens dmu_object_size_from_db(zp->z_dbuf, &zp->z_blksz, &dummy);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * This is a dummy interface used when pvn_vplist_dirty() should *not*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * be calling back into the fs for a putpage(). E.g.: when truncating
fa9e4066f08beec538e775443c5be79dd423fcabahrens * a file, the pages being "thrown away* don't need to be written out.
fa9e4066f08beec538e775443c5be79dd423fcabahrens/* ARGSUSED */
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_no_putpage(vnode_t *vp, page_t *pp, u_offset_t *offp, size_t *lenp,
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);
104e2ed78d9ef0a0f89f320108b8ca29ca3850d5perrin * Free space in a file.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * IN: zp - znode of file to free data in.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * from - start of section to free.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * len - length of section to free (0 => to EOF).
fa9e4066f08beec538e775443c5be79dd423fcabahrens * flag - current file open mode flags.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * tx - open transaction.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * RETURN: 0 if success
fa9e4066f08beec538e775443c5be79dd423fcabahrens * error code if failure
fa9e4066f08beec538e775443c5be79dd423fcabahrenszfs_freesp(znode_t *zp, uint64_t from, uint64_t len, int flag, dmu_tx_t *tx,
8ef9dde03e938929ceec1291f40c6a4e644e6783marks return (0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Nothing to do if file already at desired length.
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Check for any locks in the region to be freed.
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (error = chklock(vp, FWRITE, start, 0, flag, NULL))
fa9e4066f08beec538e775443c5be79dd423fcabahrens * We are growing the file past the current block size.
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Clear any mapped pages in the truncated region.
fa9e4066f08beec538e775443c5be79dd423fcabahrens if (off != 0 && (pp = page_lookup(vp, start, SE_SHARED))) {
fa9e4066f08beec538e775443c5be79dd423fcabahrens * We need to zero a partial page.
fa9e4066f08beec538e775443c5be79dd423fcabahrens return (0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * First attempt to create master node.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * In an empty objset, there are no blocks to read and thus
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * there can be no i/o errors (which we assert below).
fa9e4066f08beec538e775443c5be79dd423fcabahrens error = zap_create_claim(os, moid, DMU_OT_MASTER_NODE,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Set starting attributes.
eaca9bbd5f5d1e4e554da4c7108e8a03c8c33481eschrock error = zap_update(os, moid, ZPL_VERSION_OBJ, 8, 1, &version, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Create a delete queue.
fa9e4066f08beec538e775443c5be79dd423fcabahrens doid = zap_create(os, DMU_OT_DELETE_QUEUE, DMU_OT_NONE, 0, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens error = zap_add(os, moid, ZFS_DELETE_QUEUE, 8, 1, &doid, tx);
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Create root znode. Create minimal znode/vnode/zfsvfs
fa9e4066f08beec538e775443c5be79dd423fcabahrens * to allow zfs_mknode to work.
fa9e4066f08beec538e775443c5be79dd423fcabahrens mutex_init(&zfsvfs.z_znodes_lock, NULL, MUTEX_DEFAULT, NULL);
fa9e4066f08beec538e775443c5be79dd423fcabahrens zfs_mknode(rootzp, &vattr, &roid, tx, cr, IS_ROOT_NODE, NULL, 0);
fa9e4066f08beec538e775443c5be79dd423fcabahrens error = zap_add(os, moid, ZFS_ROOT_OBJ, 8, 1, &roid, tx);