Skip to content

Commit

Permalink
config: rework ZFS_GENHD_FL_*
Browse files Browse the repository at this point in the history
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Tino Reichardt <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #16479
  • Loading branch information
robn authored and behlendorf committed Sep 18, 2024
1 parent d4e5538 commit 0a61e51
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
21 changes: 2 additions & 19 deletions config/kernel-genhd-flags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,25 @@ 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], [
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])
])
])
])
13 changes: 13 additions & 0 deletions include/os/linux/kernel/linux/blkdev_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions module/os/linux/zfs/zvol_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0a61e51

Please sign in to comment.