]> git.proxmox.com Git - zfsonlinux.git/blame - debian/patches/0011-Revert-zvol-Temporally-disable-blk-mq.patch
cherry-pick fix for data corruption
[zfsonlinux.git] / debian / patches / 0011-Revert-zvol-Temporally-disable-blk-mq.patch
CommitLineData
7e3b7d81
SI
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Tony Hutter <hutter2@llnl.gov>
3Date: Mon, 23 Oct 2023 14:39:59 -0700
4Subject: [PATCH] Revert "zvol: Temporally disable blk-mq"
5
6This reverts commit aefb6a2bd6c24597cde655e9ce69edd0a4c34357.
7
8aefb6a2bd temporally disabled blk-mq until we could fix a fix for
9
10Signed-off-by: Tony Hutter <hutter2@llnl.gov>
11Closes #15439
12(cherry picked from commit 05c4710e8958832afc2868102c9535a4f18115be)
13Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
14---
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(-)
19
20diff --git a/man/man4/zfs.4 b/man/man4/zfs.4
21index 71a3e67ee..cfadd79d8 100644
22--- a/man/man4/zfs.4
23+++ b/man/man4/zfs.4
24@@ -2317,6 +2317,63 @@ If
25 .Sy zvol_threads
26 to the number of CPUs present or 32 (whichever is greater).
27 .
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
31+.Li blk-mq
32+and is only read and assigned to a zvol at zvol load time.
33+If
34+.Sy 0
35+(the default) then internally set
36+.Sy zvol_blk_mq_threads
37+to the number of CPUs present.
38+.
39+.It Sy zvol_use_blk_mq Ns = Ns Sy 0 Ns | Ns 1 Pq uint
40+Set to
41+.Sy 1
42+to use the
43+.Li blk-mq
44+API for zvols.
45+Set to
46+.Sy 0
47+(the default) to use the legacy zvol APIs.
48+This setting can give better or worse zvol performance depending on
49+the workload.
50+This parameter will only appear if your kernel supports
51+.Li blk-mq
52+and is only read and assigned to a zvol at zvol load time.
53+.
54+.It Sy zvol_blk_mq_blocks_per_thread Ns = Ns Sy 8 Pq uint
55+If
56+.Sy zvol_use_blk_mq
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).
61+If set to
62+.Sy 0 ,
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
66+.Li blk-mq
67+and is only applied at each zvol's load time.
68+.
69+.It Sy zvol_blk_mq_queue_depth Ns = Ns Sy 0 Pq uint
70+The queue_depth value for the zvol
71+.Li blk-mq
72+interface.
73+This parameter will only appear if your kernel supports
74+.Li blk-mq
75+and is only applied at each zvol's load time.
76+If
77+.Sy 0
78+(the default) then use the kernel's default queue depth.
79+Values are clamped to the kernel's
80+.Dv BLKDEV_MIN_RQ
81+and
82+.Dv BLKDEV_MAX_RQ Ns / Ns Dv BLKDEV_DEFAULT_RQ
83+limits.
84+.
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 :
88diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c
89index 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");
95
96+#ifdef HAVE_BLK_MQ
97+module_param(zvol_blk_mq_queue_depth, uint, 0644);
98+MODULE_PARM_DESC(zvol_blk_mq_queue_depth, "Default blk-mq queue depth");
99+
100+module_param(zvol_use_blk_mq, uint, 0644);
101+MODULE_PARM_DESC(zvol_use_blk_mq, "Use the blk-mq API for zvols");
102+
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");
106+#endif
107+
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");
111diff --git a/tests/zfs-tests/include/tunables.cfg b/tests/zfs-tests/include/tunables.cfg
112index 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