David Howells | 1e1236b | 2021-10-20 14:34:41 +0100 | [diff] [blame] | 1 | // 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 Howells | 62ab633 | 2021-10-20 15:26:17 +0100 | [diff] [blame] | 14 | * operation counters |
| 15 | */ |
| 16 | atomic_t fscache_n_volumes; |
| 17 | atomic_t fscache_n_volumes_collision; |
| 18 | atomic_t fscache_n_volumes_nomem; |
David Howells | 7f3283a | 2021-10-20 15:53:34 +0100 | [diff] [blame^] | 19 | atomic_t fscache_n_cookies; |
| 20 | |
| 21 | atomic_t fscache_n_acquires; |
| 22 | atomic_t fscache_n_acquires_ok; |
| 23 | atomic_t fscache_n_acquires_oom; |
| 24 | |
| 25 | atomic_t fscache_n_updates; |
| 26 | EXPORT_SYMBOL(fscache_n_updates); |
| 27 | |
| 28 | atomic_t fscache_n_relinquishes; |
| 29 | atomic_t fscache_n_relinquishes_retire; |
| 30 | atomic_t fscache_n_relinquishes_dropped; |
David Howells | 62ab633 | 2021-10-20 15:26:17 +0100 | [diff] [blame] | 31 | |
| 32 | /* |
David Howells | 1e1236b | 2021-10-20 14:34:41 +0100 | [diff] [blame] | 33 | * display the general statistics |
| 34 | */ |
| 35 | int fscache_stats_show(struct seq_file *m, void *v) |
| 36 | { |
| 37 | seq_puts(m, "FS-Cache statistics\n"); |
David Howells | 7f3283a | 2021-10-20 15:53:34 +0100 | [diff] [blame^] | 38 | seq_printf(m, "Cookies: n=%d v=%d vcol=%u voom=%u\n", |
| 39 | atomic_read(&fscache_n_cookies), |
David Howells | 62ab633 | 2021-10-20 15:26:17 +0100 | [diff] [blame] | 40 | atomic_read(&fscache_n_volumes), |
| 41 | atomic_read(&fscache_n_volumes_collision), |
| 42 | atomic_read(&fscache_n_volumes_nomem) |
| 43 | ); |
David Howells | 1e1236b | 2021-10-20 14:34:41 +0100 | [diff] [blame] | 44 | |
David Howells | 7f3283a | 2021-10-20 15:53:34 +0100 | [diff] [blame^] | 45 | 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 Howells | 1e1236b | 2021-10-20 14:34:41 +0100 | [diff] [blame] | 58 | netfs_stats_show(m); |
| 59 | return 0; |
| 60 | } |