Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp776581imw; Fri, 8 Jul 2022 11:29:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uCueul0K/GYO6b8/FzMXJUAQeksiemMoJbNTVlbgWMYgT7noUcAiZVzcRQ9abxCSltcV2q X-Received: by 2002:a17:906:8292:b0:723:5473:b2cf with SMTP id h18-20020a170906829200b007235473b2cfmr4811549ejx.378.1657304943644; Fri, 08 Jul 2022 11:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657304943; cv=none; d=google.com; s=arc-20160816; b=IP1vU2HrTrxklsPzMZu24z0LZJBJB6BmO+c6qtGyPNy9J0/y7YNLqoRLPJtAuWp9q8 BcaGc7TKNUVCV/BbdwoATNj4pY6lr/44EwMBHx+dRnMa3f+0ZbAk5DVUZyvg+t7aw5QR 0M8Zh+B759FaX8jY2How9f8ShE3LPgD2NA6JK1xVuyITPXkNwTZxjSt4WrtVU45ZrSN3 5I4lHsfK83O2rtWbVRPf6ibpK3oCDasvYZhDIxKU6DpXMGI4FyMW4GPi9+17ZsFx7IiW OY0UOsy2jZmdKidHlMRLqls0rRsyAbsqp7U63jv1vNjKKc9zP1FbEPqYZavRFTHtacw5 pv/g== 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=0qlO6ZoN6FYuE++KyIySKj21NTSVOSeAc9kzpVX7+Ms=; b=O2JoLURN8DpRtXrNt4+M0rSrymaCsjTMDjLrzyTrpM2fuQyQi3UCIfrh+L6us8RJ9M DAnUMe3bfPf+jzfLzoxM4AbIsaTtpkuxYUaY4TbYuv1A4mYaHXwmg204xplgoPEpW/bj r3aaSdgId9f/ZfhExu+EpjMaKAbtrTSLJxbh4vjUzGp4Cx7ZhvnwKxYBFeaQqHRATscG n+EdsY1SZ4x58otxNmL3CDuJRYUEPuBa5UzTpVUMwiSIDJl3KYPhxYxJ8ezsw3hNHEBN Z3xjhx79YEE3DsnbgXo/TBOV9kx8dImwS/vrvUzbU6YvcUC9Ar1TS7eK82Ng4VlI8AeF RW0w== 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 sg6-20020a170907a40600b00722f52f1dd4si1037634ejc.809.2022.07.08.11.28.39; Fri, 08 Jul 2022 11:29:03 -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 S239607AbiGHS1F (ORCPT + 99 others); Fri, 8 Jul 2022 14:27:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239609AbiGHS0k (ORCPT ); Fri, 8 Jul 2022 14:26:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B4D888F35; Fri, 8 Jul 2022 11:26:25 -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 83807B82928; Fri, 8 Jul 2022 18:26:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C86E1C341C6; Fri, 8 Jul 2022 18:26:04 +0000 (UTC) Subject: [PATCH v3 22/32] NFSD: nfsd_file_hash_remove can compute hashval From: Chuck Lever To: linux-nfs@vger.kernel.org, netdev@vger.kernel.org Cc: david@fromorbit.com, jlayton@redhat.com, tgraf@suug.ch Date: Fri, 08 Jul 2022 14:26:03 -0400 Message-ID: <165730476376.28142.6727024491872832707.stgit@klimt.1015granger.net> In-Reply-To: <165730437087.28142.6731645688073512500.stgit@klimt.1015granger.net> References: <165730437087.28142.6731645688073512500.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, 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 Remove an unnecessary use of nf_hashval. Signed-off-by: Chuck Lever --- fs/nfsd/filecache.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 26d10e3c4e70..490e7d7da7d2 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -294,6 +294,18 @@ nfsd_file_do_unhash(struct nfsd_file *nf) atomic_long_dec(&nfsd_filecache_count); } +static void +nfsd_file_hash_remove(struct nfsd_file *nf) +{ + struct inode *inode = nf->nf_inode; + unsigned int hashval = (unsigned int)hash_long(inode->i_ino, + NFSD_FILE_HASH_BITS); + + spin_lock(&nfsd_file_hashtbl[hashval].nfb_lock); + nfsd_file_do_unhash(nf); + spin_unlock(&nfsd_file_hashtbl[hashval].nfb_lock); +} + static bool nfsd_file_unhash(struct nfsd_file *nf) { @@ -513,11 +525,8 @@ static void nfsd_file_gc_dispose_list(struct list_head *dispose) { struct nfsd_file *nf; - list_for_each_entry(nf, dispose, nf_lru) { - spin_lock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); - nfsd_file_do_unhash(nf); - spin_unlock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); - } + list_for_each_entry(nf, dispose, nf_lru) + nfsd_file_hash_remove(nf); nfsd_file_dispose_list_delayed(dispose); }