From: Dave Chinner <david@fromorbit.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Andreas Dilger <adilger@dilger.ca>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
Aurelien Jarno <aurelien@aurel32.net>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Robert Edmonds <edmonds@debian.org>,
Rob Browning <rlb@defaultvalue.org>
Subject: Re: Argument type for FS_IOC_GETFLAGS/FS_IOC_SETFLAGS ioctls
Date: Mon, 2 Dec 2013 09:20:03 +1100 [thread overview]
Message-ID: <20131201222003.GX10988@dastard> (raw)
In-Reply-To: <20131129142205.GA21527@thunk.org>
On Fri, Nov 29, 2013 at 09:22:05AM -0500, Theodore Ts'o wrote:
> On Fri, Nov 29, 2013 at 04:27:48PM +1100, Dave Chinner wrote:
> > > Sure, I was thinking about doing something like this instead:
> > >
> > > #define FS_IOC_GETFLAGS_WIDE _IOR('f', 32, __u64)
> > > #define FS_IOC_SETFLAGS_WIDE _IOR('f', 32, __u64)
> > >
> > > And I agree that a good reason to do this is to get 64 bits worth of
> > > attributes....
> >
> > Why create a new ioctl for getting these generic attributes out of
> > the kernel? Isn't that the problem xstat() is supposed to solve?
>
> Well, need to set and get these file flags, and historically we've
> used a bitmask for this purpose. And these aren't so much attributes
> as flags, really, i.e:
Yes, I know the history of this shitty interface. Thank you for
explaining to everyone else how we got into this mess....
> > And if it's truly generic stuff, then a syscall pair with enough
> > bitmap space for the forseeable future is more appropriate than a
> > new ioctl....
>
> You mean something where we take a char * and a length?
I don't really care how a bitmap gets specified - I'd even argue
that we shouldn't use a bitmap but a special attribute namespace.
> We could, but
> (a) it would be incompatible with existing FS_IOC_[GS]ETFLAGS, and (b)
> it's not clear the complexity is worth it.
Compatibility is not an issue here - if we have to change existing
applications to make use of more flags, then we may as well fix all
the problems the ioctl interface entails at the same time.
> P.S. One of the reasons why there's a certain amount of wastage with
> this ioctl is that some of the bit fields were originally used as the
> file system level encouding for the file flags in ext[234]. This
> could be argued to be bad design, but we didn't ask for this
> ext[234]-specific ioctl to get hijcaked for use by other file systems,
> either.
Hijacked? Ted, I think you need to tone down the rhetoric a bit.
Filesystems wanted to be compatible with the lsattr/ chattr tools
that shipped by default on all systems via e2fsprogs rather than
re-inventing their own wheel. Yes, it has made a mess of the
interface, but that's because nobody has stepped up to say "no,
don't do that, those are ext2 on-disk definitions" when it was
needed.
Let's take the opportunity to make a clean break so we don't have to
care what any specific filesystem does or stores on disk. With an
attribute namespace it's easy to add filesystem specific flags and
it's trivial to make them generic without breaking backwards
compatibility....
> If we do create the 64-bit version of this ioctl, we won't
> have this problem with the upper 32-bits --- and indeed it would be
> preferable if other file-system specific flags for btrfs, f2fs, et.al,
> got allocated from the MSB end of the 64-bit ioctl.
Ugh, that'll just screw it up even more. And if we put the ~10 XFS
flags in there that aren't supported by FS_IOC_GETFLAGS, and all the
others from other filesystems, we'll be out of space in a couple of
kernel releases...
> Or we could design an entirely new ioctl that uses a completely new
> bitmask allocation scheme, or even a plan9 style set of ascii messages
> which are passed back and forth between userspace and the kernel ---
> or even insist that btrfs was wrong, that they shouldn't have been
> allocating flags out of this legacy ioctl, but should have been using
> the existing xattr interface with a new namespace that was either
> btrfs specific or a new vfsflag namspace.
Yup, you've pretty much stated all the reasons why an expanded
bitmap is a bad idea, and why adding an attribute flag namespace is
probably a better way to expose all of these generic and
filesystem-specific flags in a generic manner.
And FWIW, an attribute based approach means you don't need to get
the flags before setting them to ensure you don't reset flags you
don't care about, so it's safer from that perspective, too...
> The options and opportunities for bike shedding are endless. :-)
I'm not interested in bike shedding - let's just solve the problem
once and for all....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2013-12-01 22:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-26 20:05 Argument type for FS_IOC_GETFLAGS/FS_IOC_SETFLAGS ioctls Aurelien Jarno
2013-11-27 1:01 ` Darrick J. Wong
2013-11-27 4:00 ` Theodore Ts'o
2013-11-27 10:03 ` Aurelien Jarno
2013-11-27 13:34 ` Theodore Ts'o
2013-11-27 18:14 ` Robert Edmonds
2013-11-27 23:14 ` Aurelien Jarno
2013-11-29 0:53 ` Andreas Dilger
2013-11-29 4:54 ` Theodore Ts'o
2013-11-29 5:27 ` Dave Chinner
2013-11-29 14:22 ` Theodore Ts'o
2013-11-29 16:32 ` Rob Browning
2013-12-01 22:20 ` Dave Chinner [this message]
2013-12-02 4:52 ` Theodore Ts'o
2013-12-02 22:30 ` Dave Chinner
2013-11-29 21:55 ` Andreas Dilger
2013-12-19 18:20 ` Rob Browning
2013-12-19 23:30 ` Darrick J. Wong
2013-11-27 10:15 ` Christoph Hellwig
2014-06-30 22:51 ` Rob Browning
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=20131201222003.GX10988@dastard \
--to=david@fromorbit.com \
--cc=adilger@dilger.ca \
--cc=aurelien@aurel32.net \
--cc=darrick.wong@oracle.com \
--cc=edmonds@debian.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rlb@defaultvalue.org \
--cc=tytso@mit.edu \
--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).