blob: a5aa93ece8c50e4cebcdc05067d801e2d200c991 [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001// SPDX-License-Identifier: GPL-2.0-or-later
David Howells7394daa2009-04-03 16:42:37 +01002/* FS-Cache statistics
3 *
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
David Howells7394daa2009-04-03 16:42:37 +01006 */
7
8#define FSCACHE_DEBUG_LEVEL THREAD
9#include <linux/module.h>
10#include <linux/proc_fs.h>
11#include <linux/seq_file.h>
12#include "internal.h"
13
14/*
15 * operation counters
16 */
17atomic_t fscache_n_op_pend;
18atomic_t fscache_n_op_run;
19atomic_t fscache_n_op_enqueue;
David Howells7394daa2009-04-03 16:42:37 +010020atomic_t fscache_n_op_deferred_release;
David Howells03cdd0e2015-02-25 13:21:15 +000021atomic_t fscache_n_op_initialised;
David Howells7394daa2009-04-03 16:42:37 +010022atomic_t fscache_n_op_release;
23atomic_t fscache_n_op_gc;
David Howells5753c442009-11-19 18:11:19 +000024atomic_t fscache_n_op_cancelled;
David Howellse3d4d282009-11-19 18:11:32 +000025atomic_t fscache_n_op_rejected;
David Howells7394daa2009-04-03 16:42:37 +010026
27atomic_t fscache_n_attr_changed;
28atomic_t fscache_n_attr_changed_ok;
29atomic_t fscache_n_attr_changed_nobufs;
30atomic_t fscache_n_attr_changed_nomem;
31atomic_t fscache_n_attr_changed_calls;
32
33atomic_t fscache_n_allocs;
34atomic_t fscache_n_allocs_ok;
35atomic_t fscache_n_allocs_wait;
36atomic_t fscache_n_allocs_nobufs;
David Howells5753c442009-11-19 18:11:19 +000037atomic_t fscache_n_allocs_intr;
David Howells60d543c2009-11-19 18:11:45 +000038atomic_t fscache_n_allocs_object_dead;
David Howells7394daa2009-04-03 16:42:37 +010039atomic_t fscache_n_alloc_ops;
40atomic_t fscache_n_alloc_op_waits;
41
42atomic_t fscache_n_retrievals;
43atomic_t fscache_n_retrievals_ok;
44atomic_t fscache_n_retrievals_wait;
45atomic_t fscache_n_retrievals_nodata;
46atomic_t fscache_n_retrievals_nobufs;
47atomic_t fscache_n_retrievals_intr;
48atomic_t fscache_n_retrievals_nomem;
David Howells60d543c2009-11-19 18:11:45 +000049atomic_t fscache_n_retrievals_object_dead;
David Howells7394daa2009-04-03 16:42:37 +010050atomic_t fscache_n_retrieval_ops;
51atomic_t fscache_n_retrieval_op_waits;
52
53atomic_t fscache_n_stores;
54atomic_t fscache_n_stores_ok;
55atomic_t fscache_n_stores_again;
56atomic_t fscache_n_stores_nobufs;
57atomic_t fscache_n_stores_oom;
58atomic_t fscache_n_store_ops;
59atomic_t fscache_n_store_calls;
David Howells1bccf512009-11-19 18:11:25 +000060atomic_t fscache_n_store_pages;
61atomic_t fscache_n_store_radix_deletes;
62atomic_t fscache_n_store_pages_over_limit;
David Howells7394daa2009-04-03 16:42:37 +010063
David Howells201a1542009-11-19 18:11:35 +000064atomic_t fscache_n_store_vmscan_not_storing;
65atomic_t fscache_n_store_vmscan_gone;
66atomic_t fscache_n_store_vmscan_busy;
67atomic_t fscache_n_store_vmscan_cancelled;
David Howells8c209ce2012-12-05 13:34:49 +000068atomic_t fscache_n_store_vmscan_wait;
David Howells201a1542009-11-19 18:11:35 +000069
David Howells7394daa2009-04-03 16:42:37 +010070atomic_t fscache_n_marks;
71atomic_t fscache_n_uncaches;
72
73atomic_t fscache_n_acquires;
74atomic_t fscache_n_acquires_null;
75atomic_t fscache_n_acquires_no_cache;
76atomic_t fscache_n_acquires_ok;
77atomic_t fscache_n_acquires_nobufs;
78atomic_t fscache_n_acquires_oom;
79
David Howellsef778e72012-12-20 21:52:36 +000080atomic_t fscache_n_invalidates;
81atomic_t fscache_n_invalidates_run;
82
David Howells7394daa2009-04-03 16:42:37 +010083atomic_t fscache_n_updates;
84atomic_t fscache_n_updates_null;
85atomic_t fscache_n_updates_run;
86
87atomic_t fscache_n_relinquishes;
88atomic_t fscache_n_relinquishes_null;
89atomic_t fscache_n_relinquishes_waitcrt;
David Howells2175bb02009-11-19 18:11:38 +000090atomic_t fscache_n_relinquishes_retire;
David Howells7394daa2009-04-03 16:42:37 +010091
92atomic_t fscache_n_cookie_index;
93atomic_t fscache_n_cookie_data;
94atomic_t fscache_n_cookie_special;
95
96atomic_t fscache_n_object_alloc;
97atomic_t fscache_n_object_no_alloc;
98atomic_t fscache_n_object_lookups;
99atomic_t fscache_n_object_lookups_negative;
100atomic_t fscache_n_object_lookups_positive;
David Howellsfee096d2009-11-19 18:12:05 +0000101atomic_t fscache_n_object_lookups_timed_out;
David Howells7394daa2009-04-03 16:42:37 +0100102atomic_t fscache_n_object_created;
103atomic_t fscache_n_object_avail;
104atomic_t fscache_n_object_dead;
105
106atomic_t fscache_n_checkaux_none;
107atomic_t fscache_n_checkaux_okay;
108atomic_t fscache_n_checkaux_update;
109atomic_t fscache_n_checkaux_obsolete;
110
David Howells52bd75f2009-11-19 18:11:08 +0000111atomic_t fscache_n_cop_alloc_object;
112atomic_t fscache_n_cop_lookup_object;
113atomic_t fscache_n_cop_lookup_complete;
114atomic_t fscache_n_cop_grab_object;
David Howellsef778e72012-12-20 21:52:36 +0000115atomic_t fscache_n_cop_invalidate_object;
David Howells52bd75f2009-11-19 18:11:08 +0000116atomic_t fscache_n_cop_update_object;
117atomic_t fscache_n_cop_drop_object;
118atomic_t fscache_n_cop_put_object;
119atomic_t fscache_n_cop_sync_cache;
120atomic_t fscache_n_cop_attr_changed;
121atomic_t fscache_n_cop_read_or_alloc_page;
122atomic_t fscache_n_cop_read_or_alloc_pages;
123atomic_t fscache_n_cop_allocate_page;
124atomic_t fscache_n_cop_allocate_pages;
125atomic_t fscache_n_cop_write_page;
126atomic_t fscache_n_cop_uncache_page;
127atomic_t fscache_n_cop_dissociate_pages;
128
David Howells182d9192015-02-19 23:47:31 +0000129atomic_t fscache_n_cache_no_space_reject;
130atomic_t fscache_n_cache_stale_objects;
131atomic_t fscache_n_cache_retired_objects;
132atomic_t fscache_n_cache_culled_objects;
133
David Howells7394daa2009-04-03 16:42:37 +0100134/*
135 * display the general statistics
136 */
Christoph Hellwig3f3942a2018-05-15 15:57:23 +0200137int fscache_stats_show(struct seq_file *m, void *v)
David Howells7394daa2009-04-03 16:42:37 +0100138{
139 seq_puts(m, "FS-Cache statistics\n");
140
141 seq_printf(m, "Cookies: idx=%u dat=%u spc=%u\n",
142 atomic_read(&fscache_n_cookie_index),
143 atomic_read(&fscache_n_cookie_data),
144 atomic_read(&fscache_n_cookie_special));
145
146 seq_printf(m, "Objects: alc=%u nal=%u avl=%u ded=%u\n",
147 atomic_read(&fscache_n_object_alloc),
148 atomic_read(&fscache_n_object_no_alloc),
149 atomic_read(&fscache_n_object_avail),
150 atomic_read(&fscache_n_object_dead));
151 seq_printf(m, "ChkAux : non=%u ok=%u upd=%u obs=%u\n",
152 atomic_read(&fscache_n_checkaux_none),
153 atomic_read(&fscache_n_checkaux_okay),
154 atomic_read(&fscache_n_checkaux_update),
155 atomic_read(&fscache_n_checkaux_obsolete));
156
157 seq_printf(m, "Pages : mrk=%u unc=%u\n",
158 atomic_read(&fscache_n_marks),
159 atomic_read(&fscache_n_uncaches));
160
161 seq_printf(m, "Acquire: n=%u nul=%u noc=%u ok=%u nbf=%u"
162 " oom=%u\n",
163 atomic_read(&fscache_n_acquires),
164 atomic_read(&fscache_n_acquires_null),
165 atomic_read(&fscache_n_acquires_no_cache),
166 atomic_read(&fscache_n_acquires_ok),
167 atomic_read(&fscache_n_acquires_nobufs),
168 atomic_read(&fscache_n_acquires_oom));
169
David Howellsfee096d2009-11-19 18:12:05 +0000170 seq_printf(m, "Lookups: n=%u neg=%u pos=%u crt=%u tmo=%u\n",
David Howells7394daa2009-04-03 16:42:37 +0100171 atomic_read(&fscache_n_object_lookups),
172 atomic_read(&fscache_n_object_lookups_negative),
173 atomic_read(&fscache_n_object_lookups_positive),
David Howellscc4fc292010-04-06 14:35:09 -0700174 atomic_read(&fscache_n_object_created),
175 atomic_read(&fscache_n_object_lookups_timed_out));
David Howells7394daa2009-04-03 16:42:37 +0100176
David Howellsef778e72012-12-20 21:52:36 +0000177 seq_printf(m, "Invals : n=%u run=%u\n",
178 atomic_read(&fscache_n_invalidates),
179 atomic_read(&fscache_n_invalidates_run));
180
David Howells7394daa2009-04-03 16:42:37 +0100181 seq_printf(m, "Updates: n=%u nul=%u run=%u\n",
182 atomic_read(&fscache_n_updates),
183 atomic_read(&fscache_n_updates_null),
184 atomic_read(&fscache_n_updates_run));
185
David Howells2175bb02009-11-19 18:11:38 +0000186 seq_printf(m, "Relinqs: n=%u nul=%u wcr=%u rtr=%u\n",
David Howells7394daa2009-04-03 16:42:37 +0100187 atomic_read(&fscache_n_relinquishes),
188 atomic_read(&fscache_n_relinquishes_null),
David Howells2175bb02009-11-19 18:11:38 +0000189 atomic_read(&fscache_n_relinquishes_waitcrt),
190 atomic_read(&fscache_n_relinquishes_retire));
David Howells7394daa2009-04-03 16:42:37 +0100191
192 seq_printf(m, "AttrChg: n=%u ok=%u nbf=%u oom=%u run=%u\n",
193 atomic_read(&fscache_n_attr_changed),
194 atomic_read(&fscache_n_attr_changed_ok),
195 atomic_read(&fscache_n_attr_changed_nobufs),
196 atomic_read(&fscache_n_attr_changed_nomem),
197 atomic_read(&fscache_n_attr_changed_calls));
198
David Howells5753c442009-11-19 18:11:19 +0000199 seq_printf(m, "Allocs : n=%u ok=%u wt=%u nbf=%u int=%u\n",
David Howells7394daa2009-04-03 16:42:37 +0100200 atomic_read(&fscache_n_allocs),
201 atomic_read(&fscache_n_allocs_ok),
202 atomic_read(&fscache_n_allocs_wait),
David Howells5753c442009-11-19 18:11:19 +0000203 atomic_read(&fscache_n_allocs_nobufs),
204 atomic_read(&fscache_n_allocs_intr));
David Howells60d543c2009-11-19 18:11:45 +0000205 seq_printf(m, "Allocs : ops=%u owt=%u abt=%u\n",
David Howells7394daa2009-04-03 16:42:37 +0100206 atomic_read(&fscache_n_alloc_ops),
David Howells60d543c2009-11-19 18:11:45 +0000207 atomic_read(&fscache_n_alloc_op_waits),
208 atomic_read(&fscache_n_allocs_object_dead));
David Howells7394daa2009-04-03 16:42:37 +0100209
210 seq_printf(m, "Retrvls: n=%u ok=%u wt=%u nod=%u nbf=%u"
211 " int=%u oom=%u\n",
212 atomic_read(&fscache_n_retrievals),
213 atomic_read(&fscache_n_retrievals_ok),
214 atomic_read(&fscache_n_retrievals_wait),
215 atomic_read(&fscache_n_retrievals_nodata),
216 atomic_read(&fscache_n_retrievals_nobufs),
217 atomic_read(&fscache_n_retrievals_intr),
218 atomic_read(&fscache_n_retrievals_nomem));
David Howells60d543c2009-11-19 18:11:45 +0000219 seq_printf(m, "Retrvls: ops=%u owt=%u abt=%u\n",
David Howells7394daa2009-04-03 16:42:37 +0100220 atomic_read(&fscache_n_retrieval_ops),
David Howells60d543c2009-11-19 18:11:45 +0000221 atomic_read(&fscache_n_retrieval_op_waits),
222 atomic_read(&fscache_n_retrievals_object_dead));
David Howells7394daa2009-04-03 16:42:37 +0100223
224 seq_printf(m, "Stores : n=%u ok=%u agn=%u nbf=%u oom=%u\n",
225 atomic_read(&fscache_n_stores),
226 atomic_read(&fscache_n_stores_ok),
227 atomic_read(&fscache_n_stores_again),
228 atomic_read(&fscache_n_stores_nobufs),
229 atomic_read(&fscache_n_stores_oom));
David Howells1bccf512009-11-19 18:11:25 +0000230 seq_printf(m, "Stores : ops=%u run=%u pgs=%u rxd=%u olm=%u\n",
David Howells7394daa2009-04-03 16:42:37 +0100231 atomic_read(&fscache_n_store_ops),
David Howells1bccf512009-11-19 18:11:25 +0000232 atomic_read(&fscache_n_store_calls),
233 atomic_read(&fscache_n_store_pages),
234 atomic_read(&fscache_n_store_radix_deletes),
235 atomic_read(&fscache_n_store_pages_over_limit));
David Howells7394daa2009-04-03 16:42:37 +0100236
David Howells8c209ce2012-12-05 13:34:49 +0000237 seq_printf(m, "VmScan : nos=%u gon=%u bsy=%u can=%u wt=%u\n",
David Howells201a1542009-11-19 18:11:35 +0000238 atomic_read(&fscache_n_store_vmscan_not_storing),
239 atomic_read(&fscache_n_store_vmscan_gone),
240 atomic_read(&fscache_n_store_vmscan_busy),
David Howells8c209ce2012-12-05 13:34:49 +0000241 atomic_read(&fscache_n_store_vmscan_cancelled),
242 atomic_read(&fscache_n_store_vmscan_wait));
David Howells201a1542009-11-19 18:11:35 +0000243
David Howellse3d4d282009-11-19 18:11:32 +0000244 seq_printf(m, "Ops : pend=%u run=%u enq=%u can=%u rej=%u\n",
David Howells7394daa2009-04-03 16:42:37 +0100245 atomic_read(&fscache_n_op_pend),
246 atomic_read(&fscache_n_op_run),
David Howells5753c442009-11-19 18:11:19 +0000247 atomic_read(&fscache_n_op_enqueue),
David Howellse3d4d282009-11-19 18:11:32 +0000248 atomic_read(&fscache_n_op_cancelled),
249 atomic_read(&fscache_n_op_rejected));
David Howells03cdd0e2015-02-25 13:21:15 +0000250 seq_printf(m, "Ops : ini=%u dfr=%u rel=%u gc=%u\n",
251 atomic_read(&fscache_n_op_initialised),
David Howells7394daa2009-04-03 16:42:37 +0100252 atomic_read(&fscache_n_op_deferred_release),
253 atomic_read(&fscache_n_op_release),
254 atomic_read(&fscache_n_op_gc));
David Howells52bd75f2009-11-19 18:11:08 +0000255
256 seq_printf(m, "CacheOp: alo=%d luo=%d luc=%d gro=%d\n",
257 atomic_read(&fscache_n_cop_alloc_object),
258 atomic_read(&fscache_n_cop_lookup_object),
259 atomic_read(&fscache_n_cop_lookup_complete),
260 atomic_read(&fscache_n_cop_grab_object));
David Howellsef778e72012-12-20 21:52:36 +0000261 seq_printf(m, "CacheOp: inv=%d upo=%d dro=%d pto=%d atc=%d syn=%d\n",
262 atomic_read(&fscache_n_cop_invalidate_object),
David Howells52bd75f2009-11-19 18:11:08 +0000263 atomic_read(&fscache_n_cop_update_object),
264 atomic_read(&fscache_n_cop_drop_object),
265 atomic_read(&fscache_n_cop_put_object),
266 atomic_read(&fscache_n_cop_attr_changed),
267 atomic_read(&fscache_n_cop_sync_cache));
268 seq_printf(m, "CacheOp: rap=%d ras=%d alp=%d als=%d wrp=%d ucp=%d dsp=%d\n",
269 atomic_read(&fscache_n_cop_read_or_alloc_page),
270 atomic_read(&fscache_n_cop_read_or_alloc_pages),
271 atomic_read(&fscache_n_cop_allocate_page),
272 atomic_read(&fscache_n_cop_allocate_pages),
273 atomic_read(&fscache_n_cop_write_page),
274 atomic_read(&fscache_n_cop_uncache_page),
275 atomic_read(&fscache_n_cop_dissociate_pages));
David Howells182d9192015-02-19 23:47:31 +0000276 seq_printf(m, "CacheEv: nsp=%d stl=%d rtr=%d cul=%d\n",
277 atomic_read(&fscache_n_cache_no_space_reject),
278 atomic_read(&fscache_n_cache_stale_objects),
279 atomic_read(&fscache_n_cache_retired_objects),
280 atomic_read(&fscache_n_cache_culled_objects));
David Howells7394daa2009-04-03 16:42:37 +0100281 return 0;
282}