All of lore.kernel.org
 help / color / mirror / Atom feed
From: <Anna.Schumaker@Netapp.com>
To: <Trond.Myklebust@primarydata.com>, <linux-nfs@vger.kernel.org>
Subject: [PATCH 06/34] NFS: Clean up decode_layoutrecall_args()
Date: Fri, 7 Apr 2017 14:15:00 -0400	[thread overview]
Message-ID: <20170407181528.2832-7-Anna.Schumaker@Netapp.com> (raw)
In-Reply-To: <20170407181528.2832-1-Anna.Schumaker@Netapp.com>

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

Additionally, this change lets us cut out the goto by returning errors
immediately.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/callback_xdr.c | 38 +++++++++++---------------------------
 1 file changed, 11 insertions(+), 27 deletions(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 0319230fe1a8..d5ddceb91a9a 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -227,10 +227,8 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
 	uint32_t iomode;
 
 	p = read_buf(xdr, 4 * sizeof(uint32_t));
-	if (unlikely(p == NULL)) {
-		status = htonl(NFS4ERR_BADXDR);
-		goto out;
-	}
+	if (unlikely(p == NULL))
+		return htonl(NFS4ERR_BADXDR);
 
 	args->cbl_layout_type = ntohl(*p++);
 	/* Depite the spec's xdr, iomode really belongs in the FILE switch,
@@ -244,37 +242,23 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
 		args->cbl_range.iomode = iomode;
 		status = decode_fh(xdr, &args->cbl_fh);
 		if (unlikely(status != 0))
-			goto out;
+			return status;
 
 		p = read_buf(xdr, 2 * sizeof(uint64_t));
-		if (unlikely(p == NULL)) {
-			status = htonl(NFS4ERR_BADXDR);
-			goto out;
-		}
+		if (unlikely(p == NULL))
+			return htonl(NFS4ERR_BADXDR);
 		p = xdr_decode_hyper(p, &args->cbl_range.offset);
 		p = xdr_decode_hyper(p, &args->cbl_range.length);
-		status = decode_layout_stateid(xdr, &args->cbl_stateid);
-		if (unlikely(status != 0))
-			goto out;
+		return decode_layout_stateid(xdr, &args->cbl_stateid);
 	} else if (args->cbl_recall_type == RETURN_FSID) {
 		p = read_buf(xdr, 2 * sizeof(uint64_t));
-		if (unlikely(p == NULL)) {
-			status = htonl(NFS4ERR_BADXDR);
-			goto out;
-		}
+		if (unlikely(p == NULL))
+			return htonl(NFS4ERR_BADXDR);
 		p = xdr_decode_hyper(p, &args->cbl_fsid.major);
 		p = xdr_decode_hyper(p, &args->cbl_fsid.minor);
-	} else if (args->cbl_recall_type != RETURN_ALL) {
-		status = htonl(NFS4ERR_BADXDR);
-		goto out;
-	}
-	dprintk("%s: ltype 0x%x iomode %d changed %d recall_type %d\n",
-		__func__,
-		args->cbl_layout_type, iomode,
-		args->cbl_layoutchanged, args->cbl_recall_type);
-out:
-	dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
-	return status;
+	} else if (args->cbl_recall_type != RETURN_ALL)
+		return htonl(NFS4ERR_BADXDR);
+	return 0;
 }
 
 static
-- 
2.12.2


  parent reply	other threads:[~2017-04-07 18:15 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 18:14 [PATCH 00/34] dprintk() cleanup (part 1) Anna.Schumaker
2017-04-07 18:14 ` [PATCH 01/34] NFS: Clean up do_callback_layoutrecall() Anna.Schumaker
2017-04-07 18:14 ` [PATCH 02/34] NFS: Clean up nfs4_callback_layoutrecall() Anna.Schumaker
2017-04-07 18:14 ` [PATCH 03/34] NFS: Remove extra dprintk()s from callback_proc.c Anna.Schumaker
2017-04-07 18:14 ` [PATCH 04/34] NFS: Clean up decode_getattr_args() Anna.Schumaker
2017-04-07 18:14 ` [PATCH 05/34] NFS: Clean up decode_recall_args() Anna.Schumaker
2017-04-07 18:15 ` Anna.Schumaker [this message]
2017-04-07 18:15 ` [PATCH 07/34] NFS: Clean up decode_cb_sequence_args() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 08/34] NFS: Clean up decode_notify_lock_args() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 09/34] NFS: Clean up encode_cb_sequence_res() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 10/34] NFS: Remove extra dprintk()s from callback_xdr.c Anna.Schumaker
2017-04-07 18:15 ` [PATCH 11/34] NFS: Clean up nfs_init_client() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 12/34] NFS: Clean up extra dprintk()s in client.c Anna.Schumaker
2017-04-07 18:15 ` [PATCH 13/34] NFS: Remove nfs_direct_readpage_release() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 14/34] NFS: Clean up nfs_direct_commit_complete() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 15/34] NFS: Remove extra dprintk()s from namespace.c Anna.Schumaker
2017-04-07 18:15 ` [PATCH 16/34] NFS: Clean up nfs42_layoutstat_done() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 17/34] NFS: Clean up nfs4_match_clientids() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 18/34] NFS: Clean up nfs4_check_serverowner_minor_id() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 19/34] NFS: Create a common nfs4_match_client() function Anna.Schumaker
2017-04-07 18:15 ` [PATCH 20/34] NFS: Clean up nfs4_check_serverowner_major_id() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 21/34] NFS: Clean up nfs4_check_server_scope() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 22/34] NFS: Clean up nfs4_set_client() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 23/34] NFS: Clean up nfs4_init_server() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 24/34] NFS: Remove extra dprintk()s from nfs4client.c Anna.Schumaker
2017-04-07 18:15 ` [PATCH 25/34] NFS: Clean up nfs4_get_rootfh() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 26/34] NFS: Remove extra dprintk()s from nfs4namespace.c Anna.Schumaker
2017-04-07 18:15 ` [PATCH 27/34] NFS: Clean up nfs4_proc_bind_one_conn_to_session() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 28/34] NFS: Clean up _nfs4_proc_exchange_id() Anna.Schumaker
2017-04-07 18:15 ` [PATCH 29/34] NFS: Clean up nfs4_proc_get_lease_time() Anna.Schumaker
2017-04-08 14:24 ` [PATCH 00/34] dprintk() cleanup (part 1) Chuck Lever

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=20170407181528.2832-7-Anna.Schumaker@Netapp.com \
    --to=anna.schumaker@netapp.com \
    --cc=Trond.Myklebust@primarydata.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.