From: Christoph Hellwig <hch@lst.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] block: fix physical_block_size calculation
Date: Tue, 15 Jun 2010 14:39:36 +0200 [thread overview]
Message-ID: <20100615123936.GA25281@lst.de> (raw)
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;
+ size >>= 1) {
exp++;
}
next reply other threads:[~2010-06-15 12:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-15 12:39 Christoph Hellwig [this message]
2010-06-15 13:48 ` [Qemu-devel] [PATCH] block: fix physical_block_size calculation Kevin Wolf
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=20100615123936.GA25281@lst.de \
--to=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).