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 */
183 enum lprocfs_fields_flags {
184 LPROCFS_FIELDS_FLAGS_CONFIG = 0x0001,
185 LPROCFS_FIELDS_FLAGS_SUM = 0x0002,
186 LPROCFS_FIELDS_FLAGS_MIN = 0x0003,
187 LPROCFS_FIELDS_FLAGS_MAX = 0x0004,
188 LPROCFS_FIELDS_FLAGS_AVG = 0x0005,
189 LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006,
190 LPROCFS_FIELDS_FLAGS_COUNT = 0x0007,
193 struct lprocfs_stats {
194 unsigned short ls_num; /* # of counters */
195 unsigned short ls_biggest_alloc_num;
196 /* 1 + the highest slot index which has
197 * been allocated, the 0th entry is
198 * a statically intialized template */
199 int ls_flags; /* See LPROCFS_STATS_FLAG_* */
200 cfs_spinlock_t ls_lock; /* Lock used only when there are
201 * no percpu stats areas */
202 struct lprocfs_percpu *ls_percpu[0];
205 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
207 /* Pack all opcodes down into a single monotonically increasing index */
208 static inline int opcode_offset(__u32 opc) {
209 if (opc < OST_LAST_OPC) {
211 return (opc - OST_FIRST_OPC);
212 } else if (opc < MDS_LAST_OPC) {
214 return (opc - MDS_FIRST_OPC +
216 } else if (opc < LDLM_LAST_OPC) {
218 return (opc - LDLM_FIRST_OPC +
221 } else if (opc < MGS_LAST_OPC) {
223 return (opc - MGS_FIRST_OPC +
227 } else if (opc < OBD_LAST_OPC) {
229 return (opc - OBD_FIRST_OPC +
234 } else if (opc < LLOG_LAST_OPC) {
236 return (opc - LLOG_FIRST_OPC +
242 } else if (opc < QUOTA_LAST_OPC) {
244 return (opc - QUOTA_FIRST_OPC +
251 } else if (opc < SEQ_LAST_OPC) {
253 return (opc - SEQ_FIRST_OPC +
261 } else if (opc < SEC_LAST_OPC) {
263 return (opc - SEC_FIRST_OPC +
272 } else if (opc < FLD_LAST_OPC) {
274 return (opc - FLD_FIRST_OPC +
291 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST) + \
302 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
306 PTLRPC_REQWAIT_CNTR = 0,
307 PTLRPC_REQQDEPTH_CNTR,
308 PTLRPC_REQACTIVE_CNTR,
310 PTLRPC_REQBUF_AVAIL_CNTR,
314 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
317 LDLM_GLIMPSE_ENQUEUE = 0,
334 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
336 extern cfs_proc_dir_entry_t *proc_lustre_root;
339 struct obd_histogram;
341 /* Days / hours / mins / seconds format */
345 static inline void s2dhms(struct dhms *ts, time_t secs)
347 ts->d = secs / 86400;
354 #define DHMS_FMT "%dd%dh%02dm%02ds"
355 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
357 #define JOBSTATS_JOBID_VAR_MAX_LEN 20
358 #define JOBSTATS_DISABLE "disable"
359 #define JOBSTATS_PROCNAME_UID "procname_uid"
361 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats);
363 struct obd_job_stats {
364 cfs_hash_t *ojs_hash;
366 cfs_rwlock_t ojs_lock; /* protect the obj_list */
368 cntr_init_callback ojs_cntr_init_fn;
369 cfs_timer_t ojs_cleanup_timer;
370 int ojs_cleanup_interval;
375 extern int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
379 * < 0 : on error (only possible for opc as LPROCFS_GET_SMP_ID)
381 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc,
382 unsigned long *flags)
390 case LPROCFS_GET_SMP_ID:
391 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
392 cfs_spin_lock_irqsave(&stats->ls_lock, *flags);
395 unsigned int cpuid = cfs_get_cpu();
397 if (unlikely(stats->ls_percpu[cpuid + 1] == NULL))
398 rc = lprocfs_stats_alloc_one(stats, cpuid + 1);
399 return rc < 0 ? rc : cpuid + 1;
402 case LPROCFS_GET_NUM_CPU:
403 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
404 cfs_spin_lock_irqsave(&stats->ls_lock, *flags);
407 return stats->ls_biggest_alloc_num;
412 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats, int opc,
413 unsigned long *flags)
419 case LPROCFS_GET_SMP_ID:
420 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
421 cfs_spin_unlock_irqrestore(&stats->ls_lock, *flags);
426 case LPROCFS_GET_NUM_CPU:
427 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
428 cfs_spin_unlock_irqrestore(&stats->ls_lock, *flags);
433 /* Two optimized LPROCFS counter increment functions are provided:
434 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
435 * lprocfs_counter_add(cntr) - use for multi-valued counters
436 * Counter data layout allows config flag, counter lock and the
437 * count itself to reside within a single cache line.
440 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
442 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
445 #define lprocfs_counter_incr(stats, idx) \
446 lprocfs_counter_add(stats, idx, 1)
447 #define lprocfs_counter_decr(stats, idx) \
448 lprocfs_counter_sub(stats, idx, 1)
450 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
451 enum lprocfs_fields_flags field);
452 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
454 enum lprocfs_fields_flags field)
457 unsigned int num_cpu;
458 unsigned long flags = 0;
461 LASSERT(stats != NULL);
463 num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
464 for (i = 0; i < num_cpu; i++) {
465 if (stats->ls_percpu[i] == NULL)
467 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
470 lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU, &flags);
474 extern struct lprocfs_stats *
475 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
476 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
477 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
478 extern void lprocfs_init_ops_stats(int num_private_stats,
479 struct lprocfs_stats *stats);
480 extern void lprocfs_init_mps_stats(int num_private_stats,
481 struct lprocfs_stats *stats);
482 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
483 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
484 unsigned int num_private_stats);
485 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
486 unsigned int num_private_stats);
487 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
488 unsigned conf, const char *name,
490 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
491 extern void lprocfs_free_md_stats(struct obd_device *obddev);
494 extern int lprocfs_add_clear_entry(struct obd_device * obd,
495 cfs_proc_dir_entry_t *entry);
496 extern int lprocfs_exp_setup(struct obd_export *exp,
497 lnet_nid_t *peer_nid, int *newnid);
498 extern int lprocfs_exp_cleanup(struct obd_export *exp);
499 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
501 cfs_read_proc_t *read_proc,
502 cfs_write_proc_t *write_proc,
504 struct file_operations *fops);
505 extern struct proc_dir_entry *
506 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
507 const char *format, ...);
508 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
510 lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
511 unsigned long count, void *data);
512 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
513 int count, int *eof, void *data);
515 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
516 struct lprocfs_stats *stats);
518 /* lprocfs_status.c */
519 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
520 struct lprocfs_vars *var,
523 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
524 cfs_proc_dir_entry_t *parent,
525 struct lprocfs_vars *list,
528 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
529 extern void lprocfs_remove_proc_entry(const char *name,
530 struct proc_dir_entry *parent);
532 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
535 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
536 extern int lprocfs_obd_cleanup(struct obd_device *obd);
537 extern struct file_operations lprocfs_evict_client_fops;
539 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name,
540 mode_t mode, struct file_operations *seq_fops,
542 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
543 mode_t mode, struct file_operations *seq_fops,
546 /* Generic callbacks */
548 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
549 int count, int *eof, void *data);
550 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
551 int count, int *eof, void *data);
552 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
553 unsigned long count, void *data);
554 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
555 int count, int *eof, void *data);
556 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
557 unsigned long count, void *data);
558 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
559 int count, int *eof, void *data);
560 extern int lprocfs_rd_name(char *page, char **start, off_t off,
561 int count, int *eof, void *data);
562 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
563 int count, int *eof, void *data);
564 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
565 int count, int *eof, void *data);
566 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
567 int count, int *eof, void *data);
568 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
569 int *eof, void *data);
570 extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
571 int *eof, void *data);
572 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
573 int count, int *eof, void *data);
574 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
575 int count, int *eof, void *data);
576 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
577 int count, int *eof, void *data);
578 struct adaptive_timeout;
579 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
580 struct adaptive_timeout *at);
581 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
582 int count, int *eof, void *data);
583 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
584 unsigned long count, void *data);
585 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
586 unsigned long count, void *data);
587 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
588 unsigned long count, void *data);
589 extern int lprocfs_wr_import(struct file *file, const char *buffer,
590 unsigned long count, void *data);
591 extern int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
592 int count, int *eof, void *data);
593 extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
594 unsigned long count, void *data);
597 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
598 int count, int *eof, void *data);
599 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
600 int count, int *eof, void *data);
601 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
602 int count, int *eof, void *data);
603 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
604 int count, int *eof, void *data);
605 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
606 int count, int *eof, void *data);
607 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
608 int count, int *eof, void *data);
609 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
610 int count, int *eof, void *data);
611 extern int lprocfs_osd_rd_blksize(char *page, char **start, off_t off,
612 int count, int *eof, void *data);
613 extern int lprocfs_osd_rd_kbytesfree(char *page, char **start, off_t off,
614 int count, int *eof, void *data);
615 extern int lprocfs_osd_rd_kbytesavail(char *page, char **start, off_t off,
616 int count, int *eof, void *data);
617 extern int lprocfs_osd_rd_filestotal(char *page, char **start, off_t off,
618 int count, int *eof, void *data);
619 extern int lprocfs_osd_rd_filesfree(char *page, char **start, off_t off,
620 int count, int *eof, void *data);
621 extern int lprocfs_osd_rd_kbytestotal(char *page, char **start, off_t off,
622 int count, int *eof, void *data);
625 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
627 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
629 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
631 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
633 extern int lprocfs_write_frac_u64_helper(const char *buffer,
635 __u64 *val, int mult);
636 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
637 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
638 void lprocfs_oh_clear(struct obd_histogram *oh);
639 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
641 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
642 struct lprocfs_counter *cnt);
644 /* lprocfs_status.c: recovery status */
645 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
646 int count, int *eof, void *data);
648 /* lprocfs_statuc.c: hash statistics */
649 int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
650 int count, int *eof, void *data);
652 /* lprocfs_status.c: IR factor */
653 int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
654 int count, int *eof, void *data);
655 int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer,
656 unsigned long count, void *data);
658 extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
660 /* You must use these macros when you want to refer to
661 * the import in a client obd_device for a lprocfs entry */
662 #define LPROCFS_CLIMP_CHECK(obd) do { \
663 typecheck(struct obd_device *, obd); \
664 cfs_down_read(&(obd)->u.cli.cl_sem); \
665 if ((obd)->u.cli.cl_import == NULL) { \
666 cfs_up_read(&(obd)->u.cli.cl_sem); \
670 #define LPROCFS_CLIMP_EXIT(obd) \
671 cfs_up_read(&(obd)->u.cli.cl_sem);
674 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
675 proc entries; otherwise, you will define name##_seq_write function also for
676 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
677 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
678 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
679 static int name##_seq_open(cfs_inode_t *inode, struct file *file) { \
680 struct proc_dir_entry *dp = PDE(inode); \
682 LPROCFS_ENTRY_AND_CHECK(dp); \
683 rc = single_open(file, name##_seq_show, dp->data); \
690 struct file_operations name##_fops = { \
691 .owner = THIS_MODULE, \
692 .open = name##_seq_open, \
694 .write = custom_seq_write, \
695 .llseek = seq_lseek, \
696 .release = lprocfs_seq_release, \
699 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
700 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
702 /* lprocfs_jobstats.c */
703 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
704 int event, long amount);
705 void lprocfs_job_stats_fini(struct obd_device *obd);
706 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
707 cntr_init_callback fn);
708 int lprocfs_rd_job_interval(char *page, char **start, off_t off,
709 int count, int *eof, void *data);
710 int lprocfs_wr_job_interval(struct file *file, const char *buffer,
711 unsigned long count, void *data);
714 struct ptlrpc_request;
715 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
718 int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
719 int count, int *eof, void *data);
720 int lprocfs_obd_wr_recovery_time_soft(struct file *file,
722 unsigned long count, void *data);
723 int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
724 int count, int *eof, void *data);
725 int lprocfs_obd_wr_recovery_time_hard(struct file *file,
727 unsigned long count, void *data);
728 int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
729 int count, int *eof, void *data);
730 int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
731 int count, int *eof, void *data);
732 int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
733 unsigned long count, void *data);
734 int lprocfs_target_rd_instance(char *page, char **start, off_t off,
735 int count, int *eof, void *data);
737 /* all quota proc functions */
738 extern int lprocfs_quota_rd_bunit(char *page, char **start,
739 off_t off, int count,
740 int *eof, void *data);
741 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
742 unsigned long count, void *data);
743 extern int lprocfs_quota_rd_btune(char *page, char **start,
744 off_t off, int count,
745 int *eof, void *data);
746 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
747 unsigned long count, void *data);
748 extern int lprocfs_quota_rd_iunit(char *page, char **start,
749 off_t off, int count,
750 int *eof, void *data);
751 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
752 unsigned long count, void *data);
753 extern int lprocfs_quota_rd_itune(char *page, char **start,
754 off_t off, int count,
755 int *eof, void *data);
756 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
757 unsigned long count, void *data);
758 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
759 int *eof, void *data);
760 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
761 unsigned long count, void *data);
762 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
763 int count, int *eof, void *data);
764 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
766 unsigned long count, void *data);
767 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
768 int count, int *eof, void *data);
769 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
770 unsigned long count, void *data);
771 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
772 int count, int *eof, void *data);
773 extern int lprocfs_quota_wr_switch_qs(struct file *file,
775 unsigned long count, void *data);
776 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
777 int count, int *eof, void *data);
778 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
780 unsigned long count, void *data);
781 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
782 int count, int *eof, void *data);
783 extern int lprocfs_quota_wr_least_bunit(struct file *file,
785 unsigned long count, void *data);
786 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
787 int count, int *eof, void *data);
788 extern int lprocfs_quota_wr_least_iunit(struct file *file,
790 unsigned long count, void *data);
791 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
792 int count, int *eof, void *data);
793 extern int lprocfs_quota_wr_qs_factor(struct file *file,
795 unsigned long count, void *data);
800 /* LPROCFS is not defined */
804 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
805 int index, long amount)
807 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
810 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
811 int index, long amount)
813 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
816 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
817 int index, unsigned conf,
818 const char *name, const char *units)
821 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
822 enum lprocfs_fields_flags field)
825 /* NB: we return !NULL to satisfy error checker */
826 static inline struct lprocfs_stats *
827 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
828 { return (struct lprocfs_stats *)1; }
829 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
831 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
833 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
835 struct lprocfs_stats *stats)
837 static inline void lprocfs_init_ops_stats(int num_private_stats,
838 struct lprocfs_stats *stats)
840 static inline void lprocfs_init_mps_stats(int num_private_stats,
841 struct lprocfs_stats *stats)
843 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
845 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
846 unsigned int num_private_stats)
848 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
849 unsigned int num_private_stats)
851 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
853 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
857 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
859 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
862 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
864 static inline cfs_proc_dir_entry_t *
865 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
866 cfs_read_proc_t *read_proc, cfs_write_proc_t *write_proc,
867 void *data, struct file_operations *fops)
869 static inline struct proc_dir_entry *
870 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
871 const char *format, ...)
873 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
876 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
877 unsigned long count, void *data)
880 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
881 int count, int *eof, void *data)
884 static inline cfs_proc_dir_entry_t *
885 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
886 struct lprocfs_vars *list, void *data)
888 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
889 struct lprocfs_vars *var,
892 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
894 static inline void lprocfs_remove_proc_entry(const char *name,
895 struct proc_dir_entry *parent)
897 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
900 static inline int lprocfs_obd_setup(struct obd_device *dev,
901 struct lprocfs_vars *list)
903 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
905 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
906 int count, int *eof, void *data)
908 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
909 int count, int *eof, void *data)
911 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
912 int count, int *eof, void *data)
914 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
915 int count, int *eof, void *data)
917 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
918 int count, int *eof, void *data)
920 static inline int lprocfs_rd_import(char *page, char **start, off_t off,
921 int count, int *eof, void *data)
923 static inline int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
924 int count, int *eof, void *data)
926 static inline int lprocfs_rd_state(char *page, char **start, off_t off,
927 int count, int *eof, void *data)
929 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
930 int count, int *eof, void *data)
932 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
933 int count, int *eof, void *data)
935 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
936 int count, int *eof, void *data)
938 struct adaptive_timeout;
939 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
940 struct adaptive_timeout *at)
942 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
943 int count, int *eof, void *data)
945 static inline int lprocfs_wr_timeouts(struct file *file,
947 unsigned long count, void *data)
949 static inline int lprocfs_wr_evict_client(struct file *file,
951 unsigned long count, void *data)
953 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
954 unsigned long count, void *data)
956 static inline int lprocfs_wr_import(struct file *file, const char *buffer,
957 unsigned long count, void *data)
959 static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
960 unsigned long count, void *data)
965 int lprocfs_rd_blksize(char *page, char **start, off_t off,
966 int count, int *eof, void *data)
969 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
970 int count, int *eof, void *data)
973 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
974 int count, int *eof, void *data)
977 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
978 int count, int *eof, void *data)
981 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
982 int count, int *eof, void *data)
985 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
986 int count, int *eof, void *data)
989 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
990 int count, int *eof, void *data)
993 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
996 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
999 void lprocfs_oh_clear(struct obd_histogram *oh)
1002 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1005 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1006 struct lprocfs_counter *cnt)
1009 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1010 enum lprocfs_fields_flags field)
1011 { return (__u64)0; }
1013 #define LPROC_SEQ_FOPS_RO(name)
1014 #define LPROC_SEQ_FOPS(name)
1016 /* lprocfs_jobstats.c */
1018 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1022 void lprocfs_job_stats_fini(struct obd_device *obd)
1025 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1026 cntr_init_callback fn)
1030 /* lproc_ptlrpc.c */
1031 #define target_print_req NULL
1033 #endif /* LPROCFS */
1035 #endif /* LPROCFS_SNMP_H */