From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C19DCC433EF for ; Fri, 22 Oct 2021 19:04:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A64BA610C9 for ; Fri, 22 Oct 2021 19:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234063AbhJVTHF (ORCPT ); Fri, 22 Oct 2021 15:07:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53407 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234178AbhJVTGn (ORCPT ); Fri, 22 Oct 2021 15:06:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634929465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xtb4hcPSNunQaDtuEubceadXUD58SpuwyP5ctiegSsc=; b=MmMxfeiz7T0uBVB+hgMKncXTTl1oqjHOEpILYmVkIPQ4Si7dxHZhOOUgsAZVXWEzT3/cgN nqAWYQ56GljeefeJmuYfXigkF0x46RXhzX9VY1hpKEOl5geOUB7uCQ1dPzFxAfGqO8O6uR 93ndOZLeyPHwle67JbuidBfWPOlX+y8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-35-W324zErpNbG-X3a_UNQe1A-1; Fri, 22 Oct 2021 15:04:19 -0400 X-MC-Unique: W324zErpNbG-X3a_UNQe1A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6094110A8E01; Fri, 22 Oct 2021 19:04:17 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC78F19D9B; Fri, 22 Oct 2021 19:04:11 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH v2 22/53] fscache: Provide read/write stat counters for the cache From: David Howells To: linux-cachefs@redhat.com Cc: dhowells@redhat.com, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Jeff Layton , Matthew Wilcox , Alexander Viro , Omar Sandoval , Linus Torvalds , linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 22 Oct 2021 20:04:10 +0100 Message-ID: <163492945090.1038219.9027971867494708379.stgit@warthog.procyon.org.uk> In-Reply-To: <163492911924.1038219.13107463173777870713.stgit@warthog.procyon.org.uk> References: <163492911924.1038219.13107463173777870713.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Provide read/write stat counters for the cache backend to use. Signed-off-by: David Howells cc: linux-cachefs@redhat.com --- fs/fscache/stats.c | 9 +++++++++ include/linux/fscache-cache.h | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/fs/fscache/stats.c b/fs/fscache/stats.c index 45b7636c7737..8d5ad6771498 100644 --- a/fs/fscache/stats.c +++ b/fs/fscache/stats.c @@ -37,6 +37,11 @@ atomic_t fscache_n_relinquishes; atomic_t fscache_n_relinquishes_retire; atomic_t fscache_n_relinquishes_dropped; +atomic_t fscache_n_read; +EXPORT_SYMBOL(fscache_n_read); +atomic_t fscache_n_write; +EXPORT_SYMBOL(fscache_n_write); + /* * display the general statistics */ @@ -76,6 +81,10 @@ int fscache_stats_show(struct seq_file *m, void *v) atomic_read(&fscache_n_relinquishes_retire), atomic_read(&fscache_n_relinquishes_dropped)); + seq_printf(m, "IO : rd=%u wr=%u\n", + atomic_read(&fscache_n_read), + atomic_read(&fscache_n_write)); + netfs_stats_show(m); return 0; } diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h index 2d57b85cfde3..6830f91ebaf4 100644 --- a/include/linux/fscache-cache.h +++ b/include/linux/fscache-cache.h @@ -172,6 +172,16 @@ void fscache_end_operation(struct netfs_cache_resources *cres) ops->end_operation(cres); } +#ifdef CONFIG_FSCACHE_STATS +extern atomic_t fscache_n_read; +extern atomic_t fscache_n_write; +#define fscache_count_read() atomic_inc(&fscache_n_read) +#define fscache_count_write() atomic_inc(&fscache_n_write) +#else +#define fscache_count_read() do {} while(0) +#define fscache_count_write() do {} while(0) +#endif + extern struct workqueue_struct *fscache_wq; #endif /* _LINUX_FSCACHE_CACHE_H */