The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [GIT PULL] vfs dio
Date: Wed, 22 Jan 2025 14:50:42 +0100	[thread overview]
Message-ID: <20250122-aalen-knabbern-3a6d2f4b9c92@brauner> (raw)
In-Reply-To: <CAHk-=wgdZJQFfBnKXQm2EZiej-KVk5=E1gOBhW72XnQ_SBZ=cQ@mail.gmail.com>

On Mon, Jan 20, 2025 at 11:50:09AM -0800, Linus Torvalds wrote:
> On Mon, 20 Jan 2025 at 11:38, Christian Brauner <brauner@kernel.org> wrote:
> >
> > It is heavily used nowadays though because there's a few
> > additional bits in there that don't require calling into filesystems
> > but are heavily used.
> 
> By "heavily used" you mean "there is probably a 1:1000 ratio between
> statx:stat in reality".
> 
> Those "few additional bits" are all very specialized. No normal
> application cares about things like "mount ID" or subvolume data. I
> can't imagine what other fields you think are so important.

Sorry, I wasn't talking about new fields I was talking about actual bits
that statx has.

#define STATX_ATTR_COMPRESSED		0x00000004 /* [I] File is compressed by the fs */
#define STATX_ATTR_IMMUTABLE		0x00000010 /* [I] File is marked immutable */
#define STATX_ATTR_APPEND		0x00000020 /* [I] File is append-only */
#define STATX_ATTR_NODUMP		0x00000040 /* [I] File is not to be dumped */
#define STATX_ATTR_ENCRYPTED		0x00000800 /* [I] File requires key to decrypt in fs */
#define STATX_ATTR_AUTOMOUNT		0x00001000 /* Dir: Automount trigger */
#define STATX_ATTR_MOUNT_ROOT		0x00002000 /* Root of a mount */
#define STATX_ATTR_VERITY		0x00100000 /* [I] Verity protected file */
#define STATX_ATTR_DAX			0x00200000 /* File is currently in DAX state */
#define STATX_ATTR_WRITE_ATOMIC		0x00400000 /* File supports atomic write operations */

I think that such an attribute field could've been added to struct stat
itself because afaict there are two unused fields in there currently:

struct stat {
	unsigned long	st_dev;		/* Device.  */
	unsigned long	st_ino;		/* File serial number.  */
	unsigned int	st_mode;	/* File mode.  */
	unsigned int	st_nlink;	/* Link count.  */
	unsigned int	st_uid;		/* User ID of the file's owner.  */
	unsigned int	st_gid;		/* Group ID of the file's group. */
	[...]
	unsigned int	__unused4;
	unsigned int	__unused5;
};

I happily concede that stat() will exceed the usage of statx() for most
application that e.g., just want to do the basic mode, uid, gid thing.
So compared to that statx() usage is probably not that important.

And nothing would stop us from adding a statx2()...

int statx(int dfd, const char *path, unsigned int flags, unsigned int mask
          struct statx *st, size_t st_size)

#define STATX_SIZE_VER0 // compatible with struct stat

and then only the stat portion is filled in. This could allow glibc to
use statx() for everything without perf impact especially when paired
with allowing NULL with AT_EMPTY_PATH.

  reply	other threads:[~2025-01-22 13:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-18 13:09 [GIT PULL] vfs dio Christian Brauner
2025-01-20 19:24 ` Linus Torvalds
2025-01-20 19:38   ` Christian Brauner
2025-01-20 19:50     ` Linus Torvalds
2025-01-22 13:50       ` Christian Brauner [this message]
2025-01-20 19:39   ` Linus Torvalds
2025-01-29  6:34   ` Christoph Hellwig
2025-01-20 19:51 ` pr-tracker-bot

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=20250122-aalen-knabbern-3a6d2f4b9c92@brauner \
    --to=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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