Re: [PATCH 09/13] libmultipath: Add PR support
From: John Garry
Date: Wed Feb 25 2026 - 11:52:48 EST
On 25/02/2026 15:49, Keith Busch wrote:
On Wed, Feb 25, 2026 at 03:32:21PM +0000, John Garry wrote:
+static int mpath_pr_register(struct block_device *bdev, u64 old_key,Instead of having the lower layer define new mp template functions, why
+ u64 new_key, unsigned int flags)
+{
+ struct mpath_disk *mpath_disk = dev_get_drvdata(&bdev->bd_device);
+ struct mpath_head *mpath_head = mpath_disk->mpath_head;
+ struct mpath_device *mpath_device;
+ int srcu_idx, ret = -EWOULDBLOCK;
+
+ srcu_idx = srcu_read_lock(&mpath_head->srcu);
+ mpath_device = mpath_find_path(mpath_head);
+ if (mpath_device)
+ ret = mpath_head->mpdt->pr_ops->pr_register(mpath_device,
+ old_key, new_key, flags);
+ srcu_read_unlock(&mpath_head->srcu, srcu_idx);
not use the existing pr_ops from mpath_device->disk->fops->pr_ops?
Yeah, that should be possible and I did use disk->fops elsewhere. We would just need to find the per-path bdev. I just wasn't sure if that was a preferred style.
cheers