From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbXCr-0003ls-Bo for qemu-devel@nongnu.org; Thu, 22 Nov 2012 08:52:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TbXCl-0004Xs-6D for qemu-devel@nongnu.org; Thu, 22 Nov 2012 08:52:41 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:44389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TbXCk-0004XR-Tq for qemu-devel@nongnu.org; Thu, 22 Nov 2012 08:52:35 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Nov 2012 13:52:33 -0000 Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qAMC2vKc65142954 for ; Thu, 22 Nov 2012 12:02:57 GMT Received: from d06av06.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qAMC34OU016768 for ; Thu, 22 Nov 2012 05:03:04 -0700 Message-ID: <50AE1477.9090001@de.ibm.com> Date: Thu, 22 Nov 2012 13:03:03 +0100 From: Christian Borntraeger MIME-Version: 1.0 References: <1353488287-47077-1-git-send-email-borntraeger@de.ibm.com> <50AC9B96.9070908@redhat.com> <50ACFB6D.8040106@redhat.com> In-Reply-To: <50ACFB6D.8040106@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: Paolo Bonzini Cc: Kevin Wolf , Heinz Graalfs , agraf@suse.de, qemu-devel@nongnu.org, jfrei@linux.vnet.ibm.com, Stefan Hajnoczi On 21/11/12 17:03, Paolo Bonzini wrote: > 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). For other reasons (partition table format) we want to have host block size == guest block size on s390 anyway - so it would not really matter for us. But I certainly agree that it makes more sense to use the host block size for the alignment checks. > So I suggest that we just look at writes outside the device models, and > "fix" them to always read a multiple of 4k. Wouldnt that cause performance regressions for block devices with 512 byte block size, because we read more than necessary. Wouldnt that also require read/update/write combinations for valid 512 byte writes? Christian