aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-09-11 13:48:41 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-09-13 18:30:36 -0400
commitee626a77d3725a129391b1c85edd46f3b470cca9 (patch)
treeba38fa7285435d7db6091ae20698bc227afc1b9a /fs/nfsd/nfs4state.c
parent69064a2764fe195f1478be3ea83d15abe5d71025 (diff)
nfsd4: better stateid hashing
First, we shouldn't care here about the structure of the opaque part of the stateid. Second, this hash is really dumb. (I'm not sure the replacement is much better, though--to look at it another patch.) Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index ea338d0c62a1..0cd346477f29 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -168,9 +168,9 @@ static unsigned int file_hashval(struct inode *ino)
168 return hash_ptr(ino, FILE_HASH_BITS); 168 return hash_ptr(ino, FILE_HASH_BITS);
169} 169}
170 170
171static unsigned int stateid_hashval(u32 owner_id, u32 file_id) 171static unsigned int stateid_hashval(stateid_t *s)
172{ 172{
173 return (owner_id + file_id) & STATEID_HASH_MASK; 173 return opaque_hashval(&s->si_opaque, sizeof(stateid_opaque_t)) & STATEID_HASH_MASK;
174} 174}
175 175
176static struct list_head file_hashtbl[FILE_HASH_SIZE]; 176static struct list_head file_hashtbl[FILE_HASH_SIZE];
@@ -221,7 +221,7 @@ static inline void hash_stid(struct nfs4_stid *stid)
221 stateid_t *s = &stid->sc_stateid; 221 stateid_t *s = &stid->sc_stateid;
222 unsigned int hashval; 222 unsigned int hashval;
223 223
224 hashval = stateid_hashval(s->si_stateownerid, s->si_fileid); 224 hashval = stateid_hashval(s);
225 list_add(&stid->sc_hash, &stateid_hashtbl[hashval]); 225 list_add(&stid->sc_hash, &stateid_hashtbl[hashval]);
226} 226}
227 227
@@ -1083,7 +1083,7 @@ static struct nfs4_stid *find_stateid(stateid_t *t)
1083 struct nfs4_stid *s; 1083 struct nfs4_stid *s;
1084 unsigned int hashval; 1084 unsigned int hashval;
1085 1085
1086 hashval = stateid_hashval(t->si_stateownerid, t->si_fileid); 1086 hashval = stateid_hashval(t);
1087 list_for_each_entry(s, &stateid_hashtbl[hashval], sc_hash) 1087 list_for_each_entry(s, &stateid_hashtbl[hashval], sc_hash)
1088 if (same_stateid(&s->sc_stateid, t)) 1088 if (same_stateid(&s->sc_stateid, t))
1089 return s; 1089 return s;