aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-01-28 07:30:11 -0500
committerJeff Garzik <jgarzik@redhat.com>2010-02-04 01:01:32 -0500
commitf7acede65d6b65919aee5b6a360a17cedb11f2f7 (patch)
treeac1adbda9b14e2820e8bee2407bf6895c357d9b0 /include/linux
parentbc496ed00ab1411d3efaf295b72e0c9eb343e1a3 (diff)
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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ata.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 38a6948ce0c2..20f31567ccee 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -647,9 +647,9 @@ static inline int ata_id_has_large_logical_sectors(const u16 *id)
647 return id[ATA_ID_SECTOR_SIZE] & (1 << 13); 647 return id[ATA_ID_SECTOR_SIZE] & (1 << 13);
648} 648}
649 649
650static inline u8 ata_id_logical_per_physical_sectors(const u16 *id) 650static 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
655static inline int ata_id_has_lba48(const u16 *id) 655static inline int ata_id_has_lba48(const u16 *id)