public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
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 11/13] scsi: add reprep arg to scsi_requeue_command() and make it public
Date: Thu, 31 Mar 2005 18:08:45 +0900 (KST)	[thread overview]
Message-ID: <20050331090647.ABDB1FF4@htj.dyndns.org> (raw)
In-Reply-To: <20050331090647.FEDC3964@htj.dyndns.org>

11_scsi_make_requeue_command_public.patch

	Add reprep argument to scsi_requeue_command(), remove
	redundant q argument, add code to set cmd->state/owner, and
	make the function public.  This patch is preparation for
	consolidating requeue paths.

Signed-off-by: Tejun Heo <htejun@gmail.com>

 scsi_lib.c  |   23 ++++++++++++++---------
 scsi_priv.h |    1 +
 2 files changed, 15 insertions(+), 9 deletions(-)

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
@@ -466,8 +466,8 @@ void scsi_device_unbusy(struct scsi_devi
  *
  * 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 may need to be requeued.
+ *		reprep	- needs to prep the command again?
  *
  * Returns:	Nothing
  *
@@ -478,11 +478,16 @@ void scsi_device_unbusy(struct scsi_devi
  *		we need to request the blocks that come after the bad
  *		sector.
  */
-static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
+void scsi_requeue_command(struct scsi_cmnd *cmd, int reprep)
 {
+	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;
+
+	if (reprep)
+		cmd->request->flags &= ~REQ_DONTPREP;
 	cmd->request->flags |= REQ_SOFTBARRIER;
 
 	spin_lock_irqsave(q->queue_lock, flags);
@@ -556,7 +561,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(cmd, 1);
 
 			return cmd;
 		}
@@ -818,7 +823,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(cmd, 1);
 				return;
 			}
 			break;
@@ -839,7 +844,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(cmd, 1);
 				result = 0;
 			} else {
 				cmd = scsi_end_request(cmd, 0, this_count, 1);
@@ -852,7 +857,7 @@ void scsi_io_completion(struct scsi_cmnd
 			 * retry.
 			 */
 			if (sshdr.asc == 0x04 && sshdr.ascq == 0x01) {
-				scsi_requeue_command(q, cmd);
+				scsi_requeue_command(cmd, 1);
 				return;
 			}
 			printk(KERN_INFO "Device %s not ready.\n",
@@ -878,7 +883,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(cmd, 1);
 		return;
 	}
 	if (result) {
Index: scsi-export/drivers/scsi/scsi_priv.h
===================================================================
--- scsi-export.orig/drivers/scsi/scsi_priv.h	2005-03-31 18:06:20.000000000 +0900
+++ scsi-export/drivers/scsi/scsi_priv.h	2005-03-31 18:06:22.000000000 +0900
@@ -96,6 +96,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, int reprep);
 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);


  parent reply	other threads:[~2005-03-31  9:08 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 ` Tejun Heo [this message]
2005-03-31 10:32   ` [PATCH scsi-misc-2.6 11/13] scsi: add reprep arg to scsi_requeue_command() and make it public Christoph Hellwig
2005-04-01  5:35     ` Tejun Heo
2005-03-31  9:08 ` [PATCH scsi-misc-2.6 12/13] scsi: replace scsi_queue_insert() with scsi_requeue_command() Tejun Heo
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.ABDB1FF4@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