diff options
author | Christoph Hellwig <hch@lst.de> | 2006-01-06 12:34:07 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2006-01-14 11:54:45 -0500 |
commit | 776b23a0363d99ca402edc1aba1db8099b747b33 (patch) | |
tree | 20cab193388facc2506e3de2a3d931ab22d81ae4 /drivers/scsi/sd.c | |
parent | d4054239929479907f20b9d68c905589125ad343 (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/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index fbd8e1bbad38..930db398d107 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -232,34 +232,12 @@ static void scsi_disk_put(struct scsi_disk *sdkp) | |||
232 | **/ | 232 | **/ |
233 | static int sd_init_command(struct scsi_cmnd * SCpnt) | 233 | static int sd_init_command(struct scsi_cmnd * SCpnt) |
234 | { | 234 | { |
235 | unsigned int this_count, timeout; | ||
236 | struct gendisk *disk; | ||
237 | sector_t block; | ||
238 | struct scsi_device *sdp = SCpnt->device; | 235 | struct scsi_device *sdp = SCpnt->device; |
239 | struct request *rq = SCpnt->request; | 236 | struct request *rq = SCpnt->request; |
240 | 237 | struct gendisk *disk = rq->rq_disk; | |
241 | timeout = sdp->timeout; | 238 | sector_t block = rq->sector; |
242 | 239 | unsigned int this_count = SCpnt->request_bufflen >> 9; | |
243 | /* | 240 | unsigned int timeout = sdp->timeout; |
244 | * SG_IO from block layer already setup, just copy cdb basically | ||
245 | */ | ||
246 | if (blk_pc_request(rq)) { | ||
247 | scsi_setup_blk_pc_cmnd(SCpnt); | ||
248 | if (rq->timeout) | ||
249 | timeout = rq->timeout; | ||
250 | |||
251 | goto queue; | ||
252 | } | ||
253 | |||
254 | /* | ||
255 | * we only do REQ_CMD and REQ_BLOCK_PC | ||
256 | */ | ||
257 | if (!blk_fs_request(rq)) | ||
258 | return 0; | ||
259 | |||
260 | disk = rq->rq_disk; | ||
261 | block = rq->sector; | ||
262 | this_count = SCpnt->request_bufflen >> 9; | ||
263 | 241 | ||
264 | SCSI_LOG_HLQUEUE(1, printk("sd_init_command: disk=%s, block=%llu, " | 242 | SCSI_LOG_HLQUEUE(1, printk("sd_init_command: disk=%s, block=%llu, " |
265 | "count=%d\n", disk->disk_name, | 243 | "count=%d\n", disk->disk_name, |
@@ -402,8 +380,6 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) | |||
402 | SCpnt->transfersize = sdp->sector_size; | 380 | SCpnt->transfersize = sdp->sector_size; |
403 | SCpnt->underflow = this_count << 9; | 381 | SCpnt->underflow = this_count << 9; |
404 | SCpnt->allowed = SD_MAX_RETRIES; | 382 | SCpnt->allowed = SD_MAX_RETRIES; |
405 | |||
406 | queue: | ||
407 | SCpnt->timeout_per_command = timeout; | 383 | SCpnt->timeout_per_command = timeout; |
408 | 384 | ||
409 | /* | 385 | /* |
@@ -837,15 +813,7 @@ static void sd_rw_intr(struct scsi_cmnd * SCpnt) | |||
837 | relatively rare error condition, no care is taken to avoid | 813 | relatively rare error condition, no care is taken to avoid |
838 | unnecessary additional work such as memcpy's that could be avoided. | 814 | unnecessary additional work such as memcpy's that could be avoided. |
839 | */ | 815 | */ |
840 | 816 | if (driver_byte(result) != 0 && | |
841 | /* | ||
842 | * If SG_IO from block layer then set good_bytes to stop retries; | ||
843 | * else if errors, check them, and if necessary prepare for | ||
844 | * (partial) retries. | ||
845 | */ | ||
846 | if (blk_pc_request(SCpnt->request)) | ||
847 | good_bytes = this_count; | ||
848 | else if (driver_byte(result) != 0 && | ||
849 | sense_valid && !sense_deferred) { | 817 | sense_valid && !sense_deferred) { |
850 | switch (sshdr.sense_key) { | 818 | switch (sshdr.sense_key) { |
851 | case MEDIUM_ERROR: | 819 | case MEDIUM_ERROR: |