* Re: [PATCH scsi-misc-2.6 01/07] scsi: update and make public scsi_requeue_command()
2005-04-12 12:52 [PATCH scsi-misc-2.6 00/07] scsi: requeue path consolidation Tejun Heo
@ 2005-04-12 12:52 ` Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 02/07] scsi: make scsi_retry_command() use scsi_requeue_command() Tejun Heo
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2005-04-12 12:52 UTC (permalink / raw)
To: James.Bottomley, axboe, Christoph Hellwig; +Cc: linux-scsi, linux-kernel
01_scsi_requeue_make_requeue_command_public.patch
This patch makes the following changes to
scsi_requeue_command() and make the function public.
* remove redundant argument @q
* remove REQ_DONTPREP clearing
* add state/owner setting
A new inline function scsi_requeue_command_reprep() is defined
and used for the original users of scsi_requeue_command().
Using a wrapper function for reprep cases is suggested by
Christoph Hellwig.
Signed-off-by: Tejun Heo <htejun@gmail.com>
scsi_lib.c | 42 +++++++++++++++++++++++++-----------------
scsi_priv.h | 1 +
2 files changed, 26 insertions(+), 17 deletions(-)
Index: scsi-reqfn-export/drivers/scsi/scsi_lib.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_lib.c 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_lib.c 2005-04-12 21:50:11.000000000 +0900
@@ -468,23 +468,24 @@ static void scsi_run_queue(struct reques
*
* Purpose: Handle post-processing of completed commands.
*
- * Arguments: q - queue to operate on
- * cmd - command that may need to be requeued.
+ * Arguments: cmd - command that need to be requeued.
*
* Returns: Nothing
*
- * Notes: After command completion, there may be blocks left
- * over which weren't finished by the previous command
- * this can be for a number of reasons - the main one is
- * I/O errors in the middle of the request, in which case
- * we need to request the blocks that come after the bad
- * sector.
+ * Notes: After command completion, a command may need to be
+ * requeued due to error or unfinished blocks. All
+ * requeueing after command issueing goes through this
+ * function. The caller is expected to have performed
+ * scsi_device_unbusy() before invoking this function.
*/
-static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
+void scsi_requeue_command(struct scsi_cmnd *cmd)
{
+ struct request_queue *q = cmd->device->request_queue;
unsigned long flags;
- cmd->request->flags &= ~REQ_DONTPREP;
+ cmd->state = SCSI_STATE_MLQUEUE;
+ cmd->owner = SCSI_OWNER_MIDLEVEL;
+
cmd->request->flags |= REQ_SOFTBARRIER;
spin_lock_irqsave(q->queue_lock, flags);
@@ -494,6 +495,12 @@ static void scsi_requeue_command(struct
scsi_run_queue(q);
}
+static inline void scsi_requeue_command_reprep(struct scsi_cmnd *cmd)
+{
+ cmd->request->flags &= ~REQ_DONTPREP;
+ scsi_requeue_command(cmd);
+}
+
void scsi_next_command(struct scsi_cmnd *cmd)
{
struct request_queue *q = cmd->device->request_queue;
@@ -558,7 +565,7 @@ static struct scsi_cmnd *scsi_end_reques
* leftovers in the front of the
* queue, and goose the queue again.
*/
- scsi_requeue_command(q, cmd);
+ scsi_requeue_command_reprep(cmd);
return cmd;
}
@@ -697,8 +704,9 @@ static void scsi_release_buffers(struct
* function will be goosed. If we are not done, then
* scsi_end_request will directly goose the queue.
*
- * b) We can just use scsi_requeue_command() here. This would
- * be used if we just wanted to retry, for example.
+ * b) We can just use scsi_requeue_command_reprep() here.
+ * This would be used if we just wanted to retry, for
+ * example.
*/
void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes,
unsigned int block_bytes)
@@ -820,7 +828,7 @@ void scsi_io_completion(struct scsi_cmnd
* media change, so we just retry the
* request and see what happens.
*/
- scsi_requeue_command(q, cmd);
+ scsi_requeue_command_reprep(cmd);
return;
}
break;
@@ -841,7 +849,7 @@ void scsi_io_completion(struct scsi_cmnd
* This will cause a retry with a 6-byte
* command.
*/
- scsi_requeue_command(q, cmd);
+ scsi_requeue_command_reprep(cmd);
result = 0;
} else {
cmd = scsi_end_request(cmd, 0, this_count, 1);
@@ -854,7 +862,7 @@ void scsi_io_completion(struct scsi_cmnd
* retry.
*/
if (sshdr.asc == 0x04 && sshdr.ascq == 0x01) {
- scsi_requeue_command(q, cmd);
+ scsi_requeue_command_reprep(cmd);
return;
}
printk(KERN_INFO "Device %s not ready.\n",
@@ -880,7 +888,7 @@ void scsi_io_completion(struct scsi_cmnd
* recovery reasons. Just retry the request
* and see what happens.
*/
- scsi_requeue_command(q, cmd);
+ scsi_requeue_command_reprep(cmd);
return;
}
if (result) {
Index: scsi-reqfn-export/drivers/scsi/scsi_priv.h
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_priv.h 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_priv.h 2005-04-12 21:50:11.000000000 +0900
@@ -95,6 +95,7 @@ extern int scsi_maybe_unblock_host(struc
extern void scsi_setup_cmd_retry(struct scsi_cmnd *cmd);
extern void scsi_device_unbusy(struct scsi_device *sdev);
extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
+extern void scsi_requeue_command(struct scsi_cmnd *cmd);
extern void scsi_next_command(struct scsi_cmnd *cmd);
extern void scsi_run_host_queues(struct Scsi_Host *shost);
extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH scsi-misc-2.6 02/07] scsi: make scsi_retry_command() use scsi_requeue_command()
2005-04-12 12:52 [PATCH scsi-misc-2.6 00/07] scsi: requeue path consolidation Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 01/07] scsi: update and make public scsi_requeue_command() Tejun Heo
@ 2005-04-12 12:52 ` Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 03/07] scsi: replace scsi_queue_insert() usages with scsi_retry_command() Tejun Heo
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2005-04-12 12:52 UTC (permalink / raw)
To: James.Bottomley, axboe, Christoph Hellwig; +Cc: linux-scsi, linux-kernel
02_scsi_requeue_use_scsi_requeue_command_in_scsi_retry_command.patch
scsi_retry_command() orignally used scsi_queue_insert() for
requeueing. This patch makes it use scsi_retry_command()
instead. Adding a call to scsi_device_unbusy() is sufficient
and the change also makes scsi_retry_command() symmetric with
scsi_finish_command() in how it unbusies the command. Also as
there's nothing to return, make the function void.
Signed-off-by: Tejun Heo <htejun@gmail.com>
scsi.c | 8 ++++++--
scsi_priv.h | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
Index: scsi-reqfn-export/drivers/scsi/scsi.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi.c 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi.c 2005-04-12 21:50:11.000000000 +0900
@@ -669,8 +669,12 @@ static void scsi_softirq(struct softirq_
* level drivers should not become re-entrant as a result of
* this.
*/
-int scsi_retry_command(struct scsi_cmnd *cmd)
+void scsi_retry_command(struct scsi_cmnd *cmd)
{
+ SCSI_LOG_MLQUEUE(1, printk("Retrying command %p\n", cmd));
+
+ scsi_device_unbusy(cmd->device);
+
/*
* Restore the SCSI command state.
*/
@@ -682,7 +686,7 @@ int scsi_retry_command(struct scsi_cmnd
*/
memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
- return scsi_queue_insert(cmd, SCSI_MLQUEUE_EH_RETRY);
+ scsi_requeue_command(cmd);
}
/*
Index: scsi-reqfn-export/drivers/scsi/scsi_priv.h
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_priv.h 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_priv.h 2005-04-12 21:50:11.000000000 +0900
@@ -60,7 +60,7 @@ extern void scsi_exit_hosts(void);
extern int scsi_setup_command_freelist(struct Scsi_Host *shost);
extern void scsi_destroy_command_freelist(struct Scsi_Host *shost);
extern void scsi_done(struct scsi_cmnd *cmd);
-extern int scsi_retry_command(struct scsi_cmnd *cmd);
+extern void scsi_retry_command(struct scsi_cmnd *cmd);
extern int scsi_insert_special_req(struct scsi_request *sreq, int);
extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd,
struct scsi_request *sreq);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH scsi-misc-2.6 03/07] scsi: replace scsi_queue_insert() usages with scsi_retry_command()
2005-04-12 12:52 [PATCH scsi-misc-2.6 00/07] scsi: requeue path consolidation Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 01/07] scsi: update and make public scsi_requeue_command() Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 02/07] scsi: make scsi_retry_command() use scsi_requeue_command() Tejun Heo
@ 2005-04-12 12:52 ` Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 04/07] scsi: remove scsi_queue_insert() Tejun Heo
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2005-04-12 12:52 UTC (permalink / raw)
To: James.Bottomley, axboe, Christoph Hellwig; +Cc: linux-scsi, linux-kernel
03_scsi_requeue_use_scsi_retry_command_instead_of_scsi_queue_insert.patch
There are two users of scsi_queue_insert() left now. One in
scsi_softirq() and the other in scsi_eh_flush_done_q(). The
only additional functionality of scsi_queue_insert() used is
setting device_blocked on ADD_TO_MLQUEUE case in
scsi_softirq().
Open code device_blocked setting and replace
scsi_queue_insert() with scsi_retry_command() in both cases.
Signed-off-by: Tejun Heo <htejun@gmail.com>
scsi.c | 7 ++++---
scsi_error.c | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
Index: scsi-reqfn-export/drivers/scsi/scsi.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi.c 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi.c 2005-04-12 21:50:11.000000000 +0900
@@ -638,6 +638,7 @@ static void scsi_softirq(struct softirq_
while (!list_empty(&local_q)) {
struct scsi_cmnd *cmd = list_entry(local_q.next,
struct scsi_cmnd, eh_entry);
+ struct scsi_device *sdev = cmd->device;
list_del_init(&cmd->eh_entry);
disposition = scsi_decide_disposition(cmd);
@@ -646,12 +647,12 @@ static void scsi_softirq(struct softirq_
case SUCCESS:
scsi_finish_command(cmd);
break;
+ case ADD_TO_MLQUEUE:
+ sdev->device_blocked = sdev->max_device_blocked;
+ /* fall through */
case NEEDS_RETRY:
scsi_retry_command(cmd);
break;
- case ADD_TO_MLQUEUE:
- scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY);
- break;
default:
if (!scsi_eh_scmd_add(cmd, 0))
scsi_finish_command(cmd);
Index: scsi-reqfn-export/drivers/scsi/scsi_error.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_error.c 2005-04-12 21:50:10.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_error.c 2005-04-12 21:50:11.000000000 +0900
@@ -1522,7 +1522,7 @@ static void scsi_eh_flush_done_q(struct
" retry cmd: %p\n",
current->comm,
scmd));
- scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY);
+ scsi_retry_command(scmd);
} else {
if (!scmd->result)
scmd->result |= (DRIVER_TIMEOUT << 24);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH scsi-misc-2.6 04/07] scsi: remove scsi_queue_insert()
2005-04-12 12:52 [PATCH scsi-misc-2.6 00/07] scsi: requeue path consolidation Tejun Heo
` (2 preceding siblings ...)
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 03/07] scsi: replace scsi_queue_insert() usages with scsi_retry_command() Tejun Heo
@ 2005-04-12 12:52 ` Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 05/07] scsi: move scsi_init_cmd_errh() from request_fn to prep_fn Tejun Heo
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2005-04-12 12:52 UTC (permalink / raw)
To: James.Bottomley, axboe, Christoph Hellwig; +Cc: linux-scsi, linux-kernel
04_scsi_requeue_remove_scsi_queue_insert.patch
scsi_queue_insert() now has no user left. Kill it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
scsi_lib.c | 76 ------------------------------------------------------------
scsi_priv.h | 1
2 files changed, 77 deletions(-)
Index: scsi-reqfn-export/drivers/scsi/scsi_lib.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_lib.c 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_lib.c 2005-04-12 21:50:11.000000000 +0900
@@ -106,82 +106,6 @@ int scsi_insert_special_req(struct scsi_
return 0;
}
-static void scsi_run_queue(struct request_queue *q);
-
-/*
- * Function: scsi_queue_insert()
- *
- * Purpose: Insert a command in the midlevel queue.
- *
- * Arguments: cmd - command that we are adding to queue.
- * reason - why we are inserting command to queue.
- *
- * Lock status: Assumed that lock is not held upon entry.
- *
- * Returns: Nothing.
- *
- * Notes: We do this for one of two cases. Either the host is busy
- * and it cannot accept any more commands for the time being,
- * or the device returned QUEUE_FULL and can accept no more
- * commands.
- * Notes: This could be called either from an interrupt context or a
- * normal process context.
- */
-int scsi_queue_insert(struct scsi_cmnd *cmd, int reason)
-{
- struct Scsi_Host *host = cmd->device->host;
- struct scsi_device *device = cmd->device;
- struct request_queue *q = device->request_queue;
- unsigned long flags;
-
- SCSI_LOG_MLQUEUE(1,
- printk("Inserting command %p into mlqueue\n", cmd));
-
- /*
- * Set the appropriate busy bit for the device/host.
- *
- * If the host/device isn't busy, assume that something actually
- * completed, and that we should be able to queue a command now.
- *
- * Note that the prior mid-layer assumption that any host could
- * always queue at least one command is now broken. The mid-layer
- * will implement a user specifiable stall (see
- * scsi_host.max_host_blocked and scsi_device.max_device_blocked)
- * if a command is requeued with no other commands outstanding
- * either for the device or for the host.
- */
- if (reason == SCSI_MLQUEUE_HOST_BUSY)
- host->host_blocked = host->max_host_blocked;
- else if (reason == SCSI_MLQUEUE_DEVICE_BUSY)
- device->device_blocked = device->max_device_blocked;
-
- /*
- * Register the fact that we own the thing for now.
- */
- cmd->state = SCSI_STATE_MLQUEUE;
- cmd->owner = SCSI_OWNER_MIDLEVEL;
-
- /*
- * Decrement the counters, since these commands are no longer
- * active on the host/device.
- */
- scsi_device_unbusy(device);
-
- /*
- * Requeue the command. Turn on REQ_SOFTBARRIER to prevent
- * other requests from passing this request.
- */
- cmd->request->flags |= REQ_SOFTBARRIER;
-
- spin_lock_irqsave(q->queue_lock, flags);
- blk_requeue_request(q, cmd->request);
- spin_unlock_irqrestore(q->queue_lock, flags);
-
- scsi_run_queue(q);
-
- return 0;
-}
-
/*
* Function: scsi_do_req
*
Index: scsi-reqfn-export/drivers/scsi/scsi_priv.h
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_priv.h 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_priv.h 2005-04-12 21:50:11.000000000 +0900
@@ -94,7 +94,6 @@ extern int scsi_eh_scmd_add(struct scsi_
extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
extern void scsi_setup_cmd_retry(struct scsi_cmnd *cmd);
extern void scsi_device_unbusy(struct scsi_device *sdev);
-extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
extern void scsi_requeue_command(struct scsi_cmnd *cmd);
extern void scsi_next_command(struct scsi_cmnd *cmd);
extern void scsi_run_host_queues(struct Scsi_Host *shost);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH scsi-misc-2.6 05/07] scsi: move scsi_init_cmd_errh() from request_fn to prep_fn.
2005-04-12 12:52 [PATCH scsi-misc-2.6 00/07] scsi: requeue path consolidation Tejun Heo
` (3 preceding siblings ...)
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 04/07] scsi: remove scsi_queue_insert() Tejun Heo
@ 2005-04-12 12:52 ` Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 06/07] scsi: add cmd->result clearing Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 07/07] scsi: consolidate scsi_cmd_retry() calls Tejun Heo
6 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2005-04-12 12:52 UTC (permalink / raw)
To: James.Bottomley, axboe, Christoph Hellwig; +Cc: linux-scsi, linux-kernel
05_scsi_requeue_move_init_cmd_errh.patch
As now all non-reprepped requeue goes through
scsi_retry_command() which clears sense buffer, there's no
need to call scsi_init_cmd_errh() in scsi_request_fn(). Move
scsi_init_cmd_errh() to scsi_prep_fn().
Signed-off-by: Tejun Heo <htejun@gmail.com>
scsi_lib.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
Index: scsi-reqfn-export/drivers/scsi/scsi_lib.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_lib.c 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_lib.c 2005-04-12 21:50:12.000000000 +0900
@@ -1051,6 +1051,8 @@ static int scsi_prep_fn(struct request_q
if (CDB_SIZE(cmd) > sdev->host->max_cmd_len)
goto kill;
+ scsi_init_cmd_errh(cmd);
+
/* If SCSI-2 or lower, store the LUN value in cmnd. */
if (cmd->device->scsi_level <= SCSI_2)
cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
@@ -1311,9 +1313,6 @@ static void scsi_request_fn(struct reque
target->starget_sdev_user = sdev;
}
- /* Once requeue path is cleaned up, init_cmd_errh can
- * be moved to prep_fn() where it belongs. */
- scsi_init_cmd_errh(cmd);
shost->host_busy++;
scsi_log_send(cmd);
scsi_cmd_get_serial(shost, cmd);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH scsi-misc-2.6 06/07] scsi: add cmd->result clearing
2005-04-12 12:52 [PATCH scsi-misc-2.6 00/07] scsi: requeue path consolidation Tejun Heo
` (4 preceding siblings ...)
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 05/07] scsi: move scsi_init_cmd_errh() from request_fn to prep_fn Tejun Heo
@ 2005-04-12 12:52 ` Tejun Heo
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 07/07] scsi: consolidate scsi_cmd_retry() calls Tejun Heo
6 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2005-04-12 12:52 UTC (permalink / raw)
To: James.Bottomley, axboe, Christoph Hellwig; +Cc: linux-scsi, linux-kernel
06_scsi_requeue_reset_result.patch
cmd->result wasn't cleared on requeue or reprep. Clear it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
scsi.c | 9 +++++----
scsi_lib.c | 1 +
2 files changed, 6 insertions(+), 4 deletions(-)
Index: scsi-reqfn-export/drivers/scsi/scsi.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi.c 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi.c 2005-04-12 21:50:12.000000000 +0900
@@ -681,11 +681,12 @@ void scsi_retry_command(struct scsi_cmnd
*/
scsi_setup_cmd_retry(cmd);
- /*
- * Zero the sense information from the last time we tried
- * this command.
- */
+ /*
+ * Zero the sense information and result code from the last
+ * time we tried this command.
+ */
memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
+ cmd->result = 0;
scsi_requeue_command(cmd);
}
Index: scsi-reqfn-export/drivers/scsi/scsi_lib.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_lib.c 2005-04-12 21:50:12.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_lib.c 2005-04-12 21:50:12.000000000 +0900
@@ -222,6 +222,7 @@ static int scsi_init_cmd_errh(struct scs
cmd->abort_reason = 0;
memset(cmd->sense_buffer, 0, sizeof cmd->sense_buffer);
+ cmd->result = 0;
if (cmd->cmd_len == 0)
cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH scsi-misc-2.6 07/07] scsi: consolidate scsi_cmd_retry() calls
2005-04-12 12:52 [PATCH scsi-misc-2.6 00/07] scsi: requeue path consolidation Tejun Heo
` (5 preceding siblings ...)
2005-04-12 12:52 ` [PATCH scsi-misc-2.6 06/07] scsi: add cmd->result clearing Tejun Heo
@ 2005-04-12 12:52 ` Tejun Heo
6 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2005-04-12 12:52 UTC (permalink / raw)
To: James.Bottomley, axboe, Christoph Hellwig; +Cc: linux-scsi, linux-kernel
07_scsi_requeue_consolidate_setup_cmd_retry_calls_in_eh.patch
scsi_setup_cmd_retry() is needed because scsi eh may alter
scsi_cmnd to issue eh commands. Consolidate calls to
scsi_setup_cmd_retry() to one place in scsi_eh_flush_done_q().
This change makes scsi_retry_command() more symmetrical with
scsi_finish_command().
Signed-off-by: Tejun Heo <htejun@gmail.com>
scsi.c | 5 -----
scsi_error.c | 31 +++++++------------------------
2 files changed, 7 insertions(+), 29 deletions(-)
Index: scsi-reqfn-export/drivers/scsi/scsi.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi.c 2005-04-12 21:50:12.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi.c 2005-04-12 21:50:12.000000000 +0900
@@ -677,11 +677,6 @@ void scsi_retry_command(struct scsi_cmnd
scsi_device_unbusy(cmd->device);
/*
- * Restore the SCSI command state.
- */
- scsi_setup_cmd_retry(cmd);
-
- /*
* Zero the sense information and result code from the last
* time we tried this command.
*/
Index: scsi-reqfn-export/drivers/scsi/scsi_error.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_error.c 2005-04-12 21:50:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_error.c 2005-04-12 21:50:12.000000000 +0900
@@ -586,11 +586,6 @@ static int scsi_request_sense(struct scs
kfree(scsi_result);
- /*
- * when we eventually call scsi_finish, we really wish to complete
- * the original request, so let's restore the original data. (db)
- */
- scsi_setup_cmd_retry(scmd);
scmd->result = saved_result;
return rtn;
}
@@ -612,14 +607,7 @@ static void scsi_eh_finish_cmd(struct sc
{
scmd->device->host->host_failed--;
scmd->state = SCSI_STATE_BHQUEUE;
-
scsi_eh_eflags_clr_all(scmd);
-
- /*
- * set this back so that the upper level can correctly free up
- * things.
- */
- scsi_setup_cmd_retry(scmd);
list_move_tail(&scmd->eh_entry, done_q);
}
@@ -756,12 +744,6 @@ retry_tur:
rtn = scsi_send_eh_cmnd(scmd, SENSE_TIMEOUT);
/*
- * when we eventually call scsi_finish, we really wish to complete
- * the original request, so let's restore the original data. (db)
- */
- scsi_setup_cmd_retry(scmd);
-
- /*
* hey, we are done. let's look to see what happened.
*/
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n",
@@ -884,12 +866,6 @@ static int scsi_eh_try_stu(struct scsi_c
rtn = scsi_send_eh_cmnd(scmd, START_UNIT_TIMEOUT);
/*
- * when we eventually call scsi_finish, we really wish to complete
- * the original request, so let's restore the original data. (db)
- */
- scsi_setup_cmd_retry(scmd);
-
- /*
* hey, we are done. let's look to see what happened.
*/
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd %p rtn %x\n",
@@ -1515,6 +1491,13 @@ static void scsi_eh_flush_done_q(struct
list_for_each_safe(lh, lh_sf, done_q) {
scmd = list_entry(lh, struct scsi_cmnd, eh_entry);
list_del_init(lh);
+
+ /*
+ * Restore the SCSI command state such that we retry
+ * or finish the original command.
+ */
+ scsi_setup_cmd_retry(scmd);
+
if (scsi_device_online(scmd->device) &&
!blk_noretry_request(scmd->request) &&
(++scmd->retries < scmd->allowed)) {
^ permalink raw reply [flat|nested] 8+ messages in thread