Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp431862pxm; Fri, 25 Feb 2022 10:49:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0LGI8ibCW8YePLjVReWPWYgRBopeGyeY4H+3hHaZlMsWzufiz8cn1DgrZfRTC7utg88tt X-Received: by 2002:a17:906:3117:b0:6cd:f81b:e295 with SMTP id 23-20020a170906311700b006cdf81be295mr6782993ejx.511.1645814951384; Fri, 25 Feb 2022 10:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645814951; cv=none; d=google.com; s=arc-20160816; b=mF3z7TCz+HNzi9qwVlaDnRSuYfkWdPjaGW3PMMVSQ2jSSZKud0o+wZx19JhV0Lgt3h C0Y+zVnY5mmo6cqcoHV6rgqbKkasV4IpMfeFOfXGNa21plJNwb2ACjClT1gpzPohGjJw 9jwVWCyImJGGUxqP4E+kM5miS3dap2OKyvegiPx/OxeTrmvsS/pj6tGYmhWsE/ir6iLW 6HGKCjHXKJ8ND66oDp0Bu51u/6C12aQqoT+Gc7NmEIgUo1e/rCiXyjRDxfdfhOvyaGWY +vGoP2v24d0si/0FxGqWDEJfsa/UyH6s/MEJUV1rf8dvyssV84lvtf2CYMZYuwWv2PTR 19Rg== 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=t2tY6Ck2k7cix35sYxzWM/6G3qEKACjXbnqpzINUdIg=; b=IQGm7GZ7lhZceEOlMtZrfgf1ezN2haVSNTHoi+3xmVNXGoBX6Uo9qOJjz1o4vUZ0Vg A1KD/bngo2wvQ8oTh6rSdGWIeP9Na0fWWzBzepG74BHy1kdHNl8enl3mvyXlF1uFIrFM 3akSqJ71oz3T6GkJxPJ2UbTf8UPmedm2rtXa7db9JbzR5u0qDbd7SJ4HMXnrVH1PAcHU TwhK+ra0q2zwBlPgdoeymI1gXB5JH5Yq8v8zN5dGKbLR8P04pLRp2iaGaXLZIA6FGQkv DI3DGfVw1WkqUrbhFebOZgP58G/dtNzSHzHPOw3pm3jQsicxCBcOL0zupWgzWuWpRZJm JTWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UDtikHMg; 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 eb13-20020a0564020d0d00b00412bfd8b012si2666947edb.214.2022.02.25.10.48.36; Fri, 25 Feb 2022 10:49:11 -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=UDtikHMg; 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 S233300AbiBYSfZ (ORCPT + 99 others); Fri, 25 Feb 2022 13:35:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233345AbiBYSfT (ORCPT ); Fri, 25 Feb 2022 13:35:19 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EA051B01B0 for ; Fri, 25 Feb 2022 10:34:46 -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 ams.source.kernel.org (Postfix) with ESMTPS id 1F807B83309 for ; Fri, 25 Feb 2022 18:34:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92139C340F0 for ; Fri, 25 Feb 2022 18:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645814085; bh=zTUh0Tk58PHGBP7SmvW1skLQZqy/LTcWWM0mY1cHiPQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UDtikHMgv1FsSloHRa5WOWoIOtK/enQxUB700qG5EJYT1HZtJ5sumsAUBL3axa9aS TSvow3FgxDdKzVtcxLMhWMYa4WTlJExccxwF2DzNJwHqt8XwWlEjX75RNDs0wxzDQF mUed6GgJ5Nr8Le6XMUkVwRkHoscOZLmlSI3MjgRUj5qIBOgmir/px9SPqaJsU/ilD+ hTn3dcw45g1dIK2aPLuCsEg04AL96AKJuJWUUH9HlpzcW/+FS4Ps6+OQG/f3OJiKNY eFTPhhCjcKSBrgAZ3+j4EaV1eJW8hTcx14ChP671u+xPPsTqPQ6IeBjkMMGhs74V8e lBTL6xYNZo/ew== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v8 24/24] NFS: Cache all entries in the readdirplus reply Date: Fri, 25 Feb 2022 13:28:29 -0500 Message-Id: <20220225182829.1236093-25-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220225182829.1236093-24-trondmy@kernel.org> References: <20220225182829.1236093-1-trondmy@kernel.org> <20220225182829.1236093-2-trondmy@kernel.org> <20220225182829.1236093-3-trondmy@kernel.org> <20220225182829.1236093-4-trondmy@kernel.org> <20220225182829.1236093-5-trondmy@kernel.org> <20220225182829.1236093-6-trondmy@kernel.org> <20220225182829.1236093-7-trondmy@kernel.org> <20220225182829.1236093-8-trondmy@kernel.org> <20220225182829.1236093-9-trondmy@kernel.org> <20220225182829.1236093-10-trondmy@kernel.org> <20220225182829.1236093-11-trondmy@kernel.org> <20220225182829.1236093-12-trondmy@kernel.org> <20220225182829.1236093-13-trondmy@kernel.org> <20220225182829.1236093-14-trondmy@kernel.org> <20220225182829.1236093-15-trondmy@kernel.org> <20220225182829.1236093-16-trondmy@kernel.org> <20220225182829.1236093-17-trondmy@kernel.org> <20220225182829.1236093-18-trondmy@kernel.org> <20220225182829.1236093-19-trondmy@kernel.org> <20220225182829.1236093-20-trondmy@kernel.org> <20220225182829.1236093-21-trondmy@kernel.org> <20220225182829.1236093-22-trondmy@kernel.org> <20220225182829.1236093-23-trondmy@kernel.org> <20220225182829.1236093-24-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 Even if we're not able to cache all the entries in the readdir buffer, let's ensure that we do prime the dcache. Signed-off-by: Trond Myklebust --- fs/nfs/dir.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 71f61565c72c..5e9c25a562bf 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -789,7 +789,7 @@ static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc, struct xdr_stream stream; struct xdr_buf buf; struct page *scratch, *new, *page = *arrays; - int status; + int err, status = 0; scratch = alloc_page(GFP_KERNEL); if (scratch == NULL) @@ -802,25 +802,32 @@ static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc, if (entry->fattr->label) entry->fattr->label->len = NFS4_MAXLABELLEN; - status = xdr_decode(desc, entry, &stream); - if (status != 0) + err = xdr_decode(desc, entry, &stream); + if (err != 0) { + if (!status) + status = err; break; + } - if (desc->plus) + if (desc->plus) { nfs_prime_dcache(file_dentry(desc->file), entry, - desc->dir_verifier); + desc->dir_verifier); + if (status == -ENOSPC) + continue; + } status = nfs_readdir_add_to_array(entry, page); if (status != -ENOSPC) continue; if (page->mapping != mapping) { - if (!--narrays) - break; + if (narrays <= 1) + continue; new = nfs_readdir_page_array_alloc(entry->prev_cookie, GFP_KERNEL); if (!new) - break; + continue; + narrays--; arrays++; *arrays = page = new; } else { @@ -829,14 +836,14 @@ static int nfs_readdir_page_filler(struct nfs_readdir_descriptor *desc, change_attr, desc->clear_cache); if (!new) - break; + continue; if (page != *arrays) nfs_readdir_page_unlock_and_put(page); page = new; } desc->page_index_max++; status = nfs_readdir_add_to_array(entry, page); - } while (!status && !entry->eof); + } while ((!status || (status == -ENOSPC && desc->plus)) && !entry->eof); switch (status) { case -EBADCOOKIE: -- 2.35.1