From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdHqr-0002Ox-Qf for qemu-devel@nongnu.org; Wed, 01 Apr 2015 08:34:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdHql-0002zA-TD for qemu-devel@nongnu.org; Wed, 01 Apr 2015 08:34:33 -0400 Date: Wed, 1 Apr 2015 14:34:17 +0200 From: Kevin Wolf Message-ID: <20150401123417.GF3593@noname.str.redhat.com> References: <55151DB7.3090200@msgid.tls.msk.ru> <55156DE0.4050209@redhat.com> <551578F4.9010400@msgid.tls.msk.ru> <55158F8B.9090607@redhat.com> <20150330153634.GC4305@noname.redhat.com> <551BB9DA.7030309@msgid.tls.msk.ru> <551BC040.9000806@msgid.tls.msk.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <551BC040.9000806@msgid.tls.msk.ru> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] block-commit & dropping privs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: qemu-devel , qemu-block@nongnu.org Am 01.04.2015 um 11:54 hat Michael Tokarev geschrieben: > 01.04.2015 12:26, Michael Tokarev =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > 30.03.2015 18:36, Kevin Wolf wrote: > >> Am 27.03.2015 um 18:12 hat Eric Blake geschrieben: > >>> On 03/27/2015 09:36 AM, Michael Tokarev wrote: > >>>> Wonder how to specify cache mode, or should I open these with prop= er > >>>> O_DIRECT/O_SYNC/whatever? It looks like it's possible to change O= _DIRECT > >>>> at runtime but not O_SYNC. > >>>> > >>>> And the more interesting question is how to do that from shell. > >>> > >>> Redirections only get you so far in shell; you may need a wrapper C > >>> program go get O_DIRECT and/or O_SYNC pre-set. Then again, if you = use > >>> QMP and pass over the Unix socket, you need a C program anyways. > >> > >> O_DIRECT can be set with fcntl(), so qemu takes care of that. O_SYNC > >> is completely unused on Linux these days, so that shouldn't be a pro= blem >=20 > Do you mean it is unused in qemu or in kernel? :) In qemu. We used to use O_DSYNC for cache=3Dwritethrough long ago, but nowadays we just issue fdatasync() manually. > >> either. (Other platforms use it as a misguided attempt of approximat= ing > >> O_DIRECT. We should really error out instead.) > >> > >> So if I'm not mistaken, just having one read-only and one read-write= fd > >> should be enough for any configuration in practice. >=20 > Yes, O_DIRECT appears to work with fdsets. >=20 > > Probably yes. Except the thing doesn't actually work. ;) > >=20 > > When flushing changes to the base image, that base image needs to be > > reopened. So I should convince qemu that the base image of this qcow > > file is /dev/fdset/foo, not the one recorded in the header. >=20 > qemu-system-x86_64: -drive file=3Dw7x64.qcow2,backing_file=3D/dev/fdset= /2,if=3Dnone,id=3Ddr,cache=3Dnone: \ > could not open disk image w7x64.qcow2: Block format 'qcow2' used by de= vice 'dr' \ > doesn't support the option 'backing_file' Overriding the backing file should work like this: -drive file=3D...,backing.file.filename=3D/dev/fdset/2 Kevin