]> granicus.if.org Git - zfs/blobdiff - module/zfs/zvol.c
Bound zvol_threads module option
[zfs] / module / zfs / zvol.c
index d180b5b5b76f468ba67aa6b71e5f35d094727c11..b073a3c5ee5d2ec85e0b2e038e953dbc603524c0 100644 (file)
@@ -764,7 +764,7 @@ zvol_request(struct request_queue *q)
                        continue;
                }
 
-               switch (rq_data_dir(req)) {
+               switch ((int)rq_data_dir(req)) {
                case READ:
                        zvol_dispatch(zvol_read, req);
                        break;
@@ -1624,6 +1624,7 @@ zvol_set_snapdev(const char *dsname, uint64_t snapdev) {
 int
 zvol_init(void)
 {
+       int threads = MIN(MAX(zvol_threads, 1), 1024);
        int error;
 
        list_create(&zvol_state_list, sizeof (zvol_state_t),
@@ -1631,8 +1632,8 @@ zvol_init(void)
 
        mutex_init(&zvol_state_lock, NULL, MUTEX_DEFAULT, NULL);
 
-       zvol_taskq = taskq_create(ZVOL_DRIVER, zvol_threads, maxclsyspri,
-           zvol_threads, INT_MAX, TASKQ_PREPOPULATE);
+       zvol_taskq = taskq_create(ZVOL_DRIVER, threads, maxclsyspri,
+           threads * 2, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC);
        if (zvol_taskq == NULL) {
                printk(KERN_INFO "ZFS: taskq_create() failed\n");
                error = -ENOMEM;
@@ -1677,7 +1678,7 @@ module_param(zvol_major, uint, 0444);
 MODULE_PARM_DESC(zvol_major, "Major number for zvol device");
 
 module_param(zvol_threads, uint, 0444);
-MODULE_PARM_DESC(zvol_threads, "Number of threads for zvol device");
+MODULE_PARM_DESC(zvol_threads, "Max number of threads to handle I/O requests");
 
 module_param(zvol_max_discard_blocks, ulong, 0444);
 MODULE_PARM_DESC(zvol_max_discard_blocks, "Max number of blocks to discard");