Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2440781pxm; Sun, 27 Feb 2022 21:53:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdkbDpeesYSV0VRU6Fc1rbuuNySLhHQMBYZz0uTRma9j3g4CZ2YTeaKMU3Kf85CEYb5DFx X-Received: by 2002:a05:6a00:1a42:b0:4c9:f270:1f39 with SMTP id h2-20020a056a001a4200b004c9f2701f39mr20056001pfv.50.1646027603159; Sun, 27 Feb 2022 21:53:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646027603; cv=none; d=google.com; s=arc-20160816; b=qVbYahFt39UIPt3nlzNFi44RBqrwaqDHAd0tl0guM2vXaXVrvRO7/jJ37NlKQyh33n eqX+ReqoLzjCjpHYOC/wyoPbWECCTjAuVISUDjKtct6kPPcouHLySfTmM6uc+fpXgJvY QK5+/tvOp/2FQoLxfM35SGMeywV18jewLky/ajYDqQe1I+fkg4/Kevnwd0C+9T+WEdU7 EGf6BFbOpFfA1Bzk5b4UIRrzdmEcg13/km+QjxK1JhbXcPG1sNBqK0SGa/Y4Yx6P5VOy /gm7BcESjjSbJN48p/qypoqCJfoh4V8qBGlaMD/3sOgxPckEe26m0l5lWlrzUVF9LcN/ JdfQ== 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=wq9l/sK4zX/223hrHm+fhbz3lTscVlDVfW1CQf7iBzQ=; b=VCTqeXU4y0GVh0JGWYnVZOwumktimUwVVeToPSOTaK0cQ9Dju6GcdwxpDFznE8RdBb qx2RGnezjxhjkpbozPPJcNUJQ4LahJF5co63rGwNPaWLyyK11WrLRaknFU7V4yeH81mw pSlBciaq/xOSy1BEWFc1WNWcXxD68Im9lpi6qYuM3CjUNu0jjW+Hz5DDjVMOOfqDYgjv o2QtLCKhekvbBAyKBWXi0xzKN4TNVmc4uCoH7x0AybPGyoQHM7RXi88hZ0X5sRqULyxv cU2KST8Rv7PmqpunECnYHdQIC37Tn1V5nrLV+nEpRRaFmo3r4g3kgtGDgHp9u4Wm6lW5 tjCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pGY8f9sL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s23-20020a63dc17000000b00378a97f1310si1969160pgg.807.2022.02.27.21.52.56; Sun, 27 Feb 2022 21:53:23 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pGY8f9sL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232206AbiB0XTX (ORCPT + 99 others); Sun, 27 Feb 2022 18:19:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232210AbiB0XTV (ORCPT ); Sun, 27 Feb 2022 18:19:21 -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 96CD62250A for ; Sun, 27 Feb 2022 15:18:44 -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 77B1C611D4 for ; Sun, 27 Feb 2022 23:18:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C56C2C340F0 for ; Sun, 27 Feb 2022 23:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646003923; bh=kImNWb+ZQLwpJRUBv8IYr+PeOGFgcCo58C5B2ZBUmGQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pGY8f9sLXlJ3CSHGW9nZOSd+7WPeLo8gd6aR4MDwTN3VqcG6XRUPJHd99lzaOlk60 Bg6dE6mMErkdmgg8CZ4YPgQ5eqGONvJrs1VgRE0K/WyfXBkQYoRKnm/tBa/Un1JyA0 7QMWlVsb6OyCiGrgW95jDRURWAcI63VxfGMYt1GuVNHvBDL4YMSMT09Z+DCbYR6M// GGkBwrNnQBfEyYRlUasJ2knA5DZCAlmItq9MlL7F7iK8NChRCY+xpSoBdFgoQawIRb NLYN3MUGgDmuN0YlYpG8GfZD4o7geJ7FNNawzI2Ji8JmY01Rnp8eiWHJya9kfQSfOL LaB+YSCsHpuFA== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v9 25/27] NFS: Remove unnecessary cache invalidations for directories Date: Sun, 27 Feb 2022 18:12:25 -0500 Message-Id: <20220227231227.9038-26-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220227231227.9038-25-trondmy@kernel.org> References: <20220227231227.9038-1-trondmy@kernel.org> <20220227231227.9038-2-trondmy@kernel.org> <20220227231227.9038-3-trondmy@kernel.org> <20220227231227.9038-4-trondmy@kernel.org> <20220227231227.9038-5-trondmy@kernel.org> <20220227231227.9038-6-trondmy@kernel.org> <20220227231227.9038-7-trondmy@kernel.org> <20220227231227.9038-8-trondmy@kernel.org> <20220227231227.9038-9-trondmy@kernel.org> <20220227231227.9038-10-trondmy@kernel.org> <20220227231227.9038-11-trondmy@kernel.org> <20220227231227.9038-12-trondmy@kernel.org> <20220227231227.9038-13-trondmy@kernel.org> <20220227231227.9038-14-trondmy@kernel.org> <20220227231227.9038-15-trondmy@kernel.org> <20220227231227.9038-16-trondmy@kernel.org> <20220227231227.9038-17-trondmy@kernel.org> <20220227231227.9038-18-trondmy@kernel.org> <20220227231227.9038-19-trondmy@kernel.org> <20220227231227.9038-20-trondmy@kernel.org> <20220227231227.9038-21-trondmy@kernel.org> <20220227231227.9038-22-trondmy@kernel.org> <20220227231227.9038-23-trondmy@kernel.org> <20220227231227.9038-24-trondmy@kernel.org> <20220227231227.9038-25-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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 68b0f19053ac..5a2c98b2cc15 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); memcpy(ctx->verf, nfsi->cookieverf, sizeof(ctx->verf)); spin_unlock(&dir->i_lock); 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 3893386ceaed..72f42b1d0d3c 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