From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Wolf Subject: Re: [PATCH] Use qemu_memalign instead of qemu_malloc Date: Wed, 25 Jun 2008 16:29:31 +0200 Message-ID: <4862564B.8080108@suse.de> References: <1214333395-4094-1-git-send-email-aliguori@us.ibm.com> <48620DAB.5010501@suse.de> <48624C9D.90903@us.ibm.com> <486252FA.6030804@suse.de> <48625404.9070803@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Anthony Liguori Return-path: Received: from ns2.suse.de ([195.135.220.15]:46363 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752795AbYFYOcZ (ORCPT ); Wed, 25 Jun 2008 10:32:25 -0400 In-Reply-To: <48625404.9070803@us.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: Anthony Liguori schrieb: > Kevin Wolf wrote: >> Anthony Liguori schrieb: >> >> Yes, if it fails, the EINVAL is no surprise. I meant what code path it >> was using. Obviously we missed something in our patch and I'd like to >> fix that. Did the error occur on raw images or something like qcow2? >> > > It's a raw image and the calls are being made via > bdrv_aio_read/bdrv_aio_write. It doesn't occur with a qcow2 but then > cache=off doesn't seem to do what it's supposed to with cache=off (I > believe the underlying backing file is not opened O_DIRECT?). This is really strange. In raw_aio_read/write there is a check like this: if (unlikely(s->aligned_buf != NULL && ((uintptr_t) buf % 512))) { // emulate it using raw_pread/write which uses // s->aligned_buf for the request then } For qcow2 I think O_DIRECT actually is in effect. Otherwise it would have worked even without our patch, and it didn't. And indeed, looking at the code, it passes flags to bdrv_file_open when it opens the image file. Kevin