From patchwork Thu Dec 15 22:13:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9476993 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 01D7D607EE for ; Thu, 15 Dec 2016 22:14:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E66F428864 for ; Thu, 15 Dec 2016 22:14:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA43B28865; Thu, 15 Dec 2016 22:14:15 +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 72F2528861 for ; Thu, 15 Dec 2016 22:14:15 +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 1cHeHy-0000jd-7r; Thu, 15 Dec 2016 22:14:10 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cHeHx-0000jY-B2 for v9fs-developer@lists.sourceforge.net; Thu, 15 Dec 2016 22:14:09 +0000 X-ACL-Warn: Received: from mail.kernel.org ([198.145.29.136]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1cHeHw-0003pW-FA for v9fs-developer@lists.sourceforge.net; Thu, 15 Dec 2016 22:14:09 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE86420520; Thu, 15 Dec 2016 22:14:01 +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 DC51F20528; Thu, 15 Dec 2016 22:13:59 +0000 (UTC) From: Stefano Stabellini To: v9fs-developer@lists.sourceforge.net Date: Thu, 15 Dec 2016 14:13:49 -0800 Message-Id: <1481840034-2113-2-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: 1cHeHw-0003pW-FA Cc: ericvh@gmail.com, rminnich@sandia.gov, sstabellini@kernel.org, linux-kernel@vger.kernel.org, lucho@ionkov.net Subject: [V9fs-developer] [PATCH v2 2/7] 9p: store req details and workqueue 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: 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 --- 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);