From: Tejun Heo <htejun@gmail.com>
To: James.Bottomley@steeleye.com, axboe@suse.de
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH scsi-misc-2.6 12/13] scsi: replace scsi_queue_insert() with scsi_requeue_command()
Date: Thu, 31 Mar 2005 18:08:50 +0900 (KST) [thread overview]
Message-ID: <20050331090647.B916C84F@htj.dyndns.org> (raw)
In-Reply-To: <20050331090647.FEDC3964@htj.dyndns.org>
12_scsi_consolidate_requeue_paths.patch
Add scsi_device_unbusy() call to scsi_retry_command(), replace
scsi_queue_insert() with scsi_requeue_command(), make
scsi_softirq() use scsi_retry_command() for ADD_TO_MLQUEUE
case too (with explicit device blocking), and make
scsi_eh_flush_done_q() use scsi_retry_command(). While at it,
remove leading and tailing empty comment lines from trivial
comments.
As scsi_queue_insert() has no users now, kill it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
scsi.c | 25 ++++++++++---------
scsi_error.c | 2 -
scsi_lib.c | 74 -----------------------------------------------------------
scsi_priv.h | 3 --
4 files changed, 15 insertions(+), 89 deletions(-)
Index: scsi-export/drivers/scsi/scsi.c
===================================================================
--- scsi-export.orig/drivers/scsi/scsi.c 2005-03-31 18:06:22.000000000 +0900
+++ scsi-export/drivers/scsi/scsi.c 2005-03-31 18:06:22.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 thru */
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);
@@ -669,20 +670,20 @@ 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)
{
- /*
- * Restore the SCSI command state.
- */
+ SCSI_LOG_MLQUEUE(1, printk("Retrying command %p\n", cmd));
+
+ scsi_device_unbusy(cmd->device);
+
+ /* Restore the SCSI command state. */
scsi_setup_cmd_retry(cmd);
- /*
- * Zero the sense information from the last time we tried
- * this command.
- */
+ /* Zero the sense information from the last time we tried
+ * this command. */
memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
- return scsi_queue_insert(cmd, SCSI_MLQUEUE_EH_RETRY);
+ scsi_requeue_command(cmd, 0);
}
/*
Index: scsi-export/drivers/scsi/scsi_error.c
===================================================================
--- scsi-export.orig/drivers/scsi/scsi_error.c 2005-03-31 18:06:21.000000000 +0900
+++ scsi-export/drivers/scsi/scsi_error.c 2005-03-31 18:06:22.000000000 +0900
@@ -1551,7 +1551,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);
Index: scsi-export/drivers/scsi/scsi_lib.c
===================================================================
--- scsi-export.orig/drivers/scsi/scsi_lib.c 2005-03-31 18:06:22.000000000 +0900
+++ scsi-export/drivers/scsi/scsi_lib.c 2005-03-31 18:06:22.000000000 +0900
@@ -210,80 +210,6 @@ int scsi_insert_special_req(struct scsi_
}
/*
- * 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));
-
- /*
- * Next, 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
*
* Purpose: Queue a SCSI request
Index: scsi-export/drivers/scsi/scsi_priv.h
===================================================================
--- scsi-export.orig/drivers/scsi/scsi_priv.h 2005-03-31 18:06:22.000000000 +0900
+++ scsi-export/drivers/scsi/scsi_priv.h 2005-03-31 18:06:22.000000000 +0900
@@ -62,7 +62,7 @@ extern int scsi_dispatch_cmd(struct scsi
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);
@@ -95,7 +95,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, int reprep);
extern void scsi_next_command(struct scsi_cmnd *cmd);
extern void scsi_run_host_queues(struct Scsi_Host *shost);
next prev parent reply other threads:[~2005-03-31 9:33 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-31 9:07 [PATCH scsi-misc-2.6 00/13] scsi: scsi_request_fn() rewrite & stuff Tejun Heo
2005-03-31 9:07 ` [PATCH scsi-misc-2.6 01/13] scsi: don't use blk_insert_request() for requeueing Tejun Heo
2005-03-31 10:12 ` Christoph Hellwig
2005-04-01 4:18 ` Tejun Heo
2005-03-31 17:53 ` James Bottomley
2005-04-01 5:01 ` Tejun Heo
2005-04-01 18:09 ` James Bottomley
2005-04-01 22:21 ` Tejun Heo
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 02/13] scsi: don't turn on REQ_SPECIAL on sgtable allocation failure Tejun Heo
2005-03-31 17:53 ` James Bottomley
2005-04-01 5:14 ` Tejun Heo
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 03/13] scsi: remove unused scsi_cmnd->internal_timeout field Tejun Heo
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 04/13] scsi: remove meaningless volatile qualifiers from structure definitions Tejun Heo
2005-03-31 10:11 ` Christoph Hellwig
2005-04-01 5:15 ` Tejun Heo
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 05/13] scsi: remove a timer race from scsi_queue_insert() and cleanup timer Tejun Heo
2005-03-31 10:13 ` Christoph Hellwig
2005-04-01 5:15 ` Tejun Heo
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 06/13] scsi: remove meaningless scsi_cmnd->serial_number_at_timeout field Tejun Heo
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 07/13] scsi: move error handling out of scsi_init_io() into scsi_prep_fn() Tejun Heo
2005-04-01 18:23 ` James Bottomley
2005-04-01 23:07 ` Tejun Heo
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 08/13] scsi: move request preps in other places into prep_fn() Tejun Heo
2005-03-31 10:20 ` Christoph Hellwig
2005-04-01 5:20 ` Tejun Heo
2005-03-31 18:07 ` James Bottomley
2005-04-01 5:25 ` Tejun Heo
2005-04-04 18:39 ` James Bottomley
2005-04-05 6:19 ` Tejun Heo
2005-04-05 14:20 ` James Bottomley
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 09/13] scsi: in scsi_prep_fn(), remove bogus comments & clean up Tejun Heo
2005-03-31 10:22 ` Christoph Hellwig
2005-03-31 18:02 ` James Bottomley
2005-04-01 5:29 ` Tejun Heo
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 10/13] scsi: rewrite scsi_request_fn() Tejun Heo
2005-03-31 11:14 ` Christoph Hellwig
2005-04-01 5:44 ` Tejun Heo
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 11/13] scsi: add reprep arg to scsi_requeue_command() and make it public Tejun Heo
2005-03-31 10:32 ` Christoph Hellwig
2005-04-01 5:35 ` Tejun Heo
2005-03-31 9:08 ` Tejun Heo [this message]
2005-03-31 9:08 ` [PATCH scsi-misc-2.6 13/13] scsi: consolidate scsi_cmd_retry() calls in scsi_error.c Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050331090647.B916C84F@htj.dyndns.org \
--to=htejun@gmail.com \
--cc=James.Bottomley@steeleye.com \
--cc=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®