From patchwork Thu Dec 15 22:13:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9477007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 17EFC60825 for ; Thu, 15 Dec 2016 22:15:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 089C12885C for ; Thu, 15 Dec 2016 22:15:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F134128862; Thu, 15 Dec 2016 22:15:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 659B32885C for ; Thu, 15 Dec 2016 22:15:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cHeI5-00087P-Gj; Thu, 15 Dec 2016 22:14:17 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cHeI3-00086z-3u for v9fs-developer@lists.sourceforge.net; Thu, 15 Dec 2016 22:14:15 +0000 X-ACL-Warn: Received: from mail.kernel.org ([198.145.29.136]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1cHeI2-00060B-DW for v9fs-developer@lists.sourceforge.net; Thu, 15 Dec 2016 22:14:15 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1567520513; Thu, 15 Dec 2016 22:14:08 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.hsd1.ca.comcast.net (96-82-76-110-static.hfc.comcastbusiness.net [96.82.76.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDD8F20523; Thu, 15 Dec 2016 22:14:06 +0000 (UTC) From: Stefano Stabellini To: v9fs-developer@lists.sourceforge.net Date: Thu, 15 Dec 2016 14:13:53 -0800 Message-Id: <1481840034-2113-6-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1481840034-2113-1-git-send-email-sstabellini@kernel.org> References: <1481840034-2113-1-git-send-email-sstabellini@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP X-Headers-End: 1cHeI2-00060B-DW Cc: ericvh@gmail.com, rminnich@sandia.gov, sstabellini@kernel.org, linux-kernel@vger.kernel.org, lucho@ionkov.net Subject: [V9fs-developer] [PATCH v2 6/7] 9p: handle large aio read requests X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Virus-Scanned: ClamAV using ClamSMTP When an async read larger then msize-P9_IOHDRSZ is issued, do not limit the read size to msize-P9_IOHDRSZ. Instead, keep sending read requests from the completion function, until the original read is completed. Signed-off-by: Stefano Stabellini --- net/9p/client.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/net/9p/client.c b/net/9p/client.c index e69955d..8d2f8f7 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -1609,14 +1609,52 @@ int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags) count -= n; } - err = total; req->kiocb->ki_pos += total; + req->completed += total; + req->file_offset += total; + req->page_offset += total; + err = req->completed; + + if (req->tot_size - req->completed > 0 && total == req->rsize) { + struct p9_req_t *req2; + u64 rsize = req->tot_size - req->completed; + + if (rsize > req->fid->iounit) + rsize = req->fid->iounit; + if (rsize > clnt->msize-P9_IOHDRSZ) + rsize = clnt->msize - P9_IOHDRSZ; + + req2 = p9_client_get_req(clnt, P9_TREAD, "dqd", req->fid->fid, + req->file_offset, rsize); + if (IS_ERR(req2)) { + err = PTR_ERR(req2); + goto out; + } + req2->fid = req->fid; + req2->rsize = rsize; + req2->tot_size = req->tot_size; + req2->completed = req->completed; + req2->file_offset = req->file_offset; + req2->page_offset = req->page_offset; + req2->kiocb = req->kiocb; + req2->pagevec = req->pagevec; + INIT_WORK(&req2->work, p9_client_read_complete); + + err = clnt->trans_mod->request(clnt, req2); + if (err < 0) { + clnt->status = Disconnected; + p9_free_req(clnt, req2); + goto out; + } + goto out2; + } out: req->kiocb->ki_complete(req->kiocb, err, 0); release_pages(req->pagevec, (req->tot_size + PAGE_SIZE - 1) / PAGE_SIZE, false); kvfree(req->pagevec); +out2: p9_free_req(clnt, req); }