From patchwork Mon Feb 2 22:38:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5765141 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4D4AF9F380 for ; Mon, 2 Feb 2015 22:41:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A792209EB for ; Mon, 2 Feb 2015 22:41:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69F48209EA for ; Mon, 2 Feb 2015 22:41:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965371AbbBBWlP (ORCPT ); Mon, 2 Feb 2015 17:41:15 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:43224 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965368AbbBBWlO (ORCPT ); Mon, 2 Feb 2015 17:41:14 -0500 Received: by mail-pa0-f45.google.com with SMTP id et14so87962771pad.4 for ; Mon, 02 Feb 2015 14:41:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3SherojytyInSY5JKUAcHf3JQgK5fKt+9X3A/gye09g=; b=UEbwaGGWJv5AM1Wzd7XqkHz/zZiB8bf2mxsLzxYTuWmJwiwJrC/uon3ZSCKBQc2z3r bL4Zg/Kw8fZycxvLEmIBcJ6eiUHlQGPgC2Hjgx8wV5NmUyY0cJC8wJpUL6oOaP6nbIMG A5xST84/YvXysu32mkQ4v+Lq0IuhN9R+aspNqXIhgi1MgQE0vL4HuQSzIdYFuRkoZ7Ct J8hy1Ieyt1Y/3uBWRuK3d9B/ufzyZ/b+FC6Yk6JGA1Wxf8aODlLI+pHNZ9jOTqATBFCN A0W5ufKewuxh/rjhxmisUCLfRTe+Xk2khh0xOehJiQz5PhapHVisHr6/jwCPGdZW59JK 5TBQ== X-Gm-Message-State: ALoCoQmYxgGc6Xo0/eqEoKf9IBktVi1TxWu2GGMgm/+uxwX5t+6FgFiazQ+XqH14Dzfok0q+EhDL X-Received: by 10.68.129.67 with SMTP id nu3mr32646376pbb.152.1422916874035; Mon, 02 Feb 2015 14:41:14 -0800 (PST) Received: from localhost.localdomain ([50.242.95.105]) by mx.google.com with ESMTPSA id bx13sm94656pdb.19.2015.02.02.14.41.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Feb 2015 14:41:13 -0800 (PST) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing list Subject: [PATCH v6 43/53] nfs41: allow async version layoutreturn Date: Mon, 2 Feb 2015 14:38:57 -0800 Message-Id: <1422916747-86649-44-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1422916747-86649-1-git-send-email-loghyr@primarydata.com> References: <1422916747-86649-1-git-send-email-loghyr@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peng Tao Signed-off-by: Peng Tao Signed-off-by: Tom Haynes --- fs/nfs/nfs4proc.c | 11 +++++++++-- fs/nfs/pnfs.c | 11 ++++++----- fs/nfs/pnfs.h | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e19b5db..2397c0f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -7810,7 +7810,7 @@ static const struct rpc_call_ops nfs4_layoutreturn_call_ops = { .rpc_release = nfs4_layoutreturn_release, }; -int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp) +int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync) { struct rpc_task *task; struct rpc_message msg = { @@ -7824,16 +7824,23 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp) .rpc_message = &msg, .callback_ops = &nfs4_layoutreturn_call_ops, .callback_data = lrp, + .flags = RPC_TASK_ASYNC, }; - int status; + int status = 0; dprintk("--> %s\n", __func__); nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1); task = rpc_run_task(&task_setup_data); if (IS_ERR(task)) return PTR_ERR(task); + if (sync == false) + goto out; + status = nfs4_wait_for_completion_rpc_task(task); + if (status != 0) + goto out; status = task->tk_status; trace_nfs4_layoutreturn(lrp->args.inode, status); +out: dprintk("<-- %s status=%d\n", __func__, status); rpc_put_task(task); return status; diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 9549b89..0a0e209 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -52,7 +52,7 @@ static LIST_HEAD(pnfs_modules_tbl); static int pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, - enum pnfs_iomode iomode); + enum pnfs_iomode iomode, bool sync); /* Return the registered pnfs layout driver module matching given id */ static struct pnfs_layoutdriver_type * @@ -392,7 +392,8 @@ pnfs_put_lseg(struct pnfs_layout_segment *lseg) spin_unlock(&inode->i_lock); pnfs_free_lseg(lseg); if (need_return) - pnfs_send_layoutreturn(lo, stateid, iomode); + pnfs_send_layoutreturn(lo, stateid, iomode, + true); else pnfs_put_layout_hdr(lo); } @@ -897,7 +898,7 @@ static void pnfs_clear_layoutcommit(struct inode *inode, static int pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, - enum pnfs_iomode iomode) + enum pnfs_iomode iomode, bool sync) { struct inode *ino = lo->plh_inode; struct nfs4_layoutreturn *lrp; @@ -923,7 +924,7 @@ pnfs_send_layoutreturn(struct pnfs_layout_hdr *lo, nfs4_stateid stateid, lrp->clp = NFS_SERVER(ino)->nfs_client; lrp->cred = lo->plh_lc_cred; - status = nfs4_proc_layoutreturn(lrp); + status = nfs4_proc_layoutreturn(lrp, sync); out: if (status) { spin_lock(&ino->i_lock); @@ -989,7 +990,7 @@ _pnfs_return_layout(struct inode *ino) spin_unlock(&ino->i_lock); pnfs_free_lseg_list(&tmp_list); - status = pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY); + status = pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY, true); out: dprintk("<-- %s status: %d\n", __func__, status); return status; diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 9d176e1..443d199 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -219,7 +219,7 @@ extern int nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *dev, struct rpc_cred *cred); extern struct pnfs_layout_segment* nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags); -extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp); +extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync); /* pnfs.c */ void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo);