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.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2016, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 * lustre/include/lprocfs_status.h
34 * Top level header file for LProc
36 * Author: Hariharan Thantry thantry@users.sourceforge.net
38 #ifndef _LPROCFS_STATUS_H
39 #define _LPROCFS_STATUS_H
42 #include <linux/proc_fs.h>
43 #include <linux/rwsem.h>
44 #include <linux/spinlock.h>
45 #include <linux/seq_file.h>
47 #include <lustre/lustre_idl.h>
51 const struct file_operations *fops;
59 /* if we find more consumers this could be generalized */
60 #define OBD_HIST_MAX 32
61 struct obd_histogram {
63 unsigned long oh_buckets[OBD_HIST_MAX];
85 struct obd_histogram hist[BRW_LAST];
89 RENAME_SAMEDIR_SIZE = 0,
90 RENAME_CROSSDIR_SRC_SIZE,
91 RENAME_CROSSDIR_TGT_SIZE,
96 struct obd_histogram hist[RENAME_LAST];
99 /* An lprocfs counter can be configured using the enum bit masks below.
101 * LPROCFS_CNTR_EXTERNALLOCK indicates that an external lock already
102 * protects this counter from concurrent updates. If not specified,
103 * lprocfs an internal per-counter lock variable. External locks are
104 * not used to protect counter increments, but are used to protect
105 * counter readout and resets.
107 * LPROCFS_CNTR_AVGMINMAX indicates a multi-valued counter samples,
108 * (i.e. counter can be incremented by more than "1"). When specified,
109 * the counter maintains min, max and sum in addition to a simple
110 * invocation count. This allows averages to be be computed.
111 * If not specified, the counter is an increment-by-1 counter.
112 * min, max, sum, etc. are not maintained.
114 * LPROCFS_CNTR_STDDEV indicates that the counter should track sum of
115 * squares (for multi-valued counter samples only). This allows
116 * external computation of standard deviation, but involves a 64-bit
117 * multiply per counter increment.
121 LPROCFS_CNTR_EXTERNALLOCK = 0x0001,
122 LPROCFS_CNTR_AVGMINMAX = 0x0002,
123 LPROCFS_CNTR_STDDEV = 0x0004,
125 /* counter data type */
126 LPROCFS_TYPE_REGS = 0x0100,
127 LPROCFS_TYPE_BYTES = 0x0200,
128 LPROCFS_TYPE_PAGES = 0x0400,
129 LPROCFS_TYPE_CYCLE = 0x0800,
132 #define LC_MIN_INIT ((~(__u64)0) >> 1)
134 struct lprocfs_counter_header {
135 unsigned int lc_config;
136 const char *lc_name; /* must be static */
137 const char *lc_units; /* must be static */
140 struct lprocfs_counter {
146 * Every counter has lc_array_sum[0], while lc_array_sum[1] is only
147 * for irq context counter, i.e. stats with
148 * LPROCFS_STATS_FLAG_IRQ_SAFE flag, its counter need
151 __s64 lc_array_sum[1];
153 #define lc_sum lc_array_sum[0]
154 #define lc_sum_irq lc_array_sum[1]
156 struct lprocfs_percpu {
157 struct lprocfs_counter lp_cntr[0];
160 enum lprocfs_stats_lock_ops {
161 LPROCFS_GET_NUM_CPU = 0x0001, /* number allocated per-CPU stats */
162 LPROCFS_GET_SMP_ID = 0x0002, /* current stat to be updated */
165 enum lprocfs_stats_flags {
166 LPROCFS_STATS_FLAG_NONE = 0x0000, /* per cpu counter */
167 LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
168 * area and need locking */
169 LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */
172 enum lprocfs_fields_flags {
173 LPROCFS_FIELDS_FLAGS_CONFIG = 0x0001,
174 LPROCFS_FIELDS_FLAGS_SUM = 0x0002,
175 LPROCFS_FIELDS_FLAGS_MIN = 0x0003,
176 LPROCFS_FIELDS_FLAGS_MAX = 0x0004,
177 LPROCFS_FIELDS_FLAGS_AVG = 0x0005,
178 LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006,
179 LPROCFS_FIELDS_FLAGS_COUNT = 0x0007,
182 struct lprocfs_stats {
184 unsigned short ls_num;
185 /* 1 + the biggest cpu # whose ls_percpu slot has been allocated */
186 unsigned short ls_biggest_alloc_num;
187 enum lprocfs_stats_flags ls_flags;
188 /* Lock used when there are no percpu stats areas; For percpu stats,
189 * it is used to protect ls_biggest_alloc_num change */
192 /* has ls_num of counter headers */
193 struct lprocfs_counter_header *ls_cnt_header;
194 struct lprocfs_percpu *ls_percpu[0];
197 #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC)
199 /* Pack all opcodes down into a single monotonically increasing index */
200 static inline int opcode_offset(__u32 opc) {
201 if (opc < OST_LAST_OPC) {
203 return (opc - OST_FIRST_OPC);
204 } else if (opc < MDS_LAST_OPC) {
206 return (opc - MDS_FIRST_OPC +
208 } else if (opc < LDLM_LAST_OPC) {
210 return (opc - LDLM_FIRST_OPC +
213 } else if (opc < MGS_LAST_OPC) {
215 return (opc - MGS_FIRST_OPC +
219 } else if (opc < OBD_LAST_OPC) {
221 return (opc - OBD_FIRST_OPC +
226 } else if (opc < LLOG_LAST_OPC) {
228 return (opc - LLOG_FIRST_OPC +
234 } else if (opc < QUOTA_LAST_OPC) {
236 return (opc - QUOTA_FIRST_OPC +
243 } else if (opc < SEQ_LAST_OPC) {
245 return (opc - SEQ_FIRST_OPC +
253 } else if (opc < SEC_LAST_OPC) {
255 return (opc - SEC_FIRST_OPC +
264 } else if (opc < FLD_LAST_OPC) {
266 return (opc - FLD_FIRST_OPC +
276 } else if (opc < OUT_UPDATE_LAST_OPC) {
278 return (opc - OUT_UPDATE_FIRST_OPC +
289 } else if (opc < LFSCK_LAST_OPC) {
291 return (opc - LFSCK_FIRST_OPC +
292 OPC_RANGE(OUT_UPDATE) +
310 #define LUSTRE_MAX_OPCODES (OPC_RANGE(OST) + \
320 OPC_RANGE(OUT_UPDATE) + \
323 #define EXTRA_MAX_OPCODES ((PTLRPC_LAST_CNTR - PTLRPC_FIRST_CNTR) + \
327 PTLRPC_REQWAIT_CNTR = 0,
328 PTLRPC_REQQDEPTH_CNTR,
329 PTLRPC_REQACTIVE_CNTR,
331 PTLRPC_REQBUF_AVAIL_CNTR,
335 #define PTLRPC_FIRST_CNTR PTLRPC_REQWAIT_CNTR
337 enum lprocfs_extra_opc {
338 LDLM_GLIMPSE_ENQUEUE = 0,
355 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
357 extern struct proc_dir_entry *proc_lustre_root;
360 struct obd_histogram;
362 /* Days / hours / mins / seconds format */
366 static inline void s2dhms(struct dhms *ts, time_t secs)
368 ts->d = secs / 86400;
375 #define DHMS_FMT "%dd%dh%02dm%02ds"
376 #define DHMS_VARS(x) (x)->d, (x)->h, (x)->m, (x)->s
378 #define JOBSTATS_JOBID_VAR_MAX_LEN 20
379 #define JOBSTATS_DISABLE "disable"
380 #define JOBSTATS_PROCNAME_UID "procname_uid"
381 #define JOBSTATS_NODELOCAL "nodelocal"
383 typedef void (*cntr_init_callback)(struct lprocfs_stats *stats);
385 struct obd_job_stats {
386 struct cfs_hash *ojs_hash; /* hash of jobids */
387 struct list_head ojs_list; /* list of job_stat structs */
388 rwlock_t ojs_lock; /* protect ojs_list/js_list */
389 unsigned int ojs_cleanup_interval;/* seconds before expiry */
390 time_t ojs_last_cleanup; /* previous cleanup time */
391 cntr_init_callback ojs_cntr_init_fn;/* lprocfs_stats initializer */
392 unsigned short ojs_cntr_num; /* number of stats in struct */
393 bool ojs_cleaning; /* currently expiring stats */
396 #ifdef CONFIG_PROC_FS
398 int lprocfs_stats_alloc_one(struct lprocfs_stats *stats,
400 int lprocfs_stats_lock(struct lprocfs_stats *stats,
401 enum lprocfs_stats_lock_ops opc,
402 unsigned long *flags);
403 void lprocfs_stats_unlock(struct lprocfs_stats *stats,
404 enum lprocfs_stats_lock_ops opc,
405 unsigned long *flags);
407 static inline unsigned int
408 lprocfs_stats_counter_size(struct lprocfs_stats *stats)
410 unsigned int percpusize;
412 percpusize = offsetof(struct lprocfs_percpu, lp_cntr[stats->ls_num]);
414 /* irq safe stats need lc_array_sum[1] */
415 if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
416 percpusize += stats->ls_num * sizeof(__s64);
418 if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
419 percpusize = L1_CACHE_ALIGN(percpusize);
424 static inline struct lprocfs_counter *
425 lprocfs_stats_counter_get(struct lprocfs_stats *stats, unsigned int cpuid,
428 struct lprocfs_counter *cntr;
430 cntr = &stats->ls_percpu[cpuid]->lp_cntr[index];
432 if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
433 cntr = (void *)cntr + index * sizeof(__s64);
438 /* Two optimized LPROCFS counter increment functions are provided:
439 * lprocfs_counter_incr(cntr, value) - optimized for by-one counters
440 * lprocfs_counter_add(cntr) - use for multi-valued counters
441 * Counter data layout allows config flag, counter lock and the
442 * count itself to reside within a single cache line.
445 extern void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
447 extern void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx,
450 #define lprocfs_counter_incr(stats, idx) \
451 lprocfs_counter_add(stats, idx, 1)
452 #define lprocfs_counter_decr(stats, idx) \
453 lprocfs_counter_sub(stats, idx, 1)
455 extern __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
456 struct lprocfs_counter_header *header,
457 enum lprocfs_stats_flags flags,
458 enum lprocfs_fields_flags field);
459 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
460 enum lprocfs_fields_flags field);
462 extern struct lprocfs_stats *
463 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
464 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
465 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
466 extern void lprocfs_init_ops_stats(int num_private_stats,
467 struct lprocfs_stats *stats);
468 extern void lprocfs_init_mps_stats(int num_private_stats,
469 struct lprocfs_stats *stats);
470 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
471 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
472 unsigned int num_private_stats);
473 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
474 unsigned int num_private_stats);
475 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
476 unsigned conf, const char *name,
478 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
479 extern void lprocfs_free_md_stats(struct obd_device *obddev);
482 extern int lprocfs_add_clear_entry(struct obd_device * obd,
483 struct proc_dir_entry *entry);
484 #ifdef HAVE_SERVER_SUPPORT
485 extern int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *peer_nid);
486 extern int lprocfs_exp_cleanup(struct obd_export *exp);
488 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
491 extern struct proc_dir_entry *
492 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
493 void *data, const struct file_operations *fops);
494 extern struct proc_dir_entry *
495 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
496 const char *format, ...);
497 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
498 #ifdef HAVE_SERVER_SUPPORT
500 lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
501 size_t count, loff_t *off);
502 extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
504 extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
505 struct lprocfs_stats *stats);
507 /* lprocfs_status.c */
508 extern int lprocfs_add_vars(struct proc_dir_entry *root,
509 struct lprocfs_vars *var, void *data);
510 extern struct proc_dir_entry *
511 lprocfs_register(const char *name, struct proc_dir_entry *parent,
512 struct lprocfs_vars *list, void *data);
513 extern void lprocfs_remove(struct proc_dir_entry **root);
514 extern void lprocfs_remove_proc_entry(const char *name,
515 struct proc_dir_entry *parent);
516 #ifndef HAVE_REMOVE_PROC_SUBTREE
517 extern int remove_proc_subtree(const char *name,
518 struct proc_dir_entry *parent);
519 #define PDE_DATA(inode) (PDE(inode)->data)
521 static inline int LPROCFS_ENTRY_CHECK(struct inode *inode)
523 struct proc_dir_entry *dp = PDE(inode);
526 spin_lock(&(dp)->pde_unload_lock);
527 if (dp->proc_fops == NULL)
529 spin_unlock(&(dp)->pde_unload_lock);
535 static inline int LPROCFS_ENTRY_CHECK(struct inode *inode)
538 extern int lprocfs_obd_setup(struct obd_device *dev);
539 extern int lprocfs_obd_cleanup(struct obd_device *obd);
540 #ifdef HAVE_SERVER_SUPPORT
541 extern const struct file_operations lprocfs_evict_client_fops;
543 extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name,
545 const struct file_operations *seq_fops,
547 extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name,
549 const struct file_operations *seq_fops,
552 /* Generic callbacks */
553 extern int lprocfs_u64_seq_show(struct seq_file *m, void *data);
554 extern int lprocfs_atomic_seq_show(struct seq_file *m, void *data);
555 extern ssize_t lprocfs_atomic_seq_write(struct file *file,
556 const char __user *buffer,
557 size_t count, loff_t *off);
558 extern int lprocfs_uint_seq_show(struct seq_file *m, void *data);
559 extern ssize_t lprocfs_uint_seq_write(struct file *file,
560 const char __user *buffer,
561 size_t count, loff_t *off);
562 extern int lprocfs_wr_uint(struct file *file, const char __user *buffer,
563 unsigned long count, void *data);
564 extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
565 extern int lprocfs_name_seq_show(struct seq_file *m, void *data);
566 extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data);
567 extern int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data);
568 extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
569 extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
570 extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data);
571 #ifdef HAVE_SERVER_SUPPORT
572 extern int lprocfs_num_exports_seq_show(struct seq_file *m, void *data);
574 struct adaptive_timeout;
575 extern int lprocfs_at_hist_helper(struct seq_file *m,
576 struct adaptive_timeout *at);
577 extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data);
579 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
580 size_t count, loff_t *off);
581 #ifdef HAVE_SERVER_SUPPORT
583 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
584 size_t count, loff_t *off);
587 lprocfs_ping_seq_write(struct file *file, const char __user *buffer,
588 size_t count, loff_t *off);
590 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
591 size_t count, loff_t *off);
592 extern int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data);
594 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
595 size_t count, loff_t *off);
598 extern int lprocfs_blksize_seq_show(struct seq_file *m, void *data);
599 extern int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data);
600 extern int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data);
601 extern int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data);
602 extern int lprocfs_filestotal_seq_show(struct seq_file *m, void *data);
603 extern int lprocfs_filesfree_seq_show(struct seq_file *m, void *data);
605 extern int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult);
606 extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
608 extern int lprocfs_str_to_s64(const char __user *buffer, unsigned long count,
610 extern int lprocfs_str_with_units_to_s64(const char __user *buffer,
611 unsigned long count, __s64 *val,
613 char *lprocfs_find_named_value(const char *buffer, const char *name,
615 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);
616 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
617 void lprocfs_oh_clear(struct obd_histogram *oh);
618 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
620 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
621 struct lprocfs_counter *cnt);
623 #ifdef HAVE_SERVER_SUPPORT
624 /* lprocfs_status.c: recovery status */
625 int lprocfs_recovery_status_seq_show(struct seq_file *m, void *data);
627 /* lprocfs_status.c: hash statistics */
628 int lprocfs_hash_seq_show(struct seq_file *m, void *data);
630 /* lprocfs_status.c: IR factor */
631 int lprocfs_ir_factor_seq_show(struct seq_file *m, void *data);
633 lprocfs_ir_factor_seq_write(struct file *file, const char __user *buffer,
634 size_t count, loff_t *off);
636 extern int lprocfs_single_release(struct inode *, struct file *);
637 extern int lprocfs_seq_release(struct inode *, struct file *);
639 /* You must use these macros when you want to refer to
640 * the import in a client obd_device for a lprocfs entry */
641 #define LPROCFS_CLIMP_CHECK(obd) do { \
642 typecheck(struct obd_device *, obd); \
643 down_read(&(obd)->u.cli.cl_sem); \
644 if ((obd)->u.cli.cl_import == NULL) { \
645 up_read(&(obd)->u.cli.cl_sem); \
649 #define LPROCFS_CLIMP_EXIT(obd) \
650 up_read(&(obd)->u.cli.cl_sem);
652 /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only
653 proc entries; otherwise, you will define name##_seq_write function also for
654 a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally,
655 call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */
656 #define __LPROC_SEQ_FOPS(name, custom_seq_write) \
657 static int name##_single_open(struct inode *inode, struct file *file) \
661 rc = LPROCFS_ENTRY_CHECK(inode); \
665 return single_open(file, name##_seq_show, PDE_DATA(inode)); \
667 static const struct file_operations name##_fops = { \
668 .owner = THIS_MODULE, \
669 .open = name##_single_open, \
671 .write = custom_seq_write, \
672 .llseek = seq_lseek, \
673 .release = lprocfs_single_release, \
676 #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)
677 #define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)
679 #define LPROC_SEQ_FOPS_RO_TYPE(name, type) \
680 static int name##_##type##_seq_show(struct seq_file *m, void *v)\
682 return lprocfs_##type##_seq_show(m, m->private); \
684 LPROC_SEQ_FOPS_RO(name##_##type)
686 #define LPROC_SEQ_FOPS_RW_TYPE(name, type) \
687 static int name##_##type##_seq_show(struct seq_file *m, void *v)\
689 return lprocfs_##type##_seq_show(m, m->private); \
691 static ssize_t name##_##type##_seq_write(struct file *file, \
692 const char __user *buffer, size_t count, \
695 struct seq_file *seq = file->private_data; \
696 return lprocfs_##type##_seq_write(file, buffer, \
697 count, seq->private); \
699 LPROC_SEQ_FOPS(name##_##type);
701 #define LPROC_SEQ_FOPS_WO_TYPE(name, type) \
702 static ssize_t name##_##type##_write(struct file *file, \
703 const char __user *buffer, size_t count, \
706 return lprocfs_##type##_seq_write(file, buffer, count, off);\
708 static int name##_##type##_open(struct inode *inode, struct file *file)\
710 return single_open(file, NULL, PDE_DATA(inode)); \
712 static const struct file_operations name##_##type##_fops = { \
713 .open = name##_##type##_open, \
714 .write = name##_##type##_write, \
715 .release = lprocfs_single_release, \
719 struct ptlrpc_request;
720 extern void target_print_req(void *seq_file, struct ptlrpc_request *req);
722 #ifdef HAVE_SERVER_SUPPORT
723 /* lprocfs_jobstats.c */
724 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
725 int event, long amount);
726 void lprocfs_job_stats_fini(struct obd_device *obd);
727 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
728 cntr_init_callback fn);
729 int lprocfs_job_interval_seq_show(struct seq_file *m, void *data);
731 lprocfs_job_interval_seq_write(struct file *file, const char __user *buffer,
732 size_t count, loff_t *off);
734 int lprocfs_recovery_time_soft_seq_show(struct seq_file *m, void *data);
735 ssize_t lprocfs_recovery_time_soft_seq_write(struct file *file,
736 const char __user *buffer,
737 size_t count, loff_t *off);
738 int lprocfs_recovery_time_hard_seq_show(struct seq_file *m, void *data);
740 lprocfs_recovery_time_hard_seq_write(struct file *file,
741 const char __user *buffer,
742 size_t count, loff_t *off);
743 int lprocfs_target_instance_seq_show(struct seq_file *m, void *data);
745 int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data);
747 lprocfs_obd_max_pages_per_rpc_seq_write(struct file *file,
748 const char __user *buffer,
749 size_t count, loff_t *off);
751 struct root_squash_info;
752 int lprocfs_wr_root_squash(const char __user *buffer, unsigned long count,
753 struct root_squash_info *squash, char *name);
754 int lprocfs_wr_nosquash_nids(const char __user *buffer, unsigned long count,
755 struct root_squash_info *squash, char *name);
757 #else /* !CONFIG_PROC_FS */
759 #define proc_lustre_root NULL
761 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
762 int index, long amount)
764 static inline void lprocfs_counter_incr(struct lprocfs_stats *stats,
767 static inline void lprocfs_counter_sub(struct lprocfs_stats *stats,
768 int index, long amount)
770 static inline void lprocfs_counter_decr(struct lprocfs_stats *stats,
773 static inline void lprocfs_counter_init(struct lprocfs_stats *stats,
774 int index, unsigned conf,
775 const char *name, const char *units)
778 static inline __u64 lc_read_helper(struct lprocfs_counter *lc,
779 enum lprocfs_fields_flags field)
782 /* NB: we return !NULL to satisfy error checker */
783 static inline struct lprocfs_stats *
784 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags)
785 { return (struct lprocfs_stats *)1; }
786 static inline void lprocfs_clear_stats(struct lprocfs_stats *stats)
788 static inline void lprocfs_free_stats(struct lprocfs_stats **stats)
790 static inline int lprocfs_register_stats(struct proc_dir_entry *root,
792 struct lprocfs_stats *stats)
794 static inline void lprocfs_init_ops_stats(int num_private_stats,
795 struct lprocfs_stats *stats)
797 static inline void lprocfs_init_mps_stats(int num_private_stats,
798 struct lprocfs_stats *stats)
800 static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
802 static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
803 unsigned int num_private_stats)
805 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
806 unsigned int num_private_stats)
808 static inline void lprocfs_free_obd_stats(struct obd_device *obddev)
810 static inline void lprocfs_free_md_stats(struct obd_device *obddev)
814 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
816 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
818 #ifdef HAVE_SERVER_SUPPORT
820 ssize_t lprocfs_nid_stats_seq_write(struct file *file,
821 const char __user *buffer,
822 size_t count, loff_t *off)
825 int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
827 static inline int lprocfs_exp_setup(struct obd_export *exp,lnet_nid_t *peer_nid)
830 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
832 static inline struct proc_dir_entry *
833 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
834 void *data, const struct file_operations *fops)
836 static inline struct proc_dir_entry *
837 lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
838 const char *format, ...)
840 static inline int lprocfs_add_vars(struct proc_dir_entry *root,
841 struct lprocfs_vars *var, void *data)
843 static inline struct proc_dir_entry *
844 lprocfs_register(const char *name, struct proc_dir_entry *parent,
845 struct lprocfs_vars *list, void *data)
847 static inline void lprocfs_remove(struct proc_dir_entry **root)
849 static inline void lprocfs_remove_proc_entry(const char *name,
850 struct proc_dir_entry *parent)
852 static inline int lprocfs_obd_setup(struct obd_device *dev)
854 static inline int lprocfs_obd_cleanup(struct obd_device *dev)
856 static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
858 static inline int lprocfs_name_seq_show(struct seq_file *m, void *data)
860 static inline int lprocfs_server_seq_show(struct seq_file *m, void *data)
862 static inline int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data)
864 static inline int lprocfs_import_seq_show(struct seq_file *m, void *data)
866 static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)
868 static inline int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data)
870 #ifdef HAVE_SERVER_SUPPORT
871 static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
874 struct adaptive_timeout;
875 static inline int lprocfs_at_hist_helper(struct seq_file *m,
876 struct adaptive_timeout *at)
878 static inline int lprocfs_timeouts_seq_show(struct seq_file *m, void *data)
880 static inline ssize_t
881 lprocfs_timeouts_seq_write(struct file *file, const char __user *buffer,
882 size_t count, loff_t *off)
884 #ifdef HAVE_SERVER_SUPPORT
885 static inline ssize_t
886 lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
887 size_t count, loff_t *off)
890 static inline ssize_t
891 lprocfs_ping_seq_write(struct file *file, const char __user *buffer,
892 size_t count, loff_t *off)
894 static inline ssize_t
895 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
896 size_t count, loff_t *off)
899 lprocfs_pinger_recov_seq_show(struct seq_file *m, void *data)
901 static inline ssize_t
902 lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
903 size_t count, loff_t *off)
908 int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
911 int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
914 int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
917 int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
920 int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
923 int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
926 void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
929 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
932 void lprocfs_oh_clear(struct obd_histogram *oh)
935 unsigned long lprocfs_oh_sum(struct obd_histogram *oh)
938 void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
939 struct lprocfs_counter *cnt)
942 u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,
943 enum lprocfs_fields_flags field)
946 #define LPROC_SEQ_FOPS_RO(name)
947 #define LPROC_SEQ_FOPS(name)
948 #define LPROC_SEQ_FOPS_RO_TYPE(name, type)
949 #define LPROC_SEQ_FOPS_RW_TYPE(name, type)
950 #define LPROC_SEQ_FOPS_WO_TYPE(name, type)
952 /* lprocfs_jobstats.c */
954 int lprocfs_job_stats_log(struct obd_device *obd, char *jobid, int event,
958 void lprocfs_job_stats_fini(struct obd_device *obd)
961 int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
962 cntr_init_callback fn)
967 #define target_print_req NULL
969 #endif /* CONFIG_PROC_FS */
971 #endif /* LPROCFS_STATUS_H */