Whamcloud - gitweb
LU-14487 modules: remove references to Sun Trademark.
[fs/lustre-release.git] / lustre / obdclass / upcall_cache.c
index 0790617..76f13e7 100644 (file)
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * lustre/obdclass/upcall_cache.c
  *
@@ -36,7 +35,7 @@
 #define DEBUG_SUBSYSTEM S_SEC
 
 #include <libcfs/libcfs.h>
-#include <lnet/types.h>
+#include <uapi/linux/lnet/lnet-types.h>
 #include <upcall_cache.h>
 
 static struct upcall_cache_entry *alloc_entry(struct upcall_cache *cache,
@@ -114,18 +113,18 @@ static inline void put_entry(struct upcall_cache *cache,
 static int check_unlink_entry(struct upcall_cache *cache,
                              struct upcall_cache_entry *entry)
 {
-       if (UC_CACHE_IS_VALID(entry) &&
-           cfs_time_before(cfs_time_current(), entry->ue_expire))
+       time64_t now = ktime_get_seconds();
+
+       if (UC_CACHE_IS_VALID(entry) && now < entry->ue_expire)
                return 0;
 
        if (UC_CACHE_IS_ACQUIRING(entry)) {
                if (entry->ue_acquire_expire == 0 ||
-                   cfs_time_before(cfs_time_current(),
-                                   entry->ue_acquire_expire))
+                   now < entry->ue_acquire_expire)
                        return 0;
 
                UC_CACHE_SET_EXPIRED(entry);
-               wake_up_all(&entry->ue_waitq);
+               wake_up(&entry->ue_waitq);
        } else if (!UC_CACHE_IS_INVALID(entry)) {
                UC_CACHE_SET_EXPIRED(entry);
        }
@@ -148,7 +147,7 @@ struct upcall_cache_entry *upcall_cache_get_entry(struct upcall_cache *cache,
 {
        struct upcall_cache_entry *entry = NULL, *new = NULL, *next;
        struct list_head *head;
-       wait_queue_t wait;
+       wait_queue_entry_t wait;
        int rc, found;
        ENTRY;
 
@@ -197,12 +196,12 @@ find_again:
                spin_unlock(&cache->uc_lock);
                rc = refresh_entry(cache, entry);
                spin_lock(&cache->uc_lock);
-               entry->ue_acquire_expire =
-                       cfs_time_shift(cache->uc_acquire_expire);
+               entry->ue_acquire_expire = ktime_get_seconds() +
+                                          cache->uc_acquire_expire;
                if (rc < 0) {
                        UC_CACHE_CLEAR_ACQUIRING(entry);
                        UC_CACHE_SET_INVALID(entry);
-                       wake_up_all(&entry->ue_waitq);
+                       wake_up(&entry->ue_waitq);
                        if (unlikely(rc == -EREMCHG)) {
                                put_entry(cache, entry);
                                GOTO(out, entry = ERR_PTR(rc));
@@ -217,7 +216,7 @@ find_again:
                              MAX_SCHEDULE_TIMEOUT;
                long left;
 
-               init_waitqueue_entry(&wait, current);
+               init_wait(&wait);
                add_wait_queue(&entry->ue_waitq, &wait);
                set_current_state(TASK_INTERRUPTIBLE);
                spin_unlock(&cache->uc_lock);
@@ -339,7 +338,7 @@ int upcall_cache_downcall(struct upcall_cache *cache, __u32 err, __u64 key,
        if (rc)
                GOTO(out, rc);
 
-       entry->ue_expire = cfs_time_shift(cache->uc_entry_expire);
+       entry->ue_expire = ktime_get_seconds() + cache->uc_entry_expire;
        UC_CACHE_SET_VALID(entry);
        CDEBUG(D_OTHER, "%s: created upcall cache entry %p for key %llu\n",
               cache->uc_name, entry, entry->ue_key);
@@ -350,7 +349,7 @@ out:
        }
        UC_CACHE_CLEAR_ACQUIRING(entry);
        spin_unlock(&cache->uc_lock);
-       wake_up_all(&entry->ue_waitq);
+       wake_up(&entry->ue_waitq);
        put_entry(cache, entry);
 
        RETURN(rc);
@@ -399,10 +398,10 @@ void upcall_cache_flush_one(struct upcall_cache *cache, __u64 key, void *args)
 
        if (found) {
                CWARN("%s: flush entry %p: key %llu, ref %d, fl %x, "
-                     "cur %lu, ex %ld/%ld\n",
+                     "cur %lld, ex %lld/%lld\n",
                      cache->uc_name, entry, entry->ue_key,
                      atomic_read(&entry->ue_refcount), entry->ue_flags,
-                     cfs_time_current_sec(), entry->ue_acquire_expire,
+                     ktime_get_real_seconds(), entry->ue_acquire_expire,
                      entry->ue_expire);
                UC_CACHE_SET_EXPIRED(entry);
                if (!atomic_read(&entry->ue_refcount))