| 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_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_rh_retry_read_req; |
| 33 | atomic_t netfs_n_rh_retry_read_subreq; |
| 34 | atomic_t netfs_n_wh_buffered_write; |
| 35 | atomic_t netfs_n_wh_writethrough; |
| 36 | atomic_t netfs_n_wh_dio_write; |
| 37 | atomic_t netfs_n_wh_writepages; |
| 38 | atomic_t netfs_n_wh_copy_to_cache; |
| 39 | atomic_t netfs_n_wh_wstream_conflict; |
| 40 | atomic_t netfs_n_wh_upload; |
| 41 | atomic_t netfs_n_wh_upload_done; |
| 42 | atomic_t netfs_n_wh_upload_failed; |
| 43 | atomic_t netfs_n_wh_write; |
| 44 | atomic_t netfs_n_wh_write_done; |
| 45 | atomic_t netfs_n_wh_write_failed; |
| 46 | atomic_t netfs_n_wh_retry_write_req; |
| 47 | atomic_t netfs_n_wh_retry_write_subreq; |
| 48 | atomic_t netfs_n_wb_lock_skip; |
| 49 | atomic_t netfs_n_wb_lock_wait; |
| 50 | atomic_t netfs_n_folioq; |
| 51 | |
| 52 | int netfs_stats_show(struct seq_file *m, void *v) |
| 53 | { |
| 54 | seq_printf(m, fmt: "Reads : DR=%u RA=%u RF=%u RS=%u WB=%u WBZ=%u\n" , |
| 55 | atomic_read(v: &netfs_n_rh_dio_read), |
| 56 | atomic_read(v: &netfs_n_rh_readahead), |
| 57 | atomic_read(v: &netfs_n_rh_read_folio), |
| 58 | atomic_read(v: &netfs_n_rh_read_single), |
| 59 | atomic_read(v: &netfs_n_rh_write_begin), |
| 60 | atomic_read(v: &netfs_n_rh_write_zskip)); |
| 61 | seq_printf(m, fmt: "Writes : BW=%u WT=%u DW=%u WP=%u 2C=%u\n" , |
| 62 | atomic_read(v: &netfs_n_wh_buffered_write), |
| 63 | atomic_read(v: &netfs_n_wh_writethrough), |
| 64 | atomic_read(v: &netfs_n_wh_dio_write), |
| 65 | atomic_read(v: &netfs_n_wh_writepages), |
| 66 | atomic_read(v: &netfs_n_wh_copy_to_cache)); |
| 67 | seq_printf(m, fmt: "ZeroOps: ZR=%u sh=%u sk=%u\n" , |
| 68 | atomic_read(v: &netfs_n_rh_zero), |
| 69 | atomic_read(v: &netfs_n_rh_short_read), |
| 70 | atomic_read(v: &netfs_n_rh_write_zskip)); |
| 71 | seq_printf(m, fmt: "DownOps: DL=%u ds=%u df=%u di=%u\n" , |
| 72 | atomic_read(v: &netfs_n_rh_download), |
| 73 | atomic_read(v: &netfs_n_rh_download_done), |
| 74 | atomic_read(v: &netfs_n_rh_download_failed), |
| 75 | atomic_read(v: &netfs_n_rh_download_instead)); |
| 76 | seq_printf(m, fmt: "CaRdOps: RD=%u rs=%u rf=%u\n" , |
| 77 | atomic_read(v: &netfs_n_rh_read), |
| 78 | atomic_read(v: &netfs_n_rh_read_done), |
| 79 | atomic_read(v: &netfs_n_rh_read_failed)); |
| 80 | seq_printf(m, fmt: "UpldOps: UL=%u us=%u uf=%u\n" , |
| 81 | atomic_read(v: &netfs_n_wh_upload), |
| 82 | atomic_read(v: &netfs_n_wh_upload_done), |
| 83 | atomic_read(v: &netfs_n_wh_upload_failed)); |
| 84 | seq_printf(m, fmt: "CaWrOps: WR=%u ws=%u wf=%u\n" , |
| 85 | atomic_read(v: &netfs_n_wh_write), |
| 86 | atomic_read(v: &netfs_n_wh_write_done), |
| 87 | atomic_read(v: &netfs_n_wh_write_failed)); |
| 88 | seq_printf(m, fmt: "Retries: rq=%u rs=%u wq=%u ws=%u\n" , |
| 89 | atomic_read(v: &netfs_n_rh_retry_read_req), |
| 90 | atomic_read(v: &netfs_n_rh_retry_read_subreq), |
| 91 | atomic_read(v: &netfs_n_wh_retry_write_req), |
| 92 | atomic_read(v: &netfs_n_wh_retry_write_subreq)); |
| 93 | seq_printf(m, fmt: "Objs : rr=%u sr=%u foq=%u wsc=%u\n" , |
| 94 | atomic_read(v: &netfs_n_rh_rreq), |
| 95 | atomic_read(v: &netfs_n_rh_sreq), |
| 96 | atomic_read(v: &netfs_n_folioq), |
| 97 | atomic_read(v: &netfs_n_wh_wstream_conflict)); |
| 98 | seq_printf(m, fmt: "WbLock : skip=%u wait=%u\n" , |
| 99 | atomic_read(v: &netfs_n_wb_lock_skip), |
| 100 | atomic_read(v: &netfs_n_wb_lock_wait)); |
| 101 | return fscache_stats_show(m); |
| 102 | } |
| 103 | EXPORT_SYMBOL(netfs_stats_show); |
| 104 | |