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 <[email protected]>
---
 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


Reply via email to