Whamcloud - gitweb
LU-5319 ptlrpc: Add OBD_CONNECT_MULTIMODRPCS flag
[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.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (c) 2011, 2014, Intel Corporation.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/include/lprocfs_status.h
37  *
38  * Top level header file for LProc
39  *
40  * Author: Hariharan Thantry thantry@users.sourceforge.net
41  */
42 #ifndef _LPROCFS_STATUS_H
43 #define _LPROCFS_STATUS_H
44
45 #include <linux/fs.h>
46 #include <linux/proc_fs.h>
47 #include <linux/rwsem.h>
48 #include <linux/spinlock.h>
49 #include <linux/seq_file.h>
50
51 #include <lustre/lustre_idl.h>
52
53 struct lprocfs_vars {
54         const char                      *name;
55         const struct file_operations    *fops;
56         void                            *data;
57         /**
58          * /proc file mode.
59          */
60         mode_t                           proc_mode;
61 };
62
63 /* if we find more consumers this could be generalized */
64 #define OBD_HIST_MAX 32
65 struct obd_histogram {
66         spinlock_t      oh_lock;
67         unsigned long   oh_buckets[OBD_HIST_MAX];
68 };
69
70 enum {
71         BRW_R_PAGES = 0,
72         BRW_W_PAGES,
73         BRW_R_RPC_HIST,
74         BRW_W_RPC_HIST,
75         BRW_R_IO_TIME,
76         BRW_W_IO_TIME,
77         BRW_R_DISCONT_PAGES,
78         BRW_W_DISCONT_PAGES,
79         BRW_R_DISCONT_BLOCKS,
80         BRW_W_DISCONT_BLOCKS,
81         BRW_R_DISK_IOSIZE,
82         BRW_W_DISK_IOSIZE,
83         BRW_R_DIO_FRAGS,
84         BRW_W_DIO_FRAGS,
85         BRW_LAST,
86 };
87
88 struct brw_stats {
89         struct obd_histogram hist[BRW_LAST];
90 };
91
92 enum {
93         RENAME_SAMEDIR_SIZE = 0,
94         RENAME_CROSSDIR_SRC_SIZE,
95         RENAME_CROSSDIR_TGT_SIZE,
96         RENAME_LAST,
97 };
98
99 struct rename_stats {
100         struct obd_histogram hist[RENAME_LAST];
101 };
102
103 /* An lprocfs counter can be configured using the enum bit masks below.
104  *
105  * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
106  * protects this counter from concurrent updates. If not specified,
107  * lprocfs an internal per-counter lock variable. External locks are
108  * not used to protect counter increments, but are used to protect
109  * counter readout and resets.
110  *
111  * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
112  * (i.e. counter can be incremented by more than "1"). When specified,
113  * the counter maintains min, max and sum in addition to a simple
114  * invocation count. This allows averages to be be computed.
115  * If not specified, the counter is an increment-by-1 counter.
116  * min, max, sum, etc. are not maintained.
117  *
118  * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
119  * squares (for multi-valued counter samples only). This allows
120  * external computation of standard deviation, but involves a 64-bit
121  * multiply per counter increment.
122  */
123
124 enum {
125         LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
126         LPROCFS_CNTR_AVGMINMAX    = 0x0002,
127         LPROCFS_CNTR_STDDEV       = 0x0004,
128
129         /* counter data type */
130         LPROCFS_TYPE_REGS         = 0x0100,
131         LPROCFS_TYPE_BYTES        = 0x0200,
132         LPROCFS_TYPE_PAGES        = 0x0400,
133         LPROCFS_TYPE_CYCLE        = 0x0800,
134 };
135
136 #define LC_MIN_INIT ((~(__u64)0) >> 1)
137
138 struct lprocfs_counter_header {
139         unsigned int            lc_config;
140         const char              *lc_name;   /* must be static */
141         const char              *lc_units;  /* must be static */
142 };
143
144 struct lprocfs_counter {
145         __s64   lc_count;
146         __s64   lc_min;
147         __s64   lc_max;
148         __s64   lc_sumsquare;
149         /*
150          * Every counter has lc_array_sum[0], while lc_array_sum[1] is only
151          * for irq context counter, i.e. stats with
152          * LPROCFS_STATS_FLAG_IRQ_SAFE flag, its counter need
153          * lc_array_sum[1]
154          */
155         __s64   lc_array_sum[1];
156 };
157 #define lc_sum          lc_array_sum[0]
158 #define lc_sum_irq      lc_array_sum[1]
159
160 struct lprocfs_percpu {
161         struct lprocfs_counter lp_cntr[0];
162 };
163
164 enum lprocfs_stats_lock_ops {
165         LPROCFS_GET_NUM_CPU     = 0x0001, /* number allocated per-CPU stats */
166         LPROCFS_GET_SMP_ID      = 0x0002, /* current stat to be updated */
167 };
168
169 enum lprocfs_stats_flags {
170         LPROCFS_STATS_FLAG_NONE     = 0x0000, /* per cpu counter */
171         LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
172                                                * area and need locking */
173         LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */
174 };
175
176 enum lprocfs_fields_flags {
177         LPROCFS_FIELDS_FLAGS_CONFIG     = 0x0001,
178         LPROCFS_FIELDS_FLAGS_SUM        = 0x0002,
179         LPROCFS_FIELDS_FLAGS_MIN        = 0x0003,
180         LPROCFS_FIELDS_FLAGS_MAX        = 0x0004,
181         LPROCFS_FIELDS_FLAGS_AVG        = 0x0005,
182         LPROCFS_FIELDS_FLAGS_SUMSQUARE  = 0x0006,
183         LPROCFS_FIELDS_FLAGS_COUNT      = 0x0007,
184 };
185
186 struct lprocfs_stats {
187         /* # of counters */
188         unsigned short                  ls_num;
189         /* 1 + the biggest cpu # whose ls_percpu slot has been allocated */
190         unsigned short                  ls_biggest_alloc_num;
191         enum lprocfs_stats_flags        ls_flags;
192         /* Lock used when there are no percpu stats areas; For percpu stats,
193          * it is used to protect ls_biggest_alloc_num change */
194         spinlock_t                      ls_lock;
195
196         /* has ls_num of counter headers */
197         struct lprocfs_counter_header   *ls_cnt_header;
198         struct lprocfs_percpu           *ls_percpu[0];
199 };
200
201 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
202
203 /* Pack all opcodes down into a single monotonically increasing index */
204 static inline int opcode_offset(__u32 opc) {
205         if (opc < OST_LAST_OPC) {
206                  /* OST opcode */
207                 return (opc - OST_FIRST_OPC);
208         } else if (opc < MDS_LAST_OPC) {
209                 /* MDS opcode */
210                 return (opc - MDS_FIRST_OPC +
211                         OPC_RANGE(OST));
212         } else if (opc < LDLM_LAST_OPC) {
213                 /* LDLM Opcode */
214                 return (opc - LDLM_FIRST_OPC +
215                         OPC_RANGE(MDS) +
216                         OPC_RANGE(OST));
217         } else if (opc < MGS_LAST_OPC) {
218                 /* MGS Opcode */
219                 return (opc - MGS_FIRST_OPC +
220                         OPC_RANGE(LDLM) +
221                         OPC_RANGE(MDS) +
222                         OPC_RANGE(OST));
223         } else if (opc < OBD_LAST_OPC) {
224                 /* OBD Ping */
225                 return (opc - OBD_FIRST_OPC +
226                         OPC_RANGE(MGS) +
227                         OPC_RANGE(LDLM) +
228                         OPC_RANGE(MDS) +
229                         OPC_RANGE(OST));
230         } else if (opc < LLOG_LAST_OPC) {
231                 /* LLOG Opcode */
232                 return (opc - LLOG_FIRST_OPC +
233                         OPC_RANGE(OBD) +
234                         OPC_RANGE(MGS) +
235                         OPC_RANGE(LDLM) +
236                         OPC_RANGE(MDS) +
237                         OPC_RANGE(OST));
238         } else if (opc < QUOTA_LAST_OPC) {
239                 /* LQUOTA Opcode */
240                 return (opc - QUOTA_FIRST_OPC +
241                         OPC_RANGE(LLOG) +
242                         OPC_RANGE(OBD) +
243                         OPC_RANGE(MGS) +
244                         OPC_RANGE(LDLM) +
245                         OPC_RANGE(MDS) +
246                         OPC_RANGE(OST));
247         } else if (opc < SEQ_LAST_OPC) {
248                 /* SEQ opcode */
249                 return (opc - SEQ_FIRST_OPC +
250                         OPC_RANGE(QUOTA) +
251                         OPC_RANGE(LLOG) +
252                         OPC_RANGE(OBD) +
253                         OPC_RANGE(MGS) +
254                         OPC_RANGE(LDLM) +
255                         OPC_RANGE(MDS) +
256                         OPC_RANGE(OST));
257         } else if (opc < SEC_LAST_OPC) {
258                 /* SEC opcode */
259                 return (opc - SEC_FIRST_OPC +
260                         OPC_RANGE(SEQ) +
261                         OPC_RANGE(QUOTA) +
262                         OPC_RANGE(LLOG) +
263                         OPC_RANGE(OBD) +
264                         OPC_RANGE(MGS) +
265                         OPC_RANGE(LDLM) +
266                         OPC_RANGE(MDS) +
267                         OPC_RANGE(OST));
268         } else if (opc < FLD_LAST_OPC) {
269                 /* FLD opcode */
270                  return (opc - FLD_FIRST_OPC +
271                         OPC_RANGE(SEC) +
272                         OPC_RANGE(SEQ) +
273                         OPC_RANGE(QUOTA) +
274                         OPC_RANGE(LLOG) +
275                         OPC_RANGE(OBD) +
276                         OPC_RANGE(MGS) +
277                         OPC_RANGE(LDLM) +
278                         OPC_RANGE(MDS) +
279                         OPC_RANGE(OST));
280         } else if (opc < OUT_UPDATE_LAST_OPC) {
281                 /* update opcode */
282                 return (opc - OUT_UPDATE_FIRST_OPC +
283                         OPC_RANGE(FLD) +
284                         OPC_RANGE(SEC) +
285                         OPC_RANGE(SEQ) +
286                         OPC_RANGE(QUOTA) +
287                         OPC_RANGE(LLOG) +
288                         OPC_RANGE(OBD) +
289                         OPC_RANGE(MGS) +
290                         OPC_RANGE(LDLM) +
291                         OPC_RANGE(MDS) +
292                         OPC_RANGE(OST));
293         } else if (opc < LFSCK_LAST_OPC) {
294                 /* LFSCK opcode */
295                 return (opc - LFSCK_FIRST_OPC +
296                         OPC_RANGE(OUT_UPDATE) +
297                         OPC_RANGE(FLD) +
298                         OPC_RANGE(SEC) +
299                         OPC_RANGE(SEQ) +
300                         OPC_RANGE(QUOTA) +
301                         OPC_RANGE(LLOG) +
302                         OPC_RANGE(OBD) +
303                         OPC_RANGE(MGS) +
304                         OPC_RANGE(LDLM) +
305                         OPC_RANGE(MDS) +
306                         OPC_RANGE(OST));
307         } else {
308                 /* Unknown Opcode */
309                 return -1;
310         }
311 }
312
313
314 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST)  + \
315                             OPC_RANGE(MDS)  + \
316                             OPC_RANGE(LDLM) + \
317                             OPC_RANGE(MGS)  + \
318                             OPC_RANGE(OBD)  + \
319                             OPC_RANGE(LLOG) + \
320                             OPC_RANGE(SEC)  + \
321                             OPC_RANGE(SEQ)  + \
322                             OPC_RANGE(SEC)  + \
323                             OPC_RANGE(FLD)  + \
324                             OPC_RANGE(OUT_UPDATE) + \
325                             OPC_RANGE(LFSCK))
326
327 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR)  + \
328                             OPC_RANGE(EXTRA))
329
330 enum {
331         PTLRPC_REQWAIT_CNTR = 0,
332         PTLRPC_REQQDEPTH_CNTR,
333         PTLRPC_REQACTIVE_CNTR,
334         PTLRPC_TIMEOUT,
335         PTLRPC_REQBUF_AVAIL_CNTR,
336         PTLRPC_LAST_CNTR
337 };
338
339 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
340
341 enum lprocfs_extra_opc {
342         LDLM_GLIMPSE_ENQUEUE = 0,
343         LDLM_PLAIN_ENQUEUE,
344         LDLM_EXTENT_ENQUEUE,
345         LDLM_FLOCK_ENQUEUE,
346         LDLM_IBITS_ENQUEUE,
347         MDS_REINT_SETATTR,
348         MDS_REINT_CREATE,
349         MDS_REINT_LINK,
350         MDS_REINT_UNLINK,
351         MDS_REINT_RENAME,
352         MDS_REINT_OPEN,
353         MDS_REINT_SETXATTR,
354         BRW_READ_BYTES,
355         BRW_WRITE_BYTES,
356         EXTRA_LAST_OPC
357 };
358
359 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
360 /* class_obd.c */
361 extern struct proc_dir_entry *proc_lustre_root;
362
363 struct obd_device;
364 struct obd_histogram;
365
366 /* Days / hours / mins / seconds format */
367 struct dhms {
368         int d,h,m,s;
369 };
370 static inline void s2dhms(struct dhms *ts, time_t secs)
371 {
372         ts->d = secs / 86400;
373         secs = secs % 86400;
374         ts->h = secs / 3600;
375         secs = secs % 3600;
376         ts->m = secs / 60;
377         ts->s = secs % 60;
378 }
379 #define DHMS_FMT "%dd%dh%02dm%02ds"
380 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
381
382 #define JOBSTATS_JOBID_VAR_MAX_LEN      20
383 #define JOBSTATS_DISABLE                "disable"
384 #define JOBSTATS_PROCNAME_UID           "procname_uid"
385
386 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats);
387
388 struct obd_job_stats {
389         cfs_hash_t             *ojs_hash;
390         struct list_head        ojs_list;
391         rwlock_t                ojs_lock; /* protect the obj_list */
392         cntr_init_callback      ojs_cntr_init_fn;
393         int                     ojs_cntr_num;
394         int                     ojs_cleanup_interval;
395         time_t                  ojs_last_cleanup;
396 };
397
398 #ifdef CONFIG_PROC_FS
399
400 extern int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
401                                    unsigned int cpuid);
402
403 /**
404  * Lock statistics structure for access, possibly only on this CPU.
405  *
406  * The statistics struct may be allocated with per-CPU structures for
407  * efficient concurrent update (usually only on server-wide stats), or
408  * as a single global struct (e.g. for per-client or per-job statistics),
409  * so the required locking depends on the type of structure allocated.
410  *
411  * For per-CPU statistics, pin the thread to the current cpuid so that
412  * will only access the statistics for that CPU.  If the stats structure
413  * for the current CPU has not been allocated (or previously freed),
414  * allocate it now.  The per-CPU statistics do not need locking since
415  * the thread is pinned to the CPU during update.
416  *
417  * For global statistics, lock the stats structure to prevent concurrent update.
418  *
419  * \param[in] stats     statistics structure to lock
420  * \param[in] opc       type of operation:
421  *                      LPROCFS_GET_SMP_ID: "lock" and return current CPU index
422  *                              for incrementing statistics for that CPU
423  *                      LPROCFS_GET_NUM_CPU: "lock" and return number of used
424  *                              CPU indices to iterate over all indices
425  * \param[out] flags    CPU interrupt saved state for IRQ-safe locking
426  *
427  * \retval cpuid of current thread or number of allocated structs
428  * \retval negative on error (only for opc LPROCFS_GET_SMP_ID + per-CPU stats)
429  */
430 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats,
431                                      enum lprocfs_stats_lock_ops opc,
432                                      unsigned long *flags)
433 {
434         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
435                 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE)
436                         spin_lock_irqsave(&stats->ls_lock, *flags);
437                 else
438                         spin_lock(&stats->ls_lock);
439                 return opc == LPROCFS_GET_NUM_CPU ? 1 : 0;
440         }
441
442         switch (opc) {
443         case LPROCFS_GET_SMP_ID: {
444                 unsigned int cpuid = get_cpu();
445
446                 if (unlikely(stats->ls_percpu[cpuid] == NULL)) {
447                         int rc = lprocfs_stats_alloc_one(stats, cpuid);
448                         if (rc < 0) {
449                                 put_cpu();
450                                 return rc;
451                         }
452                 }
453                 return cpuid;
454         }
455         case LPROCFS_GET_NUM_CPU:
456                 return stats->ls_biggest_alloc_num;
457         default:
458                 LBUG();
459         }
460 }
461
462 /**
463  * Unlock statistics structure after access.
464  *
465  * Unlock the lock acquired via lprocfs_stats_lock() for global statistics,
466  * or unpin this thread from the current cpuid for per-CPU statistics.
467  *
468  * This function must be called using the same arguments as used when calling
469  * lprocfs_stats_lock() so that the correct operation can be performed.
470  *
471  * \param[in] stats     statistics structure to unlock
472  * \param[in] opc       type of operation (current cpuid or number of structs)
473  * \param[in] flags     CPU interrupt saved state for IRQ-safe locking
474  */
475 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats,
476                                         enum lprocfs_stats_lock_ops opc,
477                                         unsigned long *flags)
478 {
479         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
480                 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE)
481                         spin_unlock_irqrestore(&stats->ls_lock, *flags);
482                 else
483                         spin_unlock(&stats->ls_lock);
484         } else if (opc == LPROCFS_GET_SMP_ID) {
485                 put_cpu();
486         }
487 }
488
489 static inline unsigned int
490 lprocfs_stats_counter_size(struct lprocfs_stats *stats)
491 {
492         unsigned int percpusize;
493
494         percpusize = offsetof(struct lprocfs_percpu, lp_cntr[stats->ls_num]);
495
496         /* irq safe stats need lc_array_sum[1] */
497         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
498                 percpusize += stats->ls_num * sizeof(__s64);
499
500         if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
501                 percpusize = L1_CACHE_ALIGN(percpusize);
502
503         return percpusize;
504 }
505
506 static inline struct lprocfs_counter *
507 lprocfs_stats_counter_get(struct lprocfs_stats *stats, unsigned int cpuid,
508                           int index)
509 {
510         struct lprocfs_counter *cntr;
511
512         cntr = &stats->ls_percpu[cpuid]->lp_cntr[index];
513
514         if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
515                 cntr = (void *)cntr + index * sizeof(__s64);
516
517         return cntr;
518 }
519
520 /* Two optimized LPROCFS counter increment functions are provided:
521  *     lprocfs_counter_incr(cntr, value) - optimized for by-one counters
522  *     lprocfs_counter_add(cntr) - use for multi-valued counters
523  * Counter data layout allows config flag, counter lock and the
524  * count itself to reside within a single cache line.
525  */
526
527 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
528                                 long amount);
529 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
530                                 long amount);
531
532 #define lprocfs_counter_incr(stats, idx) \
533         lprocfs_counter_add(stats, idx, 1)
534 #define lprocfs_counter_decr(stats, idx) \
535         lprocfs_counter_sub(stats, idx, 1)
536
537 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
538                                  struct lprocfs_counter_header *header,
539                                  enum lprocfs_stats_flags flags,
540                                  enum lprocfs_fields_flags field);
541 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
542                                             int idx,
543                                             enum lprocfs_fields_flags field)
544 {
545         unsigned int  i;
546         unsigned int  num_cpu;
547         unsigned long flags     = 0;
548         __u64         ret       = 0;
549
550         LASSERT(stats != NULL);
551
552         num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
553         for (i = 0; i < num_cpu; i++) {
554                 if (stats->ls_percpu[i] == NULL)
555                         continue;
556                 ret += lprocfs_read_helper(
557                                 lprocfs_stats_counter_get(stats, i, idx),
558                                 &stats->ls_cnt_header[idx], stats->ls_flags,
559                                 field);
560         }
561         lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU, &flags);
562         return ret;
563 }
564
565 extern struct lprocfs_stats *
566 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
567 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
568 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
569 extern void lprocfs_init_ops_stats(int num_private_stats,
570                                    struct lprocfs_stats *stats);
571 extern void lprocfs_init_mps_stats(int num_private_stats,
572                                    struct lprocfs_stats *stats);
573 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
574 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
575                                    unsigned int num_private_stats);
576 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
577                                   unsigned int num_private_stats);
578 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
579                                  unsigned conf, const char *name,
580                                  const char *units);
581 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
582 extern void lprocfs_free_md_stats(struct obd_device *obddev);
583 struct obd_export;
584 struct nid_stat;
585 extern int lprocfs_add_clear_entry(struct obd_device * obd,
586                                    struct proc_dir_entry *entry);
587 #ifdef HAVE_SERVER_SUPPORT
588 extern int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *peer_nid);
589 extern int lprocfs_exp_cleanup(struct obd_export *exp);
590 #else
591 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
592 { return 0; }
593 #endif
594 extern struct proc_dir_entry *
595 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
596                    void *data, const struct file_operations *fops);
597 extern struct proc_dir_entry *
598 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
599                     const char *format, ...);
600 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
601 #ifdef HAVE_SERVER_SUPPORT
602 extern ssize_t
603 lprocfs_nid_stats_clear_seq_write(struct file *file, const char *buffer,
604                                         size_t count, loff_t *off);
605 extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
606 #endif
607 extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
608                                   struct lprocfs_stats *stats);
609
610 /* lprocfs_status.c */
611 extern int lprocfs_add_vars(struct proc_dir_entry *root,
612                             struct lprocfs_vars *var, void *data);
613 extern struct proc_dir_entry *
614 lprocfs_register(const char *name, struct proc_dir_entry *parent,
615                  struct lprocfs_vars *list, void *data);
616 extern void lprocfs_remove(struct proc_dir_entry **root);
617 extern void lprocfs_remove_proc_entry(const char *name,
618                                       struct proc_dir_entry *parent);
619 #ifndef HAVE_REMOVE_PROC_SUBTREE
620 extern int remove_proc_subtree(const char *name,
621                                struct proc_dir_entry *parent);
622 #define PDE_DATA(inode)         (PDE(inode)->data)
623
624 static inline int LPROCFS_ENTRY_CHECK(struct inode *inode)
625 {
626         struct proc_dir_entry *dp = PDE(inode);
627         int deleted = 0;
628
629         spin_lock(&(dp)->pde_unload_lock);
630         if (dp->proc_fops == NULL)
631                 deleted = 1;
632         spin_unlock(&(dp)->pde_unload_lock);
633         if (deleted)
634                 return -ENODEV;
635         return 0;
636 }
637 #else
638 static inline int LPROCFS_ENTRY_CHECK(struct inode *inode)
639 { return 0; }
640 #endif
641 extern int lprocfs_obd_setup(struct obd_device *dev);
642 extern int lprocfs_obd_cleanup(struct obd_device *obd);
643 #ifdef HAVE_SERVER_SUPPORT
644 extern const struct file_operations lprocfs_evict_client_fops;
645 #endif
646 extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name,
647                               mode_t mode,
648                               const struct file_operations *seq_fops,
649                               void *data);
650 extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name,
651                                   mode_t mode,
652                                   const struct file_operations *seq_fops,
653                                   void *data);
654
655 /* Generic callbacks */
656 extern int lprocfs_u64_seq_show(struct seq_file *m, void *data);
657 extern int lprocfs_atomic_seq_show(struct seq_file *m, void *data);
658 extern ssize_t lprocfs_atomic_seq_write(struct file *file,
659                                         const char __user *buffer,
660                                         size_t count, loff_t *off);
661 extern int lprocfs_uint_seq_show(struct seq_file *m, void *data);
662 extern ssize_t lprocfs_uint_seq_write(struct file *file,
663                                       const char __user *buffer,
664                                       size_t count, loff_t *off);
665 extern int lprocfs_wr_uint(struct file *file, const char __user *buffer,
666                            unsigned long count, void *data);
667 extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
668 extern int lprocfs_name_seq_show(struct seq_file *m, void *data);
669 extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data);
670 extern int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data);
671 extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
672 extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
673 extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data);
674 #ifdef HAVE_SERVER_SUPPORT
675 extern int lprocfs_num_exports_seq_show(struct seq_file *m, void *data);
676 #endif
677 struct adaptive_timeout;
678 extern int lprocfs_at_hist_helper(struct seq_file *m,
679                                   struct adaptive_timeout *at);
680 extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data);
681 extern ssize_t
682 lprocfs_timeouts_seq_write(struct file *file, const char *buffer,
683                            size_t count, loff_t *off);
684 #ifdef HAVE_SERVER_SUPPORT
685 extern ssize_t
686 lprocfs_evict_client_seq_write(struct file *file, const char *buffer,
687                                 size_t count, loff_t *off);
688 #endif
689 extern ssize_t
690 lprocfs_ping_seq_write(struct file *file, const char *buffer,
691                        size_t count, loff_t *off);
692 extern ssize_t
693 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
694                          size_t count, loff_t *off);
695 extern int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data);
696 extern ssize_t
697 lprocfs_pinger_recov_seq_write(struct file *file, const char *buffer,
698                                size_t count, loff_t *off);
699
700 /* Statfs helpers */
701 extern int lprocfs_blksize_seq_show(struct seq_file *m, void *data);
702 extern int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data);
703 extern int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data);
704 extern int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data);
705 extern int lprocfs_filestotal_seq_show(struct seq_file *m, void *data);
706 extern int lprocfs_filesfree_seq_show(struct seq_file *m, void *data);
707
708 extern int lprocfs_write_helper(const char __user *buffer, unsigned long count,
709                                 int *val);
710 extern int lprocfs_write_frac_helper(const char __user *buffer,
711                                      unsigned long count,
712                                      int *val, int mult);
713 extern int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult);
714 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
715                                     long val, int mult);
716 extern int lprocfs_write_u64_helper(const char __user *buffer,
717                                     unsigned long count, __u64 *val);
718 extern int lprocfs_write_frac_u64_helper(const char __user *buffer,
719                                          unsigned long count,
720                                          __u64 *val, int mult);
721 char *lprocfs_find_named_value(const char *buffer, const char *name,
722                                 size_t *count);
723 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
724 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
725 void lprocfs_oh_clear(struct obd_histogram *oh);
726 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
727
728 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
729                            struct lprocfs_counter *cnt);
730
731 #ifdef HAVE_SERVER_SUPPORT
732 /* lprocfs_status.c: recovery status */
733 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data);
734
735 /* lprocfs_status.c: hash statistics */
736 int lprocfs_hash_seq_show(struct seq_file *m, void *data);
737
738 /* lprocfs_status.c: IR factor */
739 int lprocfs_ir_factor_seq_show(struct seq_file *m, void *data);
740 ssize_t
741 lprocfs_ir_factor_seq_write(struct file *file, const char *buffer,
742                                 size_t count, loff_t *off);
743 #endif
744 extern int lprocfs_single_release(struct inode *, struct file *);
745 extern int lprocfs_seq_release(struct inode *, struct file *);
746
747 /* You must use these macros when you want to refer to
748  * the import in a client obd_device for a lprocfs entry */
749 #define LPROCFS_CLIMP_CHECK(obd) do {           \
750         typecheck(struct obd_device *, obd);    \
751         down_read(&(obd)->u.cli.cl_sem);    \
752         if ((obd)->u.cli.cl_import == NULL) {   \
753              up_read(&(obd)->u.cli.cl_sem); \
754              return -ENODEV;                    \
755         }                                       \
756 } while(0)
757 #define LPROCFS_CLIMP_EXIT(obd)                 \
758         up_read(&(obd)->u.cli.cl_sem);
759
760 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
761   proc entries; otherwise, you will define name##_seq_write function also for
762   a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
763   call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
764 #define __LPROC_SEQ_FOPS(name, custom_seq_write)                        \
765 static int name##_single_open(struct inode *inode, struct file *file)   \
766 {                                                                       \
767         int rc;                                                         \
768                                                                         \
769         rc = LPROCFS_ENTRY_CHECK(inode);                                \
770         if (rc < 0)                                                     \
771                 return rc;                                              \
772                                                                         \
773         return single_open(file, name##_seq_show, PDE_DATA(inode));     \
774 }                                                                       \
775 static const struct file_operations name##_fops = {                     \
776         .owner   = THIS_MODULE,                                         \
777         .open    = name##_single_open,                                  \
778         .read    = seq_read,                                            \
779         .write   = custom_seq_write,                                    \
780         .llseek  = seq_lseek,                                           \
781         .release = lprocfs_single_release,                              \
782 }
783
784 #define LPROC_SEQ_FOPS_RO(name)         __LPROC_SEQ_FOPS(name, NULL)
785 #define LPROC_SEQ_FOPS(name)            __LPROC_SEQ_FOPS(name, name##_seq_write)
786
787 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)                              \
788         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
789         {                                                               \
790                 return lprocfs_##type##_seq_show(m, m->private);        \
791         }                                                               \
792         LPROC_SEQ_FOPS_RO(name##_##type)
793
794 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)                              \
795         static int name##_##type##_seq_show(struct seq_file *m, void *v)\
796         {                                                               \
797                 return lprocfs_##type##_seq_show(m, m->private);        \
798         }                                                               \
799         static ssize_t name##_##type##_seq_write(struct file *file,     \
800                         const char __user *buffer, size_t count,        \
801                         loff_t *off)                                    \
802         {                                                               \
803                 struct seq_file *seq = file->private_data;              \
804                 return lprocfs_##type##_seq_write(file, buffer,         \
805                                                 count, seq->private);   \
806         }                                                               \
807         LPROC_SEQ_FOPS(name##_##type);
808
809 #define LPROC_SEQ_FOPS_WO_TYPE(name, type)                              \
810         static ssize_t name##_##type##_write(struct file *file,         \
811                         const char __user *buffer, size_t count,        \
812                         loff_t *off)                                    \
813         {                                                               \
814                 return lprocfs_##type##_seq_write(file, buffer, count, off);\
815         }                                                               \
816         static int name##_##type##_open(struct inode *inode, struct file *file)\
817         {                                                               \
818                 return single_open(file, NULL, PDE_DATA(inode));        \
819         }                                                               \
820         static const struct file_operations name##_##type##_fops = {    \
821                 .open    = name##_##type##_open,                        \
822                 .write   = name##_##type##_write,                       \
823                 .release = lprocfs_single_release,                      \
824         };
825
826 /* lproc_ptlrpc.c */
827 struct ptlrpc_request;
828 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
829
830 #ifdef HAVE_SERVER_SUPPORT
831 /* lprocfs_jobstats.c */
832 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
833                           int event, long amount);
834 void lprocfs_job_stats_fini(struct obd_device *obd);
835 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
836                            cntr_init_callback fn);
837 int lprocfs_job_interval_seq_show(struct seq_file *m, void *data);
838 ssize_t
839 lprocfs_job_interval_seq_write(struct file *file, const char *buffer,
840                                 size_t count, loff_t *off);
841 /* lproc_status.c */
842 int lprocfs_recovery_time_soft_seq_show(struct seq_file *m, void *data);
843 ssize_t lprocfs_recovery_time_soft_seq_write(struct file *file,
844                                                 const char *buffer,
845                                                 size_t count, loff_t *off);
846 int lprocfs_recovery_time_hard_seq_show(struct seq_file *m, void *data);
847 ssize_t
848 lprocfs_recovery_time_hard_seq_write(struct file *file, const char *buffer,
849                                         size_t count, loff_t *off);
850 int lprocfs_target_instance_seq_show(struct seq_file *m, void *data);
851 #endif
852 int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data);
853 ssize_t
854 lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file, const char *buffer,
855                                        size_t count, loff_t *off);
856
857 struct root_squash_info;
858 int lprocfs_wr_root_squash(const char __user *buffer, unsigned long count,
859                            struct root_squash_info *squash, char *name);
860 int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
861                              struct root_squash_info *squash, char *name);
862
863 /* all quota proc functions */
864 extern int lprocfs_quota_rd_bunit(char *page, char **start,
865                                   off_t off, int count,
866                                   int *eof, void *data);
867 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
868                                   unsigned long count, void *data);
869 extern int lprocfs_quota_rd_btune(char *page, char **start,
870                                   off_t off, int count,
871                                   int *eof, void *data);
872 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
873                                   unsigned long count, void *data);
874 extern int lprocfs_quota_rd_iunit(char *page, char **start,
875                                   off_t off, int count,
876                                   int *eof, void *data);
877 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
878                                   unsigned long count, void *data);
879 extern int lprocfs_quota_rd_itune(char *page, char **start,
880                                   off_t off, int count,
881                                   int *eof, void *data);
882 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
883                                   unsigned long count, void *data);
884 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
885                                  int *eof, void *data);
886 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
887                                  unsigned long count, void *data);
888 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
889                                            int count, int *eof, void *data);
890 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
891                                            const char *buffer,
892                                            unsigned long count, void *data);
893 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
894                                      int count, int *eof, void *data);
895 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
896                                      unsigned long count, void *data);
897 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
898                                       int count, int *eof, void *data);
899 extern int lprocfs_quota_wr_switch_qs(struct file *file,
900                                       const char *buffer,
901                                       unsigned long count, void *data);
902 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
903                                             int count, int *eof, void *data);
904 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
905                                             const char *buffer,
906                                             unsigned long count, void *data);
907 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
908                                         int count, int *eof, void *data);
909 extern int lprocfs_quota_wr_least_bunit(struct file *file,
910                                         const char *buffer,
911                                         unsigned long count, void *data);
912 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
913                                         int count, int *eof, void *data);
914 extern int lprocfs_quota_wr_least_iunit(struct file *file,
915                                         const char *buffer,
916                                         unsigned long count, void *data);
917 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
918                                       int count, int *eof, void *data);
919 extern int lprocfs_quota_wr_qs_factor(struct file *file,
920                                       const char *buffer,
921                                       unsigned long count, void *data);
922 #else /* !CONFIG_PROC_FS */
923
924 #define proc_lustre_root NULL
925
926 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
927                                        int index, long amount)
928 { return; }
929 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
930                                         int index)
931 { return; }
932 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
933                                        int index, long amount)
934 { return; }
935 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
936                                         int index)
937 { return; }
938 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
939                                         int index, unsigned conf,
940                                         const char *name, const char *units)
941 { return; }
942
943 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
944                                    enum lprocfs_fields_flags field)
945 { return 0; }
946
947 /* NB: we return !NULL to satisfy error checker */
948 static inline struct lprocfs_stats *
949 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
950 { return (struct lprocfs_stats *)1; }
951 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
952 { return; }
953 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
954 { return; }
955 static inline int lprocfs_register_stats(struct proc_dir_entry *root,
956                                          const char *name,
957                                          struct lprocfs_stats *stats)
958 { return 0; }
959 static inline void lprocfs_init_ops_stats(int num_private_stats,
960                                           struct lprocfs_stats *stats)
961 { return; }
962 static inline void lprocfs_init_mps_stats(int num_private_stats,
963                                           struct lprocfs_stats *stats)
964 { return; }
965 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
966 { return; }
967 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
968                                           unsigned int num_private_stats)
969 { return 0; }
970 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
971                                          unsigned int num_private_stats)
972 { return 0; }
973 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
974 { return; }
975 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
976 { return; }
977
978 struct obd_export;
979 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
980 { return 0; }
981 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
982 { return; }
983 #ifdef HAVE_SERVER_SUPPORT
984 static inline
985 ssize_t lprocfs_nid_stats_seq_write(struct file *file, const char *buffer,
986                                         size_t count, loff_t *off)
987 {return 0;}
988 static inline
989 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
990 {return 0;}
991 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid)
992 { return 0; }
993 #endif
994 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
995 { return 0; }
996 static inline struct proc_dir_entry *
997 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
998                    void *data, const struct file_operations *fops)
999 {return 0; }
1000 static inline struct proc_dir_entry *
1001 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
1002                     const char *format, ...)
1003 {return NULL; }
1004 static inline int lprocfs_add_vars(struct proc_dir_entry *root,
1005                                    struct lprocfs_vars *var, void *data)
1006 { return 0; }
1007 static inline struct proc_dir_entry *
1008 lprocfs_register(const char *name, struct proc_dir_entry *parent,
1009                  struct lprocfs_vars *list, void *data)
1010 { return NULL; }
1011 static inline void lprocfs_remove(struct proc_dir_entry **root)
1012 { return; }
1013 static inline void lprocfs_remove_proc_entry(const char *name,
1014                                              struct proc_dir_entry *parent)
1015 { return; }
1016 static inline int lprocfs_obd_setup(struct obd_device *dev)
1017 { return 0; }
1018 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
1019 { return 0; }
1020 static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
1021 { return 0; }
1022 static inline int lprocfs_name_seq_show(struct seq_file *m, void *data)
1023 { return 0; }
1024 static inline int lprocfs_server_seq_show(struct seq_file *m, void *data)
1025 { return 0; }
1026 static inline int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data)
1027 { return 0; }
1028 static inline int lprocfs_import_seq_show(struct seq_file *m, void *data)
1029 { return 0; }
1030 static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)
1031 { return 0; }
1032 static inline int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
1033 { return 0; }
1034 #ifdef HAVE_SERVER_SUPPORT
1035 static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
1036 { return 0; }
1037 #endif
1038 struct adaptive_timeout;
1039 static inline int lprocfs_at_hist_helper(struct seq_file *m,
1040                                          struct adaptive_timeout *at)
1041 { return 0; }
1042 static inline int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
1043 { return 0; }
1044 static inline ssize_t
1045 lprocfs_timeouts_seq_write(struct file *file, const char *buffer,
1046                            size_t count, loff_t *off)
1047 { return 0; }
1048 #ifdef HAVE_SERVER_SUPPORT
1049 static inline ssize_t
1050 lprocfs_evict_client_seq_write(struct file *file, const char *buffer,
1051                                size_t count, loff_t *off)
1052 { return 0; }
1053 #endif
1054 static inline ssize_t
1055 lprocfs_ping_seq_write(struct file *file, const char __user *buffer,
1056                        size_t count, loff_t *off)
1057 { return 0; }
1058 static inline ssize_t
1059 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
1060                          size_t count, loff_t *off)
1061 { return 0; }
1062 static inline int
1063 lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data)
1064 { return 0; }
1065 static inline ssize_t
1066 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
1067                                size_t count, loff_t *off)
1068 { return 0; }
1069
1070 /* Statfs helpers */
1071 static inline
1072 int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
1073 { return 0; }
1074 static inline
1075 int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
1076 { return 0; }
1077 static inline
1078 int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
1079 { return 0; }
1080 static inline
1081 int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
1082 { return 0; }
1083 static inline
1084 int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
1085 { return 0; }
1086 static inline
1087 int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
1088 { return 0; }
1089 static inline
1090 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
1091 { return; }
1092 static inline
1093 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
1094 { return; }
1095 static inline
1096 void lprocfs_oh_clear(struct obd_histogram *oh)
1097 { return; }
1098 static inline
1099 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1100 { return 0; }
1101 static inline
1102 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1103                            struct lprocfs_counter *cnt)
1104 { return; }
1105 static inline
1106 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1107                                enum lprocfs_fields_flags field)
1108 { return (__u64)0; }
1109
1110 #define LPROC_SEQ_FOPS_RO(name)
1111 #define LPROC_SEQ_FOPS(name)
1112 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)
1113 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)
1114 #define LPROC_SEQ_FOPS_WO_TYPE(name, type)
1115
1116 /* lprocfs_jobstats.c */
1117 static inline
1118 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1119                           long amount)
1120 { return 0; }
1121 static inline
1122 void lprocfs_job_stats_fini(struct obd_device *obd)
1123 { return; }
1124 static inline
1125 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1126                            cntr_init_callback fn)
1127 { return 0; }
1128
1129
1130 /* lproc_ptlrpc.c */
1131 #define target_print_req NULL
1132
1133 #endif /* CONFIG_PROC_FS */
1134
1135 #endif /* LPROCFS_STATUS_H */