mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-27 18:34:22 +03:00
Bound zvol_threads module option
The zvol_threads module option should be bounded to a reasonable range. The taskq must have at least 1 thread and shouldn't have more than 1,024 at most. The default value of 32 is a reasonable default. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3614
This commit is contained in:
parent
21a96fb635
commit
6339c1b9dc
@ -1567,7 +1567,7 @@ Default value: \fB16,384\fR.
|
|||||||
\fBzvol_threads\fR (uint)
|
\fBzvol_threads\fR (uint)
|
||||||
.ad
|
.ad
|
||||||
.RS 12n
|
.RS 12n
|
||||||
Number of threads for zvol device
|
Max number of threads to handle zvol I/O requests
|
||||||
.sp
|
.sp
|
||||||
Default value: \fB32\fR.
|
Default value: \fB32\fR.
|
||||||
.RE
|
.RE
|
||||||
|
@ -1624,6 +1624,7 @@ zvol_set_snapdev(const char *dsname, uint64_t snapdev) {
|
|||||||
int
|
int
|
||||||
zvol_init(void)
|
zvol_init(void)
|
||||||
{
|
{
|
||||||
|
int threads = MIN(MAX(zvol_threads, 1), 1024);
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
list_create(&zvol_state_list, sizeof (zvol_state_t),
|
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);
|
mutex_init(&zvol_state_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||||
|
|
||||||
zvol_taskq = taskq_create(ZVOL_DRIVER, zvol_threads, maxclsyspri,
|
zvol_taskq = taskq_create(ZVOL_DRIVER, threads, maxclsyspri,
|
||||||
zvol_threads * 2, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC);
|
threads * 2, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC);
|
||||||
if (zvol_taskq == NULL) {
|
if (zvol_taskq == NULL) {
|
||||||
printk(KERN_INFO "ZFS: taskq_create() failed\n");
|
printk(KERN_INFO "ZFS: taskq_create() failed\n");
|
||||||
error = -ENOMEM;
|
error = -ENOMEM;
|
||||||
@ -1677,7 +1678,7 @@ module_param(zvol_major, uint, 0444);
|
|||||||
MODULE_PARM_DESC(zvol_major, "Major number for zvol device");
|
MODULE_PARM_DESC(zvol_major, "Major number for zvol device");
|
||||||
|
|
||||||
module_param(zvol_threads, uint, 0444);
|
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_param(zvol_max_discard_blocks, ulong, 0444);
|
||||||
MODULE_PARM_DESC(zvol_max_discard_blocks, "Max number of blocks to discard");
|
MODULE_PARM_DESC(zvol_max_discard_blocks, "Max number of blocks to discard");
|
||||||
|
Loading…
Reference in New Issue
Block a user