From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=48863 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOWVY-00008e-0P for qemu-devel@nongnu.org; Tue, 15 Jun 2010 09:48:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOWVP-0001fz-KA for qemu-devel@nongnu.org; Tue, 15 Jun 2010 09:48:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56542) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOWVP-0001ft-By for qemu-devel@nongnu.org; Tue, 15 Jun 2010 09:48:43 -0400 Message-ID: <4C1784AA.8080304@redhat.com> Date: Tue, 15 Jun 2010 15:48:26 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] block: fix physical_block_size calculation References: <20100615123936.GA25281@lst.de> In-Reply-To: <20100615123936.GA25281@lst.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org Am 15.06.2010 14:39, schrieb Christoph Hellwig: > 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 > Signed-off-by: Christoph Hellwig > > 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; 512 looks wrong now that size is the number of logical blocks. Kevin > + size >>= 1) { > exp++; > } > >