Whamcloud - gitweb
LU-9019 obd: use 64-bit timestamps for rpc stats
[fs/lustre-release.git] / lustre / obdclass / genops.c
index 54168e0..9857a57 100644 (file)
@@ -1235,6 +1235,13 @@ int class_disconnect(struct obd_export *export)
        spin_lock(&export->exp_lock);
        already_disconnected = export->exp_disconnected;
        export->exp_disconnected = 1;
+       /*  We hold references of export for uuid hash
+        *  and nid_hash and export link at least. So
+        *  it is safe to call cfs_hash_del in there.  */
+       if (!hlist_unhashed(&export->exp_nid_hash))
+               cfs_hash_del(export->exp_obd->obd_nid_hash,
+                            &export->exp_connection->c_peer.nid,
+                            &export->exp_nid_hash);
        spin_unlock(&export->exp_lock);
 
         /* class_cleanup(), abort_recovery(), and class_fail_export()
@@ -1248,11 +1255,6 @@ int class_disconnect(struct obd_export *export)
        CDEBUG(D_IOCTL, "disconnect: cookie %#llx\n",
                export->exp_handle.h_cookie);
 
-       if (!hlist_unhashed(&export->exp_nid_hash))
-                cfs_hash_del(export->exp_obd->obd_nid_hash,
-                             &export->exp_connection->c_peer.nid,
-                             &export->exp_nid_hash);
-
         class_export_recovery_cleanup(export);
         class_unlink_export(export);
 no_disconn:
@@ -1596,7 +1598,7 @@ void obd_exports_barrier(struct obd_device *obd)
                spin_unlock(&obd->obd_dev_lock);
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule_timeout(cfs_time_seconds(waited));
-               if (waited > 5 && IS_PO2(waited)) {
+               if (waited > 5 && is_power_of_2(waited)) {
                        LCONSOLE_WARN("%s is waiting for obd_unlinked_exports "
                                      "more than %d seconds. "
                                      "The obd refcount = %d. Is it stuck?\n",
@@ -1937,7 +1939,7 @@ void *kuc_alloc(int payload_len, int transport, int type)
 EXPORT_SYMBOL(kuc_alloc);
 
 /* Takes pointer to payload area */
-inline void kuc_free(void *p, int payload_len)
+void kuc_free(void *p, int payload_len)
 {
         struct kuc_hdr *lh = kuc_ptr(p);
         OBD_FREE(lh, kuc_len(payload_len));
@@ -2153,16 +2155,16 @@ EXPORT_SYMBOL(obd_set_max_mod_rpcs_in_flight);
 int obd_mod_rpc_stats_seq_show(struct client_obd *cli,
                               struct seq_file *seq)
 {
-       struct timeval now;
        unsigned long mod_tot = 0, mod_cum;
+       struct timespec64 now;
        int i;
 
-       do_gettimeofday(&now);
+       ktime_get_real_ts64(&now);
 
        spin_lock(&cli->cl_mod_rpcs_lock);
 
-       seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
-                  now.tv_sec, now.tv_usec);
+       seq_printf(seq, "snapshot_time:         %llu.%9lu (secs.nsecs)\n",
+                  (s64)now.tv_sec, now.tv_nsec);
        seq_printf(seq, "modify_RPCs_in_flight:  %hu\n",
                   cli->cl_mod_rpcs_in_flight);