From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QV3eN-0005Iu-06 for qemu-devel@nongnu.org; Fri, 10 Jun 2011 11:29:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QV3eL-0003KV-TW for qemu-devel@nongnu.org; Fri, 10 Jun 2011 11:29:30 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:53707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QV3eL-0003KG-N1 for qemu-devel@nongnu.org; Fri, 10 Jun 2011 11:29:29 -0400 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e34.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p5AFGgUp010216 for ; Fri, 10 Jun 2011 09:16:42 -0600 Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p5AFTGpe097562 for ; Fri, 10 Jun 2011 09:29:17 -0600 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p5AFTFuO030480 for ; Fri, 10 Jun 2011 09:29:15 -0600 Received: from oc6675851006.ibm.com (sig-9-49-142-12.mts.ibm.com [9.49.142.12]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p5AFTF5G030436 for ; Fri, 10 Jun 2011 09:29:15 -0600 Message-ID: <4DF2384A.8020105@linux.vnet.ibm.com> Date: Fri, 10 Jun 2011 08:29:14 -0700 From: Venkateswararao Jujjuri MIME-Version: 1.0 References: <20110610103305.GD18497@redhat.com> <87y619evre.fsf@linux.vnet.ibm.com> <20110610122025.GE18497@redhat.com> In-Reply-To: <20110610122025.GE18497@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] QEMU 9pfs intentionally returning short reads ? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 06/10/2011 05:20 AM, Daniel P. Berrange wrote: > On Fri, Jun 10, 2011 at 05:36:13PM +0530, Aneesh Kumar K.V wrote: >> On Fri, 10 Jun 2011 11:33:05 +0100, "Daniel P. Berrange" wrote: >>> I've been doing some work trying to run QEMU guests with a root filesystem >>> exported from the host using virtio 9pfs. One of the issues that I have >>> discovered is that the 9p FS running on QEMU appears to cap all reads at >>> 4096 bytes[1]. Any larger read will return only partial data for plain >>> files. >>> >> But we should loop in kernel, requesting for multiple 9p request. >> >> kernel does >> >> size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ; >> if (count> size) >> ret = v9fs_file_readn(filp, NULL, udata, count, *offset); >> else >> ret = p9_client_read(fid, NULL, udata, *offset, count); >> >> and v9fs_file_readn() does.. >> >> do { >> n = p9_client_read(fid, data, udata, offset, count); >> if (n<= 0) >> break; >> >> if (data) >> data += n; >> if (udata) >> udata += n; >> >> offset += n; >> count -= n; >> total += n; >> } while (count> 0&& n == size); >> >> >> I also did an strace of simple test and i see >> >> open("test", O_RDONLY) = 3 >> read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 8192) = 8192 > In my test I did > > # strace -e trace=read,open perl -e 'open FOO, "/usr/share/X11/XKeysymDB"; sysread FOO, $foo, 8192' > open("/usr/share/X11/XKeysymDB", O_RDONLY) = 3 > read(3, "! Copyright 1993 Massachusetts I"..., 8192) = 4096 > > Perhaps there is a guest kernel driver difference ? I'm using > > 2.6.35.13-91.fc14.x86_64 The default msize is 8k; Because of iounit the net layer need to send the IO in the chunks of 4k 8k - header size faults into 4k; But never the less the fs layer should loop. There was an issue with read; and that bug is fixed by commit 97e8442b0971ea6be9a495b3d03402985cfe5d6a Author: M. Mohan Kumar Date: Fri Jun 4 11:59:07 2010 +0000 9p: Make use of iounit for read/write Change the v9fs_file_readn function to limit the maximum transfer size based on the iounit or 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 Signed-off-by: Eric Van Hensbergen Thanks, JV > Regards, > Daniel