From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDyk0-0006R8-3x for qemu-devel@nongnu.org; Wed, 12 Oct 2011 09:21:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDyjy-0005U9-Eh for qemu-devel@nongnu.org; Wed, 12 Oct 2011 09:21:00 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:55942) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDyjy-0005T2-6r for qemu-devel@nongnu.org; Wed, 12 Oct 2011 09:20:58 -0400 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Oct 2011 07:20:31 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9CDKCPY173636 for ; Wed, 12 Oct 2011 07:20:13 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9CDJfjF022639 for ; Wed, 12 Oct 2011 07:19:44 -0600 From: "Aneesh Kumar K.V" In-Reply-To: References: <1317969967-8983-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <87ty7i9o1b.fsf@skywalker.in.ibm.com> <87r52m9fnt.fsf@skywalker.in.ibm.com> <87obxp9pwm.fsf@skywalker.in.ibm.com> Date: Wed, 12 Oct 2011 18:49:23 +0530 Message-ID: <87r52iuz38.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] hw/9pfs: Add new virtfs option cache=writethrough to skip host page cache List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Wed, 12 Oct 2011 10:55:21 +0100, Stefan Hajnoczi wr= ote: > On Mon, Oct 10, 2011 at 10:06 AM, Aneesh Kumar K.V > wrote: > > diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c > > index 5c8b5ed..441a37f 100644 > > --- a/hw/9pfs/virtio-9p-handle.c > > +++ b/hw/9pfs/virtio-9p-handle.c > > @@ -202,6 +202,15 @@ static ssize_t handle_pwritev(FsContext *ctx, int = fd, const struct iovec *iov, > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 return writev(fd, iov, iovcnt); >=20 > The sync_file_range(2) call below is dead-code since we'll return > immediately after writev(2) completes. The writev(2) return value > needs to be saved temporarily and then returned after > sync_file_range(2). Missed that. Will fix in the next update >=20 > > =C2=A0 =C2=A0 } > > =C2=A0#endif > > + =C2=A0 =C2=A0if (ctx->cache_flags & V9FS_WRITETHROUGH_CACHE) { >=20 > -drive cache=3Dwritethrough means something different from 9pfs > "writethrough". This is confusing so I wonder if there is a better > name like immediate write-out. >=20 cache=3Dimmediate-write-out ?=20 > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0/* > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Initiate a writeback. This is not a dat= a integrity sync. > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 * We want to ensure that we don't leave d= irty pages in the cache > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 * after write when cache=3Dwritethrough i= s sepcified. > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 */ > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0sync_file_range(fd, offset, 0, > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE); > > + =C2=A0 =C2=A0} >=20 > I'm not sure whether SYNC_FILE_RANGE_WAIT_BEFORE is necessary. As a > best-effort mechanism just SYNC_FILE_RANGE_WRITE does the job although > a client that rapidly rewrites may be able to leave dirty pages in the > host page cache Shouldn't we prevent this ? That is the reason for me to use that WAIT_BEFORE ? >. SYNC_FILE_RANGE_WAIT_BEFORE ensures that dirty pages > get written out but it is no longer asynchronous because it blocks. -aneesh