From: Markus Elfring <Markus.Elfring@web.de>
To: linux-nfs@vger.kernel.org,
Anna Schumaker <anna.schumaker@netapp.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/3] NFS: Three function calls less
Date: Wed, 3 Jul 2019 17:11:28 +0200 [thread overview]
Message-ID: <fd43c523-ceef-ed2d-0e98-1c792350d9ed@web.de> (raw)
In-Reply-To: <cb79bcb1-0fd6-1b7f-c131-5883f09ad105@web.de>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 Jul 2019 16:45:25 +0200
Reduce function calls in two function implementations.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
fs/nfs/nfs4xdr.c | 5 +----
fs/nfs/super.c | 23 +++++++++++------------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 602446158bfb..03d58a4e38de 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1006,10 +1006,7 @@ static size_t mask_bitmap4(const __u32 *bitmap, const __u32 *mask,
static void encode_nfs4_seqid(struct xdr_stream *xdr,
const struct nfs_seqid *seqid)
{
- if (seqid != NULL)
- encode_uint32(xdr, seqid->sequence->counter);
- else
- encode_uint32(xdr, 0);
+ encode_uint32(xdr, seqid ? seqid->sequence->counter : 0);
}
static void encode_compound_hdr(struct xdr_stream *xdr,
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 84dcde7f560b..88d0be7959b5 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -663,12 +663,12 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
seq_printf(m, ",acdirmax=%u", nfss->acdirmax/HZ);
if (!(nfss->flags & (NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR)))
seq_puts(m, ",hard");
- for (nfs_infop = nfs_info; nfs_infop->flag; nfs_infop++) {
- if (nfss->flags & nfs_infop->flag)
- seq_puts(m, nfs_infop->str);
- else
- seq_puts(m, nfs_infop->nostr);
- }
+ for (nfs_infop = nfs_info; nfs_infop->flag; nfs_infop++)
+ seq_puts(m,
+ (nfss->flags & nfs_infop->flag)
+ ? nfs_infop->str
+ : nfs_infop->nostr);
+
rcu_read_lock();
seq_printf(m, ",proto=%s",
rpc_peeraddr2str(nfss->client, RPC_DISPLAY_NETID));
@@ -695,12 +695,11 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
if (nfss->options & NFS_OPTION_MIGRATION)
seq_puts(m, ",migration");
- if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) {
- if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
- seq_puts(m, ",lookupcache=none");
- else
- seq_puts(m, ",lookupcache=pos");
- }
+ if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG)
+ seq_puts(m,
+ (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
+ ? ",lookupcache=none"
+ : ",lookupcache=pos");
local_flock = nfss->flags & NFS_MOUNT_LOCAL_FLOCK;
local_fcntl = nfss->flags & NFS_MOUNT_LOCAL_FCNTL;
--
2.22.0
prev parent reply other threads:[~2019-07-03 15:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 15:07 [PATCH 0/3] NFS: Adjustments for three function implementations Markus Elfring
2019-07-03 15:08 ` [PATCH 1/3] NFS: Use seq_putc() in nfs_show_stats() Markus Elfring
2019-07-03 15:09 ` [PATCH 2/3] NFS: Replace 16 seq_printf() calls by seq_puts() Markus Elfring
2019-07-03 15:11 ` Markus Elfring [this message]
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=fd43c523-ceef-ed2d-0e98-1c792350d9ed@web.de \
--to=markus.elfring@web.de \
--cc=anna.schumaker@netapp.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.com \
/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;
as well as URLs for NNTP newsgroup(s).