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 "../../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 struct proc_dir_entry
*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"
372 #define JOBSTATS_NODELOCAL "nodelocal"
374 extern int lprocfs_write_frac_helper(const char *buffer
, unsigned long count
,
376 extern int lprocfs_read_frac_helper(char *buffer
, unsigned long count
,
380 extern int lprocfs_stats_alloc_one(struct lprocfs_stats
*stats
,
384 * < 0 : on error (only possible for opc as LPROCFS_GET_SMP_ID)
386 static inline int lprocfs_stats_lock(struct lprocfs_stats
*stats
, int opc
,
387 unsigned long *flags
)
395 case LPROCFS_GET_SMP_ID
:
396 if (stats
->ls_flags
& LPROCFS_STATS_FLAG_NOPERCPU
) {
397 if (stats
->ls_flags
& LPROCFS_STATS_FLAG_IRQ_SAFE
)
398 spin_lock_irqsave(&stats
->ls_lock
, *flags
);
400 spin_lock(&stats
->ls_lock
);
403 unsigned int cpuid
= get_cpu();
405 if (unlikely(stats
->ls_percpu
[cpuid
] == NULL
)) {
406 rc
= lprocfs_stats_alloc_one(stats
, cpuid
);
415 case LPROCFS_GET_NUM_CPU
:
416 if (stats
->ls_flags
& LPROCFS_STATS_FLAG_NOPERCPU
) {
417 if (stats
->ls_flags
& LPROCFS_STATS_FLAG_IRQ_SAFE
)
418 spin_lock_irqsave(&stats
->ls_lock
, *flags
);
420 spin_lock(&stats
->ls_lock
);
423 return stats
->ls_biggest_alloc_num
;
428 static inline void lprocfs_stats_unlock(struct lprocfs_stats
*stats
, int opc
,
429 unsigned long *flags
)
435 case LPROCFS_GET_SMP_ID
:
436 if (stats
->ls_flags
& LPROCFS_STATS_FLAG_NOPERCPU
) {
437 if (stats
->ls_flags
& LPROCFS_STATS_FLAG_IRQ_SAFE
) {
438 spin_unlock_irqrestore(&stats
->ls_lock
,
441 spin_unlock(&stats
->ls_lock
);
448 case LPROCFS_GET_NUM_CPU
:
449 if (stats
->ls_flags
& LPROCFS_STATS_FLAG_NOPERCPU
) {
450 if (stats
->ls_flags
& LPROCFS_STATS_FLAG_IRQ_SAFE
) {
451 spin_unlock_irqrestore(&stats
->ls_lock
,
454 spin_unlock(&stats
->ls_lock
);
461 static inline unsigned int
462 lprocfs_stats_counter_size(struct lprocfs_stats
*stats
)
464 unsigned int percpusize
;
466 percpusize
= offsetof(struct lprocfs_percpu
, lp_cntr
[stats
->ls_num
]);
468 /* irq safe stats need lc_array_sum[1] */
469 if ((stats
->ls_flags
& LPROCFS_STATS_FLAG_IRQ_SAFE
) != 0)
470 percpusize
+= stats
->ls_num
* sizeof(__s64
);
472 if ((stats
->ls_flags
& LPROCFS_STATS_FLAG_NOPERCPU
) == 0)
473 percpusize
= L1_CACHE_ALIGN(percpusize
);
478 static inline struct lprocfs_counter
*
479 lprocfs_stats_counter_get(struct lprocfs_stats
*stats
, unsigned int cpuid
,
482 struct lprocfs_counter
*cntr
;
484 cntr
= &stats
->ls_percpu
[cpuid
]->lp_cntr
[index
];
486 if ((stats
->ls_flags
& LPROCFS_STATS_FLAG_IRQ_SAFE
) != 0)
487 cntr
= (void *)cntr
+ index
* sizeof(__s64
);
492 /* Two optimized LPROCFS counter increment functions are provided:
493 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
494 * lprocfs_counter_add(cntr) - use for multi-valued counters
495 * Counter data layout allows config flag, counter lock and the
496 * count itself to reside within a single cache line.
499 extern void lprocfs_counter_add(struct lprocfs_stats
*stats
, int idx
,
501 extern void lprocfs_counter_sub(struct lprocfs_stats
*stats
, int idx
,
504 #define lprocfs_counter_incr(stats, idx) \
505 lprocfs_counter_add(stats, idx, 1)
506 #define lprocfs_counter_decr(stats, idx) \
507 lprocfs_counter_sub(stats, idx, 1)
509 extern __s64
lprocfs_read_helper(struct lprocfs_counter
*lc
,
510 struct lprocfs_counter_header
*header
,
511 enum lprocfs_stats_flags flags
,
512 enum lprocfs_fields_flags field
);
513 static inline __u64
lprocfs_stats_collector(struct lprocfs_stats
*stats
,
515 enum lprocfs_fields_flags field
)
518 unsigned int num_cpu
;
519 unsigned long flags
= 0;
522 LASSERT(stats
!= NULL
);
524 num_cpu
= lprocfs_stats_lock(stats
, LPROCFS_GET_NUM_CPU
, &flags
);
525 for (i
= 0; i
< num_cpu
; i
++) {
526 if (stats
->ls_percpu
[i
] == NULL
)
528 ret
+= lprocfs_read_helper(
529 lprocfs_stats_counter_get(stats
, i
, idx
),
530 &stats
->ls_cnt_header
[idx
], stats
->ls_flags
,
533 lprocfs_stats_unlock(stats
, LPROCFS_GET_NUM_CPU
, &flags
);
537 extern struct lprocfs_stats
*
538 lprocfs_alloc_stats(unsigned int num
, enum lprocfs_stats_flags flags
);
539 extern void lprocfs_clear_stats(struct lprocfs_stats
*stats
);
540 extern void lprocfs_free_stats(struct lprocfs_stats
**stats
);
541 extern void lprocfs_init_ops_stats(int num_private_stats
,
542 struct lprocfs_stats
*stats
);
543 extern void lprocfs_init_mps_stats(int num_private_stats
,
544 struct lprocfs_stats
*stats
);
545 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats
*ldlm_stats
);
546 extern int lprocfs_alloc_obd_stats(struct obd_device
*obddev
,
547 unsigned int num_private_stats
);
548 extern int lprocfs_alloc_md_stats(struct obd_device
*obddev
,
549 unsigned int num_private_stats
);
550 extern void lprocfs_counter_init(struct lprocfs_stats
*stats
, int index
,
551 unsigned conf
, const char *name
,
553 extern void lprocfs_free_obd_stats(struct obd_device
*obddev
);
554 extern void lprocfs_free_md_stats(struct obd_device
*obddev
);
557 extern int lprocfs_add_clear_entry(struct obd_device
* obd
,
558 struct proc_dir_entry
*entry
);
559 extern int lprocfs_exp_setup(struct obd_export
*exp
,
560 lnet_nid_t
*peer_nid
, int *newnid
);
561 extern int lprocfs_exp_cleanup(struct obd_export
*exp
);
562 extern struct proc_dir_entry
*lprocfs_add_simple(struct proc_dir_entry
*root
,
565 struct file_operations
*fops
);
566 extern struct proc_dir_entry
*
567 lprocfs_add_symlink(const char *name
, struct proc_dir_entry
*parent
,
568 const char *format
, ...);
569 extern void lprocfs_free_per_client_stats(struct obd_device
*obd
);
571 lprocfs_nid_stats_clear_write(struct file
*file
, const char *buffer
,
572 unsigned long count
, void *data
);
573 extern int lprocfs_nid_stats_clear_read(struct seq_file
*m
, void *data
);
575 extern int lprocfs_register_stats(struct proc_dir_entry
*root
, const char *name
,
576 struct lprocfs_stats
*stats
);
578 /* lprocfs_status.c */
579 extern int lprocfs_add_vars(struct proc_dir_entry
*root
,
580 struct lprocfs_vars
*var
,
583 extern struct proc_dir_entry
*lprocfs_register(const char *name
,
584 struct proc_dir_entry
*parent
,
585 struct lprocfs_vars
*list
,
588 extern void lprocfs_remove(struct proc_dir_entry
**root
);
589 extern void lprocfs_remove_proc_entry(const char *name
,
590 struct proc_dir_entry
*parent
);
592 extern int lprocfs_obd_setup(struct obd_device
*obd
, struct lprocfs_vars
*list
);
593 extern int lprocfs_obd_cleanup(struct obd_device
*obd
);
595 extern int lprocfs_seq_create(struct proc_dir_entry
*parent
, const char *name
,
597 const struct file_operations
*seq_fops
,
599 extern int lprocfs_obd_seq_create(struct obd_device
*dev
, const char *name
,
601 const struct file_operations
*seq_fops
,
604 /* Generic callbacks */
606 extern int lprocfs_rd_u64(struct seq_file
*m
, void *data
);
607 extern int lprocfs_rd_atomic(struct seq_file
*m
, void *data
);
608 extern int lprocfs_wr_atomic(struct file
*file
, const char *buffer
,
609 unsigned long count
, void *data
);
610 extern int lprocfs_rd_uint(struct seq_file
*m
, void *data
);
611 extern int lprocfs_wr_uint(struct file
*file
, const char *buffer
,
612 unsigned long count
, void *data
);
613 extern int lprocfs_rd_uuid(struct seq_file
*m
, void *data
);
614 extern int lprocfs_rd_name(struct seq_file
*m
, void *data
);
615 extern int lprocfs_rd_server_uuid(struct seq_file
*m
, void *data
);
616 extern int lprocfs_rd_conn_uuid(struct seq_file
*m
, void *data
);
617 extern int lprocfs_rd_import(struct seq_file
*m
, void *data
);
618 extern int lprocfs_rd_state(struct seq_file
*m
, void *data
);
619 extern int lprocfs_rd_connect_flags(struct seq_file
*m
, void *data
);
620 extern int lprocfs_rd_num_exports(struct seq_file
*m
, void *data
);
621 extern int lprocfs_rd_numrefs(struct seq_file
*m
, void *data
);
623 struct adaptive_timeout
;
624 extern int lprocfs_at_hist_helper(struct seq_file
*m
,
625 struct adaptive_timeout
*at
);
626 extern int lprocfs_rd_timeouts(struct seq_file
*m
, void *data
);
627 extern int lprocfs_wr_timeouts(struct file
*file
, const char *buffer
,
628 unsigned long count
, void *data
);
629 extern int lprocfs_wr_evict_client(struct file
*file
, const char *buffer
,
630 size_t count
, loff_t
*off
);
631 extern int lprocfs_wr_ping(struct file
*file
, const char *buffer
,
632 size_t count
, loff_t
*off
);
633 extern int lprocfs_wr_import(struct file
*file
, const char *buffer
,
634 size_t count
, loff_t
*off
);
635 extern int lprocfs_rd_pinger_recov(struct seq_file
*m
, void *n
);
636 extern int lprocfs_wr_pinger_recov(struct file
*file
, const char *buffer
,
637 size_t count
, loff_t
*off
);
640 extern int lprocfs_rd_blksize(struct seq_file
*m
, void *data
);
641 extern int lprocfs_rd_kbytestotal(struct seq_file
*m
, void *data
);
642 extern int lprocfs_rd_kbytesfree(struct seq_file
*m
, void *data
);
643 extern int lprocfs_rd_kbytesavail(struct seq_file
*m
, void *data
);
644 extern int lprocfs_rd_filestotal(struct seq_file
*m
, void *data
);
645 extern int lprocfs_rd_filesfree(struct seq_file
*m
, void *data
);
647 extern int lprocfs_write_helper(const char *buffer
, unsigned long count
,
649 extern int lprocfs_seq_read_frac_helper(struct seq_file
*m
, long val
, int mult
);
650 extern int lprocfs_write_u64_helper(const char *buffer
, unsigned long count
,
652 extern int lprocfs_write_frac_u64_helper(const char *buffer
,
654 __u64
*val
, int mult
);
655 extern char *lprocfs_find_named_value(const char *buffer
, const char *name
,
657 void lprocfs_oh_tally(struct obd_histogram
*oh
, unsigned int value
);
658 void lprocfs_oh_tally_log2(struct obd_histogram
*oh
, unsigned int value
);
659 void lprocfs_oh_clear(struct obd_histogram
*oh
);
660 unsigned long lprocfs_oh_sum(struct obd_histogram
*oh
);
662 void lprocfs_stats_collect(struct lprocfs_stats
*stats
, int idx
,
663 struct lprocfs_counter
*cnt
);
665 extern int lprocfs_single_release(cfs_inode_t
*, struct file
*);
666 extern int lprocfs_seq_release(cfs_inode_t
*, struct file
*);
668 /* You must use these macros when you want to refer to
669 * the import in a client obd_device for a lprocfs entry */
670 #define LPROCFS_CLIMP_CHECK(obd) do { \
671 typecheck(struct obd_device *, obd); \
672 down_read(&(obd)->u.cli.cl_sem); \
673 if ((obd)->u.cli.cl_import == NULL) { \
674 up_read(&(obd)->u.cli.cl_sem); \
678 #define LPROCFS_CLIMP_EXIT(obd) \
679 up_read(&(obd)->u.cli.cl_sem);
682 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
683 proc entries; otherwise, you will define name##_seq_write function also for
684 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
685 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
686 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
687 static int name##_single_open(cfs_inode_t *inode, struct file *file) \
689 return single_open(file, name##_seq_show, PDE_DATA(inode)); \
691 static struct file_operations name##_fops = { \
692 .owner = THIS_MODULE, \
693 .open = name##_single_open, \
695 .write = custom_seq_write, \
696 .llseek = seq_lseek, \
697 .release = lprocfs_single_release, \
700 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
701 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
703 #define LPROC_SEQ_FOPS_RO_TYPE(name, type) \
704 static int name##_##type##_seq_show(struct seq_file *m, void *v)\
706 return lprocfs_rd_##type(m, m->private); \
708 LPROC_SEQ_FOPS_RO(name##_##type)
710 #define LPROC_SEQ_FOPS_RW_TYPE(name, type) \
711 static int name##_##type##_seq_show(struct seq_file *m, void *v)\
713 return lprocfs_rd_##type(m, m->private); \
715 static ssize_t name##_##type##_seq_write(struct file *file, \
716 const char *buffer, size_t count, loff_t *off) \
718 struct seq_file *seq = file->private_data; \
719 return lprocfs_wr_##type(file, buffer, \
720 count, seq->private); \
722 LPROC_SEQ_FOPS(name##_##type);
724 #define LPROC_SEQ_FOPS_WR_ONLY(name, type) \
725 static ssize_t name##_##type##_write(struct file *file, \
726 const char *buffer, size_t count, loff_t *off) \
728 return lprocfs_wr_##type(file, buffer, count, off); \
730 static int name##_##type##_open(cfs_inode_t *inode, struct file *file) \
732 return single_open(file, NULL, PDE_DATA(inode)); \
734 static struct file_operations name##_##type##_fops = { \
735 .open = name##_##type##_open, \
736 .write = name##_##type##_write, \
737 .release = lprocfs_single_release, \
741 struct ptlrpc_request
;
742 extern void target_print_req(void *seq_file
, struct ptlrpc_request
*req
);
745 int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file
*m
, void *data
);
746 int lprocfs_obd_wr_max_pages_per_rpc(struct file
*file
, const char *buffer
,
747 size_t count
, loff_t
*off
);
749 /* all quota proc functions */
750 extern int lprocfs_quota_rd_bunit(char *page
, char **start
,
751 loff_t off
, int count
,
752 int *eof
, void *data
);
753 extern int lprocfs_quota_wr_bunit(struct file
*file
, const char *buffer
,
754 unsigned long count
, void *data
);
755 extern int lprocfs_quota_rd_btune(char *page
, char **start
,
756 loff_t off
, int count
,
757 int *eof
, void *data
);
758 extern int lprocfs_quota_wr_btune(struct file
*file
, const char *buffer
,
759 unsigned long count
, void *data
);
760 extern int lprocfs_quota_rd_iunit(char *page
, char **start
,
761 loff_t off
, int count
,
762 int *eof
, void *data
);
763 extern int lprocfs_quota_wr_iunit(struct file
*file
, const char *buffer
,
764 unsigned long count
, void *data
);
765 extern int lprocfs_quota_rd_itune(char *page
, char **start
,
766 loff_t off
, int count
,
767 int *eof
, void *data
);
768 extern int lprocfs_quota_wr_itune(struct file
*file
, const char *buffer
,
769 unsigned long count
, void *data
);
770 extern int lprocfs_quota_rd_type(char *page
, char **start
, loff_t off
, int count
,
771 int *eof
, void *data
);
772 extern int lprocfs_quota_wr_type(struct file
*file
, const char *buffer
,
773 unsigned long count
, void *data
);
774 extern int lprocfs_quota_rd_switch_seconds(char *page
, char **start
, loff_t off
,
775 int count
, int *eof
, void *data
);
776 extern int lprocfs_quota_wr_switch_seconds(struct file
*file
,
778 unsigned long count
, void *data
);
779 extern int lprocfs_quota_rd_sync_blk(char *page
, char **start
, loff_t off
,
780 int count
, int *eof
, void *data
);
781 extern int lprocfs_quota_wr_sync_blk(struct file
*file
, const char *buffer
,
782 unsigned long count
, void *data
);
783 extern int lprocfs_quota_rd_switch_qs(char *page
, char **start
, loff_t off
,
784 int count
, int *eof
, void *data
);
785 extern int lprocfs_quota_wr_switch_qs(struct file
*file
,
787 unsigned long count
, void *data
);
788 extern int lprocfs_quota_rd_boundary_factor(char *page
, char **start
, loff_t off
,
789 int count
, int *eof
, void *data
);
790 extern int lprocfs_quota_wr_boundary_factor(struct file
*file
,
792 unsigned long count
, void *data
);
793 extern int lprocfs_quota_rd_least_bunit(char *page
, char **start
, loff_t off
,
794 int count
, int *eof
, void *data
);
795 extern int lprocfs_quota_wr_least_bunit(struct file
*file
,
797 unsigned long count
, void *data
);
798 extern int lprocfs_quota_rd_least_iunit(char *page
, char **start
, loff_t off
,
799 int count
, int *eof
, void *data
);
800 extern int lprocfs_quota_wr_least_iunit(struct file
*file
,
802 unsigned long count
, void *data
);
803 extern int lprocfs_quota_rd_qs_factor(char *page
, char **start
, loff_t off
,
804 int count
, int *eof
, void *data
);
805 extern int lprocfs_quota_wr_qs_factor(struct file
*file
,
807 unsigned long count
, void *data
);
809 /* LPROCFS is not defined */
811 #define proc_lustre_root NULL
813 static inline void lprocfs_counter_add(struct lprocfs_stats
*stats
,
814 int index
, long amount
)
816 static inline void lprocfs_counter_incr(struct lprocfs_stats
*stats
,
819 static inline void lprocfs_counter_sub(struct lprocfs_stats
*stats
,
820 int index
, long amount
)
822 static inline void lprocfs_counter_decr(struct lprocfs_stats
*stats
,
825 static inline void lprocfs_counter_init(struct lprocfs_stats
*stats
,
826 int index
, unsigned conf
,
827 const char *name
, const char *units
)
830 static inline __u64
lc_read_helper(struct lprocfs_counter
*lc
,
831 enum lprocfs_fields_flags field
)
834 /* NB: we return !NULL to satisfy error checker */
835 static inline struct lprocfs_stats
*
836 lprocfs_alloc_stats(unsigned int num
, enum lprocfs_stats_flags flags
)
837 { return (struct lprocfs_stats
*)1; }
838 static inline void lprocfs_clear_stats(struct lprocfs_stats
*stats
)
840 static inline void lprocfs_free_stats(struct lprocfs_stats
**stats
)
842 static inline int lprocfs_register_stats(struct proc_dir_entry
*root
,
844 struct lprocfs_stats
*stats
)
846 static inline void lprocfs_init_ops_stats(int num_private_stats
,
847 struct lprocfs_stats
*stats
)
849 static inline void lprocfs_init_mps_stats(int num_private_stats
,
850 struct lprocfs_stats
*stats
)
852 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats
*ldlm_stats
)
854 static inline int lprocfs_alloc_obd_stats(struct obd_device
*obddev
,
855 unsigned int num_private_stats
)
857 static inline int lprocfs_alloc_md_stats(struct obd_device
*obddev
,
858 unsigned int num_private_stats
)
860 static inline void lprocfs_free_obd_stats(struct obd_device
*obddev
)
862 static inline void lprocfs_free_md_stats(struct obd_device
*obddev
)
866 static inline int lprocfs_add_clear_entry(struct obd_export
*exp
)
868 static inline int lprocfs_exp_setup(struct obd_export
*exp
,lnet_nid_t
*peer_nid
,
871 static inline int lprocfs_exp_cleanup(struct obd_export
*exp
)
873 static inline struct proc_dir_entry
*
874 lprocfs_add_simple(struct proc_dir_entry
*root
, char *name
,
875 void *data
, struct file_operations
*fops
)
877 static inline struct proc_dir_entry
*
878 lprocfs_add_symlink(const char *name
, struct proc_dir_entry
*parent
,
879 const char *format
, ...)
881 static inline void lprocfs_free_per_client_stats(struct obd_device
*obd
)
884 int lprocfs_nid_stats_clear_write(struct file
*file
, const char *buffer
,
885 unsigned long count
, void *data
)
888 int lprocfs_nid_stats_clear_read(struct seq_file
*m
, void *data
)
891 static inline struct proc_dir_entry
*
892 lprocfs_register(const char *name
, struct proc_dir_entry
*parent
,
893 struct lprocfs_vars
*list
, void *data
)
895 static inline int lprocfs_add_vars(struct proc_dir_entry
*root
,
896 struct lprocfs_vars
*var
,
899 static inline void lprocfs_remove(struct proc_dir_entry
**root
)
901 static inline void lprocfs_remove_proc_entry(const char *name
,
902 struct proc_dir_entry
*parent
)
904 static inline int lprocfs_obd_setup(struct obd_device
*dev
,
905 struct lprocfs_vars
*list
)
907 static inline int lprocfs_obd_cleanup(struct obd_device
*dev
)
909 static inline int lprocfs_rd_u64(struct seq_file
*m
, void *data
)
911 static inline int lprocfs_rd_uuid(struct seq_file
*m
, void *data
)
913 static inline int lprocfs_rd_name(struct seq_file
*m
, void *data
)
915 static inline int lprocfs_rd_server_uuid(struct seq_file
*m
, void *data
)
917 static inline int lprocfs_rd_conn_uuid(struct seq_file
*m
, void *data
)
919 static inline int lprocfs_rd_import(struct seq_file
*m
, void *data
)
921 static inline int lprocfs_rd_pinger_recov(struct seq_file
*m
, void *n
)
923 static inline int lprocfs_rd_state(struct seq_file
*m
, void *data
)
925 static inline int lprocfs_rd_connect_flags(struct seq_file
*m
, void *data
)
927 static inline int lprocfs_rd_num_exports(struct seq_file
*m
, void *data
)
929 extern inline int lprocfs_rd_numrefs(struct seq_file
*m
, void *data
)
931 struct adaptive_timeout
;
932 static inline int lprocfs_at_hist_helper(struct seq_file
*m
,
933 struct adaptive_timeout
*at
)
935 static inline int lprocfs_rd_timeouts(struct seq_file
*m
, void *data
)
937 static inline int lprocfs_wr_timeouts(struct file
*file
,
939 unsigned long count
, void *data
)
941 static inline int lprocfs_wr_evict_client(struct file
*file
, const char *buffer
,
942 size_t count
, loff_t
*off
)
944 static inline int lprocfs_wr_ping(struct file
*file
, const char *buffer
,
945 size_t count
, loff_t
*off
)
947 static inline int lprocfs_wr_import(struct file
*file
, const char *buffer
,
948 size_t count
, loff_t
*off
)
950 static inline int lprocfs_wr_pinger_recov(struct file
*file
, const char *buffer
,
951 size_t count
, loff_t
*off
)
956 int lprocfs_rd_blksize(struct seq_file
*m
, void *data
)
959 int lprocfs_rd_kbytestotal(struct seq_file
*m
, void *data
)
962 int lprocfs_rd_kbytesfree(struct seq_file
*m
, void *data
)
965 int lprocfs_rd_kbytesavail(struct seq_file
*m
, void *data
)
968 int lprocfs_rd_filestotal(struct seq_file
*m
, void *data
)
971 int lprocfs_rd_filesfree(struct seq_file
*m
, void *data
)
974 void lprocfs_oh_tally(struct obd_histogram
*oh
, unsigned int value
)
977 void lprocfs_oh_tally_log2(struct obd_histogram
*oh
, unsigned int value
)
980 void lprocfs_oh_clear(struct obd_histogram
*oh
)
983 unsigned long lprocfs_oh_sum(struct obd_histogram
*oh
)
986 void lprocfs_stats_collect(struct lprocfs_stats
*stats
, int idx
,
987 struct lprocfs_counter
*cnt
)
990 __u64
lprocfs_stats_collector(struct lprocfs_stats
*stats
, int idx
,
991 enum lprocfs_fields_flags field
)
994 #define LPROC_SEQ_FOPS_RO(name)
995 #define LPROC_SEQ_FOPS(name)
996 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)
997 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)
998 #define LPROC_SEQ_FOPS_WR_ONLY(name, type)
1000 /* lproc_ptlrpc.c */
1001 #define target_print_req NULL
1003 #endif /* LPROCFS */
1005 #endif /* LPROCFS_SNMP_H */