Whamcloud - gitweb
LU-9887 tests: adjust lfsck speek test error range
[fs/lustre-release.git] / lustre / obdclass / lustre_handles.c
index dbe402a..bd149dd 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -47,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;
@@ -202,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);
@@ -211,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);
@@ -220,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);