[PATCH 12/13] libmultipath: Add mpath_bdev_getgeo()

John Garry john.g.garry at oracle.com
Wed Feb 25 07:32:24 PST 2026


Add mpath_bdev_getgeo() as a multipath block device .getgeo handler.

Here we just redirect into the selected mpath_device disk fops->getgeo
handler.

Signed-off-by: John Garry <john.g.garry at oracle.com>
---
 lib/multipath.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/multipath.c b/lib/multipath.c
index 537579ad5989e..192ecd886b958 100644
--- a/lib/multipath.c
+++ b/lib/multipath.c
@@ -536,6 +536,22 @@ __releases(&mpath_head->srcu)
 }
 EXPORT_SYMBOL_GPL(mpath_head_read_unlock);
 
+static int mpath_bdev_getgeo(struct gendisk *disk, struct hd_geometry *geo)
+{
+	struct mpath_disk *mpath_disk = mpath_gendisk_to_disk(disk);
+	struct mpath_head *mpath_head = mpath_disk->mpath_head;
+	int srcu_idx, ret = -EWOULDBLOCK;
+	struct mpath_device *mpath_device;
+
+	srcu_idx = srcu_read_lock(&mpath_head->srcu);
+	mpath_device = mpath_find_path(mpath_head);
+	if (mpath_device)
+		ret = mpath_device->disk->fops->getgeo(mpath_device->disk, geo);
+	srcu_read_unlock(&mpath_head->srcu, srcu_idx);
+
+	return ret;
+}
+
 static int mpath_pr_register(struct block_device *bdev, u64 old_key,
 			u64 new_key, unsigned int flags)
 {
@@ -689,6 +705,7 @@ const struct block_device_operations mpath_ops = {
 	.ioctl		= mpath_bdev_ioctl,
 	.compat_ioctl	= blkdev_compat_ptr_ioctl,
 	.report_zones	= mpath_bdev_report_zones,
+	.getgeo		= mpath_bdev_getgeo,
 	.pr_ops		= &mpath_pr_ops,
 };
 EXPORT_SYMBOL_GPL(mpath_ops);
-- 
2.43.5




More information about the Linux-nvme mailing list