Quota code uses 'uid' or '(1 << 32) + gid' as the hash key, however,
the quota hash function lqs_hash() always try to interpret such a
unsigned long long key as a 'quota_adjust_qunit' struct, then calculate
the hash value by quota_adjust_qunit->qaq_id.
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: I128f2835ff590d712b0a1641af7361146e8e3e81
Reviewed-on: http://review.whamcloud.com/1163
Tested-by: Hudson
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
static unsigned
lqs_hash(lustre_hash_t *lh, void *key, unsigned mask)
{
- struct quota_adjust_qunit *lqs_key;
+ unsigned long long id;
unsigned hash;
ENTRY;
LASSERT(key);
- lqs_key = (struct quota_adjust_qunit *)key;
- hash = (QAQ_IS_GRP(lqs_key) ? 5381 : 5387) * lqs_key->qaq_id;
+ id = *((unsigned long long *)key);
+ hash = (LQS_KEY_GRP(id) ? 5381 : 5387) * (unsigned)LQS_KEY_ID(id);
RETURN(hash & mask);
}