From 3d2c41df692b8de874271bd8a6b23e13fd45f520 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 20 Jan 2008 11:12:26 +0100 Subject: [PATCH] --- yaml --- r: 77153 b: refs/heads/master c: a0899d4df534d2bcf671b0f647b809842309a9ae h: refs/heads/master i: 77151: 927825dcb6180bd55e572fda371c401190075025 v: v3 --- [refs] | 2 +- trunk/drivers/scsi/sd.c | 9 +++++++++ trunk/include/scsi/scsi_device.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index ea8a4bad1a97..d672cf3b6b24 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b523381e325366cc54a2548df418c2a427b2f2ee +refs/heads/master: a0899d4df534d2bcf671b0f647b809842309a9ae diff --git a/trunk/drivers/scsi/sd.c b/trunk/drivers/scsi/sd.c index 212f6bcfd457..24eba3118b5a 100644 --- a/trunk/drivers/scsi/sd.c +++ b/trunk/drivers/scsi/sd.c @@ -395,6 +395,15 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) goto out; } + /* + * Some devices (some sdcards for one) don't like it if the + * last sector gets read in a larger then 1 sector read. + */ + if (unlikely(sdp->last_sector_bug && + rq->nr_sectors > sdp->sector_size / 512 && + block + this_count == get_capacity(disk))) + this_count -= sdp->sector_size / 512; + SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "block=%llu\n", (unsigned long long)block)); diff --git a/trunk/include/scsi/scsi_device.h b/trunk/include/scsi/scsi_device.h index e0c645ac5014..3c8f898b160e 100644 --- a/trunk/include/scsi/scsi_device.h +++ b/trunk/include/scsi/scsi_device.h @@ -139,6 +139,7 @@ struct scsi_device { unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */ unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */ unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ + unsigned last_sector_bug:1; /* Always read last sector in a 1 sector read */ DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ struct list_head event_list; /* asserted events */