a010b40938
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
116 lines
4.2 KiB
Diff
116 lines
4.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
|
Date: Tue, 19 Jun 2018 21:52:45 -0700
|
|
Subject: [PATCH] Linux 4.14 compat: blk_queue_stackable()
|
|
|
|
The blk_queue_stackable() function was replaced in the 4.14 kernel
|
|
by queue_is_rq_based(), commit torvalds/linux@5fdee212. This change
|
|
resulted in the default elevator being used which can negatively
|
|
impact performance.
|
|
|
|
Rather than adding additional compatibility code to detect the
|
|
new interface unconditionally attempt to set the elevator. Since
|
|
we expect this to fail for block devices without an elevator the
|
|
error message has been moved in to zfs_dbgmsg().
|
|
|
|
Finally, it was observed that the elevator_change() was removed
|
|
from the 4.12 kernel, commit torvalds/linux@c033269. Update the
|
|
comment to clearly specify which are expected to export the
|
|
elevator_change() symbol.
|
|
|
|
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
|
|
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
|
|
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
|
Closes #7645
|
|
|
|
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
|
|
---
|
|
config/kernel-elevator-change.m4 | 4 ++--
|
|
include/linux/blkdev_compat.h | 11 -----------
|
|
module/zfs/vdev_disk.c | 22 ++++++++++------------
|
|
3 files changed, 12 insertions(+), 25 deletions(-)
|
|
|
|
diff --git a/config/kernel-elevator-change.m4 b/config/kernel-elevator-change.m4
|
|
index ace5aa82..eba25257 100644
|
|
--- a/config/kernel-elevator-change.m4
|
|
+++ b/config/kernel-elevator-change.m4
|
|
@@ -1,6 +1,6 @@
|
|
dnl #
|
|
-dnl # 2.6.36 API change
|
|
-dnl # Verify the elevator_change() symbol is available.
|
|
+dnl # 2.6.36 API, exported elevator_change() symbol
|
|
+dnl # 4.12 API, removed elevator_change() symbol
|
|
dnl #
|
|
AC_DEFUN([ZFS_AC_KERNEL_ELEVATOR_CHANGE], [
|
|
AC_MSG_CHECKING([whether elevator_change() is available])
|
|
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h
|
|
index 27f05662..c8cdf38e 100644
|
|
--- a/include/linux/blkdev_compat.h
|
|
+++ b/include/linux/blkdev_compat.h
|
|
@@ -106,17 +106,6 @@ blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua)
|
|
#endif
|
|
|
|
/*
|
|
- * 2.6.27 API change,
|
|
- * The blk_queue_stackable() queue flag was added in 2.6.27 to handle dm
|
|
- * stacking drivers. Prior to this request stacking drivers were detected
|
|
- * by checking (q->request_fn == NULL), for earlier kernels we revert to
|
|
- * this legacy behavior.
|
|
- */
|
|
-#ifndef blk_queue_stackable
|
|
-#define blk_queue_stackable(q) ((q)->request_fn == NULL)
|
|
-#endif
|
|
-
|
|
-/*
|
|
* 2.6.34 API change,
|
|
* The blk_queue_max_hw_sectors() function replaces blk_queue_max_sectors().
|
|
*/
|
|
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
|
|
index 6dc0544f..c5708cb2 100644
|
|
--- a/module/zfs/vdev_disk.c
|
|
+++ b/module/zfs/vdev_disk.c
|
|
@@ -168,23 +168,20 @@ vdev_elevator_switch(vdev_t *v, char *elevator)
|
|
if (!v->vdev_wholedisk && strncmp(device, "dm-", 3) != 0)
|
|
return;
|
|
|
|
- /* Skip devices without schedulers (loop, ram, dm, etc) */
|
|
- if (!q->elevator || !blk_queue_stackable(q))
|
|
- return;
|
|
-
|
|
/* Leave existing scheduler when set to "none" */
|
|
if ((strncmp(elevator, "none", 4) == 0) && (strlen(elevator) == 4))
|
|
return;
|
|
|
|
+ /*
|
|
+ * The elevator_change() function was available in kernels from
|
|
+ * 2.6.36 to 4.11. When not available fall back to using the user
|
|
+ * mode helper functionality to set the elevator via sysfs. This
|
|
+ * requires /bin/echo and sysfs to be mounted which may not be true
|
|
+ * early in the boot process.
|
|
+ */
|
|
#ifdef HAVE_ELEVATOR_CHANGE
|
|
error = elevator_change(q, elevator);
|
|
#else
|
|
- /*
|
|
- * For pre-2.6.36 kernels elevator_change() is not available.
|
|
- * Therefore we fall back to using a usermodehelper to echo the
|
|
- * elevator into sysfs; This requires /bin/echo and sysfs to be
|
|
- * mounted which may not be true early in the boot process.
|
|
- */
|
|
#define SET_SCHEDULER_CMD \
|
|
"exec 0</dev/null " \
|
|
" 1>/sys/block/%s/queue/scheduler " \
|
|
@@ -198,9 +195,10 @@ vdev_elevator_switch(vdev_t *v, char *elevator)
|
|
error = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
|
|
strfree(argv[2]);
|
|
#endif /* HAVE_ELEVATOR_CHANGE */
|
|
- if (error)
|
|
- printk("ZFS: Unable to set \"%s\" scheduler for %s (%s): %d\n",
|
|
+ if (error) {
|
|
+ zfs_dbgmsg("Unable to set \"%s\" scheduler for %s (%s): %d\n",
|
|
elevator, v->vdev_path, device, error);
|
|
+ }
|
|
}
|
|
|
|
/*
|