xref: /linux/fs/netfs/stats.c (revision 72bea132f3680ee51e7ed2cee62892b6f5121909)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Netfs support statistics
3  *
4  * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
5  * Written by David Howells (dhowells@redhat.com)
6  */
7 
8 #include <linux/export.h>
9 #include <linux/seq_file.h>
10 #include "internal.h"
11 
12 atomic_t netfs_n_rh_dio_read;
13 atomic_t netfs_n_rh_dio_write;
14 atomic_t netfs_n_rh_readahead;
15 atomic_t netfs_n_rh_readpage;
16 atomic_t netfs_n_rh_rreq;
17 atomic_t netfs_n_rh_sreq;
18 atomic_t netfs_n_rh_download;
19 atomic_t netfs_n_rh_download_done;
20 atomic_t netfs_n_rh_download_failed;
21 atomic_t netfs_n_rh_download_instead;
22 atomic_t netfs_n_rh_read;
23 atomic_t netfs_n_rh_read_done;
24 atomic_t netfs_n_rh_read_failed;
25 atomic_t netfs_n_rh_zero;
26 atomic_t netfs_n_rh_short_read;
27 atomic_t netfs_n_rh_write;
28 atomic_t netfs_n_rh_write_begin;
29 atomic_t netfs_n_rh_write_done;
30 atomic_t netfs_n_rh_write_failed;
31 atomic_t netfs_n_rh_write_zskip;
32 atomic_t netfs_n_wh_wstream_conflict;
33 atomic_t netfs_n_wh_upload;
34 atomic_t netfs_n_wh_upload_done;
35 atomic_t netfs_n_wh_upload_failed;
36 atomic_t netfs_n_wh_write;
37 atomic_t netfs_n_wh_write_done;
38 atomic_t netfs_n_wh_write_failed;
39 
40 int netfs_stats_show(struct seq_file *m, void *v)
41 {
42 	seq_printf(m, "Netfs  : DR=%u DW=%u RA=%u RP=%u WB=%u WBZ=%u\n",
43 		   atomic_read(&netfs_n_rh_dio_read),
44 		   atomic_read(&netfs_n_rh_dio_write),
45 		   atomic_read(&netfs_n_rh_readahead),
46 		   atomic_read(&netfs_n_rh_readpage),
47 		   atomic_read(&netfs_n_rh_write_begin),
48 		   atomic_read(&netfs_n_rh_write_zskip));
49 	seq_printf(m, "Netfs  : ZR=%u sh=%u sk=%u\n",
50 		   atomic_read(&netfs_n_rh_zero),
51 		   atomic_read(&netfs_n_rh_short_read),
52 		   atomic_read(&netfs_n_rh_write_zskip));
53 	seq_printf(m, "Netfs  : DL=%u ds=%u df=%u di=%u\n",
54 		   atomic_read(&netfs_n_rh_download),
55 		   atomic_read(&netfs_n_rh_download_done),
56 		   atomic_read(&netfs_n_rh_download_failed),
57 		   atomic_read(&netfs_n_rh_download_instead));
58 	seq_printf(m, "Netfs  : RD=%u rs=%u rf=%u\n",
59 		   atomic_read(&netfs_n_rh_read),
60 		   atomic_read(&netfs_n_rh_read_done),
61 		   atomic_read(&netfs_n_rh_read_failed));
62 	seq_printf(m, "Netfs  : UL=%u us=%u uf=%u\n",
63 		   atomic_read(&netfs_n_wh_upload),
64 		   atomic_read(&netfs_n_wh_upload_done),
65 		   atomic_read(&netfs_n_wh_upload_failed));
66 	seq_printf(m, "Netfs  : WR=%u ws=%u wf=%u\n",
67 		   atomic_read(&netfs_n_wh_write),
68 		   atomic_read(&netfs_n_wh_write_done),
69 		   atomic_read(&netfs_n_wh_write_failed));
70 	seq_printf(m, "Netfs  : rr=%u sr=%u wsc=%u\n",
71 		   atomic_read(&netfs_n_rh_rreq),
72 		   atomic_read(&netfs_n_rh_sreq),
73 		   atomic_read(&netfs_n_wh_wstream_conflict));
74 	return fscache_stats_show(m);
75 }
76 EXPORT_SYMBOL(netfs_stats_show);
77