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_wstream_conflict; 36 atomic_t netfs_n_wh_upload; 37 atomic_t netfs_n_wh_upload_done; 38 atomic_t netfs_n_wh_upload_failed; 39 atomic_t netfs_n_wh_write; 40 atomic_t netfs_n_wh_write_done; 41 atomic_t netfs_n_wh_write_failed; 42 43 int netfs_stats_show(struct seq_file *m, void *v) 44 { 45 seq_printf(m, "Netfs : DR=%u RA=%u RF=%u WB=%u WBZ=%u\n", 46 atomic_read(&netfs_n_rh_dio_read), 47 atomic_read(&netfs_n_rh_readahead), 48 atomic_read(&netfs_n_rh_read_folio), 49 atomic_read(&netfs_n_rh_write_begin), 50 atomic_read(&netfs_n_rh_write_zskip)); 51 seq_printf(m, "Netfs : BW=%u WT=%u DW=%u WP=%u\n", 52 atomic_read(&netfs_n_wh_buffered_write), 53 atomic_read(&netfs_n_wh_writethrough), 54 atomic_read(&netfs_n_wh_dio_write), 55 atomic_read(&netfs_n_wh_writepages)); 56 seq_printf(m, "Netfs : ZR=%u sh=%u sk=%u\n", 57 atomic_read(&netfs_n_rh_zero), 58 atomic_read(&netfs_n_rh_short_read), 59 atomic_read(&netfs_n_rh_write_zskip)); 60 seq_printf(m, "Netfs : DL=%u ds=%u df=%u di=%u\n", 61 atomic_read(&netfs_n_rh_download), 62 atomic_read(&netfs_n_rh_download_done), 63 atomic_read(&netfs_n_rh_download_failed), 64 atomic_read(&netfs_n_rh_download_instead)); 65 seq_printf(m, "Netfs : RD=%u rs=%u rf=%u\n", 66 atomic_read(&netfs_n_rh_read), 67 atomic_read(&netfs_n_rh_read_done), 68 atomic_read(&netfs_n_rh_read_failed)); 69 seq_printf(m, "Netfs : UL=%u us=%u uf=%u\n", 70 atomic_read(&netfs_n_wh_upload), 71 atomic_read(&netfs_n_wh_upload_done), 72 atomic_read(&netfs_n_wh_upload_failed)); 73 seq_printf(m, "Netfs : WR=%u ws=%u wf=%u\n", 74 atomic_read(&netfs_n_wh_write), 75 atomic_read(&netfs_n_wh_write_done), 76 atomic_read(&netfs_n_wh_write_failed)); 77 seq_printf(m, "Netfs : rr=%u sr=%u wsc=%u\n", 78 atomic_read(&netfs_n_rh_rreq), 79 atomic_read(&netfs_n_rh_sreq), 80 atomic_read(&netfs_n_wh_wstream_conflict)); 81 return fscache_stats_show(m); 82 } 83 EXPORT_SYMBOL(netfs_stats_show); 84