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 {
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 #define LC_MIN_INIT ((~(__u64)0) >> 1)
149 struct lprocfs_counter {
150 unsigned int lc_config;
157 const char *lc_name; /* must be static */
158 const char *lc_units; /* must be static */
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 {
189 unsigned short ls_num; /* # of counters */
190 unsigned short ls_biggest_alloc_num;
191 /* 1 + the highest slot index which has
192 * been allocated, the 0th entry is
193 * a statically intialized template */
194 int ls_flags; /* See LPROCFS_STATS_FLAG_* */
195 /* Lock used when there are no percpu stats areas; For percpu stats,
196 * it is used to protect ls_biggest_alloc_num change */
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 rwlock_t ojs_lock; /* protect the obj_list */
363 cntr_init_callback ojs_cntr_init_fn;
365 int ojs_cleanup_interval;
366 time_t ojs_last_cleanup;
371 extern int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
375 * < 0 : on error (only possible for opc as LPROCFS_GET_SMP_ID)
377 static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc,
378 unsigned long *flags)
387 case LPROCFS_GET_SMP_ID:
388 /* percpu counter stats */
389 if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0) {
390 cpuid = cfs_get_cpu();
392 if (unlikely(stats->ls_percpu[cpuid + 1] == NULL))
393 rc = lprocfs_stats_alloc_one(stats, cpuid + 1);
394 return rc < 0 ? rc : cpuid + 1;
397 /* non-percpu counter stats */
398 if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
399 spin_lock_irqsave(&stats->ls_lock, *flags);
401 spin_lock(&stats->ls_lock);
404 case LPROCFS_GET_NUM_CPU:
405 /* percpu counter stats */
406 if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
407 return stats->ls_biggest_alloc_num;
409 /* non-percpu counter stats */
410 if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
411 spin_lock_irqsave(&stats->ls_lock, *flags);
413 spin_lock(&stats->ls_lock);
418 static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats, int opc,
419 unsigned long *flags)
425 case LPROCFS_GET_SMP_ID:
426 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
427 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) {
428 spin_unlock_irqrestore(&stats->ls_lock,
431 spin_unlock(&stats->ls_lock);
438 case LPROCFS_GET_NUM_CPU:
439 if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) {
440 if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) {
441 spin_unlock_irqrestore(&stats->ls_lock,
444 spin_unlock(&stats->ls_lock);
451 /* Two optimized LPROCFS counter increment functions are provided:
452 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
453 * lprocfs_counter_add(cntr) - use for multi-valued counters
454 * Counter data layout allows config flag, counter lock and the
455 * count itself to reside within a single cache line.
458 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
460 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
463 #define lprocfs_counter_incr(stats, idx) \
464 lprocfs_counter_add(stats, idx, 1)
465 #define lprocfs_counter_decr(stats, idx) \
466 lprocfs_counter_sub(stats, idx, 1)
468 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
469 enum lprocfs_fields_flags field);
470 static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,
472 enum lprocfs_fields_flags field)
475 unsigned int num_cpu;
476 unsigned long flags = 0;
479 LASSERT(stats != NULL);
481 num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags);
482 for (i = 0; i < num_cpu; i++) {
483 if (stats->ls_percpu[i] == NULL)
485 ret += lprocfs_read_helper(&(stats->ls_percpu[i]->lp_cntr[idx]),
488 lprocfs_stats_unlock(stats, LPROCFS_GET_NUM_CPU, &flags);
492 extern struct lprocfs_stats *
493 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
494 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
495 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
496 extern void lprocfs_init_ops_stats(int num_private_stats,
497 struct lprocfs_stats *stats);
498 extern void lprocfs_init_mps_stats(int num_private_stats,
499 struct lprocfs_stats *stats);
500 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
501 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
502 unsigned int num_private_stats);
503 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
504 unsigned int num_private_stats);
505 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
506 unsigned conf, const char *name,
508 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
509 extern void lprocfs_free_md_stats(struct obd_device *obddev);
512 extern int lprocfs_add_clear_entry(struct obd_device * obd,
513 cfs_proc_dir_entry_t *entry);
514 extern int lprocfs_exp_setup(struct obd_export *exp,
515 lnet_nid_t *peer_nid, int *newnid);
516 extern int lprocfs_exp_cleanup(struct obd_export *exp);
517 extern cfs_proc_dir_entry_t *lprocfs_add_simple(struct proc_dir_entry *root,
519 cfs_read_proc_t *read_proc,
520 cfs_write_proc_t *write_proc,
522 struct file_operations *fops);
523 extern struct proc_dir_entry *
524 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
525 const char *format, ...);
526 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
528 lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
529 unsigned long count, void *data);
530 extern int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
531 int count, int *eof, void *data);
533 extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name,
534 struct lprocfs_stats *stats);
536 /* lprocfs_status.c */
537 extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
538 struct lprocfs_vars *var,
541 extern cfs_proc_dir_entry_t *lprocfs_register(const char *name,
542 cfs_proc_dir_entry_t *parent,
543 struct lprocfs_vars *list,
546 extern void lprocfs_remove(cfs_proc_dir_entry_t **root);
547 extern void lprocfs_remove_proc_entry(const char *name,
548 struct proc_dir_entry *parent);
549 extern void lprocfs_try_remove_proc_entry(const char *name,
550 struct proc_dir_entry *parent);
552 extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root,
555 extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
556 extern int lprocfs_obd_cleanup(struct obd_device *obd);
557 extern struct file_operations lprocfs_evict_client_fops;
559 extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, const char *name,
561 const struct file_operations *seq_fops,
563 extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name,
565 const struct file_operations *seq_fops,
568 /* Generic callbacks */
570 extern int lprocfs_rd_u64(char *page, char **start, off_t off,
571 int count, int *eof, void *data);
572 extern int lprocfs_rd_atomic(char *page, char **start, off_t off,
573 int count, int *eof, void *data);
574 extern int lprocfs_wr_atomic(struct file *file, const char *buffer,
575 unsigned long count, void *data);
576 extern int lprocfs_rd_uint(char *page, char **start, off_t off,
577 int count, int *eof, void *data);
578 extern int lprocfs_wr_uint(struct file *file, const char *buffer,
579 unsigned long count, void *data);
580 extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
581 int count, int *eof, void *data);
582 extern int lprocfs_rd_name(char *page, char **start, off_t off,
583 int count, int *eof, void *data);
584 extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
585 int count, int *eof, void *data);
586 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
587 int count, int *eof, void *data);
588 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
589 int count, int *eof, void *data);
590 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
591 int *eof, void *data);
592 extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
593 int *eof, void *data);
594 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
595 int count, int *eof, void *data);
596 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
597 int count, int *eof, void *data);
598 extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
599 int count, int *eof, void *data);
600 struct adaptive_timeout;
601 extern int lprocfs_at_hist_helper(char *page, int count, int rc,
602 struct adaptive_timeout *at);
603 extern int lprocfs_rd_timeouts(char *page, char **start, off_t off,
604 int count, int *eof, void *data);
605 extern int lprocfs_wr_timeouts(struct file *file, const char *buffer,
606 unsigned long count, void *data);
607 extern int lprocfs_wr_evict_client(struct file *file, const char *buffer,
608 unsigned long count, void *data);
609 extern int lprocfs_wr_ping(struct file *file, const char *buffer,
610 unsigned long count, void *data);
611 extern int lprocfs_wr_import(struct file *file, const char *buffer,
612 unsigned long count, void *data);
613 extern int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
614 int count, int *eof, void *data);
615 extern int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
616 unsigned long count, void *data);
619 extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
620 int count, int *eof, void *data);
621 extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
622 int count, int *eof, void *data);
623 extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
624 int count, int *eof, void *data);
625 extern int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
626 int count, int *eof, void *data);
627 extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
628 int count, int *eof, void *data);
629 extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
630 int count, int *eof, void *data);
631 extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
632 int count, int *eof, void *data);
633 extern int lprocfs_osd_rd_blksize(char *page, char **start, off_t off,
634 int count, int *eof, void *data);
635 extern int lprocfs_osd_rd_kbytesfree(char *page, char **start, off_t off,
636 int count, int *eof, void *data);
637 extern int lprocfs_osd_rd_kbytesavail(char *page, char **start, off_t off,
638 int count, int *eof, void *data);
639 extern int lprocfs_osd_rd_filestotal(char *page, char **start, off_t off,
640 int count, int *eof, void *data);
641 extern int lprocfs_osd_rd_filesfree(char *page, char **start, off_t off,
642 int count, int *eof, void *data);
643 extern int lprocfs_osd_rd_kbytestotal(char *page, char **start, off_t off,
644 int count, int *eof, void *data);
647 extern int lprocfs_write_helper(const char *buffer, unsigned long count,
649 extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count,
651 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
653 extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
655 extern int lprocfs_write_frac_u64_helper(const char *buffer,
657 __u64 *val, int mult);
658 char *lprocfs_find_named_value(const char *buffer, const char *name,
659 unsigned long *count);
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_single_release(cfs_inode_t *, struct file *);
683 extern int lprocfs_seq_release(cfs_inode_t *, struct file *);
685 /* You must use these macros when you want to refer to
686 * the import in a client obd_device for a lprocfs entry */
687 #define LPROCFS_CLIMP_CHECK(obd) do { \
688 typecheck(struct obd_device *, obd); \
689 down_read(&(obd)->u.cli.cl_sem); \
690 if ((obd)->u.cli.cl_import == NULL) { \
691 up_read(&(obd)->u.cli.cl_sem); \
695 #define LPROCFS_CLIMP_EXIT(obd) \
696 up_read(&(obd)->u.cli.cl_sem);
699 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
700 proc entries; otherwise, you will define name##_seq_write function also for
701 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
702 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
703 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
704 static int name##_single_open(cfs_inode_t *inode, struct file *file) { \
705 struct proc_dir_entry *dp = PDE(inode); \
707 LPROCFS_ENTRY_AND_CHECK(dp); \
708 rc = single_open(file, name##_seq_show, dp->data); \
715 struct file_operations name##_fops = { \
716 .owner = THIS_MODULE, \
717 .open = name##_single_open, \
719 .write = custom_seq_write, \
720 .llseek = seq_lseek, \
721 .release = lprocfs_single_release, \
724 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
725 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
727 /* lprocfs_jobstats.c */
728 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
729 int event, long amount);
730 void lprocfs_job_stats_fini(struct obd_device *obd);
731 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
732 cntr_init_callback fn);
733 int lprocfs_rd_job_interval(char *page, char **start, off_t off,
734 int count, int *eof, void *data);
735 int lprocfs_wr_job_interval(struct file *file, const char *buffer,
736 unsigned long count, void *data);
739 struct ptlrpc_request;
740 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
743 int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
744 int count, int *eof, void *data);
745 int lprocfs_obd_wr_recovery_time_soft(struct file *file,
747 unsigned long count, void *data);
748 int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
749 int count, int *eof, void *data);
750 int lprocfs_obd_wr_recovery_time_hard(struct file *file,
752 unsigned long count, void *data);
753 int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
754 int count, int *eof, void *data);
755 int lprocfs_obd_rd_max_pages_per_rpc(char *page, char **start, off_t off,
756 int count, int *eof, void *data);
757 int lprocfs_obd_wr_max_pages_per_rpc(struct file *file, const char *buffer,
758 unsigned long count, void *data);
759 int lprocfs_target_rd_instance(char *page, char **start, off_t off,
760 int count, int *eof, void *data);
762 /* all quota proc functions */
763 extern int lprocfs_quota_rd_bunit(char *page, char **start,
764 off_t off, int count,
765 int *eof, void *data);
766 extern int lprocfs_quota_wr_bunit(struct file *file, const char *buffer,
767 unsigned long count, void *data);
768 extern int lprocfs_quota_rd_btune(char *page, char **start,
769 off_t off, int count,
770 int *eof, void *data);
771 extern int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
772 unsigned long count, void *data);
773 extern int lprocfs_quota_rd_iunit(char *page, char **start,
774 off_t off, int count,
775 int *eof, void *data);
776 extern int lprocfs_quota_wr_iunit(struct file *file, const char *buffer,
777 unsigned long count, void *data);
778 extern int lprocfs_quota_rd_itune(char *page, char **start,
779 off_t off, int count,
780 int *eof, void *data);
781 extern int lprocfs_quota_wr_itune(struct file *file, const char *buffer,
782 unsigned long count, void *data);
783 extern int lprocfs_quota_rd_type(char *page, char **start, off_t off, int count,
784 int *eof, void *data);
785 extern int lprocfs_quota_wr_type(struct file *file, const char *buffer,
786 unsigned long count, void *data);
787 extern int lprocfs_quota_rd_switch_seconds(char *page, char **start, off_t off,
788 int count, int *eof, void *data);
789 extern int lprocfs_quota_wr_switch_seconds(struct file *file,
791 unsigned long count, void *data);
792 extern int lprocfs_quota_rd_sync_blk(char *page, char **start, off_t off,
793 int count, int *eof, void *data);
794 extern int lprocfs_quota_wr_sync_blk(struct file *file, const char *buffer,
795 unsigned long count, void *data);
796 extern int lprocfs_quota_rd_switch_qs(char *page, char **start, off_t off,
797 int count, int *eof, void *data);
798 extern int lprocfs_quota_wr_switch_qs(struct file *file,
800 unsigned long count, void *data);
801 extern int lprocfs_quota_rd_boundary_factor(char *page, char **start, off_t off,
802 int count, int *eof, void *data);
803 extern int lprocfs_quota_wr_boundary_factor(struct file *file,
805 unsigned long count, void *data);
806 extern int lprocfs_quota_rd_least_bunit(char *page, char **start, off_t off,
807 int count, int *eof, void *data);
808 extern int lprocfs_quota_wr_least_bunit(struct file *file,
810 unsigned long count, void *data);
811 extern int lprocfs_quota_rd_least_iunit(char *page, char **start, off_t off,
812 int count, int *eof, void *data);
813 extern int lprocfs_quota_wr_least_iunit(struct file *file,
815 unsigned long count, void *data);
816 extern int lprocfs_quota_rd_qs_factor(char *page, char **start, off_t off,
817 int count, int *eof, void *data);
818 extern int lprocfs_quota_wr_qs_factor(struct file *file,
820 unsigned long count, void *data);
825 /* LPROCFS is not defined */
827 #define proc_lustre_root NULL
829 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
830 int index, long amount)
832 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
835 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
836 int index, long amount)
838 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
841 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
842 int index, unsigned conf,
843 const char *name, const char *units)
846 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
847 enum lprocfs_fields_flags field)
850 /* NB: we return !NULL to satisfy error checker */
851 static inline struct lprocfs_stats *
852 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
853 { return (struct lprocfs_stats *)1; }
854 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
856 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
858 static inline int lprocfs_register_stats(cfs_proc_dir_entry_t *root,
860 struct lprocfs_stats *stats)
862 static inline void lprocfs_init_ops_stats(int num_private_stats,
863 struct lprocfs_stats *stats)
865 static inline void lprocfs_init_mps_stats(int num_private_stats,
866 struct lprocfs_stats *stats)
868 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
870 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
871 unsigned int num_private_stats)
873 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
874 unsigned int num_private_stats)
876 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
878 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
882 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
884 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid,
887 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
889 static inline cfs_proc_dir_entry_t *
890 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
891 cfs_read_proc_t *read_proc, cfs_write_proc_t *write_proc,
892 void *data, struct file_operations *fops)
894 static inline struct proc_dir_entry *
895 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
896 const char *format, ...)
898 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
901 int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
902 unsigned long count, void *data)
905 int lprocfs_nid_stats_clear_read(char *page, char **start, off_t off,
906 int count, int *eof, void *data)
909 static inline cfs_proc_dir_entry_t *
910 lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent,
911 struct lprocfs_vars *list, void *data)
913 static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root,
914 struct lprocfs_vars *var,
917 static inline void lprocfs_remove(cfs_proc_dir_entry_t **root)
919 static inline void lprocfs_remove_proc_entry(const char *name,
920 struct proc_dir_entry *parent)
922 static inline void lprocfs_try_remove_proc_entry(const char *name,
923 struct proc_dir_entry *parent)
925 static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head,
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(char *page, char **start, off_t off,
934 int count, int *eof, void *data)
936 static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
937 int count, int *eof, void *data)
939 static inline int lprocfs_rd_name(char *page, char **start, off_t off,
940 int count, int *eof, void *data)
942 static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
943 int count, int *eof, void *data)
945 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
946 int count, int *eof, void *data)
948 static inline int lprocfs_rd_import(char *page, char **start, off_t off,
949 int count, int *eof, void *data)
951 static inline int lprocfs_rd_pinger_recov(char *page, char **start, off_t off,
952 int count, int *eof, void *data)
954 static inline int lprocfs_rd_state(char *page, char **start, off_t off,
955 int count, int *eof, void *data)
957 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
958 int count, int *eof, void *data)
960 static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
961 int count, int *eof, void *data)
963 static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
964 int count, int *eof, void *data)
966 struct adaptive_timeout;
967 static inline int lprocfs_at_hist_helper(char *page, int count, int rc,
968 struct adaptive_timeout *at)
970 static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off,
971 int count, int *eof, void *data)
973 static inline int lprocfs_wr_timeouts(struct file *file,
975 unsigned long count, void *data)
977 static inline int lprocfs_wr_evict_client(struct file *file,
979 unsigned long count, void *data)
981 static inline int lprocfs_wr_ping(struct file *file, const char *buffer,
982 unsigned long count, void *data)
984 static inline int lprocfs_wr_import(struct file *file, const char *buffer,
985 unsigned long count, void *data)
987 static inline int lprocfs_wr_pinger_recov(struct file *file, const char *buffer,
988 unsigned long count, void *data)
993 int lprocfs_rd_blksize(char *page, char **start, off_t off,
994 int count, int *eof, void *data)
997 int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
998 int count, int *eof, void *data)
1001 int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
1002 int count, int *eof, void *data)
1005 int lprocfs_rd_kbytesavail(char *page, char **start, off_t off,
1006 int count, int *eof, void *data)
1009 int lprocfs_rd_filestotal(char *page, char **start, off_t off,
1010 int count, int *eof, void *data)
1013 int lprocfs_rd_filesfree(char *page, char **start, off_t off,
1014 int count, int *eof, void *data)
1017 int lprocfs_rd_filegroups(char *page, char **start, off_t off,
1018 int count, int *eof, void *data)
1021 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
1024 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
1027 void lprocfs_oh_clear(struct obd_histogram *oh)
1030 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
1033 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
1034 struct lprocfs_counter *cnt)
1037 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
1038 enum lprocfs_fields_flags field)
1039 { return (__u64)0; }
1041 #define LPROC_SEQ_FOPS_RO(name)
1042 #define LPROC_SEQ_FOPS(name)
1044 /* lprocfs_jobstats.c */
1046 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
1050 void lprocfs_job_stats_fini(struct obd_device *obd)
1053 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
1054 cntr_init_callback fn)
1058 /* lproc_ptlrpc.c */
1059 #define target_print_req NULL
1061 #endif /* LPROCFS */
1063 #endif /* LPROCFS_SNMP_H */