Received: from eggs.gnu.org ([140.186.70.92]:56334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qovz7-0005Eq-Pp for qemu-devel@nongnu.org; Thu, 04 Aug 2011 07:21:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qovz6-0003M7-JD for qemu-devel@nongnu.org; Thu, 04 Aug 2011 07:21:05 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:56590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qovz6-0003M1-FJ for qemu-devel@nongnu.org; Thu, 04 Aug 2011 07:21:04 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p74AwJWp027231 for ; Thu, 4 Aug 2011 06:58:19 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p74BL2RG214192 for ; Thu, 4 Aug 2011 07:21:02 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p74BL0sF009798 for ; Thu, 4 Aug 2011 08:21:02 -0300 From: "Aneesh Kumar K.V" In-Reply-To: References: <1312452371-10375-1-git-send-email-harsh@linux.vnet.ibm.com> <1312452371-10375-3-git-send-email-harsh@linux.vnet.ibm.com> Date: Thu, 04 Aug 2011 16:50:55 +0530 Message-ID: <87hb5x1kyw.fsf@skywalker.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/2] i_generation / st_gen support for handle based fs driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , Harsh Prateek Bora Cc: qemu-devel@nongnu.org On Thu, 4 Aug 2011 11:21:05 +0100, Stefan Hajnoczi wro= te: > On Thu, Aug 4, 2011 at 11:06 AM, Harsh Prateek Bora > wrote: > > This patch provides support for st_gen for handle based fs type server. > > Currently the support is provided for ext4, btrfs, reiserfs and xfs. > > > > Signed-off-by: Harsh Prateek Bora > > --- > > =C2=A0hw/9pfs/virtio-9p-handle.c | =C2=A0 30 ++++++++++++++++++++++++++= ++++ > > =C2=A01 files changed, 30 insertions(+), 0 deletions(-) >=20 > Does handle-based file I/O really need to duplicate all this code? Is > it possible to use either regular open or handle-based open from a > single local fs codebase? The only details common between handle based and local based getversion callback is the ioctl. Moving that into a helper may not really help in this case ?. >=20 > > diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c > > index 548a841..8dff662 100644 > > --- a/hw/9pfs/virtio-9p-handle.c > > +++ b/hw/9pfs/virtio-9p-handle.c > > @@ -20,6 +20,9 @@ > > =C2=A0#include > > =C2=A0#include > > =C2=A0#include > > +#include > > +#include > > +#include > > > > =C2=A0struct handle_data { > > =C2=A0 =C2=A0 int mountfd; > > @@ -543,9 +546,25 @@ static int handle_unlinkat(FsContext *ctx, V9fsPat= h *dir, > > =C2=A0 =C2=A0 return ret; > > =C2=A0} > > > > +static int handle_ioc_getversion(FsContext *ctx, V9fsPath *path, uint6= 4_t *st_gen) > > +{ > > + =C2=A0 =C2=A0int mode =3D 0600; > > + =C2=A0 =C2=A0int fd; > > + > > + =C2=A0 =C2=A0fd =3D handle_open(ctx, path, mode); > > + =C2=A0 =C2=A0if(fd < 0) { > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return fd; > > + =C2=A0 =C2=A0} > > + =C2=A0 =C2=A0return ioctl(fd, FS_IOC_GETVERSION, st_gen); >=20 > fd is leaked here. >=20 > Stefan Both handle and local use V9fsPath to encode file details, the former use the file handle returned by open-by-handle and the later file names. It is difficult to find out which callback to use to open the file unless we look at the fs driver used(local/handle argument passed to -fsdev command line option), hence the idea of splitting these into two different callbacks. -aneesh