mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
FreeBSD: rename teardown inactive macros to mimick rrm convention
Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Closes #11153
This commit is contained in:
parent
f9acd578f0
commit
9847f77f01
@ -113,52 +113,52 @@ struct zfsvfs {
|
||||
};
|
||||
|
||||
#ifdef TEARDOWN_INACTIVE_RMS
|
||||
#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \
|
||||
rms_init(&(zfsvfs)->z_teardown_inactive_lock, "zfs teardown inactive")
|
||||
|
||||
#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \
|
||||
rms_destroy(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs) \
|
||||
rms_try_rlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs) \
|
||||
rms_rlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \
|
||||
rms_runlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \
|
||||
rms_wlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs) \
|
||||
rms_wunlock(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \
|
||||
rms_wowned(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
#else
|
||||
#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \
|
||||
rw_init(&(zfsvfs)->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL)
|
||||
|
||||
#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \
|
||||
rw_destroy(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs) \
|
||||
rw_tryenter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
|
||||
|
||||
#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs) \
|
||||
rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
|
||||
|
||||
#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \
|
||||
rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \
|
||||
rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_WRITER)
|
||||
|
||||
#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs) \
|
||||
rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \
|
||||
#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \
|
||||
RW_WRITE_HELD(&(zfsvfs)->z_teardown_inactive_lock)
|
||||
#endif
|
||||
|
||||
|
@ -991,7 +991,7 @@ zfsvfs_create_impl(zfsvfs_t **zfvp, zfsvfs_t *zfsvfs, objset_t *os)
|
||||
#else
|
||||
rrm_init(&zfsvfs->z_teardown_lock, B_FALSE);
|
||||
#endif
|
||||
ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs);
|
||||
rw_init(&zfsvfs->z_fuid_lock, NULL, RW_DEFAULT, NULL);
|
||||
for (int i = 0; i != ZFS_OBJ_MTX_SZ; i++)
|
||||
mutex_init(&zfsvfs->z_hold_mtx[i], NULL, MUTEX_DEFAULT, NULL);
|
||||
@ -1131,7 +1131,7 @@ zfsvfs_free(zfsvfs_t *zfsvfs)
|
||||
ASSERT(zfsvfs->z_nr_znodes == 0);
|
||||
list_destroy(&zfsvfs->z_all_znodes);
|
||||
rrm_destroy(&zfsvfs->z_teardown_lock);
|
||||
ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs);
|
||||
rw_destroy(&zfsvfs->z_fuid_lock);
|
||||
for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
|
||||
mutex_destroy(&zfsvfs->z_hold_mtx[i]);
|
||||
@ -1558,7 +1558,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
|
||||
zfsvfs->z_log = NULL;
|
||||
}
|
||||
|
||||
ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs);
|
||||
|
||||
/*
|
||||
* If we are not unmounting (ie: online recv) and someone already
|
||||
@ -1566,7 +1566,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
|
||||
* or a reopen of z_os failed then just bail out now.
|
||||
*/
|
||||
if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) {
|
||||
ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs);
|
||||
rrm_exit(&zfsvfs->z_teardown_lock, FTAG);
|
||||
return (SET_ERROR(EIO));
|
||||
}
|
||||
@ -1594,7 +1594,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
|
||||
*/
|
||||
if (unmounting) {
|
||||
zfsvfs->z_unmounted = B_TRUE;
|
||||
ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs);
|
||||
rrm_exit(&zfsvfs->z_teardown_lock, FTAG);
|
||||
}
|
||||
|
||||
@ -1914,7 +1914,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds)
|
||||
znode_t *zp;
|
||||
|
||||
ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock));
|
||||
ASSERT(ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs));
|
||||
ASSERT(ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs));
|
||||
|
||||
/*
|
||||
* We already own this, so just update the objset_t, as the one we
|
||||
@ -1952,7 +1952,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds)
|
||||
|
||||
bail:
|
||||
/* release the VOPs */
|
||||
ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs);
|
||||
rrm_exit(&zfsvfs->z_teardown_lock, FTAG);
|
||||
|
||||
if (err) {
|
||||
@ -2069,7 +2069,7 @@ int
|
||||
zfs_end_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds)
|
||||
{
|
||||
ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock));
|
||||
ASSERT(ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs));
|
||||
ASSERT(ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs));
|
||||
|
||||
/*
|
||||
* We already own this, so just hold and rele it to update the
|
||||
@ -2085,7 +2085,7 @@ zfs_end_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds)
|
||||
zfsvfs->z_os = os;
|
||||
|
||||
/* release the VOPs */
|
||||
ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs);
|
||||
rrm_exit(&zfsvfs->z_teardown_lock, FTAG);
|
||||
|
||||
/*
|
||||
|
@ -3875,13 +3875,13 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct)
|
||||
zfsvfs_t *zfsvfs = zp->z_zfsvfs;
|
||||
int error;
|
||||
|
||||
ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs);
|
||||
if (zp->z_sa_hdl == NULL) {
|
||||
/*
|
||||
* The fs has been unmounted, or we did a
|
||||
* suspend/resume and this file no longer exists.
|
||||
*/
|
||||
ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs);
|
||||
vrecycle(vp);
|
||||
return;
|
||||
}
|
||||
@ -3890,7 +3890,7 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct)
|
||||
/*
|
||||
* Fast path to recycle a vnode of a removed file.
|
||||
*/
|
||||
ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs);
|
||||
vrecycle(vp);
|
||||
return;
|
||||
}
|
||||
@ -3910,7 +3910,7 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t *ct)
|
||||
dmu_tx_commit(tx);
|
||||
}
|
||||
}
|
||||
ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs);
|
||||
}
|
||||
|
||||
|
||||
@ -5047,10 +5047,10 @@ zfs_freebsd_need_inactive(struct vop_need_inactive_args *ap)
|
||||
if (vn_need_pageq_flush(vp))
|
||||
return (1);
|
||||
|
||||
if (!ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs))
|
||||
if (!ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs))
|
||||
return (1);
|
||||
need = (zp->z_sa_hdl == NULL || zp->z_unlinked || zp->z_atime_dirty);
|
||||
ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs);
|
||||
|
||||
return (need);
|
||||
}
|
||||
@ -5081,12 +5081,12 @@ zfs_freebsd_reclaim(struct vop_reclaim_args *ap)
|
||||
* zfs_znode_dmu_fini in zfsvfs_teardown during
|
||||
* force unmount.
|
||||
*/
|
||||
ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs);
|
||||
if (zp->z_sa_hdl == NULL)
|
||||
zfs_znode_free(zp);
|
||||
else
|
||||
zfs_zinactive(zp);
|
||||
ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs);
|
||||
ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs);
|
||||
|
||||
vp->v_data = NULL;
|
||||
return (0);
|
||||
|
@ -372,7 +372,7 @@ zfs_znode_dmu_fini(znode_t *zp)
|
||||
{
|
||||
ASSERT(MUTEX_HELD(ZFS_OBJ_MUTEX(zp->z_zfsvfs, zp->z_id)) ||
|
||||
zp->z_unlinked ||
|
||||
ZFS_TEARDOWN_INACTIVE_WLOCKED(zp->z_zfsvfs));
|
||||
ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zp->z_zfsvfs));
|
||||
|
||||
sa_handle_destroy(zp->z_sa_hdl);
|
||||
zp->z_sa_hdl = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user