Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp843906pxb; Fri, 21 Jan 2022 04:46:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpatO+vQux/lmPH4YfslPzqdJcBZYVQe9PPjO1iZydw07+IbHmTswv6Bp703cIZVVBu4g6 X-Received: by 2002:a63:384d:: with SMTP id h13mr2779666pgn.472.1642769160749; Fri, 21 Jan 2022 04:46:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642769160; cv=none; d=google.com; s=arc-20160816; b=s74LBcI4YWb/gKedRtENAk1zLVX7W4ZKrlpgZztVS0jJBpfI4EcoLMa+BAK8qTdWLY UuuMAweFH72op2y+yhKyA+Q++ytpmcBlN+S20khoZ0FzdxOA2kR4ifIMVkq18prNZwsx +x3AgDjCvldG406mGd2sH9ky/z9zVLiDjSqXwdmEB5UGvSPMUlKFJa1ygLilDqlbp543 tuK1QD1YdwfBbqHmzZNGX8lcSfOpLSkxPFd/Uem/gwXAeP1LEXBTL3W7IPOChVpz4UYR GGlqp+p2Ls42fvSNImScXeNbLrSUUkYMDvwuLGWtaulqM6VkceCFqlZh0qDLBDSbfGIU M34g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=CDXQb7CNNn8AA3jiASuF4i7zKIR4T/CsJ1N76UBPfcU=; b=ZH1Zyz2Wv9EHGZ9woUPosEDtTjafH8h4jTD9A/66/v4ljiBKJ3UYXTAy6I3an/FnXS 3YZjEA+SGw/wtBf7pfU59+I27o3+EZ5MnRDnX2ntGk2/SSC/TOaYMzy3tAbkM6Ffpl/M Z//3ECbZ3lrK7bHEM9chpVca/iicXi9+zkHZ8DzcNtULx9TMaxNFlFGFOCy43KLajTVq JfwQnJ04zXGNuQJQQBvhaMQ4XgBSNZlM8pyOWkM4r137BABmGwNxXoc3nRvauz7inHID vjw9VLxNUGam33Tw8FXKJJNFgHPV0loFDuiQsapBIrCBsdiWrHE75OzXIbbGLihm+Xug gkzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=me3Na73y; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si5697963pfr.238.2022.01.21.04.45.11; Fri, 21 Jan 2022 04:46:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=me3Na73y; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245274AbiASAcL (ORCPT + 99 others); Tue, 18 Jan 2022 19:32:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52128 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237177AbiASAcL (ORCPT ); Tue, 18 Jan 2022 19:32:11 -0500 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 06AE5B81885 for ; Wed, 19 Jan 2022 00:32:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B16C340E0; Wed, 19 Jan 2022 00:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642552328; bh=J0p/UyIlrs70MT8vC8z+RQFCLbNv82RinZPlLfIHBEs=; h=From:To:Cc:Subject:Date:From; b=me3Na73ypidHM0eTRhVE7wtq9DAxeRJH3h+t3Kx6PYOSIl2mPJMCIiCgnGy5u4Yn8 DMQ58PTP9Z4YF9aJY9uZwMMmRiKF8F//fxsUbQglHpdfhq87Ib1DTBdAG6ONACcwEq 2vyRrvfqYplvz9izp2+YVnJmCglzFK2qC13L/7PPmsJE8zzaF+tqoOZqr5GDACSuIt oGJKLsU20f+65BrztoY27W8C7x2HkeppIMrcXXGPmbQRaGsjC5ta0O9Oy/Nwzo7j2e Ke6yS/zhP6BNvxpieI4YJ5/pND8C4/TzsZHvAw11kYH4WBH06Ah7DKazd8Ldwfn8Vo EfGq7deBRTxYg== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH] NFS: Don't overfill uncached readdir pages Date: Tue, 18 Jan 2022 19:25:42 -0500 Message-Id: <20220119002542.245587-1-trondmy@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust If we're doing an uncached read of the directory, then we ideally want to read only the exact set of entries that will fit in the buffer supplied by the getdents() system call. So unlike the case where we're reading into the page cache, let's send only one READDIR call, before trying to fill up the buffer. Fixes: 35df59d3ef69 ("NFS: Reduce number of RPC calls when doing uncached readdir") Signed-off-by: Trond Myklebust --- fs/nfs/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 24ce5652d9be..cbf1a304ca18 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -866,7 +866,8 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc, status = nfs_readdir_page_filler(desc, entry, pages, pglen, arrays, narrays); - } while (!status && nfs_readdir_page_needs_filling(page)); + } while (!status && nfs_readdir_page_needs_filling(page) && + page_mapping(page)); nfs_readdir_free_pages(pages, array_size); out: -- 2.34.1