public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever III <chuck.lever@oracle.com>
To: Geert Jansen <gerardu@amazon.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: RFC: return d_type for non-plus READDIR
Date: Tue, 23 Mar 2021 15:26:02 +0000	[thread overview]
Message-ID: <689DD4DF-17C0-4776-BE53-7F10F7FFE720@oracle.com> (raw)
In-Reply-To: <20210323010057.GA129497@dev-dsk-gerardu-1d-3da90cb4.us-east-1.amazon.com>

Hi Geert -

> On Mar 22, 2021, at 9:00 PM, Geert Jansen <gerardu@amazon.com> wrote:
> 
> 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.

Can you say more about the impact of requesting this attribute
from servers that cannot efficiently provide it? Which servers
and filesystems find it a problem, and how much of a problem is
it?


> 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?

I'd rather avoid adding another administrative knob unless it is
absolutely necessary... are there other options for controlling
whether the client requests this attribute?

For example, is there a way for a server to decide not to provide
it if it would be burdensome to do so? ie, the client always asks,
but it would be up to the server to provide it if it can do so.

--
Chuck Lever




  reply	other threads:[~2021-03-23 15:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  1:00 RFC: return d_type for non-plus READDIR Geert Jansen
2021-03-23 15:26 ` Chuck Lever III [this message]
2021-03-24  1:47   ` Geert Jansen
2021-03-24 13:50     ` Chuck Lever III
2021-03-25 17:26       ` Geert Jansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=689DD4DF-17C0-4776-BE53-7F10F7FFE720@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=gerardu@amazon.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox