]> bbs.cooldavid.org Git - net-next-2.6.git/blame - fs/fscache/stats.c
FS-Cache: Permit cache retrieval ops to be interrupted in the initial wait phase
[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;
7394daa8
DH
29
30atomic_t fscache_n_attr_changed;
31atomic_t fscache_n_attr_changed_ok;
32atomic_t fscache_n_attr_changed_nobufs;
33atomic_t fscache_n_attr_changed_nomem;
34atomic_t fscache_n_attr_changed_calls;
35
36atomic_t fscache_n_allocs;
37atomic_t fscache_n_allocs_ok;
38atomic_t fscache_n_allocs_wait;
39atomic_t fscache_n_allocs_nobufs;
5753c441 40atomic_t fscache_n_allocs_intr;
7394daa8
DH
41atomic_t fscache_n_alloc_ops;
42atomic_t fscache_n_alloc_op_waits;
43
44atomic_t fscache_n_retrievals;
45atomic_t fscache_n_retrievals_ok;
46atomic_t fscache_n_retrievals_wait;
47atomic_t fscache_n_retrievals_nodata;
48atomic_t fscache_n_retrievals_nobufs;
49atomic_t fscache_n_retrievals_intr;
50atomic_t fscache_n_retrievals_nomem;
51atomic_t fscache_n_retrieval_ops;
52atomic_t fscache_n_retrieval_op_waits;
53
54atomic_t fscache_n_stores;
55atomic_t fscache_n_stores_ok;
56atomic_t fscache_n_stores_again;
57atomic_t fscache_n_stores_nobufs;
58atomic_t fscache_n_stores_oom;
59atomic_t fscache_n_store_ops;
60atomic_t fscache_n_store_calls;
61
62atomic_t fscache_n_marks;
63atomic_t fscache_n_uncaches;
64
65atomic_t fscache_n_acquires;
66atomic_t fscache_n_acquires_null;
67atomic_t fscache_n_acquires_no_cache;
68atomic_t fscache_n_acquires_ok;
69atomic_t fscache_n_acquires_nobufs;
70atomic_t fscache_n_acquires_oom;
71
72atomic_t fscache_n_updates;
73atomic_t fscache_n_updates_null;
74atomic_t fscache_n_updates_run;
75
76atomic_t fscache_n_relinquishes;
77atomic_t fscache_n_relinquishes_null;
78atomic_t fscache_n_relinquishes_waitcrt;
79
80atomic_t fscache_n_cookie_index;
81atomic_t fscache_n_cookie_data;
82atomic_t fscache_n_cookie_special;
83
84atomic_t fscache_n_object_alloc;
85atomic_t fscache_n_object_no_alloc;
86atomic_t fscache_n_object_lookups;
87atomic_t fscache_n_object_lookups_negative;
88atomic_t fscache_n_object_lookups_positive;
89atomic_t fscache_n_object_created;
90atomic_t fscache_n_object_avail;
91atomic_t fscache_n_object_dead;
92
93atomic_t fscache_n_checkaux_none;
94atomic_t fscache_n_checkaux_okay;
95atomic_t fscache_n_checkaux_update;
96atomic_t fscache_n_checkaux_obsolete;
97
52bd75fd
DH
98atomic_t fscache_n_cop_alloc_object;
99atomic_t fscache_n_cop_lookup_object;
100atomic_t fscache_n_cop_lookup_complete;
101atomic_t fscache_n_cop_grab_object;
102atomic_t fscache_n_cop_update_object;
103atomic_t fscache_n_cop_drop_object;
104atomic_t fscache_n_cop_put_object;
105atomic_t fscache_n_cop_sync_cache;
106atomic_t fscache_n_cop_attr_changed;
107atomic_t fscache_n_cop_read_or_alloc_page;
108atomic_t fscache_n_cop_read_or_alloc_pages;
109atomic_t fscache_n_cop_allocate_page;
110atomic_t fscache_n_cop_allocate_pages;
111atomic_t fscache_n_cop_write_page;
112atomic_t fscache_n_cop_uncache_page;
113atomic_t fscache_n_cop_dissociate_pages;
114
7394daa8
DH
115/*
116 * display the general statistics
117 */
118static int fscache_stats_show(struct seq_file *m, void *v)
119{
120 seq_puts(m, "FS-Cache statistics\n");
121
122 seq_printf(m, "Cookies: idx=%u dat=%u spc=%u\n",
123 atomic_read(&fscache_n_cookie_index),
124 atomic_read(&fscache_n_cookie_data),
125 atomic_read(&fscache_n_cookie_special));
126
127 seq_printf(m, "Objects: alc=%u nal=%u avl=%u ded=%u\n",
128 atomic_read(&fscache_n_object_alloc),
129 atomic_read(&fscache_n_object_no_alloc),
130 atomic_read(&fscache_n_object_avail),
131 atomic_read(&fscache_n_object_dead));
132 seq_printf(m, "ChkAux : non=%u ok=%u upd=%u obs=%u\n",
133 atomic_read(&fscache_n_checkaux_none),
134 atomic_read(&fscache_n_checkaux_okay),
135 atomic_read(&fscache_n_checkaux_update),
136 atomic_read(&fscache_n_checkaux_obsolete));
137
138 seq_printf(m, "Pages : mrk=%u unc=%u\n",
139 atomic_read(&fscache_n_marks),
140 atomic_read(&fscache_n_uncaches));
141
142 seq_printf(m, "Acquire: n=%u nul=%u noc=%u ok=%u nbf=%u"
143 " oom=%u\n",
144 atomic_read(&fscache_n_acquires),
145 atomic_read(&fscache_n_acquires_null),
146 atomic_read(&fscache_n_acquires_no_cache),
147 atomic_read(&fscache_n_acquires_ok),
148 atomic_read(&fscache_n_acquires_nobufs),
149 atomic_read(&fscache_n_acquires_oom));
150
151 seq_printf(m, "Lookups: n=%u neg=%u pos=%u crt=%u\n",
152 atomic_read(&fscache_n_object_lookups),
153 atomic_read(&fscache_n_object_lookups_negative),
154 atomic_read(&fscache_n_object_lookups_positive),
155 atomic_read(&fscache_n_object_created));
156
157 seq_printf(m, "Updates: n=%u nul=%u run=%u\n",
158 atomic_read(&fscache_n_updates),
159 atomic_read(&fscache_n_updates_null),
160 atomic_read(&fscache_n_updates_run));
161
162 seq_printf(m, "Relinqs: n=%u nul=%u wcr=%u\n",
163 atomic_read(&fscache_n_relinquishes),
164 atomic_read(&fscache_n_relinquishes_null),
165 atomic_read(&fscache_n_relinquishes_waitcrt));
166
167 seq_printf(m, "AttrChg: n=%u ok=%u nbf=%u oom=%u run=%u\n",
168 atomic_read(&fscache_n_attr_changed),
169 atomic_read(&fscache_n_attr_changed_ok),
170 atomic_read(&fscache_n_attr_changed_nobufs),
171 atomic_read(&fscache_n_attr_changed_nomem),
172 atomic_read(&fscache_n_attr_changed_calls));
173
5753c441 174 seq_printf(m, "Allocs : n=%u ok=%u wt=%u nbf=%u int=%u\n",
7394daa8
DH
175 atomic_read(&fscache_n_allocs),
176 atomic_read(&fscache_n_allocs_ok),
177 atomic_read(&fscache_n_allocs_wait),
5753c441
DH
178 atomic_read(&fscache_n_allocs_nobufs),
179 atomic_read(&fscache_n_allocs_intr));
7394daa8
DH
180 seq_printf(m, "Allocs : ops=%u owt=%u\n",
181 atomic_read(&fscache_n_alloc_ops),
182 atomic_read(&fscache_n_alloc_op_waits));
183
184 seq_printf(m, "Retrvls: n=%u ok=%u wt=%u nod=%u nbf=%u"
185 " int=%u oom=%u\n",
186 atomic_read(&fscache_n_retrievals),
187 atomic_read(&fscache_n_retrievals_ok),
188 atomic_read(&fscache_n_retrievals_wait),
189 atomic_read(&fscache_n_retrievals_nodata),
190 atomic_read(&fscache_n_retrievals_nobufs),
191 atomic_read(&fscache_n_retrievals_intr),
192 atomic_read(&fscache_n_retrievals_nomem));
193 seq_printf(m, "Retrvls: ops=%u owt=%u\n",
194 atomic_read(&fscache_n_retrieval_ops),
195 atomic_read(&fscache_n_retrieval_op_waits));
196
197 seq_printf(m, "Stores : n=%u ok=%u agn=%u nbf=%u oom=%u\n",
198 atomic_read(&fscache_n_stores),
199 atomic_read(&fscache_n_stores_ok),
200 atomic_read(&fscache_n_stores_again),
201 atomic_read(&fscache_n_stores_nobufs),
202 atomic_read(&fscache_n_stores_oom));
203 seq_printf(m, "Stores : ops=%u run=%u\n",
204 atomic_read(&fscache_n_store_ops),
205 atomic_read(&fscache_n_store_calls));
206
5753c441 207 seq_printf(m, "Ops : pend=%u run=%u enq=%u can=%u\n",
7394daa8
DH
208 atomic_read(&fscache_n_op_pend),
209 atomic_read(&fscache_n_op_run),
5753c441
DH
210 atomic_read(&fscache_n_op_enqueue),
211 atomic_read(&fscache_n_op_cancelled));
7394daa8
DH
212 seq_printf(m, "Ops : dfr=%u rel=%u gc=%u\n",
213 atomic_read(&fscache_n_op_deferred_release),
214 atomic_read(&fscache_n_op_release),
215 atomic_read(&fscache_n_op_gc));
52bd75fd
DH
216
217 seq_printf(m, "CacheOp: alo=%d luo=%d luc=%d gro=%d\n",
218 atomic_read(&fscache_n_cop_alloc_object),
219 atomic_read(&fscache_n_cop_lookup_object),
220 atomic_read(&fscache_n_cop_lookup_complete),
221 atomic_read(&fscache_n_cop_grab_object));
222 seq_printf(m, "CacheOp: upo=%d dro=%d pto=%d atc=%d syn=%d\n",
223 atomic_read(&fscache_n_cop_update_object),
224 atomic_read(&fscache_n_cop_drop_object),
225 atomic_read(&fscache_n_cop_put_object),
226 atomic_read(&fscache_n_cop_attr_changed),
227 atomic_read(&fscache_n_cop_sync_cache));
228 seq_printf(m, "CacheOp: rap=%d ras=%d alp=%d als=%d wrp=%d ucp=%d dsp=%d\n",
229 atomic_read(&fscache_n_cop_read_or_alloc_page),
230 atomic_read(&fscache_n_cop_read_or_alloc_pages),
231 atomic_read(&fscache_n_cop_allocate_page),
232 atomic_read(&fscache_n_cop_allocate_pages),
233 atomic_read(&fscache_n_cop_write_page),
234 atomic_read(&fscache_n_cop_uncache_page),
235 atomic_read(&fscache_n_cop_dissociate_pages));
7394daa8
DH
236 return 0;
237}
238
239/*
240 * open "/proc/fs/fscache/stats" allowing provision of a statistical summary
241 */
242static int fscache_stats_open(struct inode *inode, struct file *file)
243{
244 return single_open(file, fscache_stats_show, NULL);
245}
246
247const struct file_operations fscache_stats_fops = {
248 .owner = THIS_MODULE,
249 .open = fscache_stats_open,
250 .read = seq_read,
251 .llseek = seq_lseek,
252 .release = seq_release,
253};