aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-01-06 12:34:07 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2006-01-14 11:54:45 -0500
commit776b23a0363d99ca402edc1aba1db8099b747b33 (patch)
tree20cab193388facc2506e3de2a3d931ab22d81ae4 /drivers/scsi/scsi_lib.c
parentd4054239929479907f20b9d68c905589125ad343 (diff)
[SCSI] always handle REQ_BLOCK_PC requests in common code
LLDDs should never see REQ_BLOCK_PC requests, we can handle them just fine in the core code. There is a small behaviour change in that some check in sr's rw_intr are bypassed, but I consider the old behaviour a bug. Mike found this cleanup opportunity and provdided early patches, so all the credit goes to him, even if I redid the patches from scratch beause that was easier than forward-porting the old patches. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 00c9bf383e23..3574ba935af8 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1212,7 +1212,7 @@ static int scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk,
1212 return -EOPNOTSUPP; 1212 return -EOPNOTSUPP;
1213} 1213}
1214 1214
1215static void scsi_generic_done(struct scsi_cmnd *cmd) 1215static void scsi_blk_pc_done(struct scsi_cmnd *cmd)
1216{ 1216{
1217 BUG_ON(!blk_pc_request(cmd->request)); 1217 BUG_ON(!blk_pc_request(cmd->request));
1218 /* 1218 /*
@@ -1224,7 +1224,7 @@ static void scsi_generic_done(struct scsi_cmnd *cmd)
1224 scsi_io_completion(cmd, cmd->bufflen, 0); 1224 scsi_io_completion(cmd, cmd->bufflen, 0);
1225} 1225}
1226 1226
1227void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd) 1227static void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd)
1228{ 1228{
1229 struct request *req = cmd->request; 1229 struct request *req = cmd->request;
1230 1230
@@ -1241,8 +1241,8 @@ void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd)
1241 cmd->transfersize = req->data_len; 1241 cmd->transfersize = req->data_len;
1242 cmd->allowed = req->retries; 1242 cmd->allowed = req->retries;
1243 cmd->timeout_per_command = req->timeout; 1243 cmd->timeout_per_command = req->timeout;
1244 cmd->done = scsi_blk_pc_done;
1244} 1245}
1245EXPORT_SYMBOL_GPL(scsi_setup_blk_pc_cmnd);
1246 1246
1247static int scsi_prep_fn(struct request_queue *q, struct request *req) 1247static int scsi_prep_fn(struct request_queue *q, struct request *req)
1248{ 1248{
@@ -1339,7 +1339,6 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
1339 * happening now. 1339 * happening now.
1340 */ 1340 */
1341 if (req->flags & (REQ_CMD | REQ_BLOCK_PC)) { 1341 if (req->flags & (REQ_CMD | REQ_BLOCK_PC)) {
1342 struct scsi_driver *drv;
1343 int ret; 1342 int ret;
1344 1343
1345 /* 1344 /*
@@ -1371,16 +1370,17 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
1371 /* 1370 /*
1372 * Initialize the actual SCSI command for this request. 1371 * Initialize the actual SCSI command for this request.
1373 */ 1372 */
1374 if (req->rq_disk) { 1373 if (req->flags & REQ_BLOCK_PC) {
1374 scsi_setup_blk_pc_cmnd(cmd);
1375 } else if (req->rq_disk) {
1376 struct scsi_driver *drv;
1377
1375 drv = *(struct scsi_driver **)req->rq_disk->private_data; 1378 drv = *(struct scsi_driver **)req->rq_disk->private_data;
1376 if (unlikely(!drv->init_command(cmd))) { 1379 if (unlikely(!drv->init_command(cmd))) {
1377 scsi_release_buffers(cmd); 1380 scsi_release_buffers(cmd);
1378 scsi_put_command(cmd); 1381 scsi_put_command(cmd);
1379 goto kill; 1382 goto kill;
1380 } 1383 }
1381 } else {
1382 scsi_setup_blk_pc_cmnd(cmd);
1383 cmd->done = scsi_generic_done;
1384 } 1384 }
1385 } 1385 }
1386 1386