X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fdrivers%2Fstaging%2Flustre%2Flustre%2Fobdclass%2Flustre_handles.c;fp=kernel%2Fdrivers%2Fstaging%2Flustre%2Flustre%2Fobdclass%2Flustre_handles.c;h=fb9147cc607f19c0cdaaab7c9e6dc7dfb435986d;hb=e09b41010ba33a20a87472ee821fa407a5b8da36;hp=f720e31832952e51d7e3ba7073717f30e0de52b0;hpb=f93b97fd65072de626c074dbe099a1fff05ce060;p=kvmfornfv.git diff --git a/kernel/drivers/staging/lustre/lustre/obdclass/lustre_handles.c b/kernel/drivers/staging/lustre/lustre/obdclass/lustre_handles.c index f720e3183..fb9147cc6 100644 --- a/kernel/drivers/staging/lustre/lustre/obdclass/lustre_handles.c +++ b/kernel/drivers/staging/lustre/lustre/obdclass/lustre_handles.c @@ -44,7 +44,6 @@ #include "../include/lustre_handles.h" #include "../include/lustre_lib.h" - static __u64 handle_base; #define HANDLE_INCR 7 static spinlock_t handle_base_lock; @@ -126,6 +125,7 @@ static void class_handle_unhash_nolock(struct portals_handle *h) void class_handle_unhash(struct portals_handle *h) { struct handle_bucket *bucket; + bucket = handle_hash + (h->h_cookie & HANDLE_HASH_MASK); spin_lock(&bucket->lock); @@ -134,19 +134,6 @@ void class_handle_unhash(struct portals_handle *h) } EXPORT_SYMBOL(class_handle_unhash); -void class_handle_hash_back(struct portals_handle *h) -{ - struct handle_bucket *bucket; - - bucket = handle_hash + (h->h_cookie & HANDLE_HASH_MASK); - - spin_lock(&bucket->lock); - list_add_rcu(&h->h_link, &bucket->head); - h->h_in = 1; - spin_unlock(&bucket->lock); -} -EXPORT_SYMBOL(class_handle_hash_back); - void *class_handle2object(__u64 cookie) { struct handle_bucket *bucket; @@ -186,19 +173,20 @@ void class_handle_free_cb(struct rcu_head *rcu) if (h->h_ops->hop_free != NULL) h->h_ops->hop_free(ptr, h->h_size); else - OBD_FREE(ptr, h->h_size); + kfree(ptr); } EXPORT_SYMBOL(class_handle_free_cb); int class_handle_init(void) { struct handle_bucket *bucket; - struct timeval tv; + struct timespec64 ts; int seed[2]; LASSERT(handle_hash == NULL); - OBD_ALLOC_LARGE(handle_hash, sizeof(*bucket) * HANDLE_HASH_SIZE); + handle_hash = libcfs_kvzalloc(sizeof(*bucket) * HANDLE_HASH_SIZE, + GFP_NOFS); if (handle_hash == NULL) return -ENOMEM; @@ -211,8 +199,8 @@ int class_handle_init(void) /** bug 21430: add randomness to the initial base */ cfs_get_random_bytes(seed, sizeof(seed)); - do_gettimeofday(&tv); - cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]); + ktime_get_ts64(&ts); + cfs_srand(ts.tv_sec ^ seed[0], ts.tv_nsec ^ seed[1]); cfs_get_random_bytes(&handle_base, sizeof(handle_base)); LASSERT(handle_base != 0ULL); @@ -245,11 +233,12 @@ static int cleanup_all_handles(void) void class_handle_cleanup(void) { int count; + LASSERT(handle_hash != NULL); count = cleanup_all_handles(); - OBD_FREE_LARGE(handle_hash, sizeof(*handle_hash) * HANDLE_HASH_SIZE); + kvfree(handle_hash); handle_hash = NULL; if (count != 0)