From patchwork Thu Mar 28 16:34:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13609087 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29EE3CD1283 for ; Thu, 28 Mar 2024 16:38:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A45866B00BB; Thu, 28 Mar 2024 12:38:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F4FA6B00BD; Thu, 28 Mar 2024 12:38:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 820696B00BE; Thu, 28 Mar 2024 12:38:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5C6C36B00BB for ; Thu, 28 Mar 2024 12:38:13 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2ED25A0916 for ; Thu, 28 Mar 2024 16:38:13 +0000 (UTC) X-FDA: 81947005266.02.90C50C3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 8097A8000A for ; Thu, 28 Mar 2024 16:38:11 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GiLtrGp0; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711643891; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JI9PX3u9k9FTrB5i0WWXWgMwPBin4UAr3u+00DhFGiU=; b=1D4rL6A+urXkBJjOvYxGuLvjgiAiWZ8HVrSatx97QlhvaxTBJKgfrKQLGkjF2Ebmw5e4Wz Gcanj6bdK9t18jGe9vo8k1r7KszcQguN/nl6pZZy1tfUJ6s+7UWIzVSdg5kD+K4RVCavpw aDN0wlHEIQLdL70s/pJPC7BwMvg0mSk= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GiLtrGp0; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711643891; a=rsa-sha256; cv=none; b=FNH5KCCdE3Fz6DJgXVW8vUFgtCCuuUBeWqNaTiBDpcy67duffi58+vCkge7d5spykHtxK8 jx+Fx6bSXrxUWKpCswzpA5zMGPwKZtVksTh3E2bN39978vyoRZcp28fVBu+WIvcsif9cib hB3Sa94/48D2ZAomNfaWG2mURWkUEb8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711643890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JI9PX3u9k9FTrB5i0WWXWgMwPBin4UAr3u+00DhFGiU=; b=GiLtrGp0/e9lmReNbTYdr0AN9fe7ndSXPt3RTPa/GEboqjpgCjYd+mW8IT83PhlgRiZAGY tOCaQ9AFnUWyDCJVds6c+hfxTdbbiZiN/nxRCxyQHVI4Z9v8bdXCynbeYNLeiDzriVCs+u G5MFuzFhi/2QL1Q58B3aVRyfLDa0cXA= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-114-2sgLOBL1P_u0EwB7rUYwvg-1; Thu, 28 Mar 2024 12:38:09 -0400 X-MC-Unique: 2sgLOBL1P_u0EwB7rUYwvg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F7C2383CD7C; Thu, 28 Mar 2024 16:38:08 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B5A11C060D0; Thu, 28 Mar 2024 16:38:05 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Matthew Wilcox , Steve French , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 18/26] netfs: Add some write-side stats and clean up some stat names Date: Thu, 28 Mar 2024 16:34:10 +0000 Message-ID: <20240328163424.2781320-19-dhowells@redhat.com> In-Reply-To: <20240328163424.2781320-1-dhowells@redhat.com> References: <20240328163424.2781320-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 8097A8000A X-Stat-Signature: 457scjeqhs7h1kwu7bwtubyyt4ntopgi X-Rspam-User: X-HE-Tag: 1711643891-689729 X-HE-Meta: U2FsdGVkX18BF1P7/gjjzPlseSVPbrmcAXJqvFKuPf+lxWlYA7TKjdvFgAJ2rKwcpj/NKX7Pu3VKCfq4abaFCPTQlPsSe1qVbrd+a10fYRD0rTvDrnfaj1FE0NupAy0lBsKguEz4XaB6zmdKPr22F6BXd21uHypqEPIwOixMQVLuP9Suoevcx3qOs08CJnQwe0qbBpJ3S+IofXw7B++UvPXJOSjS9dQyfLY6z2ERJDG6S5yyTtIews6BwXTN+piGPoLItlGWWSKdO91L89+uapOblOG6GUef+S+FEx8Nq5mx0nMwb02js1qSknv14xU/ICiQF1UCQp9inq1Edg/CM62Gx27vIZK+/jANI5rZbscksfxjSSCDszLB//xKWv+eculJTjBET0u5f2Vh7nDy1ZLgVLDzscROf0o4iyZwiSMTNZXRG9hqcLANhdNrhwEooNqA/2sPNA4zQJi9ZSV4V+wZXoZ1Y/EDS0pgjs1zxAVEmHACxVbZJJHpAXqAR7o5sPtaYJB61pn2MSplqQb2ewJKY1OfieljPoX//Xe67UEiICv6lOBgSGXVNzVu2Z6zx8OkBfz8EcqSWNa4wLt0Yujdqe5ehe3H9l1n8e/qVpTK7a3Kd3qQHE/HqDeOAjQFvcoK/QGgsKgFofpVZFRGjWjBUK5+UbPUiqNyf1wNs1oENMUSgirLEE2kEY68OdpFD9KKnwP3nemXKXCcN/G4wirCE1aXbMIksEO3bq6VDNTcsWWmJssvVIfawcE4la5wonPnEzklj+MJNDZz82InCqFa4nB0J69Oo1A+6au934izbIyXEnn64HK4Gtkd+vtC1/cqOtjk5Yk/AXWEOcuGXB/+9seaGMyPgBgy1WyftRAOzJcUVEL1rHbcNG869YA40JN3/rc1Jqc7RUrCqwANgeLwPExRRwZ9ShdpyTPCCZ+7gD/EOm3ZZ7w4eZbCEjctgmJw0uN2YUR7jll8ZI4 88kD7HRv uyHGHbXn1Q+mjhDkWXym2hIyRz7qp1+t0jVrJv5nutCDvAwYb/79wnarhJzS6OrQ83ExM3KaQObL5PLlzG/GDM+RT5Y44sgxl17+UTAg2Pa/lzfw1kRR4xX9dDNndzl6gAAkjcfckZ3/OUeGfu718/ZPzRMTdSoNMxUXo2boYTrShc2UghAd0x/C8AGZlATX4zo+W4dXy3ntFBBx1ccDoHN+vwFPrstnx1DP/nYXWkpkUv3m6qj1ktMKqeNTPJP7e7Sd48NMMm5Qj7hQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add some write-side stats to count buffered writes, buffered writethrough, and writepages calls. Whilst we're at it, clean up the naming on some of the existing stats counters and organise the output into two sets. Signed-off-by: David Howells cc: Jeff Layton cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/netfs/buffered_read.c | 2 +- fs/netfs/buffered_write.c | 3 +++ fs/netfs/direct_write.c | 2 +- fs/netfs/internal.h | 7 +++++-- fs/netfs/stats.c | 17 ++++++++++++----- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index 47603f08680e..a6bb03bea920 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -282,7 +282,7 @@ int netfs_read_folio(struct file *file, struct folio *folio) if (ret == -ENOMEM || ret == -EINTR || ret == -ERESTARTSYS) goto discard; - netfs_stat(&netfs_n_rh_readpage); + netfs_stat(&netfs_n_rh_read_folio); trace_netfs_read(rreq, rreq->start, rreq->len, netfs_read_trace_readpage); /* Set up the output buffer */ diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index db4ad158948b..244d67a43972 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -215,6 +215,9 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter, if (!is_sync_kiocb(iocb)) wreq->iocb = iocb; wreq->cleanup = netfs_cleanup_buffered_write; + netfs_stat(&netfs_n_wh_writethrough); + } else { + netfs_stat(&netfs_n_wh_buffered_write); } do { diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c index bee047e20f5d..37c91188107b 100644 --- a/fs/netfs/direct_write.c +++ b/fs/netfs/direct_write.c @@ -143,7 +143,7 @@ ssize_t netfs_unbuffered_write_iter(struct kiocb *iocb, struct iov_iter *from) return 0; trace_netfs_write_iter(iocb, from); - netfs_stat(&netfs_n_rh_dio_write); + netfs_stat(&netfs_n_wh_dio_write); ret = netfs_start_io_direct(inode); if (ret < 0) diff --git a/fs/netfs/internal.h b/fs/netfs/internal.h index c67da478cd2b..58289cc65e25 100644 --- a/fs/netfs/internal.h +++ b/fs/netfs/internal.h @@ -106,9 +106,8 @@ int netfs_end_writethrough(struct netfs_io_request *wreq, struct kiocb *iocb); */ #ifdef CONFIG_NETFS_STATS extern atomic_t netfs_n_rh_dio_read; -extern atomic_t netfs_n_rh_dio_write; extern atomic_t netfs_n_rh_readahead; -extern atomic_t netfs_n_rh_readpage; +extern atomic_t netfs_n_rh_read_folio; extern atomic_t netfs_n_rh_rreq; extern atomic_t netfs_n_rh_sreq; extern atomic_t netfs_n_rh_download; @@ -125,6 +124,10 @@ extern atomic_t netfs_n_rh_write_begin; extern atomic_t netfs_n_rh_write_done; extern atomic_t netfs_n_rh_write_failed; extern atomic_t netfs_n_rh_write_zskip; +extern atomic_t netfs_n_wh_buffered_write; +extern atomic_t netfs_n_wh_writethrough; +extern atomic_t netfs_n_wh_dio_write; +extern atomic_t netfs_n_wh_writepages; extern atomic_t netfs_n_wh_wstream_conflict; extern atomic_t netfs_n_wh_upload; extern atomic_t netfs_n_wh_upload_done; diff --git a/fs/netfs/stats.c b/fs/netfs/stats.c index deeba9f9dcf5..0892768eea32 100644 --- a/fs/netfs/stats.c +++ b/fs/netfs/stats.c @@ -10,9 +10,8 @@ #include "internal.h" atomic_t netfs_n_rh_dio_read; -atomic_t netfs_n_rh_dio_write; atomic_t netfs_n_rh_readahead; -atomic_t netfs_n_rh_readpage; +atomic_t netfs_n_rh_read_folio; atomic_t netfs_n_rh_rreq; atomic_t netfs_n_rh_sreq; atomic_t netfs_n_rh_download; @@ -29,6 +28,10 @@ atomic_t netfs_n_rh_write_begin; atomic_t netfs_n_rh_write_done; atomic_t netfs_n_rh_write_failed; atomic_t netfs_n_rh_write_zskip; +atomic_t netfs_n_wh_buffered_write; +atomic_t netfs_n_wh_writethrough; +atomic_t netfs_n_wh_dio_write; +atomic_t netfs_n_wh_writepages; atomic_t netfs_n_wh_wstream_conflict; atomic_t netfs_n_wh_upload; atomic_t netfs_n_wh_upload_done; @@ -39,13 +42,17 @@ atomic_t netfs_n_wh_write_failed; int netfs_stats_show(struct seq_file *m, void *v) { - seq_printf(m, "Netfs : DR=%u DW=%u RA=%u RP=%u WB=%u WBZ=%u\n", + seq_printf(m, "Netfs : DR=%u RA=%u RF=%u WB=%u WBZ=%u\n", atomic_read(&netfs_n_rh_dio_read), - atomic_read(&netfs_n_rh_dio_write), atomic_read(&netfs_n_rh_readahead), - atomic_read(&netfs_n_rh_readpage), + atomic_read(&netfs_n_rh_read_folio), atomic_read(&netfs_n_rh_write_begin), atomic_read(&netfs_n_rh_write_zskip)); + seq_printf(m, "Netfs : BW=%u WT=%u DW=%u WP=%u\n", + atomic_read(&netfs_n_wh_buffered_write), + atomic_read(&netfs_n_wh_writethrough), + atomic_read(&netfs_n_wh_dio_write), + atomic_read(&netfs_n_wh_writepages)); seq_printf(m, "Netfs : ZR=%u sh=%u sk=%u\n", atomic_read(&netfs_n_rh_zero), atomic_read(&netfs_n_rh_short_read),