[PATCH 11/13] scsi: alua: Add scsi_device_alua_implicit()

John Garry posted 13 patches 2 weeks, 6 days ago
[PATCH 11/13] scsi: alua: Add scsi_device_alua_implicit()
Posted by John Garry 2 weeks, 6 days ago
Add to function to check whether implicit support is available, as this
will be the general check for ALUA support and no DH support.

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 drivers/scsi/scsi_alua.c | 7 +++++++
 include/scsi/scsi_alua.h | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/scsi/scsi_alua.c b/drivers/scsi/scsi_alua.c
index c269105dbae4a..d3fcd887e5018 100644
--- a/drivers/scsi/scsi_alua.c
+++ b/drivers/scsi/scsi_alua.c
@@ -631,6 +631,13 @@ blk_status_t scsi_alua_prep_fn(struct scsi_device *sdev, struct request *req)
 }
 EXPORT_SYMBOL_GPL(scsi_alua_prep_fn);
 
+bool scsi_device_alua_implicit(struct scsi_device *sdev)
+{
+	if (!sdev->alua)
+		return false;
+	return sdev->alua->tpgs & TPGS_MODE_IMPLICIT;
+}
+
 int scsi_alua_init(void)
 {
 	kalua_wq = alloc_workqueue("kalua", WQ_MEM_RECLAIM | WQ_PERCPU, 0);
diff --git a/include/scsi/scsi_alua.h b/include/scsi/scsi_alua.h
index c16d4adc915ec..2d5db944f75b7 100644
--- a/include/scsi/scsi_alua.h
+++ b/include/scsi/scsi_alua.h
@@ -40,6 +40,8 @@ int scsi_alua_stpg_run(struct scsi_device *sdev, bool optimize);
 
 blk_status_t scsi_alua_prep_fn(struct scsi_device *sdev, struct request *req);
 
+bool scsi_device_alua_implicit(struct scsi_device *sdev);
+
 int scsi_alua_init(void);
 void scsi_exit_alua(void);
 #else //CONFIG_SCSI_ALUA
@@ -64,6 +66,10 @@ blk_status_t scsi_alua_prep_fn(struct scsi_device *sdev, struct request *req)
 {
 	return BLK_STS_OK;
 }
+static inline bool scsi_device_alua_implicit(struct scsi_device *sdev)
+{
+	return false;
+}
 static inline int scsi_alua_sdev_init(struct scsi_device *sdev)
 {
 	return 0;
-- 
2.43.5
Re: [PATCH 11/13] scsi: alua: Add scsi_device_alua_implicit()
Posted by Hannes Reinecke 2 weeks, 5 days ago
On 3/17/26 13:07, John Garry wrote:
> Add to function to check whether implicit support is available, as this
> will be the general check for ALUA support and no DH support.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>   drivers/scsi/scsi_alua.c | 7 +++++++
>   include/scsi/scsi_alua.h | 6 ++++++
>   2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/scsi/scsi_alua.c b/drivers/scsi/scsi_alua.c
> index c269105dbae4a..d3fcd887e5018 100644
> --- a/drivers/scsi/scsi_alua.c
> +++ b/drivers/scsi/scsi_alua.c
> @@ -631,6 +631,13 @@ blk_status_t scsi_alua_prep_fn(struct scsi_device *sdev, struct request *req)
>   }
>   EXPORT_SYMBOL_GPL(scsi_alua_prep_fn);
>   
> +bool scsi_device_alua_implicit(struct scsi_device *sdev)
> +{
> +	if (!sdev->alua)
> +		return false;
> +	return sdev->alua->tpgs & TPGS_MODE_IMPLICIT;
> +}
> +
>   int scsi_alua_init(void)
>   {
>   	kalua_wq = alloc_workqueue("kalua", WQ_MEM_RECLAIM | WQ_PERCPU, 0);
> diff --git a/include/scsi/scsi_alua.h b/include/scsi/scsi_alua.h
> index c16d4adc915ec..2d5db944f75b7 100644
> --- a/include/scsi/scsi_alua.h
> +++ b/include/scsi/scsi_alua.h
> @@ -40,6 +40,8 @@ int scsi_alua_stpg_run(struct scsi_device *sdev, bool optimize);
>   
>   blk_status_t scsi_alua_prep_fn(struct scsi_device *sdev, struct request *req);
>   
> +bool scsi_device_alua_implicit(struct scsi_device *sdev);
> +
>   int scsi_alua_init(void);
>   void scsi_exit_alua(void);
>   #else //CONFIG_SCSI_ALUA
> @@ -64,6 +66,10 @@ blk_status_t scsi_alua_prep_fn(struct scsi_device *sdev, struct request *req)
>   {
>   	return BLK_STS_OK;
>   }
> +static inline bool scsi_device_alua_implicit(struct scsi_device *sdev)
> +{
> +	return false;
> +}
>   static inline int scsi_alua_sdev_init(struct scsi_device *sdev)
>   {
>   	return 0;

Hmm. Can you fold it into the patch where it's actually called?
It's getting hard to review without that.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
Re: [PATCH 11/13] scsi: alua: Add scsi_device_alua_implicit()
Posted by John Garry 2 weeks ago
On 18/03/2026 08:02, Hannes Reinecke wrote:
>> +
>>   int scsi_alua_init(void);
>>   void scsi_exit_alua(void);
>>   #else //CONFIG_SCSI_ALUA
>> @@ -64,6 +66,10 @@ blk_status_t scsi_alua_prep_fn(struct scsi_device 
>> *sdev, struct request *req)
>>   {
>>       return BLK_STS_OK;
>>   }
>> +static inline bool scsi_device_alua_implicit(struct scsi_device *sdev)
>> +{
>> +    return false;
>> +}
>>   static inline int scsi_alua_sdev_init(struct scsi_device *sdev)
>>   {
>>       return 0;
> 
> Hmm. Can you fold it into the patch where it's actually called?
> It's getting hard to review without that.

Sure, this series is taking baby steps ..

Thanks,
John