Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eca84933 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller
Browse files

rhashtable: Use head_hashfn instead of obj_raw_hashfn



Now that we don't have cross-table hashes, we no longer need to
keep the entire hash value so all users of obj_raw_hashfn can
use head_hashfn instead.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Acked-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8d2b1879
Loading
Loading
Loading
Loading
+5 −7
Original line number Original line Diff line number Diff line
@@ -403,7 +403,7 @@ static bool __rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj,
	rcu_read_lock();
	rcu_read_lock();


	old_tbl = rht_dereference_rcu(ht->tbl, ht);
	old_tbl = rht_dereference_rcu(ht->tbl, ht);
	hash = obj_raw_hashfn(ht, old_tbl, rht_obj(ht, obj));
	hash = head_hashfn(ht, old_tbl, obj);


	spin_lock_bh(bucket_lock(old_tbl, hash));
	spin_lock_bh(bucket_lock(old_tbl, hash));


@@ -415,7 +415,7 @@ static bool __rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj,
	 */
	 */
	tbl = rht_dereference_rcu(ht->future_tbl, ht);
	tbl = rht_dereference_rcu(ht->future_tbl, ht);
	if (tbl != old_tbl) {
	if (tbl != old_tbl) {
		hash = obj_raw_hashfn(ht, tbl, rht_obj(ht, obj));
		hash = head_hashfn(ht, tbl, obj);
		spin_lock_nested(bucket_lock(tbl, hash), RHT_LOCK_NESTED);
		spin_lock_nested(bucket_lock(tbl, hash), RHT_LOCK_NESTED);
	}
	}


@@ -428,7 +428,6 @@ static bool __rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj,


	no_resize_running = tbl == old_tbl;
	no_resize_running = tbl == old_tbl;


	hash = rht_bucket_index(tbl, hash);
	head = rht_dereference_bucket(tbl->buckets[hash], tbl, hash);
	head = rht_dereference_bucket(tbl->buckets[hash], tbl, hash);


	if (rht_is_a_nulls(head))
	if (rht_is_a_nulls(head))
@@ -444,11 +443,11 @@ static bool __rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj,


exit:
exit:
	if (tbl != old_tbl) {
	if (tbl != old_tbl) {
		hash = obj_raw_hashfn(ht, tbl, rht_obj(ht, obj));
		hash = head_hashfn(ht, tbl, obj);
		spin_unlock(bucket_lock(tbl, hash));
		spin_unlock(bucket_lock(tbl, hash));
	}
	}


	hash = obj_raw_hashfn(ht, old_tbl, rht_obj(ht, obj));
	hash = head_hashfn(ht, old_tbl, obj);
	spin_unlock_bh(bucket_lock(old_tbl, hash));
	spin_unlock_bh(bucket_lock(old_tbl, hash));


	rcu_read_unlock();
	rcu_read_unlock();
@@ -487,9 +486,8 @@ static bool __rhashtable_remove(struct rhashtable *ht,
	unsigned hash;
	unsigned hash;
	bool ret = false;
	bool ret = false;


	hash = obj_raw_hashfn(ht, tbl, rht_obj(ht, obj));
	hash = head_hashfn(ht, tbl, obj);
	lock = bucket_lock(tbl, hash);
	lock = bucket_lock(tbl, hash);
	hash = rht_bucket_index(tbl, hash);


	spin_lock_bh(lock);
	spin_lock_bh(lock);