Whamcloud - gitweb
LU-3319 lprocfs: client side cleanups 43/8943/2
authorJames Simmons <uja.ornl@gmail.com>
Tue, 21 Jan 2014 17:06:59 +0000 (12:06 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 1 Mar 2014 02:37:34 +0000 (02:37 +0000)
Now that all the client side seq_file patches it is
time to handle the issue that people pointed out but
were not severe enough to prevent landing. This patch
addresses all the concerns as well and move all struct
lprocfs_seq_var to be initialized C99 style.

Change-Id: I89e8b719bd067ecf4e3cab481a2d4c62d5052af0
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-on: http://review.whamcloud.com/8943
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
13 files changed:
lustre/fid/lproc_fid.c
lustre/lmv/lproc_lmv.c
lustre/lov/lproc_lov.c
lustre/mdc/lproc_mdc.c
lustre/mgc/lproc_mgc.c
lustre/obdclass/lprocfs_status.c
lustre/obdecho/echo.c
lustre/osc/lproc_osc.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/ptlrpc/lproc_ptlrpc.c
lustre/quota/qmt_pool.c
lustre/quota/qsd_lib.c

index d89c4f6..3b9d170 100644 (file)
@@ -203,9 +203,12 @@ LPROC_SEQ_FOPS(lprocfs_server_fid_width);
 LPROC_SEQ_FOPS_RO(lprocfs_server_fid_server);
 
 struct lprocfs_seq_vars seq_server_proc_list[] = {
-       { "space",      &lprocfs_server_fid_space_fops },
-       { "width",      &lprocfs_server_fid_width_fops },
-       { "server",     &lprocfs_server_fid_server_fops },
+       { .name =       "space",
+         .fops =       &lprocfs_server_fid_space_fops  },
+       { .name =       "width",
+         .fops =       &lprocfs_server_fid_width_fops  },
+       { .name =       "server",
+         .fops =       &lprocfs_server_fid_server_fops },
        { NULL }
 };
 
@@ -623,10 +626,14 @@ LPROC_SEQ_FOPS_RO(lprocfs_client_fid_server);
 LPROC_SEQ_FOPS_RO(lprocfs_client_fid_fid);
 
 struct lprocfs_seq_vars seq_client_proc_list[] = {
-       { "space",      &lprocfs_client_fid_space_fops },
-       { "width",      &lprocfs_client_fid_width_fops },
-       { "server",     &lprocfs_client_fid_server_fops },
-       { "fid",        &lprocfs_client_fid_fid_fops },
+       { .name =       "space",
+         .fops =       &lprocfs_client_fid_space_fops  },
+       { .name =       "width",
+         .fops =       &lprocfs_client_fid_width_fops  },
+       { .name =       "server",
+         .fops =       &lprocfs_client_fid_server_fops },
+       { .name =       "fid",
+         .fops =       &lprocfs_client_fid_fid_fops    },
        { NULL }
 };
 #endif
index eea5927..5a7271a 100644 (file)
@@ -203,11 +203,16 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file)
 LPROC_SEQ_FOPS_RO_TYPE(lmv, uuid);
 
 struct lprocfs_seq_vars lprocfs_lmv_obd_vars[] = {
-       { "numobd",     &lmv_numobd_fops        },
-       { "placement",  &lmv_placement_fops     },
-       { "activeobd",  &lmv_activeobd_fops     },
-       { "uuid",       &lmv_uuid_fops          },
-       { "desc_uuid",  &lmv_desc_uuid_fops     },
+       { .name =       "numobd",
+         .fops =       &lmv_numobd_fops        },
+       { .name =       "placement",
+         .fops =       &lmv_placement_fops     },
+       { .name =       "activeobd",
+         .fops =       &lmv_activeobd_fops     },
+       { .name =       "uuid",
+         .fops =       &lmv_uuid_fops          },
+       { .name =       "desc_uuid",
+         .fops =       &lmv_desc_uuid_fops     },
        { 0 }
 };
 
index e400faf..7786513 100644 (file)
@@ -263,20 +263,34 @@ LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree);
 LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail);
 
 struct lprocfs_seq_vars lprocfs_lov_obd_vars[] = {
-       { "uuid",               &lov_uuid_fops          },
-       { "stripesize",         &lov_stripesize_fops    },
-       { "stripeoffset",       &lov_stripeoffset_fops  },
-       { "stripecount",        &lov_stripecount_fops   },
-       { "stripetype",         &lov_stripetype_fops    },
-       { "numobd",             &lov_numobd_fops        },
-       { "activeobd",          &lov_activeobd_fops     },
-       { "filestotal",         &lov_filestotal_fops    },
-       { "filesfree",          &lov_filesfree_fops     },
-       { "blocksize",          &lov_blksize_fops       },
-       { "kbytestotal",        &lov_kbytestotal_fops   },
-       { "kbytesfree",         &lov_kbytesfree_fops    },
-       { "kbytesavail",        &lov_kbytesavail_fops   },
-       { "desc_uuid",          &lov_desc_uuid_fops     },
+       { .name =       "uuid",
+         .fops =       &lov_uuid_fops          },
+       { .name =       "stripesize",
+         .fops =       &lov_stripesize_fops    },
+       { .name =       "stripeoffset",
+         .fops =       &lov_stripeoffset_fops  },
+       { .name =       "stripecount",
+         .fops =       &lov_stripecount_fops   },
+       { .name =       "stripetype",
+         .fops =       &lov_stripetype_fops    },
+       { .name =       "numobd",
+         .fops =       &lov_numobd_fops        },
+       { .name =       "activeobd",
+         .fops =       &lov_activeobd_fops     },
+       { .name =       "filestotal",
+         .fops =       &lov_filestotal_fops    },
+       { .name =       "filesfree",
+         .fops =       &lov_filesfree_fops     },
+       { .name =       "blocksize",
+         .fops =       &lov_blksize_fops       },
+       { .name =       "kbytestotal",
+         .fops =       &lov_kbytestotal_fops   },
+       { .name =       "kbytesfree",
+         .fops =       &lov_kbytesfree_fops    },
+       { .name =       "kbytesavail",
+         .fops =       &lov_kbytesavail_fops   },
+       { .name =       "desc_uuid",
+         .fops =       &lov_desc_uuid_fops     },
        { 0 }
 };
 
index cba4f61..69e377f 100644 (file)
@@ -103,29 +103,47 @@ LPROC_SEQ_FOPS_RW_TYPE(mdc, import);
 LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov);
 
 struct lprocfs_seq_vars lprocfs_mdc_obd_vars[] = {
-       { "uuid",               &mdc_uuid_fops,         0,      0 },
-       { "ping",               &mdc_ping_fops,         0,      0222 },
-       { "connect_flags",      &mdc_connect_flags_fops,0,      0 },
-       { "blocksize",          &mdc_blksize_fops,      0,      0 },
-       { "kbytestotal",        &mdc_kbytestotal_fops,  0,      0 },
-       { "kbytesfree",         &mdc_kbytesfree_fops,   0,      0 },
-       { "kbytesavail",        &mdc_kbytesavail_fops,  0,      0 },
-       { "filestotal",         &mdc_filestotal_fops,   0,      0 },
-       { "filesfree",          &mdc_filesfree_fops,    0,      0 },
-       { "mds_server_uuid",    &mdc_server_uuid_fops,  0,      0 },
-       { "mds_conn_uuid",      &mdc_conn_uuid_fops,    0,      0 },
+       { .name =       "uuid",
+         .fops =       &mdc_uuid_fops          },
+       { .name =       "ping",
+         .fops =       &mdc_ping_fops,
+         .proc_mode =  0222                    },
+       { .name =       "connect_flags",
+         .fops =       &mdc_connect_flags_fops },
+       { .name =       "blocksize",
+         .fops =       &mdc_blksize_fops       },
+       { .name =       "kbytestotal",
+         .fops =       &mdc_kbytestotal_fops   },
+       { .name =       "kbytesfree",
+         .fops =       &mdc_kbytesfree_fops    },
+       { .name =       "kbytesavail",
+         .fops =       &mdc_kbytesavail_fops   },
+       { .name =       "filestotal",
+         .fops =       &mdc_filestotal_fops    },
+       { .name =       "filesfree",
+         .fops =       &mdc_filesfree_fops     },
+       { .name =       "mds_server_uuid",
+         .fops =       &mdc_server_uuid_fops   },
+       { .name =       "mds_conn_uuid",
+         .fops =       &mdc_conn_uuid_fops     },
        /*
         * FIXME: below proc entry is provided, but not in used, instead
         * sbi->sb_md_brw_size is used, the per obd variable should be used
         * when CMD is enabled, and dir pages are managed in MDC layer.
         * Remember to enable proc write function.
         */
-       { "max_pages_per_rpc",  &mdc_obd_max_pages_per_rpc_fops },
-       { "max_rpcs_in_flight", &mdc_max_rpcs_in_flight_fops    },
-       { "timeouts",           &mdc_timeouts_fops              },
-       { "import",             &mdc_import_fops                },
-       { "state",              &mdc_state_fops                 },
-       { "pinger_recov",       &mdc_pinger_recov_fops          },
+       { .name =       "max_pages_per_rpc",
+         .fops =       &mdc_obd_max_pages_per_rpc_fops },
+       { .name =       "max_rpcs_in_flight",
+         .fops =       &mdc_max_rpcs_in_flight_fops    },
+       { .name =       "timeouts",
+         .fops =       &mdc_timeouts_fops              },
+       { .name =       "import",
+         .fops =       &mdc_import_fops                },
+       { .name =       "state",
+         .fops =       &mdc_state_fops                 },
+       { .name =       "pinger_recov",
+         .fops =       &mdc_pinger_recov_fops          },
        { 0 }
 };
 #endif /* LPROCFS */
index 648b6e5..f818def 100644 (file)
@@ -59,14 +59,23 @@ static int mgc_ir_state_seq_show(struct seq_file *m, void *v)
 LPROC_SEQ_FOPS_RO(mgc_ir_state);
 
 struct lprocfs_seq_vars lprocfs_mgc_obd_vars[] = {
-       { "uuid",               &mgc_uuid_fops,         0,      0 },
-       { "ping",               &mgc_ping_fops,         0,      0222 },
-       { "connect_flags",      &mgc_connect_flags_fops,0,      0 },
-       { "mgs_server_uuid",    &mgc_server_uuid_fops,  0,      0 },
-       { "mgs_conn_uuid",      &mgc_conn_uuid_fops,    0,      0 },
-       { "import",             &mgc_import_fops,       0,      0 },
-       { "state",              &mgc_state_fops,        0,      0 },
-       { "ir_state",           &mgc_ir_state_fops,     0,      0 },
+       { .name =       "uuid",
+         .fops =       &mgc_uuid_fops          },
+       { .name =       "ping",
+         .fops =       &mgc_ping_fops,
+         .proc_mode =  0222                    },
+       { .name =       "connect_flags",
+         .fops =       &mgc_connect_flags_fops },
+       { .name =       "mgs_server_uuid",
+         .fops =       &mgc_server_uuid_fops   },
+       { .name =       "mgs_conn_uuid",
+         .fops =       &mgc_conn_uuid_fops     },
+       { .name =       "import",
+         .fops =       &mgc_import_fops        },
+       { .name =       "state",
+         .fops =       &mgc_state_fops         },
+       { .name =       "ir_state",
+         .fops =       &mgc_ir_state_fops      },
        { 0 }
 };
 #endif /* LPROCFS */
index 0ca58c5..973fd0b 100644 (file)
@@ -2584,7 +2584,6 @@ void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
 EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
 
 #ifdef HAVE_SERVER_SUPPORT
-/* No one appears to be using this ?? */
 int lprocfs_exp_nid_seq_show(struct seq_file *m, void *data)
 {
        struct obd_export *exp = m->private;
index 6d63aff..8563e68 100644 (file)
@@ -561,7 +561,8 @@ commitrw_cleanup:
 
 LPROC_SEQ_FOPS_RO_TYPE(echo, uuid);
 static struct lprocfs_seq_vars lprocfs_echo_obd_vars[] = {
-       { "uuid",       &echo_uuid_fops         },
+       { .name =       "uuid",
+         .fops =       &echo_uuid_fops         },
        { 0 }
 };
 
index d6e3703..ccfc212 100644 (file)
@@ -543,37 +543,69 @@ LPROC_SEQ_FOPS_RW_TYPE(osc, import);
 LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov);
 
 struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = {
-       { "uuid",               &osc_uuid_fops                  },
-       { "ping",               &osc_ping_fops,         0, 0222 },
-       { "connect_flags",      &osc_connect_flags_fops         },
-       { "blocksize",          &osc_blksize_fops               },
-       { "kbytestotal",        &osc_kbytestotal_fops           },
-       { "kbytesfree",         &osc_kbytesfree_fops            },
-       { "kbytesavail",        &osc_kbytesavail_fops           },
-       { "filestotal",         &osc_filestotal_fops            },
-       { "filesfree",          &osc_filesfree_fops             },
-       { "ost_server_uuid",    &osc_server_uuid_fops           },
-       { "ost_conn_uuid",      &osc_conn_uuid_fops             },
-       { "active",             &osc_active_fops                },
-       { "max_pages_per_rpc",  &osc_obd_max_pages_per_rpc_fops },
-       { "max_rpcs_in_flight", &osc_max_rpcs_in_flight_fops    },
-       { "destroys_in_flight", &osc_destroys_in_flight_fops    },
-       { "max_dirty_mb",       &osc_max_dirty_mb_fops          },
-       { "osc_cached_mb",      &osc_cached_mb_fops             },
-       { "cur_dirty_bytes",    &osc_cur_dirty_bytes_fops       },
-       { "cur_grant_bytes",    &osc_cur_grant_bytes_fops       },
-       { "cur_lost_grant_bytes",       &osc_cur_lost_grant_bytes_fops  },
-       { "grant_shrink_interval",      &osc_grant_shrink_interval_fops },
-       { "checksums",          &osc_checksum_fops              },
-       { "checksum_type",      &osc_checksum_type_fops         },
-       { "resend_count",       &osc_resend_count_fops          },
-       { "timeouts",           &osc_timeouts_fops              },
-       { "contention_seconds", &osc_contention_seconds_fops    },
-       { "lockless_truncate",  &osc_lockless_truncate_fops     },
-       { "import",             &osc_import_fops                },
-       { "state",              &osc_state_fops                 },
-       { "pinger_recov",       &osc_pinger_recov_fops          },
-       { "unstable_stats",     &osc_unstable_stats_fops        },
+       { .name =       "uuid",
+         .fops =       &osc_uuid_fops                  },
+       { .name =       "ping",
+         .fops =       &osc_ping_fops,
+         .proc_mode =  0222                            },
+       { .name =       "connect_flags",
+         .fops =       &osc_connect_flags_fops         },
+       { .name =       "blocksize",
+         .fops =       &osc_blksize_fops               },
+       { .name =       "kbytestotal",
+         .fops =       &osc_kbytestotal_fops           },
+       { .name =       "kbytesfree",
+         .fops =       &osc_kbytesfree_fops            },
+       { .name =       "kbytesavail",
+         .fops =       &osc_kbytesavail_fops           },
+       { .name =       "filestotal",
+         .fops =       &osc_filestotal_fops            },
+       { .name =       "filesfree",
+         .fops =       &osc_filesfree_fops             },
+       { .name =       "ost_server_uuid",
+         .fops =       &osc_server_uuid_fops           },
+       { .name =       "ost_conn_uuid",
+         .fops =       &osc_conn_uuid_fops             },
+       { .name =       "active",
+         .fops =       &osc_active_fops                },
+       { .name =       "max_pages_per_rpc",
+         .fops =       &osc_obd_max_pages_per_rpc_fops },
+       { .name =       "max_rpcs_in_flight",
+         .fops =       &osc_max_rpcs_in_flight_fops    },
+       { .name =       "destroys_in_flight",
+         .fops =       &osc_destroys_in_flight_fops    },
+       { .name =       "max_dirty_mb",
+         .fops =       &osc_max_dirty_mb_fops          },
+       { .name =       "osc_cached_mb",
+         .fops =       &osc_cached_mb_fops             },
+       { .name =       "cur_dirty_bytes",
+         .fops =       &osc_cur_dirty_bytes_fops       },
+       { .name =       "cur_grant_bytes",
+         .fops =       &osc_cur_grant_bytes_fops       },
+       { .name =       "cur_lost_grant_bytes",
+         .fops =       &osc_cur_lost_grant_bytes_fops  },
+       { .name =       "grant_shrink_interval",
+         .fops =       &osc_grant_shrink_interval_fops },
+       { .name =       "checksums",
+         .fops =       &osc_checksum_fops              },
+       { .name =       "checksum_type",
+         .fops =       &osc_checksum_type_fops         },
+       { .name =       "resend_count",
+         .fops =       &osc_resend_count_fops          },
+       { .name =       "timeouts",
+         .fops =       &osc_timeouts_fops              },
+       { .name =       "contention_seconds",
+         .fops =       &osc_contention_seconds_fops    },
+       { .name =       "lockless_truncate",
+         .fops =       &osc_lockless_truncate_fops     },
+       { .name =       "import",
+         .fops =       &osc_import_fops                },
+       { .name =       "state",
+         .fops =       &osc_state_fops                 },
+       { .name =       "pinger_recov",
+         .fops =       &osc_pinger_recov_fops          },
+       { .name =       "unstable_stats",
+         .fops =       &osc_unstable_stats_fops        },
        { 0 }
 };
 
index b9d1b71..f95fb55 100644 (file)
@@ -3669,7 +3669,7 @@ int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg)
 {
        int rc = class_process_proc_seq_param(PARAM_OSC, obd->obd_vars,
                                              lcfg, obd);
-       return(rc > 0 ? 0: rc);
+       return rc > 0 ? 0: rc;
 }
 
 static int osc_process_config(struct obd_device *obd, obd_count len, void *buf)
index e14c61a..baab8be 100644 (file)
@@ -75,7 +75,8 @@ static struct cfs_cpt_table   *ost_io_cptable;
 LPROC_SEQ_FOPS_RO_TYPE(ost, uuid);
 
 static struct lprocfs_seq_vars lprocfs_ost_obd_vars[] = {
-       { "uuid",       &ost_uuid_fops  },
+       { .name =       "uuid",
+         .fops =       &ost_uuid_fops  },
        { 0 }
 };
 #endif /* LPROCFS */
index 7691728..2a5b643 100644 (file)
@@ -1382,7 +1382,7 @@ lprocfs_import_seq_write(struct file *file, const char *buffer, size_t count,
 
                *ptr = 0;
                do_reconn = 0;
-               ptr += strlen("::");
+               ptr += 2; /* Skip :: */
                inst = simple_strtol(ptr, &endptr, 10);
                if (*endptr) {
                        CERROR("config: wrong instance # %s\n", ptr);
index afd450c..df6d6fc 100644 (file)
@@ -171,7 +171,8 @@ static int qpi_state_seq_show(struct seq_file *m, void *data)
 LPROC_SEQ_FOPS_RO(qpi_state);
 
 static struct lprocfs_seq_vars lprocfs_quota_qpi_vars[] = {
-       { "info",       &qpi_state_fops },
+       { .name =       "info",
+         .fops =       &qpi_state_fops },
        { NULL }
 };
 
index 990cfee..573473c 100644 (file)
@@ -208,10 +208,14 @@ qsd_timeout_seq_write(struct file *file, const char *buffer,
 LPROC_SEQ_FOPS(qsd_timeout);
 
 static struct lprocfs_seq_vars lprocfs_quota_qsd_vars[] = {
-       { "info",               &qsd_state_fops         },
-       { "enabled",            &qsd_enabled_fops       },
-       { "force_reint",        &qsd_force_reint_fops   },
-       { "timeout",            &qsd_timeout_fops       },
+       { .name =       "info",
+         .fops =       &qsd_state_fops         },
+       { .name =       "enabled",
+         .fops =       &qsd_enabled_fops       },
+       { .name =       "force_reint",
+         .fops =       &qsd_force_reint_fops   },
+       { .name =       "timeout",
+         .fops =       &qsd_timeout_fops       },
        { NULL }
 };