Whamcloud - gitweb
LU-9887 tests: adjust lfsck speek test error range
[fs/lustre-release.git] / lustre / obdclass / lustre_handles.c
index 2736695..bd149dd 100644 (file)
@@ -43,7 +43,7 @@
 
 static __u64 handle_base;
 #define HANDLE_INCR 7
-static spinlock_t handle_base_lock;
+static DEFINE_SPINLOCK(handle_base_lock);
 
 static struct handle_bucket {
        spinlock_t       lock;
@@ -198,7 +198,7 @@ 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);
@@ -207,7 +207,6 @@ int class_handle_init(void)
         if (handle_hash == NULL)
                 return -ENOMEM;
 
-       spin_lock_init(&handle_base_lock);
        for (bucket = handle_hash + HANDLE_HASH_SIZE - 1; bucket >= handle_hash;
             bucket--) {
                INIT_LIST_HEAD(&bucket->head);
@@ -216,8 +215,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);