Whamcloud - gitweb
Revert "LU-9019 osc: migrate to time64_t" 71/30571/2
authorOleg Drokin <oleg.drokin@intel.com>
Mon, 18 Dec 2017 15:40:38 +0000 (15:40 +0000)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 18 Dec 2017 15:46:51 +0000 (15:46 +0000)
This causes frequent failures tracked in LU-10403

This reverts commit 4f2a5d5887492da9abe320074511811415e0a06c.

Change-Id: I7d255fcee654508b6df233728624a39917853b98
Reviewed-on: https://review.whamcloud.com/30571
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Tested-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre_osc.h
lustre/mdc/lproc_mdc.c
lustre/osc/lproc_osc.c
lustre/osc/osc_cache.c
lustre/osc/osc_object.c
lustre/osc/osc_page.c

index 06d4499..734566d 100644 (file)
@@ -120,7 +120,7 @@ struct osc_device {
        } od_stats;
 
        /* configuration item(s) */
-       time64_t                od_contention_time;
+       int                     od_contention_time;
        int                     od_lockless_truncate;
 };
 
@@ -256,7 +256,7 @@ struct osc_object {
         * True if locking against this stripe got -EUSERS.
         */
        int                     oo_contended;
-       time64_t                oo_contention_time;
+       cfs_time_t              oo_contention_time;
 #ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK
        /**
         * IO context used for invariant checks in osc_lock_has_pages().
@@ -358,7 +358,7 @@ static inline int osc_object_is_locked(struct osc_object *obj)
 
 static inline void osc_object_set_contended(struct osc_object *obj)
 {
-       obj->oo_contention_time = ktime_get_seconds();
+       obj->oo_contention_time = cfs_time_current();
        /* mb(); */
        obj->oo_contended = 1;
 }
@@ -541,7 +541,7 @@ struct osc_page {
        /**
         * Submit time - the time when the page is starting RPC. For debugging.
         */
-       time64_t                ops_submit_time;
+       cfs_time_t              ops_submit_time;
 };
 
 struct osc_brw_async_args {
index 3c9d67c..cf37467 100644 (file)
@@ -190,7 +190,7 @@ static int mdc_contention_seconds_seq_show(struct seq_file *m, void *v)
        struct obd_device *obd = m->private;
        struct osc_device *od  = obd2osc_dev(obd);
 
-       seq_printf(m, "%lld\n", od->od_contention_time);
+       seq_printf(m, "%u\n", od->od_contention_time);
        return 0;
 }
 
index b999f53..40b2e5f 100644 (file)
@@ -508,7 +508,7 @@ static int osc_contention_seconds_seq_show(struct seq_file *m, void *v)
        struct obd_device *obd = m->private;
        struct osc_device *od  = obd2osc_dev(obd);
 
-       seq_printf(m, "%lld\n", od->od_contention_time);
+       seq_printf(m, "%u\n", od->od_contention_time);
        return 0;
 }
 
index 751938c..f94f053 100644 (file)
@@ -1286,7 +1286,7 @@ static int osc_make_ready(const struct lu_env *env, struct osc_async_page *oap,
        ENTRY;
        result = cl_page_make_ready(env, page, CRT_WRITE);
        if (result == 0)
-               opg->ops_submit_time = ktime_get_seconds();
+               opg->ops_submit_time = cfs_time_current();
        RETURN(result);
 }
 
index 025e68a..4f4e8ac 100644 (file)
@@ -308,9 +308,10 @@ drop_lock:
 
 int osc_object_is_contended(struct osc_object *obj)
 {
-       struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev);
-       time64_t osc_contention_time = dev->od_contention_time;
-       time64_t retry_time;
+        struct osc_device *dev  = lu2osc_dev(obj->oo_cl.co_lu.lo_dev);
+        int osc_contention_time = dev->od_contention_time;
+        cfs_time_t cur_time     = cfs_time_current();
+        cfs_time_t retry_time;
 
         if (OBD_FAIL_CHECK(OBD_FAIL_OSC_OBJECT_CONTENTION))
                 return 1;
@@ -318,16 +319,17 @@ int osc_object_is_contended(struct osc_object *obj)
         if (!obj->oo_contended)
                 return 0;
 
-       /*
-        * I like copy-paste. the code is copied from
-        * ll_file_is_contended.
-        */
-       retry_time = obj->oo_contention_time + osc_contention_time;
-       if (ktime_get_seconds() > retry_time) {
-               osc_object_clear_contended(obj);
-               return 0;
-       }
-       return 1;
+        /*
+         * I like copy-paste. the code is copied from
+         * ll_file_is_contended.
+         */
+        retry_time = cfs_time_add(obj->oo_contention_time,
+                                  cfs_time_seconds(osc_contention_time));
+        if (cfs_time_after(cur_time, retry_time)) {
+                osc_object_clear_contended(obj);
+                return 0;
+        }
+        return 1;
 }
 EXPORT_SYMBOL(osc_object_is_contended);
 
index 2681660..81d0c52 100644 (file)
@@ -119,12 +119,12 @@ static const char *osc_list(struct list_head *head)
        return list_empty(head) ? "-" : "+";
 }
 
-static inline time64_t osc_submit_duration(struct osc_page *opg)
+static inline cfs_time_t osc_submit_duration(struct osc_page *opg)
 {
-       if (opg->ops_submit_time == 0)
-               return 0;
+        if (opg->ops_submit_time == 0)
+                return 0;
 
-       return ktime_get_seconds() - opg->ops_submit_time;
+        return (cfs_time_current() - opg->ops_submit_time);
 }
 
 static int osc_page_print(const struct lu_env *env,
@@ -139,7 +139,7 @@ static int osc_page_print(const struct lu_env *env,
        return (*printer)(env, cookie, LUSTRE_OSC_NAME"-page@%p %lu: "
                          "1< %#x %d %u %s %s > "
                          "2< %lld %u %u %#x %#x | %p %p %p > "
-                         "3< %d %lld %d > "
+                         "3< %d %lu %d > "
                          "4< %d %d %d %lu %s | %s %s %s %s > "
                          "5< %s %s %s %s | %d %s | %d %s %s>\n",
                          opg, osc_index(opg),
@@ -327,7 +327,7 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg,
                oap->oap_cmd |= OBD_BRW_NOQUOTA;
        }
 
-       opg->ops_submit_time = ktime_get_seconds();
+       opg->ops_submit_time = cfs_time_current();
        osc_page_transfer_get(opg, "transfer\0imm");
        osc_page_transfer_add(env, opg, crt);
 }