@@ -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;
};
@@ -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);
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(-)