Whamcloud - gitweb
LU-2484 obd: add md_stats to MDC and LMV devices
[fs/lustre-release.git] / lustre / lvfs / lvfs_lib.c
index 3db6b25..7f5af3d 100644 (file)
@@ -58,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);
@@ -106,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);