Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147031
b: refs/heads/master
c: e6bb7a9
h: refs/heads/master
i:
  147029: ec34a69
  147027: 41d5c41
  147023: 945122a
v: v3
  • Loading branch information
FUJITA Tomonori authored and Jens Axboe committed May 11, 2009
1 parent 1dc43ab commit 8be8498
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 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: 1822952ba2b9f22f79019d07ebbeca31dc14b718
refs/heads/master: e6bb7a96c2c36f20c05ef648f15bd3c2b1834c78
43 changes: 13 additions & 30 deletions trunk/drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,33 +672,6 @@ void scsi_release_buffers(struct scsi_cmnd *cmd)
}
EXPORT_SYMBOL(scsi_release_buffers);

/*
* Bidi commands Must be complete as a whole, both sides at once. If
* part of the bytes were written and lld returned scsi_in()->resid
* and/or scsi_out()->resid this information will be left in
* req->resid_len and req->next_rq->resid_len. The upper-layer driver
* can decide what to do with this information.
*/
static void scsi_end_bidi_request(struct scsi_cmnd *cmd)
{
struct request *req = cmd->request;

req->resid_len = scsi_out(cmd)->resid;
req->next_rq->resid_len = scsi_in(cmd)->resid;

/* The req and req->next_rq have not been completed */
BUG_ON(blk_end_bidi_request(req, 0, blk_rq_bytes(req),
blk_rq_bytes(req->next_rq)));

scsi_release_buffers(cmd);

/*
* This will goose the queue request function at the end, so we don't
* need to worry about launching another command.
*/
scsi_next_command(cmd);
}

/*
* Function: scsi_io_completion()
*
Expand Down Expand Up @@ -772,12 +745,22 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
if (!sense_deferred)
error = -EIO;
}

req->resid_len = scsi_get_resid(cmd);

if (scsi_bidi_cmnd(cmd)) {
/* will also release_buffers */
scsi_end_bidi_request(cmd);
/*
* Bidi commands Must be complete as a whole,
* both sides at once.
*/
req->next_rq->resid_len = scsi_in(cmd)->resid;

blk_end_request_all(req, 0);

scsi_release_buffers(cmd);
scsi_next_command(cmd);
return;
}
req->resid_len = scsi_get_resid(cmd);
}

BUG_ON(blk_bidi_rq(req)); /* bidi not support for !blk_pc_request yet */
Expand Down

0 comments on commit 8be8498

Please sign in to comment.