Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1766526pxm; Thu, 24 Feb 2022 08:59:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSVG9hPpBv79zYzMCpIwb5aF4PXskNdgSupjNNm0pzCkv4ARdaaZ+S41C04o9mKjyi115l X-Received: by 2002:a17:902:9348:b0:14e:ec3d:2baa with SMTP id g8-20020a170902934800b0014eec3d2baamr3546792plp.107.1645721995452; Thu, 24 Feb 2022 08:59:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645721995; cv=none; d=google.com; s=arc-20160816; b=UYaNMJn6zCVB/OAbQzRZxBflGa1M2HxBGSzVTTF8Yru/e+KGIV78MOIB7I1a2/U6Gu D4Y5Qj7ZwN5EcYQFDjjoCV4hlXiztpjAA3m5bkveo7S1XaOU81xegRpaYyB6nh44KUve DR2cGQvVSoa2GKOeaTybVBdLROlVdJ/40epvctgeWIJ/P1u7DRBHizeSgQ0/aXa+PQE0 Jeu5Ot9Wp/Aa2W9jHKftwqZEUR3ciVQE7G5gK6ReGzDVHsr/kcyET6TCw6CgqBKdWslX SJhRsjwbRVTJwEMmWwqmkxBGVXmoCBunQkpJRiKjIY+2UOB/b82kw2N4ABu2QN2rkaN0 /9fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2u0tTWzB+C7m5LfM7iEbPI+TTHyVsULewsmOsGCCQ50=; b=yt20vBVXhXeygLjQjs3w+b2Zc5OH2qI2nHKtWToey06s9Wdkd671hr5IEbl5MLOVGI Bdf8DrKpYTUhUwG0M+3IUb61w04d+ueSGixEf7ECICWSP3gmttoPgz8SO+n+IC8wNtbC w/8Z2QvpVWQ7sVWgsJF92spRgV6oYItTGT5rPEPai5uZivEJYa5QOa6eNmOKZletPJij FPvQukCBHhhFudtTMycnLjXucR7hZa6N5/jpd/bKD8DtY0D7S62dAQS6rv0qDXcvxlop 44rTbrAU8c/ZYJFOqd74EeRjhhShqp4KLq8+Wtz3BZ0yV8d7+whaEdIakyouZQhlW6hi xo5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="c4hc/QY5"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b22si2412312pft.303.2022.02.24.08.59.38; Thu, 24 Feb 2022 08:59:55 -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=@gmail.com header.s=20210112 header.b="c4hc/QY5"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbiBXQ4h (ORCPT + 99 others); Thu, 24 Feb 2022 11:56:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229971AbiBXQ4f (ORCPT ); Thu, 24 Feb 2022 11:56:35 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ABAF3B297 for ; Thu, 24 Feb 2022 08:56:03 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id o62-20020a1ca541000000b00380e3cc26b7so207438wme.0 for ; Thu, 24 Feb 2022 08:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2u0tTWzB+C7m5LfM7iEbPI+TTHyVsULewsmOsGCCQ50=; b=c4hc/QY5AsPyJomMGtHByxU70WaAVKHp9IrehpZko8Nf5zdYUsQMegmneroPsJdkdE dv34aWkO34CC9kXL7fK9jHluUxgh/1ZpCDm6Nk8GVyZjhihcDG9bIzkrnEgKTXehsSlq paLp+fJhuttH9a+HM9vEnCs/ItJfn0m4Swcs9PyWaF6r/2vp757B2dZlDv1TRfSWcKJw yy/mAel8SyQ1S9Betb0OLnHr2dexklfFwcsWbEReSj3J61GeOslS3JE+O2drDFndL3hO k8nfQkmq9w9dkq04sZIkoiCdQCLInQd9/4Fh1MEel08smumMCqaWLslUmeyg51jvKdsX rLdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2u0tTWzB+C7m5LfM7iEbPI+TTHyVsULewsmOsGCCQ50=; b=gkA3msI6lhvjL52hmKIXfBvQmbJNmKZw56qtJbw8AtFaVPiTKmsPknh3BLBKxAZNJC 64qATzkSenpaHDiW6+jn48IiL/09cIwyIxEoKInqxlS96gVgsjdn4MHbfdsZSt+xvCPa CY1OePUkEL4FQ6Ioj9PHKwd8XgwJkDFqRvVievJlVXRyf2zD9WXgonaciEBbCKuFGlbR 5LDv+AneMKAKL7mF38rzCMX6Pod38sLMiMf58sztRUrQ0y4XPNOXURAds9qeINn0kE0i rOYy9a4RoBDnnRiLa0IblBJK1QT7Oh3l6vboYyG62If/5v+GfBIc3u6LUl4LI1wQv64X uGCQ== X-Gm-Message-State: AOAM5322L3c96N3QasOD60c9RGeQtNaARXYPHB280TcVkVv0E+eE/M9/ KfdNtFv89vTHM+FfkUWAYJeWKSN3PMRJJ0l+0aU= X-Received: by 2002:a05:600c:284a:b0:37e:9244:abea with SMTP id r10-20020a05600c284a00b0037e9244abeamr3119883wmb.2.1645721761517; Thu, 24 Feb 2022 08:56:01 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <20220223211305.296816-11-trondmy@kernel.org> From: Anna Schumaker Date: Thu, 24 Feb 2022 11:55:45 -0500 Message-ID: Subject: Re: [PATCH v7 10/21] NFS: Reduce use of uncached readdir To: trondmy@kernel.org Cc: Linux NFS Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Hi Trond, On Wed, Feb 23, 2022 at 8:25 PM wrote: > > From: Trond Myklebust > > When reading a very large directory, we want to try to keep the page > cache up to date if doing so is inexpensive. With the change to allow > readdir to continue reading even when the cache is incomplete, we no > longer need to fall back to uncached readdir in order to scale to large > directories. > > Signed-off-by: Trond Myklebust As of this patch, cthon tests are passing again. Anna Anna > --- > fs/nfs/dir.c | 23 +++-------------------- > 1 file changed, 3 insertions(+), 20 deletions(-) > > diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c > index 9b0f13b52dbf..982b5dbe30d7 100644 > --- a/fs/nfs/dir.c > +++ b/fs/nfs/dir.c > @@ -986,28 +986,11 @@ static int find_and_lock_cache_page(struct nfs_readdir_descriptor *desc) > return res; > } > > -static bool nfs_readdir_dont_search_cache(struct nfs_readdir_descriptor *desc) > -{ > - struct address_space *mapping = desc->file->f_mapping; > - struct inode *dir = file_inode(desc->file); > - unsigned int dtsize = NFS_SERVER(dir)->dtsize; > - loff_t size = i_size_read(dir); > - > - /* > - * Default to uncached readdir if the page cache is empty, and > - * we're looking for a non-zero cookie in a large directory. > - */ > - return desc->dir_cookie != 0 && mapping->nrpages == 0 && size > dtsize; > -} > - > /* Search for desc->dir_cookie from the beginning of the page cache */ > static int readdir_search_pagecache(struct nfs_readdir_descriptor *desc) > { > int res; > > - if (nfs_readdir_dont_search_cache(desc)) > - return -EBADCOOKIE; > - > do { > if (desc->page_index == 0) { > desc->current_index = 0; > @@ -1262,10 +1245,10 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence) > } > if (offset != filp->f_pos) { > filp->f_pos = offset; > - if (!nfs_readdir_use_cookie(filp)) { > + dir_ctx->page_index = 0; > + if (!nfs_readdir_use_cookie(filp)) > dir_ctx->dir_cookie = 0; > - dir_ctx->page_index = 0; > - } else > + else > dir_ctx->dir_cookie = offset; > if (offset == 0) > memset(dir_ctx->verf, 0, sizeof(dir_ctx->verf)); > -- > 2.35.1 >