block: fix physical_block_size calculation
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.
Reported-by Mike Cao <[email protected]>
Signed-off-by Christoph Hellwig <[email protected]>
block_int.h +3 -1
@@ -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++; }
Am 15.06.2010 17:52, schrieb Christoph Hellwig:
Quoted 6 lines
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 <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
This one looks better. Fixed whitespace errors and applied to the block branch.
Kevin