libata: fix ata_id_logical_per_physical_sectors

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>

authored by Christoph Hellwig and committed by Jeff Garzik f7acede6 bc496ed0

+2 -2
+2 -2
include/linux/ata.h
··· 647 647 return id[ATA_ID_SECTOR_SIZE] & (1 << 13); 648 648 } 649 649 650 - static inline u8 ata_id_logical_per_physical_sectors(const u16 *id) 650 + static inline u16 ata_id_logical_per_physical_sectors(const u16 *id) 651 651 { 652 - return id[ATA_ID_SECTOR_SIZE] & 0xf; 652 + return 1 << (id[ATA_ID_SECTOR_SIZE] & 0xf); 653 653 } 654 654 655 655 static inline int ata_id_has_lba48(const u16 *id)