From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LrwDn-00042N-JO for qemu-devel@nongnu.org; Thu, 09 Apr 2009 11:31:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LrwDi-0003x5-UB for qemu-devel@nongnu.org; Thu, 09 Apr 2009 11:31:19 -0400 Received: from [199.232.76.173] (port=35997 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LrwDi-0003wu-EX for qemu-devel@nongnu.org; Thu, 09 Apr 2009 11:31:14 -0400 Received: from verein.lst.de ([213.95.11.210]:58597) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1LrwDh-0000DB-UQ for qemu-devel@nongnu.org; Thu, 09 Apr 2009 11:31:14 -0400 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id n39FVCIF022602 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 9 Apr 2009 17:31:12 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.6) id n39FVCnw022600 for qemu-devel@nongnu.org; Thu, 9 Apr 2009 17:31:12 +0200 Date: Thu, 9 Apr 2009 17:31:12 +0200 From: Christoph Hellwig Subject: Re: [Qemu-devel] buffer alignment for block backends Message-ID: <20090409153112.GA22492@lst.de> References: <49DCA80A.1020808@eu.citrix.com> <49DCF2C0.9070704@codemonkey.ws> <49DDC8E0.50900@eu.citrix.com> <20090409131951.GA17258@lst.de> <49DDF882.2050308@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49DDF882.2050308@eu.citrix.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Thu, Apr 09, 2009 at 02:30:42PM +0100, Stefano Stabellini wrote: > Christoph Hellwig wrote: > > > On Thu, Apr 09, 2009 at 11:07:28AM +0100, Stefano Stabellini wrote: > >> + acb->bounce = qemu_blockalign(qiov->size); > > > > Why don't you pass a BlockDriverState to it so that it automatically > > does the best alignment for the underlying driver? > > > > This is a good idea. > > What if I add a new field to BlockDriverState called 'alignment' > defaulted to 512? Let's call it buffer_alignmnet or memory_alignment as we also have an alignment of the actual sector number (doesn't matter currently, but there are devices or device configurations that only support larger than 512 byte sectors) Also please add a large comment describing what it's used for. Right now that's only a hint for the allocations, but I might re-use it in future to move the bouncing on mis-alignmnet into the block layer.