Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2171646rwi; Thu, 3 Nov 2022 13:36:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c+z1wvuOEIlZLb3kdd+F+MtHgmFZrTvLvliakTI2d9+Bkrv87p2PVNfd+ngi630hhTjsl X-Received: by 2002:a65:6d1a:0:b0:3fb:2109:7b87 with SMTP id bf26-20020a656d1a000000b003fb21097b87mr12466966pgb.127.1667507806376; Thu, 03 Nov 2022 13:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667507806; cv=none; d=google.com; s=arc-20160816; b=GC2+a4OdqgWBt9NbTF7dOw59/CSGUxOjy8cPbFjD7Qp9JHN9dUxSy4IB3w5GZLhe22 vLCy8lqqHlJDGL2nIMIR7EEdSdA0CSpnNorGiai9XM3Tpyl1jzzdnsWS/LST+NeX/xMg q9ZRX9nPP5WS2e8L50vMt6yQk+sO9TI2tcUfiKTiqso1cBupO2kCGnfhYUeR6o30+ExA EFlIJdcEqkOk0wQJpWTHQ2xmlmTXx/3EyjPkn04/v/eKEUYGBMMsIvI6P/5Xhgluq+Qs G8OMHnnf7krgLufIWJFLBfonXh7hEaq2KR5X5mcodVquIPQIHeYqlTq0eeT2VJvUa+24 W0Aw== 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:to:from:subject; bh=RTsr9PTRsXVmoxl8iv7JFkD8dRUv5FaRSAW55biQ8OI=; b=UsTxAdEXhYHHw5j2GkuKWMgnra3Q5QifToIiA6YN7i78G1wB6iVvUYPuID7jgR7QEx RD6u0b0+xE784iqU+e1ER3ZZjPHNM5yDUa83uX7LV9Mm37SYTRXgAsgTnbxBoNTZzW4E GWjUWETQD7bWfIrl2qz78A0+Dbwdfexq/X+LDyLzCgwZmFzL252JIpGU/tXw6S1D9gge HRlF3Al2tDZMGh2RUwJsMAw/klHbkjlr4P3ACe3rXlaeNTKC0SB6C8x4GjanUK85Zy40 LPUfrk3dBZLv1LJxEQIZE/wXEVd4U2qxC0lzEUafYG2+t2uFvcrUJ5TTwc2Ya7Im4YCh ApbA== 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 c14-20020a056a000ace00b005633766252asi2137287pfl.313.2022.11.03.13.36.34; Thu, 03 Nov 2022 13:36:46 -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 S231334AbiKCUW5 (ORCPT + 99 others); Thu, 3 Nov 2022 16:22:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbiKCUW5 (ORCPT ); Thu, 3 Nov 2022 16:22:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D1511F2DC for ; Thu, 3 Nov 2022 13:22:56 -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 dfw.source.kernel.org (Postfix) with ESMTPS id CF79B61FC4 for ; Thu, 3 Nov 2022 20:22:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D641C433D6 for ; Thu, 3 Nov 2022 20:22:55 +0000 (UTC) Subject: [PATCH v1 2/2] NFSD: Re-arrange file_close_inode tracepoints From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Thu, 03 Nov 2022 16:22:54 -0400 Message-ID: <166750697425.1646.11770177003223505657.stgit@klimt.1015granger.net> In-Reply-To: <166750689663.1646.10478083854261038468.stgit@klimt.1015granger.net> References: <166750689663.1646.10478083854261038468.stgit@klimt.1015granger.net> User-Agent: StGit/1.5.dev3+g9561319 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 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 Now that we have trace_nfsd_file_closing, all we really need to capture is when an external caller has requested a close/sync. Signed-off-by: Chuck Lever --- fs/nfsd/filecache.c | 17 ++++++----------- fs/nfsd/trace.h | 45 ++++++++++++++++----------------------------- 2 files changed, 22 insertions(+), 40 deletions(-) diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index cf1a8f1d1349..7be62af4bfb7 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -706,14 +706,13 @@ static struct shrinker nfsd_file_shrinker = { * The nfsd_file objects on the list will be unhashed, and each will have a * reference taken. */ -static unsigned int +static void __nfsd_file_close_inode(struct inode *inode, struct list_head *dispose) { struct nfsd_file_lookup_key key = { .type = NFSD_FILE_KEY_INODE, .inode = inode, }; - unsigned int count = 0; struct nfsd_file *nf; rcu_read_lock(); @@ -723,11 +722,9 @@ __nfsd_file_close_inode(struct inode *inode, struct list_head *dispose) if (!nf) break; - if (nfsd_file_unhash_and_queue(nf, dispose)) - count++; + nfsd_file_unhash_and_queue(nf, dispose); } while (1); rcu_read_unlock(); - return count; } /** @@ -742,11 +739,9 @@ static void nfsd_file_close_inode(struct inode *inode) { struct nfsd_file *nf, *tmp; - unsigned int count; LIST_HEAD(dispose); - count = __nfsd_file_close_inode(inode, &dispose); - trace_nfsd_file_close_inode(inode, count); + __nfsd_file_close_inode(inode, &dispose); list_for_each_entry_safe(nf, tmp, &dispose, nf_lru) { trace_nfsd_file_closing(nf); if (!refcount_dec_and_test(&nf->nf_ref)) @@ -765,11 +760,11 @@ void nfsd_file_close_inode_sync(struct inode *inode) { struct nfsd_file *nf; - unsigned int count; LIST_HEAD(dispose); - count = __nfsd_file_close_inode(inode, &dispose); - trace_nfsd_file_close_inode(inode, count); + trace_nfsd_file_close(inode); + + __nfsd_file_close_inode(inode, &dispose); while (!list_empty(&dispose)) { nf = list_first_entry(&dispose, struct nfsd_file, nf_lru); list_del_init(&nf->nf_lru); diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index e41007807b7e..ef01ecd3eec6 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -1099,35 +1099,6 @@ TRACE_EVENT(nfsd_file_open, __entry->nf_file) ) -DECLARE_EVENT_CLASS(nfsd_file_search_class, - TP_PROTO( - const struct inode *inode, - unsigned int count - ), - TP_ARGS(inode, count), - TP_STRUCT__entry( - __field(const struct inode *, inode) - __field(unsigned int, count) - ), - TP_fast_assign( - __entry->inode = inode; - __entry->count = count; - ), - TP_printk("inode=%p count=%u", - __entry->inode, __entry->count) -); - -#define DEFINE_NFSD_FILE_SEARCH_EVENT(name) \ -DEFINE_EVENT(nfsd_file_search_class, name, \ - TP_PROTO( \ - const struct inode *inode, \ - unsigned int count \ - ), \ - TP_ARGS(inode, count)) - -DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync); -DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode); - TRACE_EVENT(nfsd_file_is_cached, TP_PROTO( const struct inode *inode, @@ -1238,6 +1209,22 @@ DEFINE_EVENT(nfsd_file_lruwalk_class, name, \ DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_removed); DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_shrinker_removed); +TRACE_EVENT(nfsd_file_close, + TP_PROTO( + const struct inode *inode + ), + TP_ARGS(inode), + TP_STRUCT__entry( + __field(const void *, inode) + ), + TP_fast_assign( + __entry->inode = inode; + ), + TP_printk("inode=%p", + __entry->inode + ) +); + TRACE_EVENT(nfsd_file_fsync, TP_PROTO( const struct nfsd_file *nf,