diff options
author | Jeff Garzik <jeff@garzik.org> | 2010-11-16 02:10:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-16 16:33:23 -0500 |
commit | f281233d3eba15fb225d21ae2e228fd4553d824a (patch) | |
tree | 51134454ba8acb558735f90be5540f7d756483e3 /drivers/scsi/arm/fas216.c | |
parent | bdbd01ac444bffb3c9aefed3059d12554059b320 (diff) |
SCSI host lock push-down
Move the mid-layer's ->queuecommand() invocation from being locked
with the host lock to being unlocked to facilitate speeding up the
critical path for drivers who don't need this lock taken anyway.
The patch below presents a simple SCSI host lock push-down as an
equivalent transformation. No locking or other behavior should change
with this patch. All existing bugs and locking orders are preserved.
Additionally, add one parameter to queuecommand,
struct Scsi_Host *
and remove one parameter from queuecommand,
void (*done)(struct scsi_cmnd *)
Scsi_Host* is a convenient pointer that most host drivers need anyway,
and 'done' is redundant to struct scsi_cmnd->scsi_done.
Minimal code disturbance was attempted with this change. Most drivers
needed only two one-line modifications for their host lock push-down.
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi/arm/fas216.c')
-rw-r--r-- | drivers/scsi/arm/fas216.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 9e71ac611146..2b2ce21e227e 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c | |||
@@ -2198,7 +2198,7 @@ no_command: | |||
2198 | * Returns: 0 on success, else error. | 2198 | * Returns: 0 on success, else error. |
2199 | * Notes: io_request_lock is held, interrupts are disabled. | 2199 | * Notes: io_request_lock is held, interrupts are disabled. |
2200 | */ | 2200 | */ |
2201 | int fas216_queue_command(struct scsi_cmnd *SCpnt, | 2201 | static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt, |
2202 | void (*done)(struct scsi_cmnd *)) | 2202 | void (*done)(struct scsi_cmnd *)) |
2203 | { | 2203 | { |
2204 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; | 2204 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; |
@@ -2240,6 +2240,8 @@ int fas216_queue_command(struct scsi_cmnd *SCpnt, | |||
2240 | return result; | 2240 | return result; |
2241 | } | 2241 | } |
2242 | 2242 | ||
2243 | DEF_SCSI_QCMD(fas216_queue_command) | ||
2244 | |||
2243 | /** | 2245 | /** |
2244 | * fas216_internal_done - trigger restart of a waiting thread in fas216_noqueue_command | 2246 | * fas216_internal_done - trigger restart of a waiting thread in fas216_noqueue_command |
2245 | * @SCpnt: Command to wake | 2247 | * @SCpnt: Command to wake |
@@ -2263,7 +2265,7 @@ static void fas216_internal_done(struct scsi_cmnd *SCpnt) | |||
2263 | * Returns: scsi result code. | 2265 | * Returns: scsi result code. |
2264 | * Notes: io_request_lock is held, interrupts are disabled. | 2266 | * Notes: io_request_lock is held, interrupts are disabled. |
2265 | */ | 2267 | */ |
2266 | int fas216_noqueue_command(struct scsi_cmnd *SCpnt, | 2268 | static int fas216_noqueue_command_lck(struct scsi_cmnd *SCpnt, |
2267 | void (*done)(struct scsi_cmnd *)) | 2269 | void (*done)(struct scsi_cmnd *)) |
2268 | { | 2270 | { |
2269 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; | 2271 | FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; |
@@ -2277,7 +2279,7 @@ int fas216_noqueue_command(struct scsi_cmnd *SCpnt, | |||
2277 | BUG_ON(info->scsi.irq != NO_IRQ); | 2279 | BUG_ON(info->scsi.irq != NO_IRQ); |
2278 | 2280 | ||
2279 | info->internal_done = 0; | 2281 | info->internal_done = 0; |
2280 | fas216_queue_command(SCpnt, fas216_internal_done); | 2282 | fas216_queue_command_lck(SCpnt, fas216_internal_done); |
2281 | 2283 | ||
2282 | /* | 2284 | /* |
2283 | * This wastes time, since we can't return until the command is | 2285 | * This wastes time, since we can't return until the command is |
@@ -2310,6 +2312,8 @@ int fas216_noqueue_command(struct scsi_cmnd *SCpnt, | |||
2310 | return 0; | 2312 | return 0; |
2311 | } | 2313 | } |
2312 | 2314 | ||
2315 | DEF_SCSI_QCMD(fas216_noqueue_command) | ||
2316 | |||
2313 | /* | 2317 | /* |
2314 | * Error handler timeout function. Indicate that we timed out, | 2318 | * Error handler timeout function. Indicate that we timed out, |
2315 | * and wake up any error handler process so it can continue. | 2319 | * and wake up any error handler process so it can continue. |