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