linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 27/30] blk_end_request: changing scsi (take 4)
@ 2007-12-11 22:52 Kiyoshi Ueda
  2007-12-12 12:55 ` James Bottomley
  0 siblings, 1 reply; 2+ messages in thread
From: Kiyoshi Ueda @ 2007-12-11 22:52 UTC (permalink / raw)
  To: jens.axboe
  Cc: linux-kernel, linux-scsi, linux-ide, dm-devel, j-nomura, k-ueda,
	James.Bottomley, bharrosh

This patch converts scsi mid-layer to use blk_end_request interfaces.
Related 'uptodate' arguments are converted to 'error'.

As a result, the interface of internal function, scsi_end_request(),
is changed.

Cc: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
---
 drivers/scsi/scsi_lib.c |   31 +++++++++++--------------------
 1 files changed, 11 insertions(+), 20 deletions(-)

Index: 2.6.24-rc4/drivers/scsi/scsi_lib.c
===================================================================
--- 2.6.24-rc4.orig/drivers/scsi/scsi_lib.c
+++ 2.6.24-rc4/drivers/scsi/scsi_lib.c
@@ -632,7 +632,7 @@ void scsi_run_host_queues(struct Scsi_Ho
  *		of upper level post-processing and scsi_io_completion).
  *
  * Arguments:   cmd	 - command that is complete.
- *              uptodate - 1 if I/O indicates success, <= 0 for I/O error.
+ *              error    - 0 if I/O indicates success, < 0 for I/O error.
  *              bytes    - number of bytes of completed I/O
  *		requeue  - indicates whether we should requeue leftovers.
  *
@@ -647,26 +647,25 @@ void scsi_run_host_queues(struct Scsi_Ho
  *		at some point during this call.
  * Notes:	If cmd was requeued, upon return it will be a stale pointer.
  */
-static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate,
+static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error,
 					  int bytes, int requeue)
 {
 	struct request_queue *q = cmd->device->request_queue;
 	struct request *req = cmd->request;
-	unsigned long flags;
 
 	/*
 	 * If there are blocks left over at the end, set up the command
 	 * to queue the remainder of them.
 	 */
-	if (end_that_request_chunk(req, uptodate, bytes)) {
+	if (blk_end_request(req, error, bytes)) {
 		int leftover = (req->hard_nr_sectors << 9);
 
 		if (blk_pc_request(req))
 			leftover = req->data_len;
 
 		/* kill remainder if no retrys */
-		if (!uptodate && blk_noretry_request(req))
-			end_that_request_chunk(req, 0, leftover);
+		if (error && blk_noretry_request(req))
+			blk_end_request(req, error, leftover);
 		else {
 			if (requeue) {
 				/*
@@ -681,14 +680,6 @@ static struct scsi_cmnd *scsi_end_reques
 		}
 	}
 
-	add_disk_randomness(req->rq_disk);
-
-	spin_lock_irqsave(q->queue_lock, flags);
-	if (blk_rq_tagged(req))
-		blk_queue_end_tag(q, req);
-	end_that_request_last(req, uptodate);
-	spin_unlock_irqrestore(q->queue_lock, flags);
-
 	/*
 	 * This will goose the queue request function at the end, so we don't
 	 * need to worry about launching another command.
@@ -985,7 +976,7 @@ void scsi_io_completion(struct scsi_cmnd
 	 * are leftovers and there is some kind of error
 	 * (result != 0), retry the rest.
 	 */
-	if (scsi_end_request(cmd, 1, good_bytes, result == 0) == NULL)
+	if (scsi_end_request(cmd, 0, good_bytes, result == 0) == NULL)
 		return;
 
 	/* good_bytes = 0, or (inclusive) there were leftovers and
@@ -999,7 +990,7 @@ void scsi_io_completion(struct scsi_cmnd
 				 * and quietly refuse further access.
 				 */
 				cmd->device->changed = 1;
-				scsi_end_request(cmd, 0, this_count, 1);
+				scsi_end_request(cmd, -EIO, this_count, 1);
 				return;
 			} else {
 				/* Must have been a power glitch, or a
@@ -1031,7 +1022,7 @@ void scsi_io_completion(struct scsi_cmnd
 				scsi_requeue_command(q, cmd);
 				return;
 			} else {
-				scsi_end_request(cmd, 0, this_count, 1);
+				scsi_end_request(cmd, -EIO, this_count, 1);
 				return;
 			}
 			break;
@@ -1059,7 +1050,7 @@ void scsi_io_completion(struct scsi_cmnd
 							 "Device not ready",
 							 &sshdr);
 
-			scsi_end_request(cmd, 0, this_count, 1);
+			scsi_end_request(cmd, -EIO, this_count, 1);
 			return;
 		case VOLUME_OVERFLOW:
 			if (!(req->cmd_flags & REQ_QUIET)) {
@@ -1069,7 +1060,7 @@ void scsi_io_completion(struct scsi_cmnd
 				scsi_print_sense("", cmd);
 			}
 			/* See SSC3rXX or current. */
-			scsi_end_request(cmd, 0, this_count, 1);
+			scsi_end_request(cmd, -EIO, this_count, 1);
 			return;
 		default:
 			break;
@@ -1090,7 +1081,7 @@ void scsi_io_completion(struct scsi_cmnd
 				scsi_print_sense("", cmd);
 		}
 	}
-	scsi_end_request(cmd, 0, this_count, !result);
+	scsi_end_request(cmd, -EIO, this_count, !result);
 }
 
 /*

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 27/30] blk_end_request: changing scsi (take 4)
  2007-12-11 22:52 [PATCH 27/30] blk_end_request: changing scsi (take 4) Kiyoshi Ueda
@ 2007-12-12 12:55 ` James Bottomley
  0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2007-12-12 12:55 UTC (permalink / raw)
  To: Kiyoshi Ueda
  Cc: jens.axboe, linux-kernel, linux-scsi, linux-ide, dm-devel,
	j-nomura, bharrosh


On Tue, 2007-12-11 at 17:52 -0500, Kiyoshi Ueda wrote:
> This patch converts scsi mid-layer to use blk_end_request interfaces.
> Related 'uptodate' arguments are converted to 'error'.
> 
> As a result, the interface of internal function, scsi_end_request(),
> is changed.

This looks fine, as far as it goes.

One of the things that might actually be useful in future is as well as
communicating the error, the ability to say more information about what
happened.  For instance dm-mp needs to know whether the error is
transport or device related (the former being retryable on a different
path).

James



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-12 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-11 22:52 [PATCH 27/30] blk_end_request: changing scsi (take 4) Kiyoshi Ueda
2007-12-12 12:55 ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).