From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbCmX-0004Pw-Qu for qemu-devel@nongnu.org; Wed, 21 Nov 2012 11:04:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbCmT-0002I6-Q5 for qemu-devel@nongnu.org; Wed, 21 Nov 2012 11:04:09 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]:38255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbCmT-0002Hr-JB for qemu-devel@nongnu.org; Wed, 21 Nov 2012 11:04:05 -0500 Received: by mail-ie0-f173.google.com with SMTP id e13so431770iej.4 for ; Wed, 21 Nov 2012 08:04:05 -0800 (PST) Sender: Paolo Bonzini Message-ID: <50ACFB6D.8040106@redhat.com> Date: Wed, 21 Nov 2012 17:03:57 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1353488287-47077-1-git-send-email-borntraeger@de.ibm.com> <50AC9B96.9070908@redhat.com> In-Reply-To: <50AC9B96.9070908@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH/RFC] block: Ensure that block size constraints are considered List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Heinz Graalfs , agraf@suse.de, qemu-devel@nongnu.org, Christian Borntraeger , jfrei@linux.vnet.ibm.com, Stefan Hajnoczi Il 21/11/2012 10:15, Kevin Wolf ha scritto: >> > + if ((bs->open_flags & BDRV_O_NOCACHE)) { >> > + bs->file->buffer_alignment = align; >> > + } > Any reason to restrict this to BDRV_O_NOCACHE? > > There have been patches to change the BDRV_O_NOCACHE flag from the > monitor, in which case bdrv_set_buffer_alignment() wouldn't be called > anew and O_DIRECT requests start to fail again. > bdrv_set_buffer_alignment() is completely broken. It should set host alignment, but in fact it is passed the guest alignment. In practice, we only support logical_block_size matching the host's or bigger (which is unsafe due to torn writes, but works). So I suggest that we just look at writes outside the device models, and "fix" them to always read a multiple of 4k. Paolo