Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4206798iog; Tue, 28 Jun 2022 11:07:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sjt83pP3U8gc0P1vWJPAVvwbC3mf0sNgi7Vi2E4yM35b8jLmHKFy6n0Dw5urzikl9yCLo1 X-Received: by 2002:a63:7418:0:b0:40c:fb51:13a0 with SMTP id p24-20020a637418000000b0040cfb5113a0mr18710761pgc.492.1656439667359; Tue, 28 Jun 2022 11:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656439667; cv=none; d=google.com; s=arc-20160816; b=Pi20Snvo9RQ/7ObtFbzwvbw6WqurpMlYjxkMKRA1Gvm6EcHectkBdrEISyk/4TyjZT dg/MfSGRo7hr4/Qwv3LjxvVSwTD7pAddtlGv9L+GDml3ur1WIKmU36pvxhaHYKlwAZIq diIihqUZir35M8rhgEWCod4Fhagy73OhYdPC6eeAucZNK51t+KVGxTlMK6FAfj59Mwjp i6FH0Q9janUQWHmdIXSQbJWH41GEZm7c6DfSKAGRpHGHcWtcna+/N/yTUXs+FughqdmT PxCMMVr13YmCL4EtPCI0iIXcI42xTaFaVC3E8cm17ULs1q/oOMtkIibU/m9afwvBr32D KEdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=JJPvGPAIygS3es9IEcDs7LHUa4Kss6THzEZe9cuXbh0=; b=SaREqokrIsvkPGCvfztUOLurLNUPVnwIbJaL6pEINjWS4xbtDOHm5p/eQEM9CgrgaD n4GV4MjmVgWXScT57fQZpc7nEEKAU93e8LenHXLadrJP+mdKG9YXPTPgcoTFlPMufstH opgEvZfXCIERwiQAxqh6dRxdmTattceUpoMPmZtkQGVIeEWZbxPlHoRTYtsg8AFduj7L VN0/xEVUPy/FUqETyN5KyjhVOAJPgnGYn6g31NyTIPFmM/kiJeWa6eSw0Vn1n25TGZVa jPW0mnLayKbyuLfwiM7qDzCLurI2UaVn8B5WzWH7njxLpA+MbayiuvW6C0eJ7/QzKyjL qZ7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v64-20020a638943000000b0040daa91d56csi15042082pgd.828.2022.06.28.11.07.35; Tue, 28 Jun 2022 11:07:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229616AbiF1SG4 (ORCPT + 99 others); Tue, 28 Jun 2022 14:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233952AbiF1SG4 (ORCPT ); Tue, 28 Jun 2022 14:06:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C73B1E3EC; Tue, 28 Jun 2022 11:06:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CF6DEB81F5B; Tue, 28 Jun 2022 18:06:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EDD7C3411D; Tue, 28 Jun 2022 18:06:52 +0000 (UTC) Subject: [PATCH v2 10/31] NFSD: Record number of flush calls From: Chuck Lever To: linux-nfs@vger.kernel.org, netdev@vger.kernel.org Cc: david@fromorbit.com, jlayton@redhat.com, tgraf@suug.ch Date: Tue, 28 Jun 2022 14:06:51 -0400 Message-ID: <165643961121.84360.9957961541694850621.stgit@manet.1015granger.net> In-Reply-To: <165643915086.84360.2809940286726976517.stgit@manet.1015granger.net> References: <165643915086.84360.2809940286726976517.stgit@manet.1015granger.net> User-Agent: StGit/1.5.dev2+g9ce680a5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Chuck Lever --- fs/nfsd/filecache.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 12f587473913..7b532449b93f 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -46,6 +46,7 @@ static DEFINE_PER_CPU(unsigned long, nfsd_file_cache_hits); static DEFINE_PER_CPU(unsigned long, nfsd_file_acquisitions); static DEFINE_PER_CPU(unsigned long, nfsd_file_releases); static DEFINE_PER_CPU(unsigned long, nfsd_file_total_age); +static DEFINE_PER_CPU(unsigned long, nfsd_file_pages_flushed); static DEFINE_PER_CPU(unsigned long, nfsd_file_evictions); struct nfsd_fcache_disposal { @@ -249,7 +250,12 @@ nfsd_file_check_write_error(struct nfsd_file *nf) static void nfsd_file_flush(struct nfsd_file *nf) { - if (nf->nf_file && vfs_fsync(nf->nf_file, 1) != 0) + struct file *file = nf->nf_file; + + if (!file || !(file->f_mode & FMODE_WRITE)) + return; + this_cpu_add(nfsd_file_pages_flushed, file->f_mapping->nrpages); + if (vfs_fsync(file, 1) != 0) nfsd_reset_write_verifier(net_generic(nf->nf_net, nfsd_net_id)); } @@ -1090,7 +1096,8 @@ nfsd_file_create(struct svc_rqst *rqstp, struct svc_fh *fhp, */ static int nfsd_file_cache_stats_show(struct seq_file *m, void *v) { - unsigned long hits = 0, acquisitions = 0, releases = 0, evictions = 0; + unsigned long releases = 0, pages_flushed = 0, evictions = 0; + unsigned long hits = 0, acquisitions = 0; unsigned int i, count = 0, longest = 0; unsigned long lru = 0, total_age = 0; @@ -1115,6 +1122,7 @@ static int nfsd_file_cache_stats_show(struct seq_file *m, void *v) releases += per_cpu(nfsd_file_releases, i); total_age += per_cpu(nfsd_file_total_age, i); evictions += per_cpu(nfsd_file_evictions, i); + pages_flushed += per_cpu(nfsd_file_pages_flushed, i); } seq_printf(m, "total entries: %u\n", count); @@ -1128,6 +1136,7 @@ static int nfsd_file_cache_stats_show(struct seq_file *m, void *v) seq_printf(m, "mean age (ms): %ld\n", total_age / releases); else seq_printf(m, "mean age (ms): -\n"); + seq_printf(m, "pages flushed: %lu\n", pages_flushed); return 0; }