From bafa12c06d87c05bb263eed37ad8af1a2df99894 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 28 Aug 2014 13:24:12 -0400 Subject: [PATCH] LU-5275 obdclass: Remove non seq file proc routines Now that we have moved everything over to seq_files for the proc handling we can remove all non seq_file routines in lustre. Change-Id: I20bd22fe920e430183b266219029a64beeb9747a Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/11451 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/include/dt_object.h | 14 - lustre/include/lprocfs_status.h | 217 +----------- lustre/include/obd_class.h | 8 +- lustre/llite/llite_lib.c | 4 +- lustre/lmv/lmv_obd.c | 2 +- lustre/lod/lod_dev.c | 4 +- lustre/lod/lproc_lod.c | 2 +- lustre/lov/lov_obd.c | 6 +- lustre/mdc/mdc_request.c | 5 +- lustre/mdd/mdd_device.c | 3 +- lustre/mdt/mdt_handler.c | 10 +- lustre/mdt/mdt_lproc.c | 2 +- lustre/mdt/mdt_mds.c | 2 +- lustre/mgc/mgc_request.c | 2 +- lustre/mgs/lproc_mgs.c | 2 +- lustre/obdclass/dt_object.c | 117 ------- lustre/obdclass/lprocfs_jobstats.c | 36 -- lustre/obdclass/lprocfs_status.c | 581 +------------------------------- lustre/obdclass/lprocfs_status_server.c | 464 +------------------------ lustre/obdclass/obd_config.c | 91 +---- lustre/obdecho/echo.c | 6 +- lustre/ofd/ofd_dev.c | 4 +- lustre/osc/osc_request.c | 5 +- lustre/osd-ldiskfs/osd_handler.c | 11 +- lustre/osd-zfs/osd_handler.c | 11 +- lustre/osp/lproc_osp.c | 2 +- lustre/osp/lwp_dev.c | 2 +- lustre/osp/osp_dev.c | 4 +- lustre/ost/ost_handler.c | 2 +- lustre/ptlrpc/lproc_ptlrpc.c | 131 ------- 30 files changed, 74 insertions(+), 1676 deletions(-) diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index aeaca2a..90f8cb5 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -2761,20 +2761,6 @@ int dt_global_init(void); void dt_global_fini(void); # ifdef LPROCFS -#ifndef HAVE_ONLY_PROCFS_SEQ -int lprocfs_dt_rd_blksize(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off, - int count, int *eof, void *data); -#endif int lprocfs_dt_blksize_seq_show(struct seq_file *m, void *v); int lprocfs_dt_kbytestotal_seq_show(struct seq_file *m, void *v); int lprocfs_dt_kbytesfree_seq_show(struct seq_file *m, void *v); diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 98e3868..1786c45 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -608,13 +608,6 @@ lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent, const char *format, ...); extern void lprocfs_free_per_client_stats(struct obd_device *obd); #ifdef HAVE_SERVER_SUPPORT -#ifndef HAVE_ONLY_PROCFS_SEQ -extern int -lprocfs_nid_stats_clear_write(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off, - int count, int *eof, void *data); -#endif extern ssize_t lprocfs_nid_stats_clear_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off); @@ -650,9 +643,8 @@ extern void lprocfs_try_remove_proc_entry(const char *name, extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root, const char *name); -extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list); #endif -extern int lprocfs_seq_obd_setup(struct obd_device *dev); +extern int lprocfs_obd_setup(struct obd_device *dev); extern int lprocfs_obd_cleanup(struct obd_device *obd); #ifdef HAVE_SERVER_SUPPORT extern const struct file_operations lprocfs_evict_client_fops; @@ -667,34 +659,6 @@ extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name, void *data); /* Generic callbacks */ -#ifndef HAVE_ONLY_PROCFS_SEQ -extern int lprocfs_rd_u64(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_atomic(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_wr_atomic(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_rd_uint(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_name(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_import(char *page, char **start, off_t off, int count, - int *eof, void *data); -extern int lprocfs_rd_state(char *page, char **start, off_t off, int count, - int *eof, void *data); -extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_num_exports(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_numrefs(char *page, char **start, off_t off, - int count, int *eof, void *data); -#endif extern int lprocfs_u64_seq_show(struct seq_file *m, void *data); extern int lprocfs_atomic_seq_show(struct seq_file *m, void *data); extern ssize_t lprocfs_atomic_seq_write(struct file *file, const char *buffer, @@ -715,39 +679,19 @@ extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data); extern int lprocfs_num_exports_seq_show(struct seq_file *m, void *data); #endif struct adaptive_timeout; -#ifndef HAVE_ONLY_PROCFS_SEQ -extern int lprocfs_at_hist_helper(char *page, int count, int rc, - struct adaptive_timeout *at); -extern int lprocfs_rd_timeouts(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_wr_timeouts(struct file *file, const char *buffer, - unsigned long count, void *data); -#endif extern int lprocfs_seq_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at); extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data); extern ssize_t lprocfs_timeouts_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off); -#ifndef HAVE_ONLY_PROCFS_SEQ #ifdef HAVE_SERVER_SUPPORT +#ifndef HAVE_ONLY_PROCFS_SEQ extern ssize_t lprocfs_fops_read(struct file *f, char __user *buf, size_t size, loff_t *ppos); extern ssize_t lprocfs_fops_write(struct file *f, const char __user *buf, size_t size, loff_t *ppos); -extern int lprocfs_wr_evict_client(struct file *file, const char *buffer, - unsigned long count, void *data); #endif -extern int lprocfs_wr_ping(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_wr_import(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_rd_pinger_recov(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer, - unsigned long count, void *data); -#endif -#ifdef HAVE_SERVER_SUPPORT extern ssize_t lprocfs_evict_client_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off); @@ -764,22 +708,6 @@ lprocfs_pinger_recov_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off); /* Statfs helpers */ -#ifndef HAVE_ONLY_PROCFS_SEQ -extern int lprocfs_rd_blksize(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_filestotal(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_filesfree(char *page, char **start, off_t off, - int count, int *eof, void *data); -extern int lprocfs_rd_filegroups(char *page, char **start, off_t off, - int count, int *eof, void *data); -#endif extern int lprocfs_blksize_seq_show(struct seq_file *m, void *data); extern int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data); extern int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data); @@ -810,20 +738,6 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, struct lprocfs_counter *cnt); #ifdef HAVE_SERVER_SUPPORT -#ifndef HAVE_ONLY_PROCFS_SEQ -/* lprocfs_status.c: recovery status */ -int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off, - int count, int *eof, void *data); -/* lprocfs_statuc.c: hash statistics */ -int lprocfs_obd_rd_hash(char *page, char **start, off_t off, - int count, int *eof, void *data); - -/* lprocfs_status.c: IR factor */ -int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer, - unsigned long count, void *data); -#endif /* lprocfs_status.c: recovery status */ int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data); @@ -922,26 +836,6 @@ int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, void lprocfs_job_stats_fini(struct obd_device *obd); int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num, cntr_init_callback fn); -#ifndef HAVE_ONLY_PROCFS_SEQ -int lprocfs_rd_job_interval(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_wr_job_interval(struct file *file, const char *buffer, - unsigned long count, void *data); - -/* lproc_status.c */ -int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_obd_wr_recovery_time_soft(struct file *file, - const char *buffer, - unsigned long count, void *data); -int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_obd_wr_recovery_time_hard(struct file *file, - const char *buffer, - unsigned long count, void *data); -int lprocfs_target_rd_instance(char *page, char **start, off_t off, - int count, int *eof, void *data); -#endif int lprocfs_job_interval_seq_show(struct seq_file *m, void *data); ssize_t lprocfs_job_interval_seq_write(struct file *file, const char *buffer, @@ -957,12 +851,6 @@ lprocfs_recovery_time_hard_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off); int lprocfs_target_instance_seq_show(struct seq_file *m, void *data); #endif -#ifndef HAVE_ONLY_PROCFS_SEQ -int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off, - int count, int *eof, void *data); -int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer, - unsigned long count, void *data); -#endif int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data); ssize_t lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file, const char *buffer, @@ -1096,16 +984,6 @@ static inline int lprocfs_add_clear_entry(struct obd_export *exp) static inline void lprocfs_free_per_client_stats(struct obd_device *obd) { return; } #ifdef HAVE_SERVER_SUPPORT -#ifndef HAVE_ONLY_PROCFS_SEQ -static inline -int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer, - unsigned long count, void *data) -{return count;} -static inline -int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off, - int count, int *eof, void *data) -{return count;} -#endif static inline ssize_t lprocfs_nid_stats_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off) @@ -1160,74 +1038,11 @@ static inline void lprocfs_try_remove_proc_entry(const char *name, static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head, const char *name) { return 0; } -static inline int lprocfs_obd_setup(struct obd_device *dev, - struct lprocfs_vars *list) -{ return 0; } #endif -static inline int lprocfs_seq_obd_setup(struct obd_device *dev) +static inline int lprocfs_obd_setup(struct obd_device *dev) { return 0; } static inline int lprocfs_obd_cleanup(struct obd_device *dev) { return 0; } -static inline int lprocfs_rd_u64(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -#ifndef HAVE_ONLY_PROCFS_SEQ -static inline int lprocfs_rd_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_rd_name(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_rd_import(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_rd_pinger_recov(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_rd_state(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_rd_numrefs(struct seq_file *m, void *data) -{ return 0; } -struct adaptive_timeout; -static inline int lprocfs_at_hist_helper(char *page, int count, int rc, - struct adaptive_timeout *at) -{ return 0; } -static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline int lprocfs_wr_timeouts(struct file *file, - const char *buffer, - unsigned long count, void *data) -{ return 0; } -#ifdef HAVE_SERVER_SUPPORT -static inline int lprocfs_wr_evict_client(struct file *file, - const char *buffer, - unsigned long count, void *data) -{ return 0; } -#endif -static inline int lprocfs_wr_ping(struct file *file, const char *buffer, - unsigned long count, void *data) -{ return 0; } -static inline int lprocfs_wr_import(struct file *file, const char *buffer, - unsigned long count, void *data) -{ return 0; } -static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer, - unsigned long count, void *data) -{ return 0; } -#endif static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data) { return 0; } static inline int lprocfs_name_seq_show(struct seq_file *m, void *data) @@ -1279,32 +1094,6 @@ lprocfs_pinger_recov_seq_write(struct file *file, const char *buffer, { return 0; } /* Statfs helpers */ -#ifndef HAVE_ONLY_PROCFS_SEQ -static inline -int lprocfs_rd_blksize(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline -int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline -int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline -int lprocfs_rd_kbytesavail(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline -int lprocfs_rd_filestotal(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -static inline -int lprocfs_rd_filesfree(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ return 0; } -#endif static inline int lprocfs_blksize_seq_show(struct seq_file *m, void *data) { return 0; } diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 0154671..0a73678 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -131,12 +131,8 @@ typedef int (*llog_cb_t)(const struct lu_env *, struct llog_handle *, struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg, const char *new_name); int class_process_config(struct lustre_cfg *lcfg); -#ifndef HAVE_ONLY_PROCFS_SEQ -int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, - struct lustre_cfg *lcfg, void *data); -#endif -int class_process_proc_seq_param(char *prefix, struct lprocfs_seq_vars *lvars, - struct lustre_cfg *lcfg, void *data); +int class_process_proc_param(char *prefix, struct lprocfs_seq_vars *lvars, + struct lustre_cfg *lcfg, void *data); int class_attach(struct lustre_cfg *lcfg); int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg); int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 6727dc8..66a2d72 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2520,8 +2520,8 @@ int ll_process_config(struct lustre_cfg *lcfg) /* Note we have not called client_common_fill_super yet, so proc fns must be able to handle that! */ - rc = class_process_proc_seq_param(PARAM_LLITE, lprocfs_llite_obd_vars, - lcfg, sb); + rc = class_process_proc_param(PARAM_LLITE, lprocfs_llite_obd_vars, + lcfg, sb); if (rc > 0) rc = 0; return rc; diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 2b3c715..1e64990 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1459,7 +1459,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg) #ifdef LPROCFS obd->obd_vars = lprocfs_lmv_obd_vars; - lprocfs_seq_obd_setup(obd); + lprocfs_obd_setup(obd); lprocfs_alloc_md_stats(obd, 0); rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd", 0444, &lmv_proc_target_fops, obd); diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c index 96d2ac9..b0d834e 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -341,8 +341,8 @@ static int lod_process_config(const struct lu_env *env, case LCFG_PARAM: { struct obd_device *obd = lod2obd(lod); - rc = class_process_proc_seq_param(PARAM_LOV, obd->obd_vars, - lcfg, obd); + rc = class_process_proc_param(PARAM_LOV, obd->obd_vars, + lcfg, obd); if (rc > 0) rc = 0; GOTO(out, rc); diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c index ec67275..0f6e7a9 100644 --- a/lustre/lod/lproc_lod.c +++ b/lustre/lod/lproc_lod.c @@ -529,7 +529,7 @@ int lod_procfs_init(struct lod_device *lod) int rc; obd->obd_vars = lprocfs_lod_obd_vars; - rc = lprocfs_seq_obd_setup(obd); + rc = lprocfs_obd_setup(obd); if (rc) { CERROR("%s: cannot setup procfs entry: %d\n", obd->obd_name, rc); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index bdf0cc5..bbe4ecd 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -858,7 +858,7 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) obd->obd_proc_entry = NULL; } } else { - rc = lprocfs_seq_obd_setup(obd); + rc = lprocfs_obd_setup(obd); } if (rc == 0) { @@ -995,8 +995,8 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, if (!desc) GOTO(out, rc = -EINVAL); - rc = class_process_proc_seq_param(PARAM_LOV, obd->obd_vars, - lcfg, obd); + rc = class_process_proc_param(PARAM_LOV, obd->obd_vars, + lcfg, obd); if (rc > 0) rc = 0; GOTO(out, rc); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 1699d29..80bf99b2 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -2873,7 +2873,7 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) GOTO(err_close_lock, rc); #ifdef LPROCFS obd->obd_vars = lprocfs_mdc_obd_vars; - lprocfs_seq_obd_setup(obd); + lprocfs_obd_setup(obd); lprocfs_alloc_md_stats(obd, 0); #endif sptlrpc_lprocfs_cliobd_attach(obd); @@ -3007,8 +3007,7 @@ static int mdc_llog_finish(struct obd_device *obd, int count) static int mdc_process_config(struct obd_device *obd, obd_count len, void *buf) { struct lustre_cfg *lcfg = buf; - int rc = class_process_proc_seq_param(PARAM_MDC, obd->obd_vars, - lcfg, obd); + int rc = class_process_proc_param(PARAM_MDC, obd->obd_vars, lcfg, obd); return (rc > 0 ? 0: rc); } diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index d55f358..ceda2ec 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -888,8 +888,7 @@ static int mdd_process_config(const struct lu_env *env, case LCFG_PARAM: { struct obd_device *obd = mdd2obd_dev(m); - rc = class_process_proc_seq_param(PARAM_MDD, obd->obd_vars, - cfg, m); + rc = class_process_proc_param(PARAM_MDD, obd->obd_vars, cfg, m); if (rc > 0 || rc == -ENOSYS) /* we don't understand; pass it on */ rc = next->ld_ops->ldo_process_config(env, next, cfg); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index a3c7349..59adef4 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -4694,13 +4694,13 @@ static int mdt_process_config(const struct lu_env *env, } } - rc = class_process_proc_seq_param(PARAM_MDT, obd->obd_vars, - cfg, obd); + rc = class_process_proc_param(PARAM_MDT, obd->obd_vars, + cfg, obd); if (rc > 0 || rc == -ENOSYS) { /* is it an HSM var ? */ - rc = class_process_proc_seq_param(PARAM_HSM, - hsm_cdt_get_proc_vars(), - cfg, obd); + rc = class_process_proc_param(PARAM_HSM, + hsm_cdt_get_proc_vars(), + cfg, obd); if (rc > 0 || rc == -ENOSYS) /* we don't understand; pass it on */ rc = next->ld_ops->ldo_process_config(env, next, diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index 45cda58..535e70b 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -975,7 +975,7 @@ int mdt_procfs_init(struct mdt_device *mdt, const char *name) LASSERT(name != NULL); obd->obd_vars = lprocfs_mdt_obd_vars; - rc = lprocfs_seq_obd_setup(obd); + rc = lprocfs_obd_setup(obd); if (rc) { CERROR("%s: cannot create proc entries: rc = %d\n", mdt_obd_name(mdt), rc); diff --git a/lustre/mdt/mdt_mds.c b/lustre/mdt/mdt_mds.c index 424ddf5..1c0677a 100644 --- a/lustre/mdt/mdt_mds.c +++ b/lustre/mdt/mdt_mds.c @@ -495,7 +495,7 @@ static struct lu_device *mds_device_alloc(const struct lu_env *env, obd->obd_lu_dev = l; obd->obd_vars = lprocfs_mds_obd_vars; - rc = lprocfs_seq_obd_setup(obd); + rc = lprocfs_obd_setup(obd); if (rc != 0) { mds_device_free(env, l); l = ERR_PTR(rc); diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 6160ffb..be9ffd8 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -910,7 +910,7 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) #ifdef LPROCFS obd->obd_vars = lprocfs_mgc_obd_vars; - lprocfs_seq_obd_setup(obd); + lprocfs_obd_setup(obd); #endif sptlrpc_lprocfs_cliobd_attach(obd); diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c index 20289cf..b2c5df7 100644 --- a/lustre/mgs/lproc_mgs.c +++ b/lustre/mgs/lproc_mgs.c @@ -229,7 +229,7 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name) int rc; obd->obd_vars = lprocfs_mgs_obd_vars; - rc = lprocfs_seq_obd_setup(obd); + rc = lprocfs_obd_setup(obd); if (rc != 0) GOTO(out, rc); diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index 088c1cb..4708a26 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -955,123 +955,6 @@ out: EXPORT_SYMBOL(dt_index_read); #ifdef LPROCFS -#ifndef HAVE_ONLY_PROCFS_SEQ -int lprocfs_dt_rd_blksize(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - - int rc = dt_statfs(NULL, dt, &osfs); - if (rc == 0) { - *eof = 1; - rc = snprintf(page, count, "%u\n", - (unsigned) osfs.os_bsize); - } - - return rc; -} -EXPORT_SYMBOL(lprocfs_dt_rd_blksize); - -int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - - int rc = dt_statfs(NULL, dt, &osfs); - if (rc == 0) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_blocks; - - while (blk_size >>= 1) - result <<= 1; - - *eof = 1; - rc = snprintf(page, count, LPU64"\n", result); - } - - return rc; -} -EXPORT_SYMBOL(lprocfs_dt_rd_kbytestotal); - -int lprocfs_dt_rd_kbytesfree(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - - int rc = dt_statfs(NULL, dt, &osfs); - if (rc == 0) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_bfree; - - while (blk_size >>= 1) - result <<= 1; - - *eof = 1; - rc = snprintf(page, count, LPU64"\n", result); - } - - return rc; -} -EXPORT_SYMBOL(lprocfs_dt_rd_kbytesfree); - -int lprocfs_dt_rd_kbytesavail(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - - int rc = dt_statfs(NULL, dt, &osfs); - if (rc == 0) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_bavail; - - while (blk_size >>= 1) - result <<= 1; - - *eof = 1; - rc = snprintf(page, count, LPU64"\n", result); - } - - return rc; -} -EXPORT_SYMBOL(lprocfs_dt_rd_kbytesavail); - -int lprocfs_dt_rd_filestotal(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - - int rc = dt_statfs(NULL, dt, &osfs); - if (rc == 0) { - *eof = 1; - rc = snprintf(page, count, LPU64"\n", osfs.os_files); - } - - return rc; -} -EXPORT_SYMBOL(lprocfs_dt_rd_filestotal); - -int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct dt_device *dt = data; - struct obd_statfs osfs; - - int rc = dt_statfs(NULL, dt, &osfs); - if (rc == 0) { - *eof = 1; - rc = snprintf(page, count, LPU64"\n", osfs.os_ffree); - } - - return rc; -} -EXPORT_SYMBOL(lprocfs_dt_rd_filesfree); -#endif - int lprocfs_dt_blksize_seq_show(struct seq_file *m, void *v) { struct dt_device *dt = m->private; diff --git a/lustre/obdclass/lprocfs_jobstats.c b/lustre/obdclass/lprocfs_jobstats.c index f0d2205..d14ce6c 100644 --- a/lustre/obdclass/lprocfs_jobstats.c +++ b/lustre/obdclass/lprocfs_jobstats.c @@ -529,42 +529,6 @@ int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num, } EXPORT_SYMBOL(lprocfs_job_stats_init); -#ifndef HAVE_ONLY_PROCFS_SEQ -int lprocfs_rd_job_interval(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - struct obd_job_stats *stats; - - LASSERT(obd != NULL); - stats = &obd->u.obt.obt_jobstats; - *eof = 1; - return snprintf(page, count, "%d\n", stats->ojs_cleanup_interval); -} -EXPORT_SYMBOL(lprocfs_rd_job_interval); - -int lprocfs_wr_job_interval(struct file *file, const char __user *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - struct obd_job_stats *stats; - int val, rc; - - LASSERT(obd != NULL); - stats = &obd->u.obt.obt_jobstats; - - rc = lprocfs_write_helper(buffer, count, &val); - if (rc) - return rc; - - stats->ojs_cleanup_interval = val; - lprocfs_job_cleanup(stats, true); - - return count; - -} -EXPORT_SYMBOL(lprocfs_wr_job_interval); -#endif int lprocfs_job_interval_seq_show(struct seq_file *m, void *data) { struct obd_device *obd = m->private; diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index dce67d5..10f8052 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -810,14 +810,14 @@ EXPORT_SYMBOL(lprocfs_stats_collect); /** * Append a space separated list of current set flags to str. */ -#define flag2seqstr(flag) \ +#define flag2str(flag) \ do { \ if (imp->imp_##flag) { \ seq_printf(m, "%s" #flag, first ? "" : ", "); \ first = false; \ } \ } while (0) -static void obd_import_flags2seqstr(struct obd_import *imp, struct seq_file *m) +static void obd_import_flags2str(struct obd_import *imp, struct seq_file *m) { bool first = true; @@ -826,19 +826,19 @@ static void obd_import_flags2seqstr(struct obd_import *imp, struct seq_file *m) first = false; } - flag2seqstr(invalid); - flag2seqstr(deactive); - flag2seqstr(replayable); - flag2seqstr(delayed_recovery); - flag2seqstr(no_lock_replay); - flag2seqstr(vbr_failed); - flag2seqstr(pingable); - flag2seqstr(resend_replay); - flag2seqstr(no_pinger_recover); - flag2seqstr(need_mne_swab); - flag2seqstr(connect_tried); + flag2str(invalid); + flag2str(deactive); + flag2str(replayable); + flag2str(delayed_recovery); + flag2str(no_lock_replay); + flag2str(vbr_failed); + flag2str(pingable); + flag2str(resend_replay); + flag2str(no_pinger_recover); + flag2str(need_mne_swab); + flag2str(connect_tried); } -#undef flag2seqstr +#undef flag2str static const char *obd_connect_names[] = { "read_only", @@ -1020,7 +1020,7 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data) seq_printf(m, " ]\n"); obd_connect_data_seqprint(m, ocd); seq_printf(m, " import_flags: [ "); - obd_import_flags2seqstr(imp, m); + obd_import_flags2str(imp, m); seq_printf(m, " ]\n" " connection:\n" @@ -1227,555 +1227,8 @@ int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data) } EXPORT_SYMBOL(lprocfs_connect_flags_seq_show); -#ifndef HAVE_ONLY_PROCFS_SEQ - -int lprocfs_rd_uint(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - unsigned int *temp = data; - return snprintf(page, count, "%u\n", *temp); -} -EXPORT_SYMBOL(lprocfs_rd_uint); - -int lprocfs_rd_u64(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - LASSERT(data != NULL); - *eof = 1; - return snprintf(page, count, LPU64"\n", *(__u64 *)data); -} -EXPORT_SYMBOL(lprocfs_rd_u64); - -int lprocfs_rd_atomic(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - atomic_t *atom = data; - LASSERT(atom != NULL); - *eof = 1; - return snprintf(page, count, "%d\n", atomic_read(atom)); -} -EXPORT_SYMBOL(lprocfs_rd_atomic); - -int lprocfs_wr_atomic(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - atomic_t *atm = data; - int val = 0; - int rc; - - rc = lprocfs_write_helper(buffer, count, &val); - if (rc < 0) - return rc; - - if (val <= 0) - return -ERANGE; - - atomic_set(atm, val); - return count; -} -EXPORT_SYMBOL(lprocfs_wr_atomic); - -int lprocfs_rd_uuid(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = data; - - LASSERT(obd != NULL); - *eof = 1; - return snprintf(page, count, "%s\n", obd->obd_uuid.uuid); -} -EXPORT_SYMBOL(lprocfs_rd_uuid); - -int lprocfs_rd_name(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *dev = data; - - LASSERT(dev != NULL); - *eof = 1; - return snprintf(page, count, "%s\n", dev->obd_name); -} -EXPORT_SYMBOL(lprocfs_rd_name); - -int lprocfs_rd_blksize(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = data; - struct obd_statfs osfs; - int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, - cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), - OBD_STATFS_NODELAY); - if (!rc) { - *eof = 1; - rc = snprintf(page, count, "%u\n", osfs.os_bsize); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_blksize); - -int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = data; - struct obd_statfs osfs; - int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, - cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), - OBD_STATFS_NODELAY); - if (!rc) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_blocks; - - while (blk_size >>= 1) - result <<= 1; - - *eof = 1; - rc = snprintf(page, count, LPU64"\n", result); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_kbytestotal); - -int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = data; - struct obd_statfs osfs; - int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, - cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), - OBD_STATFS_NODELAY); - if (!rc) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_bfree; - - while (blk_size >>= 1) - result <<= 1; - - *eof = 1; - rc = snprintf(page, count, LPU64"\n", result); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_kbytesfree); - -int lprocfs_rd_kbytesavail(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = data; - struct obd_statfs osfs; - int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, - cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), - OBD_STATFS_NODELAY); - if (!rc) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_bavail; - - while (blk_size >>= 1) - result <<= 1; - - *eof = 1; - rc = snprintf(page, count, LPU64"\n", result); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_kbytesavail); - -int lprocfs_rd_filestotal(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = data; - struct obd_statfs osfs; - int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, - cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), - OBD_STATFS_NODELAY); - if (!rc) { - *eof = 1; - rc = snprintf(page, count, LPU64"\n", osfs.os_files); - } - - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_filestotal); - -int lprocfs_rd_filesfree(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = data; - struct obd_statfs osfs; - int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, - cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), - OBD_STATFS_NODELAY); - if (!rc) { - *eof = 1; - rc = snprintf(page, count, LPU64"\n", osfs.os_ffree); - } - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_filesfree); - -int lprocfs_rd_server_uuid(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = data; - struct obd_import *imp; - char *imp_state_name = NULL; - int rc = 0; - - LASSERT(obd != NULL); - LPROCFS_CLIMP_CHECK(obd); - imp = obd->u.cli.cl_import; - imp_state_name = ptlrpc_import_state_name(imp->imp_state); - *eof = 1; - rc = snprintf(page, count, "%s\t%s%s\n", - obd2cli_tgt(obd), imp_state_name, - imp->imp_deactive ? "\tDEACTIVATED" : ""); - - LPROCFS_CLIMP_EXIT(obd); - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_server_uuid); - -int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count, - int *eof, 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; - *eof = 1; - if (conn && obd->u.cli.cl_import) { - rc = snprintf(page, count, "%s\n", - conn->c_remote_uuid.uuid); - } else { - rc = snprintf(page, count, "%s\n", ""); - } - - LPROCFS_CLIMP_EXIT(obd); - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_conn_uuid); - -/** - * Append a space separated list of current set flags to str. - */ -#define flag2str(flag) \ - if (imp->imp_##flag && max - len > 0) \ - len += snprintf(str + len, max - len, "%s" #flag, len ? ", " : ""); -static int obd_import_flags2str(struct obd_import *imp, char *str, int max) -{ - int len = 0; - - if (imp->imp_obd->obd_no_recov) - len += snprintf(str, max - len, "no_recov"); - - flag2str(invalid); - flag2str(deactive); - flag2str(replayable); - flag2str(pingable); - return len; -} -#undef flags2str - -int lprocfs_rd_import(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct lprocfs_counter ret; - struct lprocfs_counter_header *header; - struct obd_device *obd = (struct obd_device *)data; - struct obd_import *imp; - struct obd_import_conn *conn; - int i; - int j; - int k; - int rw = 0; - - LASSERT(obd != NULL); - LPROCFS_CLIMP_CHECK(obd); - imp = obd->u.cli.cl_import; - *eof = 1; - - i = snprintf(page, count, - "import:\n" - " name: %s\n" - " target: %s\n" - " state: %s\n" - " instance: %u\n" - " connect_flags: [", - obd->obd_name, - obd2cli_tgt(obd), - ptlrpc_import_state_name(imp->imp_state), - imp->imp_connect_data.ocd_instance); - i += obd_connect_flags2str(page + i, count - i, - imp->imp_connect_data.ocd_connect_flags, - ", "); - i += snprintf(page + i, count - i, - "]\n" - " import_flags: ["); - i += obd_import_flags2str(imp, page + i, count - i); - - i += snprintf(page + i, count - i, - "]\n" - " connection:\n" - " failover_nids: ["); - spin_lock(&imp->imp_lock); - j = 0; - list_for_each_entry(conn, &imp->imp_conn_list, oic_item) { - i += snprintf(page + i, count - i, "%s%s", j ? ", " : "", - libcfs_nid2str(conn->oic_conn->c_peer.nid)); - j++; - } - i += snprintf(page + i, count - i, - "]\n" - " current_connection: %s\n" - " connection_attempts: %u\n" - " generation: %u\n" - " in-progress_invalidations: %u\n", - imp->imp_connection == NULL ? "" : - libcfs_nid2str(imp->imp_connection->c_peer.nid), - imp->imp_conn_cnt, - imp->imp_generation, - atomic_read(&imp->imp_inval_count)); - spin_unlock(&imp->imp_lock); - - if (obd->obd_svc_stats == NULL) - goto out_climp; - - header = &obd->obd_svc_stats->ls_cnt_header[PTLRPC_REQWAIT_CNTR]; - lprocfs_stats_collect(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR, &ret); - if (ret.lc_count != 0) { - /* first argument to do_div MUST be __u64 */ - __u64 sum = ret.lc_sum; - do_div(sum, ret.lc_count); - ret.lc_sum = sum; - } else - ret.lc_sum = 0; - i += snprintf(page + i, count - i, - " rpcs:\n" - " inflight: %u\n" - " unregistering: %u\n" - " timeouts: %u\n" - " avg_waittime: "LPU64" %s\n", - atomic_read(&imp->imp_inflight), - atomic_read(&imp->imp_unregistering), - atomic_read(&imp->imp_timeouts), - ret.lc_sum, header->lc_units); - - k = 0; - for(j = 0; j < IMP_AT_MAX_PORTALS; j++) { - if (imp->imp_at.iat_portal[j] == 0) - break; - k = max_t(unsigned int, k, - at_get(&imp->imp_at.iat_service_estimate[j])); - } - i += snprintf(page + i, count - i, - " service_estimates:\n" - " services: %u sec\n" - " network: %u sec\n", - k, - at_get(&imp->imp_at.iat_net_latency)); - - i += snprintf(page + i, count - i, - " transactions:\n" - " last_replay: "LPU64"\n" - " peer_committed: "LPU64"\n" - " last_checked: "LPU64"\n", - imp->imp_last_replay_transno, - imp->imp_peer_committed_transno, - imp->imp_last_transno_checked); - - /* avg data rates */ - for (rw = 0; rw <= 1; rw++) { - lprocfs_stats_collect(obd->obd_svc_stats, - PTLRPC_LAST_CNTR + BRW_READ_BYTES + rw, - &ret); - if (ret.lc_sum > 0 && ret.lc_count > 0) { - /* first argument to do_div MUST be __u64 */ - __u64 sum = ret.lc_sum; - do_div(sum, ret.lc_count); - ret.lc_sum = sum; - i += snprintf(page + i, count - i, - " %s_data_averages:\n" - " bytes_per_rpc: "LPU64"\n", - rw ? "write" : "read", - ret.lc_sum); - } - k = (int)ret.lc_sum; - j = opcode_offset(OST_READ + rw) + EXTRA_MAX_OPCODES; - header = &obd->obd_svc_stats->ls_cnt_header[j]; - lprocfs_stats_collect(obd->obd_svc_stats, j, &ret); - if (ret.lc_sum > 0 && ret.lc_count != 0) { - /* first argument to do_div MUST be __u64 */ - __u64 sum = ret.lc_sum; - do_div(sum, ret.lc_count); - ret.lc_sum = sum; - i += snprintf(page + i, count - i, - " %s_per_rpc: "LPU64"\n", - header->lc_units, ret.lc_sum); - j = (int)ret.lc_sum; - if (j > 0) - i += snprintf(page + i, count - i, - " MB_per_sec: %u.%.02u\n", - k / j, (100 * k / j) % 100); - } - } - -out_climp: - LPROCFS_CLIMP_EXIT(obd); - return i; -} -EXPORT_SYMBOL(lprocfs_rd_import); - -int lprocfs_rd_state(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - struct obd_import *imp; - int i, j, k; - - LASSERT(obd != NULL); - LPROCFS_CLIMP_CHECK(obd); - imp = obd->u.cli.cl_import; - *eof = 1; - - i = snprintf(page, count, "current_state: %s\n", - ptlrpc_import_state_name(imp->imp_state)); - i += snprintf(page + i, count - i, - "state_history:\n"); - k = imp->imp_state_hist_idx; - for (j = 0; j < IMP_STATE_HIST_LEN; j++) { - struct import_state_hist *ish = - &imp->imp_state_hist[(k + j) % IMP_STATE_HIST_LEN]; - if (ish->ish_state == 0) - continue; - i += snprintf(page + i, count - i, " - ["CFS_TIME_T", %s]\n", - ish->ish_time, - ptlrpc_import_state_name(ish->ish_state)); - } - - LPROCFS_CLIMP_EXIT(obd); - return i; -} -EXPORT_SYMBOL(lprocfs_rd_state); - -int lprocfs_at_hist_helper(char *page, int count, int rc, - struct adaptive_timeout *at) -{ - int i; - for (i = 0; i < AT_BINS; i++) - rc += snprintf(page + rc, count - rc, "%3u ", at->at_hist[i]); - rc += snprintf(page + rc, count - rc, "\n"); - return rc; -} -EXPORT_SYMBOL(lprocfs_at_hist_helper); - -/* See also ptlrpc_lprocfs_rd_timeouts */ -int lprocfs_rd_timeouts(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - struct obd_import *imp; - unsigned int cur, worst; - time_t now, worstt; - struct dhms ts; - int i, rc = 0; - - LASSERT(obd != NULL); - LPROCFS_CLIMP_CHECK(obd); - imp = obd->u.cli.cl_import; - *eof = 1; - - now = cfs_time_current_sec(); - - /* Some network health info for kicks */ - s2dhms(&ts, now - imp->imp_last_reply_time); - rc += snprintf(page + rc, count - rc, - "%-10s : %ld, "DHMS_FMT" ago\n", - "last reply", imp->imp_last_reply_time, DHMS_VARS(&ts)); - - cur = at_get(&imp->imp_at.iat_net_latency); - worst = imp->imp_at.iat_net_latency.at_worst_ever; - worstt = imp->imp_at.iat_net_latency.at_worst_time; - s2dhms(&ts, now - worstt); - rc += snprintf(page + rc, count - rc, - "%-10s : cur %3u worst %3u (at %ld, "DHMS_FMT" ago) ", - "network", cur, worst, worstt, DHMS_VARS(&ts)); - rc = lprocfs_at_hist_helper(page, count, rc, - &imp->imp_at.iat_net_latency); - - for(i = 0; i < IMP_AT_MAX_PORTALS; i++) { - if (imp->imp_at.iat_portal[i] == 0) - break; - cur = at_get(&imp->imp_at.iat_service_estimate[i]); - worst = imp->imp_at.iat_service_estimate[i].at_worst_ever; - worstt = imp->imp_at.iat_service_estimate[i].at_worst_time; - s2dhms(&ts, now - worstt); - rc += snprintf(page + rc, count - rc, - "portal %-2d : cur %3u worst %3u (at %ld, " - DHMS_FMT" ago) ", imp->imp_at.iat_portal[i], - cur, worst, worstt, DHMS_VARS(&ts)); - rc = lprocfs_at_hist_helper(page, count, rc, - &imp->imp_at.iat_service_estimate[i]); - } - - LPROCFS_CLIMP_EXIT(obd); - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_timeouts); - -int lprocfs_rd_connect_flags(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = data; - __u64 flags; - int ret = 0; - - LPROCFS_CLIMP_CHECK(obd); - flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags; - ret = snprintf(page, count, "flags="LPX64"\n", flags); - ret += obd_connect_flags2str(page + ret, count - ret, flags, "\n"); - ret += snprintf(page + ret, count - ret, "\n"); - LPROCFS_CLIMP_EXIT(obd); - return ret; -} -EXPORT_SYMBOL(lprocfs_rd_connect_flags); - -int lprocfs_rd_numrefs(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_type *class = (struct obd_type*) data; - - LASSERT(class != NULL); - *eof = 1; - return snprintf(page, count, "%d\n", class->typ_refcnt); -} -EXPORT_SYMBOL(lprocfs_rd_numrefs); - -int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list) -{ - int rc = 0; - - LASSERT(obd != NULL); - LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC); - LASSERT(obd->obd_type->typ_procroot != NULL); - - obd->obd_proc_entry = lprocfs_register(obd->obd_name, - obd->obd_type->typ_procroot, - list, obd); - if (IS_ERR(obd->obd_proc_entry)) { - rc = PTR_ERR(obd->obd_proc_entry); - CERROR("error %d setting up lprocfs for %s\n",rc,obd->obd_name); - obd->obd_proc_entry = NULL; - } - return rc; -} -EXPORT_SYMBOL(lprocfs_obd_setup); -#endif - int -lprocfs_seq_obd_setup(struct obd_device *obd) +lprocfs_obd_setup(struct obd_device *obd) { int rc = 0; @@ -1793,7 +1246,7 @@ lprocfs_seq_obd_setup(struct obd_device *obd) } return rc; } -EXPORT_SYMBOL(lprocfs_seq_obd_setup); +EXPORT_SYMBOL(lprocfs_obd_setup); int lprocfs_obd_cleanup(struct obd_device *obd) { diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index 10e0cd3..3acf811 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -101,76 +101,6 @@ out: } EXPORT_SYMBOL(lprocfs_evict_client_seq_write); -#ifndef HAVE_ONLY_PROCFS_SEQ -int lprocfs_wr_evict_client(struct file *file, const char __user *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = data; - char *kbuf; - char *tmpbuf; - - OBD_ALLOC(kbuf, BUFLEN); - if (kbuf == NULL) - return -ENOMEM; - - /* - * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1 - * bytes into kbuf, to ensure that the string is NUL-terminated. - * UUID_MAX should include a trailing NUL already. - */ - if (copy_from_user(kbuf, buffer, - min_t(unsigned long, BUFLEN - 1, count))) { - count = -EFAULT; - goto out; - } - tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count)); - class_incref(obd, __func__, current); - - if (strncmp(tmpbuf, "nid:", 4) == 0) - obd_export_evict_by_nid(obd, tmpbuf + 4); - else if (strncmp(tmpbuf, "uuid:", 5) == 0) - obd_export_evict_by_uuid(obd, tmpbuf + 5); - else - obd_export_evict_by_uuid(obd, tmpbuf); - - class_decref(obd, __func__, current); -out: - OBD_FREE(kbuf, BUFLEN); - return count; -} -EXPORT_SYMBOL(lprocfs_wr_evict_client); - -const struct file_operations lprocfs_evict_client_fops = { - .owner = THIS_MODULE, - .read = lprocfs_fops_read, - .write = lprocfs_fops_write, - .open = lprocfs_evict_client_open, - .release = lprocfs_evict_client_release, -}; -EXPORT_SYMBOL(lprocfs_evict_client_fops); - -/* Function that emulates snprintf but also has the side effect of advancing - the page pointer for the next write into the buffer, incrementing the total - length written to the buffer, and decrementing the size left in the - buffer. */ -static int lprocfs_obd_snprintf(char **page, int end, int *len, - const char *format, ...) -{ - va_list list; - int n; - - if (*len >= end) - return 0; - - va_start(list, format); - n = vsnprintf(*page, end - *len, format, list); - va_end(list); - - *page += n; *len += n; - return n; -} -#endif /* HAVE_ONLY_PROCFS_SEQ */ - #undef BUFLEN int lprocfs_num_exports_seq_show(struct seq_file *m, void *data) @@ -328,142 +258,6 @@ lprocfs_nid_stats_clear_seq_write(struct file *file, const char *buffer, } EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_write); -#ifndef HAVE_ONLY_PROCFS_SEQ -int lprocfs_rd_num_exports(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device *obd = data; - - LASSERT(obd != NULL); - *eof = 1; - return snprintf(page, count, "%u\n", obd->obd_num_exports); -} -EXPORT_SYMBOL(lprocfs_rd_num_exports); - -int lprocfs_exp_rd_nid(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_export *exp = data; - LASSERT(exp != NULL); - *eof = 1; - return snprintf(page, count, "%s\n", obd_export_nid2str(exp)); -} - -struct exp_uuid_cb_data { - char *page; - int count; - int *eof; - int *len; -}; - -static void -lprocfs_exp_rd_cb_data_init(struct exp_uuid_cb_data *cb_data, char *page, - int count, int *eof, int *len) -{ - cb_data->page = page; - cb_data->count = count; - cb_data->eof = eof; - cb_data->len = len; -} - -int lprocfs_exp_print_uuid(cfs_hash_t *hs, cfs_hash_bd_t *bd, - struct hlist_node *hnode, void *cb_data) - -{ - struct obd_export *exp = cfs_hash_object(hs, hnode); - struct exp_uuid_cb_data *data = (struct exp_uuid_cb_data *)cb_data; - - if (exp->exp_nid_stats) - *data->len += snprintf((data->page + *data->len), - data->count, "%s\n", - obd_uuid2str(&exp->exp_client_uuid)); - return 0; -} - -int lprocfs_exp_rd_uuid(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct nid_stat *stats = (struct nid_stat *)data; - struct exp_uuid_cb_data cb_data; - struct obd_device *obd = stats->nid_obd; - int len = 0; - - *eof = 1; - page[0] = '\0'; - lprocfs_exp_rd_cb_data_init(&cb_data, page, count, eof, &len); - cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid, - lprocfs_exp_print_uuid, &cb_data); - return *cb_data.len; -} - -int lprocfs_exp_print_hash(cfs_hash_t *hs, cfs_hash_bd_t *bd, - struct hlist_node *hnode, void *cb_data) - -{ - struct exp_uuid_cb_data *data = cb_data; - struct obd_export *exp = cfs_hash_object(hs, hnode); - - if (exp->exp_lock_hash != NULL) { - if (!*data->len) { - *data->len += cfs_hash_debug_header(data->page, - data->count); - } - *data->len += cfs_hash_debug_str(hs, data->page + *data->len, - data->count); - } - return 0; -} - -int lprocfs_exp_rd_hash(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct nid_stat *stats = (struct nid_stat *)data; - struct exp_uuid_cb_data cb_data; - struct obd_device *obd = stats->nid_obd; - int len = 0; - - *eof = 1; - page[0] = '\0'; - lprocfs_exp_rd_cb_data_init(&cb_data, page, count, eof, &len); - - cfs_hash_for_each_key(obd->obd_nid_hash, &stats->nid, - lprocfs_exp_print_hash, &cb_data); - return *cb_data.len; -} - -int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - *eof = 1; - return snprintf(page, count, "%s\n", - "Write into this file to clear all nid stats and " - "stale nid entries"); -} -EXPORT_SYMBOL(lprocfs_nid_stats_clear_read); - -int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - struct nid_stat *client_stat; - struct list_head free_list; - - INIT_LIST_HEAD(&free_list); - cfs_hash_cond_del(obd->obd_nid_stats_hash, - lprocfs_nid_stats_clear_write_cb, &free_list); - - while (!list_empty(&free_list)) { - client_stat = list_entry(free_list.next, struct nid_stat, - nid_list); - list_del_init(&client_stat->nid_list); - lprocfs_free_client_stats(client_stat); - } - - return count; -} -EXPORT_SYMBOL(lprocfs_nid_stats_clear_write); -#endif - int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid) { struct nid_stat *new_stat, *old_stat; @@ -548,26 +342,22 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid) GOTO(destroy_new_ns, rc); } -#ifndef HAVE_ONLY_PROCFS_SEQ entry = lprocfs_add_simple(new_stat->nid_proc, "uuid", - lprocfs_exp_rd_uuid, NULL, new_stat, NULL); -#else - entry = lprocfs_add_simple(new_stat->nid_proc, "uuid", new_stat, - &lprocfs_exp_uuid_fops); +#ifndef HAVE_ONLY_PROCFS_SEQ + NULL, NULL, #endif + new_stat, &lprocfs_exp_uuid_fops); if (IS_ERR(entry)) { CWARN("Error adding the NID stats file\n"); rc = PTR_ERR(entry); GOTO(destroy_new_ns, rc); } -#ifndef HAVE_ONLY_PROCFS_SEQ entry = lprocfs_add_simple(new_stat->nid_proc, "hash", - lprocfs_exp_rd_hash, NULL, new_stat, NULL); -#else - entry = lprocfs_add_simple(new_stat->nid_proc, "hash", new_stat, - &lprocfs_exp_hash_fops); +#ifndef HAVE_ONLY_PROCFS_SEQ + NULL, NULL, #endif + new_stat, &lprocfs_exp_hash_fops); if (IS_ERR(entry)) { CWARN("Error adding the hash file\n"); rc = PTR_ERR(entry); @@ -893,246 +683,4 @@ int lprocfs_target_instance_seq_show(struct seq_file *m, void *data) } EXPORT_SYMBOL(lprocfs_target_instance_seq_show); -#ifndef HAVE_ONLY_PROCFS_SEQ -int lprocfs_obd_rd_hash(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = data; - int c = 0; - - if (obd == NULL) - return 0; - - c += cfs_hash_debug_header(page, count); - c += cfs_hash_debug_str(obd->obd_uuid_hash, page + c, count - c); - c += cfs_hash_debug_str(obd->obd_nid_hash, page + c, count - c); - c += cfs_hash_debug_str(obd->obd_nid_stats_hash, page+c, count-c); - - return c; -} -EXPORT_SYMBOL(lprocfs_obd_rd_hash); - -int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = data; - int len = 0, size; - - LASSERT(obd != NULL); - LASSERT(count >= 0); - - /* Set start of user data returned to - page + off since the user may have - requested to read much smaller than - what we need to read */ - *start = page + off; - - /* - * We know we are allocated a page here. - * Also we know that this function will - * not need to write more than a page - * so we can truncate at PAGE_CACHE_SIZE. - */ - size = min(count + (int)off + 1, (int)PAGE_CACHE_SIZE); - - /* Initialize the page */ - memset(page, 0, size); - - if (lprocfs_obd_snprintf(&page, size, &len, "status: ") <= 0) - goto out; - if (obd->obd_max_recoverable_clients == 0) { - if (lprocfs_obd_snprintf(&page, size, &len, "INACTIVE\n") <= 0) - goto out; - - goto fclose; - } - - /* sampled unlocked, but really... */ - if (obd->obd_recovering == 0) { - if (lprocfs_obd_snprintf(&page, size, &len, "COMPLETE\n") <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, - "recovery_start: %lu\n", - obd->obd_recovery_start) <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, - "recovery_duration: %lu\n", - obd->obd_recovery_end - - obd->obd_recovery_start) <= 0) - goto out; - /* Number of clients that have completed recovery */ - if (lprocfs_obd_snprintf(&page, size, &len, - "completed_clients: %d/%d\n", - obd->obd_max_recoverable_clients - - obd->obd_stale_clients, - obd->obd_max_recoverable_clients) <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, - "replayed_requests: %d\n", - obd->obd_replayed_requests) <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, - "last_transno: "LPD64"\n", - obd->obd_next_recovery_transno - 1) <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, "VBR: %s\n", - obd->obd_version_recov ? - "ENABLED" : "DISABLED") <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, "IR: %s\n", - obd->obd_no_ir ? - "DISABLED" : "ENABLED") <= 0) - goto out; - goto fclose; - } - - if (lprocfs_obd_snprintf(&page, size, &len, "RECOVERING\n") <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, "recovery_start: %lu\n", - obd->obd_recovery_start) <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, "time_remaining: %lu\n", - cfs_time_current_sec() >= - obd->obd_recovery_start + - obd->obd_recovery_timeout ? 0 : - obd->obd_recovery_start + - obd->obd_recovery_timeout - - cfs_time_current_sec()) <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, - "connected_clients: %d/%d\n", - atomic_read(&obd->obd_connected_clients), - obd->obd_max_recoverable_clients) <= 0) - goto out; - /* Number of clients that have completed recovery */ - if (lprocfs_obd_snprintf(&page, size, &len, "req_replay_clients: %d\n", - atomic_read(&obd->obd_req_replay_clients)) - <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, "lock_repay_clients: %d\n", - atomic_read(&obd->obd_lock_replay_clients)) - <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, "completed_clients: %d\n", - atomic_read(&obd->obd_connected_clients) - - atomic_read(&obd->obd_lock_replay_clients)) - <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, "evicted_clients: %d\n", - obd->obd_stale_clients) <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, "replayed_requests: %d\n", - obd->obd_replayed_requests) <= 0) - goto out; - if (lprocfs_obd_snprintf(&page, size, &len, "queued_requests: %d\n", - obd->obd_requests_queued_for_recovery) <= 0) - goto out; - - if (lprocfs_obd_snprintf(&page, size, &len, "next_transno: "LPD64"\n", - obd->obd_next_recovery_transno) <= 0) - goto out; - -fclose: - *eof = 1; -out: - return min(count, len - (int)off); -} -EXPORT_SYMBOL(lprocfs_obd_rd_recovery_status); - -int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - LASSERT(obd != NULL); - - return snprintf(page, count, "%d\n", - obd->obd_recovery_ir_factor); -} -EXPORT_SYMBOL(lprocfs_obd_rd_ir_factor); - -int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - int val, rc; - LASSERT(obd != NULL); - - rc = lprocfs_write_helper(buffer, count, &val); - if (rc) - return rc; - - if (val < OBD_IR_FACTOR_MIN || val > OBD_IR_FACTOR_MAX) - return -EINVAL; - - obd->obd_recovery_ir_factor = val; - return count; -} -EXPORT_SYMBOL(lprocfs_obd_wr_ir_factor); - -int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - LASSERT(obd != NULL); - - return snprintf(page, count, "%d\n", - obd->obd_recovery_timeout); -} -EXPORT_SYMBOL(lprocfs_obd_rd_recovery_time_soft); - -int lprocfs_obd_wr_recovery_time_soft(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - int val, rc; - LASSERT(obd != NULL); - - rc = lprocfs_write_helper(buffer, count, &val); - if (rc) - return rc; - - obd->obd_recovery_timeout = val; - return count; -} -EXPORT_SYMBOL(lprocfs_obd_wr_recovery_time_soft); - -int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = data; - LASSERT(obd != NULL); - - return snprintf(page, count, "%u\n", obd->obd_recovery_time_hard); -} -EXPORT_SYMBOL(lprocfs_obd_rd_recovery_time_hard); - -int lprocfs_obd_wr_recovery_time_hard(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = data; - int val, rc; - LASSERT(obd != NULL); - - rc = lprocfs_write_helper(buffer, count, &val); - if (rc) - return rc; - - obd->obd_recovery_time_hard = val; - return count; -} -EXPORT_SYMBOL(lprocfs_obd_wr_recovery_time_hard); - -int lprocfs_target_rd_instance(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - struct obd_device_target *target = &obd->u.obt; - - LASSERT(obd != NULL); - LASSERT(target->obt_magic == OBT_MAGIC); - *eof = 1; - return snprintf(page, count, "%u\n", obd->u.obt.obt_instance); -} -EXPORT_SYMBOL(lprocfs_target_rd_instance); -#endif /* HAVE_ONLY_PROCFS_SEQ */ #endif /* LPROCFS*/ diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index be27f65..aecfbd1 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -1260,93 +1260,8 @@ out: } EXPORT_SYMBOL(class_process_config); -#ifndef HAVE_ONLY_PROCFS_SEQ -int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, - struct lustre_cfg *lcfg, void *data) -{ - struct lprocfs_vars *var; - char *key, *sval; - int i, keylen, vallen; - int matched = 0, j = 0; - int rc = 0; - int skip = 0; - ENTRY; - - if (lcfg->lcfg_command != LCFG_PARAM) { - CERROR("Unknown command: %d\n", lcfg->lcfg_command); - RETURN(-EINVAL); - } - - /* e.g. tunefs.lustre --param mdt.group_upcall=foo /r/tmp/lustre-mdt - or lctl conf_param lustre-MDT0000.mdt.group_upcall=bar - or lctl conf_param lustre-OST0000.osc.max_dirty_mb=36 */ - for (i = 1; i < lcfg->lcfg_bufcount; i++) { - key = lustre_cfg_buf(lcfg, i); - /* Strip off prefix */ - if (class_match_param(key, prefix, &key)) - /* If the prefix doesn't match, return error so we - * can pass it down the stack */ - RETURN(-ENOSYS); - sval = strchr(key, '='); - if (!sval || (*(sval + 1) == 0)) { - CERROR("Can't parse param %s (missing '=')\n", key); - /* rc = -EINVAL; continue parsing other params */ - continue; - } - keylen = sval - key; - sval++; - vallen = strlen(sval); - matched = 0; - j = 0; - /* Search proc entries */ - while (lvars[j].name) { - var = &lvars[j]; - if (class_match_param(key, (char *)var->name, 0) == 0 && - keylen == strlen(var->name)) { - matched++; - rc = -EROFS; - - if (var->write_fptr) { - mm_segment_t oldfs; - oldfs = get_fs(); - set_fs(KERNEL_DS); - rc = (var->write_fptr)(NULL, sval, - vallen, data); - set_fs(oldfs); - } - break; - } - j++; - } - if (!matched) { - CERROR("%.*s: %s unknown param %s\n", - (int)strlen(prefix) - 1, prefix, - (char *)lustre_cfg_string(lcfg, 0), key); - /* rc = -EINVAL; continue parsing other params */ - skip++; - } else if (rc < 0) { - CERROR("%s: error writing proc entry '%s': rc = %d\n", - prefix, var->name, rc); - rc = 0; - } else { - CDEBUG(D_CONFIG, "%s.%.*s: Set parameter %.*s=%s\n", - lustre_cfg_string(lcfg, 0), - (int)strlen(prefix) - 1, prefix, - (int)(sval - key - 1), key, sval); - } - } - - if (rc > 0) - rc = 0; - if (!rc && skip) - rc = skip; - RETURN(rc); -} -EXPORT_SYMBOL(class_process_proc_param); -#endif /* !HAVE_ONLY_PROCFS_SEQ */ - -int class_process_proc_seq_param(char *prefix, struct lprocfs_seq_vars *lvars, - struct lustre_cfg *lcfg, void *data) +int class_process_proc_param(char *prefix, struct lprocfs_seq_vars *lvars, + struct lustre_cfg *lcfg, void *data) { struct lprocfs_seq_vars *var; struct file fakefile; @@ -1431,7 +1346,7 @@ int class_process_proc_seq_param(char *prefix, struct lprocfs_seq_vars *lvars, rc = skip; RETURN(rc); } -EXPORT_SYMBOL(class_process_proc_seq_param); +EXPORT_SYMBOL(class_process_proc_param); extern int lustre_check_exclusion(struct super_block *sb, char *svname); diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 74d3b9d..73c74c2 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -596,7 +596,7 @@ static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg) LASSERT (rc == ELDLM_OK); obd->obd_vars = lprocfs_echo_obd_vars; - if (lprocfs_seq_obd_setup(obd) == 0 && + if (lprocfs_obd_setup(obd) == 0 && lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST) == 0) { lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES, LPROCFS_CNTR_AVGMINMAX, @@ -606,8 +606,8 @@ static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg) "write_bytes", "bytes"); } - ptlrpc_init_client (LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL, - "echo_ldlm_cb_client", &obd->obd_ldlm_client); + ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL, + "echo_ldlm_cb_client", &obd->obd_ldlm_client); RETURN(0); } diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 9511275..b66f850 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -304,7 +304,7 @@ static int ofd_process_config(const struct lu_env *env, struct lu_device *d, break; } - rc = class_process_proc_seq_param(PARAM_OST, obd->obd_vars, cfg, + rc = class_process_proc_param(PARAM_OST, obd->obd_vars, cfg, d->ld_obd); if (rc > 0 || rc == -ENOSYS) { CDEBUG(D_CONFIG, "pass param %s down the stack.\n", @@ -525,7 +525,7 @@ static int ofd_procfs_init(struct ofd_device *ofd) /* lprocfs must be setup before the ofd so state can be safely added * to /proc incrementally as the ofd is setup */ obd->obd_vars = lprocfs_ofd_obd_vars; - rc = lprocfs_seq_obd_setup(obd); + rc = lprocfs_obd_setup(obd); if (rc) { CERROR("%s: lprocfs_obd_setup failed: %d.\n", obd->obd_name, rc); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 7a05587..732487c 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -3126,7 +3126,7 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) obd->obd_proc_entry = NULL; } } else { - rc = lprocfs_seq_obd_setup(obd); + rc = lprocfs_obd_setup(obd); } /* If the basic OSC proc tree construction succeeded then @@ -3245,8 +3245,7 @@ int osc_cleanup(struct obd_device *obd) 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); + int rc = class_process_proc_param(PARAM_OSC, obd->obd_vars, lcfg, obd); return rc > 0 ? 0: rc; } diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index b656a79..49d9afa 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -6008,13 +6008,12 @@ static int osd_process_config(const struct lu_env *env, break; case LCFG_PARAM: LASSERT(&o->od_dt_dev); - rc = class_process_proc_seq_param(PARAM_OSD, - lprocfs_osd_obd_vars, - cfg, &o->od_dt_dev); + rc = class_process_proc_param(PARAM_OSD, lprocfs_osd_obd_vars, + cfg, &o->od_dt_dev); if (rc > 0 || rc == -ENOSYS) - rc = class_process_proc_seq_param(PARAM_OST, - lprocfs_osd_obd_vars, - cfg, &o->od_dt_dev); + rc = class_process_proc_param(PARAM_OST, + lprocfs_osd_obd_vars, + cfg, &o->od_dt_dev); break; default: rc = -ENOSYS; diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c index bb42023..b59d920 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -779,13 +779,12 @@ static int osd_process_config(const struct lu_env *env, break; case LCFG_PARAM: { LASSERT(&o->od_dt_dev); - rc = class_process_proc_seq_param(PARAM_OSD, - lprocfs_osd_obd_vars, cfg, - &o->od_dt_dev); + rc = class_process_proc_param(PARAM_OSD, lprocfs_osd_obd_vars, + cfg, &o->od_dt_dev); if (rc > 0 || rc == -ENOSYS) - rc = class_process_proc_seq_param(PARAM_OST, - lprocfs_osd_obd_vars, - cfg, &o->od_dt_dev); + rc = class_process_proc_param(PARAM_OST, + lprocfs_osd_obd_vars, + cfg, &o->od_dt_dev); break; } default: diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c index 68adc7a..2dbcb73 100644 --- a/lustre/osp/lproc_osp.c +++ b/lustre/osp/lproc_osp.c @@ -812,7 +812,7 @@ void osp_lprocfs_init(struct osp_device *osp) int rc; obd->obd_vars = lprocfs_osp_obd_vars; - if (lprocfs_seq_obd_setup(obd) != 0) + if (lprocfs_obd_setup(obd) != 0) return; rc = lprocfs_seq_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars, diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c index 7587560..cb22b2f 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c @@ -267,7 +267,7 @@ int lwp_init0(const struct lu_env *env, struct lwp_device *lwp, RETURN(rc); } - if (lprocfs_seq_obd_setup(lwp->lpd_obd) == 0) + if (lprocfs_obd_setup(lwp->lpd_obd) == 0) ptlrpc_lprocfs_register_obd(lwp->lpd_obd); RETURN(0); diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index e4ce5b4..f7c18ae 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -544,8 +544,8 @@ static int osp_process_config(const struct lu_env *env, break; case LCFG_PARAM: LASSERT(obd); - rc = class_process_proc_seq_param(PARAM_OSC, obd->obd_vars, - lcfg, obd); + rc = class_process_proc_param(PARAM_OSC, obd->obd_vars, + lcfg, obd); if (rc > 0) rc = 0; if (rc == -ENOSYS) { diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 46cbe77..a35d2b0 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -92,7 +92,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg) #ifdef LPROCFS obd->obd_vars = lprocfs_ost_obd_vars; - lprocfs_seq_obd_setup(obd); + lprocfs_obd_setup(obd); #endif mutex_init(&ost->ost_health_mutex); diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 2ce646b..840ea0c 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -1179,137 +1179,6 @@ void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd) } EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd); -#ifndef HAVE_ONLY_PROCFS_SEQ -int lprocfs_wr_ping(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = data; - struct ptlrpc_request *req; - int rc; - ENTRY; - - LPROCFS_CLIMP_CHECK(obd); - req = ptlrpc_prep_ping(obd->u.cli.cl_import); - LPROCFS_CLIMP_EXIT(obd); - if (req == NULL) - RETURN(-ENOMEM); - - req->rq_send_state = LUSTRE_IMP_FULL; - - rc = ptlrpc_queue_wait(req); - - ptlrpc_req_finished(req); - if (rc >= 0) - RETURN(count); - RETURN(rc); -} -EXPORT_SYMBOL(lprocfs_wr_ping); - -int lprocfs_wr_import(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = data; - struct obd_import *imp = obd->u.cli.cl_import; - char *kbuf = NULL; - char *uuid; - char *ptr; - int do_reconn = 1; - const char prefix[] = "connection="; - const int prefix_len = sizeof(prefix) - 1; - - if (count > PAGE_CACHE_SIZE - 1 || count <= prefix_len) - return -EINVAL; - - OBD_ALLOC(kbuf, count + 1); - if (kbuf == NULL) - return -ENOMEM; - - if (copy_from_user(kbuf, buffer, count)) - GOTO(out, count = -EFAULT); - - kbuf[count] = 0; - - /* only support connection=uuid::instance now */ - if (strncmp(prefix, kbuf, prefix_len) != 0) - GOTO(out, count = -EINVAL); - - uuid = kbuf + prefix_len; - ptr = strstr(uuid, "::"); - if (ptr) { - __u32 inst; - char *endptr; - - *ptr = 0; - do_reconn = 0; - ptr += strlen("::"); - inst = simple_strtol(ptr, &endptr, 10); - if (*endptr) { - CERROR("config: wrong instance # %s\n", ptr); - } else if (inst != imp->imp_connect_data.ocd_instance) { - CDEBUG(D_INFO, "IR: %s is connecting to an obsoleted " - "target(%u/%u), reconnecting...\n", - imp->imp_obd->obd_name, - imp->imp_connect_data.ocd_instance, inst); - do_reconn = 1; - } else { - CDEBUG(D_INFO, "IR: %s has already been connecting to " - "new target(%u)\n", - imp->imp_obd->obd_name, inst); - } - } - - if (do_reconn) - ptlrpc_recover_import(imp, uuid, 1); - -out: - OBD_FREE(kbuf, count + 1); - return count; -} -EXPORT_SYMBOL(lprocfs_wr_import); - -int lprocfs_rd_pinger_recov(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = data; - struct obd_import *imp = obd->u.cli.cl_import; - int rc; - - LPROCFS_CLIMP_CHECK(obd); - rc = snprintf(page, count, "%d\n", !imp->imp_no_pinger_recover); - LPROCFS_CLIMP_EXIT(obd); - - return rc; -} -EXPORT_SYMBOL(lprocfs_rd_pinger_recov); - -int lprocfs_wr_pinger_recov(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - struct obd_device *obd = data; - struct client_obd *cli = &obd->u.cli; - struct obd_import *imp = cli->cl_import; - int rc, val; - - rc = lprocfs_write_helper(buffer, count, &val); - if (rc < 0) - return rc; - - if (val != 0 && val != 1) - return -ERANGE; - - LPROCFS_CLIMP_CHECK(obd); - spin_lock(&imp->imp_lock); - imp->imp_no_pinger_recover = !val; - spin_unlock(&imp->imp_lock); - LPROCFS_CLIMP_EXIT(obd); - - return count; - -} -EXPORT_SYMBOL(lprocfs_wr_pinger_recov); - -#endif /* HAVE_ONLY_PROCFS_SEQ */ - ssize_t lprocfs_ping_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off) -- 1.8.3.1