Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3862541pxf; Mon, 22 Mar 2021 18:02:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+A72KICrG9SzNpZA8pWyBT5Uyeb/RpIz8gJE81KrJMcFyTFlgKpMdZVotXDOmirSKawYD X-Received: by 2002:a17:906:3f87:: with SMTP id b7mr2349219ejj.139.1616461363119; Mon, 22 Mar 2021 18:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616461363; cv=none; d=google.com; s=arc-20160816; b=OXoZiheDU2ah9Zpuf2a3NpnnOk8KnrJFX1AhcLeRc1IWQf6mo8SRxk82gI+IeP42m3 GLHY+faTTWv7jHfSAsjUp0DKyCu1+kFNy9vSER00OFGlPaDJ3GQet/iDS437HscJUvx6 JLybyvWi8eQhYV72bylk0nqiDywB9bYNOXgEdtKHb/QuDEGA33wi9aC588ZJQOnssGVz dX22jjKBvLEU3rvfjv0JefMZ0ZX1JaUL8FLyb2Y1kQKjTnQN1jr3GJnNFb08ePohYMeo qBe0vLxSx8PII0OX3WDSoIT9rbdwtEieC1H5Hh8LchmTlSuPSzMbYXFOxND5PLMkPi3p WWZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:to:from:date:dkim-signature; bh=4Ivdx/d+hB+n3G6dvXqqW4p2PsE6/U7qnL5uBk0w9kg=; b=avaHk0+07NzoPIj86wz8b42OLNRgj5F/WKh2Ri3y8M8zlDLlfx1S7le9C3excGvEA6 9eLKK91fVyHbSLyev4BT+hP7P53VMiGNlzNzEa0ByBX7Uslm07BjQ0k5GRXmxtIk3zy3 l3UFbp6ndt5ipf4AB+RVP54GUSsxa+JFi7WxMg/im53msRkWWl+vShsmlxMBs6n7k36/ AsaL08Uulzc3eHHG5JzrYV+NVlfljNNVObfrL2IrkibnPzkyaFKMblO0fAbC0GXYeif/ NIUhGyRa1sWV3c0O3FkdsWiYegHt2goTlCsc/XbrngYj1GTHSTxtPWrEXFp4YNTxmXkP d7gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=soOto8lr; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g13si13339417ejc.80.2021.03.22.18.02.09; Mon, 22 Mar 2021 18:02:43 -0700 (PDT) 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=@amazon.com header.s=amazon201209 header.b=soOto8lr; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbhCWBB3 (ORCPT + 99 others); Mon, 22 Mar 2021 21:01:29 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:12449 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230284AbhCWBBA (ORCPT ); Mon, 22 Mar 2021 21:01:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1616461260; x=1647997260; h=date:from:to:subject:message-id:mime-version; bh=4Ivdx/d+hB+n3G6dvXqqW4p2PsE6/U7qnL5uBk0w9kg=; b=soOto8lrMhmvr6t+h4+j5m7zgp22ZSoGaKXOHnNhKoYVe/RDJyHTP/+D 3D3WBS03aIVBt5hbsKCr4e/3Z1sKOn9FOSKIyQVrwEbxmYEjRLLSm1aUh CZqae+de+fWi5rN+IZ9w5TdpegwE8GWI095GxvoGCNaMhYfXQhKnnEx6q g=; X-IronPort-AV: E=Sophos;i="5.81,269,1610409600"; d="scan'208";a="96920125" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 23 Mar 2021 01:00:59 +0000 Received: from EX13MTAUWA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com (Postfix) with ESMTPS id D4C99C02A3 for ; Tue, 23 Mar 2021 01:00:58 +0000 (UTC) Received: from EX13D36UWA002.ant.amazon.com (10.43.160.24) by EX13MTAUWA001.ant.amazon.com (10.43.160.58) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 23 Mar 2021 01:00:58 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D36UWA002.ant.amazon.com (10.43.160.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 23 Mar 2021 01:00:58 +0000 Received: from dev-dsk-gerardu-1d-3da90cb4.us-east-1.amazon.com (10.200.231.78) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 23 Mar 2021 01:00:58 +0000 Received: by dev-dsk-gerardu-1d-3da90cb4.us-east-1.amazon.com (Postfix, from userid 5408343) id EBA171F2D; Tue, 23 Mar 2021 01:00:57 +0000 (UTC) Date: Tue, 23 Mar 2021 01:00:57 +0000 From: Geert Jansen To: Subject: RFC: return d_type for non-plus READDIR Message-ID: <20210323010057.GA129497@dev-dsk-gerardu-1d-3da90cb4.us-east-1.amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi, recursively listing a directory tree requires that you know which entries are directories so that you can recurse into them. The getdents() API can provide this information through the d_type field. Today, d_type is available if we use READDIRPLUS. A non-plus READDIR requests only the "rdattr_error" and "mounted_on_fileid" attributes, but not "type", and consequently sets d_type to DT_UNKNOWN. Requesting the "type" attribute for regular, non-plus READDIR would allow us to always return d_type, even for large directories where we switch to a non-plus READDIR. It would allow the user to recursively list directories of any size without the need for GETATTRs, and, if the server supports this, without any stat() or equivalent calls on the server. For some use cases, you could also mount with '-o nordirplus' to scan an entire file system efficiently. Since not all file servers may be able to produce the directory entry type efficiently, this could be implemented as a mount option that defaults off. Some local file systems offer a similar choice. For example, both ext4 and xfs have an (in this case mkfs-time) option to store the inode type in the directory. If this option is set, then getdents() always returns d_type. Would a patch that adds such a mount option be acceptable?