Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1004969rdb; Sun, 3 Sep 2023 22:45:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGy6iEsJGAl5Tb4wbrJtAfNu8bjE/3ikMSZBNETXakGEwIagV9x7iUQdhqeUg2oS476hrAM X-Received: by 2002:a17:906:6a0d:b0:9a2:26fa:8752 with SMTP id qw13-20020a1709066a0d00b009a226fa8752mr12486551ejc.10.1693806337997; Sun, 03 Sep 2023 22:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693806337; cv=none; d=google.com; s=arc-20160816; b=N6larA68jNvRrvKRP/Cn8q49U1bZna58Hi3G108Qps11ZgMAkpzF4SpqKMNcF4mdeZ aA5HaZ2COMcSsKdazUyF2WULYGfRAdr1Ek6iqSufS7tIMZmjxLZd3FXcRIgh6IV3Dl+j ViGHjD0K4VhsArDB9G1Pn+gQ49x+JbBl/IllprJK+4VApLaLXmIlGn49W+vstbDzeUUk vgAvKqk7IWEHBYHQ0w+EfYwUp4I4I6I6qs6xMnfDJL67/OtCTsPct6wQkf4UWbreXyYp ezoBgw6wyL2Wf2YCnt9dkW6ImAuYOHjoJu7YtHDbUidPXM7JWTo9Ywr08ep0xEDzB51t zPAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HOxiQHnQn4KrtUcHRiuQl9E5adLkrnqfMUgTMKPa4vg=; fh=VRjJgo2wcNS+yn+5c+WtXpxOd2Q2QLUnq2bqfsAoZFQ=; b=lo4HTZ+1d4ushi22olgk9GXyNJ1cpTasO2CvcZeL6+MkLPXU+U9H7nnPyPpgafDeMJ XgZttmwPw+MOk6OU6dc5kBfSPbl853ntljlhA9SPkSoNByTeLOgiNTVIfgPgIj6lpJO4 tI0rzQ6y6Ih/kGbg2zwNyuyLpZkn7Izmq27agxEcNTZrucWAG+OgJkvrsbx00OI5nD+K YTXQ/mv9jr8ZkVZbScu/2PbRYcz2tsKRPLxk+moOXyDd9YLAT/hOeYr+AEmbChvT8NKg PT21dn/T+OjxJxrX9NI+BZa/TbHS1em3hP8LX2sqWDqfY3V257N4MJ5fYUzmlKuKrWaf YoPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=CKkDLkFJ; 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 ci12-20020a170906c34c00b0099cd32bd549si5747855ejb.606.2023.09.03.22.45.36; Sun, 03 Sep 2023 22:45:37 -0700 (PDT) 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=20221208 header.b=CKkDLkFJ; 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 S229688AbjHaUI5 (ORCPT + 3 others); Thu, 31 Aug 2023 16:08:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbjHaUI4 (ORCPT ); Thu, 31 Aug 2023 16:08:56 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCFC5E5C for ; Thu, 31 Aug 2023 13:08:52 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-26d5970cd28so926196a91.2 for ; Thu, 31 Aug 2023 13:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693512532; x=1694117332; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HOxiQHnQn4KrtUcHRiuQl9E5adLkrnqfMUgTMKPa4vg=; b=CKkDLkFJDT1oMqtsiMYSvyujTM0eq9PKkPZbkK2d3z6alC0eAIidZgUoRikiepR3dK 0DfoWOsnOirWcgBmbPO7lU5x9CcmBV6XTlTeni0vFluT+0NoVZbbB2nKaCBJa/HXmuP4 jWBqrZO1ogLuHYVNjXHpOXo6S++27fgGsvf66++X/NtfmE0OHUjTBl4hY6Fo2rByx7zU /st1c82qlKyS6G/ipXSOPgUgExTrzYBMB1l5PiS+XWWAtgyLHp2pXyIIMQl6kkH+PIpe rEghYgYQuoMNwoFWgZ0bqUndhVoXwHweZQfWA6xO8jDzmnQO1RmeceUDONBDrAx4swz9 tfyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693512532; x=1694117332; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HOxiQHnQn4KrtUcHRiuQl9E5adLkrnqfMUgTMKPa4vg=; b=PjhAW5lgTsdoncehJ3Z/dIRmB5P2TrI2vLKP34bu0E7KyRoNYIsutqfRRnU7RWF0eS hdnAZtqrGQLb4RMRLW4fqhrH4ccaMnQU9H7YII4ZqC2YrkhqHTyWisBMTnTuIKvv+Id6 Q6nFRToE85Hf/86MDS90m7nzdrHVb0+Rgh/dyLqwEr51F1rK8kP3dNd02/a4A7IReyd0 DZsRYi65as2v4gBwtYfc9jYbI12Z4plCHCQEqkmo+bebuE71W+R5vsh1+M+1l+6PINhJ N5YZ0+6jMQka5xVjALi8fuGhpPhzTl+9hH2iv/utQMjEj15uDFDo7qS6B1SYjowgBuGX KUyA== X-Gm-Message-State: AOJu0YzCvXbT4g0B2UnqpvvPLBdCycNo8iG7Yq9lMxIsrPJscMF3YY0E G/485AYePEchYLpXRd8EURtoPfTSt3d8quChqdmvIAxlhw== X-Received: by 2002:a17:90a:9ab:b0:273:4b39:e5b9 with SMTP id 40-20020a17090a09ab00b002734b39e5b9mr421785pjo.4.1693512532313; Thu, 31 Aug 2023 13:08:52 -0700 (PDT) MIME-Version: 1.0 References: <82d1908e4f835a2f16a509a11b62b9d93ccb6cdf.1693424491.git.bcodding@redhat.com> <4eb846815a1cdd1a98e064305b57a890b46e2708.camel@hammerspace.com> In-Reply-To: From: Rick Macklem Date: Thu, 31 Aug 2023 13:08:41 -0700 Message-ID: Subject: Re: [PATCH v2] NFSv4: Always ask for type with READDIR To: Jeff Layton Cc: Cedric Blancher , "linux-nfs@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 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 Thu, Aug 31, 2023 at 11:53=E2=80=AFAM Jeff Layton w= rote: > > CAUTION: This email originated from outside of the University of Guelph. = Do not click links or open attachments unless you recognize the sender and = know the content is safe. If in doubt, forward suspicious emails to IThelp@= uoguelph.ca. > > > On Thu, 2023-08-31 at 20:41 +0200, Cedric Blancher wrote: > > On Thu, 31 Aug 2023 at 02:17, Jeff Layton wrote: > > > > > > On Wed, 2023-08-30 at 20:20 +0000, Trond Myklebust wrote: > > > > On Wed, 2023-08-30 at 16:10 -0400, Jeff Layton wrote: > > > > > On Wed, 2023-08-30 at 15:42 -0400, Benjamin Coddington wrote: > > > > > > Again we have claimed regressions for walking a directory tree, > > > > > > this time > > > > > > with the "find" utility which always tries to optimize away ask= ing > > > > > > for any > > > > > > attributes until it has a complete list of entries. This behav= ior > > > > > > makes > > > > > > the readdir plus heuristic do the wrong thing, which causes a s= torm > > > > > > of > > > > > > GETATTRs to determine each entry's type in order to continue th= e > > > > > > walk. > > > > > > > > > > > > For v4 add the type attribute to each READDIR request to includ= e it > > > > > > no > > > > > > matter the heuristic. This allows a simple `find` command to > > > > > > proceed > > > > > > quickly through a directory tree. > > > > > > > > > > > > > > > > The important bit here is that with v4, we can fill out d_type ev= en > > > > > when > > > > > "plus" is false, at little cost. The downside is that non-plus > > > > > READDIR > > > > > replies will now be a bit larger on the wire. I think it's a > > > > > worthwhile > > > > > tradeoff though. > > > > > > > > The reason why we never did it before is that for many servers, it > > > > forces them to go to the inode in order to retrieve the information= . > > > > > > > > IOW: You might as well just do readdirplus. > > > > > > > > > > That makes total sense, given how this code has evolved. > > > > > > FWIW, the Linux NFS server already calls vfs_getattr for every dentry= in > > > a v4 READDIR reply regardless of what the client requests. It has to = in > > > order to detect junctions, so we're bringing in the inode no matter > > > what. Fetching the type is trivial, so I don't see this as costing > > > anything extra there. > > > > > > Mileage could vary on other servers with more synthetic filesystems, = but > > > one would hope that most of them can also return the type cheaply. > > > > Do you have examples for such synthetic filesystems? > > > > Synthetic is probably the wrong distinction here, actually. > > If looking up the inode type info is expensive, then you'll feel it here > more with this change. That's true regardless of whether this is a > "normal" or "synthetic" fs. In case you are interested in an outsider's perspective... I recently patched the FreeBSD server so that it did not need to acquire a vnode to generate a Readdir reply if only the following attributes are requested and the entry is not a directory. (FreeBSD has a d_type field in its "struct dirent".) RDAttr_error, Mounted_on_FileID, FileID, Type --> Adding a requirement for Type to nordirplus would not have any negative effect on the FreeBSD server. This patch resulted in about a 5% improvement on Readdir RPC response time for Readdirs only asking for the above attributes, for some simple measurements I did using the FreeBSD client. I still need to acquire the vnode for directories, to check for server file system mount points. I do not know if what you refer as "junctions" are directory specific? rick > > I wouldn't expect a big performance hit from the Linux NFS server given > that we'll almost certainly have that info in-core, but other servers > (ganesha? some commercial servers?) could take a hit here. > -- > Jeff Layton >