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 2/7] 9p: store req details and workqueue in struct p9_req_t
Date: Thu, 15 Dec 2016 14:13:49 -0800 [thread overview]
Message-ID: <1481840034-2113-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1481840034-2113-1-git-send-email-sstabellini@kernel.org>
Add a few fields to struct p9_req_t: page offset, file offset, total
request size, completed, rsize pagevec and kiocb store important
information regarding the read or write request, essential to complete
the request. work is used to schedule a callback function, called upon
request completion.
Currently not utilized, but they will be used in a later patch.
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changes in v2:
- clear pagevec
- replace callback with work_struct
- rename offset to page_offset
- add file_offset
- add fid
- add completed and tot_size
---
include/net/9p/client.h | 12 ++++++++++++
net/9p/client.c | 13 ++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index aef19c6..0e53b7f 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -110,7 +110,9 @@ enum p9_req_status_t {
*
*/
+struct p9_fid;
struct p9_req_t {
+ struct p9_fid *fid;
int status;
int t_err;
wait_queue_head_t *wq;
@@ -118,6 +120,16 @@ struct p9_req_t {
struct p9_fcall *rc;
void *aux;
+ /* Used for async requests */
+ struct work_struct work;
+ size_t file_offset;
+ size_t page_offset;
+ size_t tot_size;
+ size_t completed;
+ unsigned int rsize;
+ struct page **pagevec;
+ struct kiocb *kiocb;
+
struct list_head req_list;
};
diff --git a/net/9p/client.c b/net/9p/client.c
index b5ea9a3..517bc20 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -405,6 +405,14 @@ static void p9_free_req(struct p9_client *c, struct p9_req_t *r)
int tag = r->tc->tag;
p9_debug(P9_DEBUG_MUX, "clnt %p req %p tag: %d\n", c, r, tag);
+ r->fid = NULL;
+ r->file_offset = 0;
+ r->page_offset = 0;
+ r->tot_size = 0;
+ r->completed = 0;
+ r->rsize = 0;
+ r->kiocb = NULL;
+ r->pagevec = NULL;
r->status = REQ_STATUS_IDLE;
if (tag != P9_NOTAG && p9_idpool_check(tag, c->tagpool))
p9_idpool_put(tag, c->tagpool);
@@ -427,7 +435,10 @@ void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status)
smp_wmb();
req->status = status;
- wake_up(req->wq);
+ if (req->kiocb != NULL)
+ schedule_work(&req->work);
+ else
+ wake_up(req->wq);
p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc->tag);
}
EXPORT_SYMBOL(p9_client_cb);
--
1.9.1
next prev parent reply other threads:[~2016-12-15 22:14 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 ` Stefano Stabellini [this message]
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 ` [PATCH v2 6/7] 9p: handle large aio read requests Stefano Stabellini
2016-12-15 22:13 ` [PATCH v2 7/7] 9p: handle large aio write requests 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-2-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
Powered by JetHome