All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Li Xi <pkuelelixi@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-api@vger.kernel.org, adilger@dilger.ca, jack@suse.cz,
	viro@zeniv.linux.org.uk, hch@infradead.org, dmonakhov@openvz.org
Subject: Re: [v15 4/4] ext4: cleanup inode flag definitions
Date: Mon, 28 Dec 2015 10:23:34 -0500	[thread overview]
Message-ID: <20151228152334.GA31415@thunk.org> (raw)
In-Reply-To: <1442146833-13652-5-git-send-email-lixi@ddn.com>

On Sun, Sep 13, 2015 at 09:20:33PM +0900, Li Xi wrote:
> The inode flags defined in uapi/linux/fs.h were migrated from
> ext4.h. This patch changes the inode flag definitions in ext4.h
> to VFS definitions to make the gaps between them clearer.
> 
> Signed-off-by: Li Xi <lixi@ddn.com>
> Reviewed-by: Andreas Dilger <adilger@dilger.ca>

Instead of doing things this way, I've decided to clean things up by
updating the flags in uapi/linux/fs.h.  That's because some people who
might want to assign new flags might not be ext4 developers, and so
they wouldn't look at fs/ext4/ext4.h.

At the same time, we really don't want people adding new flags by
default, unless there is a really good reason.  So I've added a
comment making the history of the interface and suggesting that people
not assign new flags without thinking twice (or checking with
linux-fsdevel and linux-api).

						- Ted

commit 6ac40c7b5597646ec4335f77ab79cac9663f4a1e
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Mon Dec 28 10:21:43 2015 -0500

    fs: clean up the flags definition in uapi/linux/fs.h
    
    Add an explanation for the flags used by FS_IOC_[GS]ETFLAGS and remind
    people that changes should be revised by linux-fsdevel and linux-api.
    
    Add flags that are used on-disk for ext4, and remove FS_DIRECTIO_FL
    since it was used only by gfs2 and support was removed in 2008 in
    commit c9f6a6bbc28 ("The ability to mark files for direct i/o access
    when opened normally is both unused and pointless, so this patch
    removes support for that feature.")  Now we have _two_ remaining flags
    left.  But since we want to discourage people from assigning new
    flags, that's OK.
    
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>

diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 627f58e..35d156f 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -2,8 +2,11 @@
 #define _UAPI_LINUX_FS_H
 
 /*
- * This file has definitions for some important file table
- * structures etc.
+ * This file has definitions for some important file table structures
+ * and constants and structures used by various generic file system
+ * ioctl's.  Please do not make any changes in this file before
+ * sending patches for review to linux-fsdevel@vger.kernel.org and
+ * linux-api@vger.kernel.org.
  */
 
 #include <linux/limits.h>
@@ -204,6 +207,23 @@ struct fsxattr {
 
 /*
  * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
+ *
+ * Note: for historical reasons, these flags were originally used and
+ * defined for use by ext2/ext3, and then other file systems started
+ * using these flags so they wouldn't need to write their own version
+ * of chattr/lsattr (which was shipped as part of e2fsprogs).  You
+ * should think twice before trying to use these flags in new
+ * contexts, or trying to assign these flags, since they are used both
+ * as the UAPI and the on-disk encoding for ext2/3/4.  Also, we are
+ * almost out of 32-bit flags.  :-)
+ *
+ * We have recently hoisted FS_IOC_FSGETXATTR / FS_IOC_FSSETXATTR from
+ * XFS to the generic FS level interface.  This uses a structure that
+ * has padding and hence has more room to grow, so it may be more
+ * appropriate for many new use cases.
+ *
+ * Please do not change these flags or interfaces before checking with
+ * linux-fsdevel@vger.kernel.org and linux-api@vger.kernel.org.
  */
 #define	FS_SECRM_FL			0x00000001 /* Secure deletion */
 #define	FS_UNRM_FL			0x00000002 /* Undelete */
@@ -217,8 +237,8 @@ struct fsxattr {
 #define FS_DIRTY_FL			0x00000100
 #define FS_COMPRBLK_FL			0x00000200 /* One or more compressed clusters */
 #define FS_NOCOMP_FL			0x00000400 /* Don't compress */
-#define FS_ECOMPR_FL			0x00000800 /* Compression error */
 /* End compression flags --- maybe not all used */
+#define FS_ENCRYPT_FL			0x00000800 /* Encrypted file */
 #define FS_BTREE_FL			0x00001000 /* btree format dir */
 #define FS_INDEX_FL			0x00001000 /* hash-indexed directory */
 #define FS_IMAGIC_FL			0x00002000 /* AFS directory */
@@ -226,9 +246,12 @@ struct fsxattr {
 #define FS_NOTAIL_FL			0x00008000 /* file tail should not be merged */
 #define FS_DIRSYNC_FL			0x00010000 /* dirsync behaviour (directories only) */
 #define FS_TOPDIR_FL			0x00020000 /* Top of directory hierarchies*/
+#define FS_HUGE_FILE_FL			0x00040000 /* Reserved for ext4 */
 #define FS_EXTENT_FL			0x00080000 /* Extents */
-#define FS_DIRECTIO_FL			0x00100000 /* Use direct i/o */
+#define FS_EA_INODE_FL			0x00200000 /* Inode used for large EA */
+#define FS_EOFBLOCKS_FL			0x00400000 /* Reserved for ext4 */
 #define FS_NOCOW_FL			0x00800000 /* Do not cow file */
+#define FS_INLINE_DATA_FL		0x10000000 /* Reserved for ext4 */
 #define FS_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
 #define FS_RESERVED_FL			0x80000000 /* reserved for ext2 lib */
 

WARNING: multiple messages have this Message-ID (diff)
From: Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>
To: Li Xi <pkuelelixi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org,
	jack-AlSwsSmVLrQ@public.gmane.org,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org,
	hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	dmonakhov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org
Subject: Re: [v15 4/4] ext4: cleanup inode flag definitions
Date: Mon, 28 Dec 2015 10:23:34 -0500	[thread overview]
Message-ID: <20151228152334.GA31415@thunk.org> (raw)
In-Reply-To: <1442146833-13652-5-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>

On Sun, Sep 13, 2015 at 09:20:33PM +0900, Li Xi wrote:
> The inode flags defined in uapi/linux/fs.h were migrated from
> ext4.h. This patch changes the inode flag definitions in ext4.h
> to VFS definitions to make the gaps between them clearer.
> 
> Signed-off-by: Li Xi <lixi-LfVdkaOWEx8@public.gmane.org>
> Reviewed-by: Andreas Dilger <adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>

Instead of doing things this way, I've decided to clean things up by
updating the flags in uapi/linux/fs.h.  That's because some people who
might want to assign new flags might not be ext4 developers, and so
they wouldn't look at fs/ext4/ext4.h.

At the same time, we really don't want people adding new flags by
default, unless there is a really good reason.  So I've added a
comment making the history of the interface and suggesting that people
not assign new flags without thinking twice (or checking with
linux-fsdevel and linux-api).

						- Ted

commit 6ac40c7b5597646ec4335f77ab79cac9663f4a1e
Author: Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>
Date:   Mon Dec 28 10:21:43 2015 -0500

    fs: clean up the flags definition in uapi/linux/fs.h
    
    Add an explanation for the flags used by FS_IOC_[GS]ETFLAGS and remind
    people that changes should be revised by linux-fsdevel and linux-api.
    
    Add flags that are used on-disk for ext4, and remove FS_DIRECTIO_FL
    since it was used only by gfs2 and support was removed in 2008 in
    commit c9f6a6bbc28 ("The ability to mark files for direct i/o access
    when opened normally is both unused and pointless, so this patch
    removes support for that feature.")  Now we have _two_ remaining flags
    left.  But since we want to discourage people from assigning new
    flags, that's OK.
    
    Signed-off-by: Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>

diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 627f58e..35d156f 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -2,8 +2,11 @@
 #define _UAPI_LINUX_FS_H
 
 /*
- * This file has definitions for some important file table
- * structures etc.
+ * This file has definitions for some important file table structures
+ * and constants and structures used by various generic file system
+ * ioctl's.  Please do not make any changes in this file before
+ * sending patches for review to linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org and
+ * linux-api-u79uwXL29TaiAVqoAR/hOA@public.gmane.org
  */
 
 #include <linux/limits.h>
@@ -204,6 +207,23 @@ struct fsxattr {
 
 /*
  * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
+ *
+ * Note: for historical reasons, these flags were originally used and
+ * defined for use by ext2/ext3, and then other file systems started
+ * using these flags so they wouldn't need to write their own version
+ * of chattr/lsattr (which was shipped as part of e2fsprogs).  You
+ * should think twice before trying to use these flags in new
+ * contexts, or trying to assign these flags, since they are used both
+ * as the UAPI and the on-disk encoding for ext2/3/4.  Also, we are
+ * almost out of 32-bit flags.  :-)
+ *
+ * We have recently hoisted FS_IOC_FSGETXATTR / FS_IOC_FSSETXATTR from
+ * XFS to the generic FS level interface.  This uses a structure that
+ * has padding and hence has more room to grow, so it may be more
+ * appropriate for many new use cases.
+ *
+ * Please do not change these flags or interfaces before checking with
+ * linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org and linux-api-u79uwXL29TaiAVqoAR/hOA@public.gmane.org
  */
 #define	FS_SECRM_FL			0x00000001 /* Secure deletion */
 #define	FS_UNRM_FL			0x00000002 /* Undelete */
@@ -217,8 +237,8 @@ struct fsxattr {
 #define FS_DIRTY_FL			0x00000100
 #define FS_COMPRBLK_FL			0x00000200 /* One or more compressed clusters */
 #define FS_NOCOMP_FL			0x00000400 /* Don't compress */
-#define FS_ECOMPR_FL			0x00000800 /* Compression error */
 /* End compression flags --- maybe not all used */
+#define FS_ENCRYPT_FL			0x00000800 /* Encrypted file */
 #define FS_BTREE_FL			0x00001000 /* btree format dir */
 #define FS_INDEX_FL			0x00001000 /* hash-indexed directory */
 #define FS_IMAGIC_FL			0x00002000 /* AFS directory */
@@ -226,9 +246,12 @@ struct fsxattr {
 #define FS_NOTAIL_FL			0x00008000 /* file tail should not be merged */
 #define FS_DIRSYNC_FL			0x00010000 /* dirsync behaviour (directories only) */
 #define FS_TOPDIR_FL			0x00020000 /* Top of directory hierarchies*/
+#define FS_HUGE_FILE_FL			0x00040000 /* Reserved for ext4 */
 #define FS_EXTENT_FL			0x00080000 /* Extents */
-#define FS_DIRECTIO_FL			0x00100000 /* Use direct i/o */
+#define FS_EA_INODE_FL			0x00200000 /* Inode used for large EA */
+#define FS_EOFBLOCKS_FL			0x00400000 /* Reserved for ext4 */
 #define FS_NOCOW_FL			0x00800000 /* Do not cow file */
+#define FS_INLINE_DATA_FL		0x10000000 /* Reserved for ext4 */
 #define FS_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
 #define FS_RESERVED_FL			0x80000000 /* reserved for ext2 lib */
 

  reply	other threads:[~2015-12-28 15:23 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-13 12:20 [v15 0/4] ext4: add project quota support Li Xi
     [not found] ` <1442146833-13652-1-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2015-09-13 12:20   ` [v15 1/4] ext4: adds project ID support Li Xi
     [not found]     ` <1442146833-13652-2-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2015-09-23 12:34       ` Dmitry Monakhov
2015-09-23 18:17         ` Jan Kara
2015-09-13 12:20   ` [v15 2/4] ext4: adds project quota support Li Xi
2015-09-24 17:12   ` [v15 0/4] ext4: add " Andreas Dilger
2015-11-05 14:45     ` Li Xi
2015-11-05 15:13       ` Shuichi Ihara
     [not found]         ` <7360A48E-8576-49DB-878B-DFC2EFC83BC4-LfVdkaOWEx8@public.gmane.org>
2015-11-08 21:28           ` Dave Chinner
2015-11-18 14:14             ` Shuichi Ihara
2015-11-19 21:47               ` Dave Chinner
2015-11-23  1:45                 ` Andreas Dilger
2015-11-23  1:45                   ` Andreas Dilger
2015-11-23  2:50                   ` Dave Chinner
2015-11-23  2:50                     ` Dave Chinner
2015-11-23  9:25                 ` Jan Kara
2015-11-23  9:25                   ` Jan Kara
2015-11-23 20:15                   ` Dave Chinner
2015-11-23 20:15                     ` Dave Chinner
2015-11-24  9:07                     ` Jan Kara
2015-11-24  9:07                       ` Jan Kara
2015-09-13 12:20 ` [v15 3/4] ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support Li Xi
2016-01-03 23:05   ` [PATCH] fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion Dave Chinner
2016-01-04  6:15     ` Theodore Ts'o
2016-01-04  6:15       ` Theodore Ts'o
2016-01-30  0:56     ` Pranith Kumar
2016-01-30  0:56       ` Pranith Kumar
2016-01-30  4:41       ` Theodore Ts'o
2016-01-30  4:41         ` Theodore Ts'o
2016-01-30  4:49         ` Pranith Kumar
2016-01-31 22:36           ` Dave Chinner
2015-09-13 12:20 ` [v15 4/4] ext4: cleanup inode flag definitions Li Xi
2015-12-28 15:23   ` Theodore Ts'o [this message]
2015-12-28 15:23     ` Theodore Ts'o
2015-09-23 12:31 ` [v15 0/4] ext4: add project quota support Jan Kara
     [not found]   ` <20150923123119.GA13946-+0h/O2h83AeN3ZZ/Hiejyg@public.gmane.org>
2015-09-23 13:17     ` Li Xi
     [not found]       ` <CAPTn0cBB7h89R7NB+zg+J+TVvKXut_Usixs==S=AWs-v7kZExg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-23 13:32         ` Dmitry Monakhov
2015-09-23 13:32           ` Dmitry Monakhov
2015-09-23 13:57           ` Li Xi
     [not found]             ` <CAPTn0cC=1xWCcUMVqhAx4pvqqX9rXC8p6B4Jt7cpm4HfuaFOMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-23 13:58               ` Li Xi
2015-09-23 14:13               ` Dmitry Monakhov
2015-09-23 14:13                 ` Dmitry Monakhov
2015-09-24 12:09             ` Jan Kara
2015-10-18  1:01 ` Theodore Ts'o
2015-10-18  2:25   ` Li Xi

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=20151228152334.GA31415@thunk.org \
    --to=tytso@mit.edu \
    --cc=adilger@dilger.ca \
    --cc=dmonakhov@openvz.org \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=pkuelelixi@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.