linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libata: fix ata_id_logical_per_physical_sectors
@ 2010-01-28 10:42 Christoph Hellwig
  2010-01-28 10:56 ` Sergei Shtylyov
  2010-01-28 12:30 ` [PATCH v2] " Christoph Hellwig
  0 siblings, 2 replies; 8+ messages in thread
From: Christoph Hellwig @ 2010-01-28 10:42 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, stable

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/include/linux/ata.h
===================================================================
--- linux-2.6.orig/include/linux/ata.h	2010-01-28 11:17:41.968003842 +0100
+++ linux-2.6/include/linux/ata.h	2010-01-28 11:20:02.355268610 +0100
@@ -649,7 +649,7 @@ static inline int ata_id_has_large_logic
 
 static inline u8 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)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-02-03 18:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28 10:42 [PATCH] libata: fix ata_id_logical_per_physical_sectors Christoph Hellwig
2010-01-28 10:56 ` Sergei Shtylyov
2010-01-28 10:59   ` Christoph Hellwig
2010-01-28 12:30 ` [PATCH v2] " Christoph Hellwig
2010-02-03 17:37   ` Christoph Hellwig
2010-02-03 17:42     ` Jeff Garzik
2010-02-03 18:14     ` Martin K. Petersen
2010-02-03 18:17       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).