linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Dave Chinner <david@fromorbit.com>
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: Fri, 29 Nov 2013 09:22:05 -0500	[thread overview]
Message-ID: <20131129142205.GA21527@thunk.org> (raw)
In-Reply-To: <20131129052748.GV10988@dastard>

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:

#define FS_IMMUTABLE_FL			0x00000010 /* Immutable file */
#define FS_APPEND_FL			0x00000020 /* writes to file may only append */

etc.  Some of these files are pretty file-system specific (and indeed
this ioctl was intended originally for ext[234]):

#define FS_JOURNAL_DATA_FL		0x00004000 /* Reserved for ext3 */

But because some of these flags ended up being file system generic, for example:

#define FS_NOATIME_FL			0x00000080 /* do not update atime */

(as well as the FS_IMMUTABLE_FL and FS_APPEND_FL), this ioctl was
hijacked into a generic ioctl for all file systems.  The problem is
some of these flags have become file system specific --- for other
file systems, e.g:

#define FS_NOCOW_FL			0x00800000 /* Do not cow file */

On the other hand, some of these are currently fs-specific, but could
eventually become used by more than one file system, e.g.:

#define	FS_COMPR_FL			0x00000004 /* Compress file */

> 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?  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.

Regards,

						 - Ted

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.  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.

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.

The options and opportunities for bike shedding are endless.   :-)

  reply	other threads:[~2013-11-29 14:22 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 [this message]
2013-11-29 16:32             ` Rob Browning
2013-12-01 22:20             ` Dave Chinner
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=20131129142205.GA21527@thunk.org \
    --to=tytso@mit.edu \
    --cc=adilger@dilger.ca \
    --cc=aurelien@aurel32.net \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=edmonds@debian.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rlb@defaultvalue.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).