Skip to content

Commit 9e17e6f

Browse files
authored
Remove zfs_vdev_elevator module option
As described in commit f81d5ef the zfs_vdev_elevator module option is being removed. Users who require this functionality should update their systems to set the disk scheduler using a udev rule. Reviewed-by: Richard Laager <[email protected]> Reviewed-by: loli10K <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #8664 Closes #9417 Closes #9609
1 parent 3c819a2 commit 9e17e6f

File tree

5 files changed

+19
-161
lines changed

5 files changed

+19
-161
lines changed

config/kernel-elevator-change.m4

Lines changed: 0 additions & 26 deletions
This file was deleted.

config/kernel.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
9292
ZFS_AC_KERNEL_SRC_FST_MOUNT
9393
ZFS_AC_KERNEL_SRC_BDI
9494
ZFS_AC_KERNEL_SRC_SET_NLINK
95-
ZFS_AC_KERNEL_SRC_ELEVATOR_CHANGE
9695
ZFS_AC_KERNEL_SRC_SGET
9796
ZFS_AC_KERNEL_SRC_LSEEK_EXECUTE
9897
ZFS_AC_KERNEL_SRC_VFS_GETATTR
@@ -186,7 +185,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
186185
ZFS_AC_KERNEL_FST_MOUNT
187186
ZFS_AC_KERNEL_BDI
188187
ZFS_AC_KERNEL_SET_NLINK
189-
ZFS_AC_KERNEL_ELEVATOR_CHANGE
190188
ZFS_AC_KERNEL_SGET
191189
ZFS_AC_KERNEL_LSEEK_EXECUTE
192190
ZFS_AC_KERNEL_VFS_GETATTR

include/os/linux/kernel/linux/blkdev_compat.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,14 +456,6 @@ blk_queue_discard_secure(struct request_queue *q)
456456
#endif
457457
}
458458

459-
/*
460-
* Default Linux IO Scheduler,
461-
* Setting the scheduler to noop will allow the Linux IO scheduler to
462-
* still perform front and back merging, while leaving the request
463-
* ordering and prioritization to the ZFS IO scheduler.
464-
*/
465-
#define VDEV_SCHEDULER "noop"
466-
467459
/*
468460
* A common holder for vdev_bdev_open() is used to relax the exclusive open
469461
* semantics slightly. Internal vdev disk callers may pass VDEV_HOLDER to

man/man5/zfs-module-parameters.5

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3182,20 +3182,6 @@ threshold.
31823182
Default value: \fB32,768\fR.
31833183
.RE
31843184

3185-
.sp
3186-
.ne 2
3187-
.na
3188-
\fBzfs_vdev_scheduler\fR (charp)
3189-
.ad
3190-
.RS 12n
3191-
Set the Linux I/O scheduler on whole disk vdevs to this scheduler. This
3192-
option has been deprecated and will be removed in a future release. The
3193-
standard \fB/sys/block/<block>/queue/scheduler\fR interface should be used
3194-
to set a block device scheduler.
3195-
.sp
3196-
Default value: \fBnoop\fR.
3197-
.RE
3198-
31993185
.sp
32003186
.ne 2
32013187
.na

module/os/linux/zfs/vdev_disk.c

Lines changed: 19 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include <linux/msdos_fs.h>
3838
#include <linux/vfs_compat.h>
3939

40-
char *zfs_vdev_scheduler = VDEV_SCHEDULER;
4140
static void *zfs_vdev_holder = VDEV_HOLDER;
4241

4342
/* size of the "reserved" partition, in blocks */
@@ -141,75 +140,6 @@ vdev_disk_error(zio_t *zio)
141140
zio->io_flags);
142141
}
143142

144-
/*
145-
* Use the Linux 'noop' elevator for zfs managed block devices. This
146-
* strikes the ideal balance by allowing the zfs elevator to do all
147-
* request ordering and prioritization. While allowing the Linux
148-
* elevator to do the maximum front/back merging allowed by the
149-
* physical device. This yields the largest possible requests for
150-
* the device with the lowest total overhead.
151-
*/
152-
static void
153-
vdev_elevator_switch(vdev_t *v, char *elevator)
154-
{
155-
vdev_disk_t *vd = v->vdev_tsd;
156-
struct request_queue *q;
157-
char *device;
158-
int error;
159-
160-
for (int c = 0; c < v->vdev_children; c++)
161-
vdev_elevator_switch(v->vdev_child[c], elevator);
162-
163-
if (!v->vdev_ops->vdev_op_leaf || vd->vd_bdev == NULL)
164-
return;
165-
166-
q = bdev_get_queue(vd->vd_bdev);
167-
device = vd->vd_bdev->bd_disk->disk_name;
168-
169-
/*
170-
* Skip devices which are not whole disks (partitions).
171-
* Device-mapper devices are excepted since they may be whole
172-
* disks despite the vdev_wholedisk flag, in which case we can
173-
* and should switch the elevator. If the device-mapper device
174-
* does not have an elevator (i.e. dm-raid, dm-crypt, etc.) the
175-
* "Skip devices without schedulers" check below will fail.
176-
*/
177-
if (!v->vdev_wholedisk && strncmp(device, "dm-", 3) != 0)
178-
return;
179-
180-
/* Leave existing scheduler when set to "none" */
181-
if ((strncmp(elevator, "none", 4) == 0) && (strlen(elevator) == 4))
182-
return;
183-
184-
/*
185-
* The elevator_change() function was available in kernels from
186-
* 2.6.36 to 4.11. When not available fall back to using the user
187-
* mode helper functionality to set the elevator via sysfs. This
188-
* requires /bin/echo and sysfs to be mounted which may not be true
189-
* early in the boot process.
190-
*/
191-
#ifdef HAVE_ELEVATOR_CHANGE
192-
error = elevator_change(q, elevator);
193-
#else
194-
#define SET_SCHEDULER_CMD \
195-
"exec 0</dev/null " \
196-
" 1>/sys/block/%s/queue/scheduler " \
197-
" 2>/dev/null; " \
198-
"echo %s"
199-
200-
char *argv[] = { "/bin/sh", "-c", NULL, NULL };
201-
char *envp[] = { NULL };
202-
203-
argv[2] = kmem_asprintf(SET_SCHEDULER_CMD, device, elevator);
204-
error = call_usermodehelper(argv[0], argv, envp, UMH_NO_WAIT);
205-
kmem_strfree(argv[2]);
206-
#endif /* HAVE_ELEVATOR_CHANGE */
207-
if (error) {
208-
zfs_dbgmsg("Unable to set \"%s\" scheduler for %s (%s): %d",
209-
elevator, v->vdev_path, device, error);
210-
}
211-
}
212-
213143
static int
214144
vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
215145
uint64_t *ashift)
@@ -343,9 +273,6 @@ vdev_disk_open(vdev_t *v, uint64_t *psize, uint64_t *max_psize,
343273
/* Based on the minimum sector size set the block size */
344274
*ashift = highbit64(MAX(block_size, SPA_MINBLOCKSIZE)) - 1;
345275

346-
/* Try to set the io scheduler elevator algorithm */
347-
(void) vdev_elevator_switch(v, zfs_vdev_scheduler);
348-
349276
return (0);
350277
}
351278

@@ -857,44 +784,6 @@ vdev_disk_rele(vdev_t *vd)
857784
/* XXX: Implement me as a vnode rele for the device */
858785
}
859786

860-
static int
861-
param_set_vdev_scheduler(const char *val, zfs_kernel_param_t *kp)
862-
{
863-
spa_t *spa = NULL;
864-
char *p;
865-
866-
if (val == NULL)
867-
return (SET_ERROR(-EINVAL));
868-
869-
if ((p = strchr(val, '\n')) != NULL)
870-
*p = '\0';
871-
872-
if (spa_mode_global != SPA_MODE_UNINIT) {
873-
mutex_enter(&spa_namespace_lock);
874-
while ((spa = spa_next(spa)) != NULL) {
875-
if (spa_state(spa) != POOL_STATE_ACTIVE ||
876-
!spa_writeable(spa) || spa_suspended(spa))
877-
continue;
878-
879-
spa_open_ref(spa, FTAG);
880-
mutex_exit(&spa_namespace_lock);
881-
vdev_elevator_switch(spa->spa_root_vdev, (char *)val);
882-
mutex_enter(&spa_namespace_lock);
883-
spa_close(spa, FTAG);
884-
}
885-
mutex_exit(&spa_namespace_lock);
886-
}
887-
888-
889-
int error = param_set_charp(val, kp);
890-
if (error == 0) {
891-
printk(KERN_INFO "The 'zfs_vdev_scheduler' module option "
892-
"will be removed in a future release.\n");
893-
}
894-
895-
return (error);
896-
}
897-
898787
vdev_ops_t vdev_disk_ops = {
899788
.vdev_op_open = vdev_disk_open,
900789
.vdev_op_close = vdev_disk_close,
@@ -911,6 +800,25 @@ vdev_ops_t vdev_disk_ops = {
911800
.vdev_op_leaf = B_TRUE /* leaf vdev */
912801
};
913802

803+
/*
804+
* The zfs_vdev_scheduler module option has been deprecated. Setting this
805+
* value no longer has any effect. It has not yet been entirely removed
806+
* to allow the module to be loaded if this option is specified in the
807+
* /etc/modprobe.d/zfs.conf file. The following warning will be logged.
808+
*/
809+
static int
810+
param_set_vdev_scheduler(const char *val, zfs_kernel_param_t *kp)
811+
{
812+
int error = param_set_charp(val, kp);
813+
if (error == 0) {
814+
printk(KERN_INFO "The 'zfs_vdev_scheduler' module option "
815+
"is not supported.\n");
816+
}
817+
818+
return (error);
819+
}
820+
821+
char *zfs_vdev_scheduler = "unused";
914822
module_param_call(zfs_vdev_scheduler, param_set_vdev_scheduler,
915823
param_get_charp, &zfs_vdev_scheduler, 0644);
916824
MODULE_PARM_DESC(zfs_vdev_scheduler, "I/O scheduler");

0 commit comments

Comments
 (0)