[Cluster-devel] [GFS2 PATCH 2/2] GFS2: Use resizable hash table for glocks
Andreas Gruenbacher
agruenba at redhat.com
Mon Aug 24 13:31:51 UTC 2015
Bob,
[sorry for the empty previous reply ...]
2015-07-09 20:25 GMT+02:00 Bob Peterson <rpeterso at redhat.com>:
> @@ -1460,31 +1421,24 @@ static struct shrinker glock_shrinker = {
> *
> */
>
> -static void examine_bucket(glock_examiner examiner, const struct gfs2_sbd *sdp,
> - unsigned int hash)
> +static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)
> {
> struct gfs2_glock *gl;
> - struct hlist_bl_head *head = &gl_hash_table[hash];
> - struct hlist_bl_node *pos;
> + struct rhash_head *pos, *next;
> + const struct bucket_table *tbl;
> + int i;
>
> - rcu_read_lock();
> - hlist_bl_for_each_entry_rcu(gl, pos, head, gl_list) {
> - if ((gl->gl_name.ln_sbd == sdp) && lockref_get_not_dead(&gl->gl_lockref))
> - examiner(gl);
> + tbl = rht_dereference_rcu(gl_hash_table.tbl, &gl_hash_table);
> + for (i = 0; i < tbl->size; i++) {
> + rht_for_each_entry_safe(gl, pos, next, tbl, i, gl_node) {
> + if ((gl->gl_name.ln_sbd == sdp) &&
> + lockref_get_not_dead(&gl->gl_lockref))
> + examiner(gl);
> + }
> }
> - rcu_read_unlock();
> cond_resched();
> }
>
> -static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)
> -{
> - unsigned x;
> -
> - for (x = 0; x < GFS2_GL_HASH_SIZE; x++)
> - examine_bucket(examiner, sdp, x);
> -}
> -
> -
> /**
> * thaw_glock - thaw out a glock which has an unprocessed reply waiting
> * @gl: The glock to thaw
I don't think we can drop the rcu read lock in glock_hash_walk(): That
"lock" prevents a concurrent hash table resize from freeing the bucket
table under us.
Thanks,
Andreas
More information about the Cluster-devel
mailing list