Whamcloud - gitweb
LU-11052 obd: remove OBD ops based stats 02/32602/2
authorJohn L. Hammond <john.hammond@intel.com>
Fri, 25 May 2018 14:40:04 +0000 (09:40 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 18 Jul 2018 06:00:26 +0000 (06:00 +0000)
Stats maintained via the OBD operations wrappers (obd_setup(),
obd_cleanup(), ...) are less and less interesting to the point that we
should remove them. The only stats files affected by this are
obdfilter.*.stats, obdfilter.*.exports.*.stats and
obdecho.*.stats. For obdfilter here is a comparison for two racer
runs. With the current OBD ops based stats:

obdfilter.lustre-OST0000.stats=
snapshot_time             1527267354.328068245 secs.nsecs
read_bytes                610 samples [bytes] 4096 4194304 800043008
write_bytes               2196 samples [bytes] 5 4194304 3410224606
setattr                   13545 samples [reqs]
punch                     7682 samples [reqs]
destroy                   2281 samples [reqs]
create                    74 samples [reqs]
statfs                    234 samples [reqs]
get_info                  1 samples [reqs]
connect                   3 samples [reqs]
disconnect                1 samples [reqs]
preprw                    2806 samples [reqs]
commitrw                  2806 samples [reqs]
ping                      422 samples [reqs]

And after the OBD ops bases stats have been removed:

obdfilter.lustre-OST0000.stats=
snapshot_time             1527168813.867472974 secs.nsecs
read_bytes                200 samples [bytes] 4096 4194304 231366656
write_bytes               1703 samples [bytes] 5 4194304 1220864892
getattr                   337 samples [reqs]
setattr                   6358 samples [reqs]
punch                     2880 samples [reqs]
destroy                   2000 samples [reqs]
create                    71 samples [reqs]
statfs                    2148 samples [reqs]
get_info                  4 samples [reqs]

Changes to obdfilter.lustre-OST0000.exports.*.stats are similar.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: If4fb7022a3de0aa61905212eaab07b94c1687c68
Reviewed-on: https://review.whamcloud.com/32602
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Jesse Hanley <hanleyja@ornl.gov>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lprocfs_status.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/mdt/mdt_fs.c
lustre/mgs/mgs_fs.c
lustre/obdclass/lprocfs_status_server.c
lustre/ofd/ofd_dev.c
lustre/ofd/ofd_obd.c

index de1f0c6..e0183c0 100644 (file)
@@ -468,13 +468,11 @@ extern struct lprocfs_stats *
 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
-extern void lprocfs_init_ops_stats(int num_private_stats,
-                                   struct lprocfs_stats *stats);
 extern void lprocfs_init_mps_stats(int num_private_stats,
                                    struct lprocfs_stats *stats);
 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
-                                   unsigned int num_private_stats);
+                                  unsigned int num_stats);
 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
                                   unsigned int num_private_stats);
 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
@@ -904,16 +902,13 @@ static inline int lprocfs_register_stats(struct proc_dir_entry *root,
                                          const char *name,
                                          struct lprocfs_stats *stats)
 { return 0; }
-static inline void lprocfs_init_ops_stats(int num_private_stats,
-                                          struct lprocfs_stats *stats)
-{ return; }
 static inline void lprocfs_init_mps_stats(int num_private_stats,
                                           struct lprocfs_stats *stats)
 { return; }
 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
 { return; }
 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
-                                          unsigned int num_private_stats)
+                                         unsigned int num_stats)
 { return 0; }
 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
                                          unsigned int num_private_stats)
index 5992d3e..14aa618 100644 (file)
@@ -615,7 +615,6 @@ struct obd_device {
                                         * (for /proc/status only!!) */
                obd_no_ir:1,            /* no imperative recovery. */
                obd_process_conf:1,     /* device is processing mgs config */
-               obd_uses_nid_stats:1,   /* maintain per-client OBD stats */
                obd_checksum_dump:1;    /* dump pages upon cksum error */
 
         /* use separate field as it is set in interrupt to don't mess with
@@ -703,7 +702,6 @@ struct obd_device {
 
        /* Fields used by LProcFS */
        struct lprocfs_stats            *obd_stats;
-       unsigned int                    obd_cntr_base;
 
        unsigned int                     obd_md_cntr_base;
        struct lprocfs_stats            *obd_md_stats;
index 45660f7..3aaa52e 100644 (file)
@@ -417,31 +417,6 @@ do {                                                            \
 
 
 #ifdef CONFIG_PROC_FS
-#define OBD_COUNTER_OFFSET(op)                                                \
-       ((offsetof(struct obd_ops, o_ ## op) -                                 \
-         offsetof(struct obd_ops, o_iocontrol))                               \
-        / sizeof(((struct obd_ops *)NULL)->o_iocontrol))
-
-/* The '- 1' below is for o_owner. */
-#define NUM_OBD_STATS                                                         \
-       (sizeof(struct obd_ops) /                                              \
-        sizeof(((struct obd_ops *)NULL)->o_iocontrol) - 1)
-
-#define OBD_COUNTER_INCREMENT(obd, op)                                        \
-       lprocfs_counter_incr((obd)->obd_stats,                                 \
-                            (obd)->obd_cntr_base + OBD_COUNTER_OFFSET(op))
-
-#define EXP_COUNTER_INCREMENT(exp, op)                                        \
-       do {                                                                   \
-               unsigned int _off;                                             \
-               _off = (exp)->exp_obd->obd_cntr_base + OBD_COUNTER_OFFSET(op); \
-               lprocfs_counter_incr((exp)->exp_obd->obd_stats, _off);         \
-               if ((exp)->exp_obd->obd_uses_nid_stats &&                      \
-                   (exp)->exp_nid_stats != NULL)                              \
-                       lprocfs_counter_incr((exp)->exp_nid_stats->nid_stats,  \
-                                            _off);                            \
-       } while (0)
-
 #define _MD_COUNTER_OFFSET(m_op)                                              \
        ((offsetof(struct md_ops, m_op) -                                      \
          offsetof(struct md_ops, MD_STATS_FIRST_OP)) /                        \
@@ -465,9 +440,6 @@ do {                                                            \
        } while (0)
 
 #else
-#define OBD_COUNTER_OFFSET(op)
-#define OBD_COUNTER_INCREMENT(obd, op)
-#define EXP_COUNTER_INCREMENT(exp, op)
 #define EXP_MD_COUNTER_INCREMENT(exp, op)
 #endif
 
@@ -518,7 +490,6 @@ static inline int obd_get_info(const struct lu_env *env, struct obd_export *exp,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-       EXP_COUNTER_INCREMENT(exp, get_info);
 
        rc = OBP(exp->exp_obd, get_info)(env, exp, keylen, key, vallen, val);
        RETURN(rc);
@@ -542,7 +513,6 @@ static inline int obd_set_info_async(const struct lu_env *env,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-        EXP_COUNTER_INCREMENT(exp, set_info_async);
 
         rc = OBP(exp->exp_obd, set_info_async)(env, exp, keylen, key, vallen,
                                                val, set);
@@ -602,7 +572,6 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
                               __func__);
                        RETURN(-EOPNOTSUPP);
                }
-                OBD_COUNTER_INCREMENT(obd, setup);
                 rc = OBP(obd, setup)(obd, cfg);
         }
         RETURN(rc);
@@ -629,8 +598,6 @@ static inline int obd_precleanup(struct obd_device *obd)
        if (!obd->obd_type->typ_dt_ops->o_precleanup)
                RETURN(0);
 
-       OBD_COUNTER_INCREMENT(obd, precleanup);
-
        rc = OBP(obd, precleanup)(obd);
        RETURN(rc);
 }
@@ -655,8 +622,6 @@ static inline int obd_cleanup(struct obd_device *obd)
        if (!obd->obd_type->typ_dt_ops->o_cleanup)
                RETURN(0);
 
-        OBD_COUNTER_INCREMENT(obd, cleanup);
-
         rc = OBP(obd, cleanup)(obd);
         RETURN(rc);
 }
@@ -708,7 +673,7 @@ static inline int obd_process_config(struct obd_device *obd, int datalen,
                }
                 rc = OBP(obd, process_config)(obd, datalen, data);
         }
-        OBD_COUNTER_INCREMENT(obd, process_config);
+
         obd->obd_process_conf = 0;
 
         RETURN(rc);
@@ -729,7 +694,6 @@ static inline int obd_create(const struct lu_env *env, struct obd_export *exp,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-       EXP_COUNTER_INCREMENT(exp, create);
 
        rc = OBP(exp->exp_obd, create)(env, exp, obdo);
        RETURN(rc);
@@ -750,7 +714,6 @@ static inline int obd_destroy(const struct lu_env *env, struct obd_export *exp,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-       EXP_COUNTER_INCREMENT(exp, destroy);
 
        rc = OBP(exp->exp_obd, destroy)(env, exp, obdo);
        RETURN(rc);
@@ -771,7 +734,7 @@ static inline int obd_getattr(const struct lu_env *env, struct obd_export *exp,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-       EXP_COUNTER_INCREMENT(exp, getattr);
+
        rc = OBP(exp->exp_obd, getattr)(env, exp, oa);
 
        RETURN(rc);
@@ -792,7 +755,7 @@ static inline int obd_setattr(const struct lu_env *env, struct obd_export *exp,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-       EXP_COUNTER_INCREMENT(exp, setattr);
+
        rc = OBP(exp->exp_obd, setattr)(env, exp, oa);
 
        RETURN(rc);
@@ -810,7 +773,6 @@ static inline int obd_add_conn(struct obd_import *imp, struct obd_uuid *uuid,
                CERROR("%s: no %s operation\n", obd->obd_name, __func__);
                RETURN(-EOPNOTSUPP);
        }
-        OBD_COUNTER_INCREMENT(obd, add_conn);
 
         rc = OBP(obd, add_conn)(imp, uuid, priority);
         RETURN(rc);
@@ -827,7 +789,6 @@ static inline int obd_del_conn(struct obd_import *imp, struct obd_uuid *uuid)
                CERROR("%s: no %s operation\n", obd->obd_name, __func__);
                RETURN(-EOPNOTSUPP);
        }
-        OBD_COUNTER_INCREMENT(obd, del_conn);
 
         rc = OBP(obd, del_conn)(imp, uuid);
         RETURN(rc);
@@ -842,8 +803,6 @@ static inline struct obd_uuid *obd_get_uuid(struct obd_export *exp)
            !exp->exp_obd->obd_type->typ_dt_ops->o_get_uuid)
                RETURN(NULL);
 
-        EXP_COUNTER_INCREMENT(exp, get_uuid);
-
         uuid = OBP(exp->exp_obd, get_uuid)(exp);
         RETURN(uuid);
 }
@@ -869,7 +828,6 @@ static inline int obd_connect(const struct lu_env *env,
                CERROR("%s: no %s operation\n", obd->obd_name, __func__);
                RETURN(-EOPNOTSUPP);
        }
-        OBD_COUNTER_INCREMENT(obd, connect);
 
         rc = OBP(obd, connect)(env, exp, obd, cluuid, data, localdata);
         /* check that only subset is granted */
@@ -895,8 +853,6 @@ static inline int obd_reconnect(const struct lu_env *env,
        if (!obd->obd_type || !obd->obd_type->typ_dt_ops->o_reconnect)
                RETURN(0);
 
-        OBD_COUNTER_INCREMENT(obd, reconnect);
-
         rc = OBP(obd, reconnect)(env, exp, obd, cluuid, d, localdata);
         /* check that only subset is granted */
         LASSERT(ergo(d != NULL,
@@ -917,7 +873,6 @@ static inline int obd_disconnect(struct obd_export *exp)
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-        EXP_COUNTER_INCREMENT(exp, disconnect);
 
         rc = OBP(exp->exp_obd, disconnect)(exp);
         RETURN(rc);
@@ -931,7 +886,6 @@ static inline int obd_fid_init(struct obd_device *obd, struct obd_export *exp,
 
        if (!obd->obd_type || !obd->obd_type->typ_dt_ops->o_fid_init)
                RETURN(0);
-       OBD_COUNTER_INCREMENT(obd, fid_init);
 
        rc = OBP(obd, fid_init)(obd, exp, type);
        RETURN(rc);
@@ -943,7 +897,6 @@ static inline int obd_fid_fini(struct obd_device *obd)
        ENTRY;
        if (!obd->obd_type || !obd->obd_type->typ_dt_ops->o_fid_fini)
                RETURN(0);
-       OBD_COUNTER_INCREMENT(obd, fid_fini);
 
        rc = OBP(obd, fid_fini)(obd);
        RETURN(rc);
@@ -965,7 +918,6 @@ static inline int obd_fid_alloc(const struct lu_env *env,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-       EXP_COUNTER_INCREMENT(exp, fid_alloc);
 
        rc = OBP(exp->exp_obd, fid_alloc)(env, exp, fid, op_data);
        RETURN(rc);
@@ -980,8 +932,6 @@ static inline int obd_ping(const struct lu_env *env, struct obd_export *exp)
            !exp->exp_obd->obd_type->typ_dt_ops->o_ping)
                RETURN(0);
 
-        EXP_COUNTER_INCREMENT(exp, ping);
-
         rc = OBP(exp->exp_obd, ping)(env, exp);
         RETURN(rc);
 }
@@ -995,7 +945,6 @@ static inline int obd_pool_new(struct obd_device *obd, char *poolname)
                CERROR("%s: no %s operation\n", obd->obd_name, __func__);
                RETURN(-EOPNOTSUPP);
        }
-        OBD_COUNTER_INCREMENT(obd, pool_new);
 
         rc = OBP(obd, pool_new)(obd, poolname);
         RETURN(rc);
@@ -1009,7 +958,6 @@ static inline int obd_pool_del(struct obd_device *obd, char *poolname)
                CERROR("%s: no %s operation\n", obd->obd_name, __func__);
                RETURN(-EOPNOTSUPP);
        }
-        OBD_COUNTER_INCREMENT(obd, pool_del);
 
         rc = OBP(obd, pool_del)(obd, poolname);
         RETURN(rc);
@@ -1025,7 +973,6 @@ static inline int obd_pool_add(struct obd_device *obd, char *poolname,
                CERROR("%s: no %s operation\n", obd->obd_name, __func__);
                RETURN(-EOPNOTSUPP);
        }
-        OBD_COUNTER_INCREMENT(obd, pool_add);
 
         rc = OBP(obd, pool_add)(obd, poolname, ostname);
         RETURN(rc);
@@ -1041,7 +988,6 @@ static inline int obd_pool_rem(struct obd_device *obd, char *poolname,
                CERROR("%s: no %s operation\n", obd->obd_name, __func__);
                RETURN(-EOPNOTSUPP);
        }
-       OBD_COUNTER_INCREMENT(obd, pool_rem);
 
        rc = OBP(obd, pool_rem)(obd, poolname, ostname);
        RETURN(rc);
@@ -1089,7 +1035,6 @@ static inline int obd_statfs_async(struct obd_export *exp,
                CERROR("%s: no %s operation\n", obd->obd_name, __func__);
                RETURN(-EOPNOTSUPP);
        }
-       OBD_COUNTER_INCREMENT(obd, statfs);
 
        CDEBUG(D_SUPER, "%s: osfs %p age %lld, max_age %lld\n",
               obd->obd_name, &obd->obd_osfs, obd->obd_osfs_age, max_age);
@@ -1133,7 +1078,6 @@ static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
                CERROR("%s: no %s operation\n", obd->obd_name, __func__);
                RETURN(-EOPNOTSUPP);
        }
-        OBD_COUNTER_INCREMENT(obd, statfs);
 
        CDEBUG(D_SUPER, "osfs %lld, max_age %lld\n",
                obd->obd_osfs_age, max_age);
@@ -1177,7 +1121,7 @@ static inline int obd_preprw(const struct lu_env *env, int cmd,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-       EXP_COUNTER_INCREMENT(exp, preprw);
+
        rc = OBP(exp->exp_obd, preprw)(env, cmd, exp, oa, objcount, obj, remote,
                                       pages, local);
 
@@ -1201,7 +1145,7 @@ static inline int obd_commitrw(const struct lu_env *env, int cmd,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-       EXP_COUNTER_INCREMENT(exp, commitrw);
+
        rc = OBP(exp->exp_obd, commitrw)(env, cmd, exp, oa, objcount, obj,
                                         rnb, pages, local, rc);
 
@@ -1223,7 +1167,6 @@ static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-        EXP_COUNTER_INCREMENT(exp, iocontrol);
 
         rc = OBP(exp->exp_obd, iocontrol)(cmd, exp, len, karg, uarg);
         RETURN(rc);
@@ -1239,10 +1182,10 @@ static inline void obd_import_event(struct obd_device *obd,
                 EXIT;
                 return;
         }
-        if (obd->obd_set_up && OBP(obd, import_event)) {
-                OBD_COUNTER_INCREMENT(obd, import_event);
+
+        if (obd->obd_set_up && OBP(obd, import_event))
                 OBP(obd, import_event)(obd, imp, event);
-        }
+
         EXIT;
 }
 
@@ -1264,7 +1207,6 @@ static inline int obd_notify(struct obd_device *obd,
                RETURN(-ENOSYS);
        }
 
-       OBD_COUNTER_INCREMENT(obd, notify);
        rc = OBP(obd, notify)(obd, watched, ev);
 
        RETURN(rc);
@@ -1306,7 +1248,6 @@ static inline int obd_quotactl(struct obd_export *exp,
                       (exp)->exp_obd->obd_name, __func__);
                RETURN(-ENOTSUPP);
        }
-        EXP_COUNTER_INCREMENT(exp, quotactl);
 
         rc = OBP(exp->exp_obd, quotactl)(exp->exp_obd, exp, oqctl);
         RETURN(rc);
index 14777a2..862d19a 100644 (file)
@@ -67,8 +67,6 @@ int mdt_export_stats_init(struct obd_device *obd, struct obd_export *exp,
        int rc;
        ENTRY;
 
-       LASSERT(!obd->obd_uses_nid_stats);
-
        rc = lprocfs_exp_setup(exp, client_nid);
        if (rc != 0)
                /* Mask error for already created /proc entries */
index 0ccd4c4..96d4fad 100644 (file)
@@ -69,13 +69,11 @@ int mgs_export_stats_init(struct obd_device *obd, struct obd_export *exp,
                RETURN(rc == -EALREADY ? 0 : rc);
 
        stats = exp->exp_nid_stats;
-       stats->nid_stats = lprocfs_alloc_stats(NUM_OBD_STATS + LPROC_MGS_LAST,
-                                               LPROCFS_STATS_FLAG_NOPERCPU);
+       stats->nid_stats = lprocfs_alloc_stats(LPROC_MGS_LAST,
+                                              LPROCFS_STATS_FLAG_NOPERCPU);
        if (stats->nid_stats == NULL)
                RETURN(-ENOMEM);
 
-       lprocfs_init_ops_stats(LPROC_MGS_LAST, stats->nid_stats);
-
        mgs_stats_counter_init(stats->nid_stats);
 
        rc = lprocfs_register_stats(stats->nid_proc, "stats", stats->nid_stats);
index 8e378ba..f878de0 100644 (file)
@@ -586,90 +586,24 @@ int lprocfs_exp_cleanup(struct obd_export *exp)
        return 0;
 }
 
-#define LPROCFS_OBD_OP_INIT(base, stats, op)                   \
-do {                                                           \
-       unsigned int coffset = base + OBD_COUNTER_OFFSET(op);   \
-       LASSERT(coffset < stats->ls_num);                       \
-       lprocfs_counter_init(stats, coffset, 0, #op, "reqs");   \
-} while (0)
-
-void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats)
-{
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, iocontrol);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_info);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, set_info_async);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, setup);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, precleanup);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, cleanup);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, process_config);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, postrecov);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, add_conn);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, del_conn);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, connect);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, reconnect);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, disconnect);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_init);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_fini);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, fid_alloc);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, statfs_async);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, create);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, setattr);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, getattr);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, preprw);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, commitrw);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_export);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy_export);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, health_check);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_uuid);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotactl);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, ping);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_del);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_add);
-       LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_rem);
-
-       CLASSERT(NUM_OBD_STATS == OBD_COUNTER_OFFSET(pool_rem) + 1);
-}
-EXPORT_SYMBOL(lprocfs_init_ops_stats);
-
-int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats)
+int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned int num_stats)
 {
        struct lprocfs_stats *stats;
-       unsigned int num_stats;
-       int rc, i;
+       int rc;
 
        LASSERT(obd->obd_stats == NULL);
        LASSERT(obd->obd_proc_entry != NULL);
-       LASSERT(obd->obd_cntr_base == 0);
 
-       num_stats = NUM_OBD_STATS + num_private_stats;
        stats = lprocfs_alloc_stats(num_stats, 0);
        if (stats == NULL)
                return -ENOMEM;
 
-       lprocfs_init_ops_stats(num_private_stats, stats);
-
-       for (i = num_private_stats; i < num_stats; i++) {
-               /* If this LBUGs, it is likely that an obd
-                * operation was added to struct obd_ops in
-                * <obd.h>, and that the corresponding line item
-                * LPROCFS_OBD_OP_INIT(.., .., opname)
-                * is missing from the list above. */
-               LASSERTF(stats->ls_cnt_header[i].lc_name != NULL,
-                        "Missing obd_stat initializer obd_op "
-                        "operation at offset %d.\n", i - num_private_stats);
-       }
        rc = lprocfs_register_stats(obd->obd_proc_entry, "stats", stats);
-       if (rc < 0) {
+       if (rc < 0)
                lprocfs_free_stats(&stats);
-       } else {
-               obd->obd_stats  = stats;
-               obd->obd_cntr_base = num_private_stats;
-       }
+       else
+               obd->obd_stats = stats;
+
        return rc;
 }
 EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
index c2cda39..7495453 100644 (file)
@@ -734,8 +734,6 @@ static int ofd_procfs_init(struct ofd_device *ofd)
                GOTO(obd_cleanup, rc);
        }
 
-       obd->obd_uses_nid_stats = 1;
-
        entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL);
        if (IS_ERR(entry)) {
                rc = PTR_ERR(entry);
index 28bef97..bbe2686 100644 (file)
@@ -72,8 +72,6 @@ static int ofd_export_stats_init(struct ofd_device *ofd,
        int                      rc;
        ENTRY;
 
-       LASSERT(obd->obd_uses_nid_stats);
-
        if (obd_uuid_equals(&exp->exp_client_uuid, &obd->obd_uuid))
                /* Self-export gets no proc entry */
                RETURN(0);
@@ -84,14 +82,11 @@ static int ofd_export_stats_init(struct ofd_device *ofd,
                RETURN(rc == -EALREADY ? 0 : rc);
 
        stats = exp->exp_nid_stats;
-       stats->nid_stats = lprocfs_alloc_stats(NUM_OBD_STATS +
-                                               LPROC_OFD_STATS_LAST,
-                                               LPROCFS_STATS_FLAG_NOPERCPU);
+       stats->nid_stats = lprocfs_alloc_stats(LPROC_OFD_STATS_LAST,
+                                              LPROCFS_STATS_FLAG_NOPERCPU);
        if (stats->nid_stats == NULL)
                RETURN(-ENOMEM);
 
-       lprocfs_init_ops_stats(LPROC_OFD_STATS_LAST, stats->nid_stats);
-
        ofd_stats_counter_init(stats->nid_stats);
 
        rc = lprocfs_register_stats(stats->nid_proc, "stats", stats->nid_stats);