]> git.proxmox.com Git - qemu.git/commitdiff
block: fix physical_block_size calculation
authorChristoph Hellwig <hch@lst.de>
Tue, 15 Jun 2010 15:52:52 +0000 (17:52 +0200)
committerKevin Wolf <kwolf@redhat.com>
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 <bcao@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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++;
     }