blob: 252e883ae14899dcbc2be0cd11d9a6c55c346b85 [file] [log] [blame]
David Howells1e1236b2021-10-20 14:34:41 +01001// SPDX-License-Identifier: GPL-2.0-or-later
2/* FS-Cache statistics
3 *
4 * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#define FSCACHE_DEBUG_LEVEL CACHE
9#include <linux/proc_fs.h>
10#include <linux/seq_file.h>
11#include "internal.h"
12
13/*
David Howells62ab6332021-10-20 15:26:17 +010014 * operation counters
15 */
16atomic_t fscache_n_volumes;
17atomic_t fscache_n_volumes_collision;
18atomic_t fscache_n_volumes_nomem;
David Howells7f3283a2021-10-20 15:53:34 +010019atomic_t fscache_n_cookies;
20
21atomic_t fscache_n_acquires;
22atomic_t fscache_n_acquires_ok;
23atomic_t fscache_n_acquires_oom;
24
25atomic_t fscache_n_updates;
26EXPORT_SYMBOL(fscache_n_updates);
27
28atomic_t fscache_n_relinquishes;
29atomic_t fscache_n_relinquishes_retire;
30atomic_t fscache_n_relinquishes_dropped;
David Howells62ab6332021-10-20 15:26:17 +010031
32/*
David Howells1e1236b2021-10-20 14:34:41 +010033 * display the general statistics
34 */
35int fscache_stats_show(struct seq_file *m, void *v)
36{
37 seq_puts(m, "FS-Cache statistics\n");
David Howells7f3283a2021-10-20 15:53:34 +010038 seq_printf(m, "Cookies: n=%d v=%d vcol=%u voom=%u\n",
39 atomic_read(&fscache_n_cookies),
David Howells62ab6332021-10-20 15:26:17 +010040 atomic_read(&fscache_n_volumes),
41 atomic_read(&fscache_n_volumes_collision),
42 atomic_read(&fscache_n_volumes_nomem)
43 );
David Howells1e1236b2021-10-20 14:34:41 +010044
David Howells7f3283a2021-10-20 15:53:34 +010045 seq_printf(m, "Acquire: n=%u ok=%u oom=%u\n",
46 atomic_read(&fscache_n_acquires),
47 atomic_read(&fscache_n_acquires_ok),
48 atomic_read(&fscache_n_acquires_oom));
49
50 seq_printf(m, "Updates: n=%u\n",
51 atomic_read(&fscache_n_updates));
52
53 seq_printf(m, "Relinqs: n=%u rtr=%u drop=%u\n",
54 atomic_read(&fscache_n_relinquishes),
55 atomic_read(&fscache_n_relinquishes_retire),
56 atomic_read(&fscache_n_relinquishes_dropped));
57
David Howells1e1236b2021-10-20 14:34:41 +010058 netfs_stats_show(m);
59 return 0;
60}