Commit b8547856 authored by Steven Whitehouse's avatar Steven Whitehouse

[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: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 62f140c1
...@@ -83,12 +83,14 @@ static inline int relaxed_state_ok(unsigned int actual, unsigned requested, ...@@ -83,12 +83,14 @@ static inline int relaxed_state_ok(unsigned int actual, unsigned requested,
* Returns: The number of the corresponding hash bucket * Returns: The number of the corresponding hash bucket
*/ */
static unsigned int gl_hash(const struct lm_lockname *name) static unsigned int gl_hash(const struct gfs2_sbd *sdp,
const struct lm_lockname *name)
{ {
unsigned int h; unsigned int h;
h = jhash(&name->ln_number, sizeof(u64), 0); h = jhash(&name->ln_number, sizeof(u64), 0);
h = jhash(&name->ln_type, sizeof(unsigned int), h); h = jhash(&name->ln_type, sizeof(unsigned int), h);
h = jhash(&sdp, sizeof(struct gfs2_sbd *), h);
h &= GFS2_GL_HASH_MASK; h &= GFS2_GL_HASH_MASK;
return h; return h;
...@@ -232,7 +234,7 @@ static struct gfs2_glock *search_bucket(struct gfs2_gl_hash_bucket *bucket, ...@@ -232,7 +234,7 @@ static struct gfs2_glock *search_bucket(struct gfs2_gl_hash_bucket *bucket,
static struct gfs2_glock *gfs2_glock_find(struct gfs2_sbd *sdp, static struct gfs2_glock *gfs2_glock_find(struct gfs2_sbd *sdp,
const struct lm_lockname *name) const struct lm_lockname *name)
{ {
struct gfs2_gl_hash_bucket *bucket = &sdp->sd_gl_hash[gl_hash(name)]; struct gfs2_gl_hash_bucket *bucket = &sdp->sd_gl_hash[gl_hash(sdp, name)];
struct gfs2_glock *gl; struct gfs2_glock *gl;
read_lock(&bucket->hb_lock); read_lock(&bucket->hb_lock);
...@@ -266,7 +268,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, ...@@ -266,7 +268,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
name.ln_number = number; name.ln_number = number;
name.ln_type = glops->go_type; name.ln_type = glops->go_type;
bucket = &sdp->sd_gl_hash[gl_hash(&name)]; bucket = &sdp->sd_gl_hash[gl_hash(sdp, &name)];
read_lock(&bucket->hb_lock); read_lock(&bucket->hb_lock);
gl = search_bucket(bucket, sdp, &name); gl = search_bucket(bucket, sdp, &name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment