diff options
author | Andy Yan <ayan@marvell.com> | 2009-05-11 10:19:25 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-05-23 16:44:08 -0400 |
commit | 9870d9a2428550e7ac3164a26306ad07a99051ae (patch) | |
tree | 73f69109c51ddc4f6a33475ad848e437f0cef66a /drivers/scsi/mvsas/mv_sas.c | |
parent | 77db27cdcbc8ed371fd2f154cbadc7ff32ae8901 (diff) |
[SCSI] mvsas: performance improvement using domain_device->lldd_dev
Using sticky field to improve retrieve performance by eliminating some
lookups in . Remove some spurious casts.
Signed-off-by: Ying Chu <jasonchu@marvell.com>
Signed-off-by: Andy Yan <ayan@marvell.com>
Signed-off-by: Ke Wei <kewei@marvell.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/mvsas/mv_sas.c')
-rw-r--r-- | drivers/scsi/mvsas/mv_sas.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c index 3fc396fc050d..c05e4c05a414 100644 --- a/drivers/scsi/mvsas/mv_sas.c +++ b/drivers/scsi/mvsas/mv_sas.c | |||
@@ -225,7 +225,8 @@ struct mvs_info *mvs_find_dev_mvi(struct domain_device *dev) | |||
225 | int mvs_find_dev_phyno(struct domain_device *dev, int *phyno) | 225 | int mvs_find_dev_phyno(struct domain_device *dev, int *phyno) |
226 | { | 226 | { |
227 | unsigned long i = 0, j = 0, n = 0, num = 0; | 227 | unsigned long i = 0, j = 0, n = 0, num = 0; |
228 | struct mvs_info *mvi = mvs_find_dev_mvi(dev); | 228 | struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev; |
229 | struct mvs_info *mvi = mvi_dev->mvi_info; | ||
229 | struct sas_ha_struct *sha = dev->port->ha; | 230 | struct sas_ha_struct *sha = dev->port->ha; |
230 | 231 | ||
231 | while (sha->sas_port[i]) { | 232 | while (sha->sas_port[i]) { |
@@ -872,8 +873,8 @@ static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags, | |||
872 | struct mvs_tmf_task *tmf) | 873 | struct mvs_tmf_task *tmf) |
873 | { | 874 | { |
874 | struct domain_device *dev = task->dev; | 875 | struct domain_device *dev = task->dev; |
875 | struct mvs_info *mvi; | 876 | struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev; |
876 | struct mvs_device *mvi_dev; | 877 | struct mvs_info *mvi = mvi_dev->mvi_info; |
877 | struct mvs_task_exec_info tei; | 878 | struct mvs_task_exec_info tei; |
878 | struct sas_task *t = task; | 879 | struct sas_task *t = task; |
879 | struct mvs_slot_info *slot; | 880 | struct mvs_slot_info *slot; |
@@ -890,8 +891,6 @@ static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags, | |||
890 | return 0; | 891 | return 0; |
891 | } | 892 | } |
892 | 893 | ||
893 | mvi = mvs_find_dev_mvi(task->dev); | ||
894 | |||
895 | spin_lock_irqsave(&mvi->lock, flags); | 894 | spin_lock_irqsave(&mvi->lock, flags); |
896 | do { | 895 | do { |
897 | dev = t->dev; | 896 | dev = t->dev; |
@@ -1320,7 +1319,7 @@ int mvs_dev_found_notify(struct domain_device *dev, int lock) | |||
1320 | } | 1319 | } |
1321 | dev->lldd_dev = (void *)mvi_device; | 1320 | dev->lldd_dev = (void *)mvi_device; |
1322 | mvi_device->dev_type = dev->dev_type; | 1321 | mvi_device->dev_type = dev->dev_type; |
1323 | 1322 | mvi_device->mvi_info = mvi; | |
1324 | if (parent_dev && DEV_IS_EXPANDER(parent_dev->dev_type)) { | 1323 | if (parent_dev && DEV_IS_EXPANDER(parent_dev->dev_type)) { |
1325 | int phy_id; | 1324 | int phy_id; |
1326 | u8 phy_num = parent_dev->ex_dev.num_phys; | 1325 | u8 phy_num = parent_dev->ex_dev.num_phys; |
@@ -1357,10 +1356,8 @@ int mvs_dev_found(struct domain_device *dev) | |||
1357 | void mvs_dev_gone_notify(struct domain_device *dev, int lock) | 1356 | void mvs_dev_gone_notify(struct domain_device *dev, int lock) |
1358 | { | 1357 | { |
1359 | unsigned long flags = 0; | 1358 | unsigned long flags = 0; |
1360 | struct mvs_info *mvi; | ||
1361 | struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev; | 1359 | struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev; |
1362 | 1360 | struct mvs_info *mvi = mvi_dev->mvi_info; | |
1363 | mvi = mvs_find_dev_mvi(dev); | ||
1364 | 1361 | ||
1365 | if (lock) | 1362 | if (lock) |
1366 | spin_lock_irqsave(&mvi->lock, flags); | 1363 | spin_lock_irqsave(&mvi->lock, flags); |
@@ -1535,8 +1532,8 @@ int mvs_lu_reset(struct domain_device *dev, u8 *lun) | |||
1535 | unsigned long flags; | 1532 | unsigned long flags; |
1536 | int i, phyno[WIDE_PORT_MAX_PHY], num , rc = TMF_RESP_FUNC_FAILED; | 1533 | int i, phyno[WIDE_PORT_MAX_PHY], num , rc = TMF_RESP_FUNC_FAILED; |
1537 | struct mvs_tmf_task tmf_task; | 1534 | struct mvs_tmf_task tmf_task; |
1538 | struct mvs_info *mvi = mvs_find_dev_mvi(dev); | ||
1539 | struct mvs_device * mvi_dev = (struct mvs_device *)dev->lldd_dev; | 1535 | struct mvs_device * mvi_dev = (struct mvs_device *)dev->lldd_dev; |
1536 | struct mvs_info *mvi = mvi_dev->mvi_info; | ||
1540 | 1537 | ||
1541 | tmf_task.tmf = TMF_LU_RESET; | 1538 | tmf_task.tmf = TMF_LU_RESET; |
1542 | mvi_dev->dev_status = MVS_DEV_EH; | 1539 | mvi_dev->dev_status = MVS_DEV_EH; |
@@ -1558,8 +1555,8 @@ int mvs_I_T_nexus_reset(struct domain_device *dev) | |||
1558 | { | 1555 | { |
1559 | unsigned long flags; | 1556 | unsigned long flags; |
1560 | int i, phyno[WIDE_PORT_MAX_PHY], num , rc = TMF_RESP_FUNC_FAILED; | 1557 | int i, phyno[WIDE_PORT_MAX_PHY], num , rc = TMF_RESP_FUNC_FAILED; |
1561 | struct mvs_info *mvi = mvs_find_dev_mvi(dev); | 1558 | struct mvs_device * mvi_dev = (struct mvs_device *)dev->lldd_dev; |
1562 | struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev; | 1559 | struct mvs_info *mvi = mvi_dev->mvi_info; |
1563 | 1560 | ||
1564 | if (mvi_dev->dev_status != MVS_DEV_EH) | 1561 | if (mvi_dev->dev_status != MVS_DEV_EH) |
1565 | return TMF_RESP_FUNC_COMPLETE; | 1562 | return TMF_RESP_FUNC_COMPLETE; |
@@ -1587,7 +1584,8 @@ int mvs_query_task(struct sas_task *task) | |||
1587 | if (task->lldd_task && task->task_proto & SAS_PROTOCOL_SSP) { | 1584 | if (task->lldd_task && task->task_proto & SAS_PROTOCOL_SSP) { |
1588 | struct scsi_cmnd * cmnd = (struct scsi_cmnd *)task->uldd_task; | 1585 | struct scsi_cmnd * cmnd = (struct scsi_cmnd *)task->uldd_task; |
1589 | struct domain_device *dev = task->dev; | 1586 | struct domain_device *dev = task->dev; |
1590 | struct mvs_info *mvi = mvs_find_dev_mvi(dev); | 1587 | struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev; |
1588 | struct mvs_info *mvi = mvi_dev->mvi_info; | ||
1591 | 1589 | ||
1592 | int_to_scsilun(cmnd->device->lun, &lun); | 1590 | int_to_scsilun(cmnd->device->lun, &lun); |
1593 | rc = mvs_find_tag(mvi, task, &tag); | 1591 | rc = mvs_find_tag(mvi, task, &tag); |
@@ -1619,10 +1617,12 @@ int mvs_abort_task(struct sas_task *task) | |||
1619 | struct scsi_lun lun; | 1617 | struct scsi_lun lun; |
1620 | struct mvs_tmf_task tmf_task; | 1618 | struct mvs_tmf_task tmf_task; |
1621 | struct domain_device *dev = task->dev; | 1619 | struct domain_device *dev = task->dev; |
1622 | struct mvs_info *mvi = mvs_find_dev_mvi(dev); | 1620 | struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev; |
1621 | struct mvs_info *mvi = mvi_dev->mvi_info; | ||
1623 | int rc = TMF_RESP_FUNC_FAILED; | 1622 | int rc = TMF_RESP_FUNC_FAILED; |
1624 | unsigned long flags; | 1623 | unsigned long flags; |
1625 | u32 tag; | 1624 | u32 tag; |
1625 | |||
1626 | if (mvi->exp_req) | 1626 | if (mvi->exp_req) |
1627 | mvi->exp_req--; | 1627 | mvi->exp_req--; |
1628 | spin_lock_irqsave(&task->task_state_lock, flags); | 1628 | spin_lock_irqsave(&task->task_state_lock, flags); |
@@ -1652,7 +1652,6 @@ int mvs_abort_task(struct sas_task *task) | |||
1652 | if (rc == TMF_RESP_FUNC_COMPLETE) { | 1652 | if (rc == TMF_RESP_FUNC_COMPLETE) { |
1653 | u32 slot_no; | 1653 | u32 slot_no; |
1654 | struct mvs_slot_info *slot; | 1654 | struct mvs_slot_info *slot; |
1655 | struct mvs_info *mvi = mvs_find_dev_mvi(dev); | ||
1656 | 1655 | ||
1657 | if (task->lldd_task) { | 1656 | if (task->lldd_task) { |
1658 | slot = (struct mvs_slot_info *)task->lldd_task; | 1657 | slot = (struct mvs_slot_info *)task->lldd_task; |