Whamcloud - gitweb
LU-6401 uapi: migrate remaining uapi headers to uapi directory
[fs/lustre-release.git] / lustre / ptlrpc / nrs_orr.c
index 9d02878..c848cde 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2013, 2015, Intel Corporation.
+ * Copyright (c) 2013, 2016, Intel Corporation.
  *
  * Copyright 2012 Xyratex Technology Limited
  */
@@ -45,7 +45,6 @@
 #include <obd_support.h>
 #include <obd_class.h>
 #include <lustre_net.h>
-#include <lustre/lustre_idl.h>
 #include <lustre_req_layout.h>
 #include "ptlrpc_internal.h"
 
@@ -524,7 +523,8 @@ static struct cfs_hash_ops nrs_trr_hash_ops = {
  * \retval 0 e1 > e2
  * \retval 1 e1 < e2
  */
-static int orr_req_compare(cfs_binheap_node_t *e1, cfs_binheap_node_t *e2)
+static int
+orr_req_compare(struct cfs_binheap_node *e1, struct cfs_binheap_node *e2)
 {
        struct ptlrpc_nrs_request *nrq1;
        struct ptlrpc_nrs_request *nrq2;
@@ -579,7 +579,7 @@ static int orr_req_compare(cfs_binheap_node_t *e1, cfs_binheap_node_t *e2)
 /**
  * ORR binary heap operations
  */
-static cfs_binheap_ops_t nrs_orr_heap_ops = {
+static struct cfs_binheap_ops nrs_orr_heap_ops = {
        .hop_enter      = NULL,
        .hop_exit       = NULL,
        .hop_compare    = orr_req_compare,
@@ -637,7 +637,7 @@ static int nrs_orr_start(struct ptlrpc_nrs_policy *policy, char *arg)
                                              nrs_pol2cptab(policy),
                                              nrs_pol2cptid(policy));
        if (orrd->od_binheap == NULL)
-               GOTO(failed, rc = -ENOMEM);
+               GOTO(out_orrd, rc = -ENOMEM);
 
        nrs_orr_genobjname(policy, orrd->od_objname);
 
@@ -648,7 +648,7 @@ static int nrs_orr_start(struct ptlrpc_nrs_policy *policy, char *arg)
                                           sizeof(struct nrs_orr_object),
                                           0, 0, NULL);
        if (orrd->od_cache == NULL)
-               GOTO(failed, rc = -ENOMEM);
+               GOTO(out_binheap, rc = -ENOMEM);
 
        if (strncmp(policy->pol_desc->pd_name, NRS_POL_NAME_ORR,
                    NRS_POL_NAME_MAX) == 0) {
@@ -676,7 +676,7 @@ static int nrs_orr_start(struct ptlrpc_nrs_policy *policy, char *arg)
                                            CFS_HASH_MIN_THETA,
                                            CFS_HASH_MAX_THETA, ops, flags);
        if (orrd->od_obj_hash == NULL)
-               GOTO(failed, rc = -ENOMEM);
+               GOTO(out_cache, rc = -ENOMEM);
 
        /* XXX: Fields accessed unlocked */
        orrd->od_quantum = NRS_ORR_QUANTUM_DFLT;
@@ -692,12 +692,11 @@ static int nrs_orr_start(struct ptlrpc_nrs_policy *policy, char *arg)
 
        RETURN(rc);
 
-failed:
-       if (orrd->od_cache)
-               kmem_cache_destroy(orrd->od_cache);
-       if (orrd->od_binheap != NULL)
-               cfs_binheap_destroy(orrd->od_binheap);
-
+out_cache:
+       kmem_cache_destroy(orrd->od_cache);
+out_binheap:
+       cfs_binheap_destroy(orrd->od_binheap);
+out_orrd:
        OBD_FREE_PTR(orrd);
 
        RETURN(rc);
@@ -944,7 +943,7 @@ struct ptlrpc_nrs_request *nrs_orr_req_get(struct ptlrpc_nrs_policy *policy,
                                           bool peek, bool force)
 {
        struct nrs_orr_data       *orrd = policy->pol_private;
-       cfs_binheap_node_t        *node = cfs_binheap_root(orrd->od_binheap);
+       struct cfs_binheap_node   *node = cfs_binheap_root(orrd->od_binheap);
        struct ptlrpc_nrs_request *nrq;
 
        nrq = unlikely(node == NULL) ? NULL :
@@ -966,14 +965,14 @@ struct ptlrpc_nrs_request *nrs_orr_req_get(struct ptlrpc_nrs_policy *policy,
                        CDEBUG(D_RPCTRACE,
                               "NRS: starting to handle %s request for object "
                               "with FID "DFID", from OST with index %u, with "
-                              "round "LPU64"\n", NRS_POL_NAME_ORR,
+                              "round %llu\n", NRS_POL_NAME_ORR,
                               PFID(&orro->oo_key.ok_fid),
                               nrq->nr_u.orr.or_key.ok_idx,
                               nrq->nr_u.orr.or_round);
                else
                        CDEBUG(D_RPCTRACE,
                               "NRS: starting to handle %s request from OST "
-                              "with index %u, with round "LPU64"\n",
+                              "with index %u, with round %llu\n",
                               NRS_POL_NAME_TRR, nrq->nr_u.orr.or_key.ok_idx,
                               nrq->nr_u.orr.or_round);
 
@@ -1119,7 +1118,7 @@ static void nrs_orr_req_del(struct ptlrpc_nrs_policy *policy,
         */
        if (unlikely(is_root)) {
                /** Peek at the next request to be served */
-               cfs_binheap_node_t *node = cfs_binheap_root(orrd->od_binheap);
+               struct cfs_binheap_node *node = cfs_binheap_root(orrd->od_binheap);
 
                /** No more requests */
                if (unlikely(node == NULL)) {
@@ -1149,13 +1148,13 @@ static void nrs_orr_req_stop(struct ptlrpc_nrs_policy *policy,
                    NRS_POL_NAME_MAX) == 0)
                CDEBUG(D_RPCTRACE,
                       "NRS: finished handling %s request for object with FID "
-                      DFID", from OST with index %u, with round "LPU64"\n",
+                      DFID", from OST with index %u, with round %llu\n",
                       NRS_POL_NAME_ORR, PFID(&nrq->nr_u.orr.or_key.ok_fid),
                       nrq->nr_u.orr.or_key.ok_idx, nrq->nr_u.orr.or_round);
        else
                CDEBUG(D_RPCTRACE,
                       "NRS: finished handling %s request from OST with index %u,"
-                      " with round "LPU64"\n",
+                      " with round %llu\n",
                       NRS_POL_NAME_TRR, nrq->nr_u.orr.or_key.ok_idx,
                       nrq->nr_u.orr.or_round);
 }
@@ -1277,7 +1276,8 @@ no_hp:
  * almost identical; it can be reworked and then reused for ORR/TRR.
  */
 static ssize_t
-ptlrpc_lprocfs_nrs_orr_quantum_seq_write(struct file *file, const char *buffer,
+ptlrpc_lprocfs_nrs_orr_quantum_seq_write(struct file *file,
+                                        const char __user *buffer,
                                         size_t count, loff_t *off)
 {
        struct seq_file             *m = file->private_data;
@@ -1491,7 +1491,8 @@ no_hp:
  */
 static ssize_t
 ptlrpc_lprocfs_nrs_orr_offset_type_seq_write(struct file *file,
-                                            const char *buffer, size_t count,
+                                            const char __user *buffer,
+                                             size_t count,
                                             loff_t *off)
 {
        struct seq_file             *m = file->private_data;
@@ -1750,7 +1751,8 @@ no_hp:
  */
 static ssize_t
 ptlrpc_lprocfs_nrs_orr_supported_seq_write(struct file *file,
-                                          const char *buffer, size_t count,
+                                          const char __user *buffer,
+                                          size_t count,
                                           loff_t *off)
 {
        struct seq_file             *m = file->private_data;