Whamcloud - gitweb
LU-6409 nodemap: don't destroy nodemaps in cfs_hash_for_each
[fs/lustre-release.git] / lustre / ptlrpc / lproc_ptlrpc.c
index 08a2faa..a86b460 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -45,7 +45,7 @@
 #include "ptlrpc_internal.h"
 
 
-struct ll_rpc_opcode {
+static struct ll_rpc_opcode {
      __u32       opcode;
      const char *opname;
 } ll_rpc_opcode_table[LUSTRE_MAX_OPCODES] = {
@@ -139,7 +139,7 @@ struct ll_rpc_opcode {
        { LFSCK_QUERY,      "lfsck_query" },
 };
 
-struct ll_eopcode {
+static struct ll_eopcode {
      __u32       opcode;
      const char *opname;
 } ll_eopcode_table[EXTRA_LAST_OPC] = {
@@ -178,13 +178,14 @@ const char *ll_opcode2str(__u32 opcode)
         return ll_rpc_opcode_table[offset].opname;
 }
 
-const char* ll_eopcode2str(__u32 opcode)
+static const char *ll_eopcode2str(__u32 opcode)
 {
         LASSERT(ll_eopcode_table[opcode].opcode == opcode);
         return ll_eopcode_table[opcode].opname;
 }
-#ifdef LPROCFS
-void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
+
+#ifdef CONFIG_PROC_FS
+static void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
                              char *name, struct proc_dir_entry **procroot_ret,
                              struct lprocfs_stats **stats_ret)
 {
@@ -202,7 +203,7 @@ void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
                 return;
 
         if (dir) {
-               svc_procroot = lprocfs_seq_register(dir, root, NULL, NULL);
+               svc_procroot = lprocfs_register(dir, root, NULL, NULL);
                 if (IS_ERR(svc_procroot)) {
                         lprocfs_free_stats(&svc_stats);
                         return;
@@ -418,12 +419,6 @@ ptlrpc_lprocfs_threads_max_seq_write(struct file *file,
 LPROC_SEQ_FOPS(ptlrpc_lprocfs_threads_max);
 
 /**
- * \addtogoup nrs
- * @{
- */
-extern struct nrs_core nrs_core;
-
-/**
  * Translates \e ptlrpc_nrs_pol_state values to human-readable strings.
  *
  * \param[in] state The policy state
@@ -732,7 +727,7 @@ struct ptlrpc_srh_iterator {
        struct ptlrpc_request   *srhi_req;
 };
 
-int
+static int
 ptlrpc_lprocfs_svc_req_history_seek(struct ptlrpc_service_part *svcpt,
                                    struct ptlrpc_srh_iterator *srhi,
                                    __u64 seq)
@@ -947,27 +942,30 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)
 
        rc = ptlrpc_lprocfs_svc_req_history_seek(svcpt, srhi, srhi->srhi_seq);
 
-        if (rc == 0) {
-                req = srhi->srhi_req;
-
-                /* Print common req fields.
-                 * CAVEAT EMPTOR: we're racing with the service handler
-                 * here.  The request could contain any old crap, so you
-                 * must be just as careful as the service's request
-                 * parser. Currently I only print stuff here I know is OK
-                 * to look at coz it was set up in request_in_callback()!!! */
-                seq_printf(s, LPD64":%s:%s:x"LPU64":%d:%s:%ld:%lds(%+lds) ",
-                           req->rq_history_seq, libcfs_nid2str(req->rq_self),
-                           libcfs_id2str(req->rq_peer), req->rq_xid,
-                           req->rq_reqlen, ptlrpc_rqphase2str(req),
-                           req->rq_arrival_time.tv_sec,
-                           req->rq_sent - req->rq_arrival_time.tv_sec,
-                           req->rq_sent - req->rq_deadline);
+       if (rc == 0) {
+               char nidstr[LNET_NIDSTR_SIZE];
+
+               req = srhi->srhi_req;
+
+               libcfs_nid2str_r(req->rq_self, nidstr, sizeof(nidstr));
+               /* Print common req fields.
+                * CAVEAT EMPTOR: we're racing with the service handler
+                * here.  The request could contain any old crap, so you
+                * must be just as careful as the service's request
+                * parser. Currently I only print stuff here I know is OK
+                * to look at coz it was set up in request_in_callback()!!! */
+               seq_printf(s, LPD64":%s:%s:x"LPU64":%d:%s:%ld:%lds(%+lds) ",
+                          req->rq_history_seq, nidstr,
+                          libcfs_id2str(req->rq_peer), req->rq_xid,
+                          req->rq_reqlen, ptlrpc_rqphase2str(req),
+                          req->rq_arrival_time.tv_sec,
+                          req->rq_sent - req->rq_arrival_time.tv_sec,
+                          req->rq_sent - req->rq_deadline);
                if (svc->srv_ops.so_req_printer == NULL)
                        seq_printf(s, "\n");
                else
                        svc->srv_ops.so_req_printer(s, srhi->srhi_req);
-        }
+       }
 
        spin_unlock(&svcpt->scp_lock);
        return rc;
@@ -985,7 +983,10 @@ ptlrpc_lprocfs_svc_req_history_open(struct inode *inode, struct file *file)
        struct seq_file *seqf;
        int             rc;
 
-       LPROCFS_ENTRY_CHECK(PDE(inode));
+       rc = LPROCFS_ENTRY_CHECK(inode);
+       if (rc < 0)
+               return rc;
+
        rc = seq_open(file, &sops);
        if (rc)
                return rc;
@@ -1022,7 +1023,7 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n)
                           DHMS_FMT" ago) ", "service",
                           cur, worst, worstt, DHMS_VARS(&ts));
 
-               lprocfs_seq_at_hist_helper(m, &svcpt->scp_at_estimate);
+               lprocfs_at_hist_helper(m, &svcpt->scp_at_estimate);
        }
 
        return 0;
@@ -1062,7 +1063,7 @@ LPROC_SEQ_FOPS(ptlrpc_lprocfs_hp_ratio);
 void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
                                      struct ptlrpc_service *svc)
 {
-       struct lprocfs_seq_vars lproc_vars[] = {
+       struct lprocfs_vars lproc_vars[] = {
                { .name = "high_priority_ratio",
                  .fops = &ptlrpc_lprocfs_hp_ratio_fops,
                  .data = svc },
@@ -1105,7 +1106,7 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
        if (svc->srv_procroot == NULL)
                return;
 
-       lprocfs_seq_add_vars(svc->srv_procroot, lproc_vars, NULL);
+       lprocfs_add_vars(svc->srv_procroot, lproc_vars, NULL);
 
        rc = lprocfs_seq_create(svc->srv_procroot, "req_history",
                                0400, &req_history_fops, svc);
@@ -1316,4 +1317,4 @@ lprocfs_pinger_recov_seq_write(struct file *file, const char *buffer,
 }
 EXPORT_SYMBOL(lprocfs_pinger_recov_seq_write);
 
-#endif /* LPROCFS */
+#endif /* CONFIG_PROC_FS */