Skip to contentSkip to conversation

block: fix physical_block_size calculation

PATCH In review Christoph Hellwig 2 participants 2 messages Jun 15, 2010 – Jun 16, 2010

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 block: fix physical_block_size calculation

Both SCSI and virtio expect the physical block size relative to the logical block size. So get the factor first before calculating the log2.

block_int.h +3 -1
Index: qemu/block_int.h
===================================================================
@@ -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;
+    	 size > conf->logical_block_size;
+	 size >>= 1) {
         exp++;
     }