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