From patchwork Thu Dec 8 20:59:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9467131 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 EF99E6071E for ; Thu, 8 Dec 2016 20:59:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC065283E2 for ; Thu, 8 Dec 2016 20:59:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0E6A285F4; Thu, 8 Dec 2016 20:59:19 +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 254D3283E2 for ; Thu, 8 Dec 2016 20:59:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cF5mg-0003ah-52; Thu, 08 Dec 2016 20:59:18 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cF5mf-0003ab-Fl for v9fs-developer@lists.sourceforge.net; Thu, 08 Dec 2016 20:59:17 +0000 X-ACL-Warn: Received: from mail.kernel.org ([198.145.29.136]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1cF5me-0002kJ-Ot for v9fs-developer@lists.sourceforge.net; Thu, 08 Dec 2016 20:59:17 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EADD2035B; Thu, 8 Dec 2016 20:59:10 +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 0CC30203A5; Thu, 8 Dec 2016 20:59:09 +0000 (UTC) From: Stefano Stabellini To: v9fs-developer@lists.sourceforge.net Date: Thu, 8 Dec 2016 12:59:03 -0800 Message-Id: <1481230746-16741-2-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1481230746-16741-1-git-send-email-sstabellini@kernel.org> References: <1481230746-16741-1-git-send-email-sstabellini@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP X-Headers-End: 1cF5me-0002kJ-Ot Cc: ericvh@gmail.com, rminnich@sandia.gov, sstabellini@kernel.org, linux-kernel@vger.kernel.org, lucho@ionkov.net Subject: [V9fs-developer] [PATCH 2/5] 9p: store req details and callback in struct p9_req_t 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 Add a few fields to struct p9_req_t. Callback is the function which will be called upon requestion completion. offset, rsize, pagevec and kiocb store important information regarding the read or write request, essential to complete the request. Currently not utilized, but they will be used in a later patch. Signed-off-by: Stefano Stabellini --- include/net/9p/client.h | 8 ++++++++ net/9p/client.c | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/net/9p/client.h b/include/net/9p/client.h index aef19c6..69fc2f0 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -110,6 +110,7 @@ enum p9_req_status_t { * */ +struct p9_client; struct p9_req_t { int status; int t_err; @@ -118,6 +119,13 @@ struct p9_req_t { struct p9_fcall *rc; void *aux; + /* Used for async requests */ + void (*callback)(struct p9_client *c, struct p9_req_t *req, int status); + size_t offset; + u64 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..bfe1715 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -405,6 +405,10 @@ 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->offset = 0; + r->rsize = 0; + r->kiocb = NULL; + r->callback = NULL; r->status = REQ_STATUS_IDLE; if (tag != P9_NOTAG && p9_idpool_check(tag, c->tagpool)) p9_idpool_put(tag, c->tagpool); @@ -427,7 +431,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->callback != NULL) + req->callback(c, req, status); + else + wake_up(req->wq); p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc->tag); } EXPORT_SYMBOL(p9_client_cb);