Whamcloud - gitweb
95a5492779889bd39fb0e34d703985cc40bfb922
[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, /* need locking(no percpu area) */
196         LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */
197 };
198
199 enum lprocfs_fields_flags {
200         LPROCFS_FIELDS_FLAGS_CONFIG     = 0x0001,
201         LPROCFS_FIELDS_FLAGS_SUM        = 0x0002,
202         LPROCFS_FIELDS_FLAGS_MIN        = 0x0003,
203         LPROCFS_FIELDS_FLAGS_MAX        = 0x0004,
204         LPROCFS_FIELDS_FLAGS_AVG        = 0x0005,
205         LPROCFS_FIELDS_FLAGS_SUMSQUARE  = 0x0006,
206         LPROCFS_FIELDS_FLAGS_COUNT      = 0x0007,
207 };
208
209 struct lprocfs_stats {
210         /* # of counters */
211         unsigned short                  ls_num;
212         /* 1 + the biggest cpu # whose ls_percpu slot has been allocated */
213         unsigned short                  ls_biggest_alloc_num;
214         enum lprocfs_stats_flags        ls_flags;
215         ktime_t                         ls_init;
216         /* Lock used when there are no percpu stats areas; For percpu stats,
217          * it is used to protect ls_biggest_alloc_num change
218          */
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 {
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_MAP_TIME,
410         BRW_ALLOC_TIME,
411         BRW_RW_STATS_NUM,
412 };
413
414 struct brw_stats_props {
415         const char      *bsp_name;
416         const char      *bsp_units;
417         bool             bsp_scale;
418 };
419
420 struct brw_stats {
421         ktime_t                 bs_init;
422         struct obd_hist_pcpu    bs_hist[BRW_RW_STATS_NUM];
423         struct brw_stats_props  bs_props[BRW_RW_STATS_NUM / 2];
424 };
425
426 int lprocfs_init_brw_stats(struct brw_stats *brw_stats);
427 void lprocfs_fini_brw_stats(struct brw_stats *brw_stats);
428
429 void ldebugfs_register_osd_stats(struct dentry *parent,
430                                  struct brw_stats *brw_stats,
431                                  struct lprocfs_stats *stats);
432 #endif /* HAVE_SERVER_SUPPORT */
433
434 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
435 /* class_obd.c */
436 extern struct proc_dir_entry *proc_lustre_root;
437 extern struct dentry *debugfs_lustre_root;
438 extern struct kset *lustre_kset;
439
440 struct obd_device;
441
442 #define JOBSTATS_JOBID_VAR_MAX_LEN      20
443 #define JOBSTATS_DISABLE                "disable"
444 #define JOBSTATS_PROCNAME_UID           "procname_uid"
445 #define JOBSTATS_NODELOCAL              "nodelocal"
446 #define JOBSTATS_SESSION                "session"
447
448 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats,
449                                    unsigned int offset,
450                                    enum lprocfs_counter_config cntr_umask);
451 struct obd_job_stats {
452         struct cfs_hash        *ojs_hash;       /* hash of jobids */
453         struct list_head        ojs_list;       /* list of job_stat structs */
454         spinlock_t              ojs_lock;       /* protect ojs_list/js_list */
455         ktime_t                 ojs_cleanup_interval;/* 1/2 expiry seconds */
456         ktime_t                 ojs_cleanup_last;/* previous cleanup time */
457         cntr_init_callback      ojs_cntr_init_fn;/* lprocfs_stats initializer */
458         unsigned short          ojs_cntr_num;   /* number of stats in struct */
459         bool                    ojs_cleaning;   /* currently expiring stats */
460 };
461
462 #ifdef CONFIG_PROC_FS
463
464 int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
465                             unsigned int cpuid);
466 int lprocfs_stats_lock(struct lprocfs_stats *stats,
467                        enum lprocfs_stats_lock_ops opc,
468                        unsigned long *flags);
469 void lprocfs_stats_unlock(struct lprocfs_stats *stats,
470                           enum lprocfs_stats_lock_ops opc,
471                           unsigned long *flags);
472
473 static inline unsigned int
474 lprocfs_stats_counter_size(struct lprocfs_stats *stats)
475 {
476         unsigned int percpusize;
477
478         percpusize = offsetof(struct lprocfs_percpu, lp_cntr[stats->ls_num]);
479
480         /* irq safe stats need lc_array_sum[1] */
481         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
482                 percpusize += stats->ls_num * sizeof(__s64);
483
484         if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
485                 percpusize = L1_CACHE_ALIGN(percpusize);
486
487         return percpusize;
488 }
489
490 static inline struct lprocfs_counter *
491 lprocfs_stats_counter_get(struct lprocfs_stats *stats, unsigned int cpuid,
492                           int index)
493 {
494         struct lprocfs_counter *cntr;
495
496         cntr = &stats->ls_percpu[cpuid]->lp_cntr[index];
497
498         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
499                 cntr = (void *)cntr + index * sizeof(__s64);
500
501         return cntr;
502 }
503
504 /* Two optimized LPROCFS counter increment functions are provided:
505  *     lprocfs_counter_incr(cntr, value) - optimized for by-one counters
506  *     lprocfs_counter_add(cntr) - use for multi-valued counters
507  * Counter data layout allows config flag, counter lock and the
508  * count itself to reside within a single cache line.
509  */
510
511 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
512                                 long amount);
513 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
514                                 long amount);
515
516 #define lprocfs_counter_incr(stats, idx) \
517         lprocfs_counter_add(stats, idx, 1)
518 #define lprocfs_counter_decr(stats, idx) \
519         lprocfs_counter_sub(stats, idx, 1)
520
521 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
522                                  struct lprocfs_counter_header *header,
523                                  enum lprocfs_stats_flags flags,
524                                  enum lprocfs_fields_flags field);
525 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
526                             enum lprocfs_fields_flags field);
527
528 extern struct lprocfs_stats *
529 lprocfs_stats_alloc(unsigned int num, enum lprocfs_stats_flags flags);
530 extern void lprocfs_stats_clear(struct lprocfs_stats *stats);
531 extern void lprocfs_stats_free(struct lprocfs_stats **stats);
532 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
533 extern int lprocfs_alloc_obd_stats(struct obd_device *obd,
534                                    unsigned int num_stats);
535 extern int lprocfs_alloc_md_stats(struct obd_device *obd,
536                                   unsigned int num_private_stats);
537 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
538                                  enum lprocfs_counter_config config,
539                                  const char *name);
540 extern void lprocfs_counter_init_units(struct lprocfs_stats *stats, int index,
541                                        enum lprocfs_counter_config config,
542                                        const char *name, const char *units);
543 extern void lprocfs_free_obd_stats(struct obd_device *obd);
544 extern void lprocfs_free_md_stats(struct obd_device *obd);
545 struct obd_export;
546 struct nid_stat;
547 extern int lprocfs_add_clear_entry(struct obd_device *obd,
548                                    struct proc_dir_entry *entry);
549 #ifdef HAVE_SERVER_SUPPORT
550 extern int lprocfs_exp_setup(struct obd_export *exp, struct lnet_nid *peer_nid);
551 extern int lprocfs_exp_cleanup(struct obd_export *exp);
552 struct dentry *ldebugfs_add_symlink(const char *name, const char *target,
553                                     const char *format, ...);
554 #else
555 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
556 { return 0; }
557 #endif
558 extern struct proc_dir_entry *
559 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
560                    void *data, const struct proc_ops *ops);
561 extern struct proc_dir_entry *
562 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
563                     const char *format, ...);
564 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
565 #ifdef HAVE_SERVER_SUPPORT
566 extern ssize_t
567 lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
568                                         size_t count, loff_t *off);
569 extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
570 #endif
571 extern int lprocfs_stats_register(struct proc_dir_entry *root, const char *name,
572                                   struct lprocfs_stats *stats);
573 extern const struct file_operations ldebugfs_stats_seq_fops;
574
575 /* lprocfs_status.c */
576 extern void ldebugfs_add_vars(struct dentry *parent, struct ldebugfs_vars *var,
577                               void *data);
578 extern struct dentry *ldebugfs_register(const char *name,
579                                         struct dentry *parent,
580                                         struct ldebugfs_vars *list,
581                                         void *data);
582 extern int lprocfs_add_vars(struct proc_dir_entry *root,
583                             struct lprocfs_vars *var, void *data);
584
585 extern struct proc_dir_entry *
586 lprocfs_register(const char *name, struct proc_dir_entry *parent,
587                  struct lprocfs_vars *list, void *data);
588
589 extern void lprocfs_remove(struct proc_dir_entry **root);
590 extern void lprocfs_remove_proc_entry(const char *name,
591                                       struct proc_dir_entry *parent);
592 extern int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only);
593 extern int lprocfs_obd_cleanup(struct obd_device *obd);
594
595 extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name,
596                               mode_t mode, const struct proc_ops *seq_fops,
597                               void *data);
598 extern int lprocfs_obd_seq_create(struct obd_device *obd, const char *name,
599                                   mode_t mode, const struct proc_ops *seq_fops,
600                                   void *data);
601 extern void lprocfs_stats_header(struct seq_file *seq, ktime_t now,
602                                  ktime_t ts_init, int width, const char *colon,
603                                  bool show_units, const char *prefix);
604 extern unsigned int obd_enable_stats_header;
605
606 /* Generic callbacks */
607 extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
608 extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data);
609 ssize_t conn_uuid_show(struct kobject *kobj, struct attribute *attr, char *buf);
610 extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
611 extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
612 extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data);
613 #ifdef HAVE_SERVER_SUPPORT
614 ssize_t num_exports_show(struct kobject *kobj, struct attribute *attr,
615                          char *buf);
616 ssize_t grant_check_threshold_show(struct kobject *kobj,
617                                    struct attribute *attr, char *buf);
618 ssize_t grant_check_threshold_store(struct kobject *kobj,
619                                     struct attribute *attr,
620                                     const char *buffer, size_t count);
621 ssize_t eviction_count_show(struct kobject *kobj, struct attribute *attr,
622                             char *buf);
623 #endif
624 struct adaptive_timeout;
625 extern int lprocfs_at_hist_helper(struct seq_file *m,
626                                   struct adaptive_timeout *at);
627 extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data);
628 extern ssize_t
629 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
630                            size_t count, loff_t *off);
631 #ifdef HAVE_SERVER_SUPPORT
632 extern ssize_t
633 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
634                                 size_t count, loff_t *off);
635 #endif
636 ssize_t ping_store(struct kobject *kobj, struct attribute *attr,
637                    const char *buffer, size_t count);
638 ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
639                   char *buffer);
640
641 extern ssize_t
642 ldebugfs_import_seq_write(struct file *file, const char __user *buffer,
643                           size_t count, loff_t *off);
644 static inline ssize_t
645 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
646                          size_t count, loff_t *off)
647 {
648         return ldebugfs_import_seq_write(file, buffer, count, off);
649 }
650
651 extern int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data);
652 extern ssize_t
653 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
654                                size_t count, loff_t *off);
655
656 int string_to_size(u64 *size, const char *buffer, size_t count);
657 int sysfs_memparse(const char *buffer, size_t count, u64 *val,
658                     const char *defunit);
659 char *lprocfs_strnstr(const char *s1, const char *s2, size_t len);
660 char *lprocfs_find_named_value(const char *buffer, const char *name,
661                                 size_t *count);
662 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
663 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
664 void lprocfs_oh_clear(struct obd_histogram *oh);
665 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
666
667 void lprocfs_oh_tally_pcpu(struct obd_hist_pcpu *oh, unsigned int value);
668 void lprocfs_oh_tally_log2_pcpu(struct obd_hist_pcpu *oh, unsigned int value);
669 int lprocfs_oh_alloc_pcpu(struct obd_hist_pcpu *oh);
670 void lprocfs_oh_clear_pcpu(struct obd_hist_pcpu *oh);
671 void lprocfs_oh_release_pcpu(struct obd_hist_pcpu *oh);
672 unsigned long lprocfs_oh_sum_pcpu(struct obd_hist_pcpu *oh);
673 unsigned long lprocfs_oh_counter_pcpu(struct obd_hist_pcpu *oh,
674                       unsigned int value);
675
676 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
677                            struct lprocfs_counter *cnt);
678
679 #ifdef HAVE_SERVER_SUPPORT
680 /* lprocfs_status.c: recovery status */
681 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data);
682
683 /* lprocfs: display the uuid of stale clients */
684 int lprocfs_recovery_stale_clients_seq_show(struct seq_file *m, void *data);
685
686 /* lprocfs_status.c: hash statistics */
687 int lprocfs_hash_seq_show(struct seq_file *m, void *data);
688
689 /* lprocfs_status.c: IR factor */
690 ssize_t ir_factor_show(struct kobject *kobj, struct attribute *attr,
691                        char *buf);
692 ssize_t ir_factor_store(struct kobject *kobj, struct attribute *attr,
693                         const char *buffer, size_t count);
694 #endif
695
696 /* lprocfs_status.c: dump pages on cksum error */
697 int lprocfs_checksum_dump_seq_show(struct seq_file *m, void *data);
698 ssize_t
699 lprocfs_checksum_dump_seq_write(struct file *file, const char __user *buffer,
700                                 size_t count, loff_t *off);
701
702 extern int lprocfs_single_release(struct inode *i, struct file *f);
703 extern int lprocfs_seq_release(struct inode *i, struct file *f);
704
705 /* You must use these macros when you want to refer to
706  * the import in a client obd_device for a lprocfs entry
707  * Note that it is not safe to 'goto', 'return' or 'break'
708  * out of the body of this statement.  It *IS* safe to
709  * 'goto' the a label inside the statement, or to 'continue'
710  * to get out of the statement.
711  */
712
713 #define with_imp_locked_nested(__obd, __imp, __rc, __nest)              \
714         for (down_read_nested(&(__obd)->u.cli.cl_sem, __nest),          \
715              __imp = (__obd)->u.cli.cl_import,                          \
716              __rc = __imp ? 0 : -ENODEV;                                \
717              __imp ? 1 : (up_read(&(__obd)->u.cli.cl_sem), 0);          \
718              __imp = NULL)
719
720 #define with_imp_locked(__obd, __imp, __rc)     \
721         with_imp_locked_nested(__obd, __imp, __rc, 0)
722
723 /* write the name##_seq_show function, call LDEBUGFS_SEQ_FOPS_RO for read-only
724  * debugfs entries; otherwise, you will define name##_seq_write function also
725  * for a read-write debugfs entry, and then call LDEBUGFS_SEQ_FOPS instead.
726  * Finally, call debugfs_create_file(filename, 0444, obd, data, &name#_fops);
727  */
728 #define __LDEBUGFS_SEQ_FOPS(name, custom_seq_write)                     \
729 static int name##_single_open(struct inode *inode, struct file *file)   \
730 {                                                                       \
731         return single_open(file, name##_seq_show, inode->i_private);    \
732 }                                                                       \
733 static const struct file_operations name##_fops = {                     \
734         .owner   = THIS_MODULE,                                         \
735         .open    = name##_single_open,                                  \
736         .read    = seq_read,                                            \
737         .write   = custom_seq_write,                                    \
738         .llseek  = seq_lseek,                                           \
739         .release = single_release,                                      \
740 }
741
742 #define LDEBUGFS_SEQ_FOPS_RO(name)      __LDEBUGFS_SEQ_FOPS(name, NULL)
743 #define LDEBUGFS_SEQ_FOPS(name)         __LDEBUGFS_SEQ_FOPS(name, \
744                                                             name##_seq_write)
745
746 #define LDEBUGFS_SEQ_FOPS_RO_TYPE(name, type)                           \
747         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
748         {                                                               \
749                 if (!m->private)                                        \
750                         return -ENODEV;                                 \
751                 return lprocfs_##type##_seq_show(m, m->private);        \
752         }                                                               \
753         LDEBUGFS_SEQ_FOPS_RO(name##_##type)
754
755 #define LDEBUGFS_SEQ_FOPS_RW_TYPE(name, type)                           \
756         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
757         {                                                               \
758                 if (!m->private)                                        \
759                         return -ENODEV;                                 \
760                 return lprocfs_##type##_seq_show(m, m->private);        \
761         }                                                               \
762         static ssize_t name##_##type##_seq_write(struct file *file,     \
763                         const char __user *buffer, size_t count,        \
764                         loff_t *off)                                    \
765         {                                                               \
766                 struct seq_file *seq = file->private_data;              \
767                                                                         \
768                 if (!seq->private)                                      \
769                         return -ENODEV;                                 \
770                 return ldebugfs_##type##_seq_write(file, buffer, count, \
771                                                    seq->private);       \
772         }                                                               \
773         LDEBUGFS_SEQ_FOPS(name##_##type);
774
775 #define LDEBUGFS_FOPS_WR_ONLY(name, type)                               \
776         static ssize_t name##_##type##_write(struct file *file,         \
777                         const char __user *buffer, size_t count,        \
778                         loff_t *off)                                    \
779         {                                                               \
780                 return ldebugfs_##type##_seq_write(file, buffer, count, \
781                                                    off);                \
782         }                                                               \
783         static int name##_##type##_open(struct inode *inode,            \
784                                         struct file *file)              \
785         {                                                               \
786                 return single_open(file, NULL, inode->i_private);       \
787         }                                                               \
788         static const struct file_operations name##_##type##_fops = {    \
789                 .open    = name##_##type##_open,                        \
790                 .write   = name##_##type##_write,                       \
791                 .release = single_release,                              \
792         };
793
794 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
795  * proc entries; otherwise, you will define name##_seq_write function also for
796  * a read-write proc entry, and then call LPROC_SEQ_FOPS instead. Finally,
797  * call ldebugfs_obd_seq_create(obd, filename, 0444, &name#_fops, data);
798  */
799 #define __LPROC_SEQ_FOPS(name, custom_seq_write)                        \
800 static int name##_single_open(struct inode *inode, struct file *file)   \
801 {                                                                       \
802         return single_open(file, name##_seq_show,                       \
803                            inode->i_private ? inode->i_private :        \
804                                               pde_data(inode));         \
805 }                                                                       \
806 static const struct proc_ops name##_fops = {                            \
807         PROC_OWNER(THIS_MODULE)                                         \
808         .proc_open              = name##_single_open,                   \
809         .proc_read              = seq_read,                             \
810         .proc_write             = custom_seq_write,                     \
811         .proc_lseek             = seq_lseek,                            \
812         .proc_release           = lprocfs_single_release,               \
813 }
814
815 #define LPROC_SEQ_FOPS_RO(name)         __LPROC_SEQ_FOPS(name, NULL)
816 #define LPROC_SEQ_FOPS(name)            __LPROC_SEQ_FOPS(name, name##_seq_write)
817
818 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)                              \
819         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
820         {                                                               \
821                 return lprocfs_##type##_seq_show(m, m->private);        \
822         }                                                               \
823         LPROC_SEQ_FOPS_RO(name##_##type)
824
825 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)                              \
826         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
827         {                                                               \
828                 return lprocfs_##type##_seq_show(m, m->private);        \
829         }                                                               \
830         static ssize_t name##_##type##_seq_write(struct file *file,     \
831                         const char __user *buffer, size_t count,        \
832                         loff_t *off)                                    \
833         {                                                               \
834                 struct seq_file *seq = file->private_data;              \
835                 return lprocfs_##type##_seq_write(file, buffer,         \
836                                                   count, seq->private); \
837         }                                                               \
838         LPROC_SEQ_FOPS(name##_##type);
839
840 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)                              \
841         static ssize_t name##_##type##_write(struct file *file,         \
842                         const char __user *buffer, size_t count,        \
843                         loff_t *off)                                    \
844         {                                                               \
845                 return lprocfs_##type##_seq_write(file, buffer, count, off);\
846         }                                                               \
847         static int name##_##type##_open(struct inode *inode, struct file *file)\
848         {                                                               \
849                 return single_open(file, NULL,                          \
850                                    inode->i_private ? inode->i_private : \
851                                    pde_data(inode));                    \
852         }                                                               \
853         static const struct proc_ops name##_##type##_fops = {           \
854                 .proc_open      = name##_##type##_open,                 \
855                 .proc_write     = name##_##type##_write,                \
856                 .proc_release   = lprocfs_single_release,               \
857         };
858
859 struct lustre_attr {
860         struct attribute attr;
861         ssize_t (*show)(struct kobject *kobj, struct attribute *attr,
862                         char *buf);
863         ssize_t (*store)(struct kobject *kobj, struct attribute *attr,
864                          const char *buf, size_t len);
865 };
866
867 #define LUSTRE_ATTR(name, mode, show, store) \
868 static struct lustre_attr lustre_attr_##name = __ATTR(name, mode, show, store)
869
870 #define LUSTRE_WO_ATTR(name) LUSTRE_ATTR(name, 0200, NULL, name##_store)
871 #define LUSTRE_RO_ATTR(name) LUSTRE_ATTR(name, 0444, name##_show, NULL)
872 #define LUSTRE_RW_ATTR(name) LUSTRE_ATTR(name, 0644, name##_show, name##_store)
873
874 ssize_t lustre_attr_show(struct kobject *kobj, struct attribute *attr,
875                          char *buf);
876 ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr,
877                           const char *buf, size_t len);
878
879 extern const struct sysfs_ops lustre_sysfs_ops;
880
881 #define LUSTRE_OBD_UINT_PARAM_ATTR(name)\
882 static ssize_t name##_show(struct kobject *kobj, struct attribute *attr,\
883                            char *buf)                                   \
884 {                                                                       \
885         int rc;                                                         \
886         struct obd_device *obd =                                        \
887                 container_of(kobj, struct obd_device, obd_kset.kobj);   \
888         rc = snprintf(buf, PAGE_SIZE, "%u\n", obd->obd_##name); \
889         return rc;                                                      \
890 }                                                                       \
891 static ssize_t name##_store(struct kobject *kobj, struct attribute *attr,\
892                             const char *buffer, size_t count)           \
893 {                                                                       \
894         int rc;                                                         \
895         unsigned int val;                                               \
896         struct obd_device *obd =                                        \
897                 container_of(kobj, struct obd_device, obd_kset.kobj);   \
898         rc = kstrtouint(buffer, 10, &val);                              \
899         if (rc)                                                         \
900                 return rc;                                              \
901         obd->obd_##name = val;                                          \
902         return count;                                                   \
903 }                                                                       \
904 LUSTRE_RW_ATTR(name)
905
906 /* lproc_ptlrpc.c */
907 struct ptlrpc_request;
908 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
909
910 #ifdef HAVE_SERVER_SUPPORT
911 /* lprocfs_jobstats.c */
912 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
913                           int event, long amount);
914 void lprocfs_job_stats_fini(struct obd_device *obd);
915 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
916                            cntr_init_callback fn);
917 ssize_t job_cleanup_interval_show(struct kobject *kobj, struct attribute *attr,
918                                   char *buf);
919 ssize_t job_cleanup_interval_store(struct kobject *kobj,
920                                    struct attribute *attr,
921                                    const char *buffer, size_t count);
922 /* lproc_status_server.c */
923 ssize_t recovery_time_soft_show(struct kobject *kobj, struct attribute *attr,
924                                 char *buf);
925 ssize_t recovery_time_soft_store(struct kobject *kobj,
926                                  struct attribute *attr,
927                                  const char *buffer, size_t count);
928 ssize_t recovery_time_hard_show(struct kobject *kobj, struct attribute *attr,
929                                 char *buf);
930 ssize_t recovery_time_hard_store(struct kobject *kobj,
931                                  struct attribute *attr,
932                                  const char *buffer, size_t count);
933 ssize_t instance_show(struct kobject *kobj, struct attribute *attr,
934                       char *buf);
935 #endif
936 /* lproc_status.c */
937 int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data);
938 ssize_t lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file,
939                                                 const char __user *buffer,
940                                                 size_t count, loff_t *off);
941 ssize_t short_io_bytes_show(struct kobject *kobj, struct attribute *attr,
942                             char *buf);
943 ssize_t short_io_bytes_store(struct kobject *kobj, struct attribute *attr,
944                              const char *buffer, size_t count);
945
946 struct root_squash_info;
947 int lprocfs_wr_root_squash(const char __user *buffer, unsigned long count,
948                            struct root_squash_info *squash, char *name);
949 int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
950                              struct root_squash_info *squash, char *name);
951
952 #else /* !CONFIG_PROC_FS */
953
954 #define proc_lustre_root NULL
955
956 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
957                                        int index, long amount)
958 {
959 }
960
961 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats, int index)
962 {
963 }
964
965 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
966                                        int index, long amount)
967 {
968 }
969
970 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats, int index)
971 {
972 }
973
974 static inline void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
975                                         enum lprocfs_counter_config config,
976                                         const char *name)
977 {
978 }
979
980 static inline void lprocfs_counter_init_units(struct lprocfs_stats *stats,
981                                 int index, enum lprocfs_counter_config config,
982                                 const char *name, const char *units)
983 {
984 }
985
986 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
987                                    enum lprocfs_fields_flags field)
988 {
989         return 0;
990 }
991
992 /* NB: we return !NULL to satisfy error checker */
993 static inline struct lprocfs_stats *
994 lprocfs_stats_alloc(unsigned int num, enum lprocfs_stats_flags flags)
995 {
996         return (struct lprocfs_stats *)1;
997 }
998
999 static inline void lprocfs_stats_clear(struct lprocfs_stats *stats)
1000 {
1001 }
1002
1003 static inline void lprocfs_stats_free(struct lprocfs_stats **stats)
1004 {
1005 }
1006
1007 static inline int lprocfs_stats_register(struct proc_dir_entry *root,
1008                                          const char *name,
1009                                          struct lprocfs_stats *stats)
1010 {
1011         return 0;
1012 }
1013
1014 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
1015 {
1016 }
1017
1018 static inline int lprocfs_alloc_obd_stats(struct obd_device *obd,
1019                                           unsigned int num_stats)
1020 {
1021         return 0;
1022 }
1023
1024 static inline int lprocfs_alloc_md_stats(struct obd_device *obd,
1025                                          unsigned int num_private_stats)
1026 {
1027         return 0;
1028 }
1029
1030 static inline void lprocfs_free_obd_stats(struct obd_device *obd)
1031 {
1032 }
1033
1034 static inline void lprocfs_free_md_stats(struct obd_device *obd)
1035 {
1036 }
1037
1038 struct obd_export;
1039 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
1040 {
1041         return 0;
1042 }
1043
1044 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
1045 {
1046 }
1047
1048 #ifdef HAVE_SERVER_SUPPORT
1049 static inline
1050 ssize_t lprocfs_nid_stats_seq_write(struct file *file,
1051                                     const char __user *buffer,
1052                                     size_t count, loff_t *off)
1053 {
1054         return 0;
1055 }
1056
1057 static inline int lprocfs_nid_stats_clear_seq_show(struct seq_file *m,
1058                                                    void *data)
1059 {
1060         return 0;
1061 }
1062
1063 static inline int lprocfs_exp_setup(struct obd_export *exp,
1064                                     struct lnet_nid *peer_nid)
1065 {
1066         return 0;
1067 }
1068 #endif
1069 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
1070 {
1071         return 0;
1072 }
1073
1074 static inline struct proc_dir_entry *
1075 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
1076                    void *data, const struct file_operations *fops)
1077 {
1078         return 0;
1079 }
1080
1081 static inline struct proc_dir_entry *
1082 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
1083                     const char *format, ...)
1084 {
1085         return NULL;
1086 }
1087
1088 static inline int lprocfs_add_vars(struct proc_dir_entry *root,
1089                                    struct lprocfs_vars *var, void *data)
1090 {
1091         return 0;
1092 }
1093
1094 static inline struct proc_dir_entry *
1095 lprocfs_register(const char *name, struct proc_dir_entry *parent,
1096                  struct lprocfs_vars *list, void *data)
1097 {
1098         return NULL;
1099 }
1100
1101 static inline void lprocfs_remove(struct proc_dir_entry **root)
1102 {
1103 }
1104
1105 static inline void lprocfs_remove_proc_entry(const char *name,
1106                                              struct proc_dir_entry *parent)
1107 {
1108 }
1109
1110 static inline int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only)
1111 {
1112         return 0;
1113 }
1114
1115 static inline int lprocfs_obd_cleanup(struct obd_device *obd)
1116 {
1117         return 0;
1118 }
1119
1120 static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
1121 {
1122         return 0;
1123 }
1124
1125 static inline int lprocfs_server_seq_show(struct seq_file *m, void *data)
1126 {
1127         return 0;
1128 }
1129
1130 static inline int lprocfs_import_seq_show(struct seq_file *m, void *data)
1131 {
1132         return 0;
1133 }
1134
1135 static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)
1136 {
1137         return 0;
1138 }
1139
1140 static inline int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
1141 {
1142         return 0;
1143 }
1144 #ifdef HAVE_SERVER_SUPPORT
1145 static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
1146 {
1147         return 0;
1148 }
1149 #endif
1150 struct adaptive_timeout;
1151 static inline int lprocfs_at_hist_helper(struct seq_file *m,
1152                                          struct adaptive_timeout *at)
1153 {
1154         return 0;
1155 }
1156
1157 static inline int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
1158 {
1159         return 0;
1160 }
1161
1162 static inline ssize_t
1163 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
1164                            size_t count, loff_t *off)
1165 {
1166         return 0;
1167 }
1168 #ifdef HAVE_SERVER_SUPPORT
1169 static inline ssize_t
1170 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
1171                                size_t count, loff_t *off)
1172 {
1173         return 0;
1174 }
1175 #endif
1176
1177 static inline ssize_t
1178 lprocfs_ping_seq_write(struct file *file, const char __user *buffer,
1179                        size_t count, loff_t *off)
1180 {
1181         return 0;
1182 }
1183
1184 static inline ssize_t
1185 ldebugfs_import_seq_write(struct file *file, const char __user *buffer,
1186                           size_t count, loff_t *off)
1187 {
1188         return 0;
1189 }
1190
1191 static inline ssize_t
1192 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
1193                          size_t count, loff_t *off)
1194 {
1195         return 0;
1196 }
1197
1198 static inline int
1199 lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data)
1200 {
1201         return 0;
1202 }
1203
1204 static inline ssize_t
1205 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
1206                                size_t count, loff_t *off)
1207 {
1208         return 0;
1209 }
1210
1211 /* Statfs helpers */
1212 static inline
1213 int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
1214 {
1215         return 0;
1216 }
1217
1218 static inline
1219 int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
1220 {
1221         return 0;
1222 }
1223
1224 static inline
1225 int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
1226 {
1227         return 0;
1228 }
1229
1230 static inline
1231 int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
1232 {
1233         return 0;
1234 }
1235
1236 static inline
1237 int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
1238 {
1239         return 0;
1240 }
1241
1242 static inline
1243 int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
1244 {
1245         return 0;
1246 }
1247
1248 static inline
1249 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
1250 {
1251 }
1252
1253 static inline
1254 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
1255 {
1256 }
1257
1258 static inline
1259 void lprocfs_oh_clear(struct obd_histogram *oh)
1260 {
1261 }
1262
1263 static inline
1264 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1265 {
1266         return 0;
1267 }
1268
1269 static inline
1270 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1271                            struct lprocfs_counter *cnt)
1272 {
1273 }
1274
1275 static inline
1276 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1277                             enum lprocfs_fields_flags field)
1278 {
1279         return (__u64)0;
1280 }
1281
1282 #define LPROC_SEQ_FOPS_RO(name)
1283 #define LPROC_SEQ_FOPS(name)
1284 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)
1285 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)
1286 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)
1287
1288 /* lprocfs_jobstats.c */
1289 static inline
1290 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1291                           long amount)
1292 {
1293         return 0;
1294 }
1295
1296 static inline
1297 void lprocfs_job_stats_fini(struct obd_device *obd)
1298 {
1299 }
1300
1301 static inline
1302 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1303                            cntr_init_callback fn)
1304 {
1305         return 0;
1306 }
1307
1308
1309 /* lproc_ptlrpc.c */
1310 #define target_print_req NULL
1311
1312 #endif /* CONFIG_PROC_FS */
1313
1314 #endif /* LPROCFS_STATUS_H */