Whamcloud - gitweb
LU-6496 ptlrpc: Fix wrong code indentation in plain_authorize
[fs/lustre-release.git] / lustre / ptlrpc / nrs_crr.c
index 53a3fbc..fa36c5a 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2011 Intel Corporation
+ * Copyright (c) 2011, 2014, Intel Corporation.
  *
  * Copyright 2012 Xyratex Technology Limited
  */
@@ -41,9 +41,6 @@
 #ifdef HAVE_SERVER_SUPPORT
 
 #define DEBUG_SUBSYSTEM S_RPC
-#ifndef __KERNEL__
-#include <liblustre.h>
-#endif
 #include <obd_support.h>
 #include <obd_class.h>
 #include <lustre_net.h>
@@ -112,47 +109,47 @@ static unsigned nrs_crrn_hop_hash(cfs_hash_t *hs, const void *key,
        return cfs_hash_djb2_hash(key, sizeof(lnet_nid_t), mask);
 }
 
-static int nrs_crrn_hop_keycmp(const void *key, cfs_hlist_node_t *hnode)
+static int nrs_crrn_hop_keycmp(const void *key, struct hlist_node *hnode)
 {
        lnet_nid_t              *nid = (lnet_nid_t *)key;
-       struct nrs_crrn_client  *cli = cfs_hlist_entry(hnode,
+       struct nrs_crrn_client  *cli = hlist_entry(hnode,
                                                       struct nrs_crrn_client,
                                                       cc_hnode);
        return *nid == cli->cc_nid;
 }
 
-static void *nrs_crrn_hop_key(cfs_hlist_node_t *hnode)
+static void *nrs_crrn_hop_key(struct hlist_node *hnode)
 {
-       struct nrs_crrn_client  *cli = cfs_hlist_entry(hnode,
+       struct nrs_crrn_client  *cli = hlist_entry(hnode,
                                                       struct nrs_crrn_client,
                                                       cc_hnode);
        return &cli->cc_nid;
 }
 
-static void *nrs_crrn_hop_object(cfs_hlist_node_t *hnode)
+static void *nrs_crrn_hop_object(struct hlist_node *hnode)
 {
-       return cfs_hlist_entry(hnode, struct nrs_crrn_client, cc_hnode);
+       return hlist_entry(hnode, struct nrs_crrn_client, cc_hnode);
 }
 
-static void nrs_crrn_hop_get(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+static void nrs_crrn_hop_get(cfs_hash_t *hs, struct hlist_node *hnode)
 {
-       struct nrs_crrn_client *cli = cfs_hlist_entry(hnode,
+       struct nrs_crrn_client *cli = hlist_entry(hnode,
                                                      struct nrs_crrn_client,
                                                      cc_hnode);
        atomic_inc(&cli->cc_ref);
 }
 
-static void nrs_crrn_hop_put(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+static void nrs_crrn_hop_put(cfs_hash_t *hs, struct hlist_node *hnode)
 {
-       struct nrs_crrn_client  *cli = cfs_hlist_entry(hnode,
+       struct nrs_crrn_client  *cli = hlist_entry(hnode,
                                                       struct nrs_crrn_client,
                                                       cc_hnode);
        atomic_dec(&cli->cc_ref);
 }
 
-static void nrs_crrn_hop_exit(cfs_hash_t *hs, cfs_hlist_node_t *hnode)
+static void nrs_crrn_hop_exit(cfs_hash_t *hs, struct hlist_node *hnode)
 {
-       struct nrs_crrn_client  *cli = cfs_hlist_entry(hnode,
+       struct nrs_crrn_client  *cli = hlist_entry(hnode,
                                                       struct nrs_crrn_client,
                                                       cc_hnode);
        LASSERTF(atomic_read(&cli->cc_ref) == 0,
@@ -214,7 +211,7 @@ static int nrs_crrn_start(struct ptlrpc_nrs_policy *policy, char *arg)
         * with the default max_rpcs_in_flight value, as we are scheduling over
         * NIDs, and there may be more than one mount point per client.
         */
-       net->cn_quantum = OSC_MAX_RIF_DEFAULT;
+       net->cn_quantum = OBD_MAX_RIF_DEFAULT;
        /**
         * Set to 1 so that the test inside nrs_crrn_req_add() can evaluate to
         * true.
@@ -273,8 +270,9 @@ static void nrs_crrn_stop(struct ptlrpc_nrs_policy *policy)
  * \retval 0   operation carried out successfully
  * \retval -ve error
  */
-int nrs_crrn_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc,
-                void *arg)
+static int nrs_crrn_ctl(struct ptlrpc_nrs_policy *policy,
+                       enum ptlrpc_nrs_ctl opc,
+                       void *arg)
 {
        assert_spin_locked(&policy->pol_nrs->nrs_lock);
 
@@ -329,10 +327,10 @@ int nrs_crrn_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc,
  *
  * \see nrs_resource_get_safe()
  */
-int nrs_crrn_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_crrn_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_crrn_net     *net;
        struct nrs_crrn_client  *cli;
@@ -612,7 +610,7 @@ static void nrs_crrn_req_stop(struct ptlrpc_nrs_policy *policy,
               libcfs_id2str(req->rq_peer), nrq->nr_u.crr.cr_round);
 }
 
-#ifdef LPROCFS
+#ifdef CONFIG_PROC_FS
 
 /**
  * lprocfs interface
@@ -819,9 +817,9 @@ LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_crrn_quantum);
  * \retval 0   success
  * \retval != 0        error
  */
-int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc)
+static int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc)
 {
-       struct lprocfs_seq_vars nrs_crrn_lprocfs_vars[] = {
+       struct lprocfs_vars nrs_crrn_lprocfs_vars[] = {
                { .name         = "nrs_crrn_quantum",
                  .fops         = &ptlrpc_lprocfs_nrs_crrn_quantum_fops,
                  .data = svc },
@@ -831,8 +829,7 @@ int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc)
        if (svc->srv_procroot == NULL)
                return 0;
 
-       return lprocfs_seq_add_vars(svc->srv_procroot, nrs_crrn_lprocfs_vars,
-                                   NULL);
+       return lprocfs_add_vars(svc->srv_procroot, nrs_crrn_lprocfs_vars, NULL);
 }
 
 /**
@@ -840,7 +837,7 @@ int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc)
  *
  * \param[in] svc the service
  */
-void nrs_crrn_lprocfs_fini(struct ptlrpc_service *svc)
+static void nrs_crrn_lprocfs_fini(struct ptlrpc_service *svc)
 {
        if (svc->srv_procroot == NULL)
                return;
@@ -848,7 +845,7 @@ void nrs_crrn_lprocfs_fini(struct ptlrpc_service *svc)
        lprocfs_remove_proc_entry("nrs_crrn_quantum", svc->srv_procroot);
 }
 
-#endif /* LPROCFS */
+#endif /* CONFIG_PROC_FS */
 
 /**
  * CRR-N policy operations
@@ -863,7 +860,7 @@ static const struct ptlrpc_nrs_pol_ops nrs_crrn_ops = {
        .op_req_enqueue         = nrs_crrn_req_add,
        .op_req_dequeue         = nrs_crrn_req_del,
        .op_req_stop            = nrs_crrn_req_stop,
-#ifdef LPROCFS
+#ifdef CONFIG_PROC_FS
        .op_lprocfs_init        = nrs_crrn_lprocfs_init,
        .op_lprocfs_fini        = nrs_crrn_lprocfs_fini,
 #endif