linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: v9fs-developer@lists.sourceforge.net
Cc: sstabellini@kernel.org, ericvh@gmail.com, rminnich@sandia.gov,
	lucho@ionkov.net, linux-kernel@vger.kernel.org
Subject: [PATCH v2 6/7] 9p: handle large aio read requests
Date: Thu, 15 Dec 2016 14:13:53 -0800	[thread overview]
Message-ID: <1481840034-2113-6-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1481840034-2113-1-git-send-email-sstabellini@kernel.org>

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 <sstabellini@kernel.org>
---
 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);
 }
 
-- 
1.9.1

  parent reply	other threads:[~2016-12-15 22:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-15 22:12 [PATCH v2 0/7] async requests support for 9pfs Stefano Stabellini
2016-12-15 22:13 ` [PATCH v2 1/7] 9p: add iocb parameter to p9_client_read and p9_client_write Stefano Stabellini
2016-12-15 22:13   ` [PATCH v2 2/7] 9p: store req details and workqueue in struct p9_req_t Stefano Stabellini
2016-12-15 22:13   ` [PATCH v2 3/7] 9p: introduce p9_client_get_req Stefano Stabellini
2016-12-15 22:13   ` [PATCH v2 4/7] 9p: introduce async read requests Stefano Stabellini
2016-12-15 22:13   ` [PATCH v2 5/7] 9p: introduce async write requests Stefano Stabellini
2016-12-15 22:13   ` Stefano Stabellini [this message]
2016-12-15 22:13   ` [PATCH v2 7/7] 9p: handle large aio " Stefano Stabellini
2017-01-03 23:37 ` [PATCH v2 0/7] async requests support for 9pfs Stefano Stabellini
2017-02-17  1:00   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481840034-2113-6-git-send-email-sstabellini@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=ericvh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=rminnich@sandia.gov \
    --cc=v9fs-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).