aboutsummaryrefslogtreecommitdiffstats
path: root/module/os/linux/zfs
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2022-04-19 10:38:04 -0700
committerGitHub <[email protected]>2022-04-19 10:38:04 -0700
commit026f126b83c09b7aaaf9e10f57871283c9794a68 (patch)
treed7d1718506c6f7ef3f60d474e77bc42b40d2e37b /module/os/linux/zfs
parentec4d860eb0771b8f9204716b96e4e6ff6c692a73 (diff)
Linux 5.17 compat: GENHD_FL_EXT_DEVT / GENHD_FL_NO_PART_SCAN
As of the 5.17 kernel the GENHD_FL_EXT_DEVT flag has been removed and the GENHD_FL_NO_PART_SCAN flag renamed GENHD_FL_NO_PART. Update zvol_alloc() to set GENHD_FL_NO_PART for the newer kernels which is sufficient. The behavior for prior kernels remains unchanged. 1ebe2e5f ("block: remove GENHD_FL_EXT_DEVT") 46e7eac6 ("block: rename GENHD_FL_NO_PART_SCAN to GENHD_FL_NO_PART") Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #13294 Closes #13297
Diffstat (limited to 'module/os/linux/zfs')
-rw-r--r--module/os/linux/zfs/zvol_os.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/module/os/linux/zfs/zvol_os.c b/module/os/linux/zfs/zvol_os.c
index d30f01f4b..4ebdf8331 100644
--- a/module/os/linux/zfs/zvol_os.c
+++ b/module/os/linux/zfs/zvol_os.c
@@ -906,22 +906,17 @@ zvol_alloc(dev_t dev, const char *name)
zso->zvo_disk->major = zvol_major;
zso->zvo_disk->events = DISK_EVENT_MEDIA_CHANGE;
+ /*
+ * Setting ZFS_VOLMODE_DEV disables partitioning on ZVOL devices.
+ * This is accomplished by limiting the number of minors for the
+ * device to one and explicitly disabling partition scanning.
+ */
if (volmode == ZFS_VOLMODE_DEV) {
- /*
- * ZFS_VOLMODE_DEV disable partitioning on ZVOL devices: set
- * gendisk->minors = 1 as noted in include/linux/blkdev.h.
- * Also disable extended partition numbers (GENHD_FL_EXT_DEVT)
- * and suppresses partition scanning (GENHD_FL_NO_PART_SCAN)
- * setting gendisk->flags accordingly.
- */
zso->zvo_disk->minors = 1;
-#if defined(GENHD_FL_EXT_DEVT)
- zso->zvo_disk->flags &= ~GENHD_FL_EXT_DEVT;
-#endif
-#if defined(GENHD_FL_NO_PART_SCAN)
- zso->zvo_disk->flags |= GENHD_FL_NO_PART_SCAN;
-#endif
+ zso->zvo_disk->flags &= ~ZFS_GENHD_FL_EXT_DEVT;
+ zso->zvo_disk->flags |= ZFS_GENHD_FL_NO_PART;
}
+
zso->zvo_disk->first_minor = (dev & MINORMASK);
zso->zvo_disk->fops = &zvol_ops;
zso->zvo_disk->private_data = zv;