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>
This commit is contained in:
Christoph Hellwig 2010-06-15 17:52:52 +02:00 committed by Kevin Wolf
parent c7126d5b32
commit 1e297c3235

View 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++;
}