4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2012, Whamcloud, Inc.
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 RENAME_SAMEDIR_SIZE = 0,
105 RENAME_CROSSDIR_SRC_SIZE,
106 RENAME_CROSSDIR_TGT_SIZE,
110 struct rename_stats {
111 struct obd_histogram hist[RENAME_LAST];
114 /* An lprocfs counter can be configured using the enum bit masks below.
116 * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
117 * protects this counter from concurrent updates. If not specified,
118 * lprocfs an internal per-counter lock variable. External locks are
119 * not used to protect counter increments, but are used to protect
120 * counter readout and resets.
122 * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
123 * (i.e. counter can be incremented by more than "1"). When specified,
124 * the counter maintains min, max and sum in addition to a simple
125 * invocation count. This allows averages to be be computed.
126 * If not specified, the counter is an increment-by-1 counter.
127 * min, max, sum, etc. are not maintained.
129 * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
130 * squares (for multi-valued counter samples only). This allows
131 * external computation of standard deviation, but involves a 64-bit
132 * multiply per counter increment.
136 LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
137 LPROCFS_CNTR_AVGMINMAX = 0x0002,
138 LPROCFS_CNTR_STDDEV = 0x0004,
140 /* counter data type */
141 LPROCFS_TYPE_REGS = 0x0100,
142 LPROCFS_TYPE_BYTES = 0x0200,
143 LPROCFS_TYPE_PAGES = 0x0400,
144 LPROCFS_TYPE_CYCLE = 0x0800,
147 struct lprocfs_atomic {
148 cfs_atomic_t la_entry;
149 cfs_atomic_t la_exit;
152 #define LC_MIN_INIT ((~(__u64)0) >> 1)
154 struct lprocfs_counter {
155 struct lprocfs_atomic lc_cntl; /* may need to move to per set */
156 unsigned int lc_config;
163 const char *lc_name; /* must be static */
164 const char *lc_units; /* must be static */
167 struct lprocfs_percpu {
171 struct lprocfs_counter lp_cntr[0];
174 #define LPROCFS_GET_NUM_CPU 0x0001
175 #define LPROCFS_GET_SMP_ID 0x0002
177 enum lprocfs_stats_flags {
178 LPROCFS_STATS_FLAG_NONE = 0x0000, /* per cpu counter */
179 LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
180 * area and need locking */
181 LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */
184 enum lprocfs_fields_flags {
185 LPROCFS_FIELDS_FLAGS_CONFIG = 0x0001,
186 LPROCFS_FIELDS_FLAGS_SUM = 0x0002,
187 LPROCFS_FIELDS_FLAGS_MIN = 0x0003,
188 LPROCFS_FIELDS_FLAGS_MAX = 0x0004,
189 LPROCFS_FIELDS_FLAGS_AVG = 0x0005,
190 LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006,
191 LPROCFS_FIELDS_FLAGS_COUNT = 0x0007,
194 struct lprocfs_stats {
195 unsigned short ls_num; /* # of counters */
196 unsigned short ls_biggest_alloc_num;
197 /* 1 + the highest slot index which has
198 * been allocated, the 0th entry is
199 * a statically intialized template */
200 int ls_flags; /* See LPROCFS_STATS_FLAG_* */
201 /* Lock used when there are no percpu stats areas; For percpu stats,
202 * it is used to protect ls_biggest_alloc_num change */
203 cfs_spinlock_t ls_lock;
204 struct lprocfs_percpu *ls_percpu[0];
207 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
209 /* Pack all opcodes down into a single monotonically increasing index */
210 static inline int opcode_offset(__u32 opc) {
211 if (opc < OST_LAST_OPC) {
213 return (opc - OST_FIRST_OPC);
214 } else if (opc < MDS_LAST_OPC) {
216 return (opc - MDS_FIRST_OPC +
218 } else if (opc < LDLM_LAST_OPC) {
220 return (opc - LDLM_FIRST_OPC +
223 } else if (opc < MGS_LAST_OPC) {
225 return (opc - MGS_FIRST_OPC +
229 } else if (opc < OBD_LAST_OPC) {
231 return (opc - OBD_FIRST_OPC +
236 } else if (opc < LLOG_LAST_OPC) {
238 return (opc - LLOG_FIRST_OPC +
244 } else if (opc < QUOTA_LAST_OPC) {
246 return (opc - QUOTA_FIRST_OPC +
253 } else if (opc < SEQ_LAST_OPC) {
255 return (opc - SEQ_FIRST_OPC +
263 } else if (opc < SEC_LAST_OPC) {
265 return (opc - SEC_FIRST_OPC +
274 } else if (opc < FLD_LAST_OPC) {
276 return (opc - FLD_FIRST_OPC +
293 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST) + \
304 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
308 PTLRPC_REQWAIT_CNTR = 0,
309 PTLRPC_REQQDEPTH_CNTR,
310 PTLRPC_REQACTIVE_CNTR,
312 PTLRPC_REQBUF_AVAIL_CNTR,
316 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
319 LDLM_GLIMPSE_ENQUEUE = 0,
336 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
338 extern cfs_proc_dir_entry_t *proc_lustre_root;
341 struct obd_histogram;
343 /* Days / hours / mins / seconds format */
347 static inline void s2dhms(struct dhms *ts, time_t secs)
349 ts->d = secs / 86400;
356 #define DHMS_FMT "%dd%dh%02dm%02ds"
357 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
359 #define JOBSTATS_JOBID_VAR_MAX_LEN 20
360 #define JOBSTATS_DISABLE "disable"
361 #define JOBSTATS_PROCNAME_UID "procname_uid"
363 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats);
365 struct obd_job_stats {
366 cfs_hash_t *ojs_hash;
368 cfs_rwlock_t ojs_lock; /* protect the obj_list */
370 cntr_init_callback ojs_cntr_init_fn;
371 cfs_timer_t ojs_cleanup_timer;
372 int ojs_cleanup_interval;
377 extern int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
381 * < 0 : on error (only possible for opc as LPROCFS_GET_SMP_ID)
383 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc,
384 unsigned long *flags)
393 case LPROCFS_GET_SMP_ID:
394 /* percpu counter stats */
395 if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0) {
396 cpuid = cfs_get_cpu();
398 if (unlikely(stats->ls_percpu[cpuid + 1] == NULL))
399 rc = lprocfs_stats_alloc_one(stats, cpuid + 1);
400 return rc < 0 ? rc : cpuid + 1;
403 /* non-percpu counter stats */
404 if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
405 cfs_spin_lock_irqsave(&stats->ls_lock, *flags);
407 cfs_spin_lock(&stats->ls_lock);
410 case LPROCFS_GET_NUM_CPU:
411 /* percpu counter stats */
412 if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
413 return stats->ls_biggest_alloc_num;
415 /* non-percpu counter stats */
416 if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
417 cfs_spin_lock_irqsave(&stats->ls_lock, *flags);
419 cfs_spin_lock(&stats->ls_lock);
424 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats, int opc,
425 unsigned long *flags)
431 case LPROCFS_GET_SMP_ID:
432 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
433 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) {
434 cfs_spin_unlock_irqrestore(&stats->ls_lock,
437 cfs_spin_unlock(&stats->ls_lock);
444 case LPROCFS_GET_NUM_CPU:
445 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
446 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) {
447 cfs_spin_unlock_irqrestore(&stats->ls_lock,
450 cfs_spin_unlock(&stats->ls_lock);
457 /* Two optimized LPROCFS counter increment functions are provided:
458 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
459 * lprocfs_counter_add(cntr) - use for multi-valued counters
460 * Counter data layout allows config flag, counter lock and the
461 * count itself to reside within a single cache line.
464 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
466 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
469 #define lprocfs_counter_incr(stats, idx) \
470 lprocfs_counter_add(stats, idx, 1)
471 #define lprocfs_counter_decr(stats, idx) \
472 lprocfs_counter_sub(stats, idx, 1)
474 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
475 enum lprocfs_fields_flags field);
476 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
478 enum lprocfs_fields_flags field)
481 unsigned int num_cpu;
482 unsigned long flags = 0;
485 LASSERT(stats != NULL);
487 num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
488 for (i = 0; i < num_cpu; i++) {
489 if (stats->ls_percpu[i] == NULL)
491 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
494 lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU, &flags);
498 extern struct lprocfs_stats *
499 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
500 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
501 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
502 extern void lprocfs_init_ops_stats(int num_private_stats,
503 struct lprocfs_stats *stats);
504 extern void lprocfs_init_mps_stats(int num_private_stats,
505 struct lprocfs_stats *stats);
506 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
507 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
508 unsigned int num_private_stats);
509 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
510 unsigned int num_private_stats);
511 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
512 unsigned conf, const char *name,
514 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
515 extern void lprocfs_free_md_stats(struct obd_device *obddev);
518 extern int lprocfs_add_clear_entry(struct obd_device * obd,
519 cfs_proc_dir_entry_t *entry);
520 extern int lprocfs_exp_setup(struct obd_export *exp,
521 lnet_nid_t *peer_nid, int *newnid);
522 extern int lprocfs_exp_cleanup(struct obd_export *exp);
523 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
525 cfs_read_proc_t *read_proc,
526 cfs_write_proc_t *write_proc,
528 struct file_operations *fops);
529 extern struct proc_dir_entry *
530 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
531 const char *format, ...);
532 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
534 lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
535 unsigned long count, void *data);
536 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
537 int count, int *eof, void *data);
539 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
540 struct lprocfs_stats *stats);
542 /* lprocfs_status.c */
543 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
544 struct lprocfs_vars *var,
547 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
548 cfs_proc_dir_entry_t *parent,
549 struct lprocfs_vars *list,
552 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
553 extern void lprocfs_remove_proc_entry(const char *name,
554 struct proc_dir_entry *parent);
556 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
559 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
560 extern int lprocfs_obd_cleanup(struct obd_device *obd);
561 extern struct file_operations lprocfs_evict_client_fops;
563 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name,
564 mode_t mode, struct file_operations *seq_fops,
566 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
567 mode_t mode, struct file_operations *seq_fops,
570 /* Generic callbacks */
572 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
573 int count, int *eof, void *data);
574 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
575 int count, int *eof, void *data);
576 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
577 unsigned long count, void *data);
578 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
579 int count, int *eof, void *data);
580 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
581 unsigned long count, void *data);
582 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
583 int count, int *eof, void *data);
584 extern int lprocfs_rd_name(char *page, char **start, off_t off,
585 int count, int *eof, void *data);
586 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
587 int count, int *eof, void *data);
588 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
589 int count, int *eof, void *data);
590 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
591 int count, int *eof, void *data);
592 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
593 int *eof, void *data);
594 extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
595 int *eof, void *data);
596 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
597 int count, int *eof, void *data);
598 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
599 int count, int *eof, void *data);
600 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
601 int count, int *eof, void *data);
602 struct adaptive_timeout;
603 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
604 struct adaptive_timeout *at);
605 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
606 int count, int *eof, void *data);
607 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
608 unsigned long count, void *data);
609 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
610 unsigned long count, void *data);
611 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
612 unsigned long count, void *data);
613 extern int lprocfs_wr_import(struct file *file, const char *buffer,
614 unsigned long count, void *data);
615 extern int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
616 int count, int *eof, void *data);
617 extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
618 unsigned long count, void *data);
621 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
622 int count, int *eof, void *data);
623 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
624 int count, int *eof, void *data);
625 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
626 int count, int *eof, void *data);
627 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
628 int count, int *eof, void *data);
629 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
630 int count, int *eof, void *data);
631 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
632 int count, int *eof, void *data);
633 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
634 int count, int *eof, void *data);
635 extern int lprocfs_osd_rd_blksize(char *page, char **start, off_t off,
636 int count, int *eof, void *data);
637 extern int lprocfs_osd_rd_kbytesfree(char *page, char **start, off_t off,
638 int count, int *eof, void *data);
639 extern int lprocfs_osd_rd_kbytesavail(char *page, char **start, off_t off,
640 int count, int *eof, void *data);
641 extern int lprocfs_osd_rd_filestotal(char *page, char **start, off_t off,
642 int count, int *eof, void *data);
643 extern int lprocfs_osd_rd_filesfree(char *page, char **start, off_t off,
644 int count, int *eof, void *data);
645 extern int lprocfs_osd_rd_kbytestotal(char *page, char **start, off_t off,
646 int count, int *eof, void *data);
649 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
651 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
653 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
655 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
657 extern int lprocfs_write_frac_u64_helper(const char *buffer,
659 __u64 *val, int mult);
660 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
661 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
662 void lprocfs_oh_clear(struct obd_histogram *oh);
663 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
665 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
666 struct lprocfs_counter *cnt);
668 /* lprocfs_status.c: recovery status */
669 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
670 int count, int *eof, void *data);
672 /* lprocfs_statuc.c: hash statistics */
673 int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
674 int count, int *eof, void *data);
676 /* lprocfs_status.c: IR factor */
677 int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
678 int count, int *eof, void *data);
679 int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer,
680 unsigned long count, void *data);
682 extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
684 /* You must use these macros when you want to refer to
685 * the import in a client obd_device for a lprocfs entry */
686 #define LPROCFS_CLIMP_CHECK(obd) do { \
687 typecheck(struct obd_device *, obd); \
688 cfs_down_read(&(obd)->u.cli.cl_sem); \
689 if ((obd)->u.cli.cl_import == NULL) { \
690 cfs_up_read(&(obd)->u.cli.cl_sem); \
694 #define LPROCFS_CLIMP_EXIT(obd) \
695 cfs_up_read(&(obd)->u.cli.cl_sem);
698 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
699 proc entries; otherwise, you will define name##_seq_write function also for
700 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
701 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
702 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
703 static int name##_seq_open(cfs_inode_t *inode, struct file *file) { \
704 struct proc_dir_entry *dp = PDE(inode); \
706 LPROCFS_ENTRY_AND_CHECK(dp); \
707 rc = single_open(file, name##_seq_show, dp->data); \
714 struct file_operations name##_fops = { \
715 .owner = THIS_MODULE, \
716 .open = name##_seq_open, \
718 .write = custom_seq_write, \
719 .llseek = seq_lseek, \
720 .release = lprocfs_seq_release, \
723 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
724 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
726 /* lprocfs_jobstats.c */
727 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
728 int event, long amount);
729 void lprocfs_job_stats_fini(struct obd_device *obd);
730 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
731 cntr_init_callback fn);
732 int lprocfs_rd_job_interval(char *page, char **start, off_t off,
733 int count, int *eof, void *data);
734 int lprocfs_wr_job_interval(struct file *file, const char *buffer,
735 unsigned long count, void *data);
738 struct ptlrpc_request;
739 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
742 int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
743 int count, int *eof, void *data);
744 int lprocfs_obd_wr_recovery_time_soft(struct file *file,
746 unsigned long count, void *data);
747 int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
748 int count, int *eof, void *data);
749 int lprocfs_obd_wr_recovery_time_hard(struct file *file,
751 unsigned long count, void *data);
752 int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
753 int count, int *eof, void *data);
754 int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
755 int count, int *eof, void *data);
756 int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
757 unsigned long count, void *data);
758 int lprocfs_target_rd_instance(char *page, char **start, off_t off,
759 int count, int *eof, void *data);
761 /* all quota proc functions */
762 extern int lprocfs_quota_rd_bunit(char *page, char **start,
763 off_t off, int count,
764 int *eof, void *data);
765 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
766 unsigned long count, void *data);
767 extern int lprocfs_quota_rd_btune(char *page, char **start,
768 off_t off, int count,
769 int *eof, void *data);
770 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
771 unsigned long count, void *data);
772 extern int lprocfs_quota_rd_iunit(char *page, char **start,
773 off_t off, int count,
774 int *eof, void *data);
775 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
776 unsigned long count, void *data);
777 extern int lprocfs_quota_rd_itune(char *page, char **start,
778 off_t off, int count,
779 int *eof, void *data);
780 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
781 unsigned long count, void *data);
782 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
783 int *eof, void *data);
784 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
785 unsigned long count, void *data);
786 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
787 int count, int *eof, void *data);
788 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
790 unsigned long count, void *data);
791 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
792 int count, int *eof, void *data);
793 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
794 unsigned long count, void *data);
795 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
796 int count, int *eof, void *data);
797 extern int lprocfs_quota_wr_switch_qs(struct file *file,
799 unsigned long count, void *data);
800 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
801 int count, int *eof, void *data);
802 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
804 unsigned long count, void *data);
805 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
806 int count, int *eof, void *data);
807 extern int lprocfs_quota_wr_least_bunit(struct file *file,
809 unsigned long count, void *data);
810 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
811 int count, int *eof, void *data);
812 extern int lprocfs_quota_wr_least_iunit(struct file *file,
814 unsigned long count, void *data);
815 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
816 int count, int *eof, void *data);
817 extern int lprocfs_quota_wr_qs_factor(struct file *file,
819 unsigned long count, void *data);
824 /* LPROCFS is not defined */
828 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
829 int index, long amount)
831 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
834 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
835 int index, long amount)
837 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
840 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
841 int index, unsigned conf,
842 const char *name, const char *units)
845 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
846 enum lprocfs_fields_flags field)
849 /* NB: we return !NULL to satisfy error checker */
850 static inline struct lprocfs_stats *
851 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
852 { return (struct lprocfs_stats *)1; }
853 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
855 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
857 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
859 struct lprocfs_stats *stats)
861 static inline void lprocfs_init_ops_stats(int num_private_stats,
862 struct lprocfs_stats *stats)
864 static inline void lprocfs_init_mps_stats(int num_private_stats,
865 struct lprocfs_stats *stats)
867 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
869 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
870 unsigned int num_private_stats)
872 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
873 unsigned int num_private_stats)
875 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
877 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
881 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
883 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
886 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
888 static inline cfs_proc_dir_entry_t *
889 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
890 cfs_read_proc_t *read_proc, cfs_write_proc_t *write_proc,
891 void *data, struct file_operations *fops)
893 static inline struct proc_dir_entry *
894 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
895 const char *format, ...)
897 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
900 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
901 unsigned long count, void *data)
904 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
905 int count, int *eof, void *data)
908 static inline cfs_proc_dir_entry_t *
909 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
910 struct lprocfs_vars *list, void *data)
912 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
913 struct lprocfs_vars *var,
916 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
918 static inline void lprocfs_remove_proc_entry(const char *name,
919 struct proc_dir_entry *parent)
921 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
924 static inline int lprocfs_obd_setup(struct obd_device *dev,
925 struct lprocfs_vars *list)
927 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
929 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
930 int count, int *eof, void *data)
932 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
933 int count, int *eof, void *data)
935 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
936 int count, int *eof, void *data)
938 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
939 int count, int *eof, void *data)
941 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
942 int count, int *eof, void *data)
944 static inline int lprocfs_rd_import(char *page, char **start, off_t off,
945 int count, int *eof, void *data)
947 static inline int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
948 int count, int *eof, void *data)
950 static inline int lprocfs_rd_state(char *page, char **start, off_t off,
951 int count, int *eof, void *data)
953 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
954 int count, int *eof, void *data)
956 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
957 int count, int *eof, void *data)
959 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
960 int count, int *eof, void *data)
962 struct adaptive_timeout;
963 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
964 struct adaptive_timeout *at)
966 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
967 int count, int *eof, void *data)
969 static inline int lprocfs_wr_timeouts(struct file *file,
971 unsigned long count, void *data)
973 static inline int lprocfs_wr_evict_client(struct file *file,
975 unsigned long count, void *data)
977 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
978 unsigned long count, void *data)
980 static inline int lprocfs_wr_import(struct file *file, const char *buffer,
981 unsigned long count, void *data)
983 static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
984 unsigned long count, void *data)
989 int lprocfs_rd_blksize(char *page, char **start, off_t off,
990 int count, int *eof, void *data)
993 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
994 int count, int *eof, void *data)
997 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
998 int count, int *eof, void *data)
1001 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
1002 int count, int *eof, void *data)
1005 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
1006 int count, int *eof, void *data)
1009 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
1010 int count, int *eof, void *data)
1013 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
1014 int count, int *eof, void *data)
1017 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
1020 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
1023 void lprocfs_oh_clear(struct obd_histogram *oh)
1026 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1029 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1030 struct lprocfs_counter *cnt)
1033 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1034 enum lprocfs_fields_flags field)
1035 { return (__u64)0; }
1037 #define LPROC_SEQ_FOPS_RO(name)
1038 #define LPROC_SEQ_FOPS(name)
1040 /* lprocfs_jobstats.c */
1042 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1046 void lprocfs_job_stats_fini(struct obd_device *obd)
1049 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1050 cntr_init_callback fn)
1054 /* lproc_ptlrpc.c */
1055 #define target_print_req NULL
1057 #endif /* LPROCFS */
1059 #endif /* LPROCFS_SNMP_H */