From d221e09e1332a13d835e4255f799e7243f0be29d Mon Sep 17 00:00:00 2001 From: johann Date: Tue, 1 Dec 2009 13:18:05 +0000 Subject: [PATCH] Branch b1_8 b=20978 i=adilger i=liang use LICFS_ALLOC instead of vmalloc in the lustre hash code. --- lustre/obdclass/class_hash.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lustre/obdclass/class_hash.c b/lustre/obdclass/class_hash.c index 5370a4e..f78c898 100644 --- a/lustre/obdclass/class_hash.c +++ b/lustre/obdclass/class_hash.c @@ -79,7 +79,7 @@ lustre_hash_init(char *name, unsigned int cur_bits, unsigned int max_bits, LASSERT(max_bits >= cur_bits); LASSERT(max_bits < 31); - OBD_ALLOC_PTR(lh); + LIBCFS_ALLOC_PTR(lh); if (!lh) RETURN(NULL); @@ -102,9 +102,9 @@ lustre_hash_init(char *name, unsigned int cur_bits, unsigned int max_bits, /* theta * 1000 */ __lustre_hash_set_theta(lh, 500, 2000); - OBD_VMALLOC(lh->lh_buckets, sizeof(*lh->lh_buckets) << lh->lh_cur_bits); + LIBCFS_ALLOC(lh->lh_buckets, sizeof(*lh->lh_buckets) << lh->lh_cur_bits); if (!lh->lh_buckets) { - OBD_FREE_PTR(lh); + LIBCFS_FREE_PTR(lh); RETURN(NULL); } @@ -150,8 +150,8 @@ lustre_hash_exit(lustre_hash_t *lh) LASSERT(atomic_read(&lh->lh_count) == 0); write_unlock(&lh->lh_rwlock); - OBD_VFREE(lh->lh_buckets, sizeof(*lh->lh_buckets) << lh->lh_cur_bits); - OBD_FREE_PTR(lh); + LIBCFS_FREE(lh->lh_buckets, sizeof(*lh->lh_buckets) << lh->lh_cur_bits); + LIBCFS_FREE_PTR(lh); EXIT; } EXPORT_SYMBOL(lustre_hash_exit); @@ -564,7 +564,7 @@ lustre_hash_rehash(lustre_hash_t *lh, int bits) LASSERT(!in_interrupt()); LASSERT(mask > 0); - OBD_VMALLOC(rehash_buckets, sizeof(*rehash_buckets) << bits); + LIBCFS_ALLOC(rehash_buckets, sizeof(*rehash_buckets) << bits); if (!rehash_buckets) RETURN(-ENOMEM); @@ -582,8 +582,8 @@ lustre_hash_rehash(lustre_hash_t *lh, int bits) */ theta = __lustre_hash_theta(lh); if ((theta >= lh->lh_min_theta) && (theta <= lh->lh_max_theta)) { - OBD_VFREE(rehash_buckets, sizeof(*rehash_buckets) << bits); write_unlock(&lh->lh_rwlock); + LIBCFS_FREE(rehash_buckets, sizeof(*rehash_buckets) << bits); RETURN(-EALREADY); } @@ -630,8 +630,8 @@ lustre_hash_rehash(lustre_hash_t *lh, int bits) write_unlock(&lh_lhb->lhb_rwlock); } - OBD_VFREE(lh_buckets, sizeof(*lh_buckets) << lh_bits); write_unlock(&lh->lh_rwlock); + LIBCFS_FREE(lh_buckets, sizeof(*lh_buckets) << lh_bits); RETURN(0); } -- 1.8.3.1