qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: fix physical_block_size calculation
Date: Tue, 15 Jun 2010 15:48:26 +0200	[thread overview]
Message-ID: <4C1784AA.8080304@redhat.com> (raw)
In-Reply-To: <20100615123936.GA25281@lst.de>

Am 15.06.2010 14:39, schrieb Christoph Hellwig:
> Both SCSI and virtio expect the physical block size relative to the
> logical block size.  So get the factor first before calculating the
> log2.  
> 
> Reported-by: Mike Cao <bcao@redhat.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: qemu/block_int.h
> ===================================================================
> --- qemu.orig/block_int.h	2010-06-15 14:29:42.593012221 +0200
> +++ qemu/block_int.h	2010-06-15 14:30:00.164034570 +0200
> @@ -223,7 +223,9 @@ static inline unsigned int get_physical_
>  {
>      unsigned int exp = 0, size;
>  
> -    for (size = conf->physical_block_size; size > 512; size >>= 1) {
> +    for (size = conf->physical_block_size / conf->logical_block_size;
> +         size > 512;

512 looks wrong now that size is the number of logical blocks.

Kevin

> +	 size >>= 1) {
>          exp++;
>      }
>  
> 

  reply	other threads:[~2010-06-15 13:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 12:39 [Qemu-devel] [PATCH] block: fix physical_block_size calculation Christoph Hellwig
2010-06-15 13:48 ` Kevin Wolf [this message]
2010-06-15 15:52   ` 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=4C1784AA.8080304@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hch@lst.de \
    --cc=qemu-devel@nongnu.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).