Use 32 as the default number of zvol threads.
[zfs.git] / module / zfs / zvol.c
index 0aaa268..19888ea 100644 (file)
@@ -47,7 +47,7 @@
 #include <linux/blkdev_compat.h>
 
 unsigned int zvol_major = ZVOL_MAJOR;
-unsigned int zvol_threads = 0;
+unsigned int zvol_threads = 32;
 
 static taskq_t *zvol_taskq;
 static kmutex_t zvol_state_lock;
@@ -1188,6 +1188,15 @@ __zvol_create_minor(const char *name)
 
        set_capacity(zv->zv_disk, zv->zv_volsize >> 9);
 
+       blk_queue_max_hw_sectors(zv->zv_queue, UINT_MAX);
+       blk_queue_max_segments(zv->zv_queue, UINT16_MAX);
+       blk_queue_max_segment_size(zv->zv_queue, UINT_MAX);
+       blk_queue_physical_block_size(zv->zv_queue, zv->zv_volblocksize);
+       blk_queue_io_opt(zv->zv_queue, zv->zv_volblocksize);
+#ifdef HAVE_BLK_QUEUE_NONROT
+       queue_flag_set_unlocked(QUEUE_FLAG_NONROT, zv->zv_queue);
+#endif
+
        if (zil_replay_disable)
                zil_destroy(dmu_objset_zil(os), B_FALSE);
        else
@@ -1334,9 +1343,6 @@ zvol_init(void)
 {
        int error;
 
-       if (!zvol_threads)
-               zvol_threads = num_online_cpus();
-
        zvol_taskq = taskq_create(ZVOL_DRIVER, zvol_threads, maxclsyspri,
                                  zvol_threads, INT_MAX, TASKQ_PREPOPULATE);
        if (zvol_taskq == NULL) {