[PATCH 02/18] xstat: Add a pair of system calls to make extended file stats available [ver #6]
adilger at dilger.ca
Tue Jul 20 02:28:25 MDT 2010
On 2010-07-19, at 11:46, Linus Torvalds wrote:
> On Mon, Jul 19, 2010 at 10:26 AM, David Howells <dhowells at redhat.com> wrote:
>> I suspect they would, though maybe they can say otherwise. What about SMB
>> directory enumeration? I believe that is effectively getdents-with-stat.
>> Having to do open+stat for each file for that would be painful.
> Yeah, but do you need xstat information at all for something like
> that? Most people try very hard to make do with the information
> returned by readdir itself (d_type and inode number), because if you
> end up looking up each name you've already pretty much lost in a
> performance model.
This lightweight stat() interface is exactly needed for things like "color ls",
which is the default on all distros today. "ls --color" always does a stat on the file just to get the file mode to color executable files differently. For Lustre and other distributed filesystems, getting things like the current file size is hard work (i.e. multiple RPCs per file), yet "ls" doesn't care about the size or modification times unless "ls -l" is used. Same goes for "find".
> (And I do agree that a "readdirplus()" is probably something that a
> lot of server people would find useful, but obviously that's another
> cross-filesystem nightmare. Only a few filesystems can cheaply give
> you anything but d_type/d_ino, and not all do even that),
Having a readdirplus() syscall would be even better, but again only with the ability to request specific attributes. Otherwise the filesystem may be doing a lot of extra work to collect all of the file attributes, and then userspace will probably be throwing most of them away.
More information about the samba-technical