mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Macroify teardown lock handling
This will allow platforms to implement it as they see fit, in particular in a different manner than rrm locks. 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:
committed by
Tony Hutter
parent
cd80d6d355
commit
5d946dfa1c
@@ -138,6 +138,39 @@ struct zfsvfs {
|
||||
taskqid_t z_drain_task; /* task id for the unlink drain task */
|
||||
};
|
||||
|
||||
#define ZFS_TEARDOWN_INIT(zfsvfs) \
|
||||
rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE)
|
||||
|
||||
#define ZFS_TEARDOWN_DESTROY(zfsvfs) \
|
||||
rrm_destroy(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \
|
||||
rw_tryenter(&(zfsvfs)->z_teardown_lock, RW_READER)
|
||||
|
||||
#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \
|
||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, tag);
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \
|
||||
rrm_enter(&(zfsvfs)->z_teardown_lock, RW_WRITER, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
|
||||
|
||||
#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \
|
||||
RRM_READ_HELD(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \
|
||||
RRM_WRITE_HELD(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZFS_TEARDOWN_HELD(zfsvfs) \
|
||||
RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock)
|
||||
|
||||
#define ZSB_XATTR 0x0001 /* Enable user xattrs */
|
||||
|
||||
/*
|
||||
|
||||
@@ -79,9 +79,9 @@ extern "C" {
|
||||
/* Called on entry to each ZFS inode and vfs operation. */
|
||||
#define ZFS_ENTER_ERROR(zfsvfs, error) \
|
||||
do { \
|
||||
rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \
|
||||
ZFS_TEARDOWN_ENTER_READ(zfsvfs, FTAG); \
|
||||
if (unlikely((zfsvfs)->z_unmounted)) { \
|
||||
ZFS_EXIT(zfsvfs); \
|
||||
ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \
|
||||
return (error); \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -92,7 +92,7 @@ do { \
|
||||
#define ZFS_EXIT(zfsvfs) \
|
||||
do { \
|
||||
zfs_exit_fs(zfsvfs); \
|
||||
rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG); \
|
||||
ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \
|
||||
} while (0)
|
||||
|
||||
#define ZPL_EXIT(zfsvfs) \
|
||||
|
||||
Reference in New Issue
Block a user