From 755e9c0eb3ab38c803dafa40b6aba50912dee376 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 10 Jun 2005 23:25:58 +0000 Subject: [PATCH] Branch b1_4 Fix build if LPROCFS isn't defined to see if this is cause of 2.6.9 x86_64 prob. b=6471 --- lustre/include/linux/lprocfs_status.h | 2 +- lustre/include/linux/lustre_dlm.h | 7 +++--- lustre/include/linux/lustre_net.h | 10 ++++---- lustre/ldiskfs/quotafmt_test.c | 2 ++ lustre/ldlm/ldlm_lockd.c | 4 ++-- lustre/ldlm/ldlm_resource.c | 12 +++++----- lustre/llite/llite_internal.h | 8 ++++++- lustre/llite/lproc_llite.c | 13 +++-------- lustre/llite/super.c | 4 ++-- lustre/lov/lov_obd.c | 2 +- lustre/lov/lproc_lov.c | 8 ++----- lustre/lvfs/quotacheck_test.c | 2 ++ lustre/lvfs/quotactl_test.c | 2 ++ lustre/mdc/lproc_mdc.c | 7 ++---- lustre/mds/lproc_mds.c | 11 ++------- lustre/obdclass/class_obd.c | 14 ++++++----- lustre/obdclass/llog_test.c | 2 ++ lustre/obdclass/lprocfs_status.c | 5 ++-- lustre/obdecho/lproc_echo.c | 8 ++----- lustre/obdfilter/filter_internal.h | 14 +++++------ lustre/obdfilter/lproc_obdfilter.c | 10 ++------ lustre/osc/lproc_osc.c | 8 ++----- lustre/osc/osc_internal.h | 2 +- lustre/osc/osc_request.c | 14 +++++------ lustre/ost/lproc_ost.c | 7 ++---- lustre/ptlrpc/lproc_ptlrpc.c | 44 +++++++++++++++++------------------ lustre/ptlrpc/ptlrpc_internal.h | 2 +- lustre/ptlrpc/ptlrpc_module.c | 4 ---- 28 files changed, 100 insertions(+), 128 deletions(-) diff --git a/lustre/include/linux/lprocfs_status.h b/lustre/include/linux/lprocfs_status.h index 6c0adbd..fda0ee6 100644 --- a/lustre/include/linux/lprocfs_status.h +++ b/lustre/include/linux/lprocfs_status.h @@ -303,7 +303,7 @@ static inline void lprocfs_free_obd_stats(struct obd_device *obddev) static inline struct proc_dir_entry * lprocfs_register(const char *name, struct proc_dir_entry *parent, struct lprocfs_vars *list, void *data) { return NULL; } -#define LPROCFS_INIT_VARS(name, vclass, vinstance) do {} while (0) +#define LPROCFS_INIT_VARS(name, vclass, vinstance) #define lprocfs_init_vars(...) do {} while (0) static inline int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *var, diff --git a/lustre/include/linux/lustre_dlm.h b/lustre/include/linux/lustre_dlm.h index 8686034..b612d93 100644 --- a/lustre/include/linux/lustre_dlm.h +++ b/lustre/include/linux/lustre_dlm.h @@ -168,9 +168,6 @@ struct ldlm_namespace { struct list_head ns_root_list; /* all root resources in ns */ struct lustre_lock ns_lock; /* protects hash, refcount, list */ struct list_head ns_list_chain; /* position in global NS list */ - /* - struct proc_dir_entry *ns_proc_dir; - */ struct list_head ns_unused_list; /* all root resources in ns */ int ns_nr_unused; @@ -488,7 +485,11 @@ struct ldlm_namespace *ldlm_namespace_new(char *name, __u32 local); int ldlm_namespace_cleanup(struct ldlm_namespace *ns, int flags); int ldlm_namespace_free(struct ldlm_namespace *ns, int force); int ldlm_proc_setup(void); +#ifdef LPROCFS void ldlm_proc_cleanup(void); +#else +static inline void ldlm_proc_cleanup(void) {} +#endif /* resource.c - internal */ struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns, diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h index 73c7729..3cac3bd 100644 --- a/lustre/include/linux/lustre_net.h +++ b/lustre/include/linux/lustre_net.h @@ -771,12 +771,12 @@ int ptlrpcd_addref(void); void ptlrpcd_decref(void); /* ptlrpc/lproc_ptlrpc.c */ -#ifdef __KERNEL__ -void ptlrpc_lprocfs_register_obd(struct obd_device *obddev); -void ptlrpc_lprocfs_unregister_obd(struct obd_device *obddev); +#ifdef LPROCFS +void ptlrpc_lprocfs_register_obd(struct obd_device *obd); +void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd); #else -#define ptlrpc_lprocfs_register_obd(param...) do{}while(0) -#define ptlrpc_lprocfs_unregister_obd(param...) do{}while(0) +static inline void ptlrpc_lprocfs_register_obd(struct obd_device *obd) {} +static inline void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd) {} #endif /* ptlrpc/llog_server.c */ diff --git a/lustre/ldiskfs/quotafmt_test.c b/lustre/ldiskfs/quotafmt_test.c index a8210cb..ead691c 100644 --- a/lustre/ldiskfs/quotafmt_test.c +++ b/lustre/ldiskfs/quotafmt_test.c @@ -436,9 +436,11 @@ static struct obd_ops quotfmt_obd_ops = { .o_cleanup = quotfmt_test_cleanup, }; +#ifdef LPROCFS static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; LPROCFS_INIT_VARS(quotfmt_test, lprocfs_module_vars, lprocfs_obd_vars) +#endif static int __init quotfmt_test_init(void) { diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 884cfb6..0533a10 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -1409,7 +1409,7 @@ static int ldlm_setup(void) if (ldlm_state == NULL) RETURN(-ENOMEM); -#ifdef __KERNEL__ +#ifdef LPROCFS rc = ldlm_proc_setup(); if (rc != 0) GOTO(out_free, rc); @@ -1503,7 +1503,7 @@ static int ldlm_setup(void) #endif out_proc: -#ifdef __KERNEL__ +#ifdef LPROCFS ldlm_proc_cleanup(); out_free: #endif diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index de0ba04..e8d43a0 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -39,7 +39,7 @@ struct proc_dir_entry *ldlm_type_proc_dir = NULL; struct proc_dir_entry *ldlm_ns_proc_dir = NULL; struct proc_dir_entry *ldlm_svc_proc_dir = NULL; -#ifdef __KERNEL__ +#ifdef LPROCFS static int ldlm_proc_dump_ns(struct file *file, const char *buffer, unsigned long count, void *data) { @@ -206,8 +206,10 @@ void ldlm_proc_namespace(struct ldlm_namespace *ns) lprocfs_add_vars(ldlm_ns_proc_dir, lock_vars, 0); } } -#endif #undef MAX_STRING_SIZE +#else +#define ldlm_proc_namespace(ns) do {} while (0) +#endif /* LPROCFS */ struct ldlm_namespace *ldlm_namespace_new(char *name, __u32 client) { @@ -255,9 +257,7 @@ struct ldlm_namespace *ldlm_namespace_new(char *name, __u32 client) down(&ldlm_namespace_lock); list_add(&ns->ns_list_chain, &ldlm_namespace_list); up(&ldlm_namespace_lock); -#ifdef __KERNEL__ ldlm_proc_namespace(ns); -#endif RETURN(ns); out_hash: @@ -380,7 +380,7 @@ int ldlm_namespace_free(struct ldlm_namespace *ns, int force) /* At shutdown time, don't call the cancellation callback */ ldlm_namespace_cleanup(ns, 0); -#ifdef __KERNEL__ +#ifdef LPROCFS { struct proc_dir_entry *dir; dir = lprocfs_srch(ldlm_ns_proc_dir, ns->ns_name); @@ -409,7 +409,7 @@ int ldlm_namespace_free(struct ldlm_namespace *ns, int force) "of this node.\n", ns->ns_name, atomic_read(&ns->ns_refcount), rc); } - CDEBUG(D_DLMTRACE, + CDEBUG(D_DLMTRACE, "dlm namespace %s free done waiting\n", ns->ns_name); } diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 73532dd..7ab6585 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -168,7 +168,6 @@ struct lov_stripe_md; extern spinlock_t inode_lock; -extern void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi); extern struct proc_dir_entry *proc_lustre_fs_root; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) @@ -250,9 +249,16 @@ extern char *llap_origins[]; #endif /* llite/lproc_llite.c */ +#ifdef LPROCFS int lprocfs_register_mountpoint(struct proc_dir_entry *parent, struct super_block *sb, char *osc, char *mdc); void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi); +#else +static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent, + struct super_block *sb, char *osc, char *mdc){return 0;} +static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {} +#endif + /* llite/dir.c */ extern struct file_operations ll_dir_operations; diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 75fa98a..d8114fa 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -29,20 +29,13 @@ #include "llite_internal.h" -/* /proc/lustre/llite mount point registration */ struct proc_dir_entry *proc_lustre_fs_root; + +#ifdef LPROCFS +/* /proc/lustre/llite mount point registration */ struct file_operations llite_dump_pgcache_fops; struct file_operations ll_ra_stats_fops; -#ifndef LPROCFS -int lprocfs_register_mountpoint(struct proc_dir_entry *parent, - struct super_block *sb, char *osc, char *mdc) -{ - return 0; -} -void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi){} -#else - long long mnt_instance; static int ll_rd_blksize(char *page, char **start, off_t off, int count, diff --git a/lustre/llite/super.c b/lustre/llite/super.c index 78f9206..dbf1b20 100644 --- a/lustre/llite/super.c +++ b/lustre/llite/super.c @@ -102,8 +102,8 @@ static int __init init_lustre_lite(void) if (ll_file_data_slab == NULL) return -ENOMEM; - proc_lustre_fs_root = proc_lustre_root ? - proc_mkdir("llite", proc_lustre_root) : NULL; + if (proc_lustre_root) + proc_lustre_fs_root = proc_mkdir("llite", proc_lustre_root); ll_register_cache(&ll_cache_definition); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index e8b5492..1739474 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -588,7 +588,7 @@ static int lov_setup(struct obd_device *obd, obd_count len, void *buf) lprocfs_init_vars(lov, &lvars); lprocfs_obd_setup(obd, lvars.obd_vars); -#ifdef __KERNEL__ +#ifdef LPROCFS { struct proc_dir_entry *entry; diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index ee4883d..2546c6c 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -29,11 +29,7 @@ #include #include -#ifndef LPROCFS -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -#else - +#ifdef LPROCFS static int lov_rd_stripesize(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -205,5 +201,5 @@ struct file_operations lov_proc_target_fops = { .release = seq_release, }; -#endif /* LPROCFS */ LPROCFS_INIT_VARS(lov, lprocfs_module_vars, lprocfs_obd_vars) +#endif /* LPROCFS */ diff --git a/lustre/lvfs/quotacheck_test.c b/lustre/lvfs/quotacheck_test.c index 0791981..a997dcc 100644 --- a/lustre/lvfs/quotacheck_test.c +++ b/lustre/lvfs/quotacheck_test.c @@ -204,9 +204,11 @@ static struct obd_ops quotacheck_obd_ops = { .o_cleanup = quotacheck_test_cleanup, }; +#ifdef LPROCFS static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; LPROCFS_INIT_VARS(quotacheck_test, lprocfs_module_vars, lprocfs_obd_vars) +#endif static int __init quotacheck_test_init(void) { diff --git a/lustre/lvfs/quotactl_test.c b/lustre/lvfs/quotactl_test.c index 898437e..30c3c8c 100644 --- a/lustre/lvfs/quotactl_test.c +++ b/lustre/lvfs/quotactl_test.c @@ -348,9 +348,11 @@ static struct obd_ops quotactl_obd_ops = { .o_cleanup = quotactl_test_cleanup, }; +#ifdef LPROCFS static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; LPROCFS_INIT_VARS(quotactl_test, lprocfs_module_vars, lprocfs_obd_vars) +#endif static int __init quotactl_test_init(void) { diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index d49a771..7b83f48 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -26,10 +26,7 @@ #include #include -#ifndef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; -#else +#ifdef LPROCFS static struct lprocfs_vars lprocfs_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { "ping", 0, lprocfs_wr_ping, 0 }, @@ -50,6 +47,6 @@ static struct lprocfs_vars lprocfs_module_vars[] = { { 0 } }; +LPROCFS_INIT_VARS(mdc, lprocfs_module_vars, lprocfs_obd_vars) #endif /* LPROCFS */ -LPROCFS_INIT_VARS(mdc, lprocfs_module_vars, lprocfs_obd_vars) diff --git a/lustre/mds/lproc_mds.c b/lustre/mds/lproc_mds.c index 74795b4..1185866 100644 --- a/lustre/mds/lproc_mds.c +++ b/lustre/mds/lproc_mds.c @@ -29,14 +29,7 @@ #include #include -#ifndef LPROCFS -struct lprocfs_vars lprocfs_mds_obd_vars[] = { {0} }; -struct lprocfs_vars lprocfs_mds_module_vars[] = { {0} }; -struct lprocfs_vars lprocfs_mdt_obd_vars[] = { {0} }; -struct lprocfs_vars lprocfs_mdt_module_vars[] = { {0} }; - -#else - +#ifdef LPROCFS static int lprocfs_mds_rd_mntdev(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -199,6 +192,6 @@ struct lprocfs_vars lprocfs_mdt_module_vars[] = { { 0 } }; -#endif LPROCFS_INIT_VARS(mds, lprocfs_mds_module_vars, lprocfs_mds_obd_vars); LPROCFS_INIT_VARS(mdt, lprocfs_mdt_module_vars, lprocfs_mdt_obd_vars); +#endif diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 1cf16f2..ffd7f80 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -410,6 +410,8 @@ EXPORT_SYMBOL(obd_lustre_upcall); EXPORT_SYMBOL(obd_sync_filter); EXPORT_SYMBOL(ptlrpc_put_connection_superhack); EXPORT_SYMBOL(ptlrpc_abort_inflight_superhack); + +struct proc_dir_entry *proc_lustre_root; EXPORT_SYMBOL(proc_lustre_root); EXPORT_SYMBOL(class_register_type); @@ -478,14 +480,17 @@ int obd_proc_read_pinger(char *page, char **start, off_t off, int count, } /* Root for /proc/fs/lustre */ -struct proc_dir_entry *proc_lustre_root = NULL; struct lprocfs_vars lprocfs_base[] = { { "version", obd_proc_read_version, NULL, NULL }, { "kernel_version", obd_proc_read_kernel_version, NULL, NULL }, { "pinger", obd_proc_read_pinger, NULL, NULL }, { 0 } }; +#else +#define lprocfs_base NULL +#endif /* LPROCFS */ +#ifdef __KERNEL__ static void *obd_device_list_seq_start(struct seq_file *p, loff_t*pos) { if (*pos >= MAX_OBD_DEVICES) @@ -639,7 +644,7 @@ int init_obdclass(void) #endif { struct obd_device *obd; -#ifdef LPROCFS +#ifdef __KERNEL__ struct proc_dir_entry *entry; #endif int err; @@ -676,9 +681,7 @@ int init_obdclass(void) #ifdef __KERNEL__ obd_sysctl_init(); -#endif -#ifdef LPROCFS proc_lustre_root = proc_mkdir("lustre", proc_root_fs); if (!proc_lustre_root) { printk(KERN_ERR @@ -720,12 +723,11 @@ static void cleanup_obdclass(void) obd_cleanup_caches(); obd_sysctl_clean(); -#ifdef LPROCFS + if (proc_lustre_root) { lprocfs_remove(proc_lustre_root); proc_lustre_root = NULL; } -#endif class_handle_cleanup(); class_exit_uuidlist(); diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index 2d5e7b6..7007632 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -662,9 +662,11 @@ static struct obd_ops llog_obd_ops = { .o_llog_finish = llog_test_llog_finish, }; +#ifdef LPROCFS static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; LPROCFS_INIT_VARS(llog_test, lprocfs_module_vars, lprocfs_obd_vars) +#endif static int __init llog_test_init(void) { diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index cff37a3..8a0db22 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -43,7 +43,7 @@ #include #include -#if defined(LPROCFS) && defined(__KERNEL__) +#if defined(LPROCFS) struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head, const char *name) @@ -874,8 +874,6 @@ int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off, } EXPORT_SYMBOL(lprocfs_obd_rd_recovery_status); -#endif /* LPROCFS*/ - EXPORT_SYMBOL(lprocfs_register); EXPORT_SYMBOL(lprocfs_srch); EXPORT_SYMBOL(lprocfs_remove); @@ -907,3 +905,4 @@ EXPORT_SYMBOL(lprocfs_rd_filesfree); EXPORT_SYMBOL(lprocfs_write_helper); EXPORT_SYMBOL(lprocfs_write_u64_helper); +#endif /* LPROCFS*/ diff --git a/lustre/obdecho/lproc_echo.c b/lustre/obdecho/lproc_echo.c index c25d156..cc3207d 100644 --- a/lustre/obdecho/lproc_echo.c +++ b/lustre/obdecho/lproc_echo.c @@ -24,11 +24,7 @@ #include #include -#ifndef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; -#else - +#ifdef LPROCFS static struct lprocfs_vars lprocfs_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { 0 } @@ -39,5 +35,5 @@ static struct lprocfs_vars lprocfs_module_vars[] = { { 0 } }; -#endif /* LPROCFS */ LPROCFS_INIT_VARS(echo, lprocfs_module_vars, lprocfs_obd_vars) +#endif /* LPROCFS */ diff --git a/lustre/obdfilter/filter_internal.h b/lustre/obdfilter/filter_internal.h index 47ad2ce..7f83452 100644 --- a/lustre/obdfilter/filter_internal.h +++ b/lustre/obdfilter/filter_internal.h @@ -172,21 +172,21 @@ int filter_san_setup(struct obd_device *obd, obd_count len, void *buf); int filter_san_preprw(int cmd, struct obd_export *, struct obdo *, int objcount, struct obd_ioobj *, int niocount, struct niobuf_remote *); -#ifdef __KERNEL__ +#ifdef LPROCFS void filter_tally_write(struct filter_obd *filter, struct page **pages, - int nr_pages, unsigned long *blocks, + int nr_pages, unsigned long *blocks, int blocks_per_page); -void filter_tally_read(struct filter_obd *filter, struct niobuf_local *lnb, +void filter_tally_read(struct filter_obd *filter, struct niobuf_local *lnb, int niocount); int lproc_filter_attach_seqstat(struct obd_device *dev); #else -static inline filter_tally_write(struct filter_obd *filter, - struct page **pages, int nr_pages, +static inline void filter_tally_write(struct filter_obd *filter, + struct page **pages, int nr_pages, unsigned long *blocks, int blocks_per_page) {} -static inline void filter_tally_read(struct filter_obd *filter, +static inline void filter_tally_read(struct filter_obd *filter, struct niobuf_local *lnb, int niocount) {} -static inline lproc_filter_attach_seqstat(struct obd_device *dev) {} +static inline int lproc_filter_attach_seqstat(struct obd_device *dev){return 0;} #endif diff --git a/lustre/obdfilter/lproc_obdfilter.c b/lustre/obdfilter/lproc_obdfilter.c index f504922..8334946 100644 --- a/lustre/obdfilter/lproc_obdfilter.c +++ b/lustre/obdfilter/lproc_obdfilter.c @@ -29,11 +29,7 @@ #include "filter_internal.h" -#ifndef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; -#else - +#ifdef LPROCFS static int lprocfs_filter_rd_groups(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -582,7 +578,5 @@ int lproc_filter_attach_seqstat(struct obd_device *dev) &filter_brw_stats_fops, dev); } - - -#endif /* LPROCFS */ LPROCFS_INIT_VARS(filter, lprocfs_module_vars, lprocfs_obd_vars) +#endif /* LPROCFS */ diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index da9aa9d..3127e0b 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -30,11 +30,7 @@ #include #include "osc_internal.h" -#ifndef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; -#else - +#ifdef LPROCFS static int osc_rd_max_pages_per_rpc(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -452,5 +448,5 @@ int lproc_osc_attach_seqstat(struct obd_device *dev) &osc_rpc_stats_fops, dev); } -#endif /* LPROCFS */ LPROCFS_INIT_VARS(osc, lprocfs_module_vars, lprocfs_obd_vars) +#endif /* LPROCFS */ diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index 8fe19d9..ac8d500 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -61,7 +61,7 @@ int osc_qinfo_cleanup(struct client_obd *cli); int osc_qinfo_init(void); void osc_qinfo_exit(void); -#ifdef __KERNEL__ +#ifdef LPROCFS int lproc_osc_attach_seqstat(struct obd_device *dev); #else static inline int lproc_osc_attach_seqstat(struct obd_device *dev) {return 0;} diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 37a44af..4057928 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1621,7 +1621,7 @@ static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi, list_splice(&rpc_list, &aa->aa_oaps); INIT_LIST_HEAD(&rpc_list); -#ifdef __KERNEL__ +#ifdef LPROCFS if (cmd == OBD_BRW_READ) { lprocfs_oh_tally_log2(&cli->cl_read_page_hist, page_count); lprocfs_oh_tally(&cli->cl_read_rpc_hist, cli->cl_r_in_flight); @@ -3367,7 +3367,7 @@ struct obd_ops osc_obd_ops = { .o_quotactl = osc_quotactl, }; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#if defined(__KERNEL__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) struct obd_ops sanosc_obd_ops = { .o_owner = THIS_MODULE, .o_cleanup = client_obd_cleanup, @@ -3403,14 +3403,14 @@ struct obd_ops sanosc_obd_ops = { int __init osc_init(void) { struct lprocfs_static_vars lvars; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#if defined(__KERNEL__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) struct lprocfs_static_vars sanlvars; #endif int rc; ENTRY; lprocfs_init_vars(osc, &lvars); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#if defined(__KERNEL__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) lprocfs_init_vars(osc, &sanlvars); #endif @@ -3419,13 +3419,13 @@ int __init osc_init(void) if (rc) RETURN(rc); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#if defined(__KERNEL__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) rc = class_register_type(&sanosc_obd_ops, sanlvars.module_vars, LUSTRE_SANOSC_NAME); if (rc) class_unregister_type(LUSTRE_OSC_NAME); #endif - + rc = osc_qinfo_init(); RETURN(rc); @@ -3435,7 +3435,7 @@ int __init osc_init(void) static void /*__exit*/ osc_exit(void) { osc_qinfo_exit(); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +#if defined(__KERNEL__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) class_unregister_type(LUSTRE_SANOSC_NAME); #endif class_unregister_type(LUSTRE_OSC_NAME); diff --git a/lustre/ost/lproc_ost.c b/lustre/ost/lproc_ost.c index 4ceec0d..bf64ba2 100644 --- a/lustre/ost/lproc_ost.c +++ b/lustre/ost/lproc_ost.c @@ -26,10 +26,7 @@ #include #include "ost_internal.h" -#ifndef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; -#else +#ifdef LPROCFS static struct lprocfs_vars lprocfs_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { 0 } @@ -74,5 +71,5 @@ ost_print_req(void *seq_file, struct ptlrpc_request *req) } } -#endif /* LPROCFS */ LPROCFS_INIT_VARS(ost, lprocfs_module_vars, lprocfs_obd_vars) +#endif /* LPROCFS */ diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index f82ec04..f79d127 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -102,12 +102,7 @@ const char* ll_opcode2str(__u32 opcode) return ll_rpc_opcode_table[offset].opname; } -#ifndef LPROCFS -void ptlrpc_lprocfs_register_service(struct obd_device *obddev, - struct ptlrpc_service *svc) { return ; } -void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc) { return; } -#else - +#ifdef LPROCFS void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir, char *name, struct proc_dir_entry **procroot_ret, struct lprocfs_stats **stats_ret) @@ -167,7 +162,7 @@ ptlrpc_lprocfs_read_req_history_len(char *page, char **start, off_t off, int count, int *eof, void *data) { struct ptlrpc_service *svc = data; - + *eof = 1; return snprintf(page, count, "%d\n", svc->srv_n_history_rqbds); } @@ -177,7 +172,7 @@ ptlrpc_lprocfs_read_req_history_max(char *page, char **start, off_t off, int count, int *eof, void *data) { struct ptlrpc_service *svc = data; - + *eof = 1; return snprintf(page, count, "%d\n", svc->srv_max_history_rqbds); } @@ -191,7 +186,7 @@ ptlrpc_lprocfs_write_req_history_max(struct file *file, const char *buffer, unsigned long flags; int val; int rc = lprocfs_write_helper(buffer, count, &val); - + if (rc < 0) return rc; @@ -204,11 +199,11 @@ ptlrpc_lprocfs_write_req_history_max(struct file *file, const char *buffer, bufpages = (svc->srv_buf_size + PAGE_SIZE - 1)/PAGE_SIZE; if (val > num_physpages/(2*bufpages)) return -ERANGE; - + spin_lock_irqsave(&svc->srv_lock, flags); svc->srv_max_history_rqbds = val; spin_unlock_irqrestore(&svc->srv_lock, flags); - + return count; } @@ -230,7 +225,7 @@ ptlrpc_lprocfs_svc_req_history_seek(struct ptlrpc_service *svc, srhi->srhi_seq <= seq) { /* If srhi_req was set previously, hasn't been culled and * we're searching for a seq on or after it (i.e. more - * recent), search from it onwards. + * recent), search from it onwards. * Since the service history is LRU (i.e. culled reqs will * be near the head), we shouldn't have to do long * re-scans */ @@ -244,7 +239,7 @@ ptlrpc_lprocfs_svc_req_history_seek(struct ptlrpc_service *svc, while (e != &svc->srv_request_history) { req = list_entry(e, struct ptlrpc_request, rq_history_list); - + if (req->rq_history_seq >= seq) { srhi->srhi_seq = req->rq_history_seq; srhi->srhi_req = req; @@ -252,7 +247,7 @@ ptlrpc_lprocfs_svc_req_history_seek(struct ptlrpc_service *svc, } e = e->next; } - + return -ENOENT; } @@ -270,16 +265,16 @@ ptlrpc_lprocfs_svc_req_history_start(struct seq_file *s, loff_t *pos) srhi->srhi_seq = 0; srhi->srhi_req = NULL; - + spin_lock_irqsave(&svc->srv_lock, flags); rc = ptlrpc_lprocfs_svc_req_history_seek(svc, srhi, *pos); spin_unlock_irqrestore(&svc->srv_lock, flags); - + if (rc == 0) { *pos = srhi->srhi_seq; return srhi; } - + OBD_FREE(srhi, sizeof(*srhi)); return NULL; } @@ -294,7 +289,7 @@ ptlrpc_lprocfs_svc_req_history_stop(struct seq_file *s, void *iter) } static void * -ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s, +ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s, void *iter, loff_t *pos) { struct ptlrpc_service *svc = s->private; @@ -379,13 +374,13 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry, struct ptlrpc_service *svc) { struct lprocfs_vars lproc_vars[] = { - {.name = "req_buffer_history_len", + {.name = "req_buffer_history_len", .write_fptr = NULL, - .read_fptr = ptlrpc_lprocfs_read_req_history_len, + .read_fptr = ptlrpc_lprocfs_read_req_history_len, .data = svc}, {.name = "req_buffer_history_max", .write_fptr = ptlrpc_lprocfs_write_req_history_max, - .read_fptr = ptlrpc_lprocfs_read_req_history_max, + .read_fptr = ptlrpc_lprocfs_read_req_history_max, .data = svc}, {NULL} }; @@ -401,13 +396,13 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry, ptlrpc_lprocfs_register(entry, svc->srv_name, "stats", &svc->srv_procroot, &svc->srv_stats); - + if (svc->srv_procroot == NULL) return; lprocfs_add_vars(svc->srv_procroot, lproc_vars, NULL); - req_history = create_proc_entry("req_history", 0400, + req_history = create_proc_entry("req_history", 0400, svc->srv_procroot); if (req_history != NULL) { req_history->data = svc; @@ -421,6 +416,7 @@ void ptlrpc_lprocfs_register_obd(struct obd_device *obddev) &obddev->obd_svc_procroot, &obddev->obd_svc_stats); } +EXPORT_SYMBOL(ptlrpc_lprocfs_register_obd); void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req) { @@ -457,6 +453,8 @@ void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd) obd->obd_svc_stats = NULL; } } +EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd); + int lprocfs_wr_evict_client(struct file *file, const char *buffer, unsigned long count, void *data) diff --git a/lustre/ptlrpc/ptlrpc_internal.h b/lustre/ptlrpc/ptlrpc_internal.h index 1c92f6f..70dcbf2 100644 --- a/lustre/ptlrpc/ptlrpc_internal.h +++ b/lustre/ptlrpc/ptlrpc_internal.h @@ -41,7 +41,7 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight); void ptlrpc_initiate_recovery(struct obd_import *imp); -#ifdef __KERNEL__ +#ifdef LPROCFS void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry, struct ptlrpc_service *svc); void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc); diff --git a/lustre/ptlrpc/ptlrpc_module.c b/lustre/ptlrpc/ptlrpc_module.c index f3e7c18..f9c4bdb 100644 --- a/lustre/ptlrpc/ptlrpc_module.c +++ b/lustre/ptlrpc/ptlrpc_module.c @@ -202,10 +202,6 @@ EXPORT_SYMBOL(ptlrpcd_decref); EXPORT_SYMBOL(ptlrpcd_add_req); EXPORT_SYMBOL(ptlrpcd_wake); -/* lproc_ptlrpc.c */ -EXPORT_SYMBOL(ptlrpc_lprocfs_register_obd); -EXPORT_SYMBOL(ptlrpc_lprocfs_unregister_obd); - /* llogd.c */ EXPORT_SYMBOL(llog_origin_handle_create); EXPORT_SYMBOL(llog_origin_handle_next_block); -- 1.8.3.1