Whamcloud - gitweb
LU-17005 obdclass: allow stats header to be disabled
[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  * LPROCFS_CNTR_HISTOGRAM indicates that the counter should track a
131  * exponential histogram.
132  */
133
134 enum lprocfs_counter_config {
135         LPROCFS_CNTR_EXTERNALLOCK       = 0x0001,
136         LPROCFS_CNTR_AVGMINMAX          = 0x0002,
137         LPROCFS_CNTR_STDDEV             = 0x0004,
138         LPROCFS_CNTR_HISTOGRAM          = 0x0008,
139
140         /* counter unit type */
141         LPROCFS_TYPE_REQS               = 0x0000, /* default if config = 0 */
142         LPROCFS_TYPE_BYTES              = 0x0200,
143         LPROCFS_TYPE_PAGES              = 0x0400,
144         LPROCFS_TYPE_LOCKS              = 0x0500,
145         LPROCFS_TYPE_LOCKSPS            = 0x0600,
146         LPROCFS_TYPE_SECS               = 0x0700,
147         LPROCFS_TYPE_USECS              = 0x0800,
148         LPROCFS_TYPE_MASK               = 0x0f00,
149
150         LPROCFS_TYPE_LATENCY            = LPROCFS_TYPE_USECS |
151                                           LPROCFS_CNTR_AVGMINMAX |
152                                           LPROCFS_CNTR_STDDEV,
153         LPROCFS_TYPE_BYTES_FULL         = LPROCFS_TYPE_BYTES |
154                                           LPROCFS_CNTR_AVGMINMAX |
155                                           LPROCFS_CNTR_STDDEV,
156         LPROCFS_TYPE_BYTES_FULL_HISTOGRAM       = LPROCFS_TYPE_BYTES_FULL |
157                                                   LPROCFS_CNTR_HISTOGRAM,
158 };
159 #define LC_MIN_INIT ((~(__u64)0) >> 1)
160
161 struct lprocfs_counter_header {
162         enum lprocfs_counter_config     lc_config;
163         const char                      *lc_name;   /* must be static */
164         const char                      *lc_units;  /* must be static */
165         struct obd_histogram            *lc_hist;
166 };
167
168 struct lprocfs_counter {
169         __s64   lc_count;
170         __s64   lc_min;
171         __s64   lc_max;
172         __s64   lc_sumsquare;
173         /*
174          * Every counter has lc_array_sum[0], while lc_array_sum[1] is only
175          * for irq context counter, i.e. stats with
176          * LPROCFS_STATS_FLAG_IRQ_SAFE flag, its counter need
177          * lc_array_sum[1]
178          */
179         __s64   lc_array_sum[1];
180 };
181 #define lc_sum          lc_array_sum[0]
182 #define lc_sum_irq      lc_array_sum[1]
183
184 struct lprocfs_percpu {
185         struct lprocfs_counter lp_cntr[0];
186 };
187
188 enum lprocfs_stats_lock_ops {
189         LPROCFS_GET_NUM_CPU     = 0x0001, /* number allocated per-CPU stats */
190         LPROCFS_GET_SMP_ID      = 0x0002, /* current stat to be updated */
191 };
192
193 enum lprocfs_stats_flags {
194         LPROCFS_STATS_FLAG_NONE     = 0x0000, /* per cpu counter */
195         LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
196                                                * area and need locking */
197         LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */
198 };
199
200 enum lprocfs_fields_flags {
201         LPROCFS_FIELDS_FLAGS_CONFIG     = 0x0001,
202         LPROCFS_FIELDS_FLAGS_SUM        = 0x0002,
203         LPROCFS_FIELDS_FLAGS_MIN        = 0x0003,
204         LPROCFS_FIELDS_FLAGS_MAX        = 0x0004,
205         LPROCFS_FIELDS_FLAGS_AVG        = 0x0005,
206         LPROCFS_FIELDS_FLAGS_SUMSQUARE  = 0x0006,
207         LPROCFS_FIELDS_FLAGS_COUNT      = 0x0007,
208 };
209
210 struct lprocfs_stats {
211         /* # of counters */
212         unsigned short                  ls_num;
213         /* 1 + the biggest cpu # whose ls_percpu slot has been allocated */
214         unsigned short                  ls_biggest_alloc_num;
215         enum lprocfs_stats_flags        ls_flags;
216         ktime_t                         ls_init;
217         /* Lock used when there are no percpu stats areas; For percpu stats,
218          * it is used to protect ls_biggest_alloc_num change */
219         spinlock_t                      ls_lock;
220
221         /* has ls_num of counter headers */
222         struct lprocfs_counter_header   *ls_cnt_header;
223         struct lprocfs_percpu           *ls_percpu[0];
224 };
225
226 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
227
228 /* Pack all opcodes down into a single monotonically increasing index */
229 static inline int opcode_offset(__u32 opc) {
230         if (opc < OST_LAST_OPC) {
231                  /* OST opcode */
232                 return (opc - OST_FIRST_OPC);
233         } else if (opc < MDS_LAST_OPC) {
234                 /* MDS opcode */
235                 return (opc - MDS_FIRST_OPC +
236                         OPC_RANGE(OST));
237         } else if (opc < LDLM_LAST_OPC) {
238                 /* LDLM Opcode */
239                 return (opc - LDLM_FIRST_OPC +
240                         OPC_RANGE(MDS) +
241                         OPC_RANGE(OST));
242         } else if (opc < MGS_LAST_OPC) {
243                 /* MGS Opcode */
244                 return (opc - MGS_FIRST_OPC +
245                         OPC_RANGE(LDLM) +
246                         OPC_RANGE(MDS) +
247                         OPC_RANGE(OST));
248         } else if (opc < OBD_LAST_OPC) {
249                 /* OBD Ping */
250                 return (opc - OBD_FIRST_OPC +
251                         OPC_RANGE(MGS) +
252                         OPC_RANGE(LDLM) +
253                         OPC_RANGE(MDS) +
254                         OPC_RANGE(OST));
255         } else if (opc < LLOG_LAST_OPC) {
256                 /* LLOG Opcode */
257                 return (opc - LLOG_FIRST_OPC +
258                         OPC_RANGE(OBD) +
259                         OPC_RANGE(MGS) +
260                         OPC_RANGE(LDLM) +
261                         OPC_RANGE(MDS) +
262                         OPC_RANGE(OST));
263         } else if (opc < QUOTA_LAST_OPC) {
264                 /* LQUOTA Opcode */
265                 return (opc - QUOTA_FIRST_OPC +
266                         OPC_RANGE(LLOG) +
267                         OPC_RANGE(OBD) +
268                         OPC_RANGE(MGS) +
269                         OPC_RANGE(LDLM) +
270                         OPC_RANGE(MDS) +
271                         OPC_RANGE(OST));
272         } else if (opc < SEQ_LAST_OPC) {
273                 /* SEQ opcode */
274                 return (opc - SEQ_FIRST_OPC +
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 < SEC_LAST_OPC) {
283                 /* SEC opcode */
284                 return (opc - SEC_FIRST_OPC +
285                         OPC_RANGE(SEQ) +
286                         OPC_RANGE(QUOTA) +
287                         OPC_RANGE(LLOG) +
288                         OPC_RANGE(OBD) +
289                         OPC_RANGE(MGS) +
290                         OPC_RANGE(LDLM) +
291                         OPC_RANGE(MDS) +
292                         OPC_RANGE(OST));
293         } else if (opc < FLD_LAST_OPC) {
294                 /* FLD opcode */
295                  return (opc - FLD_FIRST_OPC +
296                         OPC_RANGE(SEC) +
297                         OPC_RANGE(SEQ) +
298                         OPC_RANGE(QUOTA) +
299                         OPC_RANGE(LLOG) +
300                         OPC_RANGE(OBD) +
301                         OPC_RANGE(MGS) +
302                         OPC_RANGE(LDLM) +
303                         OPC_RANGE(MDS) +
304                         OPC_RANGE(OST));
305 #ifdef HAVE_SERVER_SUPPORT
306         } else if (opc < OUT_UPDATE_LAST_OPC) {
307                 /* update opcode */
308                 return (opc - OUT_UPDATE_FIRST_OPC +
309                         OPC_RANGE(FLD) +
310                         OPC_RANGE(SEC) +
311                         OPC_RANGE(SEQ) +
312                         OPC_RANGE(QUOTA) +
313                         OPC_RANGE(LLOG) +
314                         OPC_RANGE(OBD) +
315                         OPC_RANGE(MGS) +
316                         OPC_RANGE(LDLM) +
317                         OPC_RANGE(MDS) +
318                         OPC_RANGE(OST));
319         } else if (opc < LFSCK_LAST_OPC) {
320                 /* LFSCK opcode */
321                 return (opc - LFSCK_FIRST_OPC +
322                         OPC_RANGE(OUT_UPDATE) +
323                         OPC_RANGE(FLD) +
324                         OPC_RANGE(SEC) +
325                         OPC_RANGE(SEQ) +
326                         OPC_RANGE(QUOTA) +
327                         OPC_RANGE(LLOG) +
328                         OPC_RANGE(OBD) +
329                         OPC_RANGE(MGS) +
330                         OPC_RANGE(LDLM) +
331                         OPC_RANGE(MDS) +
332                         OPC_RANGE(OST));
333 #endif /* HAVE_SERVER_SUPPORT */
334         } else {
335                 /* Unknown Opcode */
336                 return -1;
337         }
338 }
339
340 #define LUSTRE_MAX_OPCODES_CLIENT (OPC_RANGE(OST)  + \
341                                    OPC_RANGE(MDS)  + \
342                                    OPC_RANGE(LDLM) + \
343                                    OPC_RANGE(MGS)  + \
344                                    OPC_RANGE(OBD)  + \
345                                    OPC_RANGE(LLOG) + \
346                                    OPC_RANGE(SEC)  + \
347                                    OPC_RANGE(SEQ)  + \
348                                    OPC_RANGE(SEC)  + \
349                                    OPC_RANGE(FLD))
350
351 #ifdef HAVE_SERVER_SUPPORT
352 #define LUSTRE_MAX_OPCODES (LUSTRE_MAX_OPCODES_CLIENT + \
353                             OPC_RANGE(OUT_UPDATE) + \
354                             OPC_RANGE(LFSCK))
355 #else
356 #define LUSTRE_MAX_OPCODES LUSTRE_MAX_OPCODES_CLIENT
357 #endif
358
359 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR)  + \
360                             OPC_RANGE(EXTRA))
361
362 enum {
363         PTLRPC_REQWAIT_CNTR = 0,
364         PTLRPC_REQQDEPTH_CNTR,
365         PTLRPC_REQACTIVE_CNTR,
366         PTLRPC_TIMEOUT,
367         PTLRPC_REQBUF_AVAIL_CNTR,
368         PTLRPC_LAST_CNTR
369 };
370
371 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
372
373 enum lprocfs_extra_opc {
374         LDLM_GLIMPSE_ENQUEUE = 0,
375         LDLM_PLAIN_ENQUEUE,
376         LDLM_EXTENT_ENQUEUE,
377         LDLM_FLOCK_ENQUEUE,
378         LDLM_IBITS_ENQUEUE,
379         MDS_REINT_SETATTR,
380         MDS_REINT_CREATE,
381         MDS_REINT_LINK,
382         MDS_REINT_UNLINK,
383         MDS_REINT_RENAME,
384         MDS_REINT_OPEN,
385         MDS_REINT_SETXATTR,
386         MDS_REINT_RESYNC,
387         BRW_READ_BYTES,
388         BRW_WRITE_BYTES,
389         EXTRA_LAST_OPC
390 };
391
392 #ifdef HAVE_SERVER_SUPPORT
393 enum brw_rw_stats {
394         BRW_R_PAGES = 0,
395         BRW_W_PAGES,
396         BRW_R_DISCONT_PAGES,
397         BRW_W_DISCONT_PAGES,
398         BRW_R_DISCONT_BLOCKS,
399         BRW_W_DISCONT_BLOCKS,
400         BRW_R_DIO_FRAGS,
401         BRW_W_DIO_FRAGS,
402         BRW_R_RPC_HIST,
403         BRW_W_RPC_HIST,
404         BRW_R_IO_TIME,
405         BRW_W_IO_TIME,
406         BRW_R_DISK_IOSIZE,
407         BRW_W_DISK_IOSIZE,
408         BRW_MAP_TIME,
409         BRW_ALLOC_TIME,
410         BRW_RW_STATS_NUM,
411 };
412
413 struct brw_stats_props {
414         const char      *bsp_name;
415         const char      *bsp_units;
416         bool             bsp_scale;
417 };
418
419 struct brw_stats {
420         ktime_t                 bs_init;
421         struct obd_hist_pcpu    bs_hist[BRW_RW_STATS_NUM];
422         struct brw_stats_props  bs_props[BRW_RW_STATS_NUM / 2];
423 };
424
425 int lprocfs_init_brw_stats(struct brw_stats *brw_stats);
426 void lprocfs_fini_brw_stats(struct brw_stats *brw_stats);
427
428 void ldebugfs_register_osd_stats(struct dentry *parent,
429                                  struct brw_stats *brw_stats,
430                                  struct lprocfs_stats *stats);
431 #endif /* HAVE_SERVER_SUPPORT */
432
433 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
434 /* class_obd.c */
435 extern struct proc_dir_entry *proc_lustre_root;
436 extern struct dentry *debugfs_lustre_root;
437 extern struct kset *lustre_kset;
438
439 struct obd_device;
440
441 #define JOBSTATS_JOBID_VAR_MAX_LEN      20
442 #define JOBSTATS_DISABLE                "disable"
443 #define JOBSTATS_PROCNAME_UID           "procname_uid"
444 #define JOBSTATS_NODELOCAL              "nodelocal"
445 #define JOBSTATS_SESSION                "session"
446
447 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats,
448                                    unsigned int offset,
449                                    enum lprocfs_counter_config cntr_umask);
450 struct obd_job_stats {
451         struct cfs_hash        *ojs_hash;       /* hash of jobids */
452         struct list_head        ojs_list;       /* list of job_stat structs */
453         spinlock_t              ojs_lock;       /* protect ojs_list/js_list */
454         ktime_t                 ojs_cleanup_interval;/* 1/2 expiry seconds */
455         ktime_t                 ojs_cleanup_last;/* previous cleanup time */
456         cntr_init_callback      ojs_cntr_init_fn;/* lprocfs_stats initializer */
457         unsigned short          ojs_cntr_num;   /* number of stats in struct */
458         bool                    ojs_cleaning;   /* currently expiring stats */
459 };
460
461 #ifdef CONFIG_PROC_FS
462
463 int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
464                             unsigned int cpuid);
465 int lprocfs_stats_lock(struct lprocfs_stats *stats,
466                        enum lprocfs_stats_lock_ops opc,
467                        unsigned long *flags);
468 void lprocfs_stats_unlock(struct lprocfs_stats *stats,
469                           enum lprocfs_stats_lock_ops opc,
470                           unsigned long *flags);
471
472 static inline unsigned int
473 lprocfs_stats_counter_size(struct lprocfs_stats *stats)
474 {
475         unsigned int percpusize;
476
477         percpusize = offsetof(struct lprocfs_percpu, lp_cntr[stats->ls_num]);
478
479         /* irq safe stats need lc_array_sum[1] */
480         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
481                 percpusize += stats->ls_num * sizeof(__s64);
482
483         if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
484                 percpusize = L1_CACHE_ALIGN(percpusize);
485
486         return percpusize;
487 }
488
489 static inline struct lprocfs_counter *
490 lprocfs_stats_counter_get(struct lprocfs_stats *stats, unsigned int cpuid,
491                           int index)
492 {
493         struct lprocfs_counter *cntr;
494
495         cntr = &stats->ls_percpu[cpuid]->lp_cntr[index];
496
497         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
498                 cntr = (void *)cntr + index * sizeof(__s64);
499
500         return cntr;
501 }
502
503 /* Two optimized LPROCFS counter increment functions are provided:
504  *     lprocfs_counter_incr(cntr, value) - optimized for by-one counters
505  *     lprocfs_counter_add(cntr) - use for multi-valued counters
506  * Counter data layout allows config flag, counter lock and the
507  * count itself to reside within a single cache line.
508  */
509
510 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
511                                 long amount);
512 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
513                                 long amount);
514
515 #define lprocfs_counter_incr(stats, idx) \
516         lprocfs_counter_add(stats, idx, 1)
517 #define lprocfs_counter_decr(stats, idx) \
518         lprocfs_counter_sub(stats, idx, 1)
519
520 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
521                                  struct lprocfs_counter_header *header,
522                                  enum lprocfs_stats_flags flags,
523                                  enum lprocfs_fields_flags field);
524 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
525                             enum lprocfs_fields_flags field);
526
527 extern struct lprocfs_stats *
528 lprocfs_stats_alloc(unsigned int num, enum lprocfs_stats_flags flags);
529 extern void lprocfs_stats_clear(struct lprocfs_stats *stats);
530 extern void lprocfs_stats_free(struct lprocfs_stats **stats);
531 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
532 extern int lprocfs_alloc_obd_stats(struct obd_device *obd,
533                                    unsigned int num_stats);
534 extern int lprocfs_alloc_md_stats(struct obd_device *obd,
535                                   unsigned int num_private_stats);
536 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
537                                  enum lprocfs_counter_config config,
538                                  const char *name);
539 extern void lprocfs_counter_init_units(struct lprocfs_stats *stats, int index,
540                                        enum lprocfs_counter_config config,
541                                        const char *name, const char *units);
542 extern void lprocfs_free_obd_stats(struct obd_device *obd);
543 extern void lprocfs_free_md_stats(struct obd_device *obd);
544 struct obd_export;
545 struct nid_stat;
546 extern int lprocfs_add_clear_entry(struct obd_device *obd,
547                                    struct proc_dir_entry *entry);
548 #ifdef HAVE_SERVER_SUPPORT
549 extern int lprocfs_exp_setup(struct obd_export *exp, struct lnet_nid *peer_nid);
550 extern int lprocfs_exp_cleanup(struct obd_export *exp);
551 struct dentry *ldebugfs_add_symlink(const char *name, const char *target,
552                                     const char *format, ...);
553 #else
554 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
555 { return 0; }
556 #endif
557 extern struct proc_dir_entry *
558 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
559                    void *data, const struct proc_ops *ops);
560 extern struct proc_dir_entry *
561 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
562                     const char *format, ...);
563 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
564 #ifdef HAVE_SERVER_SUPPORT
565 extern ssize_t
566 lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
567                                         size_t count, loff_t *off);
568 extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
569 #endif
570 extern int lprocfs_stats_register(struct proc_dir_entry *root, const char *name,
571                                   struct lprocfs_stats *stats);
572 extern const struct file_operations ldebugfs_stats_seq_fops;
573
574 /* lprocfs_status.c */
575 extern void ldebugfs_add_vars(struct dentry *parent, struct ldebugfs_vars *var,
576                               void *data);
577 extern struct dentry *ldebugfs_register(const char *name,
578                                         struct dentry *parent,
579                                         struct ldebugfs_vars *list,
580                                         void *data);
581 extern int lprocfs_add_vars(struct proc_dir_entry *root,
582                             struct lprocfs_vars *var, void *data);
583
584 extern struct proc_dir_entry *
585 lprocfs_register(const char *name, struct proc_dir_entry *parent,
586                  struct lprocfs_vars *list, void *data);
587
588 extern void lprocfs_remove(struct proc_dir_entry **root);
589 extern void lprocfs_remove_proc_entry(const char *name,
590                                       struct proc_dir_entry *parent);
591 extern int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only);
592 extern int lprocfs_obd_cleanup(struct obd_device *obd);
593
594 extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name,
595                               mode_t mode, const struct proc_ops *seq_fops,
596                               void *data);
597 extern int lprocfs_obd_seq_create(struct obd_device *obd, const char *name,
598                                   mode_t mode, const struct proc_ops *seq_fops,
599                                   void *data);
600 extern void lprocfs_stats_header(struct seq_file *seq, ktime_t now,
601                                  ktime_t ts_init, int width, const char *colon,
602                                  bool show_units, const char *prefix);
603 extern unsigned int obd_enable_stats_header;
604
605 /* Generic callbacks */
606 extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
607 extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data);
608 ssize_t conn_uuid_show(struct kobject *kobj, struct attribute *attr, char *buf);
609 extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
610 extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
611 extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data);
612 #ifdef HAVE_SERVER_SUPPORT
613 ssize_t num_exports_show(struct kobject *kobj, struct attribute *attr,
614                          char *buf);
615 ssize_t grant_check_threshold_show(struct kobject *kobj,
616                                    struct attribute *attr, char *buf);
617 ssize_t grant_check_threshold_store(struct kobject *kobj,
618                                     struct attribute *attr,
619                                     const char *buffer, size_t count);
620 ssize_t eviction_count_show(struct kobject *kobj, struct attribute *attr,
621                             char *buf);
622 #endif
623 struct adaptive_timeout;
624 extern int lprocfs_at_hist_helper(struct seq_file *m,
625                                   struct adaptive_timeout *at);
626 extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data);
627 extern ssize_t
628 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
629                            size_t count, loff_t *off);
630 #ifdef HAVE_SERVER_SUPPORT
631 extern ssize_t
632 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
633                                 size_t count, loff_t *off);
634 #endif
635 ssize_t ping_store(struct kobject *kobj, struct attribute *attr,
636                    const char *buffer, size_t count);
637 ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
638                   char *buffer);
639
640 extern ssize_t
641 ldebugfs_import_seq_write(struct file *file, const char __user *buffer,
642                           size_t count, loff_t *off);
643 static inline ssize_t
644 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
645                          size_t count, loff_t *off)
646 {
647         return ldebugfs_import_seq_write(file, buffer, count, off);
648 }
649
650 extern int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data);
651 extern ssize_t
652 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
653                                size_t count, loff_t *off);
654
655 int string_to_size(u64 *size, const char *buffer, size_t count);
656 int sysfs_memparse(const char *buffer, size_t count, u64 *val,
657                     const char *defunit);
658 char *lprocfs_strnstr(const char *s1, const char *s2, size_t len);
659 char *lprocfs_find_named_value(const char *buffer, const char *name,
660                                 size_t *count);
661 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
662 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
663 void lprocfs_oh_clear(struct obd_histogram *oh);
664 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
665
666 void lprocfs_oh_tally_pcpu(struct obd_hist_pcpu *oh, unsigned int value);
667 void lprocfs_oh_tally_log2_pcpu(struct obd_hist_pcpu *oh, unsigned int value);
668 int lprocfs_oh_alloc_pcpu(struct obd_hist_pcpu *oh);
669 void lprocfs_oh_clear_pcpu(struct obd_hist_pcpu *oh);
670 void lprocfs_oh_release_pcpu(struct obd_hist_pcpu *oh);
671 unsigned long lprocfs_oh_sum_pcpu(struct obd_hist_pcpu *oh);
672 unsigned long lprocfs_oh_counter_pcpu(struct obd_hist_pcpu *oh,
673                       unsigned int value);
674
675 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
676                            struct lprocfs_counter *cnt);
677
678 #ifdef HAVE_SERVER_SUPPORT
679 /* lprocfs_status.c: recovery status */
680 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data);
681
682 /* lprocfs: display the uuid of stale clients */
683 int lprocfs_recovery_stale_clients_seq_show(struct seq_file *m, void *data);
684
685 /* lprocfs_status.c: hash statistics */
686 int lprocfs_hash_seq_show(struct seq_file *m, void *data);
687
688 /* lprocfs_status.c: IR factor */
689 ssize_t ir_factor_show(struct kobject *kobj, struct attribute *attr,
690                        char *buf);
691 ssize_t ir_factor_store(struct kobject *kobj, struct attribute *attr,
692                         const char *buffer, size_t count);
693 #endif
694
695 /* lprocfs_status.c: dump pages on cksum error */
696 int lprocfs_checksum_dump_seq_show(struct seq_file *m, void *data);
697 ssize_t
698 lprocfs_checksum_dump_seq_write(struct file *file, const char __user *buffer,
699                                 size_t count, loff_t *off);
700
701 extern int lprocfs_single_release(struct inode *, struct file *);
702 extern int lprocfs_seq_release(struct inode *, struct file *);
703
704 /* You must use these macros when you want to refer to
705  * the import in a client obd_device for a lprocfs entry
706  * Note that it is not safe to 'goto', 'return' or 'break'
707  * out of the body of this statement.  It *IS* safe to
708  * 'goto' the a label inside the statement, or to 'continue'
709  * to get out of the statement.
710  */
711
712 #define with_imp_locked_nested(__obd, __imp, __rc, __nest)              \
713         for (down_read_nested(&(__obd)->u.cli.cl_sem, __nest),          \
714              __imp = (__obd)->u.cli.cl_import,                          \
715              __rc = __imp ? 0 : -ENODEV;                                \
716              __imp ? 1 : (up_read(&(__obd)->u.cli.cl_sem), 0);          \
717              __imp = NULL)
718
719 #define with_imp_locked(__obd, __imp, __rc)     \
720         with_imp_locked_nested(__obd, __imp, __rc, 0)
721
722 /* write the name##_seq_show function, call LDEBUGFS_SEQ_FOPS_RO for read-only
723  * debugfs entries; otherwise, you will define name##_seq_write function also
724  * for a read-write debugfs entry, and then call LDEBUGFS_SEQ_FOPS instead.
725  * Finally, call debugfs_create_file(filename, 0444, obd, data, &name#_fops);
726  */
727 #define __LDEBUGFS_SEQ_FOPS(name, custom_seq_write)                     \
728 static int name##_single_open(struct inode *inode, struct file *file)   \
729 {                                                                       \
730         return single_open(file, name##_seq_show, inode->i_private);    \
731 }                                                                       \
732 static const struct file_operations name##_fops = {                     \
733         .owner   = THIS_MODULE,                                         \
734         .open    = name##_single_open,                                  \
735         .read    = seq_read,                                            \
736         .write   = custom_seq_write,                                    \
737         .llseek  = seq_lseek,                                           \
738         .release = single_release,                                      \
739 }
740
741 #define LDEBUGFS_SEQ_FOPS_RO(name)      __LDEBUGFS_SEQ_FOPS(name, NULL)
742 #define LDEBUGFS_SEQ_FOPS(name)         __LDEBUGFS_SEQ_FOPS(name, \
743                                                             name##_seq_write)
744
745 #define LDEBUGFS_SEQ_FOPS_RO_TYPE(name, type)                           \
746         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
747         {                                                               \
748                 if (!m->private)                                        \
749                         return -ENODEV;                                 \
750                 return lprocfs_##type##_seq_show(m, m->private);        \
751         }                                                               \
752         LDEBUGFS_SEQ_FOPS_RO(name##_##type)
753
754 #define LDEBUGFS_SEQ_FOPS_RW_TYPE(name, type)                           \
755         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
756         {                                                               \
757                 if (!m->private)                                        \
758                         return -ENODEV;                                 \
759                 return lprocfs_##type##_seq_show(m, m->private);        \
760         }                                                               \
761         static ssize_t name##_##type##_seq_write(struct file *file,     \
762                         const char __user *buffer, size_t count,        \
763                         loff_t *off)                                    \
764         {                                                               \
765                 struct seq_file *seq = file->private_data;              \
766                                                                         \
767                 if (!seq->private)                                      \
768                         return -ENODEV;                                 \
769                 return ldebugfs_##type##_seq_write(file, buffer, count, \
770                                                    seq->private);       \
771         }                                                               \
772         LDEBUGFS_SEQ_FOPS(name##_##type);
773
774 #define LDEBUGFS_FOPS_WR_ONLY(name, type)                               \
775         static ssize_t name##_##type##_write(struct file *file,         \
776                         const char __user *buffer, size_t count,        \
777                         loff_t *off)                                    \
778         {                                                               \
779                 return ldebugfs_##type##_seq_write(file, buffer, count, \
780                                                    off);                \
781         }                                                               \
782         static int name##_##type##_open(struct inode *inode,            \
783                                         struct file *file)              \
784         {                                                               \
785                 return single_open(file, NULL, inode->i_private);       \
786         }                                                               \
787         static const struct file_operations name##_##type##_fops = {    \
788                 .open    = name##_##type##_open,                        \
789                 .write   = name##_##type##_write,                       \
790                 .release = single_release,                              \
791         };
792
793 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
794  * proc entries; otherwise, you will define name##_seq_write function also for
795  * a read-write proc entry, and then call LPROC_SEQ_FOPS instead. Finally,
796  * call ldebugfs_obd_seq_create(obd, filename, 0444, &name#_fops, data);
797  */
798 #define __LPROC_SEQ_FOPS(name, custom_seq_write)                        \
799 static int name##_single_open(struct inode *inode, struct file *file)   \
800 {                                                                       \
801         return single_open(file, name##_seq_show,                       \
802                            inode->i_private ? inode->i_private :        \
803                                               pde_data(inode));         \
804 }                                                                       \
805 static const struct proc_ops name##_fops = {                            \
806         PROC_OWNER(THIS_MODULE)                                         \
807         .proc_open              = name##_single_open,                   \
808         .proc_read              = seq_read,                             \
809         .proc_write             = custom_seq_write,                     \
810         .proc_lseek             = seq_lseek,                            \
811         .proc_release           = lprocfs_single_release,               \
812 }
813
814 #define LPROC_SEQ_FOPS_RO(name)         __LPROC_SEQ_FOPS(name, NULL)
815 #define LPROC_SEQ_FOPS(name)            __LPROC_SEQ_FOPS(name, name##_seq_write)
816
817 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)                              \
818         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
819         {                                                               \
820                 return lprocfs_##type##_seq_show(m, m->private);        \
821         }                                                               \
822         LPROC_SEQ_FOPS_RO(name##_##type)
823
824 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)                              \
825         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
826         {                                                               \
827                 return lprocfs_##type##_seq_show(m, m->private);        \
828         }                                                               \
829         static ssize_t name##_##type##_seq_write(struct file *file,     \
830                         const char __user *buffer, size_t count,        \
831                         loff_t *off)                                    \
832         {                                                               \
833                 struct seq_file *seq = file->private_data;              \
834                 return lprocfs_##type##_seq_write(file, buffer,         \
835                                                   count, seq->private); \
836         }                                                               \
837         LPROC_SEQ_FOPS(name##_##type);
838
839 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)                              \
840         static ssize_t name##_##type##_write(struct file *file,         \
841                         const char __user *buffer, size_t count,        \
842                         loff_t *off)                                    \
843         {                                                               \
844                 return lprocfs_##type##_seq_write(file, buffer, count, off);\
845         }                                                               \
846         static int name##_##type##_open(struct inode *inode, struct file *file)\
847         {                                                               \
848                 return single_open(file, NULL,                          \
849                                    inode->i_private ? inode->i_private : \
850                                    pde_data(inode));                    \
851         }                                                               \
852         static const struct proc_ops name##_##type##_fops = {           \
853                 .proc_open      = name##_##type##_open,                 \
854                 .proc_write     = name##_##type##_write,                \
855                 .proc_release   = lprocfs_single_release,               \
856         };
857
858 struct lustre_attr {
859         struct attribute attr;
860         ssize_t (*show)(struct kobject *kobj, struct attribute *attr,
861                         char *buf);
862         ssize_t (*store)(struct kobject *kobj, struct attribute *attr,
863                          const char *buf, size_t len);
864 };
865
866 #define LUSTRE_ATTR(name, mode, show, store) \
867 static struct lustre_attr lustre_attr_##name = __ATTR(name, mode, show, store)
868
869 #define LUSTRE_WO_ATTR(name) LUSTRE_ATTR(name, 0200, NULL, name##_store)
870 #define LUSTRE_RO_ATTR(name) LUSTRE_ATTR(name, 0444, name##_show, NULL)
871 #define LUSTRE_RW_ATTR(name) LUSTRE_ATTR(name, 0644, name##_show, name##_store)
872
873 ssize_t lustre_attr_show(struct kobject *kobj, struct attribute *attr,
874                          char *buf);
875 ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr,
876                           const char *buf, size_t len);
877
878 extern const struct sysfs_ops lustre_sysfs_ops;
879
880 /* lproc_ptlrpc.c */
881 struct ptlrpc_request;
882 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
883
884 #ifdef HAVE_SERVER_SUPPORT
885 /* lprocfs_jobstats.c */
886 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
887                           int event, long amount);
888 void lprocfs_job_stats_fini(struct obd_device *obd);
889 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
890                            cntr_init_callback fn);
891 ssize_t job_cleanup_interval_show(struct kobject *kobj, struct attribute *attr,
892                                   char *buf);
893 ssize_t job_cleanup_interval_store(struct kobject *kobj,
894                                    struct attribute *attr,
895                                    const char *buffer, size_t count);
896 /* lproc_status_server.c */
897 ssize_t recovery_time_soft_show(struct kobject *kobj, struct attribute *attr,
898                                 char *buf);
899 ssize_t recovery_time_soft_store(struct kobject *kobj,
900                                  struct attribute *attr,
901                                  const char *buffer, size_t count);
902 ssize_t recovery_time_hard_show(struct kobject *kobj, struct attribute *attr,
903                                 char *buf);
904 ssize_t recovery_time_hard_store(struct kobject *kobj,
905                                  struct attribute *attr,
906                                  const char *buffer, size_t count);
907 ssize_t instance_show(struct kobject *kobj, struct attribute *attr,
908                       char *buf);
909 #endif
910 /* lproc_status.c */
911 int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data);
912 ssize_t lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file,
913                                                 const char __user *buffer,
914                                                 size_t count, loff_t *off);
915 ssize_t short_io_bytes_show(struct kobject *kobj, struct attribute *attr,
916                             char *buf);
917 ssize_t short_io_bytes_store(struct kobject *kobj, struct attribute *attr,
918                              const char *buffer, size_t count);
919
920 struct root_squash_info;
921 int lprocfs_wr_root_squash(const char __user *buffer, unsigned long count,
922                            struct root_squash_info *squash, char *name);
923 int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
924                              struct root_squash_info *squash, char *name);
925
926 #else /* !CONFIG_PROC_FS */
927
928 #define proc_lustre_root NULL
929
930 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
931                                        int index, long amount)
932 { return; }
933 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats, int index)
934 { return; }
935 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
936                                        int index, long amount)
937 { return; }
938 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats, int index)
939 { return; }
940 static inline void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
941                                         enum lprocfs_counter_config config,
942                                         const char *name)
943 { return; }
944 static inline void lprocfs_counter_init_units(struct lprocfs_stats *stats,
945                                 int index, enum lprocfs_counter_config config,
946                                 const char *name, const char *units)
947 { return; }
948
949 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
950                                    enum lprocfs_fields_flags field)
951 { return 0; }
952
953 /* NB: we return !NULL to satisfy error checker */
954 static inline struct lprocfs_stats *
955 lprocfs_stats_alloc(unsigned int num, enum lprocfs_stats_flags flags)
956 { return (struct lprocfs_stats *)1; }
957 static inline void lprocfs_stats_clear(struct lprocfs_stats *stats)
958 { return; }
959 static inline void lprocfs_stats_free(struct lprocfs_stats **stats)
960 { return; }
961 static inline int lprocfs_stats_register(struct proc_dir_entry *root,
962                                          const char *name,
963                                          struct lprocfs_stats *stats)
964 { return 0; }
965 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
966 { return; }
967 static inline int lprocfs_alloc_obd_stats(struct obd_device *obd,
968                                           unsigned int num_stats)
969 { return 0; }
970 static inline int lprocfs_alloc_md_stats(struct obd_device *obd,
971                                          unsigned int num_private_stats)
972 { return 0; }
973 static inline void lprocfs_free_obd_stats(struct obd_device *obd)
974 { return; }
975 static inline void lprocfs_free_md_stats(struct obd_device *obd)
976 { return; }
977
978 struct obd_export;
979 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
980 { return 0; }
981 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
982 { return; }
983 #ifdef HAVE_SERVER_SUPPORT
984 static inline
985 ssize_t lprocfs_nid_stats_seq_write(struct file *file,
986                                     const char __user *buffer,
987                                     size_t count, loff_t *off)
988 {return 0;}
989 static inline
990 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
991 {return 0;}
992 static inline int lprocfs_exp_setup(struct obd_export *exp,
993                                     struct lnet_nid *peer_nid)
994 { return 0; }
995 #endif
996 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
997 { return 0; }
998 static inline struct proc_dir_entry *
999 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
1000                    void *data, const struct file_operations *fops)
1001 {return 0; }
1002 static inline struct proc_dir_entry *
1003 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
1004                     const char *format, ...)
1005 {return NULL; }
1006 static inline int lprocfs_add_vars(struct proc_dir_entry *root,
1007                                    struct lprocfs_vars *var, void *data)
1008 { return 0; }
1009 static inline struct proc_dir_entry *
1010 lprocfs_register(const char *name, struct proc_dir_entry *parent,
1011                  struct lprocfs_vars *list, void *data)
1012 { return NULL; }
1013 static inline void lprocfs_remove(struct proc_dir_entry **root)
1014 { return; }
1015 static inline void lprocfs_remove_proc_entry(const char *name,
1016                                              struct proc_dir_entry *parent)
1017 { return; }
1018 static inline int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only)
1019 { return 0; }
1020 static inline int lprocfs_obd_cleanup(struct obd_device *obd)
1021 { return 0; }
1022 static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
1023 { return 0; }
1024 static inline int lprocfs_server_seq_show(struct seq_file *m, void *data)
1025 { return 0; }
1026 static inline int lprocfs_import_seq_show(struct seq_file *m, void *data)
1027 { return 0; }
1028 static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)
1029 { return 0; }
1030 static inline int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
1031 { return 0; }
1032 #ifdef HAVE_SERVER_SUPPORT
1033 static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
1034 { return 0; }
1035 #endif
1036 struct adaptive_timeout;
1037 static inline int lprocfs_at_hist_helper(struct seq_file *m,
1038                                          struct adaptive_timeout *at)
1039 { return 0; }
1040 static inline int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
1041 { return 0; }
1042 static inline ssize_t
1043 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
1044                            size_t count, loff_t *off)
1045 { return 0; }
1046 #ifdef HAVE_SERVER_SUPPORT
1047 static inline ssize_t
1048 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
1049                                size_t count, loff_t *off)
1050 { return 0; }
1051 #endif
1052 static inline ssize_t
1053 lprocfs_ping_seq_write(struct file *file, const char __user *buffer,
1054                        size_t count, loff_t *off)
1055 { return 0; }
1056 static inline ssize_t
1057 ldebugfs_import_seq_write(struct file *file, const char __user *buffer,
1058                           size_t count, loff_t *off)
1059 { return 0; }
1060 static inline ssize_t
1061 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
1062                          size_t count, loff_t *off)
1063 { return 0; }
1064 static inline int
1065 lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data)
1066 { return 0; }
1067 static inline ssize_t
1068 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
1069                                size_t count, loff_t *off)
1070 { return 0; }
1071
1072 /* Statfs helpers */
1073 static inline
1074 int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
1075 { return 0; }
1076 static inline
1077 int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
1078 { return 0; }
1079 static inline
1080 int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
1081 { return 0; }
1082 static inline
1083 int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
1084 { return 0; }
1085 static inline
1086 int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
1087 { return 0; }
1088 static inline
1089 int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
1090 { return 0; }
1091 static inline
1092 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
1093 { return; }
1094 static inline
1095 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
1096 { return; }
1097 static inline
1098 void lprocfs_oh_clear(struct obd_histogram *oh)
1099 { return; }
1100 static inline
1101 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1102 { return 0; }
1103 static inline
1104 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1105                            struct lprocfs_counter *cnt)
1106 { return; }
1107 static inline
1108 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1109                             enum lprocfs_fields_flags field)
1110 { return (__u64)0; }
1111
1112 #define LPROC_SEQ_FOPS_RO(name)
1113 #define LPROC_SEQ_FOPS(name)
1114 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)
1115 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)
1116 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)
1117
1118 /* lprocfs_jobstats.c */
1119 static inline
1120 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1121                           long amount)
1122 { return 0; }
1123 static inline
1124 void lprocfs_job_stats_fini(struct obd_device *obd)
1125 { return; }
1126 static inline
1127 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1128                            cntr_init_callback fn)
1129 { return 0; }
1130
1131
1132 /* lproc_ptlrpc.c */
1133 #define target_print_req NULL
1134
1135 #endif /* CONFIG_PROC_FS */
1136
1137 #endif /* LPROCFS_STATUS_H */