Whamcloud - gitweb
64c56e21d2a8000b6fdc74674cb7421a99295316
[fs/lustre-release.git] / lustre / include / lprocfs_status.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2011, 2017, Intel Corporation.
27  */
28 /*
29  * This file is part of Lustre, http://www.lustre.org/
30  *
31  * lustre/include/lprocfs_status.h
32  *
33  * Top level header file for LProc
34  *
35  * Author: Hariharan Thantry thantry@users.sourceforge.net
36  */
37 #ifndef _LPROCFS_STATUS_H
38 #define _LPROCFS_STATUS_H
39
40 #include <linux/fs.h>
41 #include <linux/proc_fs.h>
42 #include <linux/debugfs.h>
43 #include <linux/rwsem.h>
44 #include <linux/spinlock.h>
45 #include <linux/string_helpers.h>
46 #include <linux/seq_file.h>
47
48 #include <libcfs/libcfs.h>
49 #include <libcfs/linux/linux-fs.h>
50 #include <uapi/linux/lustre/lustre_idl.h>
51
52 /*
53  * Liuux 5.6 introduces proc_ops with v5.5-8862-gd56c0d45f0e2
54  * Now that proc and debugfs use separate operation vector types
55  * separate containers are also needed.
56  */
57 struct lprocfs_vars {
58         const char                      *name;
59         const struct proc_ops           *fops;
60         void                            *data;
61         /** /proc file mode. */
62         mode_t                           proc_mode;
63 };
64
65 /** Provide a debugfs container */
66 struct ldebugfs_vars {
67         const char                      *name;
68         const struct file_operations    *fops;
69         void                            *data;
70         /** debugfs file mode. */
71         mode_t                           proc_mode;
72 };
73
74 static inline unsigned int pct(unsigned long a, unsigned long b)
75 {
76         return b ? a * 100 / b : 0;
77 }
78
79 #define PAGES_TO_MiB(pages)     ((pages) >> (20 - PAGE_SHIFT))
80 #define MiB_TO_PAGES(mb)        ((mb) << (20 - PAGE_SHIFT))
81
82 /**
83  * Append a space separated list of current set flags to str.
84  */
85 #define flag2str(port, flag)                                            \
86         do {                                                            \
87                 if ((port)->port##_##flag) {                            \
88                         seq_printf(m, "%s" #flag, first ? "" : ", ");   \
89                         first = false;                                  \
90                 }                                                       \
91         } while (0)
92
93 void obd_connect_seq_flags2str(struct seq_file *m, __u64 flags, __u64 flags2,
94                                const char *sep);
95 void obd_connect_data_seqprint(struct seq_file *m,
96                                struct obd_connect_data *ocd);
97
98 /* if we find more consumers this could be generalized */
99 #define OBD_HIST_MAX 32
100 struct obd_histogram {
101         spinlock_t      oh_lock;
102         unsigned long   oh_buckets[OBD_HIST_MAX];
103 };
104
105 struct obd_hist_pcpu {
106         struct percpu_counter   oh_pc_buckets[OBD_HIST_MAX];
107         bool                    oh_initialized;
108 };
109
110 /* An lprocfs counter can be configured using the enum bit masks below.
111  *
112  * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
113  * protects this counter from concurrent updates. If not specified,
114  * lprocfs an internal per-counter lock variable. External locks are
115  * not used to protect counter increments, but are used to protect
116  * counter readout and resets.
117  *
118  * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
119  * (i.e. counter can be incremented by more than "1"). When specified,
120  * the counter maintains min, max and sum in addition to a simple
121  * invocation count. This allows averages to be be computed.
122  * If not specified, the counter is an increment-by-1 counter.
123  * min, max, sum, etc. are not maintained.
124  *
125  * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
126  * squares (for multi-valued counter samples only). This allows
127  * external computation of standard deviation, but involves a 64-bit
128  * multiply per counter increment.
129  */
130
131 enum {
132         LPROCFS_CNTR_EXTERNALLOCK       = 0x0001,
133         LPROCFS_CNTR_AVGMINMAX          = 0x0002,
134         LPROCFS_CNTR_STDDEV             = 0x0004,
135
136         /* counter data type */
137         LPROCFS_TYPE_REQS               = 0x0100,
138         LPROCFS_TYPE_BYTES              = 0x0200,
139         LPROCFS_TYPE_PAGES              = 0x0400,
140         LPROCFS_TYPE_USEC               = 0x0800,
141
142         LPROCFS_TYPE_LATENCY            = LPROCFS_TYPE_USEC |
143                                           LPROCFS_CNTR_AVGMINMAX |
144                                           LPROCFS_CNTR_STDDEV,
145         LPROCFS_TYPE_BYTES_FULL         = LPROCFS_TYPE_BYTES |
146                                           LPROCFS_CNTR_AVGMINMAX |
147                                           LPROCFS_CNTR_STDDEV,
148 };
149 #define LC_MIN_INIT ((~(__u64)0) >> 1)
150
151 struct lprocfs_counter_header {
152         unsigned int            lc_config;
153         const char              *lc_name;   /* must be static */
154         const char              *lc_units;  /* must be static */
155 };
156
157 struct lprocfs_counter {
158         __s64   lc_count;
159         __s64   lc_min;
160         __s64   lc_max;
161         __s64   lc_sumsquare;
162         /*
163          * Every counter has lc_array_sum[0], while lc_array_sum[1] is only
164          * for irq context counter, i.e. stats with
165          * LPROCFS_STATS_FLAG_IRQ_SAFE flag, its counter need
166          * lc_array_sum[1]
167          */
168         __s64   lc_array_sum[1];
169 };
170 #define lc_sum          lc_array_sum[0]
171 #define lc_sum_irq      lc_array_sum[1]
172
173 struct lprocfs_percpu {
174         struct lprocfs_counter lp_cntr[0];
175 };
176
177 enum lprocfs_stats_lock_ops {
178         LPROCFS_GET_NUM_CPU     = 0x0001, /* number allocated per-CPU stats */
179         LPROCFS_GET_SMP_ID      = 0x0002, /* current stat to be updated */
180 };
181
182 enum lprocfs_stats_flags {
183         LPROCFS_STATS_FLAG_NONE     = 0x0000, /* per cpu counter */
184         LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
185                                                * area and need locking */
186         LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */
187 };
188
189 enum lprocfs_fields_flags {
190         LPROCFS_FIELDS_FLAGS_CONFIG     = 0x0001,
191         LPROCFS_FIELDS_FLAGS_SUM        = 0x0002,
192         LPROCFS_FIELDS_FLAGS_MIN        = 0x0003,
193         LPROCFS_FIELDS_FLAGS_MAX        = 0x0004,
194         LPROCFS_FIELDS_FLAGS_AVG        = 0x0005,
195         LPROCFS_FIELDS_FLAGS_SUMSQUARE  = 0x0006,
196         LPROCFS_FIELDS_FLAGS_COUNT      = 0x0007,
197 };
198
199 struct lprocfs_stats {
200         /* # of counters */
201         unsigned short                  ls_num;
202         /* 1 + the biggest cpu # whose ls_percpu slot has been allocated */
203         unsigned short                  ls_biggest_alloc_num;
204         enum lprocfs_stats_flags        ls_flags;
205         ktime_t                         ls_init;
206         /* Lock used when there are no percpu stats areas; For percpu stats,
207          * it is used to protect ls_biggest_alloc_num change */
208         spinlock_t                      ls_lock;
209
210         /* has ls_num of counter headers */
211         struct lprocfs_counter_header   *ls_cnt_header;
212         struct lprocfs_percpu           *ls_percpu[0];
213 };
214
215 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
216
217 /* Pack all opcodes down into a single monotonically increasing index */
218 static inline int opcode_offset(__u32 opc) {
219         if (opc < OST_LAST_OPC) {
220                  /* OST opcode */
221                 return (opc - OST_FIRST_OPC);
222         } else if (opc < MDS_LAST_OPC) {
223                 /* MDS opcode */
224                 return (opc - MDS_FIRST_OPC +
225                         OPC_RANGE(OST));
226         } else if (opc < LDLM_LAST_OPC) {
227                 /* LDLM Opcode */
228                 return (opc - LDLM_FIRST_OPC +
229                         OPC_RANGE(MDS) +
230                         OPC_RANGE(OST));
231         } else if (opc < MGS_LAST_OPC) {
232                 /* MGS Opcode */
233                 return (opc - MGS_FIRST_OPC +
234                         OPC_RANGE(LDLM) +
235                         OPC_RANGE(MDS) +
236                         OPC_RANGE(OST));
237         } else if (opc < OBD_LAST_OPC) {
238                 /* OBD Ping */
239                 return (opc - OBD_FIRST_OPC +
240                         OPC_RANGE(MGS) +
241                         OPC_RANGE(LDLM) +
242                         OPC_RANGE(MDS) +
243                         OPC_RANGE(OST));
244         } else if (opc < LLOG_LAST_OPC) {
245                 /* LLOG Opcode */
246                 return (opc - LLOG_FIRST_OPC +
247                         OPC_RANGE(OBD) +
248                         OPC_RANGE(MGS) +
249                         OPC_RANGE(LDLM) +
250                         OPC_RANGE(MDS) +
251                         OPC_RANGE(OST));
252         } else if (opc < QUOTA_LAST_OPC) {
253                 /* LQUOTA Opcode */
254                 return (opc - QUOTA_FIRST_OPC +
255                         OPC_RANGE(LLOG) +
256                         OPC_RANGE(OBD) +
257                         OPC_RANGE(MGS) +
258                         OPC_RANGE(LDLM) +
259                         OPC_RANGE(MDS) +
260                         OPC_RANGE(OST));
261         } else if (opc < SEQ_LAST_OPC) {
262                 /* SEQ opcode */
263                 return (opc - SEQ_FIRST_OPC +
264                         OPC_RANGE(QUOTA) +
265                         OPC_RANGE(LLOG) +
266                         OPC_RANGE(OBD) +
267                         OPC_RANGE(MGS) +
268                         OPC_RANGE(LDLM) +
269                         OPC_RANGE(MDS) +
270                         OPC_RANGE(OST));
271         } else if (opc < SEC_LAST_OPC) {
272                 /* SEC opcode */
273                 return (opc - SEC_FIRST_OPC +
274                         OPC_RANGE(SEQ) +
275                         OPC_RANGE(QUOTA) +
276                         OPC_RANGE(LLOG) +
277                         OPC_RANGE(OBD) +
278                         OPC_RANGE(MGS) +
279                         OPC_RANGE(LDLM) +
280                         OPC_RANGE(MDS) +
281                         OPC_RANGE(OST));
282         } else if (opc < FLD_LAST_OPC) {
283                 /* FLD opcode */
284                  return (opc - FLD_FIRST_OPC +
285                         OPC_RANGE(SEC) +
286                         OPC_RANGE(SEQ) +
287                         OPC_RANGE(QUOTA) +
288                         OPC_RANGE(LLOG) +
289                         OPC_RANGE(OBD) +
290                         OPC_RANGE(MGS) +
291                         OPC_RANGE(LDLM) +
292                         OPC_RANGE(MDS) +
293                         OPC_RANGE(OST));
294 #ifdef HAVE_SERVER_SUPPORT
295         } else if (opc < OUT_UPDATE_LAST_OPC) {
296                 /* update opcode */
297                 return (opc - OUT_UPDATE_FIRST_OPC +
298                         OPC_RANGE(FLD) +
299                         OPC_RANGE(SEC) +
300                         OPC_RANGE(SEQ) +
301                         OPC_RANGE(QUOTA) +
302                         OPC_RANGE(LLOG) +
303                         OPC_RANGE(OBD) +
304                         OPC_RANGE(MGS) +
305                         OPC_RANGE(LDLM) +
306                         OPC_RANGE(MDS) +
307                         OPC_RANGE(OST));
308         } else if (opc < LFSCK_LAST_OPC) {
309                 /* LFSCK opcode */
310                 return (opc - LFSCK_FIRST_OPC +
311                         OPC_RANGE(OUT_UPDATE) +
312                         OPC_RANGE(FLD) +
313                         OPC_RANGE(SEC) +
314                         OPC_RANGE(SEQ) +
315                         OPC_RANGE(QUOTA) +
316                         OPC_RANGE(LLOG) +
317                         OPC_RANGE(OBD) +
318                         OPC_RANGE(MGS) +
319                         OPC_RANGE(LDLM) +
320                         OPC_RANGE(MDS) +
321                         OPC_RANGE(OST));
322 #endif /* HAVE_SERVER_SUPPORT */
323         } else {
324                 /* Unknown Opcode */
325                 return -1;
326         }
327 }
328
329 #define LUSTRE_MAX_OPCODES_CLIENT (OPC_RANGE(OST)  + \
330                                    OPC_RANGE(MDS)  + \
331                                    OPC_RANGE(LDLM) + \
332                                    OPC_RANGE(MGS)  + \
333                                    OPC_RANGE(OBD)  + \
334                                    OPC_RANGE(LLOG) + \
335                                    OPC_RANGE(SEC)  + \
336                                    OPC_RANGE(SEQ)  + \
337                                    OPC_RANGE(SEC)  + \
338                                    OPC_RANGE(FLD))
339
340 #ifdef HAVE_SERVER_SUPPORT
341 #define LUSTRE_MAX_OPCODES (LUSTRE_MAX_OPCODES_CLIENT + \
342                             OPC_RANGE(OUT_UPDATE) + \
343                             OPC_RANGE(LFSCK))
344 #else
345 #define LUSTRE_MAX_OPCODES LUSTRE_MAX_OPCODES_CLIENT
346 #endif
347
348 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR)  + \
349                             OPC_RANGE(EXTRA))
350
351 enum {
352         PTLRPC_REQWAIT_CNTR = 0,
353         PTLRPC_REQQDEPTH_CNTR,
354         PTLRPC_REQACTIVE_CNTR,
355         PTLRPC_TIMEOUT,
356         PTLRPC_REQBUF_AVAIL_CNTR,
357         PTLRPC_LAST_CNTR
358 };
359
360 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
361
362 enum lprocfs_extra_opc {
363         LDLM_GLIMPSE_ENQUEUE = 0,
364         LDLM_PLAIN_ENQUEUE,
365         LDLM_EXTENT_ENQUEUE,
366         LDLM_FLOCK_ENQUEUE,
367         LDLM_IBITS_ENQUEUE,
368         MDS_REINT_SETATTR,
369         MDS_REINT_CREATE,
370         MDS_REINT_LINK,
371         MDS_REINT_UNLINK,
372         MDS_REINT_RENAME,
373         MDS_REINT_OPEN,
374         MDS_REINT_SETXATTR,
375         MDS_REINT_RESYNC,
376         BRW_READ_BYTES,
377         BRW_WRITE_BYTES,
378         EXTRA_LAST_OPC
379 };
380
381 #ifdef HAVE_SERVER_SUPPORT
382 enum brw_rw_stats {
383         BRW_R_PAGES = 0,
384         BRW_W_PAGES,
385         BRW_R_DISCONT_PAGES,
386         BRW_W_DISCONT_PAGES,
387         BRW_R_DISCONT_BLOCKS,
388         BRW_W_DISCONT_BLOCKS,
389         BRW_R_DIO_FRAGS,
390         BRW_W_DIO_FRAGS,
391         BRW_R_RPC_HIST,
392         BRW_W_RPC_HIST,
393         BRW_R_IO_TIME,
394         BRW_W_IO_TIME,
395         BRW_R_DISK_IOSIZE,
396         BRW_W_DISK_IOSIZE,
397         BRW_RW_STATS_NUM,
398 };
399
400 struct brw_stats_props {
401         const char      *bsp_name;
402         const char      *bsp_units;
403         bool             bsp_scale;
404 };
405
406 struct brw_stats {
407         ktime_t                 bs_init;
408         struct obd_hist_pcpu    bs_hist[BRW_RW_STATS_NUM];
409         struct brw_stats_props  bs_props[BRW_RW_STATS_NUM / 2];
410 };
411
412 int lprocfs_init_brw_stats(struct brw_stats *brw_stats);
413 void lprocfs_fini_brw_stats(struct brw_stats *brw_stats);
414
415 void ldebugfs_register_osd_stats(struct dentry *parent,
416                                  struct brw_stats *brw_stats,
417                                  struct lprocfs_stats *stats);
418 #endif /* HAVE_SERVER_SUPPORT */
419
420 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
421 /* class_obd.c */
422 extern struct proc_dir_entry *proc_lustre_root;
423 extern struct dentry *debugfs_lustre_root;
424 extern struct kset *lustre_kset;
425
426 struct obd_device;
427
428 #define JOBSTATS_JOBID_VAR_MAX_LEN      20
429 #define JOBSTATS_DISABLE                "disable"
430 #define JOBSTATS_PROCNAME_UID           "procname_uid"
431 #define JOBSTATS_NODELOCAL              "nodelocal"
432 #define JOBSTATS_SESSION                "session"
433
434 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats,
435                                    unsigned int offset);
436
437 struct obd_job_stats {
438         struct cfs_hash        *ojs_hash;       /* hash of jobids */
439         struct list_head        ojs_list;       /* list of job_stat structs */
440         rwlock_t                ojs_lock;       /* protect ojs_list/js_list */
441         ktime_t                 ojs_cleanup_interval;/* 1/2 expiry seconds */
442         ktime_t                 ojs_cleanup_last;/* previous cleanup time */
443         cntr_init_callback      ojs_cntr_init_fn;/* lprocfs_stats initializer */
444         unsigned short          ojs_cntr_num;   /* number of stats in struct */
445         bool                    ojs_cleaning;   /* currently expiring stats */
446 };
447
448 #ifdef CONFIG_PROC_FS
449
450 int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
451                             unsigned int cpuid);
452 int lprocfs_stats_lock(struct lprocfs_stats *stats,
453                        enum lprocfs_stats_lock_ops opc,
454                        unsigned long *flags);
455 void lprocfs_stats_unlock(struct lprocfs_stats *stats,
456                           enum lprocfs_stats_lock_ops opc,
457                           unsigned long *flags);
458
459 static inline unsigned int
460 lprocfs_stats_counter_size(struct lprocfs_stats *stats)
461 {
462         unsigned int percpusize;
463
464         percpusize = offsetof(struct lprocfs_percpu, lp_cntr[stats->ls_num]);
465
466         /* irq safe stats need lc_array_sum[1] */
467         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
468                 percpusize += stats->ls_num * sizeof(__s64);
469
470         if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
471                 percpusize = L1_CACHE_ALIGN(percpusize);
472
473         return percpusize;
474 }
475
476 static inline struct lprocfs_counter *
477 lprocfs_stats_counter_get(struct lprocfs_stats *stats, unsigned int cpuid,
478                           int index)
479 {
480         struct lprocfs_counter *cntr;
481
482         cntr = &stats->ls_percpu[cpuid]->lp_cntr[index];
483
484         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
485                 cntr = (void *)cntr + index * sizeof(__s64);
486
487         return cntr;
488 }
489
490 /* Two optimized LPROCFS counter increment functions are provided:
491  *     lprocfs_counter_incr(cntr, value) - optimized for by-one counters
492  *     lprocfs_counter_add(cntr) - use for multi-valued counters
493  * Counter data layout allows config flag, counter lock and the
494  * count itself to reside within a single cache line.
495  */
496
497 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
498                                 long amount);
499 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
500                                 long amount);
501
502 #define lprocfs_counter_incr(stats, idx) \
503         lprocfs_counter_add(stats, idx, 1)
504 #define lprocfs_counter_decr(stats, idx) \
505         lprocfs_counter_sub(stats, idx, 1)
506
507 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
508                                  struct lprocfs_counter_header *header,
509                                  enum lprocfs_stats_flags flags,
510                                  enum lprocfs_fields_flags field);
511 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
512                             enum lprocfs_fields_flags field);
513
514 extern struct lprocfs_stats *
515 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
516 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
517 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
518 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
519 extern int lprocfs_alloc_obd_stats(struct obd_device *obd,
520                                    unsigned int num_stats);
521 extern int lprocfs_alloc_md_stats(struct obd_device *obd,
522                                   unsigned int num_private_stats);
523 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
524                                  unsigned conf, const char *name,
525                                  const char *units);
526 extern void lprocfs_free_obd_stats(struct obd_device *obd);
527 extern void lprocfs_free_md_stats(struct obd_device *obd);
528 struct obd_export;
529 struct nid_stat;
530 extern int lprocfs_add_clear_entry(struct obd_device *obd,
531                                    struct proc_dir_entry *entry);
532 #ifdef HAVE_SERVER_SUPPORT
533 extern int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *peer_nid);
534 extern int lprocfs_exp_cleanup(struct obd_export *exp);
535 struct dentry *ldebugfs_add_symlink(const char *name, const char *target,
536                                     const char *format, ...);
537 #else
538 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
539 { return 0; }
540 #endif
541 extern struct proc_dir_entry *
542 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
543                    void *data, const struct proc_ops *ops);
544 extern struct proc_dir_entry *
545 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
546                     const char *format, ...);
547 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
548 #ifdef HAVE_SERVER_SUPPORT
549 extern ssize_t
550 lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
551                                         size_t count, loff_t *off);
552 extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
553 #endif
554 extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
555                                   struct lprocfs_stats *stats);
556 extern const struct file_operations ldebugfs_stats_seq_fops;
557
558 /* lprocfs_status.c */
559 extern void ldebugfs_add_vars(struct dentry *parent, struct ldebugfs_vars *var,
560                               void *data);
561 extern struct dentry *ldebugfs_register(const char *name,
562                                         struct dentry *parent,
563                                         struct ldebugfs_vars *list,
564                                         void *data);
565 extern int lprocfs_add_vars(struct proc_dir_entry *root,
566                             struct lprocfs_vars *var, void *data);
567
568 extern struct proc_dir_entry *
569 lprocfs_register(const char *name, struct proc_dir_entry *parent,
570                  struct lprocfs_vars *list, void *data);
571
572 extern void lprocfs_remove(struct proc_dir_entry **root);
573 extern void lprocfs_remove_proc_entry(const char *name,
574                                       struct proc_dir_entry *parent);
575 extern int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only);
576 extern int lprocfs_obd_cleanup(struct obd_device *obd);
577
578 extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name,
579                               mode_t mode, const struct proc_ops *seq_fops,
580                               void *data);
581 extern int lprocfs_obd_seq_create(struct obd_device *obd, const char *name,
582                                   mode_t mode, const struct proc_ops *seq_fops,
583                                   void *data);
584 extern void lprocfs_stats_header(struct seq_file *seq, ktime_t now,
585                                  ktime_t ts_init, int width, const char *colon,
586                                  bool show_units);
587
588 /* Generic callbacks */
589 extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
590 extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data);
591 ssize_t conn_uuid_show(struct kobject *kobj, struct attribute *attr, char *buf);
592 extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
593 extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
594 extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data);
595 #ifdef HAVE_SERVER_SUPPORT
596 ssize_t num_exports_show(struct kobject *kobj, struct attribute *attr,
597                          char *buf);
598 ssize_t grant_check_threshold_show(struct kobject *kobj,
599                                    struct attribute *attr, char *buf);
600 ssize_t grant_check_threshold_store(struct kobject *kobj,
601                                     struct attribute *attr,
602                                     const char *buffer, size_t count);
603 #endif
604 struct adaptive_timeout;
605 extern int lprocfs_at_hist_helper(struct seq_file *m,
606                                   struct adaptive_timeout *at);
607 extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data);
608 extern ssize_t
609 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
610                            size_t count, loff_t *off);
611 #ifdef HAVE_SERVER_SUPPORT
612 extern ssize_t
613 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
614                                 size_t count, loff_t *off);
615 #endif
616 ssize_t ping_store(struct kobject *kobj, struct attribute *attr,
617                    const char *buffer, size_t count);
618 ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
619                   char *buffer);
620
621 extern ssize_t
622 ldebugfs_import_seq_write(struct file *file, const char __user *buffer,
623                           size_t count, loff_t *off);
624 static inline ssize_t
625 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
626                          size_t count, loff_t *off)
627 {
628         return ldebugfs_import_seq_write(file, buffer, count, off);
629 }
630
631 extern int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data);
632 extern ssize_t
633 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
634                                size_t count, loff_t *off);
635
636 int string_to_size(u64 *size, const char *buffer, size_t count);
637 int sysfs_memparse(const char *buffer, size_t count, u64 *val,
638                     const char *defunit);
639 char *lprocfs_strnstr(const char *s1, const char *s2, size_t len);
640 char *lprocfs_find_named_value(const char *buffer, const char *name,
641                                 size_t *count);
642 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
643 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
644 void lprocfs_oh_clear(struct obd_histogram *oh);
645 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
646
647 void lprocfs_oh_tally_pcpu(struct obd_hist_pcpu *oh, unsigned int value);
648 void lprocfs_oh_tally_log2_pcpu(struct obd_hist_pcpu *oh, unsigned int value);
649 int lprocfs_oh_alloc_pcpu(struct obd_hist_pcpu *oh);
650 void lprocfs_oh_clear_pcpu(struct obd_hist_pcpu *oh);
651 void lprocfs_oh_release_pcpu(struct obd_hist_pcpu *oh);
652 unsigned long lprocfs_oh_sum_pcpu(struct obd_hist_pcpu *oh);
653 unsigned long lprocfs_oh_counter_pcpu(struct obd_hist_pcpu *oh,
654                       unsigned int value);
655
656 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
657                            struct lprocfs_counter *cnt);
658
659 #ifdef HAVE_SERVER_SUPPORT
660 /* lprocfs_status.c: recovery status */
661 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data);
662
663 /* lprocfs_status.c: hash statistics */
664 int lprocfs_hash_seq_show(struct seq_file *m, void *data);
665
666 /* lprocfs_status.c: IR factor */
667 ssize_t ir_factor_show(struct kobject *kobj, struct attribute *attr,
668                        char *buf);
669 ssize_t ir_factor_store(struct kobject *kobj, struct attribute *attr,
670                         const char *buffer, size_t count);
671 #endif
672
673 /* lprocfs_status.c: dump pages on cksum error */
674 int lprocfs_checksum_dump_seq_show(struct seq_file *m, void *data);
675 ssize_t
676 lprocfs_checksum_dump_seq_write(struct file *file, const char __user *buffer,
677                                 size_t count, loff_t *off);
678
679 extern int lprocfs_single_release(struct inode *, struct file *);
680 extern int lprocfs_seq_release(struct inode *, struct file *);
681
682 /* You must use these macros when you want to refer to
683  * the import in a client obd_device for a lprocfs entry
684  * Note that it is not safe to 'goto', 'return' or 'break'
685  * out of the body of this statement.  It *IS* safe to
686  * 'goto' the a label inside the statement, or to 'continue'
687  * to get out of the statement.
688  */
689
690 #define with_imp_locked_nested(__obd, __imp, __rc, __nest)              \
691         for (down_read_nested(&(__obd)->u.cli.cl_sem, __nest),          \
692              __imp = (__obd)->u.cli.cl_import,                          \
693              __rc = __imp ? 0 : -ENODEV;                                \
694              __imp ? 1 : (up_read(&(__obd)->u.cli.cl_sem), 0);          \
695              __imp = NULL)
696
697 #define with_imp_locked(__obd, __imp, __rc)     \
698         with_imp_locked_nested(__obd, __imp, __rc, 0)
699
700 /* write the name##_seq_show function, call LDEBUGFS_SEQ_FOPS_RO for read-only
701  * debugfs entries; otherwise, you will define name##_seq_write function also
702  * for a read-write debugfs entry, and then call LDEBUGFS_SEQ_FOPS instead.
703  * Finally, call debugfs_create_file(filename, 0444, obd, data, &name#_fops);
704  */
705 #define __LDEBUGFS_SEQ_FOPS(name, custom_seq_write)                     \
706 static int name##_single_open(struct inode *inode, struct file *file)   \
707 {                                                                       \
708         return single_open(file, name##_seq_show, inode->i_private);    \
709 }                                                                       \
710 static const struct file_operations name##_fops = {                     \
711         .owner   = THIS_MODULE,                                         \
712         .open    = name##_single_open,                                  \
713         .read    = seq_read,                                            \
714         .write   = custom_seq_write,                                    \
715         .llseek  = seq_lseek,                                           \
716         .release = single_release,                                      \
717 }
718
719 #define LDEBUGFS_SEQ_FOPS_RO(name)      __LDEBUGFS_SEQ_FOPS(name, NULL)
720 #define LDEBUGFS_SEQ_FOPS(name)         __LDEBUGFS_SEQ_FOPS(name, \
721                                                             name##_seq_write)
722
723 #define LDEBUGFS_SEQ_FOPS_RO_TYPE(name, type)                           \
724         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
725         {                                                               \
726                 if (!m->private)                                        \
727                         return -ENODEV;                                 \
728                 return lprocfs_##type##_seq_show(m, m->private);        \
729         }                                                               \
730         LDEBUGFS_SEQ_FOPS_RO(name##_##type)
731
732 #define LDEBUGFS_SEQ_FOPS_RW_TYPE(name, type)                           \
733         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
734         {                                                               \
735                 if (!m->private)                                        \
736                         return -ENODEV;                                 \
737                 return lprocfs_##type##_seq_show(m, m->private);        \
738         }                                                               \
739         static ssize_t name##_##type##_seq_write(struct file *file,     \
740                         const char __user *buffer, size_t count,        \
741                         loff_t *off)                                    \
742         {                                                               \
743                 struct seq_file *seq = file->private_data;              \
744                                                                         \
745                 if (!seq->private)                                      \
746                         return -ENODEV;                                 \
747                 return ldebugfs_##type##_seq_write(file, buffer, count, \
748                                                    seq->private);       \
749         }                                                               \
750         LDEBUGFS_SEQ_FOPS(name##_##type);
751
752 #define LDEBUGFS_FOPS_WR_ONLY(name, type)                               \
753         static ssize_t name##_##type##_write(struct file *file,         \
754                         const char __user *buffer, size_t count,        \
755                         loff_t *off)                                    \
756         {                                                               \
757                 return ldebugfs_##type##_seq_write(file, buffer, count, \
758                                                    off);                \
759         }                                                               \
760         static int name##_##type##_open(struct inode *inode,            \
761                                         struct file *file)              \
762         {                                                               \
763                 return single_open(file, NULL, inode->i_private);       \
764         }                                                               \
765         static const struct file_operations name##_##type##_fops = {    \
766                 .open    = name##_##type##_open,                        \
767                 .write   = name##_##type##_write,                       \
768                 .release = single_release,                              \
769         };
770
771 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
772  * proc entries; otherwise, you will define name##_seq_write function also for
773  * a read-write proc entry, and then call LPROC_SEQ_FOPS instead. Finally,
774  * call ldebugfs_obd_seq_create(obd, filename, 0444, &name#_fops, data);
775  */
776 #define __LPROC_SEQ_FOPS(name, custom_seq_write)                        \
777 static int name##_single_open(struct inode *inode, struct file *file)   \
778 {                                                                       \
779         return single_open(file, name##_seq_show,                       \
780                            inode->i_private ? inode->i_private :        \
781                                               PDE_DATA(inode));         \
782 }                                                                       \
783 static const struct proc_ops name##_fops = {                            \
784         PROC_OWNER(THIS_MODULE)                                         \
785         .proc_open              = name##_single_open,                   \
786         .proc_read              = seq_read,                             \
787         .proc_write             = custom_seq_write,                     \
788         .proc_lseek             = seq_lseek,                            \
789         .proc_release           = lprocfs_single_release,               \
790 }
791
792 #define LPROC_SEQ_FOPS_RO(name)         __LPROC_SEQ_FOPS(name, NULL)
793 #define LPROC_SEQ_FOPS(name)            __LPROC_SEQ_FOPS(name, name##_seq_write)
794
795 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)                              \
796         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
797         {                                                               \
798                 return lprocfs_##type##_seq_show(m, m->private);        \
799         }                                                               \
800         LPROC_SEQ_FOPS_RO(name##_##type)
801
802 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)                              \
803         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
804         {                                                               \
805                 return lprocfs_##type##_seq_show(m, m->private);        \
806         }                                                               \
807         static ssize_t name##_##type##_seq_write(struct file *file,     \
808                         const char __user *buffer, size_t count,        \
809                         loff_t *off)                                    \
810         {                                                               \
811                 struct seq_file *seq = file->private_data;              \
812                 return lprocfs_##type##_seq_write(file, buffer,         \
813                                                   count, seq->private); \
814         }                                                               \
815         LPROC_SEQ_FOPS(name##_##type);
816
817 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)                              \
818         static ssize_t name##_##type##_write(struct file *file,         \
819                         const char __user *buffer, size_t count,        \
820                         loff_t *off)                                    \
821         {                                                               \
822                 return lprocfs_##type##_seq_write(file, buffer, count, off);\
823         }                                                               \
824         static int name##_##type##_open(struct inode *inode, struct file *file)\
825         {                                                               \
826                 return single_open(file, NULL,                          \
827                                    inode->i_private ? inode->i_private : \
828                                    PDE_DATA(inode));                    \
829         }                                                               \
830         static const struct proc_ops name##_##type##_fops = {           \
831                 .proc_open      = name##_##type##_open,                 \
832                 .proc_write     = name##_##type##_write,                \
833                 .proc_release   = lprocfs_single_release,               \
834         };
835
836 struct lustre_attr {
837         struct attribute attr;
838         ssize_t (*show)(struct kobject *kobj, struct attribute *attr,
839                         char *buf);
840         ssize_t (*store)(struct kobject *kobj, struct attribute *attr,
841                          const char *buf, size_t len);
842 };
843
844 #define LUSTRE_ATTR(name, mode, show, store) \
845 static struct lustre_attr lustre_attr_##name = __ATTR(name, mode, show, store)
846
847 #define LUSTRE_WO_ATTR(name) LUSTRE_ATTR(name, 0200, NULL, name##_store)
848 #define LUSTRE_RO_ATTR(name) LUSTRE_ATTR(name, 0444, name##_show, NULL)
849 #define LUSTRE_RW_ATTR(name) LUSTRE_ATTR(name, 0644, name##_show, name##_store)
850
851 ssize_t lustre_attr_show(struct kobject *kobj, struct attribute *attr,
852                          char *buf);
853 ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr,
854                           const char *buf, size_t len);
855
856 extern const struct sysfs_ops lustre_sysfs_ops;
857
858 /* lproc_ptlrpc.c */
859 struct ptlrpc_request;
860 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
861
862 #ifdef HAVE_SERVER_SUPPORT
863 /* lprocfs_jobstats.c */
864 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
865                           int event, long amount);
866 void lprocfs_job_stats_fini(struct obd_device *obd);
867 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
868                            cntr_init_callback fn);
869 ssize_t job_cleanup_interval_show(struct kobject *kobj, struct attribute *attr,
870                                   char *buf);
871 ssize_t job_cleanup_interval_store(struct kobject *kobj,
872                                    struct attribute *attr,
873                                    const char *buffer, size_t count);
874 /* lproc_status_server.c */
875 ssize_t recovery_time_soft_show(struct kobject *kobj, struct attribute *attr,
876                                 char *buf);
877 ssize_t recovery_time_soft_store(struct kobject *kobj,
878                                  struct attribute *attr,
879                                  const char *buffer, size_t count);
880 ssize_t recovery_time_hard_show(struct kobject *kobj, struct attribute *attr,
881                                 char *buf);
882 ssize_t recovery_time_hard_store(struct kobject *kobj,
883                                  struct attribute *attr,
884                                  const char *buffer, size_t count);
885 ssize_t instance_show(struct kobject *kobj, struct attribute *attr,
886                       char *buf);
887 #endif
888 /* lproc_status.c */
889 int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data);
890 ssize_t lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file,
891                                                 const char __user *buffer,
892                                                 size_t count, loff_t *off);
893 ssize_t short_io_bytes_show(struct kobject *kobj, struct attribute *attr,
894                             char *buf);
895 ssize_t short_io_bytes_store(struct kobject *kobj, struct attribute *attr,
896                              const char *buffer, size_t count);
897
898 struct root_squash_info;
899 int lprocfs_wr_root_squash(const char __user *buffer, unsigned long count,
900                            struct root_squash_info *squash, char *name);
901 int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
902                              struct root_squash_info *squash, char *name);
903
904 #else /* !CONFIG_PROC_FS */
905
906 #define proc_lustre_root NULL
907
908 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
909                                        int index, long amount)
910 { return; }
911 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
912                                         int index)
913 { return; }
914 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
915                                        int index, long amount)
916 { return; }
917 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
918                                         int index)
919 { return; }
920 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
921                                         int index, unsigned conf,
922                                         const char *name, const char *units)
923 { return; }
924
925 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
926                                    enum lprocfs_fields_flags field)
927 { return 0; }
928
929 /* NB: we return !NULL to satisfy error checker */
930 static inline struct lprocfs_stats *
931 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
932 { return (struct lprocfs_stats *)1; }
933 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
934 { return; }
935 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
936 { return; }
937 static inline int lprocfs_register_stats(struct proc_dir_entry *root,
938                                          const char *name,
939                                          struct lprocfs_stats *stats)
940 { return 0; }
941 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
942 { return; }
943 static inline int lprocfs_alloc_obd_stats(struct obd_device *obd,
944                                           unsigned int num_stats)
945 { return 0; }
946 static inline int lprocfs_alloc_md_stats(struct obd_device *obd,
947                                          unsigned int num_private_stats)
948 { return 0; }
949 static inline void lprocfs_free_obd_stats(struct obd_device *obd)
950 { return; }
951 static inline void lprocfs_free_md_stats(struct obd_device *obd)
952 { return; }
953
954 struct obd_export;
955 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
956 { return 0; }
957 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
958 { return; }
959 #ifdef HAVE_SERVER_SUPPORT
960 static inline
961 ssize_t lprocfs_nid_stats_seq_write(struct file *file,
962                                     const char __user *buffer,
963                                     size_t count, loff_t *off)
964 {return 0;}
965 static inline
966 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
967 {return 0;}
968 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid)
969 { return 0; }
970 #endif
971 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
972 { return 0; }
973 static inline struct proc_dir_entry *
974 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
975                    void *data, const struct file_operations *fops)
976 {return 0; }
977 static inline struct proc_dir_entry *
978 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
979                     const char *format, ...)
980 {return NULL; }
981 static inline int lprocfs_add_vars(struct proc_dir_entry *root,
982                                    struct lprocfs_vars *var, void *data)
983 { return 0; }
984 static inline struct proc_dir_entry *
985 lprocfs_register(const char *name, struct proc_dir_entry *parent,
986                  struct lprocfs_vars *list, void *data)
987 { return NULL; }
988 static inline void lprocfs_remove(struct proc_dir_entry **root)
989 { return; }
990 static inline void lprocfs_remove_proc_entry(const char *name,
991                                              struct proc_dir_entry *parent)
992 { return; }
993 static inline int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only)
994 { return 0; }
995 static inline int lprocfs_obd_cleanup(struct obd_device *obd)
996 { return 0; }
997 static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
998 { return 0; }
999 static inline int lprocfs_server_seq_show(struct seq_file *m, void *data)
1000 { return 0; }
1001 static inline int lprocfs_import_seq_show(struct seq_file *m, void *data)
1002 { return 0; }
1003 static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)
1004 { return 0; }
1005 static inline int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
1006 { return 0; }
1007 #ifdef HAVE_SERVER_SUPPORT
1008 static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
1009 { return 0; }
1010 #endif
1011 struct adaptive_timeout;
1012 static inline int lprocfs_at_hist_helper(struct seq_file *m,
1013                                          struct adaptive_timeout *at)
1014 { return 0; }
1015 static inline int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
1016 { return 0; }
1017 static inline ssize_t
1018 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
1019                            size_t count, loff_t *off)
1020 { return 0; }
1021 #ifdef HAVE_SERVER_SUPPORT
1022 static inline ssize_t
1023 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
1024                                size_t count, loff_t *off)
1025 { return 0; }
1026 #endif
1027 static inline ssize_t
1028 lprocfs_ping_seq_write(struct file *file, const char __user *buffer,
1029                        size_t count, loff_t *off)
1030 { return 0; }
1031 static inline ssize_t
1032 ldebugfs_import_seq_write(struct file *file, const char __user *buffer,
1033                           size_t count, loff_t *off)
1034 { return 0; }
1035 static inline ssize_t
1036 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
1037                          size_t count, loff_t *off)
1038 { return 0; }
1039 static inline int
1040 lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data)
1041 { return 0; }
1042 static inline ssize_t
1043 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
1044                                size_t count, loff_t *off)
1045 { return 0; }
1046
1047 /* Statfs helpers */
1048 static inline
1049 int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
1050 { return 0; }
1051 static inline
1052 int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
1053 { return 0; }
1054 static inline
1055 int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
1056 { return 0; }
1057 static inline
1058 int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
1059 { return 0; }
1060 static inline
1061 int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
1062 { return 0; }
1063 static inline
1064 int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
1065 { return 0; }
1066 static inline
1067 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
1068 { return; }
1069 static inline
1070 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
1071 { return; }
1072 static inline
1073 void lprocfs_oh_clear(struct obd_histogram *oh)
1074 { return; }
1075 static inline
1076 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1077 { return 0; }
1078 static inline
1079 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1080                            struct lprocfs_counter *cnt)
1081 { return; }
1082 static inline
1083 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1084                             enum lprocfs_fields_flags field)
1085 { return (__u64)0; }
1086
1087 #define LPROC_SEQ_FOPS_RO(name)
1088 #define LPROC_SEQ_FOPS(name)
1089 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)
1090 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)
1091 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)
1092
1093 /* lprocfs_jobstats.c */
1094 static inline
1095 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1096                           long amount)
1097 { return 0; }
1098 static inline
1099 void lprocfs_job_stats_fini(struct obd_device *obd)
1100 { return; }
1101 static inline
1102 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1103                            cntr_init_callback fn)
1104 { return 0; }
1105
1106
1107 /* lproc_ptlrpc.c */
1108 #define target_print_req NULL
1109
1110 #endif /* CONFIG_PROC_FS */
1111
1112 #endif /* LPROCFS_STATUS_H */