diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/zfs_vfsops.h | 5 | ||||
-rw-r--r-- | include/sys/zfs_znode.h | 25 |
2 files changed, 13 insertions, 17 deletions
diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h index a59114a1a..efaefdacc 100644 --- a/include/sys/zfs_vfsops.h +++ b/include/sys/zfs_vfsops.h @@ -112,8 +112,9 @@ typedef struct zfs_sb { uint64_t z_groupquota_obj; uint64_t z_replay_eof; /* New end of file - replay only */ sa_attr_type_t *z_attr_table; /* SA attr mapping->id */ - uint64_t z_hold_mtx_size; /* znode hold locks size */ - kmutex_t *z_hold_mtx; /* znode hold locks */ + uint64_t z_hold_size; /* znode hold array size */ + avl_tree_t *z_hold_trees; /* znode hold trees */ + kmutex_t *z_hold_locks; /* znode hold locks */ } zfs_sb_t; #define ZFS_SUPER_MAGIC 0x2fc12fc1 diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h index 59ca085ef..c03bef5c7 100644 --- a/include/sys/zfs_znode.h +++ b/include/sys/zfs_znode.h @@ -220,6 +220,12 @@ typedef struct znode { struct inode z_inode; /* generic vfs inode */ } znode_t; +typedef struct znode_hold { + uint64_t zh_obj; /* object id */ + kmutex_t zh_lock; /* lock serializing object access */ + avl_node_t zh_node; /* avl tree linkage */ + refcount_t zh_refcount; /* active consumer reference count */ +} znode_hold_t; /* * Range locking rules @@ -273,24 +279,12 @@ typedef struct znode { /* * Macros for dealing with dmu_buf_hold */ -#define ZFS_OBJ_MTX_SZ 64 -#define ZFS_OBJ_MTX_MAX (1024 * 1024) +#define ZFS_OBJ_MTX_SZ 64 +#define ZFS_OBJ_MTX_MAX (1024 * 1024) +#define ZFS_OBJ_HASH(zsb, obj) ((obj) & ((zsb->z_hold_size) - 1)) extern unsigned int zfs_object_mutex_size; -#define ZFS_OBJ_HASH(zsb, obj_num) \ - ((obj_num) & ((zsb->z_hold_mtx_size) - 1)) -#define ZFS_OBJ_MUTEX(zsb, obj_num) \ - (&(zsb)->z_hold_mtx[ZFS_OBJ_HASH(zsb, obj_num)]) -#define ZFS_OBJ_HOLD_ENTER(zsb, obj_num) \ - mutex_enter(ZFS_OBJ_MUTEX((zsb), (obj_num))) -#define ZFS_OBJ_HOLD_TRYENTER(zsb, obj_num) \ - mutex_tryenter(ZFS_OBJ_MUTEX((zsb), (obj_num))) -#define ZFS_OBJ_HOLD_EXIT(zsb, obj_num) \ - mutex_exit(ZFS_OBJ_MUTEX((zsb), (obj_num))) -#define ZFS_OBJ_HOLD_OWNED(zsb, obj_num) \ - mutex_owned(ZFS_OBJ_MUTEX((zsb), (obj_num))) - /* Encode ZFS stored time values from a struct timespec */ #define ZFS_TIME_ENCODE(tp, stmp) \ { \ @@ -326,6 +320,7 @@ extern void zfs_grow_blocksize(znode_t *, uint64_t, dmu_tx_t *); extern int zfs_freesp(znode_t *, uint64_t, uint64_t, int, boolean_t); extern void zfs_znode_init(void); extern void zfs_znode_fini(void); +extern int zfs_znode_hold_compare(const void *, const void *); extern int zfs_zget(zfs_sb_t *, uint64_t, znode_t **); extern int zfs_rezget(znode_t *); extern void zfs_zinactive(znode_t *); |