Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213627
b: refs/heads/master
c: 5ce524b
h: refs/heads/master
i:
  213625: 044d24e
  213623: 4f9dc1a
v: v3
  • Loading branch information
Hans de Goede authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent 0e9184e commit 593b663
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae38c78a03e1b77ad45248fcf097e4568e740209
refs/heads/master: 5ce524bdff367b4abda20bcfd4dafd9d30c773df
12 changes: 12 additions & 0 deletions trunk/drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,9 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
unsigned long long lba;
unsigned sector_size;

if (sdp->no_read_capacity_16)
return -EINVAL;

do {
memset(cmd, 0, 16);
cmd[0] = SERVICE_ACTION_IN;
Expand Down Expand Up @@ -1626,6 +1629,15 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
sector_size = get_unaligned_be32(&buffer[4]);
lba = get_unaligned_be32(&buffer[0]);

if (sdp->no_read_capacity_16 && (lba == 0xffffffff)) {
/* Some buggy (usb cardreader) devices return an lba of
0xffffffff when the want to report a size of 0 (with
which they really mean no media is present) */
sdkp->capacity = 0;
sdkp->hw_sector_size = sector_size;
return sector_size;
}

if ((sizeof(sdkp->capacity) == 4) && (lba == 0xffffffff)) {
sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use a "
"kernel compiled with support for large block "
Expand Down
1 change: 1 addition & 0 deletions trunk/include/scsi/scsi_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ struct scsi_device {
unsigned last_sector_bug:1; /* do not use multisector accesses on
SD_LAST_BUGGY_SECTORS */
unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */
unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
unsigned is_visible:1; /* is the device visible in sysfs */

DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
Expand Down

0 comments on commit 593b663

Please sign in to comment.