From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 05/15] NFSv4.1: Merge the nfs41_proc_async_sequence() and nfs4_proc_sequence()
Date: Mon, 14 Jun 2010 17:51:29 -0400 [thread overview]
Message-ID: <1276552299-6625-5-git-send-email-Trond.Myklebust@netapp.com> (raw)
In-Reply-To: <1276552299-6625-4-git-send-email-Trond.Myklebust@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/nfs4proc.c | 68 ++++++++++++++++++++++++++++++++++------------------
1 files changed, 44 insertions(+), 24 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 7034188..ae2651e 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5048,24 +5048,6 @@ int nfs4_init_session(struct nfs_server *server)
/*
* Renew the cl_session lease.
*/
-static int nfs4_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred)
-{
- struct nfs4_sequence_args args;
- struct nfs4_sequence_res res;
-
- struct rpc_message msg = {
- .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SEQUENCE],
- .rpc_argp = &args,
- .rpc_resp = &res,
- .rpc_cred = cred,
- };
-
- args.sa_cache_this = 0;
-
- return nfs4_call_sync_sequence(clp, clp->cl_rpcclient, &msg, &args,
- &res, args.sa_cache_this, 1);
-}
-
struct nfs4_sequence_data {
struct nfs_client *clp;
struct nfs4_sequence_args args;
@@ -5139,28 +5121,66 @@ static const struct rpc_call_ops nfs41_sequence_ops = {
.rpc_release = nfs41_sequence_release,
};
-static int nfs41_proc_async_sequence(struct nfs_client *clp,
- struct rpc_cred *cred)
+static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred)
{
struct nfs4_sequence_data *calldata;
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SEQUENCE],
.rpc_cred = cred,
};
+ struct rpc_task_setup task_setup_data = {
+ .rpc_client = clp->cl_rpcclient,
+ .rpc_message = &msg,
+ .callback_ops = &nfs41_sequence_ops,
+ .flags = RPC_TASK_ASYNC | RPC_TASK_SOFT,
+ };
if (!atomic_inc_not_zero(&clp->cl_count))
- return -EIO;
+ return ERR_PTR(-EIO);
calldata = kmalloc(sizeof(*calldata), GFP_NOFS);
if (calldata == NULL) {
nfs_put_client(clp);
- return -ENOMEM;
+ return ERR_PTR(-ENOMEM);
}
msg.rpc_argp = &calldata->args;
msg.rpc_resp = &calldata->res;
calldata->clp = clp;
+ task_setup_data.callback_data = calldata;
- return rpc_call_async(clp->cl_rpcclient, &msg, RPC_TASK_SOFT,
- &nfs41_sequence_ops, calldata);
+ return rpc_run_task(&task_setup_data);
+}
+
+static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cred)
+{
+ struct rpc_task *task;
+ int ret = 0;
+
+ task = _nfs41_proc_sequence(clp, cred);
+ if (IS_ERR(task))
+ ret = PTR_ERR(task);
+ else
+ rpc_put_task(task);
+ dprintk("<-- %s status=%d\n", __func__, ret);
+ return ret;
+}
+
+static int nfs4_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred)
+{
+ struct rpc_task *task;
+ int ret;
+
+ task = _nfs41_proc_sequence(clp, cred);
+ if (IS_ERR(task)) {
+ ret = PTR_ERR(task);
+ goto out;
+ }
+ ret = rpc_wait_for_completion_task(task);
+ if (!ret)
+ ret = task->tk_status;
+ rpc_put_task(task);
+out:
+ dprintk("<-- %s status=%d\n", __func__, ret);
+ return ret;
}
struct nfs4_reclaim_complete_data {
--
1.7.0.1
next prev parent reply other threads:[~2010-06-14 21:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-14 21:51 [PATCH 01/15] NFSv41: Fix a memory leak in nfs41_proc_async_sequence() Trond Myklebust
2010-06-14 21:51 ` [PATCH 02/15] NFSv4.1: Clean up nfs4_setup_sequence Trond Myklebust
2010-06-14 21:51 ` [PATCH 03/15] NFSv4.1: Simplify nfs41_sequence_done() Trond Myklebust
2010-06-14 21:51 ` [PATCH 04/15] NFSv4: Kill nfs4_async_handle_error() abuses by NFSv4.1 Trond Myklebust
2010-06-14 21:51 ` Trond Myklebust [this message]
2010-06-14 21:51 ` [PATCH 06/15] NFSv4.1: Make nfs4_setup_sequence take a nfs_server argument Trond Myklebust
2010-06-14 21:51 ` [PATCH 07/15] NFSv41: Further cleanup for nfs4_sequence_done Trond Myklebust
2010-06-14 21:51 ` [PATCH 08/15] NFSv41: Don't store session state in the nfs_client->cl_state Trond Myklebust
2010-06-14 21:51 ` [PATCH 09/15] NFSv41: Clean up the NFSv4.1 minor version specific operations Trond Myklebust
2010-06-14 21:51 ` [PATCH 10/15] NFSv41: Convert the various reboot recovery ops etc to minor version ops Trond Myklebust
2010-06-14 21:51 ` [PATCH 11/15] NFSv41: Fix nfs_async_inode_return_delegation() ugliness Trond Myklebust
2010-06-14 21:51 ` [PATCH 12/15] NFSv41: Deprecate nfs_client->cl_minorversion Trond Myklebust
2010-06-14 21:51 ` [PATCH 13/15] NFSv41: Clean up exclusive create Trond Myklebust
2010-06-14 21:51 ` [PATCH 14/15] NFSv41: Cleanup for nfs4_alloc_session Trond Myklebust
2010-06-14 21:51 ` [PATCH 15/15] NFSv4.1: There is no need to init the session more than once Trond Myklebust
2010-06-14 23:13 ` [PATCH 13/15] NFSv41: Clean up exclusive create Benny Halevy
2010-06-15 15:50 ` Trond Myklebust
[not found] ` <1276617009.8767.6.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-06-15 16:08 ` Benny Halevy
2010-06-15 16:19 ` Trond Myklebust
[not found] ` <1276618750.8767.7.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-06-15 16:30 ` Benny Halevy
2010-06-15 16:50 ` [PATCH 02/15] NFSv4.1: Clean up nfs4_setup_sequence Gilliam, PaulX J
[not found] ` <0A97A441BFADC74EA1E299A79C69DF9213D49EB687-osO9UTpF0UQ64kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-06-15 17:32 ` Trond Myklebust
2010-06-15 17:53 ` J. Bruce Fields
[not found] ` <1276623141.8767.47.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-06-15 18:01 ` Gilliam, PaulX J
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=1276552299-6625-5-git-send-email-Trond.Myklebust@netapp.com \
--to=trond.myklebust@netapp.com \
--cc=linux-nfs@vger.kernel.org \
/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