summaryrefslogtreecommitdiff
path: root/block_int.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-06-15 17:52:52 +0200
committerKevin Wolf <kwolf@redhat.com>2010-06-22 14:38:01 +0200
commit1e297c323590d3deae46e566956cc4351e2aa5da (patch)
treebeadd56b5142b32bc63002efdcfcee4a2ff82bf0 /block_int.h
parentc7126d5b3216e57b4e388e3fd34faa785b8e4bd0 (diff)
downloadqemu-1e297c323590d3deae46e566956cc4351e2aa5da.tar.gz
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. Reported-by: Mike Cao <bcao@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block_int.h')
-rw-r--r--block_int.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/block_int.h b/block_int.h
index e3bfd192a2..b64a0095f5 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++;
}