Whamcloud - gitweb
LU-8066 obd: use correct names for conn_uuid 13/33213/6
authorJames Simmons <uja.ornl@yahoo.com>
Sat, 13 Oct 2018 02:34:58 +0000 (22:34 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 29 Oct 2018 16:00:43 +0000 (16:00 +0000)
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 <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/33213
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lprocfs_status.h
lustre/mdc/lproc_mdc.c
lustre/mgc/lproc_mgc.c
lustre/obdclass/lprocfs_status.c
lustre/osc/lproc_osc.c
lustre/osp/lproc_osp.c

index 64658f8..d42981d 100644 (file)
@@ -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);
 /* 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);
 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; }
 { 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)
 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)
index e2efa79..fd5dcf0 100644 (file)
@@ -222,6 +222,7 @@ static ssize_t contention_seconds_store(struct kobject *kobj,
 }
 LUSTRE_RW_ATTR(contention_seconds);
 
 }
 LUSTRE_RW_ATTR(contention_seconds);
 
+LUSTRE_ATTR(mds_conn_uuid, 0444, conn_uuid_show, NULL);
 LUSTRE_RO_ATTR(conn_uuid);
 
 LUSTRE_WO_ATTR(ping);
 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_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,
        &lustre_attr_conn_uuid.attr,
        &lustre_attr_ping.attr,
        NULL,
index b15e8b7..b712008 100644 (file)
@@ -69,10 +69,13 @@ struct lprocfs_vars lprocfs_mgc_obd_vars[] = {
 };
 #endif /* CONFIG_PROC_FS */
 
 };
 #endif /* CONFIG_PROC_FS */
 
+LUSTRE_ATTR(mgs_conn_uuid, 0444, conn_uuid_show, NULL);
 LUSTRE_RO_ATTR(conn_uuid);
 LUSTRE_RO_ATTR(conn_uuid);
+
 LUSTRE_WO_ATTR(ping);
 
 static struct attribute *mgc_attrs[] = {
 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,
        &lustre_attr_conn_uuid.attr,
        &lustre_attr_ping.attr,
        NULL,
index 1f064ff..028b47b 100644 (file)
@@ -566,26 +566,6 @@ int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data)
 }
 EXPORT_SYMBOL(lprocfs_server_uuid_seq_show);
 
 }
 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", "<none>");
-
-       LPROCFS_CLIMP_EXIT(obd);
-       return rc;
-}
-EXPORT_SYMBOL(lprocfs_conn_uuid_seq_show);
-
 /** add up per-cpu counters */
 
 /**
 /** add up per-cpu counters */
 
 /**
index 7ff4d11..2a4dd88 100644 (file)
@@ -186,6 +186,7 @@ static ssize_t max_dirty_mb_store(struct kobject *kobj,
 }
 LUSTRE_RW_ATTR(max_dirty_mb);
 
 }
 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);
 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_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,
        &lustre_attr_conn_uuid.attr,
        &lustre_attr_ping.attr,
        &lustre_attr_idle_timeout.attr,
index 98ec193..e1d5509 100644 (file)
@@ -763,10 +763,32 @@ ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
 }
 LUSTRE_RO_ATTR(ping);
 
 }
 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", "<none>");
+
+       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, 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);
 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           },
          .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",
        { .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           },
          .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",
        { .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_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,
        &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_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,
        &lustre_attr_ping.attr,
        &lustre_attr_prealloc_status.attr,
        NULL,