From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52813 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKR2l-0003B0-5j for qemu-devel@nongnu.org; Fri, 04 Jun 2010 03:10:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKR0j-0008LQ-HU for qemu-devel@nongnu.org; Fri, 04 Jun 2010 03:08:10 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:35713) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKR0i-0008Ku-L3 for qemu-devel@nongnu.org; Fri, 04 Jun 2010 03:08:09 -0400 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by e28smtp03.in.ibm.com (8.14.4/8.13.1) with ESMTP id o54783dW021413 for ; Fri, 4 Jun 2010 12:38:03 +0530 Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o54783J33592430 for ; Fri, 4 Jun 2010 12:38:03 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o54782Wu008336 for ; Fri, 4 Jun 2010 17:08:03 +1000 Date: Fri, 4 Jun 2010 12:37:59 +0530 From: Sripathi Kodi Subject: Re: [Qemu-devel] 9p: [RFC] [PATCH 02/02] Make use of iounit for read/write Message-ID: <20100604123759.7126d72a@in.ibm.com> In-Reply-To: <1275401869-27560-1-git-send-email-mohan@in.ibm.com> References: <1275401834-27520-1-git-send-email-mohan@in.ibm.com> <1275401869-27560-1-git-send-email-mohan@in.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "M. Mohan Kumar" Cc: v9fs-developer@lists.sourceforge.net, qemu-devel@nongnu.org On Tue, 1 Jun 2010 19:47:49 +0530 "M. Mohan Kumar" wrote: > Change the v9fs_file_readn function to limit the maximum transfer size > based on the iounit instead of msize. > > Also remove the redundant check for limiting the transfer size in > v9fs_file_write. This check is done by p9_client_write. > > Signed-off-by: M. Mohan Kumar > --- > fs/9p/vfs_file.c | 10 ++-------- > 1 files changed, 2 insertions(+), 8 deletions(-) > > diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c > index 25b300e..b8c0891 100644 > --- a/fs/9p/vfs_file.c > +++ b/fs/9p/vfs_file.c > @@ -160,7 +160,7 @@ v9fs_file_readn(struct file *filp, char *data, char __user *udata, u32 count, > offset += n; > count -= n; > total += n; > - } while (count > 0 && n == (fid->clnt->msize - P9_IOHDRSZ)); > + } while (count > 0 && n == fid->iounit); If fid->iounit is zero this will go wrong. With the current version of your server side patch, fid->iounit can be zero, right? > > if (n < 0) > total = n; > @@ -187,11 +187,7 @@ v9fs_file_read(struct file *filp, char __user *udata, size_t count, > P9_DPRINTK(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset); > fid = filp->private_data; > > - if (count > (fid->clnt->msize - P9_IOHDRSZ)) > - ret = v9fs_file_readn(filp, NULL, udata, count, *offset); > - else > - ret = p9_client_read(fid, NULL, udata, *offset, count); > - > + ret = v9fs_file_readn(filp, NULL, udata, count, *offset); > if (ret > 0) > *offset += ret; > > @@ -225,8 +221,6 @@ v9fs_file_write(struct file *filp, const char __user * data, > clnt = fid->clnt; > > rsize = fid->iounit; > - if (!rsize || rsize > clnt->msize-P9_IOHDRSZ) > - rsize = clnt->msize - P9_IOHDRSZ; This will be needed if fid->iounit = 0 Thanks, Sripathi. > > do { > if (count < rsize) > -- > 1.6.6.1 > >