Whamcloud - gitweb
LU-3809 test: Cleanup if replay-single/58[bc] fail
[fs/lustre-release.git] / lustre / ptlrpc / nrs_orr.c
index c660916..a5afbc0 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2011 Intel Corporation
+ * Copyright (c) 2013, Intel Corporation.
  *
  * Copyright 2012 Xyratex Technology Limited
  */
@@ -595,7 +595,8 @@ static cfs_binheap_ops_t nrs_orr_heap_ops = {
 
 /**
  * Prints a warning message if an ORR/TRR policy is started on a service with
- * more than one CPT.
+ * more than one CPT.  Not printed on the console for now, since we don't
+ * have any performance metrics in the first place, and it is annoying.
  *
  * \param[in] policy the policy instance
  *
@@ -603,16 +604,13 @@ static cfs_binheap_ops_t nrs_orr_heap_ops = {
  */
 static int nrs_orr_init(struct ptlrpc_nrs_policy *policy)
 {
-       if (policy->pol_nrs->nrs_svcpt->scp_service->srv_ncpts > 1) {
-               bool is_orr = strncmp(policy->pol_desc->pd_name,
-                                     NRS_POL_NAME_ORR, NRS_POL_NAME_MAX) == 0;
-
-               CWARN("A%s %s NRS policy has been registered on a PTLRPC "
-                     "service which has more than one service partition. "
-                     "Please be advised that this policy may perform better "
-                     "on services with only one partition.\n",
-                     is_orr ? "n" : "", policy->pol_desc->pd_name);
-       }
+       if (policy->pol_nrs->nrs_svcpt->scp_service->srv_ncpts > 1)
+               CDEBUG(D_CONFIG, "%s: The %s NRS policy was registered on a "
+                     "service with multiple service partitions. This policy "
+                     "may perform better with a single partition.\n",
+                     policy->pol_nrs->nrs_svcpt->scp_service->srv_name,
+                     policy->pol_desc->pd_name);
+
        return 0;
 }
 
@@ -654,9 +652,9 @@ static int nrs_orr_start(struct ptlrpc_nrs_policy *policy)
        /**
         * Slab cache for NRS ORR/TRR objects.
         */
-       orrd->od_cache = cfs_mem_cache_create(orrd->od_objname,
-                                             sizeof(struct nrs_orr_object),
-                                             0, 0);
+       orrd->od_cache = kmem_cache_create(orrd->od_objname,
+                                          sizeof(struct nrs_orr_object),
+                                          0, 0, NULL);
        if (orrd->od_cache == NULL)
                GOTO(failed, rc = -ENOMEM);
 
@@ -704,7 +702,7 @@ static int nrs_orr_start(struct ptlrpc_nrs_policy *policy)
 
 failed:
        if (orrd->od_cache) {
-               rc = cfs_mem_cache_destroy(orrd->od_cache);
+               kmem_cache_destroy(orrd->od_cache);
                LASSERTF(rc == 0, "Could not destroy od_cache slab\n");
        }
        if (orrd->od_binheap != NULL)
@@ -737,7 +735,7 @@ static void nrs_orr_stop(struct ptlrpc_nrs_policy *policy)
 
        cfs_binheap_destroy(orrd->od_binheap);
        cfs_hash_putref(orrd->od_obj_hash);
-       cfs_mem_cache_destroy(orrd->od_cache);
+       kmem_cache_destroy(orrd->od_cache);
 
        OBD_FREE_PTR(orrd);
 }
@@ -761,7 +759,7 @@ int nrs_orr_ctl(struct ptlrpc_nrs_policy *policy, enum ptlrpc_nrs_ctl opc,
 {
        LASSERT(spin_is_locked(&policy->pol_nrs->nrs_lock));
 
-       switch(opc) {
+       switch((enum nrs_ctl_orr)opc) {
        default:
                RETURN(-EINVAL);
 
@@ -884,8 +882,8 @@ 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 ? CFS_ALLOC_ATOMIC :
-                                  CFS_ALLOC_IO);
+                                  (moving_req ? GFP_ATOMIC :
+                                   __GFP_IO));
        if (orro == NULL)
                RETURN(-ENOMEM);
 
@@ -1314,7 +1312,7 @@ static int ptlrpc_lprocfs_wr_nrs_orr_quantum(struct file *file,
         if (count > (sizeof(kernbuf) - 1))
                 return -EINVAL;
 
-       if (cfs_copy_from_user(kernbuf, buffer, count))
+       if (copy_from_user(kernbuf, buffer, count))
                return -EFAULT;
 
         kernbuf[count] = '\0';
@@ -1533,7 +1531,7 @@ static int ptlrpc_lprocfs_wr_nrs_orr_offset_type(struct file *file,
         if (count > (sizeof(kernbuf) - 1))
                 return -EINVAL;
 
-       if (cfs_copy_from_user(kernbuf, buffer, count))
+       if (copy_from_user(kernbuf, buffer, count))
                return -EFAULT;
 
         kernbuf[count] = '\0';
@@ -1795,7 +1793,7 @@ static int ptlrpc_lprocfs_wr_nrs_orr_supported(struct file *file,
         if (count > (sizeof(kernbuf) - 1))
                 return -EINVAL;
 
-       if (cfs_copy_from_user(kernbuf, buffer, count))
+       if (copy_from_user(kernbuf, buffer, count))
                return -EFAULT;
 
         kernbuf[count] = '\0';