Skip to contentSkip to conversation

scsi_lib.c: do not requeue on success

PATCH In review Luben Tuikov 2 participants 2 messages Jul 8, 2006 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_lib.c: do not requeue on success

Do not requeue on success. I.e. when result is 0, success, we do not want to requeue.

drivers/scsi/scsi_lib.c +1 -1
index 08af9aa..841f958 100644
@@ -932,7 +932,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, 1, good_bytes, !!result) == NULL)
                return;
 
        /* good_bytes = 0, or (inclusive) there were leftovers and
#1 lore raw

drivers/scsi/scsi_lib.c void scsi_io_completion(struct scsi_cmnd · line 935

Quoted 2 lines · Luben Tuikov
drivers/scsi/scsi_lib.c +1 -1
-       if (scsi_end_request(cmd, 1, good_bytes, result == 0) == NULL)
+       if (scsi_end_request(cmd, 1, good_bytes, !!result) == NULL)

Um, why?

I merely reverted this hunk back to the original code to fix the SATA flushing problem. The requeue code in scsi_end_request() is

	if (end_that_request_chunk(req, uptodate, bytes)) {
[...]
		/* kill remainder if no retrys */
		if (!uptodate && blk_noretry_request(req))
			end_that_request_chunk(req, 0, leftover);
		else {
			if (requeue) {
				/*
				 * Bleah.  Leftovers again.  Stick the
				 * leftovers in the front of the
				 * queue, and goose the queue again.
				 */
				scsi_requeue_command(q, cmd);
				cmd = NULL;
			}
			return cmd;
		}

however, since we go into scsi_end_request() with uptodate == 1, we always hit the else code if good_bytes is less than the actual request size. Now, if we have an actual error, i.e. result != 0 it looks to me like we want to continue on in scsi_io_completion and process it (i.e. return and don't requeue). I think if good_bytes is less than the request size and result == 0 we want to requeue (this is for the case where we had to process the request with a SCSI command that couldn't contain the entire request length, so we have to keep going around until we complete it---realistically only READ/WRITE(6), I think).

James