Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1683473pxm; Thu, 24 Feb 2022 07:33:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrjG3MnH9mfOHHluo/M60BQaGPxuaVLNjblzJno0YHS1nHotUk86dFVSZJDa5++UC3S2IT X-Received: by 2002:a17:902:edd5:b0:14f:9044:19f2 with SMTP id q21-20020a170902edd500b0014f904419f2mr3102593plk.74.1645716828207; Thu, 24 Feb 2022 07:33:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645716828; cv=none; d=google.com; s=arc-20160816; b=ARjwFih5LSis3F00oURh55voTi7bP8hTUm6BaD0VaXMvd+k62ag1dOsz48SuhDZ5WC TZu5Y45NHcSTCT+vKxJdVTLgwya+Qjh70byGHPsxOlXoMx7CsTqWfZLLLUEzri2HHNZ3 SUMp9vJ5TgfIw0j0DTmOFJjHr63Zu9cyCelx7yTp8V8tNlM5jyQaJPoyjwwaIXHe0fSY qit/TQSNn9jkM46AMx5UrIuDV+BSrMm5IUtBYM2hr8wEwEIF8Ch4nJVcjUue4FOuLQz3 TlCL9arLbzsxlMy7ogCxRL7UP0IKN+JDM0aSFk5ShdOUkexlU/1qw4MRtVoQevFhwzQd IT1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=2iMQBL7n6jOsKk0gBixWydXv+tyxVvEIlZv4EN73YSE=; b=HFWOFZCPATXeMO2blmmPg6KzCFWS1uA4awJIesqdOE5j/CAlIRg2vQIz78Xg5Mk4Ds X/107zIQre1mdZQNquO5GvgBip8wW/juRqf60cOVUWCNQ42bQUIEpCXBTZ7Yl/lPsi7B 2nEr55cOqFzf0Xycs33jCLR3fp7wNqfSzE6aMMLNpl3b+CQGVOicN72CQ17WgGxCOYJg sN7pfurrEjmtb3y3ZfwcpnhyYnZgdzcV//CJ8VwZtf8TMXh0CSKcrD3Auv12wfmnZH0Q w1Z/fVtLp6PUEXPcWagdjTjIKIsT7sCbphNZO5B2yT4tVrUFyYXBmWb9sZLWm/j1KiiS X5yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cexSPdZJ; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 143si2519039pgf.494.2022.02.24.07.33.27; Thu, 24 Feb 2022 07:33:48 -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=@redhat.com header.s=mimecast20190719 header.b=cexSPdZJ; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235387AbiBXOQc (ORCPT + 99 others); Thu, 24 Feb 2022 09:16:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233212AbiBXOQ2 (ORCPT ); Thu, 24 Feb 2022 09:16:28 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 898A329A555 for ; Thu, 24 Feb 2022 06:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645712157; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2iMQBL7n6jOsKk0gBixWydXv+tyxVvEIlZv4EN73YSE=; b=cexSPdZJtZOWMAafkFN3RkZ84qkgKAZ7ad3ASLNP1paQf/swIvYI97T+j5l4WUh52lJJ8H 3slnR+k2lm9LH9ZjedaVB3QAakDAtZrg0vofSeEgYresg2CHcxq2Hy6YoPWz3Zy7SN7PhN Sh9cGP3prDSwEB85CdP4rZeQwnN+RhQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-74AtA2ubMzGkNR_JhH46fQ-1; Thu, 24 Feb 2022 09:15:56 -0500 X-MC-Unique: 74AtA2ubMzGkNR_JhH46fQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 733E81854E26; Thu, 24 Feb 2022 14:15:55 +0000 (UTC) Received: from [172.16.176.1] (ovpn-64-2.rdu2.redhat.com [10.10.64.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 394BF5C3E0; Thu, 24 Feb 2022 14:15:55 +0000 (UTC) From: "Benjamin Coddington" To: trondmy@kernel.org Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH v7 04/21] NFS: Calculate page offsets algorithmically Date: Thu, 24 Feb 2022 09:15:54 -0500 Message-ID: In-Reply-To: <20220223211305.296816-5-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> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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 On 23 Feb 2022, at 16:12, trondmy@kernel.org wrote: > From: Trond Myklebust > > Instead of relying on counting the page offsets as we walk through the > page cache, switch to calculating them algorithmically. > > Signed-off-by: Trond Myklebust > --- > fs/nfs/dir.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c > index 8f17aaebcd77..f2258e926df2 100644 > --- a/fs/nfs/dir.c > +++ b/fs/nfs/dir.c > @@ -248,17 +248,20 @@ static const char *nfs_readdir_copy_name(const > char *name, unsigned int len) > return ret; > } > > +static size_t nfs_readdir_array_maxentries(void) > +{ > + return (PAGE_SIZE - sizeof(struct nfs_cache_array)) / > + sizeof(struct nfs_cache_array_entry); > +} > + Why the choice to use a runtime function call rather than the compiler's calculation? I suspect that the end result is the same, as the compiler will optimize it away, but I'm curious if there's a good reason for this. Ben