Skip to content

Commit

Permalink
get_disk renamed to get_disk_and_module in 4.16
Browse files Browse the repository at this point in the history
As of torvalds/linux@fb6d47a, get_disk
is now get_disk_and_module. Add a configure check to determine
if we need to use get_disk_and_module.

Signed-off-by: Giuseppe Di Natale <[email protected]>
  • Loading branch information
dinatale2 committed Mar 4, 2018
1 parent 5666a99 commit 323dd89
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/kernel-get-disk-and-module.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
dnl #
dnl # 4.16 API change
dnl # Verify if get_disk_and_module() symbol is available.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_AND_MODULE],
[AC_MSG_CHECKING([whether get_disk_and_module() is available])
ZFS_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/genhd.h>
], [
struct gendisk *disk = NULL;
(void) get_disk_and_module(disk);
], [get_disk_and_module], [block/genhd.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_DISK_AND_MODULE,
1, [get_disk_and_module() is available])
], [
AC_MSG_RESULT(no)
])
])
1 change: 1 addition & 0 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BIO_RW_UNPLUG
ZFS_AC_KERNEL_BLK_QUEUE_HAVE_BLK_PLUG
ZFS_AC_KERNEL_GET_DISK_AND_MODULE
ZFS_AC_KERNEL_GET_DISK_RO
ZFS_AC_KERNEL_GET_GENDISK
ZFS_AC_KERNEL_HAVE_BIO_SET_OP_ATTRS
Expand Down
4 changes: 4 additions & 0 deletions module/zfs/zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,11 @@ zvol_probe(dev_t dev, int *part, void *arg)
struct kobject *kobj;

zv = zvol_find_by_dev(dev);
#ifndef HAVE_GET_DISK_AND_MODULE
kobj = zv ? get_disk(zv->zv_disk) : NULL;
#else
kobj = zv ? get_disk_and_module(zv->zv_disk) : NULL;
#endif
ASSERT(zv == NULL || MUTEX_HELD(&zv->zv_state_lock));
if (zv)
mutex_exit(&zv->zv_state_lock);
Expand Down

0 comments on commit 323dd89

Please sign in to comment.