config: rework ZFS_GENHD_FL_*

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16479
This commit is contained in:
Rob Norris 2024-08-24 22:06:22 +10:00 committed by Brian Behlendorf
parent d4e5538014
commit 0a61e51736
3 changed files with 17 additions and 21 deletions

View File

@ -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 <linux/blkdev.h>
], [
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])
])
])
])

View File

@ -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,

View File

@ -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);