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 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/include/lprocfs_status.h
38 * Top level header file for LProc SNMP
40 * Author: Hariharan Thantry thantry@users.sourceforge.net
42 #ifndef _LPROCFS_SNMP_H
43 #define _LPROCFS_SNMP_H
45 #if defined(__linux__)
46 #include <linux/lprocfs_status.h>
47 #elif defined(__APPLE__)
48 #include <darwin/lprocfs_status.h>
49 #elif defined(__WINNT__)
50 #include <winnt/lprocfs_status.h>
52 #error Unsupported operating system.
54 #include <lustre/lustre_idl.h>
55 #include <libcfs/params_tree.h>
59 cfs_read_proc_t *read_fptr;
60 cfs_write_proc_t *write_fptr;
62 struct file_operations *fops;
69 struct lprocfs_static_vars {
70 struct lprocfs_vars *module_vars;
71 struct lprocfs_vars *obd_vars;
74 /* if we find more consumers this could be generalized */
75 #define OBD_HIST_MAX 32
76 struct obd_histogram {
77 cfs_spinlock_t oh_lock;
78 unsigned long oh_buckets[OBD_HIST_MAX];
100 struct obd_histogram hist[BRW_LAST];
104 /* An lprocfs counter can be configured using the enum bit masks below.
106 * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
107 * protects this counter from concurrent updates. If not specified,
108 * lprocfs an internal per-counter lock variable. External locks are
109 * not used to protect counter increments, but are used to protect
110 * counter readout and resets.
112 * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
113 * (i.e. counter can be incremented by more than "1"). When specified,
114 * the counter maintains min, max and sum in addition to a simple
115 * invocation count. This allows averages to be be computed.
116 * If not specified, the counter is an increment-by-1 counter.
117 * min, max, sum, etc. are not maintained.
119 * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
120 * squares (for multi-valued counter samples only). This allows
121 * external computation of standard deviation, but involves a 64-bit
122 * multiply per counter increment.
126 LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
127 LPROCFS_CNTR_AVGMINMAX = 0x0002,
128 LPROCFS_CNTR_STDDEV = 0x0004,
130 /* counter data type */
131 LPROCFS_TYPE_REGS = 0x0100,
132 LPROCFS_TYPE_BYTES = 0x0200,
133 LPROCFS_TYPE_PAGES = 0x0400,
134 LPROCFS_TYPE_CYCLE = 0x0800,
137 struct lprocfs_atomic {
138 cfs_atomic_t la_entry;
139 cfs_atomic_t la_exit;
142 #define LC_MIN_INIT ((~(__u64)0) >> 1)
144 struct lprocfs_counter {
145 struct lprocfs_atomic lc_cntl; /* may need to move to per set */
146 unsigned int lc_config;
153 const char *lc_name; /* must be static */
154 const char *lc_units; /* must be static */
157 struct lprocfs_percpu {
158 struct lprocfs_counter lp_cntr[0];
161 #define LPROCFS_GET_NUM_CPU 0x0001
162 #define LPROCFS_GET_SMP_ID 0x0002
164 enum lprocfs_stats_flags {
165 LPROCFS_STATS_FLAG_NONE = 0x0000, /* per cpu counter */
166 LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
167 * area and need locking */
170 enum lprocfs_fields_flags {
171 LPROCFS_FIELDS_FLAGS_CONFIG = 0x0001,
172 LPROCFS_FIELDS_FLAGS_SUM = 0x0002,
173 LPROCFS_FIELDS_FLAGS_MIN = 0x0003,
174 LPROCFS_FIELDS_FLAGS_MAX = 0x0004,
175 LPROCFS_FIELDS_FLAGS_AVG = 0x0005,
176 LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006,
177 LPROCFS_FIELDS_FLAGS_COUNT = 0x0007,
180 struct lprocfs_stats {
181 unsigned int ls_num; /* # of counters */
182 int ls_flags; /* See LPROCFS_STATS_FLAG_* */
183 cfs_spinlock_t ls_lock; /* Lock used only when there are
184 * no percpu stats areas */
185 struct lprocfs_percpu *ls_percpu[0];
188 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
190 /* Pack all opcodes down into a single monotonically increasing index */
191 static inline int opcode_offset(__u32 opc) {
192 if (opc < OST_LAST_OPC) {
194 return (opc - OST_FIRST_OPC);
195 } else if (opc < MDS_LAST_OPC) {
197 return (opc - MDS_FIRST_OPC +
199 } else if (opc < LDLM_LAST_OPC) {
201 return (opc - LDLM_FIRST_OPC +
204 } else if (opc < MGS_LAST_OPC) {
206 return (opc - MGS_FIRST_OPC +
210 } else if (opc < OBD_LAST_OPC) {
212 return (opc - OBD_FIRST_OPC +
217 } else if (opc < LLOG_LAST_OPC) {
219 return (opc - LLOG_FIRST_OPC +
225 } else if (opc < QUOTA_LAST_OPC) {
227 return (opc - QUOTA_FIRST_OPC +
234 } else if (opc < SEQ_LAST_OPC) {
236 return (opc - SEQ_FIRST_OPC +
244 } else if (opc < SEC_LAST_OPC) {
246 return (opc - SEC_FIRST_OPC +
255 } else if (opc < FLD_LAST_OPC) {
257 return (opc - FLD_FIRST_OPC +
274 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST) + \
285 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
289 PTLRPC_REQWAIT_CNTR = 0,
290 PTLRPC_REQQDEPTH_CNTR,
291 PTLRPC_REQACTIVE_CNTR,
293 PTLRPC_REQBUF_AVAIL_CNTR,
297 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
300 LDLM_GLIMPSE_ENQUEUE = 0,
317 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
319 extern cfs_proc_dir_entry_t *proc_lustre_root;
322 struct obd_histogram;
324 /* Days / hours / mins / seconds format */
328 static inline void s2dhms(struct dhms *ts, time_t secs)
330 ts->d = secs / 86400;
337 #define DHMS_FMT "%dd%dh%02dm%02ds"
338 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
343 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc)
349 case LPROCFS_GET_SMP_ID:
350 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
351 cfs_spin_lock(&stats->ls_lock);
354 return cfs_get_cpu();
357 case LPROCFS_GET_NUM_CPU:
358 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
359 cfs_spin_lock(&stats->ls_lock);
362 return cfs_num_possible_cpus();
367 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats, int opc)
373 case LPROCFS_GET_SMP_ID:
374 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
375 cfs_spin_unlock(&stats->ls_lock);
380 case LPROCFS_GET_NUM_CPU:
381 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
382 cfs_spin_unlock(&stats->ls_lock);
387 /* Two optimized LPROCFS counter increment functions are provided:
388 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
389 * lprocfs_counter_add(cntr) - use for multi-valued counters
390 * Counter data layout allows config flag, counter lock and the
391 * count itself to reside within a single cache line.
394 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
396 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
399 #define lprocfs_counter_incr(stats, idx) \
400 lprocfs_counter_add(stats, idx, 1)
401 #define lprocfs_counter_decr(stats, idx) \
402 lprocfs_counter_sub(stats, idx, 1)
404 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
405 enum lprocfs_fields_flags field);
406 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
408 enum lprocfs_fields_flags field)
413 LASSERT(stats != NULL);
414 for (i = 0; i < cfs_num_possible_cpus(); i++)
415 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
420 extern struct lprocfs_stats *
421 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
422 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
423 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
424 extern void lprocfs_init_ops_stats(int num_private_stats,
425 struct lprocfs_stats *stats);
426 extern void lprocfs_init_mps_stats(int num_private_stats,
427 struct lprocfs_stats *stats);
428 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
429 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
430 unsigned int num_private_stats);
431 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
432 unsigned int num_private_stats);
433 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
434 unsigned conf, const char *name,
436 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
437 extern void lprocfs_free_md_stats(struct obd_device *obddev);
440 extern int lprocfs_add_clear_entry(struct obd_device * obd,
441 cfs_proc_dir_entry_t *entry);
442 extern int lprocfs_exp_setup(struct obd_export *exp,
443 lnet_nid_t *peer_nid, int *newnid);
444 extern int lprocfs_exp_cleanup(struct obd_export *exp);
445 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
447 cfs_read_proc_t *read_proc,
448 cfs_write_proc_t *write_proc,
450 struct file_operations *fops);
451 extern struct proc_dir_entry *
452 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
453 const char *format, ...);
454 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
456 lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
457 unsigned long count, void *data);
458 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
459 int count, int *eof, void *data);
461 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
462 struct lprocfs_stats *stats);
464 /* lprocfs_status.c */
465 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
466 struct lprocfs_vars *var,
469 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
470 cfs_proc_dir_entry_t *parent,
471 struct lprocfs_vars *list,
474 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
475 extern void lprocfs_remove_proc_entry(const char *name,
476 struct proc_dir_entry *parent);
478 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
481 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
482 extern int lprocfs_obd_cleanup(struct obd_device *obd);
483 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
484 extern struct file_operations lprocfs_evict_client_fops;
486 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name,
487 mode_t mode, struct file_operations *seq_fops,
489 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
490 mode_t mode, struct file_operations *seq_fops,
493 /* Generic callbacks */
495 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
496 int count, int *eof, void *data);
497 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
498 int count, int *eof, void *data);
499 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
500 unsigned long count, void *data);
501 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
502 int count, int *eof, void *data);
503 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
504 unsigned long count, void *data);
505 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
506 int count, int *eof, void *data);
507 extern int lprocfs_rd_name(char *page, char **start, off_t off,
508 int count, int *eof, void *data);
509 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
510 int count, int *eof, void *data);
511 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
512 int count, int *eof, void *data);
513 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
514 int count, int *eof, void *data);
515 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
516 int *eof, void *data);
517 extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
518 int *eof, void *data);
519 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
520 int count, int *eof, void *data);
521 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
522 int count, int *eof, void *data);
523 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
524 int count, int *eof, void *data);
525 struct adaptive_timeout;
526 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
527 struct adaptive_timeout *at);
528 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
529 int count, int *eof, void *data);
530 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
531 unsigned long count, void *data);
532 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
533 unsigned long count, void *data);
534 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
535 unsigned long count, void *data);
538 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
539 int count, int *eof, void *data);
540 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
541 int count, int *eof, void *data);
542 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
543 int count, int *eof, void *data);
544 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
545 int count, int *eof, void *data);
546 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
547 int count, int *eof, void *data);
548 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
549 int count, int *eof, void *data);
550 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
551 int count, int *eof, void *data);
553 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
555 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
557 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
559 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
561 extern int lprocfs_write_frac_u64_helper(const char *buffer,
563 __u64 *val, int mult);
564 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
565 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
566 void lprocfs_oh_clear(struct obd_histogram *oh);
567 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
569 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
570 struct lprocfs_counter *cnt);
572 /* lprocfs_status.c: recovery status */
573 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
574 int count, int *eof, void *data);
576 /* lprocfs_statuc.c: hash statistics */
577 int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
578 int count, int *eof, void *data);
580 extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
582 /* You must use these macros when you want to refer to
583 * the import in a client obd_device for a lprocfs entry */
584 #define LPROCFS_CLIMP_CHECK(obd) do { \
585 typecheck(struct obd_device *, obd); \
586 cfs_down_read(&(obd)->u.cli.cl_sem); \
587 if ((obd)->u.cli.cl_import == NULL) { \
588 cfs_up_read(&(obd)->u.cli.cl_sem); \
592 #define LPROCFS_CLIMP_EXIT(obd) \
593 cfs_up_read(&(obd)->u.cli.cl_sem);
596 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
597 proc entries; otherwise, you will define name##_seq_write function also for
598 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
599 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
600 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
601 static int name##_seq_open(cfs_inode_t *inode, struct file *file) { \
602 struct proc_dir_entry *dp = PDE(inode); \
604 LPROCFS_ENTRY_AND_CHECK(dp); \
605 rc = single_open(file, name##_seq_show, dp->data); \
612 struct file_operations name##_fops = { \
613 .owner = THIS_MODULE, \
614 .open = name##_seq_open, \
616 .write = custom_seq_write, \
617 .llseek = seq_lseek, \
618 .release = lprocfs_seq_release, \
621 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
622 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
625 struct ptlrpc_request;
626 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
629 int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
630 int count, int *eof, void *data);
631 int lprocfs_obd_wr_recovery_time_soft(struct file *file,
633 unsigned long count, void *data);
634 int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
635 int count, int *eof, void *data);
636 int lprocfs_obd_wr_recovery_time_hard(struct file *file,
638 unsigned long count, void *data);
639 int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
640 int count, int *eof, void *data);
641 /* all quota proc functions */
642 extern int lprocfs_quota_rd_bunit(char *page, char **start,
643 off_t off, int count,
644 int *eof, void *data);
645 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
646 unsigned long count, void *data);
647 extern int lprocfs_quota_rd_btune(char *page, char **start,
648 off_t off, int count,
649 int *eof, void *data);
650 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
651 unsigned long count, void *data);
652 extern int lprocfs_quota_rd_iunit(char *page, char **start,
653 off_t off, int count,
654 int *eof, void *data);
655 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
656 unsigned long count, void *data);
657 extern int lprocfs_quota_rd_itune(char *page, char **start,
658 off_t off, int count,
659 int *eof, void *data);
660 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
661 unsigned long count, void *data);
662 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
663 int *eof, void *data);
664 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
665 unsigned long count, void *data);
666 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
667 int count, int *eof, void *data);
668 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
670 unsigned long count, void *data);
671 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
672 int count, int *eof, void *data);
673 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
674 unsigned long count, void *data);
675 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
676 int count, int *eof, void *data);
677 extern int lprocfs_quota_wr_switch_qs(struct file *file,
679 unsigned long count, void *data);
680 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
681 int count, int *eof, void *data);
682 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
684 unsigned long count, void *data);
685 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
686 int count, int *eof, void *data);
687 extern int lprocfs_quota_wr_least_bunit(struct file *file,
689 unsigned long count, void *data);
690 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
691 int count, int *eof, void *data);
692 extern int lprocfs_quota_wr_least_iunit(struct file *file,
694 unsigned long count, void *data);
695 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
696 int count, int *eof, void *data);
697 extern int lprocfs_quota_wr_qs_factor(struct file *file,
699 unsigned long count, void *data);
704 /* LPROCFS is not defined */
708 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
709 int index, long amount)
711 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
714 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
715 int index, long amount)
717 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
720 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
721 int index, unsigned conf,
722 const char *name, const char *units)
725 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
726 enum lprocfs_fields_flags field)
729 /* NB: we return !NULL to satisfy error checker */
730 static inline struct lprocfs_stats *
731 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
732 { return (struct lprocfs_stats *)1; }
733 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
735 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
737 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
739 struct lprocfs_stats *stats)
741 static inline void lprocfs_init_ops_stats(int num_private_stats,
742 struct lprocfs_stats *stats)
744 static inline void lprocfs_init_mps_stats(int num_private_stats,
745 struct lprocfs_stats *stats)
747 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
749 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
750 unsigned int num_private_stats)
752 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
753 unsigned int num_private_stats)
755 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
757 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
761 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
763 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
766 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
768 static inline cfs_proc_dir_entry_t *
769 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
770 cfs_read_proc_t *read_proc, cfs_write_proc_t *write_proc,
771 void *data, struct file_operations *fops)
773 static inline struct proc_dir_entry *
774 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
775 const char *format, ...)
777 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
780 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
781 unsigned long count, void *data)
784 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
785 int count, int *eof, void *data)
788 static inline cfs_proc_dir_entry_t *
789 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
790 struct lprocfs_vars *list, void *data)
792 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
793 struct lprocfs_vars *var,
796 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
798 static inline void lprocfs_remove_proc_entry(const char *name,
799 struct proc_dir_entry *parent)
801 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
804 static inline int lprocfs_obd_setup(struct obd_device *dev,
805 struct lprocfs_vars *list)
807 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
809 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
810 int count, int *eof, void *data)
812 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
813 int count, int *eof, void *data)
815 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
816 int count, int *eof, void *data)
818 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
819 int count, int *eof, void *data)
821 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
822 int count, int *eof, void *data)
824 static inline int lprocfs_rd_import(char *page, char **start, off_t off,
825 int count, int *eof, void *data)
827 static inline int lprocfs_rd_state(char *page, char **start, off_t off,
828 int count, int *eof, void *data)
830 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
831 int count, int *eof, void *data)
833 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
834 int count, int *eof, void *data)
836 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
837 int count, int *eof, void *data)
839 struct adaptive_timeout;
840 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
841 struct adaptive_timeout *at)
843 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
844 int count, int *eof, void *data)
846 static inline int lprocfs_wr_timeouts(struct file *file,
848 unsigned long count, void *data)
850 static inline int lprocfs_wr_evict_client(struct file *file,
852 unsigned long count, void *data)
854 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
855 unsigned long count, void *data)
861 int lprocfs_rd_blksize(char *page, char **start, off_t off,
862 int count, int *eof, void *data)
865 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
866 int count, int *eof, void *data)
869 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
870 int count, int *eof, void *data)
873 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
874 int count, int *eof, void *data)
877 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
878 int count, int *eof, void *data)
881 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
882 int count, int *eof, void *data)
885 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
886 int count, int *eof, void *data)
889 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
892 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
895 void lprocfs_oh_clear(struct obd_histogram *oh)
898 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
901 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
902 struct lprocfs_counter *cnt)
905 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
906 enum lprocfs_fields_flags field)
909 #define LPROC_SEQ_FOPS_RO(name)
910 #define LPROC_SEQ_FOPS(name)
913 #define target_print_req NULL
917 #endif /* LPROCFS_SNMP_H */