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.
32 * Copyright (c) 2011, 2012, Whamcloud, Inc.
35 * This file is part of Lustre, http://www.lustre.org/
36 * Lustre is a trademark of Sun Microsystems, Inc.
38 * lustre/include/lprocfs_status.h
40 * Top level header file for LProc SNMP
42 * Author: Hariharan Thantry thantry@users.sourceforge.net
44 #ifndef _LPROCFS_SNMP_H
45 #define _LPROCFS_SNMP_H
47 #if defined(__linux__)
48 #include <linux/lprocfs_status.h>
49 #elif defined(__APPLE__)
50 #include <darwin/lprocfs_status.h>
51 #elif defined(__WINNT__)
52 #include <winnt/lprocfs_status.h>
54 #error Unsupported operating system.
56 #include <lustre/lustre_idl.h>
57 #include <libcfs/params_tree.h>
61 cfs_read_proc_t *read_fptr;
62 cfs_write_proc_t *write_fptr;
64 struct file_operations *fops;
71 struct lprocfs_static_vars {
72 struct lprocfs_vars *module_vars;
73 struct lprocfs_vars *obd_vars;
76 /* if we find more consumers this could be generalized */
77 #define OBD_HIST_MAX 32
78 struct obd_histogram {
79 cfs_spinlock_t oh_lock;
80 unsigned long oh_buckets[OBD_HIST_MAX];
102 struct obd_histogram hist[BRW_LAST];
106 RENAME_SAMEDIR_SIZE = 0,
107 RENAME_CROSSDIR_SRC_SIZE,
108 RENAME_CROSSDIR_TGT_SIZE,
112 struct rename_stats {
113 struct obd_histogram hist[RENAME_LAST];
116 /* An lprocfs counter can be configured using the enum bit masks below.
118 * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
119 * protects this counter from concurrent updates. If not specified,
120 * lprocfs an internal per-counter lock variable. External locks are
121 * not used to protect counter increments, but are used to protect
122 * counter readout and resets.
124 * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
125 * (i.e. counter can be incremented by more than "1"). When specified,
126 * the counter maintains min, max and sum in addition to a simple
127 * invocation count. This allows averages to be be computed.
128 * If not specified, the counter is an increment-by-1 counter.
129 * min, max, sum, etc. are not maintained.
131 * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
132 * squares (for multi-valued counter samples only). This allows
133 * external computation of standard deviation, but involves a 64-bit
134 * multiply per counter increment.
138 LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
139 LPROCFS_CNTR_AVGMINMAX = 0x0002,
140 LPROCFS_CNTR_STDDEV = 0x0004,
142 /* counter data type */
143 LPROCFS_TYPE_REGS = 0x0100,
144 LPROCFS_TYPE_BYTES = 0x0200,
145 LPROCFS_TYPE_PAGES = 0x0400,
146 LPROCFS_TYPE_CYCLE = 0x0800,
149 struct lprocfs_atomic {
150 cfs_atomic_t la_entry;
151 cfs_atomic_t la_exit;
154 #define LC_MIN_INIT ((~(__u64)0) >> 1)
156 struct lprocfs_counter {
157 struct lprocfs_atomic lc_cntl; /* may need to move to per set */
158 unsigned int lc_config;
165 const char *lc_name; /* must be static */
166 const char *lc_units; /* must be static */
169 struct lprocfs_percpu {
170 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
173 struct lprocfs_counter lp_cntr[0];
176 #define LPROCFS_GET_NUM_CPU 0x0001
177 #define LPROCFS_GET_SMP_ID 0x0002
179 enum lprocfs_stats_flags {
180 LPROCFS_STATS_FLAG_NONE = 0x0000, /* per cpu counter */
181 LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
182 * area and need locking */
185 enum lprocfs_fields_flags {
186 LPROCFS_FIELDS_FLAGS_CONFIG = 0x0001,
187 LPROCFS_FIELDS_FLAGS_SUM = 0x0002,
188 LPROCFS_FIELDS_FLAGS_MIN = 0x0003,
189 LPROCFS_FIELDS_FLAGS_MAX = 0x0004,
190 LPROCFS_FIELDS_FLAGS_AVG = 0x0005,
191 LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006,
192 LPROCFS_FIELDS_FLAGS_COUNT = 0x0007,
195 struct lprocfs_stats {
196 unsigned int ls_num; /* # of counters */
197 int ls_flags; /* See LPROCFS_STATS_FLAG_* */
198 cfs_spinlock_t ls_lock; /* Lock used only when there are
199 * no percpu stats areas */
200 struct lprocfs_percpu *ls_percpu[0];
203 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
205 /* Pack all opcodes down into a single monotonically increasing index */
206 static inline int opcode_offset(__u32 opc) {
207 if (opc < OST_LAST_OPC) {
209 return (opc - OST_FIRST_OPC);
210 } else if (opc < MDS_LAST_OPC) {
212 return (opc - MDS_FIRST_OPC +
214 } else if (opc < LDLM_LAST_OPC) {
216 return (opc - LDLM_FIRST_OPC +
219 } else if (opc < MGS_LAST_OPC) {
221 return (opc - MGS_FIRST_OPC +
225 } else if (opc < OBD_LAST_OPC) {
227 return (opc - OBD_FIRST_OPC +
232 } else if (opc < LLOG_LAST_OPC) {
234 return (opc - LLOG_FIRST_OPC +
240 } else if (opc < QUOTA_LAST_OPC) {
242 return (opc - QUOTA_FIRST_OPC +
249 } else if (opc < SEQ_LAST_OPC) {
251 return (opc - SEQ_FIRST_OPC +
259 } else if (opc < SEC_LAST_OPC) {
261 return (opc - SEC_FIRST_OPC +
270 } else if (opc < FLD_LAST_OPC) {
272 return (opc - FLD_FIRST_OPC +
289 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST) + \
300 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
304 PTLRPC_REQWAIT_CNTR = 0,
305 PTLRPC_REQQDEPTH_CNTR,
306 PTLRPC_REQACTIVE_CNTR,
308 PTLRPC_REQBUF_AVAIL_CNTR,
312 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
315 LDLM_GLIMPSE_ENQUEUE = 0,
332 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
334 extern cfs_proc_dir_entry_t *proc_lustre_root;
337 struct obd_histogram;
339 /* Days / hours / mins / seconds format */
343 static inline void s2dhms(struct dhms *ts, time_t secs)
345 ts->d = secs / 86400;
352 #define DHMS_FMT "%dd%dh%02dm%02ds"
353 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
358 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc)
364 case LPROCFS_GET_SMP_ID:
365 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
366 cfs_spin_lock(&stats->ls_lock);
369 return cfs_get_cpu();
372 case LPROCFS_GET_NUM_CPU:
373 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
374 cfs_spin_lock(&stats->ls_lock);
377 return cfs_num_possible_cpus();
382 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats, int opc)
388 case LPROCFS_GET_SMP_ID:
389 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
390 cfs_spin_unlock(&stats->ls_lock);
395 case LPROCFS_GET_NUM_CPU:
396 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
397 cfs_spin_unlock(&stats->ls_lock);
402 /* Two optimized LPROCFS counter increment functions are provided:
403 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
404 * lprocfs_counter_add(cntr) - use for multi-valued counters
405 * Counter data layout allows config flag, counter lock and the
406 * count itself to reside within a single cache line.
409 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
411 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
414 #define lprocfs_counter_incr(stats, idx) \
415 lprocfs_counter_add(stats, idx, 1)
416 #define lprocfs_counter_decr(stats, idx) \
417 lprocfs_counter_sub(stats, idx, 1)
419 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
420 enum lprocfs_fields_flags field);
421 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
423 enum lprocfs_fields_flags field)
427 unsigned int num_cpu;
429 LASSERT(stats != NULL);
431 num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU);
432 for (i = 0; i < num_cpu; i++)
433 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
435 lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU);
439 extern struct lprocfs_stats *
440 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
441 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
442 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
443 extern void lprocfs_init_ops_stats(int num_private_stats,
444 struct lprocfs_stats *stats);
445 extern void lprocfs_init_mps_stats(int num_private_stats,
446 struct lprocfs_stats *stats);
447 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
448 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
449 unsigned int num_private_stats);
450 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
451 unsigned int num_private_stats);
452 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
453 unsigned conf, const char *name,
455 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
456 extern void lprocfs_free_md_stats(struct obd_device *obddev);
459 extern int lprocfs_add_clear_entry(struct obd_device * obd,
460 cfs_proc_dir_entry_t *entry);
461 extern int lprocfs_exp_setup(struct obd_export *exp,
462 lnet_nid_t *peer_nid, int *newnid);
463 extern int lprocfs_exp_cleanup(struct obd_export *exp);
464 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
466 cfs_read_proc_t *read_proc,
467 cfs_write_proc_t *write_proc,
469 struct file_operations *fops);
470 extern struct proc_dir_entry *
471 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
472 const char *format, ...);
473 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
475 lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
476 unsigned long count, void *data);
477 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
478 int count, int *eof, void *data);
480 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
481 struct lprocfs_stats *stats);
483 /* lprocfs_status.c */
484 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
485 struct lprocfs_vars *var,
488 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
489 cfs_proc_dir_entry_t *parent,
490 struct lprocfs_vars *list,
493 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
494 extern void lprocfs_remove_proc_entry(const char *name,
495 struct proc_dir_entry *parent);
497 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
500 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
501 extern int lprocfs_obd_cleanup(struct obd_device *obd);
502 extern struct file_operations lprocfs_evict_client_fops;
504 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name,
505 mode_t mode, struct file_operations *seq_fops,
507 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
508 mode_t mode, struct file_operations *seq_fops,
511 /* Generic callbacks */
513 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
514 int count, int *eof, void *data);
515 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
516 int count, int *eof, void *data);
517 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
518 unsigned long count, void *data);
519 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
520 int count, int *eof, void *data);
521 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
522 unsigned long count, void *data);
523 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
524 int count, int *eof, void *data);
525 extern int lprocfs_rd_name(char *page, char **start, off_t off,
526 int count, int *eof, void *data);
527 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
528 int count, int *eof, void *data);
529 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
530 int count, int *eof, void *data);
531 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
532 int count, int *eof, void *data);
533 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
534 int *eof, void *data);
535 extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
536 int *eof, void *data);
537 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
538 int count, int *eof, void *data);
539 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
540 int count, int *eof, void *data);
541 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
542 int count, int *eof, void *data);
543 struct adaptive_timeout;
544 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
545 struct adaptive_timeout *at);
546 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
547 int count, int *eof, void *data);
548 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
549 unsigned long count, void *data);
550 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
551 unsigned long count, void *data);
552 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
553 unsigned long count, void *data);
554 extern int lprocfs_wr_import(struct file *file, const char *buffer,
555 unsigned long count, void *data);
556 extern int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
557 int count, int *eof, void *data);
558 extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
559 unsigned long count, void *data);
562 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
563 int count, int *eof, void *data);
564 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
565 int count, int *eof, void *data);
566 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
567 int count, int *eof, void *data);
568 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
569 int count, int *eof, void *data);
570 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
571 int count, int *eof, void *data);
572 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
573 int count, int *eof, void *data);
574 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
575 int count, int *eof, void *data);
577 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
579 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
581 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
583 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
585 extern int lprocfs_write_frac_u64_helper(const char *buffer,
587 __u64 *val, int mult);
588 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
589 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
590 void lprocfs_oh_clear(struct obd_histogram *oh);
591 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
593 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
594 struct lprocfs_counter *cnt);
596 /* lprocfs_status.c: recovery status */
597 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
598 int count, int *eof, void *data);
600 /* lprocfs_statuc.c: hash statistics */
601 int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
602 int count, int *eof, void *data);
604 /* lprocfs_status.c: IR factor */
605 int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
606 int count, int *eof, void *data);
607 int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer,
608 unsigned long count, void *data);
610 extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
612 /* You must use these macros when you want to refer to
613 * the import in a client obd_device for a lprocfs entry */
614 #define LPROCFS_CLIMP_CHECK(obd) do { \
615 typecheck(struct obd_device *, obd); \
616 cfs_down_read(&(obd)->u.cli.cl_sem); \
617 if ((obd)->u.cli.cl_import == NULL) { \
618 cfs_up_read(&(obd)->u.cli.cl_sem); \
622 #define LPROCFS_CLIMP_EXIT(obd) \
623 cfs_up_read(&(obd)->u.cli.cl_sem);
626 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
627 proc entries; otherwise, you will define name##_seq_write function also for
628 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
629 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
630 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
631 static int name##_seq_open(cfs_inode_t *inode, struct file *file) { \
632 struct proc_dir_entry *dp = PDE(inode); \
634 LPROCFS_ENTRY_AND_CHECK(dp); \
635 rc = single_open(file, name##_seq_show, dp->data); \
642 struct file_operations name##_fops = { \
643 .owner = THIS_MODULE, \
644 .open = name##_seq_open, \
646 .write = custom_seq_write, \
647 .llseek = seq_lseek, \
648 .release = lprocfs_seq_release, \
651 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
652 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
655 struct ptlrpc_request;
656 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
659 int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
660 int count, int *eof, void *data);
661 int lprocfs_obd_wr_recovery_time_soft(struct file *file,
663 unsigned long count, void *data);
664 int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
665 int count, int *eof, void *data);
666 int lprocfs_obd_wr_recovery_time_hard(struct file *file,
668 unsigned long count, void *data);
669 int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
670 int count, int *eof, void *data);
671 int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
672 int count, int *eof, void *data);
673 int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
674 unsigned long count, void *data);
675 int lprocfs_target_rd_instance(char *page, char **start, off_t off,
676 int count, int *eof, void *data);
678 /* all quota proc functions */
679 extern int lprocfs_quota_rd_bunit(char *page, char **start,
680 off_t off, int count,
681 int *eof, void *data);
682 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
683 unsigned long count, void *data);
684 extern int lprocfs_quota_rd_btune(char *page, char **start,
685 off_t off, int count,
686 int *eof, void *data);
687 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
688 unsigned long count, void *data);
689 extern int lprocfs_quota_rd_iunit(char *page, char **start,
690 off_t off, int count,
691 int *eof, void *data);
692 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
693 unsigned long count, void *data);
694 extern int lprocfs_quota_rd_itune(char *page, char **start,
695 off_t off, int count,
696 int *eof, void *data);
697 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
698 unsigned long count, void *data);
699 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
700 int *eof, void *data);
701 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
702 unsigned long count, void *data);
703 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
704 int count, int *eof, void *data);
705 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
707 unsigned long count, void *data);
708 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
709 int count, int *eof, void *data);
710 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
711 unsigned long count, void *data);
712 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
713 int count, int *eof, void *data);
714 extern int lprocfs_quota_wr_switch_qs(struct file *file,
716 unsigned long count, void *data);
717 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
718 int count, int *eof, void *data);
719 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
721 unsigned long count, void *data);
722 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
723 int count, int *eof, void *data);
724 extern int lprocfs_quota_wr_least_bunit(struct file *file,
726 unsigned long count, void *data);
727 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
728 int count, int *eof, void *data);
729 extern int lprocfs_quota_wr_least_iunit(struct file *file,
731 unsigned long count, void *data);
732 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
733 int count, int *eof, void *data);
734 extern int lprocfs_quota_wr_qs_factor(struct file *file,
736 unsigned long count, void *data);
741 /* LPROCFS is not defined */
745 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
746 int index, long amount)
748 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
751 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
752 int index, long amount)
754 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
757 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
758 int index, unsigned conf,
759 const char *name, const char *units)
762 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
763 enum lprocfs_fields_flags field)
766 /* NB: we return !NULL to satisfy error checker */
767 static inline struct lprocfs_stats *
768 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
769 { return (struct lprocfs_stats *)1; }
770 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
772 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
774 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
776 struct lprocfs_stats *stats)
778 static inline void lprocfs_init_ops_stats(int num_private_stats,
779 struct lprocfs_stats *stats)
781 static inline void lprocfs_init_mps_stats(int num_private_stats,
782 struct lprocfs_stats *stats)
784 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
786 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
787 unsigned int num_private_stats)
789 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
790 unsigned int num_private_stats)
792 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
794 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
798 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
800 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
803 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
805 static inline cfs_proc_dir_entry_t *
806 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
807 cfs_read_proc_t *read_proc, cfs_write_proc_t *write_proc,
808 void *data, struct file_operations *fops)
810 static inline struct proc_dir_entry *
811 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
812 const char *format, ...)
814 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
817 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
818 unsigned long count, void *data)
821 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
822 int count, int *eof, void *data)
825 static inline cfs_proc_dir_entry_t *
826 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
827 struct lprocfs_vars *list, void *data)
829 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
830 struct lprocfs_vars *var,
833 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
835 static inline void lprocfs_remove_proc_entry(const char *name,
836 struct proc_dir_entry *parent)
838 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
841 static inline int lprocfs_obd_setup(struct obd_device *dev,
842 struct lprocfs_vars *list)
844 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
846 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
847 int count, int *eof, void *data)
849 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
850 int count, int *eof, void *data)
852 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
853 int count, int *eof, void *data)
855 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
856 int count, int *eof, void *data)
858 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
859 int count, int *eof, void *data)
861 static inline int lprocfs_rd_import(char *page, char **start, off_t off,
862 int count, int *eof, void *data)
864 static inline int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
865 int count, int *eof, void *data)
867 static inline int lprocfs_rd_state(char *page, char **start, off_t off,
868 int count, int *eof, void *data)
870 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
871 int count, int *eof, void *data)
873 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
874 int count, int *eof, void *data)
876 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
877 int count, int *eof, void *data)
879 struct adaptive_timeout;
880 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
881 struct adaptive_timeout *at)
883 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
884 int count, int *eof, void *data)
886 static inline int lprocfs_wr_timeouts(struct file *file,
888 unsigned long count, void *data)
890 static inline int lprocfs_wr_evict_client(struct file *file,
892 unsigned long count, void *data)
894 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
895 unsigned long count, void *data)
897 static inline int lprocfs_wr_import(struct file *file, const char *buffer,
898 unsigned long count, void *data)
900 static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
901 unsigned long count, void *data)
906 int lprocfs_rd_blksize(char *page, char **start, off_t off,
907 int count, int *eof, void *data)
910 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
911 int count, int *eof, void *data)
914 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
915 int count, int *eof, void *data)
918 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
919 int count, int *eof, void *data)
922 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
923 int count, int *eof, void *data)
926 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
927 int count, int *eof, void *data)
930 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
931 int count, int *eof, void *data)
934 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
937 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
940 void lprocfs_oh_clear(struct obd_histogram *oh)
943 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
946 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
947 struct lprocfs_counter *cnt)
950 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
951 enum lprocfs_fields_flags field)
954 #define LPROC_SEQ_FOPS_RO(name)
955 #define LPROC_SEQ_FOPS(name)
958 #define target_print_req NULL
962 #endif /* LPROCFS_SNMP_H */