Whamcloud - gitweb
Branch b1_4
authoradilger <adilger>
Fri, 10 Jun 2005 23:25:58 +0000 (23:25 +0000)
committeradilger <adilger>
Fri, 10 Jun 2005 23:25:58 +0000 (23:25 +0000)
Fix build if LPROCFS isn't defined to see if this is cause of 2.6.9 x86_64 prob.
b=6471

28 files changed:
lustre/include/linux/lprocfs_status.h
lustre/include/linux/lustre_dlm.h
lustre/include/linux/lustre_net.h
lustre/ldiskfs/quotafmt_test.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_resource.c
lustre/llite/llite_internal.h
lustre/llite/lproc_llite.c
lustre/llite/super.c
lustre/lov/lov_obd.c
lustre/lov/lproc_lov.c
lustre/lvfs/quotacheck_test.c
lustre/lvfs/quotactl_test.c
lustre/mdc/lproc_mdc.c
lustre/mds/lproc_mds.c
lustre/obdclass/class_obd.c
lustre/obdclass/llog_test.c
lustre/obdclass/lprocfs_status.c
lustre/obdecho/lproc_echo.c
lustre/obdfilter/filter_internal.h
lustre/obdfilter/lproc_obdfilter.c
lustre/osc/lproc_osc.c
lustre/osc/osc_internal.h
lustre/osc/osc_request.c
lustre/ost/lproc_ost.c
lustre/ptlrpc/lproc_ptlrpc.c
lustre/ptlrpc/ptlrpc_internal.h
lustre/ptlrpc/ptlrpc_module.c

index 6c0adbd..fda0ee6 100644 (file)
@@ -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,
index 8686034..b612d93 100644 (file)
@@ -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,
index 73c7729..3cac3bd 100644 (file)
@@ -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 */
index a8210cb..ead691c 100644 (file)
@@ -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)
 {
index 884cfb6..0533a10 100644 (file)
@@ -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
index de0ba04..e8d43a0 100644 (file)
@@ -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);
         }
 
index 73532dd..7ab6585 100644 (file)
@@ -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;
index 75fa98a..d8114fa 100644 (file)
 
 #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,
index 78f9206..dbf1b20 100644 (file)
@@ -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);
 
index e8b5492..1739474 100644 (file)
@@ -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;
 
index ee4883d..2546c6c 100644 (file)
 #include <linux/obd_class.h>
 #include <linux/seq_file.h>
 
-#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 */
index 0791981..a997dcc 100644 (file)
@@ -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)
 {
index 898437e..30c3c8c 100644 (file)
@@ -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)
 {
index d49a771..7b83f48 100644 (file)
 #include <linux/obd_class.h>
 #include <linux/lprocfs_status.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 },
         { "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)
index 74795b4..1185866 100644 (file)
 #include <linux/obd_class.h>
 #include <linux/lprocfs_status.h>
 
-#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
index 1cf16f2..ffd7f80 100644 (file)
@@ -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();
index 2d5e7b6..7007632 100644 (file)
@@ -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)
 {
index cff37a3..8a0db22 100644 (file)
@@ -43,7 +43,7 @@
 #include <linux/lprocfs_status.h>
 #include <linux/lustre_fsfilt.h>
 
-#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*/
index c25d156..cc3207d 100644 (file)
 #include <linux/lprocfs_status.h>
 #include <linux/obd_class.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 }
@@ -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 */
index 47ad2ce..7f83452 100644 (file)
@@ -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
 
 
index f504922..8334946 100644 (file)
 
 #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 */
index da9aa9d..3127e0b 100644 (file)
 #include <linux/seq_file.h>
 #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 */
index 8fe19d9..ac8d500 100644 (file)
@@ -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;}
index 37a44af..4057928 100644 (file)
@@ -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);
index 4ceec0d..bf64ba2 100644 (file)
 #include <linux/seq_file.h>
 #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 */
index f82ec04..f79d127 100644 (file)
@@ -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)
index 1c92f6f..70dcbf2 100644 (file)
@@ -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);
index f3e7c18..f9c4bdb 100644 (file)
@@ -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);