aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-09-07 13:12:27 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-09-07 13:12:27 -0400
commitb8547856f9c158ff70effbcfd15969c908fbe1b3 (patch)
tree11aed7e28899a3a3dc9a45a2cfc160ec084c581e
parent62f140c173f2c85e15527eefc6e2fb3c37a97eb1 (diff)
[GFS2] Add gfs2 superblock to glock hash function
This is another patch preparing for sharing of the glock hash table between different gfs2 mounts. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/glock.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index f2edc8b76121..00769674f2ea 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -83,12 +83,14 @@ static inline int relaxed_state_ok(unsigned int actual, unsigned requested,
83 * Returns: The number of the corresponding hash bucket 83 * Returns: The number of the corresponding hash bucket
84 */ 84 */
85 85
86static unsigned int gl_hash(const struct lm_lockname *name) 86static unsigned int gl_hash(const struct gfs2_sbd *sdp,
87 const struct lm_lockname *name)
87{ 88{
88 unsigned int h; 89 unsigned int h;
89 90
90 h = jhash(&name->ln_number, sizeof(u64), 0); 91 h = jhash(&name->ln_number, sizeof(u64), 0);
91 h = jhash(&name->ln_type, sizeof(unsigned int), h); 92 h = jhash(&name->ln_type, sizeof(unsigned int), h);
93 h = jhash(&sdp, sizeof(struct gfs2_sbd *), h);
92 h &= GFS2_GL_HASH_MASK; 94 h &= GFS2_GL_HASH_MASK;
93 95
94 return h; 96 return h;
@@ -232,7 +234,7 @@ static struct gfs2_glock *search_bucket(struct gfs2_gl_hash_bucket *bucket,
232static struct gfs2_glock *gfs2_glock_find(struct gfs2_sbd *sdp, 234static struct gfs2_glock *gfs2_glock_find(struct gfs2_sbd *sdp,
233 const struct lm_lockname *name) 235 const struct lm_lockname *name)
234{ 236{
235 struct gfs2_gl_hash_bucket *bucket = &sdp->sd_gl_hash[gl_hash(name)]; 237 struct gfs2_gl_hash_bucket *bucket = &sdp->sd_gl_hash[gl_hash(sdp, name)];
236 struct gfs2_glock *gl; 238 struct gfs2_glock *gl;
237 239
238 read_lock(&bucket->hb_lock); 240 read_lock(&bucket->hb_lock);
@@ -266,7 +268,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
266 268
267 name.ln_number = number; 269 name.ln_number = number;
268 name.ln_type = glops->go_type; 270 name.ln_type = glops->go_type;
269 bucket = &sdp->sd_gl_hash[gl_hash(&name)]; 271 bucket = &sdp->sd_gl_hash[gl_hash(sdp, &name)];
270 272
271 read_lock(&bucket->hb_lock); 273 read_lock(&bucket->hb_lock);
272 gl = search_bucket(bucket, sdp, &name); 274 gl = search_bucket(bucket, sdp, &name);