mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-01-25 10:12:13 +03:00
Linux 6.18: block_device_operations->getgeo takes struct gendisk*
Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <robn@despairlabs.com>
This commit is contained in:
parent
49f078997a
commit
04d0f83f4e
@ -119,15 +119,49 @@ AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 6.18 API change
|
||||
dnl # block_device_operation->getgeo takes struct gendisk* as first arg
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK], [
|
||||
ZFS_LINUX_TEST_SRC([block_device_operations_getgeo_gendisk], [
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
static int blk_getgeo(struct gendisk *disk, struct hd_geometry *geo)
|
||||
{
|
||||
(void) disk, (void) geo;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static const struct block_device_operations
|
||||
bops __attribute__ ((unused)) = {
|
||||
.getgeo = blk_getgeo,
|
||||
};
|
||||
], [], [])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK], [
|
||||
AC_MSG_CHECKING([whether bops->getgeo() takes gendisk as first arg])
|
||||
ZFS_LINUX_TEST_RESULT([block_device_operations_getgeo_gendisk], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK], [1],
|
||||
[Define if getgeo() in block_device_operations takes struct gendisk * as its first arg])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS], [
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_1ARG
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
|
||||
ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS], [
|
||||
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS
|
||||
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID
|
||||
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK
|
||||
ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK
|
||||
])
|
||||
|
||||
@ -1032,12 +1032,12 @@ zvol_os_update_volsize(zvol_state_t *zv, uint64_t volsize)
|
||||
* tiny devices. For devices over 1 Mib a standard head and sector count
|
||||
* is used to keep the cylinders count reasonable.
|
||||
*/
|
||||
static int
|
||||
zvol_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
static inline int
|
||||
zvol_getgeo_impl(struct gendisk *disk, struct hd_geometry *geo)
|
||||
{
|
||||
zvol_state_t *zv = atomic_load_ptr(&disk->private_data);
|
||||
sector_t sectors;
|
||||
|
||||
zvol_state_t *zv = atomic_load_ptr(&bdev->bd_disk->private_data);
|
||||
ASSERT3P(zv, !=, NULL);
|
||||
ASSERT3U(zv->zv_open_count, >, 0);
|
||||
|
||||
@ -1057,6 +1057,20 @@ zvol_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLOCK_DEVICE_OPERATIONS_GETGEO_GENDISK
|
||||
static int
|
||||
zvol_getgeo(struct gendisk *disk, struct hd_geometry *geo)
|
||||
{
|
||||
return (zvol_getgeo_impl(disk, geo));
|
||||
}
|
||||
#else
|
||||
static int
|
||||
zvol_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
{
|
||||
return (zvol_getgeo_impl(bdev->bd_disk, geo));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Why have two separate block_device_operations structs?
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user