diff --git a/config/kernel-genhd-flags.m4 b/config/kernel-genhd-flags.m4 index af6a8a086..60cc31733 100644 --- a/config/kernel-genhd-flags.m4 +++ b/config/kernel-genhd-flags.m4 @@ -17,12 +17,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENHD_FLAGS], [ ], [ int flags __attribute__ ((unused)) = GENHD_FL_NO_PART; ]) - - ZFS_LINUX_TEST_SRC([genhd_fl_no_part_scan], [ - #include - ], [ - int flags __attribute__ ((unused)) = GENHD_FL_NO_PART_SCAN; - ]) ]) AC_DEFUN([ZFS_AC_KERNEL_GENHD_FLAGS], [ @@ -30,29 +24,18 @@ AC_DEFUN([ZFS_AC_KERNEL_GENHD_FLAGS], [ AC_MSG_CHECKING([whether GENHD_FL_EXT_DEVT flag is available]) ZFS_LINUX_TEST_RESULT([genhd_fl_ext_devt], [ AC_MSG_RESULT(yes) - AC_DEFINE(ZFS_GENHD_FL_EXT_DEVT, GENHD_FL_EXT_DEVT, + AC_DEFINE(HAVE_GENHD_FL_EXT_DEVT, 1, [GENHD_FL_EXT_DEVT flag is available]) ], [ AC_MSG_RESULT(no) - AC_DEFINE(ZFS_GENHD_FL_EXT_DEVT, 0, - [GENHD_FL_EXT_DEVT flag is not available]) ]) AC_MSG_CHECKING([whether GENHD_FL_NO_PART flag is available]) ZFS_LINUX_TEST_RESULT([genhd_fl_no_part], [ AC_MSG_RESULT(yes) - AC_DEFINE(ZFS_GENHD_FL_NO_PART, GENHD_FL_NO_PART, + AC_DEFINE(HAVE_GENHD_FL_NO_PART, 1, [GENHD_FL_NO_PART flag is available]) ], [ AC_MSG_RESULT(no) - - AC_MSG_CHECKING([whether GENHD_FL_NO_PART_SCAN flag is available]) - ZFS_LINUX_TEST_RESULT([genhd_fl_no_part_scan], [ - AC_MSG_RESULT(yes) - AC_DEFINE(ZFS_GENHD_FL_NO_PART, GENHD_FL_NO_PART_SCAN, - [GENHD_FL_NO_PART_SCAN flag is available]) - ], [ - ZFS_LINUX_TEST_ERROR([GENHD_FL_NO_PART|GENHD_FL_NO_PART_SCAN]) - ]) ]) ]) diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h index 7c75e0076..1b9df65c0 100644 --- a/include/os/linux/kernel/linux/blkdev_compat.h +++ b/include/os/linux/kernel/linux/blkdev_compat.h @@ -247,6 +247,19 @@ zfs_check_disk_status(struct block_device *bdev) #endif } +/* + * 5.17 API change + * + * GENHD_FL_EXT_DEVT flag removed + * GENHD_FL_NO_PART_SCAN renamed GENHD_FL_NO_PART + */ +#ifndef HAVE_GENHD_FL_EXT_DEVT +#define GENHD_FL_EXT_DEVT (0) +#endif +#ifndef HAVE_GENHD_FL_NO_PART +#define GENHD_FL_NO_PART (GENHD_FL_NO_PART_SCAN) +#endif + /* * 4.1 API, * 3.10.0 CentOS 7.x API, diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 0c9320fcf..303aafc95 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -1421,8 +1421,8 @@ zvol_alloc(dev_t dev, const char *name, uint64_t volblocksize) */ if (volmode == ZFS_VOLMODE_DEV) { zso->zvo_disk->minors = 1; - zso->zvo_disk->flags &= ~ZFS_GENHD_FL_EXT_DEVT; - zso->zvo_disk->flags |= ZFS_GENHD_FL_NO_PART; + zso->zvo_disk->flags &= ~GENHD_FL_EXT_DEVT; + zso->zvo_disk->flags |= GENHD_FL_NO_PART; } zso->zvo_disk->first_minor = (dev & MINORMASK);