xref: /linux/fs/netfs/stats.c (revision 35219bc5c71f4197c8bd10297597de797c1eece5)
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_readahead;
14 atomic_t netfs_n_rh_read_folio;
15 atomic_t netfs_n_rh_rreq;
16 atomic_t netfs_n_rh_sreq;
17 atomic_t netfs_n_rh_download;
18 atomic_t netfs_n_rh_download_done;
19 atomic_t netfs_n_rh_download_failed;
20 atomic_t netfs_n_rh_download_instead;
21 atomic_t netfs_n_rh_read;
22 atomic_t netfs_n_rh_read_done;
23 atomic_t netfs_n_rh_read_failed;
24 atomic_t netfs_n_rh_zero;
25 atomic_t netfs_n_rh_short_read;
26 atomic_t netfs_n_rh_write;
27 atomic_t netfs_n_rh_write_begin;
28 atomic_t netfs_n_rh_write_done;
29 atomic_t netfs_n_rh_write_failed;
30 atomic_t netfs_n_rh_write_zskip;
31 atomic_t netfs_n_wh_buffered_write;
32 atomic_t netfs_n_wh_writethrough;
33 atomic_t netfs_n_wh_dio_write;
34 atomic_t netfs_n_wh_writepages;
35 atomic_t netfs_n_wh_copy_to_cache;
36 atomic_t netfs_n_wh_wstream_conflict;
37 atomic_t netfs_n_wh_upload;
38 atomic_t netfs_n_wh_upload_done;
39 atomic_t netfs_n_wh_upload_failed;
40 atomic_t netfs_n_wh_write;
41 atomic_t netfs_n_wh_write_done;
42 atomic_t netfs_n_wh_write_failed;
43 atomic_t netfs_n_wb_lock_skip;
44 atomic_t netfs_n_wb_lock_wait;
45 atomic_t netfs_n_folioq;
46 
netfs_stats_show(struct seq_file * m,void * v)47 int netfs_stats_show(struct seq_file *m, void *v)
48 {
49 	seq_printf(m, "Reads  : DR=%u RA=%u RF=%u WB=%u WBZ=%u\n",
50 		   atomic_read(&netfs_n_rh_dio_read),
51 		   atomic_read(&netfs_n_rh_readahead),
52 		   atomic_read(&netfs_n_rh_read_folio),
53 		   atomic_read(&netfs_n_rh_write_begin),
54 		   atomic_read(&netfs_n_rh_write_zskip));
55 	seq_printf(m, "Writes : BW=%u WT=%u DW=%u WP=%u 2C=%u\n",
56 		   atomic_read(&netfs_n_wh_buffered_write),
57 		   atomic_read(&netfs_n_wh_writethrough),
58 		   atomic_read(&netfs_n_wh_dio_write),
59 		   atomic_read(&netfs_n_wh_writepages),
60 		   atomic_read(&netfs_n_wh_copy_to_cache));
61 	seq_printf(m, "ZeroOps: ZR=%u sh=%u sk=%u\n",
62 		   atomic_read(&netfs_n_rh_zero),
63 		   atomic_read(&netfs_n_rh_short_read),
64 		   atomic_read(&netfs_n_rh_write_zskip));
65 	seq_printf(m, "DownOps: DL=%u ds=%u df=%u di=%u\n",
66 		   atomic_read(&netfs_n_rh_download),
67 		   atomic_read(&netfs_n_rh_download_done),
68 		   atomic_read(&netfs_n_rh_download_failed),
69 		   atomic_read(&netfs_n_rh_download_instead));
70 	seq_printf(m, "CaRdOps: RD=%u rs=%u rf=%u\n",
71 		   atomic_read(&netfs_n_rh_read),
72 		   atomic_read(&netfs_n_rh_read_done),
73 		   atomic_read(&netfs_n_rh_read_failed));
74 	seq_printf(m, "UpldOps: UL=%u us=%u uf=%u\n",
75 		   atomic_read(&netfs_n_wh_upload),
76 		   atomic_read(&netfs_n_wh_upload_done),
77 		   atomic_read(&netfs_n_wh_upload_failed));
78 	seq_printf(m, "CaWrOps: WR=%u ws=%u wf=%u\n",
79 		   atomic_read(&netfs_n_wh_write),
80 		   atomic_read(&netfs_n_wh_write_done),
81 		   atomic_read(&netfs_n_wh_write_failed));
82 	seq_printf(m, "Objs   : rr=%u sr=%u foq=%u wsc=%u\n",
83 		   atomic_read(&netfs_n_rh_rreq),
84 		   atomic_read(&netfs_n_rh_sreq),
85 		   atomic_read(&netfs_n_folioq),
86 		   atomic_read(&netfs_n_wh_wstream_conflict));
87 	seq_printf(m, "WbLock : skip=%u wait=%u\n",
88 		   atomic_read(&netfs_n_wb_lock_skip),
89 		   atomic_read(&netfs_n_wb_lock_wait));
90 	return fscache_stats_show(m);
91 }
92 EXPORT_SYMBOL(netfs_stats_show);
93