Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1039644pxm; Wed, 23 Feb 2022 16:35:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvx6BhRSITFSHstDoE4WnUwYqteCtdKJIJSEew/eHgzhgelAuKlZKd0+99c39OQnL2eJ4m X-Received: by 2002:a63:a1a:0:b0:34d:a4a9:a8b9 with SMTP id 26-20020a630a1a000000b0034da4a9a8b9mr297739pgk.176.1645662907111; Wed, 23 Feb 2022 16:35:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645662907; cv=none; d=google.com; s=arc-20160816; b=OO24xvpfYrsGONIkzBHVtTQ75k9EQdrTa7LcviOBiqZ5fd7c5nB3gfq2T98vO7gi1k Xoaf81FLRCCusNVmuE+zYzMWVtEBK32AQAJMgv6SY03JEDjhPj87N4jQpDyCzQXxE92e cuHwiQRlgMdRVCJE5LTUK0n+/XWZI31DzhSwN0NYd6T4jWJl3mGyEq/BhwE2Fd159OM5 dUH5B65FtFbiO6QgtFJXeUxhqImMbBkSS3U9GX1NBzfzfSZKvhfuyYi66g8IU01uJ1mI cz2T01pQV+3oqnkk1J6SA15drRqqozJRlSpYwYiLt0l6dQ3vrdIgp4gdp1lqIzmbhElk t8nw== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dDj+qQUwxPUuB03VX+mRWbv7e2/GGEzMZ3xDmZOtMi0=; b=JZTTkNpUym8+wu08codieV8FTvZO3wMxYNsarROJHSLKRlppWk4rILbRiMmtrdzHD+ kT8TyRa7ovTwToZAlEl4cfQ7jBZMrFlzbWmtDMv1b4AkAmks1UJx2scsdLOR0hpA+PS7 LF7fCtnTjgiXJo7EDLcDaFHntGv+q0jZVk6sClmmI4zrHrA7+VbWQ4Kjm9b75f1Ga1P7 xVkzvi3N9djBIMtOpDmcfRfvAlFsl9TYsDe5yQepgNeOHhSX0V+TQaRd2zozgbbRr4AR 5ILYPQAkc6Q74hFJI+25Hh0D0AYWqo7N+gmyVZIJ8rY/B3f5jDWSoonSJqp6M3qWm6Zu d9iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dSifdUOg; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f7si1143585plg.438.2022.02.23.16.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 16:35:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dSifdUOg; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 42A938F613; Wed, 23 Feb 2022 16:34:09 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242590AbiBWVVO (ORCPT + 99 others); Wed, 23 Feb 2022 16:21:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242483AbiBWVUJ (ORCPT ); Wed, 23 Feb 2022 16:20:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 524974ECCD for ; Wed, 23 Feb 2022 13:19:41 -0800 (PST) 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 E1AA06189D for ; Wed, 23 Feb 2022 21:19:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2769DC340F4 for ; Wed, 23 Feb 2022 21:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645651180; bh=cZRqeSCIk3eKkgq/q3P74PglmuOkVs88kahIVSQt+MY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dSifdUOgbizqiBPfazZ9NkSDsi/q5viH9RJTcTgSHz3gR4/0X6c/SSHhOt3ryOf0N bz10C2JgZc/bXSNoZmZmS0P/kZq49+tmTNhgtCUSQwjn0TKpRZkbvy9IrLPJuZJxQh R1XeLLTEYnR/OimY7KJFFhHe6046tXP/x6RZ7wcW4uWQcjDjoW3KPRRMAOm26COjQm 9P3rK36sflR7xhmEcrtknu8MB00Mk+IPEBdMz6VjlFzXXSet/C12E/mC9DPJBQUFGK sr2NzdE8S5qTG0vMwJRjT4Hrl6ZsQN66fr4pRL3i+vSJtRzORMBX1ZJvpZPVA7xAZe URcMk0UXLvgJg== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v7 21/21] NFS: Remove unnecessary cache invalidations for directories Date: Wed, 23 Feb 2022 16:13:05 -0500 Message-Id: <20220223211305.296816-22-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220223211305.296816-21-trondmy@kernel.org> References: <20220223211305.296816-1-trondmy@kernel.org> <20220223211305.296816-2-trondmy@kernel.org> <20220223211305.296816-3-trondmy@kernel.org> <20220223211305.296816-4-trondmy@kernel.org> <20220223211305.296816-5-trondmy@kernel.org> <20220223211305.296816-6-trondmy@kernel.org> <20220223211305.296816-7-trondmy@kernel.org> <20220223211305.296816-8-trondmy@kernel.org> <20220223211305.296816-9-trondmy@kernel.org> <20220223211305.296816-10-trondmy@kernel.org> <20220223211305.296816-11-trondmy@kernel.org> <20220223211305.296816-12-trondmy@kernel.org> <20220223211305.296816-13-trondmy@kernel.org> <20220223211305.296816-14-trondmy@kernel.org> <20220223211305.296816-15-trondmy@kernel.org> <20220223211305.296816-16-trondmy@kernel.org> <20220223211305.296816-17-trondmy@kernel.org> <20220223211305.296816-18-trondmy@kernel.org> <20220223211305.296816-19-trondmy@kernel.org> <20220223211305.296816-20-trondmy@kernel.org> <20220223211305.296816-21-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Trond Myklebust Now that the directory page cache entries police themselves, don't bother with marking the page cache for invalidation. Signed-off-by: Trond Myklebust --- fs/nfs/dir.c | 5 ----- fs/nfs/inode.c | 9 +++------ fs/nfs/nfs4proc.c | 2 -- include/linux/nfs_fs.h | 2 -- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index d41ea614edec..21aae3a3e282 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -83,11 +83,6 @@ alloc_nfs_open_dir_context(struct inode *dir) ctx->attr_gencount = nfsi->attr_gencount; ctx->dtsize = NFS_INIT_DTSIZE; spin_lock(&dir->i_lock); - if (list_empty(&nfsi->open_files) && - (nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER)) - nfs_set_cache_invalid(dir, - NFS_INO_INVALID_DATA | - NFS_INO_REVAL_FORCED); list_add_tail_rcu(&ctx->list, &nfsi->open_files); spin_unlock(&dir->i_lock); return ctx; diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 10d17cfb8639..43af1b6de5a6 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -210,6 +210,8 @@ void nfs_set_cache_invalid(struct inode *inode, unsigned long flags) if (flags & NFS_INO_INVALID_DATA) nfs_fscache_invalidate(inode, 0); flags &= ~NFS_INO_REVAL_FORCED; + if (S_ISDIR(inode->i_mode)) + flags &= ~(NFS_INO_INVALID_DATA | NFS_INO_DATA_INVAL_DEFER); nfsi->cache_validity |= flags; @@ -1429,10 +1431,7 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) && (fattr->valid & NFS_ATTR_FATTR_CHANGE) && inode_eq_iversion_raw(inode, fattr->pre_change_attr)) { inode_set_iversion_raw(inode, fattr->change_attr); - if (S_ISDIR(inode->i_mode)) - nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); - else if (nfs_server_capable(inode, NFS_CAP_XATTR)) - nfs_set_cache_invalid(inode, NFS_INO_INVALID_XATTR); + nfs_set_cache_invalid(inode, NFS_INO_INVALID_XATTR); } /* If we have atomic WCC data, we may update some attributes */ ts = inode->i_ctime; @@ -1851,8 +1850,6 @@ EXPORT_SYMBOL_GPL(nfs_refresh_inode); static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr *fattr, unsigned int invalid) { - if (S_ISDIR(inode->i_mode)) - invalid |= NFS_INO_INVALID_DATA; nfs_set_cache_invalid(inode, invalid); if ((fattr->valid & NFS_ATTR_FATTR) == 0) return 0; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 8b875355824b..f1aa6b3c8523 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1206,8 +1206,6 @@ nfs4_update_changeattr_locked(struct inode *inode, u64 change_attr = inode_peek_iversion_raw(inode); cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME; - if (S_ISDIR(inode->i_mode)) - cache_validity |= NFS_INO_INVALID_DATA; switch (NFS_SERVER(inode)->change_attr_type) { case NFS4_CHANGE_TYPE_IS_UNDEFINED: diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 3f9625c7d0ef..08ba4db0db4a 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -360,8 +360,6 @@ static inline void nfs_mark_for_revalidate(struct inode *inode) nfsi->cache_validity |= NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL | NFS_INO_INVALID_CHANGE | NFS_INO_INVALID_CTIME | NFS_INO_INVALID_SIZE; - if (S_ISDIR(inode->i_mode)) - nfsi->cache_validity |= NFS_INO_INVALID_DATA; spin_unlock(&inode->i_lock); } -- 2.35.1