staging/lustre/obd: Remove nid_stats tracking
authorOleg Drokin <green@linuxhacker.ru>
Sun, 31 May 2015 03:27:04 +0000 (23:27 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 06:26:38 +0000 (15:26 +0900)
This nid_stats tracking only makes sense on the server side,
on the client there are no other clients to keep track of anyway.

Signed-off-by: Dmitry Eremin <dmiter4ever@gmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/dt_object.h
drivers/staging/lustre/lustre/include/lprocfs_status.h
drivers/staging/lustre/lustre/include/lu_object.h
drivers/staging/lustre/lustre/include/lustre_export.h
drivers/staging/lustre/lustre/include/obd.h
drivers/staging/lustre/lustre/include/obd_class.h
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
drivers/staging/lustre/lustre/obdclass/obd_config.c

index be4c7d95e7884fc0a29a8da2d703843cda75e6c3..866d04b2814bfd6cde4815fb71ff4effd8e6bb0e 100644 (file)
@@ -58,7 +58,6 @@
 #include "../../include/linux/libcfs/libcfs.h"
 
 struct seq_file;
-struct proc_dir_entry;
 struct lustre_cfg;
 
 struct thandle;
index 4b8c265d8fe1c692aae1ad80d5d01f9bba8bcc6a..6a77ea8ec62e769a3237271bdea15dd9a6d2a360 100644 (file)
@@ -558,7 +558,6 @@ extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
 extern void lprocfs_free_md_stats(struct obd_device *obddev);
 struct obd_export;
-struct nid_stat;
 extern int lprocfs_add_clear_entry(struct obd_device *obd,
                                   struct proc_dir_entry *entry);
 extern int lprocfs_exp_cleanup(struct obd_export *exp);
@@ -573,11 +572,6 @@ extern struct proc_dir_entry *lprocfs_add_simple(struct proc_dir_entry *root,
 extern struct dentry *
 ldebugfs_add_symlink(const char *name, struct dentry *parent,
                    const char *format, ...);
-extern void lprocfs_free_per_client_stats(struct obd_device *obd);
-extern int
-lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
-                             unsigned long count, void *data);
-extern int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data);
 
 extern int ldebugfs_register_stats(struct dentry *parent,
                                   const char *name,
@@ -909,15 +903,6 @@ static inline struct proc_dir_entry *
 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
                   void *data, struct file_operations *fops)
 {return 0; }
-static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
-{ return; }
-static inline
-int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
-                                 unsigned long count, void *data)
-{return count;}
-static inline
-int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data)
-{ return 0; }
 
 static inline struct proc_dir_entry *
 lprocfs_register(const char *name, struct proc_dir_entry *parent,
index c8cc48f0002690f130a1b246fdfb3870d1c99781..e1d72a7a5c2dd5bb22eeced75759db6aaf904272 100644 (file)
@@ -43,7 +43,6 @@
 #include "lu_ref.h"
 
 struct seq_file;
-struct proc_dir_entry;
 struct lustre_cfg;
 struct lprocfs_stats;
 
@@ -277,7 +276,6 @@ struct lu_device {
         * Stack this device belongs to.
         */
        struct lu_site              *ld_site;
-       struct proc_dir_entry        *ld_proc_entry;
 
        /** \todo XXX: temporary back pointer into obd. */
        struct obd_device                *ld_obd;
index 9c06a49f12a4f863444d69919c5deebf9f2f82c2..3b992b42fd91b83f92839452ba872f530a6275c0 100644 (file)
@@ -106,34 +106,6 @@ struct mgs_export_data {
        spinlock_t              med_lock;       /* protect med_clients */
 };
 
-/**
- * per-NID statistics structure.
- * It tracks access patterns to this export on a per-client-NID basis
- */
-struct nid_stat {
-       lnet_nid_t             nid;
-       struct hlist_node        nid_hash;
-       struct list_head               nid_list;
-       struct obd_device       *nid_obd;
-       struct proc_dir_entry   *nid_proc;
-       struct lprocfs_stats    *nid_stats;
-       struct lprocfs_stats    *nid_ldlm_stats;
-       atomic_t             nid_exp_ref_count; /* for obd_nid_stats_hash
-                                                          exp_nid_stats */
-};
-
-#define nidstat_getref(nidstat)                                                \
-do {                                                                      \
-       atomic_inc(&(nidstat)->nid_exp_ref_count);                       \
-} while (0)
-
-#define nidstat_putref(nidstat)                                                \
-do {                                                                      \
-       atomic_dec(&(nidstat)->nid_exp_ref_count);                       \
-       LASSERTF(atomic_read(&(nidstat)->nid_exp_ref_count) >= 0,         \
-                "stat %p nid_exp_ref_count < 0\n", nidstat);             \
-} while (0)
-
 enum obd_option {
        OBD_OPT_FORCE =  0x0001,
        OBD_OPT_FAILOVER =      0x0002,
@@ -190,7 +162,6 @@ struct obd_export {
         * exp_lock protect its change
         */
        struct obd_import       *exp_imp_reverse;
-       struct nid_stat   *exp_nid_stats;
        struct lprocfs_stats     *exp_md_stats;
        /** Active connection */
        struct ptlrpc_connection *exp_connection;
index 708a4cfb4659bcdc8c55d29b7f1c8a40f1dc3dee..55452e562bd4823213025279264044e9d31d99c6 100644 (file)
@@ -845,9 +845,6 @@ struct obd_device {
        struct cfs_hash      *obd_uuid_hash;
        /* nid-export hash body */
        struct cfs_hash      *obd_nid_hash;
-       /* nid stats body */
-       struct cfs_hash      *obd_nid_stats_hash;
-       struct list_head              obd_nid_stats;
        atomic_t            obd_refcount;
        wait_queue_head_t            obd_refcount_waitq;
        struct list_head              obd_exports;
index 98b397e139a859d8732d558845da72de6b87098a..63f5224ecb97d6d410a4b3ca0e3f94a0b02ee76a 100644 (file)
@@ -378,10 +378,6 @@ static inline int obd_check_dev_active(struct obd_device *obd)
                        OBD_COUNTER_OFFSET(op);                       \
                LASSERT(coffset < (export)->exp_obd->obd_stats->ls_num);     \
                lprocfs_counter_incr((export)->exp_obd->obd_stats, coffset); \
-               if ((export)->exp_nid_stats != NULL &&                 \
-                   (export)->exp_nid_stats->nid_stats != NULL)       \
-                       lprocfs_counter_incr(                           \
-                               (export)->exp_nid_stats->nid_stats, coffset);\
        }
 
 #define MD_COUNTER_OFFSET(op)                             \
@@ -418,20 +414,6 @@ static inline int obd_check_dev_active(struct obd_device *obd)
 #define EXP_MD_COUNTER_INCREMENT(exp, op)
 #endif
 
-static inline int lprocfs_nid_ldlm_stats_init(struct nid_stat *tmp)
-{
-       /* Always add in ldlm_stats */
-       tmp->nid_ldlm_stats = lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC
-                                                 ,LPROCFS_STATS_FLAG_NOPERCPU);
-       if (tmp->nid_ldlm_stats == NULL)
-               return -ENOMEM;
-
-       lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
-
-       return lprocfs_register_stats(tmp->nid_proc, "ldlm_stats",
-                                     tmp->nid_ldlm_stats);
-}
-
 #define OBD_CHECK_MD_OP(obd, op, err)                     \
 do {                                                       \
        if (!OBT(obd) || !MDP((obd), op)) {                  \
index 3ef5474fcd3459bebba45949d983de0fefb3a720..f44c74611d3b0d736091aa8df87678913eacaa44 100644 (file)
@@ -1106,46 +1106,6 @@ int lprocfs_obd_cleanup(struct obd_device *obd)
 }
 EXPORT_SYMBOL(lprocfs_obd_cleanup);
 
-static void lprocfs_free_client_stats(struct nid_stat *client_stat)
-{
-       CDEBUG(D_CONFIG, "stat %p - data %p/%p\n", client_stat,
-              client_stat->nid_proc, client_stat->nid_stats);
-
-       LASSERTF(atomic_read(&client_stat->nid_exp_ref_count) == 0,
-                "nid %s:count %d\n", libcfs_nid2str(client_stat->nid),
-                atomic_read(&client_stat->nid_exp_ref_count));
-
-       if (client_stat->nid_proc)
-               lprocfs_remove(&client_stat->nid_proc);
-
-       if (client_stat->nid_stats)
-               lprocfs_free_stats(&client_stat->nid_stats);
-
-       if (client_stat->nid_ldlm_stats)
-               lprocfs_free_stats(&client_stat->nid_ldlm_stats);
-
-       kfree(client_stat);
-       return;
-
-}
-
-void lprocfs_free_per_client_stats(struct obd_device *obd)
-{
-       struct cfs_hash *hash = obd->obd_nid_stats_hash;
-       struct nid_stat *stat;
-
-       /* we need extra list - because hash_exit called to early */
-       /* not need locking because all clients is died */
-       while (!list_empty(&obd->obd_nid_stats)) {
-               stat = list_entry(obd->obd_nid_stats.next,
-                                     struct nid_stat, nid_list);
-               list_del_init(&stat->nid_list);
-               cfs_hash_del(hash, &stat->nid, &stat->nid_hash);
-               lprocfs_free_client_stats(stat);
-       }
-}
-EXPORT_SYMBOL(lprocfs_free_per_client_stats);
-
 int lprocfs_stats_alloc_one(struct lprocfs_stats *stats, unsigned int cpuid)
 {
        struct lprocfs_counter  *cntr;
@@ -1679,64 +1639,8 @@ void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
 }
 EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
 
-int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data)
-{
-       seq_printf(m, "%s\n",
-                  "Write into this file to clear all nid stats and stale nid entries");
-       return 0;
-}
-EXPORT_SYMBOL(lprocfs_nid_stats_clear_read);
-
-static int lprocfs_nid_stats_clear_write_cb(void *obj, void *data)
-{
-       struct nid_stat *stat = obj;
-
-       CDEBUG(D_INFO, "refcnt %d\n", atomic_read(&stat->nid_exp_ref_count));
-       if (atomic_read(&stat->nid_exp_ref_count) == 1) {
-               /* object has only hash references. */
-               spin_lock(&stat->nid_obd->obd_nid_lock);
-               list_move(&stat->nid_list, data);
-               spin_unlock(&stat->nid_obd->obd_nid_lock);
-               return 1;
-       }
-       /* we has reference to object - only clear data*/
-       if (stat->nid_stats)
-               lprocfs_clear_stats(stat->nid_stats);
-
-       return 0;
-}
-
-int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
-                                 unsigned long count, void *data)
-{
-       struct obd_device *obd = (struct obd_device *)data;
-       struct nid_stat *client_stat;
-       LIST_HEAD(free_list);
-
-       cfs_hash_cond_del(obd->obd_nid_stats_hash,
-                         lprocfs_nid_stats_clear_write_cb, &free_list);
-
-       while (!list_empty(&free_list)) {
-               client_stat = list_entry(free_list.next, struct nid_stat,
-                                            nid_list);
-               list_del_init(&client_stat->nid_list);
-               lprocfs_free_client_stats(client_stat);
-       }
-
-       return count;
-}
-EXPORT_SYMBOL(lprocfs_nid_stats_clear_write);
-
 int lprocfs_exp_cleanup(struct obd_export *exp)
 {
-       struct nid_stat *stat = exp->exp_nid_stats;
-
-       if (!stat || !exp->exp_obd)
-               return 0;
-
-       nidstat_putref(exp->exp_nid_stats);
-       exp->exp_nid_stats = NULL;
-
        return 0;
 }
 EXPORT_SYMBOL(lprocfs_exp_cleanup);
index 0bda9c56f1487cd69cbcb15941ccdc826a8ad2d8..19d4eb045b1b890de61bcdeebab7676b653e987f 100644 (file)
@@ -49,7 +49,6 @@
 
 static cfs_hash_ops_t uuid_hash_ops;
 static cfs_hash_ops_t nid_hash_ops;
-static cfs_hash_ops_t nid_stat_hash_ops;
 
 /*********** string parsing utils *********/
 
@@ -383,7 +382,6 @@ int class_attach(struct lustre_cfg *lcfg)
        INIT_LIST_HEAD(&obd->obd_unlinked_exports);
        INIT_LIST_HEAD(&obd->obd_delayed_exports);
        INIT_LIST_HEAD(&obd->obd_exports_timed);
-       INIT_LIST_HEAD(&obd->obd_nid_stats);
        spin_lock_init(&obd->obd_nid_lock);
        spin_lock_init(&obd->obd_dev_lock);
        mutex_init(&obd->obd_dev_mutex);
@@ -486,7 +484,6 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
        obd->obd_starting = 1;
        obd->obd_uuid_hash = NULL;
        obd->obd_nid_hash = NULL;
-       obd->obd_nid_stats_hash = NULL;
        spin_unlock(&obd->obd_dev_lock);
 
        /* create an uuid-export lustre hash */
@@ -515,19 +512,6 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                goto err_hash;
        }
 
-       /* create a nid-stats lustre hash */
-       obd->obd_nid_stats_hash = cfs_hash_create("NID_STATS",
-                                                 HASH_NID_STATS_CUR_BITS,
-                                                 HASH_NID_STATS_MAX_BITS,
-                                                 HASH_NID_STATS_BKT_BITS, 0,
-                                                 CFS_HASH_MIN_THETA,
-                                                 CFS_HASH_MAX_THETA,
-                                                 &nid_stat_hash_ops, CFS_HASH_DEFAULT);
-       if (!obd->obd_nid_stats_hash) {
-               err = -ENOMEM;
-               goto err_hash;
-       }
-
        exp = class_new_export(obd, &obd->obd_uuid);
        if (IS_ERR(exp)) {
                err = PTR_ERR(exp);
@@ -567,10 +551,6 @@ err_hash:
                cfs_hash_putref(obd->obd_nid_hash);
                obd->obd_nid_hash = NULL;
        }
-       if (obd->obd_nid_stats_hash) {
-               cfs_hash_putref(obd->obd_nid_stats_hash);
-               obd->obd_nid_stats_hash = NULL;
-       }
        obd->obd_starting = 0;
        CERROR("setup %s failed (%d)\n", obd->obd_name, err);
        return err;
@@ -694,12 +674,6 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg)
                obd->obd_nid_hash = NULL;
        }
 
-       /* destroy a nid-stats hash body */
-       if (obd->obd_nid_stats_hash) {
-               cfs_hash_putref(obd->obd_nid_stats_hash);
-               obd->obd_nid_stats_hash = NULL;
-       }
-
        class_decref(obd, "setup", obd);
        obd->obd_set_up = 0;
 
@@ -1893,57 +1867,3 @@ static cfs_hash_ops_t nid_hash_ops = {
        .hs_get  = nid_export_get,
        .hs_put_locked  = nid_export_put_locked,
 };
-
-
-/*
- * nid<->nidstats hash operations
- */
-
-static void *
-nidstats_key(struct hlist_node *hnode)
-{
-       struct nid_stat *ns;
-
-       ns = hlist_entry(hnode, struct nid_stat, nid_hash);
-
-       return &ns->nid;
-}
-
-static int
-nidstats_keycmp(const void *key, struct hlist_node *hnode)
-{
-       return *(lnet_nid_t *)nidstats_key(hnode) == *(lnet_nid_t *)key;
-}
-
-static void *
-nidstats_object(struct hlist_node *hnode)
-{
-       return hlist_entry(hnode, struct nid_stat, nid_hash);
-}
-
-static void
-nidstats_get(struct cfs_hash *hs, struct hlist_node *hnode)
-{
-       struct nid_stat *ns;
-
-       ns = hlist_entry(hnode, struct nid_stat, nid_hash);
-       nidstat_getref(ns);
-}
-
-static void
-nidstats_put_locked(struct cfs_hash *hs, struct hlist_node *hnode)
-{
-       struct nid_stat *ns;
-
-       ns = hlist_entry(hnode, struct nid_stat, nid_hash);
-       nidstat_putref(ns);
-}
-
-static cfs_hash_ops_t nid_stat_hash_ops = {
-       .hs_hash        = nid_hash,
-       .hs_key  = nidstats_key,
-       .hs_keycmp      = nidstats_keycmp,
-       .hs_object      = nidstats_object,
-       .hs_get  = nidstats_get,
-       .hs_put_locked  = nidstats_put_locked,
-};