linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: rwheeler@redhat.com, snitzer@redhat.com, neilb@suse.de,
	James.Bottomley@hansenpartnership.com, jens.axboe@oracle.com,
	linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 12/13] libata: Report disk alignment and physical block size
Date: Fri, 15 May 2009 14:17:11 -0400	[thread overview]
Message-ID: <4A0DB1A7.4000209@garzik.org> (raw)
In-Reply-To: <1242362435-11953-13-git-send-email-martin.petersen@oracle.com>

Martin K. Petersen wrote:
> From: Martin K. Petersen <martin.petersen@oracle.com>
> 
> For disks with 4KB sectors, report the correct block size and alignment
> when filling out the READ CAPACITY(16) response.
> 
> This patch is based upon code from Matthew Wilcox' 4KB ATA tree.  I
> fixed the bug I reported a while back caused by ATA and SCSI using
> different approaches to describing the alignment.
> 
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>  drivers/ata/libata-scsi.c |   23 ++++++++++++++++++++++-
>  1 files changed, 22 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 6e4c600..5072003 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -2376,7 +2376,23 @@ saving_not_supp:
>   */
>  static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
>  {
> -	u64 last_lba = args->dev->n_sectors - 1; /* LBA of the last block */
> +	struct ata_device *dev = args->dev;
> +	u64 last_lba = dev->n_sectors - 1; /* LBA of the last block */
> +	u8 log_per_phys = 0;
> +	u16 lowest_aligned = 0;
> +	u16 word_106 = dev->id[106];
> +	u16 word_209 = dev->id[209];
> +
> +	if ((word_106 & 0xc000) == 0x4000) {
> +		/* Number and offset of logical sectors per physical sector */
> +		if (word_106 & (1 << 13))
> +			log_per_phys = word_106 & 0xf;
> +		if ((word_209 & 0xc000) == 0x4000) {
> +			u16 first = dev->id[209] & 0x3fff;
> +			if (first > 0)
> +				lowest_aligned = (1 << log_per_phys) - first;
> +		}
> +	}
>  
>  	VPRINTK("ENTER\n");
>  
> @@ -2407,6 +2423,11 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
>  		/* sector size */
>  		rbuf[10] = ATA_SECT_SIZE >> 8;
>  		rbuf[11] = ATA_SECT_SIZE & 0xff;
> +
> +		rbuf[12] = 0;
> +		rbuf[13] = log_per_phys;
> +		rbuf[14] = (lowest_aligned >> 8) & 0x3f;
> +		rbuf[15] = lowest_aligned;

applied




  reply	other threads:[~2009-05-15 18:17 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-15  4:40 I/O Topology v3 Martin K. Petersen
2009-05-15  4:40 ` [PATCH 01/13] block: Do away with the notion of hardsect_size Martin K. Petersen
2009-05-15  4:40 ` [PATCH 02/13] block: Use accessor functions for queue limits Martin K. Petersen
2009-05-31 15:51   ` Bartlomiej Zolnierkiewicz
2009-06-01  5:08     ` Martin K. Petersen
2009-06-01  5:15       ` Jens Axboe
2009-06-01  5:28         ` Martin K. Petersen
2009-05-15  4:40 ` [PATCH 03/13] block: Move queue limits to an embedded struct Martin K. Petersen
2009-05-18 18:50   ` Mike Snitzer
2009-05-18 18:52     ` Mike Snitzer
2009-05-19 16:46     ` Martin K. Petersen
2009-05-15  4:40 ` [PATCH 04/13] block: Expose stacked device queues in sysfs Martin K. Petersen
2009-05-15  4:40 ` [PATCH 05/13] block: Export I/O topology for block devices and partitions Martin K. Petersen
2009-05-18 17:57   ` Jens Axboe
2009-05-18 18:12     ` Mike Snitzer
2009-05-19 16:41       ` Martin K. Petersen
2009-05-19 18:15         ` Jens Axboe
2009-05-20 21:19           ` Martin K. Petersen
2009-05-22  7:30             ` Jens Axboe
2009-05-22 13:34               ` Martin K. Petersen
2009-05-22 18:16                 ` Jens Axboe
2009-05-15  4:40 ` [PATCH 06/13] MD: Use new topology calls to indicate alignment and I/O sizes Martin K. Petersen
2009-05-15  4:40 ` [PATCH 07/13] block: Deprecate blk_queue_stack_limits Martin K. Petersen
2009-05-15  4:40 ` [PATCH 08/13] sd: Physical block size and alignment support Martin K. Petersen
2009-05-15  4:40 ` [PATCH 09/13] sd: Detect non-rotational devices Martin K. Petersen
2009-05-15  4:40 ` [PATCH 10/13] sd: Block limits VPD support Martin K. Petersen
2009-05-15  4:40 ` [PATCH 11/13] scsi_debug: Add support for physical block exponent and alignment Martin K. Petersen
2009-05-19 15:11   ` Douglas Gilbert
2009-05-15  4:40 ` [PATCH 12/13] libata: Report disk alignment and physical block size Martin K. Petersen
2009-05-15 18:17   ` Jeff Garzik [this message]
2009-05-15  4:40 ` [PATCH 13/13] libata: Media rotation rate and form factor heuristics Martin K. Petersen
2009-05-15 18:17   ` Jeff Garzik

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=4A0DB1A7.4000209@garzik.org \
    --to=jeff@garzik.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=neilb@suse.de \
    --cc=rwheeler@redhat.com \
    --cc=snitzer@redhat.com \
    /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).