1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Tony Hutter <hutter2@llnl.gov>
3 Date: Mon, 23 Oct 2023 14:39:59 -0700
4 Subject: [PATCH] Revert "zvol: Temporally disable blk-mq"
6 This reverts commit aefb6a2bd6c24597cde655e9ce69edd0a4c34357.
8 aefb6a2bd temporally disabled blk-mq until we could fix a fix for
10 Signed-off-by: Tony Hutter <hutter2@llnl.gov>
12 (cherry picked from commit 05c4710e8958832afc2868102c9535a4f18115be)
13 Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
15 man/man4/zfs.4 | 57 ++++++++++++++++++++++++++++
16 module/os/linux/zfs/zvol_os.c | 12 ++++++
17 tests/zfs-tests/include/tunables.cfg | 2 +-
18 3 files changed, 70 insertions(+), 1 deletion(-)
20 diff --git a/man/man4/zfs.4 b/man/man4/zfs.4
21 index 71a3e67ee..cfadd79d8 100644
24 @@ -2317,6 +2317,63 @@ If
26 to the number of CPUs present or 32 (whichever is greater).
28 +.It Sy zvol_blk_mq_threads Ns = Ns Sy 0 Pq uint
29 +The number of threads per zvol to use for queuing IO requests.
30 +This parameter will only appear if your kernel supports
32 +and is only read and assigned to a zvol at zvol load time.
35 +(the default) then internally set
36 +.Sy zvol_blk_mq_threads
37 +to the number of CPUs present.
39 +.It Sy zvol_use_blk_mq Ns = Ns Sy 0 Ns | Ns 1 Pq uint
47 +(the default) to use the legacy zvol APIs.
48 +This setting can give better or worse zvol performance depending on
50 +This parameter will only appear if your kernel supports
52 +and is only read and assigned to a zvol at zvol load time.
54 +.It Sy zvol_blk_mq_blocks_per_thread Ns = Ns Sy 8 Pq uint
57 +is enabled, then process this number of
58 +.Sy volblocksize Ns -sized blocks per zvol thread.
59 +This tunable can be use to favor better performance for zvol reads (lower
60 +values) or writes (higher values).
63 +then the zvol layer will process the maximum number of blocks
64 +per thread that it can.
65 +This parameter will only appear if your kernel supports
67 +and is only applied at each zvol's load time.
69 +.It Sy zvol_blk_mq_queue_depth Ns = Ns Sy 0 Pq uint
70 +The queue_depth value for the zvol
73 +This parameter will only appear if your kernel supports
75 +and is only applied at each zvol's load time.
78 +(the default) then use the kernel's default queue depth.
79 +Values are clamped to the kernel's
82 +.Dv BLKDEV_MAX_RQ Ns / Ns Dv BLKDEV_DEFAULT_RQ
85 .It Sy zvol_volmode Ns = Ns Sy 1 Pq uint
86 Defines zvol block devices behaviour when
87 .Sy volmode Ns = Ns Sy default :
88 diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c
89 index 76521c959..7a95b54bd 100644
90 --- a/module/os/linux/zfs/zvol_os.c
91 +++ b/module/os/linux/zfs/zvol_os.c
92 @@ -1620,6 +1620,18 @@ MODULE_PARM_DESC(zvol_prefetch_bytes, "Prefetch N bytes at zvol start+end");
93 module_param(zvol_volmode, uint, 0644);
94 MODULE_PARM_DESC(zvol_volmode, "Default volmode property value");
97 +module_param(zvol_blk_mq_queue_depth, uint, 0644);
98 +MODULE_PARM_DESC(zvol_blk_mq_queue_depth, "Default blk-mq queue depth");
100 +module_param(zvol_use_blk_mq, uint, 0644);
101 +MODULE_PARM_DESC(zvol_use_blk_mq, "Use the blk-mq API for zvols");
103 +module_param(zvol_blk_mq_blocks_per_thread, uint, 0644);
104 +MODULE_PARM_DESC(zvol_blk_mq_blocks_per_thread,
105 + "Process volblocksize blocks per thread");
108 #ifndef HAVE_BLKDEV_GET_ERESTARTSYS
109 module_param(zvol_open_timeout_ms, uint, 0644);
110 MODULE_PARM_DESC(zvol_open_timeout_ms, "Timeout for ZVOL open retries");
111 diff --git a/tests/zfs-tests/include/tunables.cfg b/tests/zfs-tests/include/tunables.cfg
112 index 8010a9451..80e7bcb3b 100644
113 --- a/tests/zfs-tests/include/tunables.cfg
114 +++ b/tests/zfs-tests/include/tunables.cfg
115 @@ -89,7 +89,7 @@ VDEV_VALIDATE_SKIP vdev.validate_skip vdev_validate_skip
116 VOL_INHIBIT_DEV UNSUPPORTED zvol_inhibit_dev
117 VOL_MODE vol.mode zvol_volmode
118 VOL_RECURSIVE vol.recursive UNSUPPORTED
119 -VOL_USE_BLK_MQ UNSUPPORTED UNSUPPORTED
120 +VOL_USE_BLK_MQ UNSUPPORTED zvol_use_blk_mq
121 XATTR_COMPAT xattr_compat zfs_xattr_compat
122 ZEVENT_LEN_MAX zevent.len_max zfs_zevent_len_max
123 ZEVENT_RETAIN_MAX zevent.retain_max zfs_zevent_retain_max