These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / lustre / lustre / obdclass / lustre_handles.c
index f720e31..fb9147c 100644 (file)
@@ -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)