Skip to content

Commit aa90f49

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi_dh_alua: move optimize_stpg evaluation
When the optimize_stpg module option is set we should just set it once during port_group allocation. Doing so allows us to override it later with device specific settings. Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 2826140 commit aa90f49

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/scsi/device_handler/scsi_dh_alua.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
#define ALUA_OPTIMIZE_STPG 1
6565
#define ALUA_RTPG_EXT_HDR_UNSUPP 2
6666

67+
static uint optimize_stpg;
68+
module_param(optimize_stpg, uint, S_IRUGO|S_IWUSR);
69+
MODULE_PARM_DESC(optimize_stpg, "Allow use of a non-optimized path, rather than sending a STPG, when implicit TPGS is supported (0=No,1=Yes). Default is 0.");
70+
6771
static LIST_HEAD(port_group_list);
6872
static DEFINE_SPINLOCK(port_group_lock);
6973

@@ -219,6 +223,8 @@ struct alua_port_group *alua_alloc_pg(struct scsi_device *sdev,
219223
pg->group_id = group_id;
220224
pg->tpgs = tpgs;
221225
pg->state = TPGS_STATE_OPTIMIZED;
226+
if (optimize_stpg)
227+
pg->flags |= ALUA_OPTIMIZE_STPG;
222228
kref_init(&pg->kref);
223229

224230
spin_lock(&port_group_lock);
@@ -678,10 +684,6 @@ static int alua_set_params(struct scsi_device *sdev, const char *params)
678684
return result;
679685
}
680686

681-
static uint optimize_stpg;
682-
module_param(optimize_stpg, uint, S_IRUGO|S_IWUSR);
683-
MODULE_PARM_DESC(optimize_stpg, "Allow use of a non-optimized path, rather than sending a STPG, when implicit TPGS is supported (0=No,1=Yes). Default is 0.");
684-
685687
/*
686688
* alua_activate - activate a path
687689
* @sdev: device on the path to be activated
@@ -703,9 +705,6 @@ static int alua_activate(struct scsi_device *sdev,
703705

704706
kref_get(&h->pg->kref);
705707

706-
if (optimize_stpg)
707-
h->pg->flags |= ALUA_OPTIMIZE_STPG;
708-
709708
err = alua_rtpg(sdev, h->pg);
710709
if (err != SCSI_DH_OK) {
711710
kref_put(&h->pg->kref, release_port_group);

0 commit comments

Comments
 (0)