]> Git Repo - qemu.git/commitdiff
block: fix physical_block_size calculation
authorChristoph Hellwig <[email protected]>
Tue, 15 Jun 2010 15:52:52 +0000 (17:52 +0200)
committerKevin Wolf <[email protected]>
Tue, 22 Jun 2010 12:38:01 +0000 (14:38 +0200)
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 <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block_int.h

index e3bfd192a29e0db85b4deaabef2641f4c6f4b805..b64a0095f5c179eefd73a0277b4fcc53d037a7db 100644 (file)
@@ -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++;
     }
 
This page took 0.026966 seconds and 4 git commands to generate.