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 {
168 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
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 int ls_num; /* # of counters */
195 int ls_flags; /* See LPROCFS_STATS_FLAG_* */
196 cfs_spinlock_t ls_lock; /* Lock used only when there are
197 * no percpu stats areas */
198 struct lprocfs_percpu *ls_percpu[0];
201 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
203 /* Pack all opcodes down into a single monotonically increasing index */
204 static inline int opcode_offset(__u32 opc) {
205 if (opc < OST_LAST_OPC) {
207 return (opc - OST_FIRST_OPC);
208 } else if (opc < MDS_LAST_OPC) {
210 return (opc - MDS_FIRST_OPC +
212 } else if (opc < LDLM_LAST_OPC) {
214 return (opc - LDLM_FIRST_OPC +
217 } else if (opc < MGS_LAST_OPC) {
219 return (opc - MGS_FIRST_OPC +
223 } else if (opc < OBD_LAST_OPC) {
225 return (opc - OBD_FIRST_OPC +
230 } else if (opc < LLOG_LAST_OPC) {
232 return (opc - LLOG_FIRST_OPC +
238 } else if (opc < QUOTA_LAST_OPC) {
240 return (opc - QUOTA_FIRST_OPC +
247 } else if (opc < SEQ_LAST_OPC) {
249 return (opc - SEQ_FIRST_OPC +
257 } else if (opc < SEC_LAST_OPC) {
259 return (opc - SEC_FIRST_OPC +
268 } else if (opc < FLD_LAST_OPC) {
270 return (opc - FLD_FIRST_OPC +
287 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST) + \
298 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
302 PTLRPC_REQWAIT_CNTR = 0,
303 PTLRPC_REQQDEPTH_CNTR,
304 PTLRPC_REQACTIVE_CNTR,
306 PTLRPC_REQBUF_AVAIL_CNTR,
310 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
313 LDLM_GLIMPSE_ENQUEUE = 0,
330 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
332 extern cfs_proc_dir_entry_t *proc_lustre_root;
335 struct obd_histogram;
337 /* Days / hours / mins / seconds format */
341 static inline void s2dhms(struct dhms *ts, time_t secs)
343 ts->d = secs / 86400;
350 #define DHMS_FMT "%dd%dh%02dm%02ds"
351 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
353 #define JOBSTATS_JOBID_VAR_MAX_LEN 20
354 #define JOBSTATS_DISABLE "disable"
355 #define JOBSTATS_PROCNAME_UID "procname_uid"
357 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats);
359 struct obd_job_stats {
360 cfs_hash_t *ojs_hash;
362 cfs_rwlock_t ojs_lock; /* protect the obj_list */
364 cntr_init_callback ojs_cntr_init_fn;
365 cfs_timer_t ojs_cleanup_timer;
366 int ojs_cleanup_interval;
371 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc)
377 case LPROCFS_GET_SMP_ID:
378 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
379 cfs_spin_lock(&stats->ls_lock);
382 return cfs_get_cpu();
385 case LPROCFS_GET_NUM_CPU:
386 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
387 cfs_spin_lock(&stats->ls_lock);
390 return cfs_num_possible_cpus();
395 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats, int opc)
401 case LPROCFS_GET_SMP_ID:
402 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
403 cfs_spin_unlock(&stats->ls_lock);
408 case LPROCFS_GET_NUM_CPU:
409 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
410 cfs_spin_unlock(&stats->ls_lock);
415 /* Two optimized LPROCFS counter increment functions are provided:
416 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
417 * lprocfs_counter_add(cntr) - use for multi-valued counters
418 * Counter data layout allows config flag, counter lock and the
419 * count itself to reside within a single cache line.
422 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
424 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
427 #define lprocfs_counter_incr(stats, idx) \
428 lprocfs_counter_add(stats, idx, 1)
429 #define lprocfs_counter_decr(stats, idx) \
430 lprocfs_counter_sub(stats, idx, 1)
432 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
433 enum lprocfs_fields_flags field);
434 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
436 enum lprocfs_fields_flags field)
440 unsigned int num_cpu;
442 LASSERT(stats != NULL);
444 num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU);
445 for (i = 0; i < num_cpu; i++)
446 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
448 lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU);
452 extern struct lprocfs_stats *
453 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
454 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
455 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
456 extern void lprocfs_init_ops_stats(int num_private_stats,
457 struct lprocfs_stats *stats);
458 extern void lprocfs_init_mps_stats(int num_private_stats,
459 struct lprocfs_stats *stats);
460 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
461 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
462 unsigned int num_private_stats);
463 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
464 unsigned int num_private_stats);
465 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
466 unsigned conf, const char *name,
468 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
469 extern void lprocfs_free_md_stats(struct obd_device *obddev);
472 extern int lprocfs_add_clear_entry(struct obd_device * obd,
473 cfs_proc_dir_entry_t *entry);
474 extern int lprocfs_exp_setup(struct obd_export *exp,
475 lnet_nid_t *peer_nid, int *newnid);
476 extern int lprocfs_exp_cleanup(struct obd_export *exp);
477 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
479 cfs_read_proc_t *read_proc,
480 cfs_write_proc_t *write_proc,
482 struct file_operations *fops);
483 extern struct proc_dir_entry *
484 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
485 const char *format, ...);
486 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
488 lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
489 unsigned long count, void *data);
490 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
491 int count, int *eof, void *data);
493 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
494 struct lprocfs_stats *stats);
496 /* lprocfs_status.c */
497 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
498 struct lprocfs_vars *var,
501 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
502 cfs_proc_dir_entry_t *parent,
503 struct lprocfs_vars *list,
506 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
507 extern void lprocfs_remove_proc_entry(const char *name,
508 struct proc_dir_entry *parent);
510 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
513 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
514 extern int lprocfs_obd_cleanup(struct obd_device *obd);
515 extern struct file_operations lprocfs_evict_client_fops;
517 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name,
518 mode_t mode, struct file_operations *seq_fops,
520 extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name,
521 mode_t mode, struct file_operations *seq_fops,
524 /* Generic callbacks */
526 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
527 int count, int *eof, void *data);
528 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
529 int count, int *eof, void *data);
530 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
531 unsigned long count, void *data);
532 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
533 int count, int *eof, void *data);
534 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
535 unsigned long count, void *data);
536 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
537 int count, int *eof, void *data);
538 extern int lprocfs_rd_name(char *page, char **start, off_t off,
539 int count, int *eof, void *data);
540 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
541 int count, int *eof, void *data);
542 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
543 int count, int *eof, void *data);
544 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
545 int count, int *eof, void *data);
546 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
547 int *eof, void *data);
548 extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
549 int *eof, void *data);
550 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
551 int count, int *eof, void *data);
552 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
553 int count, int *eof, void *data);
554 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
555 int count, int *eof, void *data);
556 struct adaptive_timeout;
557 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
558 struct adaptive_timeout *at);
559 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
560 int count, int *eof, void *data);
561 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
562 unsigned long count, void *data);
563 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
564 unsigned long count, void *data);
565 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
566 unsigned long count, void *data);
567 extern int lprocfs_wr_import(struct file *file, const char *buffer,
568 unsigned long count, void *data);
569 extern int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
570 int count, int *eof, void *data);
571 extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
572 unsigned long count, void *data);
575 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
576 int count, int *eof, void *data);
577 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
578 int count, int *eof, void *data);
579 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
580 int count, int *eof, void *data);
581 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
582 int count, int *eof, void *data);
583 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
584 int count, int *eof, void *data);
585 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
586 int count, int *eof, void *data);
587 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
588 int count, int *eof, void *data);
590 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
592 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
594 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
596 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
598 extern int lprocfs_write_frac_u64_helper(const char *buffer,
600 __u64 *val, int mult);
601 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
602 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
603 void lprocfs_oh_clear(struct obd_histogram *oh);
604 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
606 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
607 struct lprocfs_counter *cnt);
609 /* lprocfs_status.c: recovery status */
610 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
611 int count, int *eof, void *data);
613 /* lprocfs_statuc.c: hash statistics */
614 int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
615 int count, int *eof, void *data);
617 /* lprocfs_status.c: IR factor */
618 int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
619 int count, int *eof, void *data);
620 int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer,
621 unsigned long count, void *data);
623 extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
625 /* You must use these macros when you want to refer to
626 * the import in a client obd_device for a lprocfs entry */
627 #define LPROCFS_CLIMP_CHECK(obd) do { \
628 typecheck(struct obd_device *, obd); \
629 cfs_down_read(&(obd)->u.cli.cl_sem); \
630 if ((obd)->u.cli.cl_import == NULL) { \
631 cfs_up_read(&(obd)->u.cli.cl_sem); \
635 #define LPROCFS_CLIMP_EXIT(obd) \
636 cfs_up_read(&(obd)->u.cli.cl_sem);
639 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
640 proc entries; otherwise, you will define name##_seq_write function also for
641 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
642 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
643 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
644 static int name##_seq_open(cfs_inode_t *inode, struct file *file) { \
645 struct proc_dir_entry *dp = PDE(inode); \
647 LPROCFS_ENTRY_AND_CHECK(dp); \
648 rc = single_open(file, name##_seq_show, dp->data); \
655 struct file_operations name##_fops = { \
656 .owner = THIS_MODULE, \
657 .open = name##_seq_open, \
659 .write = custom_seq_write, \
660 .llseek = seq_lseek, \
661 .release = lprocfs_seq_release, \
664 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
665 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
667 /* lprocfs_jobstats.c */
668 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
669 int event, long amount);
670 void lprocfs_job_stats_fini(struct obd_device *obd);
671 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
672 cntr_init_callback fn);
673 int lprocfs_rd_job_interval(char *page, char **start, off_t off,
674 int count, int *eof, void *data);
675 int lprocfs_wr_job_interval(struct file *file, const char *buffer,
676 unsigned long count, void *data);
679 struct ptlrpc_request;
680 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
683 int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
684 int count, int *eof, void *data);
685 int lprocfs_obd_wr_recovery_time_soft(struct file *file,
687 unsigned long count, void *data);
688 int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
689 int count, int *eof, void *data);
690 int lprocfs_obd_wr_recovery_time_hard(struct file *file,
692 unsigned long count, void *data);
693 int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
694 int count, int *eof, void *data);
695 int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
696 int count, int *eof, void *data);
697 int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
698 unsigned long count, void *data);
699 int lprocfs_target_rd_instance(char *page, char **start, off_t off,
700 int count, int *eof, void *data);
702 /* all quota proc functions */
703 extern int lprocfs_quota_rd_bunit(char *page, char **start,
704 off_t off, int count,
705 int *eof, void *data);
706 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
707 unsigned long count, void *data);
708 extern int lprocfs_quota_rd_btune(char *page, char **start,
709 off_t off, int count,
710 int *eof, void *data);
711 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
712 unsigned long count, void *data);
713 extern int lprocfs_quota_rd_iunit(char *page, char **start,
714 off_t off, int count,
715 int *eof, void *data);
716 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
717 unsigned long count, void *data);
718 extern int lprocfs_quota_rd_itune(char *page, char **start,
719 off_t off, int count,
720 int *eof, void *data);
721 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
722 unsigned long count, void *data);
723 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
724 int *eof, void *data);
725 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
726 unsigned long count, void *data);
727 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
728 int count, int *eof, void *data);
729 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
731 unsigned long count, void *data);
732 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
733 int count, int *eof, void *data);
734 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
735 unsigned long count, void *data);
736 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
737 int count, int *eof, void *data);
738 extern int lprocfs_quota_wr_switch_qs(struct file *file,
740 unsigned long count, void *data);
741 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
742 int count, int *eof, void *data);
743 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
745 unsigned long count, void *data);
746 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
747 int count, int *eof, void *data);
748 extern int lprocfs_quota_wr_least_bunit(struct file *file,
750 unsigned long count, void *data);
751 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
752 int count, int *eof, void *data);
753 extern int lprocfs_quota_wr_least_iunit(struct file *file,
755 unsigned long count, void *data);
756 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
757 int count, int *eof, void *data);
758 extern int lprocfs_quota_wr_qs_factor(struct file *file,
760 unsigned long count, void *data);
765 /* LPROCFS is not defined */
769 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
770 int index, long amount)
772 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
775 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
776 int index, long amount)
778 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
781 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
782 int index, unsigned conf,
783 const char *name, const char *units)
786 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
787 enum lprocfs_fields_flags field)
790 /* NB: we return !NULL to satisfy error checker */
791 static inline struct lprocfs_stats *
792 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
793 { return (struct lprocfs_stats *)1; }
794 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
796 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
798 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
800 struct lprocfs_stats *stats)
802 static inline void lprocfs_init_ops_stats(int num_private_stats,
803 struct lprocfs_stats *stats)
805 static inline void lprocfs_init_mps_stats(int num_private_stats,
806 struct lprocfs_stats *stats)
808 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
810 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
811 unsigned int num_private_stats)
813 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
814 unsigned int num_private_stats)
816 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
818 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
822 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
824 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
827 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
829 static inline cfs_proc_dir_entry_t *
830 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
831 cfs_read_proc_t *read_proc, cfs_write_proc_t *write_proc,
832 void *data, struct file_operations *fops)
834 static inline struct proc_dir_entry *
835 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
836 const char *format, ...)
838 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
841 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
842 unsigned long count, void *data)
845 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
846 int count, int *eof, void *data)
849 static inline cfs_proc_dir_entry_t *
850 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
851 struct lprocfs_vars *list, void *data)
853 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
854 struct lprocfs_vars *var,
857 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
859 static inline void lprocfs_remove_proc_entry(const char *name,
860 struct proc_dir_entry *parent)
862 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
865 static inline int lprocfs_obd_setup(struct obd_device *dev,
866 struct lprocfs_vars *list)
868 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
870 static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
871 int count, int *eof, void *data)
873 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
874 int count, int *eof, void *data)
876 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
877 int count, int *eof, void *data)
879 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
880 int count, int *eof, void *data)
882 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
883 int count, int *eof, void *data)
885 static inline int lprocfs_rd_import(char *page, char **start, off_t off,
886 int count, int *eof, void *data)
888 static inline int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
889 int count, int *eof, void *data)
891 static inline int lprocfs_rd_state(char *page, char **start, off_t off,
892 int count, int *eof, void *data)
894 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
895 int count, int *eof, void *data)
897 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
898 int count, int *eof, void *data)
900 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
901 int count, int *eof, void *data)
903 struct adaptive_timeout;
904 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
905 struct adaptive_timeout *at)
907 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
908 int count, int *eof, void *data)
910 static inline int lprocfs_wr_timeouts(struct file *file,
912 unsigned long count, void *data)
914 static inline int lprocfs_wr_evict_client(struct file *file,
916 unsigned long count, void *data)
918 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
919 unsigned long count, void *data)
921 static inline int lprocfs_wr_import(struct file *file, const char *buffer,
922 unsigned long count, void *data)
924 static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
925 unsigned long count, void *data)
930 int lprocfs_rd_blksize(char *page, char **start, off_t off,
931 int count, int *eof, void *data)
934 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
935 int count, int *eof, void *data)
938 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
939 int count, int *eof, void *data)
942 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
943 int count, int *eof, void *data)
946 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
947 int count, int *eof, void *data)
950 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
951 int count, int *eof, void *data)
954 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
955 int count, int *eof, void *data)
958 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
961 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
964 void lprocfs_oh_clear(struct obd_histogram *oh)
967 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
970 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
971 struct lprocfs_counter *cnt)
974 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
975 enum lprocfs_fields_flags field)
978 #define LPROC_SEQ_FOPS_RO(name)
979 #define LPROC_SEQ_FOPS(name)
981 /* lprocfs_jobstats.c */
983 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
987 void lprocfs_job_stats_fini(struct obd_device *obd)
990 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
991 cntr_init_callback fn)
996 #define target_print_req NULL
1000 #endif /* LPROCFS_SNMP_H */