diff options
author | Brian Behlendorf <[email protected]> | 2015-12-18 12:19:14 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-01-15 15:33:44 -0800 |
commit | 0720116d4dd7a62d2097863fc4c32c3cbd11aefa (patch) | |
tree | 41a9f5bdc9c3c223a440129e33b5149207a45e04 /module/zfs/zfs_znode.c | |
parent | d21f279a94994f65e6bdcbbca9fd2eb552a0d604 (diff) |
Add zfs_object_mutex_size module option
Add a zfs_object_mutex_size module option to facilitate resizing the
the per-dataset znode mutex array. Increasing this value may help
make the deadlock described in #4106 less common, but this is not a
proper fix. This patch is primarily to aid debugging and analysis.
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tim Chase <[email protected]>
Issue #4106
Diffstat (limited to 'module/zfs/zfs_znode.c')
-rw-r--r-- | module/zfs/zfs_znode.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c index bd5f738a7..94e26fb13 100644 --- a/module/zfs/zfs_znode.c +++ b/module/zfs/zfs_znode.c @@ -95,6 +95,7 @@ #ifdef _KERNEL static kmem_cache_t *znode_cache = NULL; +unsigned int zfs_object_mutex_size = ZFS_OBJ_MTX_SZ; /*ARGSUSED*/ static int @@ -1734,9 +1735,11 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx) list_create(&zsb->z_all_znodes, sizeof (znode_t), offsetof(znode_t, z_link_node)); - zsb->z_hold_mtx = vmem_zalloc(sizeof (kmutex_t) * ZFS_OBJ_MTX_SZ, + zsb->z_hold_mtx_size = MIN(1 << (highbit64(zfs_object_mutex_size) - 1), + ZFS_OBJ_MTX_MAX); + zsb->z_hold_mtx = vmem_zalloc(sizeof (kmutex_t) * zsb->z_hold_mtx_size, KM_SLEEP); - for (i = 0; i != ZFS_OBJ_MTX_SZ; i++) + for (i = 0; i != zsb->z_hold_mtx_size; i++) mutex_init(&zsb->z_hold_mtx[i], NULL, MUTEX_DEFAULT, NULL); VERIFY(0 == zfs_acl_ids_create(rootzp, IS_ROOT_NODE, &vattr, @@ -1757,10 +1760,10 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx) error = zfs_create_share_dir(zsb, tx); ASSERT(error == 0); - for (i = 0; i != ZFS_OBJ_MTX_SZ; i++) + for (i = 0; i != zsb->z_hold_mtx_size; i++) mutex_destroy(&zsb->z_hold_mtx[i]); - vmem_free(zsb->z_hold_mtx, sizeof (kmutex_t) * ZFS_OBJ_MTX_SZ); + vmem_free(zsb->z_hold_mtx, sizeof (kmutex_t) * zsb->z_hold_mtx_size); kmem_free(sb, sizeof (struct super_block)); kmem_free(zsb, sizeof (zfs_sb_t)); } @@ -2023,4 +2026,7 @@ zfs_obj_to_stats(objset_t *osp, uint64_t obj, zfs_stat_t *sb, #if defined(_KERNEL) && defined(HAVE_SPL) EXPORT_SYMBOL(zfs_create_fs); EXPORT_SYMBOL(zfs_obj_to_path); + +module_param(zfs_object_mutex_size, uint, 0644); +MODULE_PARM_DESC(zfs_object_mutex_size, "Size of znode hold array"); #endif |