Index: spa.c =================================================================== --- spa.c (revision 203410) +++ spa.c (working copy) @@ -58,20 +58,24 @@ #include #include #include +#include #include "zfs_prop.h" #include "zfs_comutil.h" -int zio_taskq_threads[ZIO_TYPES][ZIO_TASKQ_TYPES] = { +static int zio_taskq_threads[ZIO_TYPES][ZIO_TASKQ_TYPES] = { /* ISSUE INTR */ { 1, 1 }, /* ZIO_TYPE_NULL */ - { 1, 8 }, /* ZIO_TYPE_READ */ - { 8, 1 }, /* ZIO_TYPE_WRITE */ + { 1, -1 }, /* ZIO_TYPE_READ */ + { -1, 1 }, /* ZIO_TYPE_WRITE */ { 1, 1 }, /* ZIO_TYPE_FREE */ { 1, 1 }, /* ZIO_TYPE_CLAIM */ { 1, 1 }, /* ZIO_TYPE_IOCTL */ }; +static int zio_worker_threads_count = -1; +TUNABLE_INT("vfs.zfs.zio_worker_threads_count", &zio_worker_threads_count); + static void spa_sync_props(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx); static boolean_t spa_has_active_shared_spare(spa_t *spa); @@ -498,7 +502,11 @@ spa_activate(spa_t *spa) for (int t = 0; t < ZIO_TYPES; t++) { for (int q = 0; q < ZIO_TASKQ_TYPES; q++) { spa->spa_zio_taskq[t][q] = taskq_create("spa_zio", - zio_taskq_threads[t][q], maxclsyspri, 50, + zio_taskq_threads[t][q] == -1 ? + (zio_worker_threads_count == -1 ? mp_ncpus : + zio_worker_threads_count) : + zio_taskq_threads[t][q], + maxclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE); } }