提交 9870d9a2 编写于 作者: A Andy Yan 提交者: James Bottomley

[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: NYing Chu <jasonchu@marvell.com>
Signed-off-by: NAndy Yan <ayan@marvell.com>
Signed-off-by: NKe Wei <kewei@marvell.com>
Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
上级 77db27cd
...@@ -225,7 +225,8 @@ struct mvs_info *mvs_find_dev_mvi(struct domain_device *dev) ...@@ -225,7 +225,8 @@ struct mvs_info *mvs_find_dev_mvi(struct domain_device *dev)
int mvs_find_dev_phyno(struct domain_device *dev, int *phyno) int mvs_find_dev_phyno(struct domain_device *dev, int *phyno)
{ {
unsigned long i = 0, j = 0, n = 0, num = 0; unsigned long i = 0, j = 0, n = 0, num = 0;
struct mvs_info *mvi = mvs_find_dev_mvi(dev); struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev;
struct mvs_info *mvi = mvi_dev->mvi_info;
struct sas_ha_struct *sha = dev->port->ha; struct sas_ha_struct *sha = dev->port->ha;
while (sha->sas_port[i]) { 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,8 +873,8 @@ static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags,
struct mvs_tmf_task *tmf) struct mvs_tmf_task *tmf)
{ {
struct domain_device *dev = task->dev; struct domain_device *dev = task->dev;
struct mvs_info *mvi; struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev;
struct mvs_device *mvi_dev; struct mvs_info *mvi = mvi_dev->mvi_info;
struct mvs_task_exec_info tei; struct mvs_task_exec_info tei;
struct sas_task *t = task; struct sas_task *t = task;
struct mvs_slot_info *slot; 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,8 +891,6 @@ static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags,
return 0; return 0;
} }
mvi = mvs_find_dev_mvi(task->dev);
spin_lock_irqsave(&mvi->lock, flags); spin_lock_irqsave(&mvi->lock, flags);
do { do {
dev = t->dev; dev = t->dev;
...@@ -1320,7 +1319,7 @@ int mvs_dev_found_notify(struct domain_device *dev, int lock) ...@@ -1320,7 +1319,7 @@ int mvs_dev_found_notify(struct domain_device *dev, int lock)
} }
dev->lldd_dev = (void *)mvi_device; dev->lldd_dev = (void *)mvi_device;
mvi_device->dev_type = dev->dev_type; mvi_device->dev_type = dev->dev_type;
mvi_device->mvi_info = mvi;
if (parent_dev && DEV_IS_EXPANDER(parent_dev->dev_type)) { if (parent_dev && DEV_IS_EXPANDER(parent_dev->dev_type)) {
int phy_id; int phy_id;
u8 phy_num = parent_dev->ex_dev.num_phys; u8 phy_num = parent_dev->ex_dev.num_phys;
...@@ -1357,10 +1356,8 @@ int mvs_dev_found(struct domain_device *dev) ...@@ -1357,10 +1356,8 @@ int mvs_dev_found(struct domain_device *dev)
void mvs_dev_gone_notify(struct domain_device *dev, int lock) void mvs_dev_gone_notify(struct domain_device *dev, int lock)
{ {
unsigned long flags = 0; unsigned long flags = 0;
struct mvs_info *mvi;
struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev; struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev;
struct mvs_info *mvi = mvi_dev->mvi_info;
mvi = mvs_find_dev_mvi(dev);
if (lock) if (lock)
spin_lock_irqsave(&mvi->lock, flags); spin_lock_irqsave(&mvi->lock, flags);
...@@ -1535,8 +1532,8 @@ int mvs_lu_reset(struct domain_device *dev, u8 *lun) ...@@ -1535,8 +1532,8 @@ int mvs_lu_reset(struct domain_device *dev, u8 *lun)
unsigned long flags; unsigned long flags;
int i, phyno[WIDE_PORT_MAX_PHY], num , rc = TMF_RESP_FUNC_FAILED; int i, phyno[WIDE_PORT_MAX_PHY], num , rc = TMF_RESP_FUNC_FAILED;
struct mvs_tmf_task tmf_task; struct mvs_tmf_task tmf_task;
struct mvs_info *mvi = mvs_find_dev_mvi(dev);
struct mvs_device * mvi_dev = (struct mvs_device *)dev->lldd_dev; struct mvs_device * mvi_dev = (struct mvs_device *)dev->lldd_dev;
struct mvs_info *mvi = mvi_dev->mvi_info;
tmf_task.tmf = TMF_LU_RESET; tmf_task.tmf = TMF_LU_RESET;
mvi_dev->dev_status = MVS_DEV_EH; mvi_dev->dev_status = MVS_DEV_EH;
...@@ -1558,8 +1555,8 @@ int mvs_I_T_nexus_reset(struct domain_device *dev) ...@@ -1558,8 +1555,8 @@ int mvs_I_T_nexus_reset(struct domain_device *dev)
{ {
unsigned long flags; unsigned long flags;
int i, phyno[WIDE_PORT_MAX_PHY], num , rc = TMF_RESP_FUNC_FAILED; int i, phyno[WIDE_PORT_MAX_PHY], num , rc = TMF_RESP_FUNC_FAILED;
struct mvs_info *mvi = mvs_find_dev_mvi(dev); struct mvs_device * mvi_dev = (struct mvs_device *)dev->lldd_dev;
struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev; struct mvs_info *mvi = mvi_dev->mvi_info;
if (mvi_dev->dev_status != MVS_DEV_EH) if (mvi_dev->dev_status != MVS_DEV_EH)
return TMF_RESP_FUNC_COMPLETE; return TMF_RESP_FUNC_COMPLETE;
...@@ -1587,7 +1584,8 @@ int mvs_query_task(struct sas_task *task) ...@@ -1587,7 +1584,8 @@ int mvs_query_task(struct sas_task *task)
if (task->lldd_task && task->task_proto & SAS_PROTOCOL_SSP) { if (task->lldd_task && task->task_proto & SAS_PROTOCOL_SSP) {
struct scsi_cmnd * cmnd = (struct scsi_cmnd *)task->uldd_task; struct scsi_cmnd * cmnd = (struct scsi_cmnd *)task->uldd_task;
struct domain_device *dev = task->dev; struct domain_device *dev = task->dev;
struct mvs_info *mvi = mvs_find_dev_mvi(dev); struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev;
struct mvs_info *mvi = mvi_dev->mvi_info;
int_to_scsilun(cmnd->device->lun, &lun); int_to_scsilun(cmnd->device->lun, &lun);
rc = mvs_find_tag(mvi, task, &tag); rc = mvs_find_tag(mvi, task, &tag);
...@@ -1619,10 +1617,12 @@ int mvs_abort_task(struct sas_task *task) ...@@ -1619,10 +1617,12 @@ int mvs_abort_task(struct sas_task *task)
struct scsi_lun lun; struct scsi_lun lun;
struct mvs_tmf_task tmf_task; struct mvs_tmf_task tmf_task;
struct domain_device *dev = task->dev; struct domain_device *dev = task->dev;
struct mvs_info *mvi = mvs_find_dev_mvi(dev); struct mvs_device *mvi_dev = (struct mvs_device *)dev->lldd_dev;
struct mvs_info *mvi = mvi_dev->mvi_info;
int rc = TMF_RESP_FUNC_FAILED; int rc = TMF_RESP_FUNC_FAILED;
unsigned long flags; unsigned long flags;
u32 tag; u32 tag;
if (mvi->exp_req) if (mvi->exp_req)
mvi->exp_req--; mvi->exp_req--;
spin_lock_irqsave(&task->task_state_lock, flags); spin_lock_irqsave(&task->task_state_lock, flags);
...@@ -1652,7 +1652,6 @@ int mvs_abort_task(struct sas_task *task) ...@@ -1652,7 +1652,6 @@ int mvs_abort_task(struct sas_task *task)
if (rc == TMF_RESP_FUNC_COMPLETE) { if (rc == TMF_RESP_FUNC_COMPLETE) {
u32 slot_no; u32 slot_no;
struct mvs_slot_info *slot; struct mvs_slot_info *slot;
struct mvs_info *mvi = mvs_find_dev_mvi(dev);
if (task->lldd_task) { if (task->lldd_task) {
slot = (struct mvs_slot_info *)task->lldd_task; slot = (struct mvs_slot_info *)task->lldd_task;
......
...@@ -231,7 +231,9 @@ struct mvs_phy { ...@@ -231,7 +231,9 @@ struct mvs_phy {
}; };
struct mvs_device { struct mvs_device {
struct list_head dev_entry;
enum sas_dev_type dev_type; enum sas_dev_type dev_type;
struct mvs_info *mvi_info;
struct domain_device *sas_device; struct domain_device *sas_device;
u32 attached_phy; u32 attached_phy;
u32 device_id; u32 device_id;
...@@ -239,7 +241,6 @@ struct mvs_device { ...@@ -239,7 +241,6 @@ struct mvs_device {
u8 taskfileset; u8 taskfileset;
u8 dev_status; u8 dev_status;
u16 reserved; u16 reserved;
struct list_head dev_entry;
}; };
struct mvs_slot_info { struct mvs_slot_info {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册