1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
30 * Use is subject to license terms.
33 * Copyright (c) 2011 Whamcloud, Inc.
36 * This file is part of Lustre, http://www.lustre.org/
37 * Lustre is a trademark of Sun Microsystems, Inc.
39 * lustre/include/lprocfs_status.h
41 * Top level header file for LProc SNMP
43 * Author: Hariharan Thantry thantry@users.sourceforge.net
45 #ifndef _LPROCFS_SNMP_H
46 #define _LPROCFS_SNMP_H
48 #if defined(__linux__)
49 #include <linux/lprocfs_status.h>
50 #elif defined(__APPLE__)
51 #include <darwin/lprocfs_status.h>
52 #elif defined(__WINNT__)
53 #include <winnt/lprocfs_status.h>
55 #error Unsupported operating system.
57 #include <lustre/lustre_idl.h>
58 #include <libcfs/params_tree.h>
62 cfs_read_proc_t *read_fptr;
63 cfs_write_proc_t *write_fptr;
65 struct file_operations *fops;
72 struct lprocfs_static_vars {
73 struct lprocfs_vars *module_vars;
74 struct lprocfs_vars *obd_vars;
77 /* if we find more consumers this could be generalized */
78 #define OBD_HIST_MAX 32
79 struct obd_histogram {
80 cfs_spinlock_t oh_lock;
81 unsigned long oh_buckets[OBD_HIST_MAX];
103 struct obd_histogram hist[BRW_LAST];
107 RENAME_SAMEDIR_SIZE = 0,
108 RENAME_CROSSDIR_SRC_SIZE,
109 RENAME_CROSSDIR_TGT_SIZE,
113 struct rename_stats {
114 struct obd_histogram hist[RENAME_LAST];
117 /* An lprocfs counter can be configured using the enum bit masks below.
119 * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
120 * protects this counter from concurrent updates. If not specified,
121 * lprocfs an internal per-counter lock variable. External locks are
122 * not used to protect counter increments, but are used to protect
123 * counter readout and resets.
125 * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
126 * (i.e. counter can be incremented by more than "1"). When specified,
127 * the counter maintains min, max and sum in addition to a simple
128 * invocation count. This allows averages to be be computed.
129 * If not specified, the counter is an increment-by-1 counter.
130 * min, max, sum, etc. are not maintained.
132 * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
133 * squares (for multi-valued counter samples only). This allows
134 * external computation of standard deviation, but involves a 64-bit
135 * multiply per counter increment.
139 LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
140 LPROCFS_CNTR_AVGMINMAX = 0x0002,
141 LPROCFS_CNTR_STDDEV = 0x0004,
143 /* counter data type */
144 LPROCFS_TYPE_REGS = 0x0100,
145 LPROCFS_TYPE_BYTES = 0x0200,
146 LPROCFS_TYPE_PAGES = 0x0400,
147 LPROCFS_TYPE_CYCLE = 0x0800,
150 struct lprocfs_atomic {
151 cfs_atomic_t la_entry;
152 cfs_atomic_t la_exit;
155 #define LC_MIN_INIT ((~(__u64)0) >> 1)
157 struct lprocfs_counter {
158 struct lprocfs_atomic lc_cntl; /* may need to move to per set */
159 unsigned int lc_config;
166 const char *lc_name; /* must be static */
167 const char *lc_units; /* must be static */
170 struct lprocfs_percpu {
171 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
174 struct lprocfs_counter lp_cntr[0];
177 #define LPROCFS_GET_NUM_CPU 0x0001
178 #define LPROCFS_GET_SMP_ID 0x0002
180 enum lprocfs_stats_flags {
181 LPROCFS_STATS_FLAG_NONE = 0x0000, /* per cpu counter */
182 LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
183 * area and need locking */
186 enum lprocfs_fields_flags {
187 LPROCFS_FIELDS_FLAGS_CONFIG = 0x0001,
188 LPROCFS_FIELDS_FLAGS_SUM = 0x0002,
189 LPROCFS_FIELDS_FLAGS_MIN = 0x0003,
190 LPROCFS_FIELDS_FLAGS_MAX = 0x0004,
191 LPROCFS_FIELDS_FLAGS_AVG = 0x0005,
192 LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006,
193 LPROCFS_FIELDS_FLAGS_COUNT = 0x0007,
196 struct lprocfs_stats {
197 unsigned int ls_num; /* # of counters */
198 int ls_flags; /* See LPROCFS_STATS_FLAG_* */
199 cfs_spinlock_t ls_lock; /* Lock used only when there are
200 * no percpu stats areas */
201 struct lprocfs_percpu *ls_percpu[0];
204 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
206 /* Pack all opcodes down into a single monotonically increasing index */
207 static inline int opcode_offset(__u32 opc) {
208 if (opc < OST_LAST_OPC) {
210 return (opc - OST_FIRST_OPC);
211 } else if (opc < MDS_LAST_OPC) {
213 return (opc - MDS_FIRST_OPC +
215 } else if (opc < LDLM_LAST_OPC) {
217 return (opc - LDLM_FIRST_OPC +
220 } else if (opc < MGS_LAST_OPC) {
222 return (opc - MGS_FIRST_OPC +
226 } else if (opc < OBD_LAST_OPC) {
228 return (opc - OBD_FIRST_OPC +
233 } else if (opc < LLOG_LAST_OPC) {
235 return (opc - LLOG_FIRST_OPC +
241 } else if (opc < QUOTA_LAST_OPC) {
243 return (opc - QUOTA_FIRST_OPC +
250 } else if (opc < SEQ_LAST_OPC) {
252 return (opc - SEQ_FIRST_OPC +
260 } else if (opc < SEC_LAST_OPC) {
262 return (opc - SEC_FIRST_OPC +
271 } else if (opc < FLD_LAST_OPC) {
273 return (opc - FLD_FIRST_OPC +
290 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST) + \
301 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
305 PTLRPC_REQWAIT_CNTR = 0,
306 PTLRPC_REQQDEPTH_CNTR,
307 PTLRPC_REQACTIVE_CNTR,
309 PTLRPC_REQBUF_AVAIL_CNTR,
313 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
316 LDLM_GLIMPSE_ENQUEUE = 0,
333 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
335 extern cfs_proc_dir_entry_t *proc_lustre_root;
338 struct obd_histogram;
340 /* Days / hours / mins / seconds format */
344 static inline void s2dhms(struct dhms *ts, time_t secs)
346 ts->d = secs / 86400;
353 #define DHMS_FMT "%dd%dh%02dm%02ds"
354 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
359 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc)
365 case LPROCFS_GET_SMP_ID:
366 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
367 cfs_spin_lock(&stats->ls_lock);
370 return cfs_get_cpu();
373 case LPROCFS_GET_NUM_CPU:
374 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
375 cfs_spin_lock(&stats->ls_lock);
378 return cfs_num_possible_cpus();
383 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats, int opc)
389 case LPROCFS_GET_SMP_ID:
390 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
391 cfs_spin_unlock(&stats->ls_lock);
396 case LPROCFS_GET_NUM_CPU:
397 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
398 cfs_spin_unlock(&stats->ls_lock);
403 /* Two optimized LPROCFS counter increment functions are provided:
404 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
405 * lprocfs_counter_add(cntr) - use for multi-valued counters
406 * Counter data layout allows config flag, counter lock and the
407 * count itself to reside within a single cache line.
410 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
412 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
415 #define lprocfs_counter_incr(stats, idx) \
416 lprocfs_counter_add(stats, idx, 1)
417 #define lprocfs_counter_decr(stats, idx) \
418 lprocfs_counter_sub(stats, idx, 1)
420 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
421 enum lprocfs_fields_flags field);
422 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
424 enum lprocfs_fields_flags field)
429 LASSERT(stats != NULL);
430 for (i = 0; i < cfs_num_possible_cpus(); i++)
431 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
436 extern struct lprocfs_stats *
437 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
438 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
439 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
440 extern void lprocfs_init_ops_stats(int num_private_stats,
441 struct lprocfs_stats *stats);
442 extern void lprocfs_init_mps_stats(int num_private_stats,
443 struct lprocfs_stats *stats);
444 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
445 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
446 unsigned int num_private_stats);
447 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
448 unsigned int num_private_stats);
449 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
450 unsigned conf, const char *name,
452 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
453 extern void lprocfs_free_md_stats(struct obd_device *obddev);
456 extern int lprocfs_add_clear_entry(struct obd_device * obd,
457 cfs_proc_dir_entry_t *entry);
458 extern int lprocfs_exp_setup(struct obd_export *exp,
459 lnet_nid_t *peer_nid, int *newnid);
460 extern int lprocfs_exp_cleanup(struct obd_export *exp);
461 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
463 cfs_read_proc_t *read_proc,
464 cfs_write_proc_t *write_proc,
466 struct file_operations *fops);
467 extern struct proc_dir_entry *
468 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
469 const char *format, ...);
470 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
472 lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
473 unsigned long count, void *data);
474 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
475 int count, int *eof, void *data);
477 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
478 struct lprocfs_stats *stats);
480 /* lprocfs_status.c */
481 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
482 struct lprocfs_vars *var,
485 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
486 cfs_proc_dir_entry_t *parent,
487 struct lprocfs_vars *list,
490 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
491 extern void lprocfs_remove_proc_entry(const char *name,
492 struct proc_dir_entry *parent);
494 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
497 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
498 extern int lprocfs_obd_cleanup(struct obd_device *obd);
499 extern struct file_operations lprocfs_evict_client_fops;
501 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name,
502 mode_t mode, struct file_operations *seq_fops,
504 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
505 mode_t mode, struct file_operations *seq_fops,
508 /* Generic callbacks */
510 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
511 int count, int *eof, void *data);
512 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
513 int count, int *eof, void *data);
514 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
515 unsigned long count, void *data);
516 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
517 int count, int *eof, void *data);
518 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
519 unsigned long count, void *data);
520 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
521 int count, int *eof, void *data);
522 extern int lprocfs_rd_name(char *page, char **start, off_t off,
523 int count, int *eof, void *data);
524 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
525 int count, int *eof, void *data);
526 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
527 int count, int *eof, void *data);
528 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
529 int count, int *eof, void *data);
530 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
531 int *eof, void *data);
532 extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
533 int *eof, void *data);
534 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
535 int count, int *eof, void *data);
536 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
537 int count, int *eof, void *data);
538 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
539 int count, int *eof, void *data);
540 struct adaptive_timeout;
541 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
542 struct adaptive_timeout *at);
543 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
544 int count, int *eof, void *data);
545 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
546 unsigned long count, void *data);
547 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
548 unsigned long count, void *data);
549 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
550 unsigned long count, void *data);
551 extern int lprocfs_wr_import(struct file *file, const char *buffer,
552 unsigned long count, void *data);
553 extern int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
554 int count, int *eof, void *data);
555 extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
556 unsigned long count, void *data);
559 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
560 int count, int *eof, void *data);
561 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
562 int count, int *eof, void *data);
563 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
564 int count, int *eof, void *data);
565 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
566 int count, int *eof, void *data);
567 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
568 int count, int *eof, void *data);
569 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
570 int count, int *eof, void *data);
571 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
572 int count, int *eof, void *data);
574 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
576 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
578 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
580 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
582 extern int lprocfs_write_frac_u64_helper(const char *buffer,
584 __u64 *val, int mult);
585 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
586 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
587 void lprocfs_oh_clear(struct obd_histogram *oh);
588 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
590 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
591 struct lprocfs_counter *cnt);
593 /* lprocfs_status.c: recovery status */
594 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
595 int count, int *eof, void *data);
597 /* lprocfs_statuc.c: hash statistics */
598 int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
599 int count, int *eof, void *data);
601 /* lprocfs_status.c: IR factor */
602 int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
603 int count, int *eof, void *data);
604 int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer,
605 unsigned long count, void *data);
607 extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
609 /* You must use these macros when you want to refer to
610 * the import in a client obd_device for a lprocfs entry */
611 #define LPROCFS_CLIMP_CHECK(obd) do { \
612 typecheck(struct obd_device *, obd); \
613 cfs_down_read(&(obd)->u.cli.cl_sem); \
614 if ((obd)->u.cli.cl_import == NULL) { \
615 cfs_up_read(&(obd)->u.cli.cl_sem); \
619 #define LPROCFS_CLIMP_EXIT(obd) \
620 cfs_up_read(&(obd)->u.cli.cl_sem);
623 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
624 proc entries; otherwise, you will define name##_seq_write function also for
625 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
626 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
627 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
628 static int name##_seq_open(cfs_inode_t *inode, struct file *file) { \
629 struct proc_dir_entry *dp = PDE(inode); \
631 LPROCFS_ENTRY_AND_CHECK(dp); \
632 rc = single_open(file, name##_seq_show, dp->data); \
639 struct file_operations name##_fops = { \
640 .owner = THIS_MODULE, \
641 .open = name##_seq_open, \
643 .write = custom_seq_write, \
644 .llseek = seq_lseek, \
645 .release = lprocfs_seq_release, \
648 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
649 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
652 struct ptlrpc_request;
653 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
656 int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
657 int count, int *eof, void *data);
658 int lprocfs_obd_wr_recovery_time_soft(struct file *file,
660 unsigned long count, void *data);
661 int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
662 int count, int *eof, void *data);
663 int lprocfs_obd_wr_recovery_time_hard(struct file *file,
665 unsigned long count, void *data);
666 int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
667 int count, int *eof, void *data);
668 int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
669 int count, int *eof, void *data);
670 int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
671 unsigned long count, void *data);
672 int lprocfs_target_rd_instance(char *page, char **start, off_t off,
673 int count, int *eof, void *data);
675 /* all quota proc functions */
676 extern int lprocfs_quota_rd_bunit(char *page, char **start,
677 off_t off, int count,
678 int *eof, void *data);
679 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
680 unsigned long count, void *data);
681 extern int lprocfs_quota_rd_btune(char *page, char **start,
682 off_t off, int count,
683 int *eof, void *data);
684 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
685 unsigned long count, void *data);
686 extern int lprocfs_quota_rd_iunit(char *page, char **start,
687 off_t off, int count,
688 int *eof, void *data);
689 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
690 unsigned long count, void *data);
691 extern int lprocfs_quota_rd_itune(char *page, char **start,
692 off_t off, int count,
693 int *eof, void *data);
694 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
695 unsigned long count, void *data);
696 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
697 int *eof, void *data);
698 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
699 unsigned long count, void *data);
700 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
701 int count, int *eof, void *data);
702 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
704 unsigned long count, void *data);
705 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
706 int count, int *eof, void *data);
707 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
708 unsigned long count, void *data);
709 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
710 int count, int *eof, void *data);
711 extern int lprocfs_quota_wr_switch_qs(struct file *file,
713 unsigned long count, void *data);
714 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
715 int count, int *eof, void *data);
716 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
718 unsigned long count, void *data);
719 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
720 int count, int *eof, void *data);
721 extern int lprocfs_quota_wr_least_bunit(struct file *file,
723 unsigned long count, void *data);
724 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
725 int count, int *eof, void *data);
726 extern int lprocfs_quota_wr_least_iunit(struct file *file,
728 unsigned long count, void *data);
729 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
730 int count, int *eof, void *data);
731 extern int lprocfs_quota_wr_qs_factor(struct file *file,
733 unsigned long count, void *data);
738 /* LPROCFS is not defined */
742 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
743 int index, long amount)
745 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
748 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
749 int index, long amount)
751 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
754 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
755 int index, unsigned conf,
756 const char *name, const char *units)
759 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
760 enum lprocfs_fields_flags field)
763 /* NB: we return !NULL to satisfy error checker */
764 static inline struct lprocfs_stats *
765 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
766 { return (struct lprocfs_stats *)1; }
767 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
769 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
771 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
773 struct lprocfs_stats *stats)
775 static inline void lprocfs_init_ops_stats(int num_private_stats,
776 struct lprocfs_stats *stats)
778 static inline void lprocfs_init_mps_stats(int num_private_stats,
779 struct lprocfs_stats *stats)
781 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
783 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
784 unsigned int num_private_stats)
786 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
787 unsigned int num_private_stats)
789 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
791 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
795 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
797 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
800 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
802 static inline cfs_proc_dir_entry_t *
803 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
804 cfs_read_proc_t *read_proc, cfs_write_proc_t *write_proc,
805 void *data, struct file_operations *fops)
807 static inline struct proc_dir_entry *
808 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
809 const char *format, ...)
811 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
814 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
815 unsigned long count, void *data)
818 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
819 int count, int *eof, void *data)
822 static inline cfs_proc_dir_entry_t *
823 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
824 struct lprocfs_vars *list, void *data)
826 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
827 struct lprocfs_vars *var,
830 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
832 static inline void lprocfs_remove_proc_entry(const char *name,
833 struct proc_dir_entry *parent)
835 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
838 static inline int lprocfs_obd_setup(struct obd_device *dev,
839 struct lprocfs_vars *list)
841 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
843 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
844 int count, int *eof, void *data)
846 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
847 int count, int *eof, void *data)
849 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
850 int count, int *eof, void *data)
852 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
853 int count, int *eof, void *data)
855 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
856 int count, int *eof, void *data)
858 static inline int lprocfs_rd_import(char *page, char **start, off_t off,
859 int count, int *eof, void *data)
861 static inline int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
862 int count, int *eof, void *data)
864 static inline int lprocfs_rd_state(char *page, char **start, off_t off,
865 int count, int *eof, void *data)
867 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
868 int count, int *eof, void *data)
870 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
871 int count, int *eof, void *data)
873 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
874 int count, int *eof, void *data)
876 struct adaptive_timeout;
877 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
878 struct adaptive_timeout *at)
880 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
881 int count, int *eof, void *data)
883 static inline int lprocfs_wr_timeouts(struct file *file,
885 unsigned long count, void *data)
887 static inline int lprocfs_wr_evict_client(struct file *file,
889 unsigned long count, void *data)
891 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
892 unsigned long count, void *data)
894 static inline int lprocfs_wr_import(struct file *file, const char *buffer,
895 unsigned long count, void *data)
897 static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
898 unsigned long count, void *data)
903 int lprocfs_rd_blksize(char *page, char **start, off_t off,
904 int count, int *eof, void *data)
907 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
908 int count, int *eof, void *data)
911 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
912 int count, int *eof, void *data)
915 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
916 int count, int *eof, void *data)
919 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
920 int count, int *eof, void *data)
923 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
924 int count, int *eof, void *data)
927 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
928 int count, int *eof, void *data)
931 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
934 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
937 void lprocfs_oh_clear(struct obd_histogram *oh)
940 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
943 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
944 struct lprocfs_counter *cnt)
947 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
948 enum lprocfs_fields_flags field)
951 #define LPROC_SEQ_FOPS_RO(name)
952 #define LPROC_SEQ_FOPS(name)
955 #define target_print_req NULL
959 #endif /* LPROCFS_SNMP_H */