diff options
author | Hans de Goede <j.w.r.degoede@hhs.nl> | 2008-01-20 05:12:26 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-23 12:29:34 -0500 |
commit | a0899d4df534d2bcf671b0f647b809842309a9ae (patch) | |
tree | 990c3eb7876f6f8a6dee37ec2ecd4684c11b1f74 /drivers/scsi/sd.c | |
parent | b523381e325366cc54a2548df418c2a427b2f2ee (diff) |
[SCSI] sd: add fix for devices with last sector access problems
This patch adds a new scsi_device flag (last_sector_bug) for devices
which contain a bug where the device crashes when the last sector is
read in a larger then 1 sector read.
This is for example the case with sdcards in the HP PSC1350 printer
cardreader and in the HP PSC1610 printer cardreader.
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 212f6bcfd45..24eba3118b5 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -395,6 +395,15 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
395 | goto out; | 395 | goto out; |
396 | } | 396 | } |
397 | 397 | ||
398 | /* | ||
399 | * Some devices (some sdcards for one) don't like it if the | ||
400 | * last sector gets read in a larger then 1 sector read. | ||
401 | */ | ||
402 | if (unlikely(sdp->last_sector_bug && | ||
403 | rq->nr_sectors > sdp->sector_size / 512 && | ||
404 | block + this_count == get_capacity(disk))) | ||
405 | this_count -= sdp->sector_size / 512; | ||
406 | |||
398 | SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "block=%llu\n", | 407 | SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "block=%llu\n", |
399 | (unsigned long long)block)); | 408 | (unsigned long long)block)); |
400 | 409 | ||