diff options
author | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:37 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:37 -0400 |
commit | 7394daa8c61dfda4baa687f133748fa0b599b017 (patch) | |
tree | 32d2c55ed60596918ec62ce6ecca186337bf4660 /fs/fscache/internal.h | |
parent | 06b3db1b9bccdc8c2c743122a89745279e5ecc46 (diff) |
FS-Cache: Add use of /proc and presentation of statistics
Make FS-Cache create its /proc interface and present various statistical
information through it. Also provide the functions for updating this
information.
These features are enabled by:
CONFIG_FSCACHE_PROC
CONFIG_FSCACHE_STATS
CONFIG_FSCACHE_HISTOGRAM
The /proc directory for FS-Cache is also exported so that caching modules can
add their own statistics there too.
The FS-Cache module is loadable at this point, and the statistics files can be
examined by userspace:
cat /proc/fs/fscache/stats
cat /proc/fs/fscache/histogram
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Daire Byrne <Daire.Byrne@framestore.com>
Diffstat (limited to 'fs/fscache/internal.h')
-rw-r--r-- | fs/fscache/internal.h | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h index 95dc92da7152..16f9f1f46e4d 100644 --- a/fs/fscache/internal.h +++ b/fs/fscache/internal.h | |||
@@ -28,6 +28,30 @@ | |||
28 | #define FSCACHE_MAX_THREADS 32 | 28 | #define FSCACHE_MAX_THREADS 32 |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * fsc-histogram.c | ||
32 | */ | ||
33 | #ifdef CONFIG_FSCACHE_HISTOGRAM | ||
34 | extern atomic_t fscache_obj_instantiate_histogram[HZ]; | ||
35 | extern atomic_t fscache_objs_histogram[HZ]; | ||
36 | extern atomic_t fscache_ops_histogram[HZ]; | ||
37 | extern atomic_t fscache_retrieval_delay_histogram[HZ]; | ||
38 | extern atomic_t fscache_retrieval_histogram[HZ]; | ||
39 | |||
40 | static inline void fscache_hist(atomic_t histogram[], unsigned long start_jif) | ||
41 | { | ||
42 | unsigned long jif = jiffies - start_jif; | ||
43 | if (jif >= HZ) | ||
44 | jif = HZ - 1; | ||
45 | atomic_inc(&histogram[jif]); | ||
46 | } | ||
47 | |||
48 | extern const struct file_operations fscache_histogram_fops; | ||
49 | |||
50 | #else | ||
51 | #define fscache_hist(hist, start_jif) do {} while (0) | ||
52 | #endif | ||
53 | |||
54 | /* | ||
31 | * fsc-main.c | 55 | * fsc-main.c |
32 | */ | 56 | */ |
33 | extern unsigned fscache_defer_lookup; | 57 | extern unsigned fscache_defer_lookup; |
@@ -35,6 +59,109 @@ extern unsigned fscache_defer_create; | |||
35 | extern unsigned fscache_debug; | 59 | extern unsigned fscache_debug; |
36 | extern struct kobject *fscache_root; | 60 | extern struct kobject *fscache_root; |
37 | 61 | ||
62 | /* | ||
63 | * fsc-proc.c | ||
64 | */ | ||
65 | #ifdef CONFIG_PROC_FS | ||
66 | extern int __init fscache_proc_init(void); | ||
67 | extern void fscache_proc_cleanup(void); | ||
68 | #else | ||
69 | #define fscache_proc_init() (0) | ||
70 | #define fscache_proc_cleanup() do {} while (0) | ||
71 | #endif | ||
72 | |||
73 | /* | ||
74 | * fsc-stats.c | ||
75 | */ | ||
76 | #ifdef CONFIG_FSCACHE_STATS | ||
77 | extern atomic_t fscache_n_ops_processed[FSCACHE_MAX_THREADS]; | ||
78 | extern atomic_t fscache_n_objs_processed[FSCACHE_MAX_THREADS]; | ||
79 | |||
80 | extern atomic_t fscache_n_op_pend; | ||
81 | extern atomic_t fscache_n_op_run; | ||
82 | extern atomic_t fscache_n_op_enqueue; | ||
83 | extern atomic_t fscache_n_op_deferred_release; | ||
84 | extern atomic_t fscache_n_op_release; | ||
85 | extern atomic_t fscache_n_op_gc; | ||
86 | |||
87 | extern atomic_t fscache_n_attr_changed; | ||
88 | extern atomic_t fscache_n_attr_changed_ok; | ||
89 | extern atomic_t fscache_n_attr_changed_nobufs; | ||
90 | extern atomic_t fscache_n_attr_changed_nomem; | ||
91 | extern atomic_t fscache_n_attr_changed_calls; | ||
92 | |||
93 | extern atomic_t fscache_n_allocs; | ||
94 | extern atomic_t fscache_n_allocs_ok; | ||
95 | extern atomic_t fscache_n_allocs_wait; | ||
96 | extern atomic_t fscache_n_allocs_nobufs; | ||
97 | extern atomic_t fscache_n_alloc_ops; | ||
98 | extern atomic_t fscache_n_alloc_op_waits; | ||
99 | |||
100 | extern atomic_t fscache_n_retrievals; | ||
101 | extern atomic_t fscache_n_retrievals_ok; | ||
102 | extern atomic_t fscache_n_retrievals_wait; | ||
103 | extern atomic_t fscache_n_retrievals_nodata; | ||
104 | extern atomic_t fscache_n_retrievals_nobufs; | ||
105 | extern atomic_t fscache_n_retrievals_intr; | ||
106 | extern atomic_t fscache_n_retrievals_nomem; | ||
107 | extern atomic_t fscache_n_retrieval_ops; | ||
108 | extern atomic_t fscache_n_retrieval_op_waits; | ||
109 | |||
110 | extern atomic_t fscache_n_stores; | ||
111 | extern atomic_t fscache_n_stores_ok; | ||
112 | extern atomic_t fscache_n_stores_again; | ||
113 | extern atomic_t fscache_n_stores_nobufs; | ||
114 | extern atomic_t fscache_n_stores_oom; | ||
115 | extern atomic_t fscache_n_store_ops; | ||
116 | extern atomic_t fscache_n_store_calls; | ||
117 | |||
118 | extern atomic_t fscache_n_marks; | ||
119 | extern atomic_t fscache_n_uncaches; | ||
120 | |||
121 | extern atomic_t fscache_n_acquires; | ||
122 | extern atomic_t fscache_n_acquires_null; | ||
123 | extern atomic_t fscache_n_acquires_no_cache; | ||
124 | extern atomic_t fscache_n_acquires_ok; | ||
125 | extern atomic_t fscache_n_acquires_nobufs; | ||
126 | extern atomic_t fscache_n_acquires_oom; | ||
127 | |||
128 | extern atomic_t fscache_n_updates; | ||
129 | extern atomic_t fscache_n_updates_null; | ||
130 | extern atomic_t fscache_n_updates_run; | ||
131 | |||
132 | extern atomic_t fscache_n_relinquishes; | ||
133 | extern atomic_t fscache_n_relinquishes_null; | ||
134 | extern atomic_t fscache_n_relinquishes_waitcrt; | ||
135 | |||
136 | extern atomic_t fscache_n_cookie_index; | ||
137 | extern atomic_t fscache_n_cookie_data; | ||
138 | extern atomic_t fscache_n_cookie_special; | ||
139 | |||
140 | extern atomic_t fscache_n_object_alloc; | ||
141 | extern atomic_t fscache_n_object_no_alloc; | ||
142 | extern atomic_t fscache_n_object_lookups; | ||
143 | extern atomic_t fscache_n_object_lookups_negative; | ||
144 | extern atomic_t fscache_n_object_lookups_positive; | ||
145 | extern atomic_t fscache_n_object_created; | ||
146 | extern atomic_t fscache_n_object_avail; | ||
147 | extern atomic_t fscache_n_object_dead; | ||
148 | |||
149 | extern atomic_t fscache_n_checkaux_none; | ||
150 | extern atomic_t fscache_n_checkaux_okay; | ||
151 | extern atomic_t fscache_n_checkaux_update; | ||
152 | extern atomic_t fscache_n_checkaux_obsolete; | ||
153 | |||
154 | static inline void fscache_stat(atomic_t *stat) | ||
155 | { | ||
156 | atomic_inc(stat); | ||
157 | } | ||
158 | |||
159 | extern const struct file_operations fscache_stats_fops; | ||
160 | #else | ||
161 | |||
162 | #define fscache_stat(stat) do {} while (0) | ||
163 | #endif | ||
164 | |||
38 | /*****************************************************************************/ | 165 | /*****************************************************************************/ |
39 | /* | 166 | /* |
40 | * debug tracing | 167 | * debug tracing |