linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Amir Goldstein <amir73il@gmail.com>
Cc: "Pali Rohár" <pali@kernel.org>,
	"Dave Chinner" <david@fromorbit.com>,
	"Eric Biggers" <ebiggers@kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>,
	"ronnie sahlberg" <ronniesahlberg@gmail.com>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Christian Brauner" <brauner@kernel.org>,
	"Jan Kara" <jack@suse.cz>, "Steve French" <sfrench@samba.org>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/4] fs: Add FS_XFLAG_COMPRESSED & FS_XFLAG_ENCRYPTED for FS_IOC_FS[GS]ETXATTR API
Date: Fri, 21 Feb 2025 11:34:43 -0500	[thread overview]
Message-ID: <20250221163443.GA2128534@mit.edu> (raw)
In-Reply-To: <CAOQ4uxiAU7UorH1FLcPgoWMXMGRsOt77yRQ12Xkmzcxe8qYuVw@mail.gmail.com>

I think a few people were talking past each other, because there are two
fileds in struct fileattr --- flags, and fsx_xflags.  The flags field
is what was originally used by FS_IOC_EXT2_[GS]ETFLAGS, which later
started getting used by many other file systems, starting with
resierfs and btrfs, and so it became FS_IOC_[GS]ETFLAGS.  The bits in
that flags word were both the ioctl ABI and the on-disk encoding, and
because we were now allowing multiple file systems to allocate bits,
and we needed to avoid stepping on each other (for example since btrfs
started using FS_NOCOW_FL, that bit position wouldn't be used by ext4,
at least not for a publically exported flag).

So we started running out of space in the FS_FLAG_*_FL namespace, and
that's why we created FS_IOC_[GS]ETXATTR and the struct fsxattr.  The
FS_XFLAG_*_FL space has plenty of space; there are 14 unassigned bit
positions, by my count.

As far as the arguments about "proper interface design", as far as
Linux is concerned, backwards compatibility trumps "we should have
done if it differently".  The one and only guarantee that we have that
FS_IOC_GETXATTR followed by FS_IOC_SETXATTR will work.  Nothing else.

The use case of "what if a backup program wants to backup the flags
and restore on a different file system" is one that hasn't been
considered, and I don't think any backup programs do it today.  For
that matter, some of the flags, such as the NODUMP flag, are designed
to be instructions to a dump/restore system, and not really one that
*should* be backed up.  Again, the only semantic that was guaranteed
is GETXATTR or GETXATTR followed by SETXATTR.

We can define some new interface for return what xflags are supported
by a particular file system.  This could either be the long-debated,
but never implemented statfsx() system call.  Or it could be extending
what gets returned by FS_IOC_GETXATTR by using one of the fs_pad
fields in struct fsxattr.  This is arguably the simplest way of
dealing with the problem.

I suppose the field could double as the bitmask field when
FS_IOC_SETXATTR is called, but that just seems to be an overly complex
set of semantics.  If someone really wants to do that, I wouldn't
really complain, but then what we would actually call the field
"flags_supported_on_get_bitmask_on_set" would seem a bit wordy.  :-)

				      	     - Ted

  reply	other threads:[~2025-02-21 16:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-16 16:40 [RFC PATCH 0/4] fs: Add support for Windows file attributes Pali Rohár
2025-02-16 16:40 ` [RFC PATCH 1/4] fs: Add FS_XFLAG_COMPRESSED & FS_XFLAG_ENCRYPTED for FS_IOC_FS[GS]ETXATTR API Pali Rohár
2025-02-16 18:34   ` Eric Biggers
2025-02-16 18:49     ` Pali Rohár
2025-02-16 20:17     ` Amir Goldstein
2025-02-16 20:24       ` Pali Rohár
2025-02-16 20:43         ` Amir Goldstein
2025-02-16 21:17           ` Pali Rohár
2025-02-17  8:27             ` Amir Goldstein
2025-02-18  1:33           ` Dave Chinner
2025-02-18  9:13             ` Amir Goldstein
2025-02-18 19:27               ` Pali Rohár
2025-02-18 22:56                 ` Dave Chinner
2025-02-18 23:06                   ` Pali Rohár
2025-02-19  7:55                     ` Amir Goldstein
2025-02-21 16:34                       ` Theodore Ts'o [this message]
2025-02-21 17:11                         ` Amir Goldstein
2025-02-25  5:41                           ` Dave Chinner
2025-02-25 20:14                             ` Pali Rohár
2025-02-21 18:55                         ` Andreas Dilger
2025-02-25  3:42                         ` Dave Chinner
2025-02-18 22:45               ` Dave Chinner
2025-02-16 16:40 ` [RFC PATCH 2/4] fs: Extend FS_IOC_FS[GS]ETXATTR API for Windows attributes Pali Rohár
2025-02-16 19:55   ` Amir Goldstein
2025-02-16 20:01     ` Pali Rohár
2025-02-16 20:34       ` Amir Goldstein
2025-02-16 21:01         ` Pali Rohár
2025-02-16 16:40 ` [RFC PATCH 3/4] fs: Implement support for fsx_xflags_mask, fsx_xflags2 and fsx_xflags2_mask into vfs Pali Rohár
2025-02-21 18:24   ` Theodore Ts'o
2025-02-25 20:07     ` Pali Rohár
2025-02-16 16:40 ` [RFC PATCH 4/4] cifs: Implement FS_IOC_FS[GS]ETXATTR API for Windows attributes Pali Rohár
2025-02-16 20:21   ` Amir Goldstein
2025-02-16 20:25     ` Pali Rohár

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=20250221163443.GA2128534@mit.edu \
    --to=tytso@mit.edu \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pali@kernel.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=sfrench@samba.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).