linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@sun.com>
To: Oleg Drokin <green@linuxhacker.ru>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Attempt at "stat light" implementation
Date: Tue, 07 Apr 2009 03:23:40 -0700	[thread overview]
Message-ID: <20090407102340.GT3204@webber.adilger.int> (raw)
In-Reply-To: <20090407062356.GA1336463@fiona.linuxhacker.ru>

On Apr 07, 2009  10:23 +0400, Oleg Drokin wrote:
>   Also perhaps the ->getattr just needs a prototype change to accept the
>   flags argument and if the FS cares about it - to use it, but I did not
>   want to do this huge patch touching every FS right now if only to save
>   my time should this approach to be determined as undesirable for one
>   reason or another, so for now I add a ->getattr_light

You mean like open(path, flags, mode), where the @mode argument is
optional?  I think that has caused a lot of headaches in the past.

> +/* Bits to define what fields the "stat light" syscall must fill in
> + * struct stat, should not intersect with above AT_* bits */
> +#define STAT_NLINK	0x01000		/* nlink */
> +#define STAT_TIMES	0x02000		/* atime, mtime, ctime */
> +#define STAT_SIZE	0x04000		/* File size and blocks */
> +#define STAT_ACCESS	0x08000		/* mode, user, group */
> +#define STAT_EVERYTHING 0x0f000	/* Just a normal stat */

The very most common fields that will need to be returned are type and
mode, because "ls --color" (the default) does this.  These should get
their own flag at minimum, and should definitely be separate from uid/gid.  

One issue I recall with uid/gid is that in some environments the UID/GID
may be remapped for remote UID mapping (maybe with an LDAP or Kerberos
query for each one), and forcing the filesystem to do this when "ls"
is just going to throw them away is pointless.

Even the inode numbers cost a non-zero amount of work in some
filesystems that have to expose a persistent 32-bit mapping.

I'd prefer to have more fine grained control than this, since the
application knows what it wants, and it is impossible to predicy
what the "slow" operation is for a given filesystem/workload.

In the end it DOES seem that fstatat(2) is a sufficient interface for
this:

       int fstatat(int dirfd, const char *pathname, struct stat *buf,
		   int flags);

since it is working on the directory and passing in the filenames
for each file.  There is even a AT_SYMLINK_NOFOLLOW to avoid the
need to have a separate "l" version.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.


  reply	other threads:[~2009-04-07 10:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07  6:23 Attempt at "stat light" implementation Oleg Drokin
2009-04-07 10:23 ` Andreas Dilger [this message]
2009-04-07 14:54   ` Oleg Drokin
2009-04-07 17:52     ` Christoph Hellwig
2009-04-07 15:22   ` jim owens
2009-04-07 15:38     ` Oleg Drokin
2009-04-07 16:20       ` jim owens
2009-04-07 17:32 ` Jamie Lokier
2009-04-07 17:38   ` Jeff Garzik
2009-04-07 17:56     ` Jamie Lokier
2009-04-07 18:21       ` Andreas Dilger
2009-04-07 19:30         ` Ulrich Drepper
2009-04-12 20:55           ` Jamie Lokier
2009-04-07 17:41   ` Oleg Drokin
2009-04-07 17:54     ` Jamie Lokier
2009-04-07 18:00       ` Oleg Drokin
2009-04-07 18:18     ` Andreas Dilger
2009-04-07 18:31     ` Nicholas Miell
2009-04-07 17:49 ` Christoph Hellwig
2009-04-07 17:56   ` Oleg Drokin
2009-04-07 18:28     ` Andreas Dilger
2009-04-07 18:50       ` Jamie Lokier
2009-04-07 19:48       ` Jeff Garzik
2009-04-07 19:47   ` Jeff Garzik
2009-04-07 20:18 ` Evgeniy Polyakov

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=20090407102340.GT3204@webber.adilger.int \
    --to=adilger@sun.com \
    --cc=green@linuxhacker.ru \
    --cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).