Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77629
b: refs/heads/master
c: 610d8b0
h: refs/heads/master
i:
  77627: 000e28c
v: v3
  • Loading branch information
Kiyoshi Ueda authored and Jens Axboe committed Jan 28, 2008
1 parent 5208e67 commit 6a00a34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3a04fe34a3ec81ddeddb6c73fb7299716cffbb0
refs/heads/master: 610d8b0c972e3b75493efef8e96175518fd736d3
31 changes: 11 additions & 20 deletions trunk/drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ void scsi_run_host_queues(struct Scsi_Host *shost)
* 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.
*
Expand All @@ -649,26 +649,25 @@ void scsi_run_host_queues(struct Scsi_Host *shost)
* 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) {
/*
Expand All @@ -683,14 +682,6 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate,
}
}

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.
Expand Down Expand Up @@ -987,7 +978,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
* 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
Expand All @@ -1001,7 +992,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
* 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
Expand Down Expand Up @@ -1033,7 +1024,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
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;
Expand Down Expand Up @@ -1061,7 +1052,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
"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)) {
Expand All @@ -1071,7 +1062,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
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;
Expand All @@ -1092,7 +1083,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
scsi_print_sense("", cmd);
}
}
scsi_end_request(cmd, 0, this_count, !result);
scsi_end_request(cmd, -EIO, this_count, !result);
}

/*
Expand Down

0 comments on commit 6a00a34

Please sign in to comment.