Commit b75ca5ea8e439893121ad80406a3c04c4b7612ab
1 parent
6ea9e7bbfc
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 6 additions and 14 deletions Side-by-side Diff
drivers/firewire/sbp2.c
... | ... | @@ -125,9 +125,6 @@ |
125 | 125 | ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) |
126 | 126 | ", or a combination)"); |
127 | 127 | |
128 | -/* I don't know why the SCSI stack doesn't define something like this... */ | |
129 | -typedef void (*scsi_done_fn_t)(struct scsi_cmnd *); | |
130 | - | |
131 | 128 | static const char sbp2_driver_name[] = "sbp2"; |
132 | 129 | |
133 | 130 | /* |
... | ... | @@ -314,7 +311,6 @@ |
314 | 311 | u8 command_block[SBP2_MAX_CDB_SIZE]; |
315 | 312 | } request; |
316 | 313 | struct scsi_cmnd *cmd; |
317 | - scsi_done_fn_t done; | |
318 | 314 | struct sbp2_logical_unit *lu; |
319 | 315 | |
320 | 316 | struct sbp2_pointer page_table[SG_ALL] __attribute__((aligned(8))); |
... | ... | @@ -1398,7 +1394,7 @@ |
1398 | 1394 | sbp2_unmap_scatterlist(device->card->device, orb); |
1399 | 1395 | |
1400 | 1396 | orb->cmd->result = result; |
1401 | - orb->done(orb->cmd); | |
1397 | + orb->cmd->scsi_done(orb->cmd); | |
1402 | 1398 | } |
1403 | 1399 | |
1404 | 1400 | static int sbp2_map_scatterlist(struct sbp2_command_orb *orb, |
... | ... | @@ -1463,7 +1459,8 @@ |
1463 | 1459 | |
1464 | 1460 | /* SCSI stack integration */ |
1465 | 1461 | |
1466 | -static int sbp2_scsi_queuecommand_lck(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |
1462 | +static int sbp2_scsi_queuecommand(struct Scsi_Host *shost, | |
1463 | + struct scsi_cmnd *cmd) | |
1467 | 1464 | { |
1468 | 1465 | struct sbp2_logical_unit *lu = cmd->device->hostdata; |
1469 | 1466 | struct fw_device *device = target_device(lu->tgt); |
... | ... | @@ -1477,7 +1474,7 @@ |
1477 | 1474 | if (cmd->sc_data_direction == DMA_BIDIRECTIONAL) { |
1478 | 1475 | fw_error("Can't handle DMA_BIDIRECTIONAL, rejecting command\n"); |
1479 | 1476 | cmd->result = DID_ERROR << 16; |
1480 | - done(cmd); | |
1477 | + cmd->scsi_done(cmd); | |
1481 | 1478 | return 0; |
1482 | 1479 | } |
1483 | 1480 | |
... | ... | @@ -1490,11 +1487,8 @@ |
1490 | 1487 | /* Initialize rcode to something not RCODE_COMPLETE. */ |
1491 | 1488 | orb->base.rcode = -1; |
1492 | 1489 | kref_init(&orb->base.kref); |
1493 | - | |
1494 | - orb->lu = lu; | |
1495 | - orb->done = done; | |
1496 | - orb->cmd = cmd; | |
1497 | - | |
1490 | + orb->lu = lu; | |
1491 | + orb->cmd = cmd; | |
1498 | 1492 | orb->request.next.high = cpu_to_be32(SBP2_ORB_NULL); |
1499 | 1493 | orb->request.misc = cpu_to_be32( |
1500 | 1494 | COMMAND_ORB_MAX_PAYLOAD(lu->tgt->max_payload) | |
... | ... | @@ -1528,8 +1522,6 @@ |
1528 | 1522 | kref_put(&orb->base.kref, free_orb); |
1529 | 1523 | return retval; |
1530 | 1524 | } |
1531 | - | |
1532 | -static DEF_SCSI_QCMD(sbp2_scsi_queuecommand) | |
1533 | 1525 | |
1534 | 1526 | static int sbp2_scsi_slave_alloc(struct scsi_device *sdev) |
1535 | 1527 | { |