]> bbs.cooldavid.org Git - net-next-2.6.git/blame - fs/fscache/stats.c
FS-Cache: Handle pages pending storage that get evicted under OOM conditions
[net-next-2.6.git] / fs / fscache / stats.c
CommitLineData
7394daa8
DH
1/* FS-Cache statistics
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#define FSCACHE_DEBUG_LEVEL THREAD
13#include <linux/module.h>
14#include <linux/proc_fs.h>
15#include <linux/seq_file.h>
16#include "internal.h"
17
18/*
19 * operation counters
20 */
21atomic_t fscache_n_op_pend;
22atomic_t fscache_n_op_run;
23atomic_t fscache_n_op_enqueue;
24atomic_t fscache_n_op_requeue;
25atomic_t fscache_n_op_deferred_release;
26atomic_t fscache_n_op_release;
27atomic_t fscache_n_op_gc;
5753c441 28atomic_t fscache_n_op_cancelled;
e3d4d28b 29atomic_t fscache_n_op_rejected;
7394daa8
DH
30
31atomic_t fscache_n_attr_changed;
32atomic_t fscache_n_attr_changed_ok;
33atomic_t fscache_n_attr_changed_nobufs;
34atomic_t fscache_n_attr_changed_nomem;
35atomic_t fscache_n_attr_changed_calls;
36
37atomic_t fscache_n_allocs;
38atomic_t fscache_n_allocs_ok;
39atomic_t fscache_n_allocs_wait;
40atomic_t fscache_n_allocs_nobufs;
5753c441 41atomic_t fscache_n_allocs_intr;
7394daa8
DH
42atomic_t fscache_n_alloc_ops;
43atomic_t fscache_n_alloc_op_waits;
44
45atomic_t fscache_n_retrievals;
46atomic_t fscache_n_retrievals_ok;
47atomic_t fscache_n_retrievals_wait;
48atomic_t fscache_n_retrievals_nodata;
49atomic_t fscache_n_retrievals_nobufs;
50atomic_t fscache_n_retrievals_intr;
51atomic_t fscache_n_retrievals_nomem;
52atomic_t fscache_n_retrieval_ops;
53atomic_t fscache_n_retrieval_op_waits;
54
55atomic_t fscache_n_stores;
56atomic_t fscache_n_stores_ok;
57atomic_t fscache_n_stores_again;
58atomic_t fscache_n_stores_nobufs;
59atomic_t fscache_n_stores_oom;
60atomic_t fscache_n_store_ops;
61atomic_t fscache_n_store_calls;
1bccf513
DH
62atomic_t fscache_n_store_pages;
63atomic_t fscache_n_store_radix_deletes;
64atomic_t fscache_n_store_pages_over_limit;
7394daa8 65
201a1542
DH
66atomic_t fscache_n_store_vmscan_not_storing;
67atomic_t fscache_n_store_vmscan_gone;
68atomic_t fscache_n_store_vmscan_busy;
69atomic_t fscache_n_store_vmscan_cancelled;
70
7394daa8
DH
71atomic_t fscache_n_marks;
72atomic_t fscache_n_uncaches;
73
74atomic_t fscache_n_acquires;
75atomic_t fscache_n_acquires_null;
76atomic_t fscache_n_acquires_no_cache;
77atomic_t fscache_n_acquires_ok;
78atomic_t fscache_n_acquires_nobufs;
79atomic_t fscache_n_acquires_oom;
80
81atomic_t fscache_n_updates;
82atomic_t fscache_n_updates_null;
83atomic_t fscache_n_updates_run;
84
85atomic_t fscache_n_relinquishes;
86atomic_t fscache_n_relinquishes_null;
87atomic_t fscache_n_relinquishes_waitcrt;
88
89atomic_t fscache_n_cookie_index;
90atomic_t fscache_n_cookie_data;
91atomic_t fscache_n_cookie_special;
92
93atomic_t fscache_n_object_alloc;
94atomic_t fscache_n_object_no_alloc;
95atomic_t fscache_n_object_lookups;
96atomic_t fscache_n_object_lookups_negative;
97atomic_t fscache_n_object_lookups_positive;
98atomic_t fscache_n_object_created;
99atomic_t fscache_n_object_avail;
100atomic_t fscache_n_object_dead;
101
102atomic_t fscache_n_checkaux_none;
103atomic_t fscache_n_checkaux_okay;
104atomic_t fscache_n_checkaux_update;
105atomic_t fscache_n_checkaux_obsolete;
106
52bd75fd
DH
107atomic_t fscache_n_cop_alloc_object;
108atomic_t fscache_n_cop_lookup_object;
109atomic_t fscache_n_cop_lookup_complete;
110atomic_t fscache_n_cop_grab_object;
111atomic_t fscache_n_cop_update_object;
112atomic_t fscache_n_cop_drop_object;
113atomic_t fscache_n_cop_put_object;
114atomic_t fscache_n_cop_sync_cache;
115atomic_t fscache_n_cop_attr_changed;
116atomic_t fscache_n_cop_read_or_alloc_page;
117atomic_t fscache_n_cop_read_or_alloc_pages;
118atomic_t fscache_n_cop_allocate_page;
119atomic_t fscache_n_cop_allocate_pages;
120atomic_t fscache_n_cop_write_page;
121atomic_t fscache_n_cop_uncache_page;
122atomic_t fscache_n_cop_dissociate_pages;
123
7394daa8
DH
124/*
125 * display the general statistics
126 */
127static int fscache_stats_show(struct seq_file *m, void *v)
128{
129 seq_puts(m, "FS-Cache statistics\n");
130
131 seq_printf(m, "Cookies: idx=%u dat=%u spc=%u\n",
132 atomic_read(&fscache_n_cookie_index),
133 atomic_read(&fscache_n_cookie_data),
134 atomic_read(&fscache_n_cookie_special));
135
136 seq_printf(m, "Objects: alc=%u nal=%u avl=%u ded=%u\n",
137 atomic_read(&fscache_n_object_alloc),
138 atomic_read(&fscache_n_object_no_alloc),
139 atomic_read(&fscache_n_object_avail),
140 atomic_read(&fscache_n_object_dead));
141 seq_printf(m, "ChkAux : non=%u ok=%u upd=%u obs=%u\n",
142 atomic_read(&fscache_n_checkaux_none),
143 atomic_read(&fscache_n_checkaux_okay),
144 atomic_read(&fscache_n_checkaux_update),
145 atomic_read(&fscache_n_checkaux_obsolete));
146
147 seq_printf(m, "Pages : mrk=%u unc=%u\n",
148 atomic_read(&fscache_n_marks),
149 atomic_read(&fscache_n_uncaches));
150
151 seq_printf(m, "Acquire: n=%u nul=%u noc=%u ok=%u nbf=%u"
152 " oom=%u\n",
153 atomic_read(&fscache_n_acquires),
154 atomic_read(&fscache_n_acquires_null),
155 atomic_read(&fscache_n_acquires_no_cache),
156 atomic_read(&fscache_n_acquires_ok),
157 atomic_read(&fscache_n_acquires_nobufs),
158 atomic_read(&fscache_n_acquires_oom));
159
160 seq_printf(m, "Lookups: n=%u neg=%u pos=%u crt=%u\n",
161 atomic_read(&fscache_n_object_lookups),
162 atomic_read(&fscache_n_object_lookups_negative),
163 atomic_read(&fscache_n_object_lookups_positive),
164 atomic_read(&fscache_n_object_created));
165
166 seq_printf(m, "Updates: n=%u nul=%u run=%u\n",
167 atomic_read(&fscache_n_updates),
168 atomic_read(&fscache_n_updates_null),
169 atomic_read(&fscache_n_updates_run));
170
171 seq_printf(m, "Relinqs: n=%u nul=%u wcr=%u\n",
172 atomic_read(&fscache_n_relinquishes),
173 atomic_read(&fscache_n_relinquishes_null),
174 atomic_read(&fscache_n_relinquishes_waitcrt));
175
176 seq_printf(m, "AttrChg: n=%u ok=%u nbf=%u oom=%u run=%u\n",
177 atomic_read(&fscache_n_attr_changed),
178 atomic_read(&fscache_n_attr_changed_ok),
179 atomic_read(&fscache_n_attr_changed_nobufs),
180 atomic_read(&fscache_n_attr_changed_nomem),
181 atomic_read(&fscache_n_attr_changed_calls));
182
5753c441 183 seq_printf(m, "Allocs : n=%u ok=%u wt=%u nbf=%u int=%u\n",
7394daa8
DH
184 atomic_read(&fscache_n_allocs),
185 atomic_read(&fscache_n_allocs_ok),
186 atomic_read(&fscache_n_allocs_wait),
5753c441
DH
187 atomic_read(&fscache_n_allocs_nobufs),
188 atomic_read(&fscache_n_allocs_intr));
7394daa8
DH
189 seq_printf(m, "Allocs : ops=%u owt=%u\n",
190 atomic_read(&fscache_n_alloc_ops),
191 atomic_read(&fscache_n_alloc_op_waits));
192
193 seq_printf(m, "Retrvls: n=%u ok=%u wt=%u nod=%u nbf=%u"
194 " int=%u oom=%u\n",
195 atomic_read(&fscache_n_retrievals),
196 atomic_read(&fscache_n_retrievals_ok),
197 atomic_read(&fscache_n_retrievals_wait),
198 atomic_read(&fscache_n_retrievals_nodata),
199 atomic_read(&fscache_n_retrievals_nobufs),
200 atomic_read(&fscache_n_retrievals_intr),
201 atomic_read(&fscache_n_retrievals_nomem));
202 seq_printf(m, "Retrvls: ops=%u owt=%u\n",
203 atomic_read(&fscache_n_retrieval_ops),
204 atomic_read(&fscache_n_retrieval_op_waits));
205
206 seq_printf(m, "Stores : n=%u ok=%u agn=%u nbf=%u oom=%u\n",
207 atomic_read(&fscache_n_stores),
208 atomic_read(&fscache_n_stores_ok),
209 atomic_read(&fscache_n_stores_again),
210 atomic_read(&fscache_n_stores_nobufs),
211 atomic_read(&fscache_n_stores_oom));
1bccf513 212 seq_printf(m, "Stores : ops=%u run=%u pgs=%u rxd=%u olm=%u\n",
7394daa8 213 atomic_read(&fscache_n_store_ops),
1bccf513
DH
214 atomic_read(&fscache_n_store_calls),
215 atomic_read(&fscache_n_store_pages),
216 atomic_read(&fscache_n_store_radix_deletes),
217 atomic_read(&fscache_n_store_pages_over_limit));
7394daa8 218
201a1542
DH
219 seq_printf(m, "VmScan : nos=%u gon=%u bsy=%u can=%u\n",
220 atomic_read(&fscache_n_store_vmscan_not_storing),
221 atomic_read(&fscache_n_store_vmscan_gone),
222 atomic_read(&fscache_n_store_vmscan_busy),
223 atomic_read(&fscache_n_store_vmscan_cancelled));
224
e3d4d28b 225 seq_printf(m, "Ops : pend=%u run=%u enq=%u can=%u rej=%u\n",
7394daa8
DH
226 atomic_read(&fscache_n_op_pend),
227 atomic_read(&fscache_n_op_run),
5753c441 228 atomic_read(&fscache_n_op_enqueue),
e3d4d28b
DH
229 atomic_read(&fscache_n_op_cancelled),
230 atomic_read(&fscache_n_op_rejected));
7394daa8
DH
231 seq_printf(m, "Ops : dfr=%u rel=%u gc=%u\n",
232 atomic_read(&fscache_n_op_deferred_release),
233 atomic_read(&fscache_n_op_release),
234 atomic_read(&fscache_n_op_gc));
52bd75fd
DH
235
236 seq_printf(m, "CacheOp: alo=%d luo=%d luc=%d gro=%d\n",
237 atomic_read(&fscache_n_cop_alloc_object),
238 atomic_read(&fscache_n_cop_lookup_object),
239 atomic_read(&fscache_n_cop_lookup_complete),
240 atomic_read(&fscache_n_cop_grab_object));
241 seq_printf(m, "CacheOp: upo=%d dro=%d pto=%d atc=%d syn=%d\n",
242 atomic_read(&fscache_n_cop_update_object),
243 atomic_read(&fscache_n_cop_drop_object),
244 atomic_read(&fscache_n_cop_put_object),
245 atomic_read(&fscache_n_cop_attr_changed),
246 atomic_read(&fscache_n_cop_sync_cache));
247 seq_printf(m, "CacheOp: rap=%d ras=%d alp=%d als=%d wrp=%d ucp=%d dsp=%d\n",
248 atomic_read(&fscache_n_cop_read_or_alloc_page),
249 atomic_read(&fscache_n_cop_read_or_alloc_pages),
250 atomic_read(&fscache_n_cop_allocate_page),
251 atomic_read(&fscache_n_cop_allocate_pages),
252 atomic_read(&fscache_n_cop_write_page),
253 atomic_read(&fscache_n_cop_uncache_page),
254 atomic_read(&fscache_n_cop_dissociate_pages));
7394daa8
DH
255 return 0;
256}
257
258/*
259 * open "/proc/fs/fscache/stats" allowing provision of a statistical summary
260 */
261static int fscache_stats_open(struct inode *inode, struct file *file)
262{
263 return single_open(file, fscache_stats_show, NULL);
264}
265
266const struct file_operations fscache_stats_fops = {
267 .owner = THIS_MODULE,
268 .open = fscache_stats_open,
269 .read = seq_read,
270 .llseek = seq_lseek,
271 .release = seq_release,
272};