summaryrefslogtreecommitdiffstats
path: root/fs/fscache/stats.c
blob: cdbb672a274f834d76aadfe94219c6ddbec106df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// SPDX-License-Identifier: GPL-2.0-or-later
/* FS-Cache statistics
 *
 * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 */

#define FSCACHE_DEBUG_LEVEL CACHE
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "internal.h"

/*
 * operation counters
 */
atomic_t fscache_n_volumes;
atomic_t fscache_n_volumes_collision;
atomic_t fscache_n_volumes_nomem;
atomic_t fscache_n_cookies;
atomic_t fscache_n_cookies_lru;
atomic_t fscache_n_cookies_lru_expired;
atomic_t fscache_n_cookies_lru_removed;
atomic_t fscache_n_cookies_lru_dropped;

atomic_t fscache_n_acquires;
atomic_t fscache_n_acquires_ok;
atomic_t fscache_n_acquires_oom;

atomic_t fscache_n_invalidates;

atomic_t fscache_n_updates;
EXPORT_SYMBOL(fscache_n_updates);

atomic_t fscache_n_relinquishes;
atomic_t fscache_n_relinquishes_retire;
atomic_t fscache_n_relinquishes_dropped;

/*
 * display the general statistics
 */
int fscache_stats_show(struct seq_file *m, void *v)
{
	seq_puts(m, "FS-Cache statistics\n");
	seq_printf(m, "Cookies: n=%d v=%d vcol=%u voom=%u\n",
		   atomic_read(&fscache_n_cookies),
		   atomic_read(&fscache_n_volumes),
		   atomic_read(&fscache_n_volumes_collision),
		   atomic_read(&fscache_n_volumes_nomem)
		   );

	seq_printf(m, "Acquire: n=%u ok=%u oom=%u\n",
		   atomic_read(&fscache_n_acquires),
		   atomic_read(&fscache_n_acquires_ok),
		   atomic_read(&fscache_n_acquires_oom));

	seq_printf(m, "LRU    : n=%u exp=%u rmv=%u drp=%u at=%ld\n",
		   atomic_read(&fscache_n_cookies_lru),
		   atomic_read(&fscache_n_cookies_lru_expired),
		   atomic_read(&fscache_n_cookies_lru_removed),
		   atomic_read(&fscache_n_cookies_lru_dropped),
		   timer_pending(&fscache_cookie_lru_timer) ?
		   fscache_cookie_lru_timer.expires - jiffies : 0);

	seq_printf(m, "Invals : n=%u\n",
		   atomic_read(&fscache_n_invalidates));

	seq_printf(m, "Updates: n=%u\n",
		   atomic_read(&fscache_n_updates));

	seq_printf(m, "Relinqs: n=%u rtr=%u drop=%u\n",
		   atomic_read(&fscache_n_relinquishes),
		   atomic_read(&fscache_n_relinquishes_retire),
		   atomic_read(&fscache_n_relinquishes_dropped));

	netfs_stats_show(m);
	return 0;
}