From f2bf876ef77ed8eda2eeb1b78ead85c1a7a8f81e Mon Sep 17 00:00:00 2001 From: James Simmons Date: Fri, 12 Oct 2018 22:34:58 -0400 Subject: [PATCH 1/1] LU-8066 obd: use correct names for conn_uuid The LUSTRE_R[OW]_ATTR() macros assume that the name of the sysfs file to create matches the beginning of the function names. In the case of LUSTRE_RO_ATTR(conn_uuid) this maps to the function conn_uuid_show() and generated sysfs files "conn_uuid". While it makes sense to standardize this interface we need to keep the old xxx_conn_uuid. We can create these xxx_conn_uuid sysfs files by using the base sysfs attr macro LUSTRE_ATTR(). Change-Id: I3bea85334578a07f4758f54773846d0f24a3d69a Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/33213 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/include/lprocfs_status.h | 3 --- lustre/mdc/lproc_mdc.c | 2 ++ lustre/mgc/lproc_mgc.c | 3 +++ lustre/obdclass/lprocfs_status.c | 20 -------------------- lustre/osc/lproc_osc.c | 2 ++ lustre/osp/lproc_osp.c | 32 ++++++++++++++++++++++++++------ 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 64658f8..d42981d 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -572,7 +572,6 @@ extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name, /* Generic callbacks */ extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data); extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data); -extern int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data); ssize_t conn_uuid_show(struct kobject *kobj, struct attribute *attr, char *buf); extern int lprocfs_import_seq_show(struct seq_file *m, void *data); extern int lprocfs_state_seq_show(struct seq_file *m, void *data); @@ -959,8 +958,6 @@ static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data) { return 0; } static inline int lprocfs_server_seq_show(struct seq_file *m, void *data) { return 0; } -static inline int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data) -{ return 0; } static inline int lprocfs_import_seq_show(struct seq_file *m, void *data) { return 0; } static inline int lprocfs_state_seq_show(struct seq_file *m, void *data) diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index e2efa79..fd5dcf0 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -222,6 +222,7 @@ static ssize_t contention_seconds_store(struct kobject *kobj, } LUSTRE_RW_ATTR(contention_seconds); +LUSTRE_ATTR(mds_conn_uuid, 0444, conn_uuid_show, NULL); LUSTRE_RO_ATTR(conn_uuid); LUSTRE_WO_ATTR(ping); @@ -526,6 +527,7 @@ static struct attribute *mdc_attrs[] = { &lustre_attr_max_rpcs_in_flight.attr, &lustre_attr_max_mod_rpcs_in_flight.attr, &lustre_attr_contention_seconds.attr, + &lustre_attr_mds_conn_uuid.attr, &lustre_attr_conn_uuid.attr, &lustre_attr_ping.attr, NULL, diff --git a/lustre/mgc/lproc_mgc.c b/lustre/mgc/lproc_mgc.c index b15e8b7..b712008 100644 --- a/lustre/mgc/lproc_mgc.c +++ b/lustre/mgc/lproc_mgc.c @@ -69,10 +69,13 @@ struct lprocfs_vars lprocfs_mgc_obd_vars[] = { }; #endif /* CONFIG_PROC_FS */ +LUSTRE_ATTR(mgs_conn_uuid, 0444, conn_uuid_show, NULL); LUSTRE_RO_ATTR(conn_uuid); + LUSTRE_WO_ATTR(ping); static struct attribute *mgc_attrs[] = { + &lustre_attr_mgs_conn_uuid.attr, &lustre_attr_conn_uuid.attr, &lustre_attr_ping.attr, NULL, diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 1f064ff..028b47b 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -566,26 +566,6 @@ int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data) } EXPORT_SYMBOL(lprocfs_server_uuid_seq_show); -int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data) -{ - struct obd_device *obd = data; - struct ptlrpc_connection *conn; - int rc = 0; - - LASSERT(obd != NULL); - - LPROCFS_CLIMP_CHECK(obd); - conn = obd->u.cli.cl_import->imp_connection; - if (conn && obd->u.cli.cl_import) - seq_printf(m, "%s\n", conn->c_remote_uuid.uuid); - else - seq_printf(m, "%s\n", ""); - - LPROCFS_CLIMP_EXIT(obd); - return rc; -} -EXPORT_SYMBOL(lprocfs_conn_uuid_seq_show); - /** add up per-cpu counters */ /** diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 7ff4d11..2a4dd88 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -186,6 +186,7 @@ static ssize_t max_dirty_mb_store(struct kobject *kobj, } LUSTRE_RW_ATTR(max_dirty_mb); +LUSTRE_ATTR(ost_conn_uuid, 0444, conn_uuid_show, NULL); LUSTRE_RO_ATTR(conn_uuid); LUSTRE_WO_ATTR(ping); @@ -960,6 +961,7 @@ static struct attribute *osc_attrs[] = { &lustre_attr_max_rpcs_in_flight.attr, &lustre_attr_short_io_bytes.attr, &lustre_attr_resend_count.attr, + &lustre_attr_ost_conn_uuid.attr, &lustre_attr_conn_uuid.attr, &lustre_attr_ping.attr, &lustre_attr_idle_timeout.attr, diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c index 98ec193..e1d5509 100644 --- a/lustre/osp/lproc_osp.c +++ b/lustre/osp/lproc_osp.c @@ -763,10 +763,32 @@ ssize_t ping_show(struct kobject *kobj, struct attribute *attr, } LUSTRE_RO_ATTR(ping); +ssize_t osp_conn_uuid_show(struct kobject *kobj, struct attribute *attr, + char *buf) +{ + struct dt_device *dt = container_of(kobj, struct dt_device, + dd_kobj); + struct lu_device *lu = dt2lu_dev(dt); + struct obd_device *obd = lu->ld_obd; + struct ptlrpc_connection *conn; + ssize_t count; + + LPROCFS_CLIMP_CHECK(obd); + conn = obd->u.cli.cl_import->imp_connection; + if (conn && obd->u.cli.cl_import) + count = sprintf(buf, "%s\n", conn->c_remote_uuid.uuid); + else + count = sprintf(buf, "%s\n", ""); + + LPROCFS_CLIMP_EXIT(obd); + return count; +} + +LUSTRE_ATTR(ost_conn_uuid, 0444, osp_conn_uuid_show, NULL); +LUSTRE_ATTR(mdt_conn_uuid, 0444, osp_conn_uuid_show, NULL); + LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, connect_flags); LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, server_uuid); -LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, conn_uuid); - LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, timeouts); LPROC_SEQ_FOPS_RW_TYPE(osp, import); @@ -916,8 +938,6 @@ static struct lprocfs_vars lprocfs_osp_obd_vars[] = { .fops = &osp_connect_flags_fops }, { .name = "ost_server_uuid", .fops = &osp_server_uuid_fops }, - { .name = "ost_conn_uuid", - .fops = &osp_conn_uuid_fops }, { .name = "timeouts", .fops = &osp_timeouts_fops }, { .name = "import", @@ -936,8 +956,6 @@ static struct lprocfs_vars lprocfs_osp_md_vars[] = { .fops = &osp_connect_flags_fops }, { .name = "mdt_server_uuid", .fops = &osp_server_uuid_fops }, - { .name = "mdt_conn_uuid", - .fops = &osp_conn_uuid_fops }, { .name = "timeouts", .fops = &osp_timeouts_fops }, { .name = "import", @@ -955,6 +973,7 @@ static struct attribute *osp_obd_attrs[] = { &lustre_attr_max_rpcs_in_flight.attr, &lustre_attr_max_rpcs_in_progress.attr, &lustre_attr_maxage.attr, + &lustre_attr_ost_conn_uuid.attr, &lustre_attr_ping.attr, &lustre_attr_prealloc_status.attr, &lustre_attr_prealloc_next_id.attr, @@ -980,6 +999,7 @@ static struct attribute *osp_md_attrs[] = { &lustre_attr_max_rpcs_in_flight.attr, &lustre_attr_max_rpcs_in_progress.attr, &lustre_attr_maxage.attr, + &lustre_attr_mdt_conn_uuid.attr, &lustre_attr_ping.attr, &lustre_attr_prealloc_status.attr, NULL, -- 1.8.3.1