Whamcloud - gitweb
LU-10391 ptlrpc: lprocfs_exp_setup() to take struct lnet_nid 42/44642/5
authorMr NeilBrown <neilb@suse.de>
Thu, 8 Jul 2021 01:32:48 +0000 (11:32 +1000)
committerOleg Drokin <green@whamcloud.com>
Mon, 12 Sep 2022 02:52:43 +0000 (02:52 +0000)
lprocfs_exp_setup() now takes 'struct lnet_nid *' as peer_nid.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: If779893d8b1c7b650d39182c121c1f611d058f0d
Reviewed-on: https://review.whamcloud.com/44642
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lprocfs_status.h
lustre/mdt/mdt_fs.c
lustre/mgs/mgs_fs.c
lustre/obdclass/lprocfs_status_server.c
lustre/ofd/ofd_obd.c

index 7103ffa..76c1eec 100644 (file)
@@ -537,7 +537,7 @@ struct nid_stat;
 extern int lprocfs_add_clear_entry(struct obd_device *obd,
                                   struct proc_dir_entry *entry);
 #ifdef HAVE_SERVER_SUPPORT
-extern int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *peer_nid);
+extern int lprocfs_exp_setup(struct obd_export *exp, struct lnet_nid *peer_nid);
 extern int lprocfs_exp_cleanup(struct obd_export *exp);
 struct dentry *ldebugfs_add_symlink(const char *name, const char *target,
                                    const char *format, ...);
@@ -974,7 +974,8 @@ ssize_t lprocfs_nid_stats_seq_write(struct file *file,
 static inline
 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
 {return 0;}
-static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid)
+static inline int lprocfs_exp_setup(struct obd_export *exp,
+                                   struct lnet_nid *peer_nid)
 { return 0; }
 #endif
 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
index 262cabe..ac9d7c6 100644 (file)
@@ -63,12 +63,18 @@ static const struct proc_ops mdt_open_files_seq_fops = {
 int mdt_export_stats_init(struct obd_device *obd, struct obd_export *exp,
                          void *localdata)
 {
-       lnet_nid_t *client_nid = localdata;
+       lnet_nid_t *client_nid4 = localdata;
        struct nid_stat *stats;
        int rc;
        ENTRY;
 
-       rc = lprocfs_exp_setup(exp, client_nid);
+       if (client_nid4) {
+               struct lnet_nid client_nid;
+
+               lnet_nid4_to_nid(*client_nid4, &client_nid);
+               rc = lprocfs_exp_setup(exp, &client_nid);
+       } else
+               rc = lprocfs_exp_setup(exp, NULL);
        if (rc != 0)
                /* Mask error for already created /proc entries */
                RETURN(rc == -EALREADY ? 0 : rc);
index cdbad80..d2bc246 100644 (file)
 int mgs_export_stats_init(struct obd_device *obd, struct obd_export *exp,
                          void *localdata)
 {
-       lnet_nid_t *client_nid = localdata;
+       lnet_nid_t *client_nid4 = localdata;
        struct nid_stat *stats;
        int rc;
 
        ENTRY;
 
-       rc = lprocfs_exp_setup(exp, client_nid);
+       if (client_nid4) {
+               struct lnet_nid client_nid;
+
+               lnet_nid4_to_nid(*client_nid4, &client_nid);
+               rc = lprocfs_exp_setup(exp, &client_nid);
+       } else
+               rc = lprocfs_exp_setup(exp, NULL);
        if (rc != 0)
                /* Mask error for already created /proc entries */
                RETURN(rc == -EALREADY ? 0 : rc);
index afdcb51..fe2d785 100644 (file)
@@ -511,7 +511,7 @@ lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
 }
 EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_write);
 
-int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid)
+int lprocfs_exp_setup(struct obd_export *exp, struct lnet_nid *nid)
 {
        struct nid_stat *new_stat, *old_stat;
        struct obd_device *obd = NULL;
@@ -527,10 +527,10 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid)
        /* not test against zero because eric say:
         * You may only test nid against another nid, or LNET_NID_ANY.
         * Anything else is nonsense.*/
-       if (nid == NULL || *nid == LNET_NID_ANY)
+       if (nid == NULL || LNET_NID_IS_ANY(nid))
                RETURN(-EALREADY);
 
-       libcfs_nid2str_r(*nid, nidstr, sizeof(nidstr));
+       libcfs_nidstr_r(nid, nidstr, sizeof(nidstr));
 
        spin_lock(&exp->exp_lock);
        if (exp->exp_nid_stats != NULL) {
@@ -547,7 +547,7 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid)
        if (new_stat == NULL)
                RETURN(-ENOMEM);
 
-       lnet_nid4_to_nid(*nid, &new_stat->nid);
+       new_stat->nid = *nid;
        new_stat->nid_obd = exp->exp_obd;
        /* we need set default refcount to 1 to balance obd_disconnect */
        atomic_set(&new_stat->nid_exp_ref_count, 1);
index 1414050..b6768be 100644 (file)
@@ -64,7 +64,7 @@
  */
 static int ofd_export_stats_init(struct ofd_device *ofd,
                                 struct obd_export *exp,
-                                lnet_nid_t *client_nid)
+                                lnet_nid_t *client_nid4)
 {
        struct obd_device       *obd = ofd_obd(ofd);
        struct nid_stat         *stats;
@@ -76,7 +76,13 @@ static int ofd_export_stats_init(struct ofd_device *ofd,
                /* Self-export gets no proc entry */
                RETURN(0);
 
-       rc = lprocfs_exp_setup(exp, client_nid);
+       if (client_nid4) {
+               struct lnet_nid client_nid;
+
+               lnet_nid4_to_nid(*client_nid4, &client_nid);
+               rc = lprocfs_exp_setup(exp, &client_nid);
+       } else
+               rc = lprocfs_exp_setup(exp, NULL);
        if (rc != 0)
                /* Mask error for already created /proc entries */
                RETURN(rc == -EALREADY ? 0 : rc);