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)
428 LASSERT(stats != NULL);
429 for (i = 0; i < cfs_num_possible_cpus(); i++)
430 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
435 extern struct lprocfs_stats *
436 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
437 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
438 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
439 extern void lprocfs_init_ops_stats(int num_private_stats,
440 struct lprocfs_stats *stats);
441 extern void lprocfs_init_mps_stats(int num_private_stats,
442 struct lprocfs_stats *stats);
443 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
444 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
445 unsigned int num_private_stats);
446 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
447 unsigned int num_private_stats);
448 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
449 unsigned conf, const char *name,
451 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
452 extern void lprocfs_free_md_stats(struct obd_device *obddev);
455 extern int lprocfs_add_clear_entry(struct obd_device * obd,
456 cfs_proc_dir_entry_t *entry);
457 extern int lprocfs_exp_setup(struct obd_export *exp,
458 lnet_nid_t *peer_nid, int *newnid);
459 extern int lprocfs_exp_cleanup(struct obd_export *exp);
460 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
462 cfs_read_proc_t *read_proc,
463 cfs_write_proc_t *write_proc,
465 struct file_operations *fops);
466 extern struct proc_dir_entry *
467 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
468 const char *format, ...);
469 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
471 lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
472 unsigned long count, void *data);
473 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
474 int count, int *eof, void *data);
476 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
477 struct lprocfs_stats *stats);
479 /* lprocfs_status.c */
480 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
481 struct lprocfs_vars *var,
484 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
485 cfs_proc_dir_entry_t *parent,
486 struct lprocfs_vars *list,
489 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
490 extern void lprocfs_remove_proc_entry(const char *name,
491 struct proc_dir_entry *parent);
493 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
496 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
497 extern int lprocfs_obd_cleanup(struct obd_device *obd);
498 extern struct file_operations lprocfs_evict_client_fops;
500 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name,
501 mode_t mode, struct file_operations *seq_fops,
503 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
504 mode_t mode, struct file_operations *seq_fops,
507 /* Generic callbacks */
509 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
510 int count, int *eof, void *data);
511 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
512 int count, int *eof, void *data);
513 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
514 unsigned long count, void *data);
515 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
516 int count, int *eof, void *data);
517 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
518 unsigned long count, void *data);
519 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
520 int count, int *eof, void *data);
521 extern int lprocfs_rd_name(char *page, char **start, off_t off,
522 int count, int *eof, void *data);
523 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
524 int count, int *eof, void *data);
525 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
526 int count, int *eof, void *data);
527 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
528 int count, int *eof, void *data);
529 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
530 int *eof, void *data);
531 extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
532 int *eof, void *data);
533 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
534 int count, int *eof, void *data);
535 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
536 int count, int *eof, void *data);
537 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
538 int count, int *eof, void *data);
539 struct adaptive_timeout;
540 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
541 struct adaptive_timeout *at);
542 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
543 int count, int *eof, void *data);
544 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
545 unsigned long count, void *data);
546 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
547 unsigned long count, void *data);
548 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
549 unsigned long count, void *data);
550 extern int lprocfs_wr_import(struct file *file, const char *buffer,
551 unsigned long count, void *data);
552 extern int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
553 int count, int *eof, void *data);
554 extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
555 unsigned long count, void *data);
558 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
559 int count, int *eof, void *data);
560 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
561 int count, int *eof, void *data);
562 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
563 int count, int *eof, void *data);
564 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
565 int count, int *eof, void *data);
566 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
567 int count, int *eof, void *data);
568 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
569 int count, int *eof, void *data);
570 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
571 int count, int *eof, void *data);
573 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
575 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
577 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
579 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
581 extern int lprocfs_write_frac_u64_helper(const char *buffer,
583 __u64 *val, int mult);
584 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
585 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
586 void lprocfs_oh_clear(struct obd_histogram *oh);
587 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
589 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
590 struct lprocfs_counter *cnt);
592 /* lprocfs_status.c: recovery status */
593 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
594 int count, int *eof, void *data);
596 /* lprocfs_statuc.c: hash statistics */
597 int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
598 int count, int *eof, void *data);
600 /* lprocfs_status.c: IR factor */
601 int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
602 int count, int *eof, void *data);
603 int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer,
604 unsigned long count, void *data);
606 extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
608 /* You must use these macros when you want to refer to
609 * the import in a client obd_device for a lprocfs entry */
610 #define LPROCFS_CLIMP_CHECK(obd) do { \
611 typecheck(struct obd_device *, obd); \
612 cfs_down_read(&(obd)->u.cli.cl_sem); \
613 if ((obd)->u.cli.cl_import == NULL) { \
614 cfs_up_read(&(obd)->u.cli.cl_sem); \
618 #define LPROCFS_CLIMP_EXIT(obd) \
619 cfs_up_read(&(obd)->u.cli.cl_sem);
622 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
623 proc entries; otherwise, you will define name##_seq_write function also for
624 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
625 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
626 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
627 static int name##_seq_open(cfs_inode_t *inode, struct file *file) { \
628 struct proc_dir_entry *dp = PDE(inode); \
630 LPROCFS_ENTRY_AND_CHECK(dp); \
631 rc = single_open(file, name##_seq_show, dp->data); \
638 struct file_operations name##_fops = { \
639 .owner = THIS_MODULE, \
640 .open = name##_seq_open, \
642 .write = custom_seq_write, \
643 .llseek = seq_lseek, \
644 .release = lprocfs_seq_release, \
647 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
648 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
651 struct ptlrpc_request;
652 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
655 int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
656 int count, int *eof, void *data);
657 int lprocfs_obd_wr_recovery_time_soft(struct file *file,
659 unsigned long count, void *data);
660 int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
661 int count, int *eof, void *data);
662 int lprocfs_obd_wr_recovery_time_hard(struct file *file,
664 unsigned long count, void *data);
665 int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
666 int count, int *eof, void *data);
667 int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
668 int count, int *eof, void *data);
669 int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
670 unsigned long count, void *data);
671 int lprocfs_target_rd_instance(char *page, char **start, off_t off,
672 int count, int *eof, void *data);
674 /* all quota proc functions */
675 extern int lprocfs_quota_rd_bunit(char *page, char **start,
676 off_t off, int count,
677 int *eof, void *data);
678 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
679 unsigned long count, void *data);
680 extern int lprocfs_quota_rd_btune(char *page, char **start,
681 off_t off, int count,
682 int *eof, void *data);
683 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
684 unsigned long count, void *data);
685 extern int lprocfs_quota_rd_iunit(char *page, char **start,
686 off_t off, int count,
687 int *eof, void *data);
688 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
689 unsigned long count, void *data);
690 extern int lprocfs_quota_rd_itune(char *page, char **start,
691 off_t off, int count,
692 int *eof, void *data);
693 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
694 unsigned long count, void *data);
695 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
696 int *eof, void *data);
697 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
698 unsigned long count, void *data);
699 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
700 int count, int *eof, void *data);
701 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
703 unsigned long count, void *data);
704 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
705 int count, int *eof, void *data);
706 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
707 unsigned long count, void *data);
708 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
709 int count, int *eof, void *data);
710 extern int lprocfs_quota_wr_switch_qs(struct file *file,
712 unsigned long count, void *data);
713 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
714 int count, int *eof, void *data);
715 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
717 unsigned long count, void *data);
718 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
719 int count, int *eof, void *data);
720 extern int lprocfs_quota_wr_least_bunit(struct file *file,
722 unsigned long count, void *data);
723 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
724 int count, int *eof, void *data);
725 extern int lprocfs_quota_wr_least_iunit(struct file *file,
727 unsigned long count, void *data);
728 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
729 int count, int *eof, void *data);
730 extern int lprocfs_quota_wr_qs_factor(struct file *file,
732 unsigned long count, void *data);
737 /* LPROCFS is not defined */
741 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
742 int index, long amount)
744 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
747 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
748 int index, long amount)
750 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
753 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
754 int index, unsigned conf,
755 const char *name, const char *units)
758 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
759 enum lprocfs_fields_flags field)
762 /* NB: we return !NULL to satisfy error checker */
763 static inline struct lprocfs_stats *
764 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
765 { return (struct lprocfs_stats *)1; }
766 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
768 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
770 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
772 struct lprocfs_stats *stats)
774 static inline void lprocfs_init_ops_stats(int num_private_stats,
775 struct lprocfs_stats *stats)
777 static inline void lprocfs_init_mps_stats(int num_private_stats,
778 struct lprocfs_stats *stats)
780 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
782 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
783 unsigned int num_private_stats)
785 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
786 unsigned int num_private_stats)
788 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
790 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
794 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
796 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
799 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
801 static inline cfs_proc_dir_entry_t *
802 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
803 cfs_read_proc_t *read_proc, cfs_write_proc_t *write_proc,
804 void *data, struct file_operations *fops)
806 static inline struct proc_dir_entry *
807 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
808 const char *format, ...)
810 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
813 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
814 unsigned long count, void *data)
817 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
818 int count, int *eof, void *data)
821 static inline cfs_proc_dir_entry_t *
822 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
823 struct lprocfs_vars *list, void *data)
825 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
826 struct lprocfs_vars *var,
829 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
831 static inline void lprocfs_remove_proc_entry(const char *name,
832 struct proc_dir_entry *parent)
834 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
837 static inline int lprocfs_obd_setup(struct obd_device *dev,
838 struct lprocfs_vars *list)
840 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
842 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
843 int count, int *eof, void *data)
845 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
846 int count, int *eof, void *data)
848 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
849 int count, int *eof, void *data)
851 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
852 int count, int *eof, void *data)
854 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
855 int count, int *eof, void *data)
857 static inline int lprocfs_rd_import(char *page, char **start, off_t off,
858 int count, int *eof, void *data)
860 static inline int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
861 int count, int *eof, void *data)
863 static inline int lprocfs_rd_state(char *page, char **start, off_t off,
864 int count, int *eof, void *data)
866 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
867 int count, int *eof, void *data)
869 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
870 int count, int *eof, void *data)
872 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
873 int count, int *eof, void *data)
875 struct adaptive_timeout;
876 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
877 struct adaptive_timeout *at)
879 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
880 int count, int *eof, void *data)
882 static inline int lprocfs_wr_timeouts(struct file *file,
884 unsigned long count, void *data)
886 static inline int lprocfs_wr_evict_client(struct file *file,
888 unsigned long count, void *data)
890 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
891 unsigned long count, void *data)
893 static inline int lprocfs_wr_import(struct file *file, const char *buffer,
894 unsigned long count, void *data)
896 static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
897 unsigned long count, void *data)
902 int lprocfs_rd_blksize(char *page, char **start, off_t off,
903 int count, int *eof, void *data)
906 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
907 int count, int *eof, void *data)
910 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
911 int count, int *eof, void *data)
914 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
915 int count, int *eof, void *data)
918 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
919 int count, int *eof, void *data)
922 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
923 int count, int *eof, void *data)
926 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
927 int count, int *eof, void *data)
930 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
933 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
936 void lprocfs_oh_clear(struct obd_histogram *oh)
939 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
942 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
943 struct lprocfs_counter *cnt)
946 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
947 enum lprocfs_fields_flags field)
950 #define LPROC_SEQ_FOPS_RO(name)
951 #define LPROC_SEQ_FOPS(name)
954 #define target_print_req NULL
958 #endif /* LPROCFS_SNMP_H */