From: Jeff Layton <jlayton@primarydata.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org, hch@infradead.org
Subject: [PATCH v2 2/4] nfsd: clean up sparse endianness warnings in nfscache.c
Date: Tue, 17 Jun 2014 07:44:12 -0400 [thread overview]
Message-ID: <1403005454-7319-3-git-send-email-jlayton@primarydata.com> (raw)
In-Reply-To: <1403005454-7319-1-git-send-email-jlayton@primarydata.com>
We currently hash the XID to determine a hash bucket to use for the
reply cache entry, which is fed into hash_32 without byte-swapping it.
Add __force to make sparse happy, and add some comments to explain
why.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
---
fs/nfsd/nfscache.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index 6040da8830ff..ff9567633245 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -221,7 +221,12 @@ static void
hash_refile(struct svc_cacherep *rp)
{
hlist_del_init(&rp->c_hash);
- hlist_add_head(&rp->c_hash, cache_hash + hash_32(rp->c_xid, maskbits));
+ /*
+ * No point in byte swapping c_xid since we're just using it to pick
+ * a hash bucket.
+ */
+ hlist_add_head(&rp->c_hash, cache_hash +
+ hash_32((__force u32)rp->c_xid, maskbits));
}
/*
@@ -356,7 +361,11 @@ nfsd_cache_search(struct svc_rqst *rqstp, __wsum csum)
struct hlist_head *rh;
unsigned int entries = 0;
- rh = &cache_hash[hash_32(rqstp->rq_xid, maskbits)];
+ /*
+ * No point in byte swapping rq_xid since we're just using it to pick
+ * a hash bucket.
+ */
+ rh = &cache_hash[hash_32((__force u32)rqstp->rq_xid, maskbits)];
hlist_for_each_entry(rp, rh, c_hash) {
++entries;
if (nfsd_cache_match(rqstp, csum, rp)) {
--
1.9.3
next prev parent reply other threads:[~2014-06-17 11:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-17 11:44 [PATCH v2 0/4] nfsd: clean up sparse endianness warnings Jeff Layton
2014-06-17 11:44 ` [PATCH v2 1/4] nfsd: add __force to opaque verifier field casts Jeff Layton
2014-06-17 13:52 ` Christoph Hellwig
2014-06-17 11:44 ` Jeff Layton [this message]
2014-06-17 13:52 ` [PATCH v2 2/4] nfsd: clean up sparse endianness warnings in nfscache.c Christoph Hellwig
2014-06-17 11:44 ` [PATCH v2 3/4] nfsd: nfsd_splice_read and nfsd_readv should return __be32 Jeff Layton
2014-06-17 13:53 ` Christoph Hellwig
2014-06-17 11:44 ` [PATCH v2 4/4] nfsd: add appropriate __force directives to filehandle generation code Jeff Layton
2014-06-17 13:57 ` Christoph Hellwig
2014-06-18 15:39 ` [PATCH v2 0/4] nfsd: clean up sparse endianness warnings J. Bruce Fields
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=1403005454-7319-3-git-send-email-jlayton@primarydata.com \
--to=jlayton@primarydata.com \
--cc=bfields@fieldses.org \
--cc=hch@infradead.org \
--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