Whamcloud - gitweb
LU-8788 tests: modify create_pool to use as wrapper
[fs/lustre-release.git] / lustre / obdclass / lprocfs_status_server.c
index d6ee00d..defd672 100644 (file)
@@ -15,7 +15,7 @@
  *
  * 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
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -23,7 +23,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2014, 2015, Intel Corporation.
+ * Copyright (c) 2014, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -44,7 +44,7 @@
 
 int lprocfs_evict_client_open(struct inode *inode, struct file *f)
 {
-       struct obd_device *obd = PDE_DATA(f->f_path.dentry->d_inode);
+       struct obd_device *obd = PDE_DATA(file_inode(f));
 
        atomic_inc(&obd->obd_evict_inprogress);
        return 0;
@@ -52,7 +52,7 @@ int lprocfs_evict_client_open(struct inode *inode, struct file *f)
 
 int lprocfs_evict_client_release(struct inode *inode, struct file *f)
 {
-       struct obd_device *obd = PDE_DATA(f->f_path.dentry->d_inode);
+       struct obd_device *obd = PDE_DATA(file_inode(f));
 
        atomic_dec(&obd->obd_evict_inprogress);
        wake_up(&obd->obd_evict_inprogress_waitq);
@@ -564,6 +564,7 @@ EXPORT_SYMBOL(lprocfs_hash_seq_show);
 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
 {
        struct obd_device *obd = m->private;
+       struct target_distribute_txn_data *tdtd;
 
        LASSERT(obd != NULL);
 
@@ -578,7 +579,9 @@ int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
                seq_printf(m, "COMPLETE\n");
                seq_printf(m, "recovery_start: %lu\n", obd->obd_recovery_start);
                seq_printf(m, "recovery_duration: %lu\n",
-                          obd->obd_recovery_end - obd->obd_recovery_start);
+                          obd->obd_recovery_end ?
+                          obd->obd_recovery_end - obd->obd_recovery_start :
+                          cfs_time_current_sec() - obd->obd_recovery_start);
                /* Number of clients that have completed recovery */
                seq_printf(m, "completed_clients: %d/%d\n",
                           obd->obd_max_recoverable_clients -
@@ -586,7 +589,7 @@ int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
                           obd->obd_max_recoverable_clients);
                seq_printf(m, "replayed_requests: %d\n",
                           obd->obd_replayed_requests);
-               seq_printf(m, "last_transno: "LPD64"\n",
+               seq_printf(m, "last_transno: %lld\n",
                           obd->obd_next_recovery_transno - 1);
                seq_printf(m, "VBR: %s\n", obd->obd_version_recov ?
                           "ENABLED" : "DISABLED");
@@ -595,6 +598,33 @@ int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
                goto out;
        }
 
+       tdtd = obd->u.obt.obt_lut->lut_tdtd;
+       if (tdtd && tdtd->tdtd_show_update_logs_retrievers) {
+               char *buf;
+               int size = 0;
+               int count = 0;
+
+               buf = tdtd->tdtd_show_update_logs_retrievers(
+                       tdtd->tdtd_show_retrievers_cbdata,
+                       &size, &count);
+               if (count > 0) {
+                       seq_printf(m, "WAITING\n");
+                       seq_printf(m, "non-ready MDTs: %s\n",
+                                  buf ? buf : "unknown (not enough RAM)");
+                       seq_printf(m, "recovery_start: %lu\n",
+                                  obd->obd_recovery_start);
+                       seq_printf(m, "time_waited: %lu\n",
+                                  cfs_time_current_sec() -
+                                  obd->obd_recovery_start);
+               }
+
+               if (buf != NULL)
+                       OBD_FREE(buf, size);
+
+               if (likely(count > 0))
+                       return 0;
+       }
+
        seq_printf(m, "RECOVERING\n");
        seq_printf(m, "recovery_start: %lu\n", obd->obd_recovery_start);
        seq_printf(m, "time_remaining: %lu\n",
@@ -619,7 +649,7 @@ int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data)
        seq_printf(m, "replayed_requests: %d\n", obd->obd_replayed_requests);
        seq_printf(m, "queued_requests: %d\n",
                   obd->obd_requests_queued_for_recovery);
-       seq_printf(m, "next_transno: "LPD64"\n",
+       seq_printf(m, "next_transno: %lld\n",
                   obd->obd_next_recovery_transno);
 out:
        return 0;