Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
#include <sys/errno.h> | #include <sys/errno.h> | ||||
#include <sys/unistd.h> | #include <sys/unistd.h> | ||||
#include <sys/atomic.h> | #include <sys/atomic.h> | ||||
#include <sys/zfs_dir.h> | #include <sys/zfs_dir.h> | ||||
#include <sys/zfs_acl.h> | #include <sys/zfs_acl.h> | ||||
#include <sys/zfs_ioctl.h> | #include <sys/zfs_ioctl.h> | ||||
#include <sys/zfs_rlock.h> | #include <sys/zfs_rlock.h> | ||||
#include <sys/zfs_fuid.h> | #include <sys/zfs_fuid.h> | ||||
#include <sys/zfs_vfsops.h> | |||||
#include <sys/dnode.h> | #include <sys/dnode.h> | ||||
#include <sys/fs/zfs.h> | #include <sys/fs/zfs.h> | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#include <sys/dmu.h> | #include <sys/dmu.h> | ||||
#include <sys/dmu_objset.h> | #include <sys/dmu_objset.h> | ||||
#include <sys/dmu_tx.h> | #include <sys/dmu_tx.h> | ||||
#include <sys/zfs_refcount.h> | #include <sys/zfs_refcount.h> | ||||
▲ Show 20 Lines • Show All 481 Lines • ▼ Show 20 Lines | |||||
#if __FreeBSD_version >= 1400077 | #if __FreeBSD_version >= 1400077 | ||||
vn_set_state(vp, VSTATE_CONSTRUCTED); | vn_set_state(vp, VSTATE_CONSTRUCTED); | ||||
#endif | #endif | ||||
VN_LOCK_AREC(vp); | VN_LOCK_AREC(vp); | ||||
if (vp->v_type != VFIFO) | if (vp->v_type != VFIFO) | ||||
VN_LOCK_ASHARE(vp); | VN_LOCK_ASHARE(vp); | ||||
atomic_add_rel_64(&zfs_znode_count, 1); | |||||
/* | |||||
* Defer the increment of zfs_znode_inuse_count until vp gets inserted into | |||||
* mp. | |||||
*/ | |||||
return (zp); | return (zp); | ||||
} | } | ||||
static uint64_t empty_xattr; | static uint64_t empty_xattr; | ||||
static uint64_t pad[4]; | static uint64_t pad[4]; | ||||
static zfs_acl_phys_t acl_phys; | static zfs_acl_phys_t acl_phys; | ||||
/* | /* | ||||
* Create a new DMU object to hold a zfs znode. | * Create a new DMU object to hold a zfs znode. | ||||
▲ Show 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr, | ||||
} | } | ||||
if (!(flag & IS_ROOT_NODE)) { | if (!(flag & IS_ROOT_NODE)) { | ||||
vnode_t *vp = ZTOV(*zpp); | vnode_t *vp = ZTOV(*zpp); | ||||
vp->v_vflag |= VV_FORCEINSMQ; | vp->v_vflag |= VV_FORCEINSMQ; | ||||
int err = insmntque(vp, zfsvfs->z_vfs); | int err = insmntque(vp, zfsvfs->z_vfs); | ||||
vp->v_vflag &= ~VV_FORCEINSMQ; | vp->v_vflag &= ~VV_FORCEINSMQ; | ||||
(void) err; | (void) err; | ||||
KASSERT(err == 0, ("insmntque() failed: error %d", err)); | KASSERT(err == 0, ("insmntque() failed: error %d", err)); | ||||
atomic_add_rel_64(&zfs_znode_inuse_count, 1); | |||||
} | } | ||||
kmem_free(sa_attrs, sizeof (sa_bulk_attr_t) * ZPL_END); | kmem_free(sa_attrs, sizeof (sa_bulk_attr_t) * ZPL_END); | ||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj); | ZFS_OBJ_HOLD_EXIT(zfsvfs, obj); | ||||
} | } | ||||
/* | /* | ||||
* Update in-core attributes. It is assumed the caller will be doing an | * Update in-core attributes. It is assumed the caller will be doing an | ||||
* sa_bulk_update to push the changes out. | * sa_bulk_update to push the changes out. | ||||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | again: | ||||
} | } | ||||
if (err == 0) { | if (err == 0) { | ||||
vnode_t *vp = ZTOV(zp); | vnode_t *vp = ZTOV(zp); | ||||
err = insmntque(vp, zfsvfs->z_vfs); | err = insmntque(vp, zfsvfs->z_vfs); | ||||
if (err == 0) { | if (err == 0) { | ||||
vp->v_hash = obj_num; | vp->v_hash = obj_num; | ||||
VOP_UNLOCK1(vp); | VOP_UNLOCK1(vp); | ||||
atomic_add_rel_64(&zfs_znode_inuse_count, 1); | |||||
} else { | } else { | ||||
zp->z_vnode = NULL; | zp->z_vnode = NULL; | ||||
zfs_znode_dmu_fini(zp); | zfs_znode_dmu_fini(zp); | ||||
zfs_znode_free(zp); | zfs_znode_free(zp); | ||||
*zpp = NULL; | *zpp = NULL; | ||||
} | } | ||||
} | } | ||||
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); | ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num); | ||||
▲ Show 20 Lines • Show All 1,160 Lines • Show Last 20 Lines |