Whamcloud - gitweb
LU-8066 ldlm: move all remaining files from procfs to debugfs
[fs/lustre-release.git] / lustre / ptlrpc / nrs_orr.c
index 6b6caea..85fc3a3 100644 (file)
@@ -1160,11 +1160,9 @@ static void nrs_orr_req_stop(struct ptlrpc_nrs_policy *policy,
 }
 
 /**
- * lprocfs interface
+ * debugfs interface
  */
 
-#ifdef CONFIG_PROC_FS
-
 /**
  * This allows to bundle the policy name into the lprocfs_vars::data pointer
  * so that lprocfs read/write functions can be used by both the ORR and TRR
@@ -1386,7 +1384,8 @@ ptlrpc_lprocfs_nrs_orr_quantum_seq_write(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_quantum);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_quantum);
 
 #define LPROCFS_NRS_OFF_NAME_REG               "reg_offset_type:"
 #define LPROCFS_NRS_OFF_NAME_HP                        "hp_offset_type:"
@@ -1606,7 +1605,8 @@ ptlrpc_lprocfs_nrs_orr_offset_type_seq_write(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_offset_type);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_offset_type);
 
 #define NRS_LPROCFS_REQ_SUPP_NAME_REG          "reg_supported:"
 #define NRS_LPROCFS_REQ_SUPP_NAME_HP           "hp_supported:"
@@ -1857,7 +1857,8 @@ ptlrpc_lprocfs_nrs_orr_supported_seq_write(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported);
 
 static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
 {
@@ -1873,7 +1874,7 @@ static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
                { NULL }
        };
 
-       if (svc->srv_procroot == NULL)
+       if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
                return 0;
 
        lprocfs_orr_data.svc = svc;
@@ -1881,21 +1882,10 @@ static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
        for (i = 0; i < ARRAY_SIZE(nrs_orr_lprocfs_vars); i++)
                nrs_orr_lprocfs_vars[i].data = &lprocfs_orr_data;
 
-       return lprocfs_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL);
-}
-
-static void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc)
-{
-       if (svc->srv_procroot == NULL)
-               return;
-
-       lprocfs_remove_proc_entry("nrs_orr_quantum", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_orr_offset_type", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_orr_supported", svc->srv_procroot);
+       return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_orr_lprocfs_vars,
+                                NULL);
 }
 
-#endif /* CONFIG_PROC_FS */
-
 static const struct ptlrpc_nrs_pol_ops nrs_orr_ops = {
        .op_policy_init         = nrs_orr_init,
        .op_policy_start        = nrs_orr_start,
@@ -1907,10 +1897,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_orr_ops = {
        .op_req_enqueue         = nrs_orr_req_add,
        .op_req_dequeue         = nrs_orr_req_del,
        .op_req_stop            = nrs_orr_req_stop,
-#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_orr_lprocfs_init,
-       .op_lprocfs_fini        = nrs_orr_lprocfs_fini,
-#endif
 };
 
 struct ptlrpc_nrs_pol_conf nrs_conf_orr = {
@@ -1925,9 +1912,6 @@ struct ptlrpc_nrs_pol_conf nrs_conf_orr = {
  *
  * TRR reuses much of the functions and data structures of ORR
  */
-
-#ifdef CONFIG_PROC_FS
-
 static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
 {
        int     i;
@@ -1942,7 +1926,7 @@ static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
                { NULL }
        };
 
-       if (svc->srv_procroot == NULL)
+       if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
                return 0;
 
        lprocfs_trr_data.svc = svc;
@@ -1950,21 +1934,10 @@ static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
        for (i = 0; i < ARRAY_SIZE(nrs_trr_lprocfs_vars); i++)
                nrs_trr_lprocfs_vars[i].data = &lprocfs_trr_data;
 
-       return lprocfs_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL);
+       return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_trr_lprocfs_vars,
+                                NULL);
 }
 
-static void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc)
-{
-       if (svc->srv_procroot == NULL)
-               return;
-
-       lprocfs_remove_proc_entry("nrs_trr_quantum", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_trr_offset_type", svc->srv_procroot);
-       lprocfs_remove_proc_entry("nrs_trr_supported", svc->srv_procroot);
-}
-
-#endif /* CONFIG_PROC_FS */
-
 /**
  * Reuse much of the ORR functionality for TRR.
  */
@@ -1979,10 +1952,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_trr_ops = {
        .op_req_enqueue         = nrs_orr_req_add,
        .op_req_dequeue         = nrs_orr_req_del,
        .op_req_stop            = nrs_orr_req_stop,
-#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_trr_lprocfs_init,
-       .op_lprocfs_fini        = nrs_trr_lprocfs_fini,
-#endif
 };
 
 struct ptlrpc_nrs_pol_conf nrs_conf_trr = {