On Wed, Feb 25, 2026 at 03:36:13PM +0000, John Garry wrote:
> Add scsi_mpath_{start,end}_request() to handle updating private multipath
> request data, like nvme_mpath_{start,end}_request().
> 
> Since we may need to update mpath_disk data, add a callbacks in
> scsi_driver to actually do this work for the scsi driver.
> 
> Signed-off-by: John Garry <[email protected]>
> ---
>  drivers/scsi/scsi_lib.c       |  4 ++++
>  include/scsi/scsi_driver.h    |  2 ++
>  include/scsi/scsi_multipath.h | 24 ++++++++++++++++++++++++
>  3 files changed, 30 insertions(+)
> 
>       #ifdef CONFIG_SCSI_MULTIPATH
> +     void (*mpath_start_cmd)(struct scsi_cmnd *);
> +     void (*mpath_end_cmd)(struct scsi_cmnd *);
>       struct mpath_disk *(*to_mpath_disk)(struct request *);
>       #endif
>  };
> diff --git a/include/scsi/scsi_multipath.h b/include/scsi/scsi_multipath.h
> index 07db217edb085..6cb3107260952 100644
> --- a/include/scsi/scsi_multipath.h
> +++ b/include/scsi/scsi_multipath.h
> @@ -56,6 +56,23 @@ void scsi_mpath_add_sysfs_link(struct scsi_device *sdev);
>  void scsi_mpath_remove_sysfs_link(struct scsi_device *sdev);
>  int scsi_mpath_get_head(struct scsi_mpath_head *);
>  void scsi_mpath_put_head(struct scsi_mpath_head *);
> +
> +static inline void scsi_mpath_start_request(struct request *req)
> +{
> +     struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
> +
> +     if (is_mpath_request(req))
> +             scsi_cmd_to_driver(cmd)->mpath_start_cmd(cmd);
> +}
> +
> +static inline void scsi_mpath_end_request(struct request *req)
> +{
> +     struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
> +
> +     if (is_mpath_request(req))
> +             scsi_cmd_to_driver(cmd)->mpath_start_cmd(cmd);

Copy-paste error. It should be:

                scsi_cmd_to_driver(cmd)->mpath_end_cmd(cmd);

-Ben


Reply via email to