Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 4.14 compat: blk_queue_stackable() #7645

Merged
merged 1 commit into from
Jun 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/kernel-elevator-change.m4
Original file line number Diff line number Diff line change
@@ -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])
Expand Down
11 changes: 0 additions & 11 deletions include/linux/blkdev_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ blk_queue_set_write_cache(struct request_queue *q, bool wc, bool fua)
#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
#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().
Expand Down
25 changes: 11 additions & 14 deletions module/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,23 +167,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 " \
Expand All @@ -197,10 +194,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(KERN_NOTICE "ZFS: Unable to set \"%s\" scheduler"
" for %s (%s): %d\n", elevator, v->vdev_path, device,
error);
if (error) {
zfs_dbgmsg("Unable to set \"%s\" scheduler for %s (%s): %d\n",
elevator, v->vdev_path, device, error);
}
}

/*
Expand Down