Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4207504iog; Tue, 28 Jun 2022 11:08:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tehBQ8ATnRAcaoqQhQz1Z+AHZwYKkKSnKXgmn6Hhu5Wk4qWkTyRJTuzmRNSX5RW1v7Z8fV X-Received: by 2002:a17:90b:4ac7:b0:1ed:21e8:ddb2 with SMTP id mh7-20020a17090b4ac700b001ed21e8ddb2mr915653pjb.93.1656439720937; Tue, 28 Jun 2022 11:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656439720; cv=none; d=google.com; s=arc-20160816; b=OFciwD+VlT5U8Y5IqNWkaKqk1p7eUxiAmAG3oqQE95DvkpZQly3mQSkFqBhHlZwHjY Cs9IZSNz6tuXJQwr8xDEINe4Q2rENn1VLHjCahPbZ4MrqosrrCIff+XTeWDXwv+2WfTU B6wyl4hBpm3AA6LRCoKuuf6uBX+/HjC5oDAxVUCIOwZYPq34URWZebP/r1tW3VaxVU9S 2Lb0ZUzHJfyJN2qIm9yODvkoKG3dxbllXG/Z/GLY82njXAwqs/DPWQ5oTdsdGT54F7l2 qoDl2elz4XGOfkB8/xEo9ma89pYRzV54JvGaGnx9opK1BGNf+Qa7fjXXwVo6GpZMoIwY Hp+A== 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=59hDHXhZtN8irGTu6brERt+0QpXynup20eKs2jHajNI=; b=d1oCHglC3UvAUEumJ7grep4aM4ui65K9YHhvKy+ap1toiqsMYYX6uJmdA9oVORyY2s dpFoi27epjFQ+dzsJw3zOj6E94y8P5FVFWnKshhntFgjiaSmNPj1lA4Hz04cJN2eyhYN oS9eryymOFQmb/sRjGPp98udrEuJcAhHaUfjY8nsMy95zthCllBbE5SLoDXb5rlWaF0u HsgnQ0qUywuhxb4y5BaNRt5MxlB/PZVa41WnCqU9EK3G/VXD5DLBcwLCjxP0TKcP5NVS FBVcCVW+C/6EB/XsIIlG6J36YV9VJA2pILjHBVxV4CO5XIGqKHjgkUAEiZPpLDLgpNxf coRg== 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 w8-20020a63f508000000b0040cf84ef4f5si25623285pgh.583.2022.06.28.11.08.27; Tue, 28 Jun 2022 11:08:40 -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 S234227AbiF1SIO (ORCPT + 99 others); Tue, 28 Jun 2022 14:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234216AbiF1SIM (ORCPT ); Tue, 28 Jun 2022 14:08:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E16E3CC9; Tue, 28 Jun 2022 11:08:11 -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 7E03461AD8; Tue, 28 Jun 2022 18:08:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89136C3411D; Tue, 28 Jun 2022 18:08:10 +0000 (UTC) Subject: [PATCH v2 22/31] 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: Tue, 28 Jun 2022 14:08:09 -0400 Message-ID: <165643968963.84360.3189416786447211750.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 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 9846ba543981..d2cbb1c48207 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); }