aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fscache/internal.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-04-03 11:42:37 -0400
committerDavid Howells <dhowells@redhat.com>2009-04-03 11:42:37 -0400
commit7394daa8c61dfda4baa687f133748fa0b599b017 (patch)
tree32d2c55ed60596918ec62ce6ecca186337bf4660 /fs/fscache/internal.h
parent06b3db1b9bccdc8c2c743122a89745279e5ecc46 (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.h127
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
34extern atomic_t fscache_obj_instantiate_histogram[HZ];
35extern atomic_t fscache_objs_histogram[HZ];
36extern atomic_t fscache_ops_histogram[HZ];
37extern atomic_t fscache_retrieval_delay_histogram[HZ];
38extern atomic_t fscache_retrieval_histogram[HZ];
39
40static 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
48extern 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 */
33extern unsigned fscache_defer_lookup; 57extern unsigned fscache_defer_lookup;
@@ -35,6 +59,109 @@ extern unsigned fscache_defer_create;
35extern unsigned fscache_debug; 59extern unsigned fscache_debug;
36extern struct kobject *fscache_root; 60extern struct kobject *fscache_root;
37 61
62/*
63 * fsc-proc.c
64 */
65#ifdef CONFIG_PROC_FS
66extern int __init fscache_proc_init(void);
67extern 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
77extern atomic_t fscache_n_ops_processed[FSCACHE_MAX_THREADS];
78extern atomic_t fscache_n_objs_processed[FSCACHE_MAX_THREADS];
79
80extern atomic_t fscache_n_op_pend;
81extern atomic_t fscache_n_op_run;
82extern atomic_t fscache_n_op_enqueue;
83extern atomic_t fscache_n_op_deferred_release;
84extern atomic_t fscache_n_op_release;
85extern atomic_t fscache_n_op_gc;
86
87extern atomic_t fscache_n_attr_changed;
88extern atomic_t fscache_n_attr_changed_ok;
89extern atomic_t fscache_n_attr_changed_nobufs;
90extern atomic_t fscache_n_attr_changed_nomem;
91extern atomic_t fscache_n_attr_changed_calls;
92
93extern atomic_t fscache_n_allocs;
94extern atomic_t fscache_n_allocs_ok;
95extern atomic_t fscache_n_allocs_wait;
96extern atomic_t fscache_n_allocs_nobufs;
97extern atomic_t fscache_n_alloc_ops;
98extern atomic_t fscache_n_alloc_op_waits;
99
100extern atomic_t fscache_n_retrievals;
101extern atomic_t fscache_n_retrievals_ok;
102extern atomic_t fscache_n_retrievals_wait;
103extern atomic_t fscache_n_retrievals_nodata;
104extern atomic_t fscache_n_retrievals_nobufs;
105extern atomic_t fscache_n_retrievals_intr;
106extern atomic_t fscache_n_retrievals_nomem;
107extern atomic_t fscache_n_retrieval_ops;
108extern atomic_t fscache_n_retrieval_op_waits;
109
110extern atomic_t fscache_n_stores;
111extern atomic_t fscache_n_stores_ok;
112extern atomic_t fscache_n_stores_again;
113extern atomic_t fscache_n_stores_nobufs;
114extern atomic_t fscache_n_stores_oom;
115extern atomic_t fscache_n_store_ops;
116extern atomic_t fscache_n_store_calls;
117
118extern atomic_t fscache_n_marks;
119extern atomic_t fscache_n_uncaches;
120
121extern atomic_t fscache_n_acquires;
122extern atomic_t fscache_n_acquires_null;
123extern atomic_t fscache_n_acquires_no_cache;
124extern atomic_t fscache_n_acquires_ok;
125extern atomic_t fscache_n_acquires_nobufs;
126extern atomic_t fscache_n_acquires_oom;
127
128extern atomic_t fscache_n_updates;
129extern atomic_t fscache_n_updates_null;
130extern atomic_t fscache_n_updates_run;
131
132extern atomic_t fscache_n_relinquishes;
133extern atomic_t fscache_n_relinquishes_null;
134extern atomic_t fscache_n_relinquishes_waitcrt;
135
136extern atomic_t fscache_n_cookie_index;
137extern atomic_t fscache_n_cookie_data;
138extern atomic_t fscache_n_cookie_special;
139
140extern atomic_t fscache_n_object_alloc;
141extern atomic_t fscache_n_object_no_alloc;
142extern atomic_t fscache_n_object_lookups;
143extern atomic_t fscache_n_object_lookups_negative;
144extern atomic_t fscache_n_object_lookups_positive;
145extern atomic_t fscache_n_object_created;
146extern atomic_t fscache_n_object_avail;
147extern atomic_t fscache_n_object_dead;
148
149extern atomic_t fscache_n_checkaux_none;
150extern atomic_t fscache_n_checkaux_okay;
151extern atomic_t fscache_n_checkaux_update;
152extern atomic_t fscache_n_checkaux_obsolete;
153
154static inline void fscache_stat(atomic_t *stat)
155{
156 atomic_inc(stat);
157}
158
159extern 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