mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Linux 5.11 compat: blk_{un}register_region()
As of 5.11 the blk_register_region() and blk_unregister_region() functions have been retired. This isn't a problem since add_disk() has implicitly allocated minor numbers for a very long time. Reviewed-by: Rafael Kitover <rkitover@gmail.com> Reviewed-by: Coleman Kane <ckane@colemankane.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #11387 Closes #11390
This commit is contained in:
parent
19697e4545
commit
c449d4b06d
@ -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 <linux/genhd.h>
|
||||
], [
|
||||
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)
|
||||
])
|
||||
])
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user