From abc6c1c6f676d7d50ddd24cdb2d72a61a123d09f Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Thu, 8 Jul 2021 11:32:48 +1000 Subject: [PATCH] LU-10391 ptlrpc: lprocfs_exp_setup() to take struct lnet_nid lprocfs_exp_setup() now takes 'struct lnet_nid *' as peer_nid. Signed-off-by: Mr NeilBrown Change-Id: If779893d8b1c7b650d39182c121c1f611d058f0d Reviewed-on: https://review.whamcloud.com/44642 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: James Simmons Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- lustre/include/lprocfs_status.h | 5 +++-- lustre/mdt/mdt_fs.c | 10 ++++++++-- lustre/mgs/mgs_fs.c | 10 ++++++++-- lustre/obdclass/lprocfs_status_server.c | 8 ++++---- lustre/ofd/ofd_obd.c | 10 ++++++++-- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 7103ffa..76c1eec 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -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) diff --git a/lustre/mdt/mdt_fs.c b/lustre/mdt/mdt_fs.c index 262cabe..ac9d7c6 100644 --- a/lustre/mdt/mdt_fs.c +++ b/lustre/mdt/mdt_fs.c @@ -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); diff --git a/lustre/mgs/mgs_fs.c b/lustre/mgs/mgs_fs.c index cdbad80..d2bc246 100644 --- a/lustre/mgs/mgs_fs.c +++ b/lustre/mgs/mgs_fs.c @@ -57,13 +57,19 @@ 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); diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index afdcb51..fe2d785 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -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); diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index 1414050..b6768be 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -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); -- 1.8.3.1