Add a function to find associated mpath_disk for a request.
Signed-off-by: John Garry <[email protected]>
---
drivers/scsi/sd.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index f94a3b696dcab..9617878b53ec6 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -4081,6 +4081,14 @@ static int sd_mpath_ioctl(struct scsi_device *sdp,
blk_mode_t mode,
return sd_ioctl(bdev, mode, cmd, arg);
}
+static struct mpath_disk *sd_mpath_to_disk(struct request *req)
+{
+ struct scsi_disk *sdkp = req->part->bd_disk->private_data;
+ struct sd_mpath_disk *sd_mpath_disk = sdkp->sd_mpath_disk;
+
+ return sd_mpath_disk->mpath_disk;
+}
+
static int sd_mpath_pr_register(struct scsi_device *sdp, u64 old_key,
u64 new_key, u32 flags)
{
@@ -4592,6 +4600,7 @@ static struct scsi_driver sd_template = {
.mpath_end_cmd = sd_mpath_end_command,
.mpath_ioctl = sd_mpath_ioctl,
.mpath_pr_ops = &sd_mpath_pr_ops,
+ .to_mpath_disk = sd_mpath_to_disk,
#endif
.done = sd_done,
.eh_action = sd_eh_action,
--
2.43.5