diff mbox

[v1,04/19] NFS: Refactor nfs4_call_data_sequence()

Message ID 20130712163202.1444.45080.stgit@seurat.1015granger.net (mailing list archive)
State New, archived
Headers show

Commit Message

Chuck Lever III July 12, 2013, 4:32 p.m. UTC
Pull main logic out of nfs4_call_data_sequence() so it can
eventually be shared with the NFSv4.0 call_sync path.  The new
helper function is left behind the NFSv4.1 CONFIG switch for now to
keep compiler warning noise at a minimum.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfs/nfs4proc.c |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Trond Myklebust July 22, 2013, 7:08 p.m. UTC | #1
On Fri, 2013-07-12 at 12:32 -0400, Chuck Lever wrote:
> Pull main logic out of nfs4_call_data_sequence() so it can

> eventually be shared with the NFSv4.0 call_sync path.  The new

> helper function is left behind the NFSv4.1 CONFIG switch for now to

> keep compiler warning noise at a minimum.

> 

> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

> ---

>  fs/nfs/nfs4proc.c |   28 ++++++++++++++++++----------

>  1 file changed, 18 insertions(+), 10 deletions(-)

> 

> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c

> index 2f6f3b9..e52d2b3 100644

> --- a/fs/nfs/nfs4proc.c

> +++ b/fs/nfs/nfs4proc.c

> @@ -393,6 +393,23 @@ static void renew_lease(const struct nfs_server *server, unsigned long timestamp

>  

>  #if defined(CONFIG_NFS_V4_1)

>  

> +static int nfs4_run_rpc_task(struct rpc_clnt *clnt,

> +			     struct rpc_message *msg,

> +			     struct rpc_task_setup *task_setup)

> +{

> +	struct rpc_task *task;

> +	int ret;

> +

> +	task = rpc_run_task(task_setup);

> +	if (IS_ERR(task))

> +		ret = PTR_ERR(task);

> +	else {

> +		ret = task->tk_status;

> +		rpc_put_task(task);

> +	}

> +	return ret;

> +}


Please don't split this out. Eventually, someone is going to call this
with the RPC_TASK_ASYNC flag set, and all hell will break loose.

> +

>  static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)

>  {

>  	struct nfs4_session *session;

> @@ -674,8 +691,6 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,

>  				   struct nfs4_sequence_args *args,

>  				   struct nfs4_sequence_res *res)

>  {

> -	int ret;

> -	struct rpc_task *task;

>  	struct nfs41_call_sync_data data = {

>  		.seq_server = server,

>  		.seq_args = args,

> @@ -688,14 +703,7 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,

>  		.callback_data = &data

>  	};

>  

> -	task = rpc_run_task(&task_setup);

> -	if (IS_ERR(task))

> -		ret = PTR_ERR(task);

> -	else {

> -		ret = task->tk_status;

> -		rpc_put_task(task);

> -	}

> -	return ret;

> +	return nfs4_run_rpc_task(clnt, msg, &task_setup);

>  }

>  

>  #else

> 

> --

> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in

> the body of a message to majordomo@vger.kernel.org

> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com
diff mbox

Patch

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 2f6f3b9..e52d2b3 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -393,6 +393,23 @@  static void renew_lease(const struct nfs_server *server, unsigned long timestamp
 
 #if defined(CONFIG_NFS_V4_1)
 
+static int nfs4_run_rpc_task(struct rpc_clnt *clnt,
+			     struct rpc_message *msg,
+			     struct rpc_task_setup *task_setup)
+{
+	struct rpc_task *task;
+	int ret;
+
+	task = rpc_run_task(task_setup);
+	if (IS_ERR(task))
+		ret = PTR_ERR(task);
+	else {
+		ret = task->tk_status;
+		rpc_put_task(task);
+	}
+	return ret;
+}
+
 static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
 {
 	struct nfs4_session *session;
@@ -674,8 +691,6 @@  static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
 				   struct nfs4_sequence_args *args,
 				   struct nfs4_sequence_res *res)
 {
-	int ret;
-	struct rpc_task *task;
 	struct nfs41_call_sync_data data = {
 		.seq_server = server,
 		.seq_args = args,
@@ -688,14 +703,7 @@  static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
 		.callback_data = &data
 	};
 
-	task = rpc_run_task(&task_setup);
-	if (IS_ERR(task))
-		ret = PTR_ERR(task);
-	else {
-		ret = task->tk_status;
-		rpc_put_task(task);
-	}
-	return ret;
+	return nfs4_run_rpc_task(clnt, msg, &task_setup);
 }
 
 #else