diff --git a/config/kernel-get-disk-and-module.m4 b/config/kernel-get-disk-and-module.m4 deleted file mode 100644 index 51cf7743cf0b..000000000000 --- a/config/kernel-get-disk-and-module.m4 +++ /dev/null @@ -1,24 +0,0 @@ -dnl # -dnl # 4.16 API change -dnl # Verify if get_disk_and_module() symbol is available. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_DISK_AND_MODULE], [ - ZFS_LINUX_TEST_SRC([get_disk_and_module], [ - #include - ], [ - struct gendisk *disk = NULL; - (void) get_disk_and_module(disk); - ]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_AND_MODULE], [ - AC_MSG_CHECKING([whether get_disk_and_module() is available]) - ZFS_LINUX_TEST_RESULT_SYMBOL([get_disk_and_module], - [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) - ]) -]) diff --git a/config/kernel.m4 b/config/kernel.m4 index 03271411fbc6..fc7ae95dbcbd 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -61,7 +61,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_BIO ZFS_AC_KERNEL_SRC_BLKDEV ZFS_AC_KERNEL_SRC_BLK_QUEUE - ZFS_AC_KERNEL_SRC_GET_DISK_AND_MODULE ZFS_AC_KERNEL_SRC_REVALIDATE_DISK ZFS_AC_KERNEL_SRC_GET_DISK_RO ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL @@ -160,7 +159,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_BIO ZFS_AC_KERNEL_BLKDEV ZFS_AC_KERNEL_BLK_QUEUE - ZFS_AC_KERNEL_GET_DISK_AND_MODULE ZFS_AC_KERNEL_REVALIDATE_DISK ZFS_AC_KERNEL_GET_DISK_RO ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h index e1270cb25d66..e41b248b0405 100644 --- a/include/os/linux/kernel/linux/blkdev_compat.h +++ b/include/os/linux/kernel/linux/blkdev_compat.h @@ -99,14 +99,6 @@ blk_queue_set_read_ahead(struct request_queue *q, unsigned long ra_pages) #endif } -#if !defined(HAVE_GET_DISK_AND_MODULE) -static inline struct kobject * -get_disk_and_module(struct gendisk *disk) -{ - return (get_disk(disk)); -} -#endif - #ifdef HAVE_BIO_BVEC_ITER #define BIO_BI_SECTOR(bio) (bio)->bi_iter.bi_sector #define BIO_BI_SIZE(bio) (bio)->bi_iter.bi_size diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c index 6f5ef12e74a6..cdc2076702af 100644 --- a/module/os/linux/zfs/zvol_os.c +++ b/module/os/linux/zfs/zvol_os.c @@ -708,46 +708,6 @@ zvol_getgeo(struct block_device *bdev, struct hd_geometry *geo) return (0); } -/* - * Find a zvol_state_t given the full major+minor dev_t. If found, - * return with zv_state_lock taken, otherwise, return (NULL) without - * taking zv_state_lock. - */ -static zvol_state_t * -zvol_find_by_dev(dev_t dev) -{ - zvol_state_t *zv; - - rw_enter(&zvol_state_lock, RW_READER); - for (zv = list_head(&zvol_state_list); zv != NULL; - zv = list_next(&zvol_state_list, zv)) { - mutex_enter(&zv->zv_state_lock); - if (zv->zv_zso->zvo_dev == dev) { - rw_exit(&zvol_state_lock); - return (zv); - } - mutex_exit(&zv->zv_state_lock); - } - rw_exit(&zvol_state_lock); - - return (NULL); -} - -static struct kobject * -zvol_probe(dev_t dev, int *part, void *arg) -{ - zvol_state_t *zv; - struct kobject *kobj; - - zv = zvol_find_by_dev(dev); - kobj = zv ? get_disk_and_module(zv->zv_zso->zvo_disk) : NULL; - ASSERT(zv == NULL || MUTEX_HELD(&zv->zv_state_lock)); - if (zv) - mutex_exit(&zv->zv_state_lock); - - return (kobj); -} - static struct block_device_operations zvol_ops = { .open = zvol_open, .release = zvol_release, @@ -1100,9 +1060,6 @@ zvol_init(void) return (-ENOMEM); } zvol_init_impl(); - blk_register_region(MKDEV(zvol_major, 0), 1UL << MINORBITS, - THIS_MODULE, zvol_probe, NULL, NULL); - ida_init(&zvol_ida); zvol_register_ops(&zvol_linux_ops); return (0); @@ -1112,7 +1069,6 @@ void zvol_fini(void) { zvol_fini_impl(); - blk_unregister_region(MKDEV(zvol_major, 0), 1UL << MINORBITS); unregister_blkdev(zvol_major, ZVOL_DRIVER); taskq_destroy(zvol_taskq); ida_destroy(&zvol_ida);