[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] block: fix physical_block_size calculation
From: |
Christoph Hellwig |
Subject: |
[Qemu-devel] [PATCH] block: fix physical_block_size calculation |
Date: |
Tue, 15 Jun 2010 14:39:36 +0200 |
User-agent: |
Mutt/1.3.28i |
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 <address@hidden>
Signed-off-by: Christoph Hellwig <address@hidden>
Index: qemu/block_int.h
===================================================================
--- qemu.orig/block_int.h 2010-06-15 14:29:42.593012221 +0200
+++ qemu/block_int.h 2010-06-15 14:30:00.164034570 +0200
@@ -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 / conf->logical_block_size;
+ size > 512;
+ size >>= 1) {
exp++;
}
- [Qemu-devel] [PATCH] block: fix physical_block_size calculation,
Christoph Hellwig <=