qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 03/14] block: fix physical_block_size calculation


From: Kevin Wolf
Subject: [Qemu-devel] [PATCH 03/14] block: fix physical_block_size calculation
Date: Tue, 22 Jun 2010 16:09:22 +0200

From: Christoph Hellwig <address@hidden>

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 <address@hidden>
Signed-off-by: Christoph Hellwig <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
 block_int.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/block_int.h b/block_int.h
index e3bfd19..b64a009 100644
--- a/block_int.h
+++ b/block_int.h
@@ -224,7 +224,9 @@ static inline unsigned int get_physical_block_exp(BlockConf 
*conf)
 {
     unsigned int exp = 0, size;
 
-    for (size = conf->physical_block_size; size > 512; size >>= 1) {
+    for (size = conf->physical_block_size;
+        size > conf->logical_block_size;
+        size >>= 1) {
         exp++;
     }
 
-- 
1.6.6.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]