aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2011-04-22 06:21:44 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2011-05-10 16:53:45 -0400
commitb75ca5ea8e439893121ad80406a3c04c4b7612ab (patch)
tree9a260ae737d99d66aa3d42fdfb0bda2125ca47e2
parent6ea9e7bbfc389a12d52646449a201fe933ccd663 (diff)
firewire: sbp2: omit Scsi_Host lock from queuecommand
firewire-sbp2 already takes care for internal serialization where required (ORB list accesses), and it does not use cmd->serial_number internally. Hence it is safe to not grab the shost lock around queuecommand. While we are at housekeeping, drop a redundant struct member: sbp2_command_orb.done is set once in a hot path and dereferenced once in a hot path. We can as well dereference sbp2_command_orb.cmd->scsi_done instead. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r--drivers/firewire/sbp2.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 77ed589b360d..cc002e92275a 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -125,9 +125,6 @@ MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0"
125 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) 125 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
126 ", or a combination)"); 126 ", or a combination)");
127 127
128/* I don't know why the SCSI stack doesn't define something like this... */
129typedef void (*scsi_done_fn_t)(struct scsi_cmnd *);
130
131static const char sbp2_driver_name[] = "sbp2"; 128static const char sbp2_driver_name[] = "sbp2";
132 129
133/* 130/*
@@ -314,7 +311,6 @@ struct sbp2_command_orb {
314 u8 command_block[SBP2_MAX_CDB_SIZE]; 311 u8 command_block[SBP2_MAX_CDB_SIZE];
315 } request; 312 } request;
316 struct scsi_cmnd *cmd; 313 struct scsi_cmnd *cmd;
317 scsi_done_fn_t done;
318 struct sbp2_logical_unit *lu; 314 struct sbp2_logical_unit *lu;
319 315
320 struct sbp2_pointer page_table[SG_ALL] __attribute__((aligned(8))); 316 struct sbp2_pointer page_table[SG_ALL] __attribute__((aligned(8)));
@@ -1398,7 +1394,7 @@ static void complete_command_orb(struct sbp2_orb *base_orb,
1398 sbp2_unmap_scatterlist(device->card->device, orb); 1394 sbp2_unmap_scatterlist(device->card->device, orb);
1399 1395
1400 orb->cmd->result = result; 1396 orb->cmd->result = result;
1401 orb->done(orb->cmd); 1397 orb->cmd->scsi_done(orb->cmd);
1402} 1398}
1403 1399
1404static int sbp2_map_scatterlist(struct sbp2_command_orb *orb, 1400static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
@@ -1463,7 +1459,8 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
1463 1459
1464/* SCSI stack integration */ 1460/* SCSI stack integration */
1465 1461
1466static int sbp2_scsi_queuecommand_lck(struct scsi_cmnd *cmd, scsi_done_fn_t done) 1462static int sbp2_scsi_queuecommand(struct Scsi_Host *shost,
1463 struct scsi_cmnd *cmd)
1467{ 1464{
1468 struct sbp2_logical_unit *lu = cmd->device->hostdata; 1465 struct sbp2_logical_unit *lu = cmd->device->hostdata;
1469 struct fw_device *device = target_device(lu->tgt); 1466 struct fw_device *device = target_device(lu->tgt);
@@ -1477,7 +1474,7 @@ static int sbp2_scsi_queuecommand_lck(struct scsi_cmnd *cmd, scsi_done_fn_t done
1477 if (cmd->sc_data_direction == DMA_BIDIRECTIONAL) { 1474 if (cmd->sc_data_direction == DMA_BIDIRECTIONAL) {
1478 fw_error("Can't handle DMA_BIDIRECTIONAL, rejecting command\n"); 1475 fw_error("Can't handle DMA_BIDIRECTIONAL, rejecting command\n");
1479 cmd->result = DID_ERROR << 16; 1476 cmd->result = DID_ERROR << 16;
1480 done(cmd); 1477 cmd->scsi_done(cmd);
1481 return 0; 1478 return 0;
1482 } 1479 }
1483 1480
@@ -1490,11 +1487,8 @@ static int sbp2_scsi_queuecommand_lck(struct scsi_cmnd *cmd, scsi_done_fn_t done
1490 /* Initialize rcode to something not RCODE_COMPLETE. */ 1487 /* Initialize rcode to something not RCODE_COMPLETE. */
1491 orb->base.rcode = -1; 1488 orb->base.rcode = -1;
1492 kref_init(&orb->base.kref); 1489 kref_init(&orb->base.kref);
1493 1490 orb->lu = lu;
1494 orb->lu = lu; 1491 orb->cmd = cmd;
1495 orb->done = done;
1496 orb->cmd = cmd;
1497
1498 orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL); 1492 orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL);
1499 orb->request.misc = cpu_to_be32( 1493 orb->request.misc = cpu_to_be32(
1500 COMMAND_ORB_MAX_PAYLOAD(lu->tgt->max_payload) | 1494 COMMAND_ORB_MAX_PAYLOAD(lu->tgt->max_payload) |
@@ -1529,8 +1523,6 @@ static int sbp2_scsi_queuecommand_lck(struct scsi_cmnd *cmd, scsi_done_fn_t done
1529 return retval; 1523 return retval;
1530} 1524}
1531 1525
1532static DEF_SCSI_QCMD(sbp2_scsi_queuecommand)
1533
1534static int sbp2_scsi_slave_alloc(struct scsi_device *sdev) 1526static int sbp2_scsi_slave_alloc(struct scsi_device *sdev)
1535{ 1527{
1536 struct sbp2_logical_unit *lu = sdev->hostdata; 1528 struct sbp2_logical_unit *lu = sdev->hostdata;