Whamcloud - gitweb
LU-6496 ptlrpc: Fix wrong code indentation in plain_authorize
[fs/lustre-release.git] / lustre / ptlrpc / nrs_orr.c
index 3753fb9..9b8ad5d 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2013, Intel Corporation.
+ * Copyright (c) 2013, 2014, Intel Corporation.
  *
  * Copyright 2012 Xyratex Technology Limited
  */
@@ -196,9 +196,9 @@ static void nrs_orr_range_fill_logical(struct niobuf_remote *nb, int niocount,
                                       struct nrs_orr_req_range *range)
 {
        /* Should we do this at page boundaries ? */
-       range->or_start = nb[0].offset & CFS_PAGE_MASK;
-       range->or_end = (nb[niocount - 1].offset +
-                        nb[niocount - 1].len - 1) | ~CFS_PAGE_MASK;
+       range->or_start = nb[0].rnb_offset & PAGE_MASK;
+       range->or_end = (nb[niocount - 1].rnb_offset +
+                        nb[niocount - 1].rnb_len - 1) | ~PAGE_MASK;
 }
 
 /**
@@ -389,17 +389,17 @@ static unsigned nrs_orr_hop_hash(cfs_hash_t *hs, const void *key, unsigned mask)
        return cfs_hash_djb2_hash(key, sizeof(struct nrs_orr_key), mask);
 }
 
-static void *nrs_orr_hop_key(cfs_hlist_node_t *hnode)
+static void *nrs_orr_hop_key(struct hlist_node *hnode)
 {
-       struct nrs_orr_object *orro = cfs_hlist_entry(hnode,
+       struct nrs_orr_object *orro = hlist_entry(hnode,
                                                      struct nrs_orr_object,
                                                      oo_hnode);
        return &orro->oo_key;
 }
 
-static int nrs_orr_hop_keycmp(const void *key, cfs_hlist_node_t *hnode)
+static int nrs_orr_hop_keycmp(const void *key, struct hlist_node *hnode)
 {
-       struct nrs_orr_object *orro = cfs_hlist_entry(hnode,
+       struct nrs_orr_object *orro = hlist_entry(hnode,
                                                      struct nrs_orr_object,
                                                      oo_hnode);
 
@@ -407,14 +407,14 @@ static int nrs_orr_hop_keycmp(const void *key, cfs_hlist_node_t *hnode)
                         &((struct nrs_orr_key *)key)->ok_fid);
 }
 
-static void *nrs_orr_hop_object(cfs_hlist_node_t *hnode)
+static void *nrs_orr_hop_object(struct hlist_node *hnode)
 {
-       return cfs_hlist_entry(hnode, struct nrs_orr_object, oo_hnode);
+       return hlist_entry(hnode, struct nrs_orr_object, oo_hnode);
 }
 
-static void nrs_orr_hop_get(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+static void nrs_orr_hop_get(cfs_hash_t *hs, struct hlist_node *hnode)
 {
-       struct nrs_orr_object *orro = cfs_hlist_entry(hnode,
+       struct nrs_orr_object *orro = hlist_entry(hnode,
                                                      struct nrs_orr_object,
                                                      oo_hnode);
        orro->oo_ref++;
@@ -424,9 +424,9 @@ static void nrs_orr_hop_get(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
  * Removes an nrs_orr_object the hash and frees its memory, if the object has
  * no active users.
  */
-static void nrs_orr_hop_put_free(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+static void nrs_orr_hop_put_free(cfs_hash_t *hs, struct hlist_node *hnode)
 {
-       struct nrs_orr_object *orro = cfs_hlist_entry(hnode,
+       struct nrs_orr_object *orro = hlist_entry(hnode,
                                                      struct nrs_orr_object,
                                                      oo_hnode);
        struct nrs_orr_data   *orrd = container_of(orro->oo_res.res_parent,
@@ -448,26 +448,26 @@ static void nrs_orr_hop_put_free(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
        OBD_SLAB_FREE_PTR(orro, orrd->od_cache);
 }
 
-static void nrs_orr_hop_put(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+static void nrs_orr_hop_put(cfs_hash_t *hs, struct hlist_node *hnode)
 {
-       struct nrs_orr_object *orro = cfs_hlist_entry(hnode,
+       struct nrs_orr_object *orro = hlist_entry(hnode,
                                                      struct nrs_orr_object,
                                                      oo_hnode);
        orro->oo_ref--;
 }
 
-static int nrs_trr_hop_keycmp(const void *key, cfs_hlist_node_t *hnode)
+static int nrs_trr_hop_keycmp(const void *key, struct hlist_node *hnode)
 {
-       struct nrs_orr_object *orro = cfs_hlist_entry(hnode,
+       struct nrs_orr_object *orro = hlist_entry(hnode,
                                                      struct nrs_orr_object,
                                                      oo_hnode);
 
        return orro->oo_key.ok_idx == ((struct nrs_orr_key *)key)->ok_idx;
 }
 
-static void nrs_trr_hop_exit(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+static void nrs_trr_hop_exit(cfs_hash_t *hs, struct hlist_node *hnode)
 {
-       struct nrs_orr_object *orro = cfs_hlist_entry(hnode,
+       struct nrs_orr_object *orro = hlist_entry(hnode,
                                                      struct nrs_orr_object,
                                                      oo_hnode);
        struct nrs_orr_data   *orrd = container_of(orro->oo_res.res_parent,
@@ -609,7 +609,7 @@ static int nrs_orr_init(struct ptlrpc_nrs_policy *policy)
  * \retval -ENOMEM OOM error
  * \retval 0      success
  */
-static int nrs_orr_start(struct ptlrpc_nrs_policy *policy)
+static int nrs_orr_start(struct ptlrpc_nrs_policy *policy, char *arg)
 {
        struct nrs_orr_data    *orrd;
        cfs_hash_ops_t         *ops;
@@ -735,16 +735,16 @@ static void nrs_orr_stop(struct ptlrpc_nrs_policy *policy)
  * \param[in]    opc    the opcode
  * \param[in,out] arg   used for passing parameters and information
  *
- * \pre spin_is_locked(&policy->pol_nrs->->nrs_lock)
- * \post spin_is_locked(&policy->pol_nrs->->nrs_lock)
+ * \pre assert_spin_locked(&policy->pol_nrs->->nrs_lock)
+ * \post assert_spin_locked(&policy->pol_nrs->->nrs_lock)
  *
  * \retval 0   operation carried successfully
  * \retval -ve error
  */
-int nrs_orr_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc,
-               void *arg)
+static int nrs_orr_ctl(struct ptlrpc_nrs_policy *policy,
+                      enum ptlrpc_nrs_ctl opc, void *arg)
 {
-       LASSERT(spin_is_locked(&policy->pol_nrs->nrs_lock));
+       assert_spin_locked(&policy->pol_nrs->nrs_lock);
 
        switch((enum nrs_ctl_orr)opc) {
        default:
@@ -819,10 +819,10 @@ int nrs_orr_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc,
  *
  * \see nrs_resource_get_safe()
  */
-int nrs_orr_res_get(struct ptlrpc_nrs_policy *policy,
-                   struct ptlrpc_nrs_request *nrq,
-                   const struct ptlrpc_nrs_resource *parent,
-                   struct ptlrpc_nrs_resource **resp, bool moving_req)
+static int nrs_orr_res_get(struct ptlrpc_nrs_policy *policy,
+                          struct ptlrpc_nrs_request *nrq,
+                          const struct ptlrpc_nrs_resource *parent,
+                          struct ptlrpc_nrs_resource **resp, bool moving_req)
 {
        struct nrs_orr_data            *orrd;
        struct nrs_orr_object          *orro;
@@ -869,7 +869,7 @@ int nrs_orr_res_get(struct ptlrpc_nrs_policy *policy,
 
        OBD_SLAB_CPT_ALLOC_PTR_GFP(orro, orrd->od_cache,
                                   nrs_pol2cptab(policy), nrs_pol2cptid(policy),
-                                  moving_req ? GFP_ATOMIC : __GFP_IO);
+                                  moving_req ? GFP_ATOMIC : GFP_NOFS);
        if (orro == NULL)
                RETURN(-ENOMEM);
 
@@ -1161,14 +1161,14 @@ static void nrs_orr_req_stop(struct ptlrpc_nrs_policy *policy,
  * lprocfs interface
  */
 
-#ifdef LPROCFS
+#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
  * policies.
  */
-struct nrs_lprocfs_orr_data {
+static struct nrs_lprocfs_orr_data {
        struct ptlrpc_service   *svc;
        char                    *name;
 } lprocfs_orr_data = {
@@ -1194,15 +1194,13 @@ struct nrs_lprocfs_orr_data {
  * XXX: the CRR-N version of this, ptlrpc_lprocfs_rd_nrs_crrn_quantum() is
  * almost identical; it can be reworked and then reused for ORR/TRR.
  */
-static int ptlrpc_lprocfs_rd_nrs_orr_quantum(char *page, char **start,
-                                            off_t off, int count, int *eof,
-                                            void *data)
+static int
+ptlrpc_lprocfs_nrs_orr_quantum_seq_show(struct seq_file *m, void *data)
 {
-       struct nrs_lprocfs_orr_data *orr_data = data;
+       struct nrs_lprocfs_orr_data *orr_data = m->private;
        struct ptlrpc_service       *svc = orr_data->svc;
        __u16                        quantum;
        int                          rc;
-       int                          rc2 = 0;
 
        /**
         * Perform two separate calls to this as only one of the NRS heads'
@@ -1214,9 +1212,7 @@ static int ptlrpc_lprocfs_rd_nrs_orr_quantum(char *page, char **start,
                                       NRS_CTL_ORR_RD_QUANTUM,
                                       true, &quantum);
        if (rc == 0) {
-               *eof = 1;
-               rc2 = snprintf(page, count, NRS_LPROCFS_QUANTUM_NAME_REG
-                              "%-5d\n", quantum);
+               seq_printf(m, NRS_LPROCFS_QUANTUM_NAME_REG "%-5d\n", quantum);
                /**
                 * Ignore -ENODEV as the regular NRS head's policy may be in the
                 * ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state.
@@ -1237,9 +1233,7 @@ static int ptlrpc_lprocfs_rd_nrs_orr_quantum(char *page, char **start,
                                       orr_data->name, NRS_CTL_ORR_RD_QUANTUM,
                                       true, &quantum);
        if (rc == 0) {
-               *eof = 1;
-               rc2 += snprintf(page + rc2, count - rc2,
-                               NRS_LPROCFS_QUANTUM_NAME_HP"%-5d\n", quantum);
+               seq_printf(m, NRS_LPROCFS_QUANTUM_NAME_HP"%-5d\n", quantum);
                /**
                 * Ignore -ENODEV as the high priority NRS head's policy may be
                 * in the ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state.
@@ -1250,7 +1244,7 @@ static int ptlrpc_lprocfs_rd_nrs_orr_quantum(char *page, char **start,
 
 no_hp:
 
-       return rc2 ? : rc;
+       return rc;
 }
 
 /**
@@ -1279,11 +1273,12 @@ no_hp:
  * XXX: the CRR-N version of this, ptlrpc_lprocfs_wr_nrs_crrn_quantum() is
  * almost identical; it can be reworked and then reused for ORR/TRR.
  */
-static int ptlrpc_lprocfs_wr_nrs_orr_quantum(struct file *file,
-                                            const char *buffer,
-                                            unsigned long count, void *data)
+static ssize_t
+ptlrpc_lprocfs_nrs_orr_quantum_seq_write(struct file *file, const char *buffer,
+                                        size_t count, loff_t *off)
 {
-       struct nrs_lprocfs_orr_data *orr_data = data;
+       struct seq_file             *m = file->private_data;
+       struct nrs_lprocfs_orr_data *orr_data = m->private;
        struct ptlrpc_service       *svc = orr_data->svc;
        enum ptlrpc_nrs_queue_type   queue = 0;
        char                         kernbuf[LPROCFS_NRS_WR_QUANTUM_MAX_CMD];
@@ -1388,6 +1383,7 @@ static int ptlrpc_lprocfs_wr_nrs_orr_quantum(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
+LPROC_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:"
@@ -1409,15 +1405,13 @@ static int ptlrpc_lprocfs_wr_nrs_orr_quantum(struct file *file,
  *     reg_offset_type:physical
  *     hp_offset_type:logical
  */
-static int ptlrpc_lprocfs_rd_nrs_orr_offset_type(char *page, char **start,
-                                                off_t off, int count, int *eof,
-                                                void *data)
+static int
+ptlrpc_lprocfs_nrs_orr_offset_type_seq_show(struct seq_file *m, void *data)
 {
-       struct nrs_lprocfs_orr_data *orr_data = data;
+       struct nrs_lprocfs_orr_data *orr_data = m->private;
        struct ptlrpc_service       *svc = orr_data->svc;
        bool                         physical;
        int                          rc;
-       int                          rc2 = 0;
 
        /**
         * Perform two separate calls to this as only one of the NRS heads'
@@ -1428,11 +1422,9 @@ static int ptlrpc_lprocfs_rd_nrs_orr_offset_type(char *page, char **start,
                                       orr_data->name, NRS_CTL_ORR_RD_OFF_TYPE,
                                       true, &physical);
        if (rc == 0) {
-               *eof = 1;
-               rc2 = snprintf(page, count,
-                              LPROCFS_NRS_OFF_NAME_REG"%s\n",
-                              physical ? LPROCFS_NRS_OFF_NAME_PHYSICAL :
-                              LPROCFS_NRS_OFF_NAME_LOGICAL);
+               seq_printf(m, LPROCFS_NRS_OFF_NAME_REG"%s\n",
+                          physical ? LPROCFS_NRS_OFF_NAME_PHYSICAL :
+                          LPROCFS_NRS_OFF_NAME_LOGICAL);
                /**
                 * Ignore -ENODEV as the regular NRS head's policy may be in the
                 * ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state.
@@ -1453,11 +1445,9 @@ static int ptlrpc_lprocfs_rd_nrs_orr_offset_type(char *page, char **start,
                                       orr_data->name, NRS_CTL_ORR_RD_OFF_TYPE,
                                       true, &physical);
        if (rc == 0) {
-               *eof = 1;
-               rc2 += snprintf(page + rc2, count - rc2,
-                               LPROCFS_NRS_OFF_NAME_HP"%s\n",
-                               physical ? LPROCFS_NRS_OFF_NAME_PHYSICAL :
-                               LPROCFS_NRS_OFF_NAME_LOGICAL);
+               seq_printf(m, LPROCFS_NRS_OFF_NAME_HP"%s\n",
+                          physical ? LPROCFS_NRS_OFF_NAME_PHYSICAL :
+                          LPROCFS_NRS_OFF_NAME_LOGICAL);
                /**
                 * Ignore -ENODEV as the high priority NRS head's policy may be
                 * in the ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state.
@@ -1467,8 +1457,7 @@ static int ptlrpc_lprocfs_rd_nrs_orr_offset_type(char *page, char **start,
        }
 
 no_hp:
-
-       return rc2 ? : rc;
+       return rc;
 }
 
 /**
@@ -1497,12 +1486,13 @@ no_hp:
  * policy instances in the ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state are
  * are skipped later by nrs_orr_ctl().
  */
-static int ptlrpc_lprocfs_wr_nrs_orr_offset_type(struct file *file,
-                                                const char *buffer,
-                                                unsigned long count,
-                                                void *data)
+static ssize_t
+ptlrpc_lprocfs_nrs_orr_offset_type_seq_write(struct file *file,
+                                            const char *buffer, size_t count,
+                                            loff_t *off)
 {
-       struct nrs_lprocfs_orr_data *orr_data = data;
+       struct seq_file             *m = file->private_data;
+       struct nrs_lprocfs_orr_data *orr_data = m->private;
        struct ptlrpc_service       *svc = orr_data->svc;
        enum ptlrpc_nrs_queue_type   queue = 0;
        char                         kernbuf[LPROCFS_NRS_WR_OFF_TYPE_MAX_CMD];
@@ -1612,6 +1602,7 @@ static int ptlrpc_lprocfs_wr_nrs_orr_offset_type(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
+LPROC_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:"
@@ -1670,15 +1661,13 @@ static enum nrs_orr_supp nrs_orr_str2supp(const char *val)
  *     reg_supported:reads
  *     hp_supported:reads_and_writes
  */
-static int ptlrpc_lprocfs_rd_nrs_orr_supported(char *page, char **start,
-                                              off_t off, int count, int *eof,
-                                              void *data)
+static int
+ptlrpc_lprocfs_nrs_orr_supported_seq_show(struct seq_file *m, void *data)
 {
-       struct nrs_lprocfs_orr_data *orr_data = data;
+       struct nrs_lprocfs_orr_data *orr_data = m->private;
        struct ptlrpc_service       *svc = orr_data->svc;
        enum nrs_orr_supp            supported;
        int                          rc;
-       int                          rc2 = 0;
 
        /**
         * Perform two separate calls to this as only one of the NRS heads'
@@ -1691,10 +1680,8 @@ static int ptlrpc_lprocfs_rd_nrs_orr_supported(char *page, char **start,
                                       &supported);
 
        if (rc == 0) {
-               *eof = 1;
-               rc2 = snprintf(page, count,
-                              NRS_LPROCFS_REQ_SUPP_NAME_REG"%s\n",
-                              nrs_orr_supp2str(supported));
+               seq_printf(m, NRS_LPROCFS_REQ_SUPP_NAME_REG"%s\n",
+                          nrs_orr_supp2str(supported));
                /**
                 * Ignore -ENODEV as the regular NRS head's policy may be in the
                 * ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state.
@@ -1716,10 +1703,8 @@ static int ptlrpc_lprocfs_rd_nrs_orr_supported(char *page, char **start,
                                       NRS_CTL_ORR_RD_SUPP_REQ, true,
                                       &supported);
        if (rc == 0) {
-               *eof = 1;
-               rc2 += snprintf(page + rc2, count - rc2,
-                              NRS_LPROCFS_REQ_SUPP_NAME_HP"%s\n",
-                              nrs_orr_supp2str(supported));
+               seq_printf(m, NRS_LPROCFS_REQ_SUPP_NAME_HP"%s\n",
+                          nrs_orr_supp2str(supported));
                /**
                 * Ignore -ENODEV as the high priority NRS head's policy may be
                 * in the ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state.
@@ -1730,7 +1715,7 @@ static int ptlrpc_lprocfs_rd_nrs_orr_supported(char *page, char **start,
 
 no_hp:
 
-       return rc2 ? : rc;
+       return rc;
 }
 
 /**
@@ -1760,11 +1745,13 @@ no_hp:
  * policy instances in the ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state are
  * are skipped later by nrs_orr_ctl().
  */
-static int ptlrpc_lprocfs_wr_nrs_orr_supported(struct file *file,
-                                              const char *buffer,
-                                              unsigned long count, void *data)
+static ssize_t
+ptlrpc_lprocfs_nrs_orr_supported_seq_write(struct file *file,
+                                          const char *buffer, size_t count,
+                                          loff_t *off)
 {
-       struct nrs_lprocfs_orr_data *orr_data = data;
+       struct seq_file             *m = file->private_data;
+       struct nrs_lprocfs_orr_data *orr_data = m->private;
        struct ptlrpc_service       *svc = orr_data->svc;
        enum ptlrpc_nrs_queue_type   queue = 0;
        char                         kernbuf[LPROCFS_NRS_WR_REQ_SUPP_MAX_CMD];
@@ -1865,22 +1852,19 @@ static int ptlrpc_lprocfs_wr_nrs_orr_supported(struct file *file,
 
        return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
 }
+LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported);
 
-int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
+static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
 {
-       int     rc;
        int     i;
 
        struct lprocfs_vars nrs_orr_lprocfs_vars[] = {
                { .name         = "nrs_orr_quantum",
-                 .read_fptr    = ptlrpc_lprocfs_rd_nrs_orr_quantum,
-                 .write_fptr   = ptlrpc_lprocfs_wr_nrs_orr_quantum },
+                 .fops         = &ptlrpc_lprocfs_nrs_orr_quantum_fops  },
                { .name         = "nrs_orr_offset_type",
-                 .read_fptr    = ptlrpc_lprocfs_rd_nrs_orr_offset_type,
-                 .write_fptr   = ptlrpc_lprocfs_wr_nrs_orr_offset_type },
+                 .fops         = &ptlrpc_lprocfs_nrs_orr_offset_type_fops },
                { .name         = "nrs_orr_supported",
-                 .read_fptr    = ptlrpc_lprocfs_rd_nrs_orr_supported,
-                 .write_fptr   = ptlrpc_lprocfs_wr_nrs_orr_supported },
+                 .fops         = &ptlrpc_lprocfs_nrs_orr_supported_fops },
                { NULL }
        };
 
@@ -1892,12 +1876,10 @@ 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;
 
-       rc = lprocfs_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL);
-
-       return rc;
+       return lprocfs_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL);
 }
 
-void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc)
+static void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc)
 {
        if (svc->srv_procroot == NULL)
                return;
@@ -1907,7 +1889,7 @@ void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc)
        lprocfs_remove_proc_entry("nrs_orr_supported", svc->srv_procroot);
 }
 
-#endif /* LPROCFS */
+#endif /* CONFIG_PROC_FS */
 
 static const struct ptlrpc_nrs_pol_ops nrs_orr_ops = {
        .op_policy_init         = nrs_orr_init,
@@ -1920,7 +1902,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 LPROCFS
+#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_orr_lprocfs_init,
        .op_lprocfs_fini        = nrs_orr_lprocfs_fini,
 #endif
@@ -1939,23 +1921,19 @@ struct ptlrpc_nrs_pol_conf nrs_conf_orr = {
  * TRR reuses much of the functions and data structures of ORR
  */
 
-#ifdef LPROCFS
+#ifdef CONFIG_PROC_FS
 
-int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
+static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
 {
-       int     rc;
        int     i;
 
        struct lprocfs_vars nrs_trr_lprocfs_vars[] = {
                { .name         = "nrs_trr_quantum",
-                 .read_fptr    = ptlrpc_lprocfs_rd_nrs_orr_quantum,
-                 .write_fptr   = ptlrpc_lprocfs_wr_nrs_orr_quantum },
+                 .fops         = &ptlrpc_lprocfs_nrs_orr_quantum_fops },
                { .name         = "nrs_trr_offset_type",
-                 .read_fptr    = ptlrpc_lprocfs_rd_nrs_orr_offset_type,
-                 .write_fptr   = ptlrpc_lprocfs_wr_nrs_orr_offset_type },
+                 .fops         = &ptlrpc_lprocfs_nrs_orr_offset_type_fops },
                { .name         = "nrs_trr_supported",
-                 .read_fptr    = ptlrpc_lprocfs_rd_nrs_orr_supported,
-                 .write_fptr   = ptlrpc_lprocfs_wr_nrs_orr_supported },
+                 .fops         = &ptlrpc_lprocfs_nrs_orr_supported_fops },
                { NULL }
        };
 
@@ -1967,12 +1945,10 @@ 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;
 
-       rc = lprocfs_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL);
-
-       return rc;
+       return lprocfs_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL);
 }
 
-void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc)
+static void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc)
 {
        if (svc->srv_procroot == NULL)
                return;
@@ -1982,7 +1958,7 @@ void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc)
        lprocfs_remove_proc_entry("nrs_trr_supported", svc->srv_procroot);
 }
 
-#endif /* LPROCFS */
+#endif /* CONFIG_PROC_FS */
 
 /**
  * Reuse much of the ORR functionality for TRR.
@@ -1998,7 +1974,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 LPROCFS
+#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_trr_lprocfs_init,
        .op_lprocfs_fini        = nrs_trr_lprocfs_fini,
 #endif