aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoger, Babu <Babu.Moger@netapp.com>2012-03-27 16:56:20 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-04-23 14:28:18 -0400
commit72d9e0f383c2b7a2e2fe4442577319bae0686f40 (patch)
treeb2b189795687b7cfd179351d4e31e05c501ff817
parentdcd3a754b8c811441326d68574598fb3b4976ff4 (diff)
[SCSI] scsi_dh_alua: Optimize the STPG command
This patch optimizes the set target port group(STPG) command. During our testing, we found that it is not optimal to send stpg command every time the path group switch happens. This patch uses PREF (preferred target port) bit with combination of flags passed by multipath user level tool to optimize this behaviour. If PREF bit is set then it issues a STPG command, otherwise it will let implicit transfer take place. By default there is no change in the behaviour. User tool needs to pass the parameter to make this change take effect. Patch has been tested on NetApp E series storage. Signed-off-by: Babu Moger <babu.moger@netapp.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/device_handler/scsi_dh_alua.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 4865a99d9c3..fda9cdea0e6 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -675,14 +675,37 @@ static int alua_activate(struct scsi_device *sdev,
675{ 675{
676 struct alua_dh_data *h = get_alua_data(sdev); 676 struct alua_dh_data *h = get_alua_data(sdev);
677 int err = SCSI_DH_OK; 677 int err = SCSI_DH_OK;
678 int stpg = 0;
678 679
679 err = alua_rtpg(sdev, h); 680 err = alua_rtpg(sdev, h);
680 if (err != SCSI_DH_OK) 681 if (err != SCSI_DH_OK)
681 goto out; 682 goto out;
682 683
683 if (h->tpgs & TPGS_MODE_EXPLICIT && 684 if (h->tpgs & TPGS_MODE_EXPLICIT) {
684 h->state != TPGS_STATE_OPTIMIZED && 685 switch (h->state) {
685 h->state != TPGS_STATE_LBA_DEPENDENT) { 686 case TPGS_STATE_NONOPTIMIZED:
687 stpg = 1;
688 if ((h->flags & ALUA_OPTIMIZE_STPG) &&
689 (!h->pref) &&
690 (h->tpgs & TPGS_MODE_IMPLICIT))
691 stpg = 0;
692 break;
693 case TPGS_STATE_STANDBY:
694 stpg = 1;
695 break;
696 case TPGS_STATE_UNAVAILABLE:
697 case TPGS_STATE_OFFLINE:
698 err = SCSI_DH_IO;
699 break;
700 case TPGS_STATE_TRANSITIONING:
701 err = SCSI_DH_RETRY;
702 break;
703 default:
704 break;
705 }
706 }
707
708 if (stpg) {
686 h->callback_fn = fn; 709 h->callback_fn = fn;
687 h->callback_data = data; 710 h->callback_data = data;
688 err = submit_stpg(h); 711 err = submit_stpg(h);