Whamcloud - gitweb
LU-3865 build: support of new MPSS version 3.x
[fs/lustre-release.git] / lustre / lvfs / lvfs_lib.c
index 82e930b..7f5af3d 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 #include <lustre_lib.h>
 #include <lprocfs_status.h>
 
-unsigned int obd_alloc_fail_rate = 0;
-
-int obd_alloc_fail(const void *ptr, const char *name, const char *type,
-                   size_t size, const char *file, int line)
-{
-        if (ptr == NULL ||
-            (cfs_rand() & OBD_ALLOC_FAIL_MASK) < obd_alloc_fail_rate) {
-                CERROR("%s%salloc of %s ("LPU64" bytes) failed at %s:%d\n",
-                       ptr ? "force " :"", type, name, (__u64)size, file,
-                       line);
-                CERROR(LPU64" total bytes and "LPU64" total pages "
-                       "("LPU64" bytes) allocated by Lustre, "
-                       "%d total bytes by LNET\n",
-                       obd_memory_sum(),
-                       obd_pages_sum() << CFS_PAGE_SHIFT,
-                       obd_pages_sum(),
-                       cfs_atomic_read(&libcfs_kmemory));
-                return 1;
-        }
-        return 0;
-}
-EXPORT_SYMBOL(obd_alloc_fail);
-
 #ifdef LPROCFS
 void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)
 {
@@ -81,6 +58,9 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)
        if (stats == NULL)
                return;
 
+       LASSERTF(0 <= idx && idx < stats->ls_num,
+                "idx %d, ls_num %hu\n", idx, stats->ls_num);
+
        /* With per-client stats, statistics are allocated only for
         * single CPU area, so the smp_id should be 0 always. */
        smp_id = lprocfs_stats_lock(stats, LPROCFS_GET_SMP_ID, &flags);
@@ -129,6 +109,9 @@ void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount)
        if (stats == NULL)
                return;
 
+       LASSERTF(0 <= idx && idx < stats->ls_num,
+                "idx %d, ls_num %hu\n", idx, stats->ls_num);
+
        /* With per-client stats, statistics are allocated only for
         * single CPU area, so the smp_id should be 0 always. */
        smp_id = lprocfs_stats_lock(stats, LPROCFS_GET_SMP_ID, &flags);
@@ -198,5 +181,3 @@ int lprocfs_stats_alloc_one(struct lprocfs_stats *stats, unsigned int cpuid)
 }
 EXPORT_SYMBOL(lprocfs_stats_alloc_one);
 #endif  /* LPROCFS */
-
-EXPORT_SYMBOL(obd_alloc_fail_rate);