1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Netfs support statistics
4 * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
8 #include <linux/export.h>
9 #include <linux/seq_file.h>
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_read_single;
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_buffered_write;
33 atomic_t netfs_n_wh_writethrough;
34 atomic_t netfs_n_wh_dio_write;
35 atomic_t netfs_n_wh_writepages;
36 atomic_t netfs_n_wh_copy_to_cache;
37 atomic_t netfs_n_wh_wstream_conflict;
38 atomic_t netfs_n_wh_upload;
39 atomic_t netfs_n_wh_upload_done;
40 atomic_t netfs_n_wh_upload_failed;
41 atomic_t netfs_n_wh_write;
42 atomic_t netfs_n_wh_write_done;
43 atomic_t netfs_n_wh_write_failed;
44 atomic_t netfs_n_wb_lock_skip;
45 atomic_t netfs_n_wb_lock_wait;
46 atomic_t netfs_n_folioq;
48 int netfs_stats_show(struct seq_file *m, void *v)
50 seq_printf(m, "Reads : DR=%u RA=%u RF=%u RS=%u WB=%u WBZ=%u\n",
51 atomic_read(&netfs_n_rh_dio_read),
52 atomic_read(&netfs_n_rh_readahead),
53 atomic_read(&netfs_n_rh_read_folio),
54 atomic_read(&netfs_n_rh_read_single),
55 atomic_read(&netfs_n_rh_write_begin),
56 atomic_read(&netfs_n_rh_write_zskip));
57 seq_printf(m, "Writes : BW=%u WT=%u DW=%u WP=%u 2C=%u\n",
58 atomic_read(&netfs_n_wh_buffered_write),
59 atomic_read(&netfs_n_wh_writethrough),
60 atomic_read(&netfs_n_wh_dio_write),
61 atomic_read(&netfs_n_wh_writepages),
62 atomic_read(&netfs_n_wh_copy_to_cache));
63 seq_printf(m, "ZeroOps: ZR=%u sh=%u sk=%u\n",
64 atomic_read(&netfs_n_rh_zero),
65 atomic_read(&netfs_n_rh_short_read),
66 atomic_read(&netfs_n_rh_write_zskip));
67 seq_printf(m, "DownOps: DL=%u ds=%u df=%u di=%u\n",
68 atomic_read(&netfs_n_rh_download),
69 atomic_read(&netfs_n_rh_download_done),
70 atomic_read(&netfs_n_rh_download_failed),
71 atomic_read(&netfs_n_rh_download_instead));
72 seq_printf(m, "CaRdOps: RD=%u rs=%u rf=%u\n",
73 atomic_read(&netfs_n_rh_read),
74 atomic_read(&netfs_n_rh_read_done),
75 atomic_read(&netfs_n_rh_read_failed));
76 seq_printf(m, "UpldOps: UL=%u us=%u uf=%u\n",
77 atomic_read(&netfs_n_wh_upload),
78 atomic_read(&netfs_n_wh_upload_done),
79 atomic_read(&netfs_n_wh_upload_failed));
80 seq_printf(m, "CaWrOps: WR=%u ws=%u wf=%u\n",
81 atomic_read(&netfs_n_wh_write),
82 atomic_read(&netfs_n_wh_write_done),
83 atomic_read(&netfs_n_wh_write_failed));
84 seq_printf(m, "Objs : rr=%u sr=%u foq=%u wsc=%u\n",
85 atomic_read(&netfs_n_rh_rreq),
86 atomic_read(&netfs_n_rh_sreq),
87 atomic_read(&netfs_n_folioq),
88 atomic_read(&netfs_n_wh_wstream_conflict));
89 seq_printf(m, "WbLock : skip=%u wait=%u\n",
90 atomic_read(&netfs_n_wb_lock_skip),
91 atomic_read(&netfs_n_wb_lock_wait));
92 return fscache_stats_show(m);
94 EXPORT_SYMBOL(netfs_stats_show);