Skip to content

Commit

Permalink
libata: fix ata_id_logical_per_physical_sectors
Browse files Browse the repository at this point in the history
The value we get from the low byte of the ATA_ID_SECTOR_SIZE word is not not
a plain multiple, but the log of it, so fix the helper to give the correct
answer.  Without this we'll get an incorrect minimal I/O size in the block
limits VPD page for 4k sector drives.

Also change the return value of ata_id_logical_per_physical_sectors to u16
for the unlikely case of very large logical sectors.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Christoph Hellwig authored and Jeff Garzik committed Feb 4, 2010
1 parent bc496ed commit f7acede
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/ata.h
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,9 @@ static inline int ata_id_has_large_logical_sectors(const u16 *id)
return id[ATA_ID_SECTOR_SIZE] & (1 << 13);
}

static inline u8 ata_id_logical_per_physical_sectors(const u16 *id)
static inline u16 ata_id_logical_per_physical_sectors(const u16 *id)
{
return id[ATA_ID_SECTOR_SIZE] & 0xf;
return 1 << (id[ATA_ID_SECTOR_SIZE] & 0xf);
}

static inline int ata_id_has_lba48(const u16 *id)
Expand Down

0 comments on commit f7acede

Please sign in to comment.