[PATCH 10/12] megaraid_sas: Add smp_mb__after_atomic_*() for instance->fw_outstanding

From: Nicholas A. Bellinger
Date: Sun Dec 19 2010 - 16:23:10 EST


From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

This patch adds four missing smp_mb__after_atomic_[inc,dec] barriers
for atomic_inc() and atomic_dec() usage with instance->fw_outstanding
within the main I/O dispatcher megasas_queue_command_lck(), completion
callback megasas_complete_cmd() and struct megasas_instance HW reset
queue drain in megasas_issue_pending_cmds_again().

Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
---
drivers/scsi/megaraid/megaraid_sas.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 7451bc0..31c5419 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -1398,6 +1398,7 @@ megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd
* Issue the command to the FW
*/
atomic_inc(&instance->fw_outstanding);
+ smp_mb__after_atomic_inc();

instance->instancet->fire_cmd(instance, cmd->frame_phys_addr,
cmd->frame_count-1, instance->reg_set);
@@ -2068,6 +2069,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
if (exception) {

atomic_dec(&instance->fw_outstanding);
+ smp_mb__after_atomic_dec();

scsi_dma_unmap(cmd->scmd);
cmd->scmd->scsi_done(cmd->scmd);
@@ -2116,6 +2118,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
}

atomic_dec(&instance->fw_outstanding);
+ smp_mb__after_atomic_dec();

scsi_dma_unmap(cmd->scmd);
cmd->scmd->scsi_done(cmd->scmd);
@@ -2219,6 +2222,7 @@ megasas_issue_pending_cmds_again(struct megasas_instance *instance)
cmd, cmd->scmd->cmnd[0], cmd->scmd->serial_number);

atomic_inc(&instance->fw_outstanding);
+ smp_mb__after_atomic_inc();
instance->instancet->fire_cmd(instance,
cmd->frame_phys_addr,
cmd->frame_count-1, instance->reg_set);
--
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/