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, Intel Corporation.
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 #include <linux/lprocfs_status.h>
46 #include <lustre/lustre_idl.h>
47 #include <linux/libcfs/params_tree.h>
51 struct file_operations *fops;
59 struct lprocfs_static_vars {
60 struct lprocfs_vars *module_vars;
61 struct lprocfs_vars *obd_vars;
64 /* if we find more consumers this could be generalized */
65 #define OBD_HIST_MAX 32
66 struct obd_histogram {
68 unsigned long oh_buckets[OBD_HIST_MAX];
90 struct obd_histogram hist[BRW_LAST];
94 RENAME_SAMEDIR_SIZE = 0,
95 RENAME_CROSSDIR_SRC_SIZE,
96 RENAME_CROSSDIR_TGT_SIZE,
100 struct rename_stats {
101 struct obd_histogram hist[RENAME_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 #define LC_MIN_INIT ((~(__u64)0) >> 1)
139 struct lprocfs_counter_header {
140 unsigned int lc_config;
141 const char *lc_name; /* must be static */
142 const char *lc_units; /* must be static */
145 struct lprocfs_counter {
151 * Every counter has lc_array_sum[0], while lc_array_sum[1] is only
152 * for irq context counter, i.e. stats with
153 * LPROCFS_STATS_FLAG_IRQ_SAFE flag, its counter need
156 __s64 lc_array_sum[1];
158 #define lc_sum lc_array_sum[0]
159 #define lc_sum_irq lc_array_sum[1]
161 struct lprocfs_percpu {
165 struct lprocfs_counter lp_cntr[0];
168 #define LPROCFS_GET_NUM_CPU 0x0001
169 #define LPROCFS_GET_SMP_ID 0x0002
171 enum lprocfs_stats_flags {
172 LPROCFS_STATS_FLAG_NONE = 0x0000, /* per cpu counter */
173 LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
174 * area and need locking */
175 LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */
178 enum lprocfs_fields_flags {
179 LPROCFS_FIELDS_FLAGS_CONFIG = 0x0001,
180 LPROCFS_FIELDS_FLAGS_SUM = 0x0002,
181 LPROCFS_FIELDS_FLAGS_MIN = 0x0003,
182 LPROCFS_FIELDS_FLAGS_MAX = 0x0004,
183 LPROCFS_FIELDS_FLAGS_AVG = 0x0005,
184 LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006,
185 LPROCFS_FIELDS_FLAGS_COUNT = 0x0007,
188 struct lprocfs_stats {
190 unsigned short ls_num;
191 /* 1 + the biggest cpu # whose ls_percpu slot has been allocated */
192 unsigned short ls_biggest_alloc_num;
193 enum lprocfs_stats_flags ls_flags;
194 /* Lock used when there are no percpu stats areas; For percpu stats,
195 * it is used to protect ls_biggest_alloc_num change */
198 /* has ls_num of counter headers */
199 struct lprocfs_counter_header *ls_cnt_header;
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 +
282 } else if (opc < UPDATE_LAST_OPC) {
284 return (opc - UPDATE_FIRST_OPC +
302 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST) + \
314 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
318 PTLRPC_REQWAIT_CNTR = 0,
319 PTLRPC_REQQDEPTH_CNTR,
320 PTLRPC_REQACTIVE_CNTR,
322 PTLRPC_REQBUF_AVAIL_CNTR,
326 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
329 LDLM_GLIMPSE_ENQUEUE = 0,
346 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
348 extern proc_dir_entry_t *proc_lustre_root;
351 struct obd_histogram;
353 /* Days / hours / mins / seconds format */
357 static inline void s2dhms(struct dhms *ts, time_t secs)
359 ts->d = secs / 86400;
366 #define DHMS_FMT "%dd%dh%02dm%02ds"
367 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
369 #define JOBSTATS_JOBID_VAR_MAX_LEN 20
370 #define JOBSTATS_DISABLE "disable"
371 #define JOBSTATS_PROCNAME_UID "procname_uid"
373 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats);
375 struct obd_job_stats {
376 cfs_hash_t *ojs_hash;
377 struct list_head ojs_list;
378 rwlock_t ojs_lock; /* protect the obj_list */
379 cntr_init_callback ojs_cntr_init_fn;
381 int ojs_cleanup_interval;
382 time_t ojs_last_cleanup;
387 extern int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
391 * < 0 : on error (only possible for opc as LPROCFS_GET_SMP_ID)
393 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc,
394 unsigned long *flags)
402 case LPROCFS_GET_SMP_ID:
403 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
404 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE)
405 spin_lock_irqsave(&stats->ls_lock, *flags);
407 spin_lock(&stats->ls_lock);
410 unsigned int cpuid = get_cpu();
412 if (unlikely(stats->ls_percpu[cpuid] == NULL)) {
413 rc = lprocfs_stats_alloc_one(stats, cpuid);
422 case LPROCFS_GET_NUM_CPU:
423 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
424 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE)
425 spin_lock_irqsave(&stats->ls_lock, *flags);
427 spin_lock(&stats->ls_lock);
430 return stats->ls_biggest_alloc_num;
435 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats, int opc,
436 unsigned long *flags)
442 case LPROCFS_GET_SMP_ID:
443 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
444 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) {
445 spin_unlock_irqrestore(&stats->ls_lock,
448 spin_unlock(&stats->ls_lock);
455 case LPROCFS_GET_NUM_CPU:
456 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
457 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) {
458 spin_unlock_irqrestore(&stats->ls_lock,
461 spin_unlock(&stats->ls_lock);
468 static inline unsigned int
469 lprocfs_stats_counter_size(struct lprocfs_stats *stats)
471 unsigned int percpusize;
473 percpusize = offsetof(struct lprocfs_percpu, lp_cntr[stats->ls_num]);
475 /* irq safe stats need lc_array_sum[1] */
476 if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
477 percpusize += stats->ls_num * sizeof(__s64);
479 if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
480 percpusize = L1_CACHE_ALIGN(percpusize);
485 static inline struct lprocfs_counter *
486 lprocfs_stats_counter_get(struct lprocfs_stats *stats, unsigned int cpuid,
489 struct lprocfs_counter *cntr;
491 cntr = &stats->ls_percpu[cpuid]->lp_cntr[index];
493 if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
494 cntr = (void *)cntr + index * sizeof(__s64);
499 /* Two optimized LPROCFS counter increment functions are provided:
500 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
501 * lprocfs_counter_add(cntr) - use for multi-valued counters
502 * Counter data layout allows config flag, counter lock and the
503 * count itself to reside within a single cache line.
506 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
508 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
511 #define lprocfs_counter_incr(stats, idx) \
512 lprocfs_counter_add(stats, idx, 1)
513 #define lprocfs_counter_decr(stats, idx) \
514 lprocfs_counter_sub(stats, idx, 1)
516 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
517 struct lprocfs_counter_header *header,
518 enum lprocfs_stats_flags flags,
519 enum lprocfs_fields_flags field);
520 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
522 enum lprocfs_fields_flags field)
525 unsigned int num_cpu;
526 unsigned long flags = 0;
529 LASSERT(stats != NULL);
531 num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
532 for (i = 0; i < num_cpu; i++) {
533 if (stats->ls_percpu[i] == NULL)
535 ret += lprocfs_read_helper(
536 lprocfs_stats_counter_get(stats, i, idx),
537 &stats->ls_cnt_header[idx], stats->ls_flags,
540 lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU, &flags);
544 extern struct lprocfs_stats *
545 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
546 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
547 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
548 extern void lprocfs_init_ops_stats(int num_private_stats,
549 struct lprocfs_stats *stats);
550 extern void lprocfs_init_mps_stats(int num_private_stats,
551 struct lprocfs_stats *stats);
552 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
553 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
554 unsigned int num_private_stats);
555 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
556 unsigned int num_private_stats);
557 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
558 unsigned conf, const char *name,
560 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
561 extern void lprocfs_free_md_stats(struct obd_device *obddev);
564 extern int lprocfs_add_clear_entry(struct obd_device * obd,
565 proc_dir_entry_t *entry);
566 extern int lprocfs_exp_setup(struct obd_export *exp,
567 lnet_nid_t *peer_nid, int *newnid);
568 extern int lprocfs_exp_cleanup(struct obd_export *exp);
569 extern proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
572 struct file_operations *fops);
573 extern struct proc_dir_entry *
574 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
575 const char *format, ...);
576 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
578 lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
579 unsigned long count, void *data);
580 extern int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data);
582 extern int lprocfs_register_stats(proc_dir_entry_t *root, const char *name,
583 struct lprocfs_stats *stats);
585 /* lprocfs_status.c */
586 extern int lprocfs_add_vars(proc_dir_entry_t *root,
587 struct lprocfs_vars *var,
590 extern proc_dir_entry_t *lprocfs_register(const char *name,
591 proc_dir_entry_t *parent,
592 struct lprocfs_vars *list,
595 extern void lprocfs_remove(proc_dir_entry_t **root);
596 extern void lprocfs_remove_proc_entry(const char *name,
597 struct proc_dir_entry *parent);
599 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
600 extern int lprocfs_obd_cleanup(struct obd_device *obd);
602 extern int lprocfs_seq_create(proc_dir_entry_t *parent, const char *name,
604 const struct file_operations *seq_fops,
606 extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name,
608 const struct file_operations *seq_fops,
611 /* Generic callbacks */
613 extern int lprocfs_rd_u64(struct seq_file *m, void *data);
614 extern int lprocfs_rd_atomic(struct seq_file *m, void *data);
615 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
616 unsigned long count, void *data);
617 extern int lprocfs_rd_uint(struct seq_file *m, void *data);
618 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
619 unsigned long count, void *data);
620 extern int lprocfs_rd_uuid(struct seq_file *m, void *data);
621 extern int lprocfs_rd_name(struct seq_file *m, void *data);
622 extern int lprocfs_rd_server_uuid(struct seq_file *m, void *data);
623 extern int lprocfs_rd_conn_uuid(struct seq_file *m, void *data);
624 extern int lprocfs_rd_import(struct seq_file *m, void *data);
625 extern int lprocfs_rd_state(struct seq_file *m, void *data);
626 extern int lprocfs_rd_connect_flags(struct seq_file *m, void *data);
627 extern int lprocfs_rd_num_exports(struct seq_file *m, void *data);
628 extern int lprocfs_rd_numrefs(struct seq_file *m, void *data);
630 struct adaptive_timeout;
631 extern int lprocfs_at_hist_helper(struct seq_file *m,
632 struct adaptive_timeout *at);
633 extern int lprocfs_rd_timeouts(struct seq_file *m, void *data);
634 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
635 unsigned long count, void *data);
636 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
637 size_t count, loff_t *off);
638 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
639 size_t count, loff_t *off);
640 extern int lprocfs_wr_import(struct file *file, const char *buffer,
641 size_t count, loff_t *off);
642 extern int lprocfs_rd_pinger_recov(struct seq_file *m, void *n);
643 extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
644 size_t count, loff_t *off);
647 extern int lprocfs_rd_blksize(struct seq_file *m, void *data);
648 extern int lprocfs_rd_kbytestotal(struct seq_file *m, void *data);
649 extern int lprocfs_rd_kbytesfree(struct seq_file *m, void *data);
650 extern int lprocfs_rd_kbytesavail(struct seq_file *m, void *data);
651 extern int lprocfs_rd_filestotal(struct seq_file *m, void *data);
652 extern int lprocfs_rd_filesfree(struct seq_file *m, void *data);
654 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
656 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
658 extern int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult);
659 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
661 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
663 extern int lprocfs_write_frac_u64_helper(const char *buffer,
665 __u64 *val, int mult);
666 extern char *lprocfs_find_named_value(const char *buffer, const char *name,
668 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
669 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
670 void lprocfs_oh_clear(struct obd_histogram *oh);
671 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
673 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
674 struct lprocfs_counter *cnt);
676 extern int lprocfs_single_release(cfs_inode_t *, struct file *);
677 extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
679 /* You must use these macros when you want to refer to
680 * the import in a client obd_device for a lprocfs entry */
681 #define LPROCFS_CLIMP_CHECK(obd) do { \
682 typecheck(struct obd_device *, obd); \
683 down_read(&(obd)->u.cli.cl_sem); \
684 if ((obd)->u.cli.cl_import == NULL) { \
685 up_read(&(obd)->u.cli.cl_sem); \
689 #define LPROCFS_CLIMP_EXIT(obd) \
690 up_read(&(obd)->u.cli.cl_sem);
693 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
694 proc entries; otherwise, you will define name##_seq_write function also for
695 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
696 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
697 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
698 static int name##_single_open(cfs_inode_t *inode, struct file *file) \
700 return single_open(file, name##_seq_show, PDE_DATA(inode)); \
702 struct file_operations name##_fops = { \
703 .owner = THIS_MODULE, \
704 .open = name##_single_open, \
706 .write = custom_seq_write, \
707 .llseek = seq_lseek, \
708 .release = lprocfs_single_release, \
711 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
712 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
714 #define LPROC_SEQ_FOPS_RO_TYPE(name, type) \
715 static int name##_##type##_seq_show(struct seq_file *m, void *v)\
717 return lprocfs_rd_##type(m, m->private); \
719 LPROC_SEQ_FOPS_RO(name##_##type)
721 #define LPROC_SEQ_FOPS_RW_TYPE(name, type) \
722 static int name##_##type##_seq_show(struct seq_file *m, void *v)\
724 return lprocfs_rd_##type(m, m->private); \
726 static ssize_t name##_##type##_seq_write(struct file *file, \
727 const char *buffer, size_t count, loff_t *off) \
729 struct seq_file *seq = file->private_data; \
730 return lprocfs_wr_##type(file, buffer, \
731 count, seq->private); \
733 LPROC_SEQ_FOPS(name##_##type);
735 #define LPROC_SEQ_FOPS_WR_ONLY(name, type) \
736 static ssize_t name##_##type##_write(struct file *file, \
737 const char *buffer, size_t count, loff_t *off) \
739 return lprocfs_wr_##type(file, buffer, count, off); \
741 static int name##_##type##_open(cfs_inode_t *inode, struct file *file) \
743 return single_open(file, NULL, PDE_DATA(inode)); \
745 struct file_operations name##_##type##_fops = { \
746 .open = name##_##type##_open, \
747 .write = name##_##type##_write, \
748 .release = lprocfs_single_release, \
751 /* lprocfs_jobstats.c */
752 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
753 int event, long amount);
754 void lprocfs_job_stats_fini(struct obd_device *obd);
755 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
756 cntr_init_callback fn);
757 int lprocfs_rd_job_interval(struct seq_file *m, void *data);
758 int lprocfs_wr_job_interval(struct file *file, const char *buffer,
759 unsigned long count, void *data);
762 struct ptlrpc_request;
763 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
766 int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file *m, void *data);
767 int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
768 size_t count, loff_t *off);
770 /* all quota proc functions */
771 extern int lprocfs_quota_rd_bunit(char *page, char **start,
772 loff_t off, int count,
773 int *eof, void *data);
774 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
775 unsigned long count, void *data);
776 extern int lprocfs_quota_rd_btune(char *page, char **start,
777 loff_t off, int count,
778 int *eof, void *data);
779 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
780 unsigned long count, void *data);
781 extern int lprocfs_quota_rd_iunit(char *page, char **start,
782 loff_t off, int count,
783 int *eof, void *data);
784 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
785 unsigned long count, void *data);
786 extern int lprocfs_quota_rd_itune(char *page, char **start,
787 loff_t off, int count,
788 int *eof, void *data);
789 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
790 unsigned long count, void *data);
791 extern int lprocfs_quota_rd_type(char *page, char **start, loff_t off, int count,
792 int *eof, void *data);
793 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
794 unsigned long count, void *data);
795 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, loff_t off,
796 int count, int *eof, void *data);
797 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
799 unsigned long count, void *data);
800 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, loff_t off,
801 int count, int *eof, void *data);
802 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
803 unsigned long count, void *data);
804 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, loff_t off,
805 int count, int *eof, void *data);
806 extern int lprocfs_quota_wr_switch_qs(struct file *file,
808 unsigned long count, void *data);
809 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, loff_t off,
810 int count, int *eof, void *data);
811 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
813 unsigned long count, void *data);
814 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, loff_t off,
815 int count, int *eof, void *data);
816 extern int lprocfs_quota_wr_least_bunit(struct file *file,
818 unsigned long count, void *data);
819 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, loff_t off,
820 int count, int *eof, void *data);
821 extern int lprocfs_quota_wr_least_iunit(struct file *file,
823 unsigned long count, void *data);
824 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, loff_t off,
825 int count, int *eof, void *data);
826 extern int lprocfs_quota_wr_qs_factor(struct file *file,
828 unsigned long count, void *data);
833 /* LPROCFS is not defined */
835 #define proc_lustre_root NULL
837 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
838 int index, long amount)
840 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
843 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
844 int index, long amount)
846 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
849 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
850 int index, unsigned conf,
851 const char *name, const char *units)
854 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
855 enum lprocfs_fields_flags field)
858 /* NB: we return !NULL to satisfy error checker */
859 static inline struct lprocfs_stats *
860 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
861 { return (struct lprocfs_stats *)1; }
862 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
864 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
866 static inline int lprocfs_register_stats(proc_dir_entry_t *root,
868 struct lprocfs_stats *stats)
870 static inline void lprocfs_init_ops_stats(int num_private_stats,
871 struct lprocfs_stats *stats)
873 static inline void lprocfs_init_mps_stats(int num_private_stats,
874 struct lprocfs_stats *stats)
876 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
878 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
879 unsigned int num_private_stats)
881 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
882 unsigned int num_private_stats)
884 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
886 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
890 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
892 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
895 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
897 static inline proc_dir_entry_t *
898 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
899 void *data, struct file_operations *fops)
901 static inline struct proc_dir_entry *
902 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
903 const char *format, ...)
905 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
908 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
909 unsigned long count, void *data)
912 int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data)
915 static inline proc_dir_entry_t *
916 lprocfs_register(const char *name, proc_dir_entry_t *parent,
917 struct lprocfs_vars *list, void *data)
919 static inline int lprocfs_add_vars(proc_dir_entry_t *root,
920 struct lprocfs_vars *var,
923 static inline void lprocfs_remove(proc_dir_entry_t **root)
925 static inline void lprocfs_remove_proc_entry(const char *name,
926 struct proc_dir_entry *parent)
928 static inline int lprocfs_obd_setup(struct obd_device *dev,
929 struct lprocfs_vars *list)
931 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
933 static inline int lprocfs_rd_u64(struct seq_file *m, void *data)
935 static inline int lprocfs_rd_uuid(struct seq_file *m, void *data)
937 static inline int lprocfs_rd_name(struct seq_file *m, void *data)
939 static inline int lprocfs_rd_server_uuid(struct seq_file *m, void *data)
941 static inline int lprocfs_rd_conn_uuid(struct seq_file *m, void *data)
943 static inline int lprocfs_rd_import(struct seq_file *m, void *data)
945 static inline int lprocfs_rd_pinger_recov(struct seq_file *m, void *n)
947 static inline int lprocfs_rd_state(struct seq_file *m, void *data)
949 static inline int lprocfs_rd_connect_flags(struct seq_file *m, void *data)
951 static inline int lprocfs_rd_num_exports(struct seq_file *m, void *data)
953 extern inline int lprocfs_rd_numrefs(struct seq_file *m, void *data)
955 struct adaptive_timeout;
956 static inline int lprocfs_at_hist_helper(struct seq_file *m,
957 struct adaptive_timeout *at)
959 static inline int lprocfs_rd_timeouts(struct seq_file *m, void *data)
961 static inline int lprocfs_wr_timeouts(struct file *file,
963 unsigned long count, void *data)
965 static inline int lprocfs_wr_evict_client(struct file *file, const char *buffer,
966 size_t count, loff_t *off)
968 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
969 size_t count, loff_t *off)
971 static inline int lprocfs_wr_import(struct file *file, const char *buffer,
972 size_t count, loff_t *off)
974 static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
975 size_t count, loff_t *off)
980 int lprocfs_rd_blksize(struct seq_file *m, void *data)
983 int lprocfs_rd_kbytestotal(struct seq_file *m, void *data)
986 int lprocfs_rd_kbytesfree(struct seq_file *m, void *data)
989 int lprocfs_rd_kbytesavail(struct seq_file *m, void *data)
992 int lprocfs_rd_filestotal(struct seq_file *m, void *data)
995 int lprocfs_rd_filesfree(struct seq_file *m, void *data)
998 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
1001 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
1004 void lprocfs_oh_clear(struct obd_histogram *oh)
1007 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1010 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1011 struct lprocfs_counter *cnt)
1014 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1015 enum lprocfs_fields_flags field)
1016 { return (__u64)0; }
1018 #define LPROC_SEQ_FOPS_RO(name)
1019 #define LPROC_SEQ_FOPS(name)
1020 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)
1021 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)
1022 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)
1024 /* lprocfs_jobstats.c */
1026 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1030 void lprocfs_job_stats_fini(struct obd_device *obd)
1033 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1034 cntr_init_callback fn)
1038 /* lproc_ptlrpc.c */
1039 #define target_print_req NULL
1041 #endif /* LPROCFS */
1043 #endif /* LPROCFS_SNMP_H */