linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: jgarzik@pobox.com
Cc: linux-ide@vger.kernel.org, stable@kernel.org
Subject: [PATCH v2] libata: fix ata_id_logical_per_physical_sectors
Date: Thu, 28 Jan 2010 13:30:11 +0100	[thread overview]
Message-ID: <20100128123011.GA32001@lst.de> (raw)
In-Reply-To: <20100128104234.GA25693@lst.de>

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>

Index: linux-2.6/include/linux/ata.h
===================================================================
--- linux-2.6.orig/include/linux/ata.h	2010-01-28 12:24:02.061016474 +0100
+++ linux-2.6/include/linux/ata.h	2010-01-28 13:26:59.270005271 +0100
@@ -647,9 +647,9 @@ static inline int ata_id_has_large_logic
 	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)

  parent reply	other threads:[~2010-01-28 12:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Christoph Hellwig [this message]
2010-02-03 17:37   ` [PATCH v2] " Christoph Hellwig
2010-02-03 17:42     ` Jeff Garzik
2010-02-03 18:14     ` Martin K. Petersen
2010-02-03 18:17       ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100128123011.GA32001@lst.de \
    --to=hch@lst.de \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).