ext4: add project quota support
Subsystems (4)
v15 cover ext4: add project quota support
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
The semantics of ext4 project quota is consistent with XFS. Each directory can have EXT4_INODE_PROJINHERIT flag set. When the EXT4_INODE_PROJINHERIT flag of a parent directory is not set, a newly created inode under that directory will have a default project ID (i.e. 0). And its EXT4_INODE_PROJINHERIT flag is not set either. When this flag is set on a directory, following rules will be kept:
1) The newly created inode under that directory will inherit both the EXT4_INODE_PROJINHERIT flag and the project ID from its parent directory.
2) Hard-linking a inode with different project ID into that directory will fail with errno EXDEV.
3) Renaming a inode with different project ID into that directory will fail with errno EXDEV. However, 'mv' command will detect this failure and copy the renamed inode to a new inode in the directory. Thus, this new inode will inherit both the project ID and EXT4_INODE_PROJINHERIT flag.
4) If the project quota of that ID is being enforced, statfs() on that directory will take the quotas as another upper limits along with the capacity of the file system, i.e. the total block/inode number will be the minimum of the quota limits and file system capacity.
Changelog:
* v15 <- v14:
- Rebase to newest master branch of git repository (b0a1ea51b).
* v14 <- v13:
- Cleanup ioctl of setting project ID;
- Do not check project quota inode number specially;
- Check isize when extract project ID from disk;
- Rebase to latest kernel (4.0.0)
* v13 <- v12:
- Update inode size check of project ID.
* v12 <- v11:
- Relax the permission check when setting project ID.
* v11 <- v10:
- Remove project quota mount option;
- Fix permission check when setting project ID.
* v10 <- v9:
- Remove non-journaled project quota interface;
- Only allow admin to read project quota info;
- Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
- Remove non-journaled project quota;
- Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
- Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
- Map ext4 inode flags to xflags of struct fsxattr;
- Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
- Add project ID check for cross rename;
- Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
- Check project feature when set/get project ID;
- Do not check project feature for project quota;
- Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
- Do not check project feature when set/get project ID;
- Use EXT4_MAXQUOTAS instead of MAXQUOTAS in ext4 patches;
- Remove unnecessary change of fs/quota/dquot.c;
- Remove CONFIG_QUOTA_PROJECT.
* v3 <- v2:
- Add EXT4_INODE_PROJINHERIT semantics.
* v2 <- v1:
- Add ioctl interface for setting/getting project;
- Add EXT4_FEATURE_RO_COMPAT_PROJECT;
- Add get_projid() method in struct dquot_operations;
- Add error check of ext4_inode_projid_set/get().
v14: http://article.gmane.org/gmane.linux.kernel.api/10345
v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153
Any comments or feedbacks are appreciated.
Regards,
- Li Xi
Li Xi (4):
ext4: adds project ID support
ext4: adds project quota support
ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
ext4: cleanup inode flag definitions
fs/ext4/ext4.h | 85 +++++++---- fs/ext4/ialloc.c | 7 + fs/ext4/inode.c | 28 ++++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/ext4/namei.c | 19 +++ fs/ext4/super.c | 57 +++++++- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 33 +++++ 8 files changed, 490 insertions(+), 153 deletions(-)
A message that is not in the archive (sent off-list or not yet received): 1442146833-13652-1-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org
PATCH v15 1/4 ext4: adds project ID support
This patch adds a new internal field of ext4 inode to save project identifier. Also a new flag EXT4_INODE_PROJINHERIT is added for inheriting project ID from parent directory.
--- fs/ext4/ext4.h | 21 +++++++++++++++++---- fs/ext4/ialloc.c | 7 +++++++ fs/ext4/inode.c | 28 ++++++++++++++++++++++++++++ fs/ext4/namei.c | 19 +++++++++++++++++++ fs/ext4/super.c | 1 + include/uapi/linux/fs.h | 1 + 6 files changed, 73 insertions(+), 4 deletions(-)
fs/ext4/ext4.h +17 -4
@@ -374,16 +374,18 @@ struct flex_groups {#define EXT4_EA_INODE_FL 0x00200000/* Inode used for large EA */ #define EXT4_EOFBLOCKS_FL 0x00400000/* Blocks allocated beyond EOF */ #define EXT4_INLINE_DATA_FL 0x10000000/* Inode has inline data. */ +#define EXT4_PROJINHERIT_FL 0x20000000/* Create with parents projid */ #define EXT4_RESERVED_FL 0x80000000/* reserved for ext4 lib */ -#define EXT4_FL_USER_VISIBLE 0x004BDFFF/* User visible flags */ -#define EXT4_FL_USER_MODIFIABLE 0x004380FF/* User modifiable flags */ +#define EXT4_FL_USER_VISIBLE 0x304BDFFF/* User visible flags */ +#define EXT4_FL_USER_MODIFIABLE 0x204380FF/* User modifiable flags */ /* Flags that should be inherited by new inodes from their parent. */ #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\ - EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL) + EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL |\ + EXT4_PROJINHERIT_FL)/* Flags that are appropriate for regular files (all but dir-specific ones). */ #define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL))
@@ -431,6 +433,7 @@ enum {EXT4_INODE_EA_INODE =21 ,/* Inode used for large EA */ EXT4_INODE_EOFBLOCKS =22 ,/* Blocks allocated beyond EOF */ EXT4_INODE_INLINE_DATA =28 ,/* Data in inode. */ +EXT4_INODE_PROJINHERIT =29 ,/* Create with parents projid */ EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */ };
@@ -692,6 +695,7 @@ struct ext4_inode {__le32 i_crtime;/* File Creation time */ __le32 i_crtime_extra;/* extra FileCreationtime (nsec << 2 | epoch) */ __le32 i_version_hi;/* high 32 bits for 64-bit version */ +__le32 i_projid;/* Project ID */ };struct move_extent {
@@ -952,6 +956,7 @@ struct ext4_inode_info {/* Encryption params */ struct ext4_crypt_info *i_crypt_info;#endif +kprojid_t i_projid; };/*
@@ -1566,6 +1571,7 @@ static inline int ext4_encrypted_inode(struct inode *inode)*/ #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400#define EXT4_FEATURE_RO_COMPAT_READONLY 0x1000 +#define EXT4_FEATURE_RO_COMPAT_PROJECT 0x2000#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
@@ -1617,7 +1623,8 @@ static inline int ext4_encrypted_inode(struct inode *inode)EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\EXT4_FEATURE_RO_COMPAT_BIGALLOC |\EXT4_FEATURE_RO_COMPAT_METADATA_CSUM |\ - EXT4_FEATURE_RO_COMPAT_QUOTA) +EXT4_FEATURE_RO_COMPAT_QUOTA |\ + EXT4_FEATURE_RO_COMPAT_PROJECT)/* * Default values for user and/or group using reserved blocks
@@ -1625,6 +1632,11 @@ static inline int ext4_encrypted_inode(struct inode *inode)#define EXT4_DEF_RESUID 0#define EXT4_DEF_RESGID 0 +/* +* Default project ID +*/ +#define EXT4_DEF_PROJID 0 +#define EXT4_DEF_INODE_READAHEAD_BLKS 32/*
@@ -2317,6 +2329,7 @@ extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, loff_t lstart, loff_t lend);extern int ext4_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf);extern qsize_t *ext4_get_reserved_space (struct inode *inode); +extern int ext4_get_projid (struct inode *inode,kprojid_t *projid);extern void ext4_da_update_reserve_space (struct inode *inode,int used,int quota_claim);
fs/ext4/ialloc.c +7 -0
@@ -769,6 +769,13 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, inode->i_gid = dir->i_gid; }else inode_init_owner (inode, dir, mode); + +if (EXT4_HAS_RO_COMPAT_FEATURE (sb,EXT4_FEATURE_RO_COMPAT_PROJECT ) && +ext4_test_inode_flag (dir,EXT4_INODE_PROJINHERIT )) + ei->i_projid =EXT4_I (dir)->i_projid; +else + ei->i_projid =make_kprojid (&init_user_ns,EXT4_DEF_PROJID ); + err =dquot_initialize (inode);if (err) goto out;
fs/ext4/inode.c +28 -0
@@ -4035,6 +4035,14 @@ static inline void ext4_iget_extra_inode(struct inode *inode,EXT4_I (inode)->i_inline_off =0 ; } +int ext4_get_projid (struct inode *inode,kprojid_t *projid) +{ +if (!EXT4_HAS_RO_COMPAT_FEATURE (inode->i_sb,EXT4_FEATURE_RO_COMPAT_PROJECT )) +return -EOPNOTSUPP ; + *projid =EXT4_I (inode)->i_projid; +return 0 ; +} +struct inode *ext4_iget (struct super_block *sb,unsigned long ino) {struct ext4_iloc iloc;
@@ -4046,6 +4054,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)int block;uid_t i_uid;gid_t i_gid; +projid_t i_projid; inode =iget_locked (sb, ino);if (!inode)
@@ -4095,12 +4104,20 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) inode->i_mode =le16_to_cpu (raw_inode->i_mode); i_uid = (uid_t )le16_to_cpu (raw_inode->i_uid_low); i_gid = (gid_t )le16_to_cpu (raw_inode->i_gid_low); +if (EXT4_HAS_RO_COMPAT_FEATURE (sb,EXT4_FEATURE_RO_COMPAT_PROJECT ) && +EXT4_INODE_SIZE (sb) >EXT4_GOOD_OLD_INODE_SIZE && +EXT4_FITS_IN_INODE (raw_inode, ei, i_projid)) + i_projid = (projid_t )le32_to_cpu (raw_inode->i_projid); +else + i_projid =EXT4_DEF_PROJID ; +if (!(test_opt (inode->i_sb,NO_UID32 ))) { i_uid |=le16_to_cpu (raw_inode->i_uid_high) <<16 ; i_gid |=le16_to_cpu (raw_inode->i_gid_high) <<16 ; }i_uid_write (inode, i_uid);i_gid_write (inode, i_gid); + ei->i_projid =make_kprojid (&init_user_ns, i_projid);set_nlink (inode,le16_to_cpu (raw_inode->i_links_count));ext4_clear_state_flags (ei);/* Only relevant on 32-bit archs */
@@ -4398,6 +4415,7 @@ static int ext4_do_update_inode(handle_t *handle,int need_datasync =0 , set_large_file =0 ;uid_t i_uid;gid_t i_gid; +projid_t i_projid;spin_lock (&ei->i_raw_lock);
@@ -4410,6 +4428,7 @@ static int ext4_do_update_inode(handle_t *handle, raw_inode->i_mode =cpu_to_le16 (inode->i_mode); i_uid =i_uid_read (inode); i_gid =i_gid_read (inode); + i_projid =from_kprojid (&init_user_ns, ei->i_projid);if (!(test_opt (inode->i_sb,NO_UID32 ))) { raw_inode->i_uid_low =cpu_to_le16 (low_16_bits (i_uid)); raw_inode->i_gid_low =cpu_to_le16 (low_16_bits (i_gid));
@@ -4488,6 +4507,15 @@ static int ext4_do_update_inode(handle_t *handle,cpu_to_le16 (ei->i_extra_isize); } } + +BUG_ON (!EXT4_HAS_RO_COMPAT_FEATURE (inode->i_sb, +EXT4_FEATURE_RO_COMPAT_PROJECT ) && + i_projid !=EXT4_DEF_PROJID ); + +if (EXT4_INODE_SIZE (inode->i_sb) >EXT4_GOOD_OLD_INODE_SIZE && +EXT4_FITS_IN_INODE (raw_inode, ei, i_projid)) + raw_inode->i_projid =cpu_to_le32 (i_projid); +ext4_inode_csum_set (inode, raw_inode, ei);spin_unlock (&ei->i_raw_lock);if (inode->i_sb->s_flags &MS_LAZYTIME )
fs/ext4/namei.c +19 -0
@@ -3215,6 +3215,12 @@ static int ext4_link(struct dentry *old_dentry,if (ext4_encrypted_inode (dir) && !ext4_is_child_context_consistent_with_parent (dir, inode))return -EPERM ; + +if ((ext4_test_inode_flag (dir,EXT4_INODE_PROJINHERIT )) && + (!projid_eq (EXT4_I (dir)->i_projid, +EXT4_I (old_dentry->d_inode)->i_projid))) +return -EXDEV ; + err =dquot_initialize (dir);if (err)return err;
@@ -3496,6 +3502,11 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,int credits;u8 old_file_type; +if ((ext4_test_inode_flag (new_dir,EXT4_INODE_PROJINHERIT )) && + (!projid_eq (EXT4_I (new_dir)->i_projid, +EXT4_I (old_dentry->d_inode)->i_projid))) +return -EXDEV ; + retval =dquot_initialize (old.dir);if (retval)return retval;
@@ -3705,6 +3716,14 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, new.inode)))return -EPERM ; +if ((ext4_test_inode_flag (new_dir,EXT4_INODE_PROJINHERIT ) && + !projid_eq (EXT4_I (new_dir)->i_projid, +EXT4_I (old_dentry->d_inode)->i_projid)) || + (ext4_test_inode_flag (old_dir,EXT4_INODE_PROJINHERIT ) && + !projid_eq (EXT4_I (old_dir)->i_projid, +EXT4_I (new_dentry->d_inode)->i_projid))) +return -EXDEV ; + retval =dquot_initialize (old.dir);if (retval)return retval;
fs/ext4/super.c +1 -0
@@ -1097,6 +1097,7 @@ static const struct dquot_operations ext4_quota_operations = { .write_info = ext4_write_info, .alloc_dquot = dquot_alloc, .destroy_dquot = dquot_destroy, + .get_projid = ext4_get_projid, };static const struct quotactl_ops ext4_qctl_operations = {
include/uapi/linux/fs.h +1 -0
@@ -197,6 +197,7 @@ struct inodes_stat_t {#define FS_EXTENT_FL 0x00080000/* Extents */ #define FS_DIRECTIO_FL 0x00100000/* Use direct i/o */ #define FS_NOCOW_FL 0x00800000/* Do not cow file */ +#define FS_PROJINHERIT_FL 0x20000000/* Create with parents projid */ #define FS_RESERVED_FL 0x80000000/* reserved for ext2 lib */ #define FS_FL_USER_VISIBLE 0x0003DFFF/* User visible flags */
Signature · 1 line
1.7.1
A message that is not in the archive (sent off-list or not yet received): 1442146833-13652-2-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org
Re: [v15 1/4] ext4: adds project ID support
Quoted 51 lines · Li Xi
This patch adds a new internal field of ext4 inode to save project identifier. Also a new flag
EXT4_INODE_PROJINHERITis added for inheriting project ID from parent directory.Signed-off-by Li Xi <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Jan Kara <[email protected]>--- fs/ext4/ext4.h | 21 +++++++++++++++++---- fs/ext4/ialloc.c | 7 +++++++ fs/ext4/inode.c | 28 ++++++++++++++++++++++++++++ fs/ext4/namei.c | 19 +++++++++++++++++++ fs/ext4/super.c | 1 + include/uapi/linux/fs.h | 1 + 6 files changed, 73 insertions(+), 4 deletions(-)fs/ext4/ext4.h +6
-3@@ -374,16 +374,18 @@ struct flex_groups {#define EXT4_EA_INODE_FL 0x00200000/* Inode used for large EA */ #define EXT4_EOFBLOCKS_FL 0x00400000/* Blocks allocated beyond EOF */ #define EXT4_INLINE_DATA_FL 0x10000000/* Inode has inline data. */ +#define EXT4_PROJINHERIT_FL 0x20000000/* Create with parents projid */ #define EXT4_RESERVED_FL 0x80000000/* reserved for ext4 lib */ -#define EXT4_FL_USER_VISIBLE 0x004BDFFF/* User visible flags */ -#define EXT4_FL_USER_MODIFIABLE 0x004380FF/* User modifiable flags */ +#define EXT4_FL_USER_VISIBLE 0x304BDFFF/* User visible flags */ +#define EXT4_FL_USER_MODIFIABLE 0x204380FF/* User modifiable flags */ /* Flags that should be inherited by new inodes from their parent. */ #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\ - EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL) + EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL |\ + EXT4_PROJINHERIT_FL)/* Flags that are appropriate for regular files (all but dir-specific ones). */ #define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL))@@ -431,6 +433,7 @@ enum {EXT4_INODE_EA_INODE =21 ,/* Inode used for large EA */ EXT4_INODE_EOFBLOCKS =22 ,/* Blocks allocated beyond EOF */ EXT4_INODE_INLINE_DATA =28 ,/* Data in inode. */ +EXT4_INODE_PROJINHERIT =29 ,/* Create with parents projid */ EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */ };
fs/ext4/ext4.h struct ext4_inode { · line 698
Quoted 4 lines
fs/ext4/ext4.h +1
-0@@ -692,6 +695,7 @@ struct ext4_inode {__le32 i_crtime;/* File Creation time */ __le32 i_crtime_extra;/* extra FileCreationtime (nsec << 2 | epoch) */ __le32 i_version_hi;/* high 32 bits for 64-bit version */ +__le32 i_projid;/* Project ID */
So you are about to extend dist_inode structure(not xattr). I do understand that his is ridiculous question for 15'th version of the patch, but still.
Personally I think that his is good idea, but can not find a
confirmation from Theodore and Jan that they are agree with that.
Guys please ACK that statement explicitly,so later we can refer on this mail as decision made.
Quoted 217 lines
fs/ext4/ext4.h +10
-1};struct move_extent {@@ -952,6 +956,7 @@ struct ext4_inode_info {/* Encryption params */ struct ext4_crypt_info *i_crypt_info;#endif +kprojid_t i_projid; };/* @@ -1566,6 +1571,7 @@ static inline int ext4_encrypted_inode(struct inode *inode)*/ #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400#define EXT4_FEATURE_RO_COMPAT_READONLY 0x1000 +#define EXT4_FEATURE_RO_COMPAT_PROJECT 0x2000#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002@@ -1617,7 +1623,8 @@ static inline int ext4_encrypted_inode(struct inode *inode)EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\EXT4_FEATURE_RO_COMPAT_BIGALLOC |\EXT4_FEATURE_RO_COMPAT_METADATA_CSUM |\ - EXT4_FEATURE_RO_COMPAT_QUOTA) +EXT4_FEATURE_RO_COMPAT_QUOTA |\ + EXT4_FEATURE_RO_COMPAT_PROJECT)/* * Default values for user and/or group using reserved blocks @@ -1625,6 +1632,11 @@ static inline int ext4_encrypted_inode(struct inode *inode)#define EXT4_DEF_RESUID 0#define EXT4_DEF_RESGID 0 +/* +* Default project ID +*/ +#define EXT4_DEF_PROJID 0 +#define EXT4_DEF_INODE_READAHEAD_BLKS 32/* @@ -2317,6 +2329,7 @@ extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, loff_t lstart, loff_t lend);extern int ext4_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf);extern qsize_t *ext4_get_reserved_space (struct inode *inode); +extern int ext4_get_projid (struct inode *inode,kprojid_t *projid);extern void ext4_da_update_reserve_space (struct inode *inode,int used,int quota_claim);fs/ext4/ialloc.c +7
-0@@ -769,6 +769,13 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, inode->i_gid = dir->i_gid; }else inode_init_owner (inode, dir, mode); + +if (EXT4_HAS_RO_COMPAT_FEATURE (sb,EXT4_FEATURE_RO_COMPAT_PROJECT ) && +ext4_test_inode_flag (dir,EXT4_INODE_PROJINHERIT )) + ei->i_projid =EXT4_I (dir)->i_projid; +else + ei->i_projid =make_kprojid (&init_user_ns,EXT4_DEF_PROJID ); + err =dquot_initialize (inode);if (err) goto out;fs/ext4/inode.c +28
-0@@ -4035,6 +4035,14 @@ static inline void ext4_iget_extra_inode(struct inode *inode,EXT4_I (inode)->i_inline_off =0 ; } +int ext4_get_projid (struct inode *inode,kprojid_t *projid) +{ +if (!EXT4_HAS_RO_COMPAT_FEATURE (inode->i_sb,EXT4_FEATURE_RO_COMPAT_PROJECT )) +return -EOPNOTSUPP ; + *projid =EXT4_I (inode)->i_projid; +return 0 ; +} +struct inode *ext4_iget (struct super_block *sb,unsigned long ino) {struct ext4_iloc iloc;@@ -4046,6 +4054,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)int block;uid_t i_uid;gid_t i_gid; +projid_t i_projid; inode =iget_locked (sb, ino);if (!inode)@@ -4095,12 +4104,20 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) inode->i_mode =le16_to_cpu (raw_inode->i_mode); i_uid = (uid_t )le16_to_cpu (raw_inode->i_uid_low); i_gid = (gid_t )le16_to_cpu (raw_inode->i_gid_low); +if (EXT4_HAS_RO_COMPAT_FEATURE (sb,EXT4_FEATURE_RO_COMPAT_PROJECT ) && +EXT4_INODE_SIZE (sb) >EXT4_GOOD_OLD_INODE_SIZE && +EXT4_FITS_IN_INODE (raw_inode, ei, i_projid)) + i_projid = (projid_t )le32_to_cpu (raw_inode->i_projid); +else + i_projid =EXT4_DEF_PROJID ; +if (!(test_opt (inode->i_sb,NO_UID32 ))) { i_uid |=le16_to_cpu (raw_inode->i_uid_high) <<16 ; i_gid |=le16_to_cpu (raw_inode->i_gid_high) <<16 ; }i_uid_write (inode, i_uid);i_gid_write (inode, i_gid); + ei->i_projid =make_kprojid (&init_user_ns, i_projid);set_nlink (inode,le16_to_cpu (raw_inode->i_links_count));ext4_clear_state_flags (ei);/* Only relevant on 32-bit archs */ @@ -4398,6 +4415,7 @@ static int ext4_do_update_inode(handle_t *handle,int need_datasync =0 , set_large_file =0 ;uid_t i_uid;gid_t i_gid; +projid_t i_projid;spin_lock (&ei->i_raw_lock);@@ -4410,6 +4428,7 @@ static int ext4_do_update_inode(handle_t *handle, raw_inode->i_mode =cpu_to_le16 (inode->i_mode); i_uid =i_uid_read (inode); i_gid =i_gid_read (inode); + i_projid =from_kprojid (&init_user_ns, ei->i_projid);if (!(test_opt (inode->i_sb,NO_UID32 ))) { raw_inode->i_uid_low =cpu_to_le16 (low_16_bits (i_uid)); raw_inode->i_gid_low =cpu_to_le16 (low_16_bits (i_gid));@@ -4488,6 +4507,15 @@ static int ext4_do_update_inode(handle_t *handle,cpu_to_le16 (ei->i_extra_isize); } } + +BUG_ON (!EXT4_HAS_RO_COMPAT_FEATURE (inode->i_sb, +EXT4_FEATURE_RO_COMPAT_PROJECT ) && + i_projid !=EXT4_DEF_PROJID ); + +if (EXT4_INODE_SIZE (inode->i_sb) >EXT4_GOOD_OLD_INODE_SIZE && +EXT4_FITS_IN_INODE (raw_inode, ei, i_projid)) + raw_inode->i_projid =cpu_to_le32 (i_projid); +ext4_inode_csum_set (inode, raw_inode, ei);spin_unlock (&ei->i_raw_lock);if (inode->i_sb->s_flags &MS_LAZYTIME )fs/ext4/namei.c +19
-0@@ -3215,6 +3215,12 @@ static int ext4_link(struct dentry *old_dentry,if (ext4_encrypted_inode (dir) && !ext4_is_child_context_consistent_with_parent (dir, inode))return -EPERM ; + +if ((ext4_test_inode_flag (dir,EXT4_INODE_PROJINHERIT )) && + (!projid_eq (EXT4_I (dir)->i_projid, +EXT4_I (old_dentry->d_inode)->i_projid))) +return -EXDEV ; + err =dquot_initialize (dir);if (err)return err;@@ -3496,6 +3502,11 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,int credits;u8 old_file_type; +if ((ext4_test_inode_flag (new_dir,EXT4_INODE_PROJINHERIT )) && + (!projid_eq (EXT4_I (new_dir)->i_projid, +EXT4_I (old_dentry->d_inode)->i_projid))) +return -EXDEV ; + retval =dquot_initialize (old.dir);if (retval)return retval;@@ -3705,6 +3716,14 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, new.inode)))return -EPERM ; +if ((ext4_test_inode_flag (new_dir,EXT4_INODE_PROJINHERIT ) && + !projid_eq (EXT4_I (new_dir)->i_projid, +EXT4_I (old_dentry->d_inode)->i_projid)) || + (ext4_test_inode_flag (old_dir,EXT4_INODE_PROJINHERIT ) && + !projid_eq (EXT4_I (old_dir)->i_projid, +EXT4_I (new_dentry->d_inode)->i_projid))) +return -EXDEV ; + retval =dquot_initialize (old.dir);if (retval)return retval;fs/ext4/super.c +1
-0@@ -1097,6 +1097,7 @@ static const struct dquot_operations ext4_quota_operations = { .write_info = ext4_write_info, .alloc_dquot = dquot_alloc, .destroy_dquot = dquot_destroy, + .get_projid = ext4_get_projid, };static const struct quotactl_ops ext4_qctl_operations = {include/uapi/linux/fs.h +1
-0@@ -197,6 +197,7 @@ struct inodes_stat_t {#define FS_EXTENT_FL 0x00080000/* Extents */ #define FS_DIRECTIO_FL 0x00100000/* Use direct i/o */ #define FS_NOCOW_FL 0x00800000/* Do not cow file */ +#define FS_PROJINHERIT_FL 0x20000000/* Create with parents projid */ #define FS_RESERVED_FL 0x80000000/* reserved for ext2 lib */ #define FS_FL_USER_VISIBLE 0x0003DFFF/* User visible flags */ Signature · 1 line
1.7.1
Jan Kara
reviewerRe: [v15 1/4] ext4: adds project ID support
Quoted 10 lines · Dmitry Monakhov
fs/ext4/ext4.h struct ext4_inode { · line 698
Quoted 5 lines
fs/ext4/ext4.h +1
-0@@ -692,6 +695,7 @@ struct ext4_inode {__le32 i_crtime;/* File Creation time */ __le32 i_crtime_extra;/* extra FileCreationtime (nsec << 2 | epoch) */ __le32 i_version_hi;/* high 32 bits for 64-bit version */ +__le32 i_projid;/* Project ID */ So you are about to extend
dist_inodestructure(not xattr). I do understand that his is ridiculous question for 15'th version of the patch, but still.
Personally I think that his is good idea, but can not find a
confirmation from Theodore and Jan that they are agree with that.
Guys please ACK that statement explicitly,so later we can refer on this mail as decision made.
Yes, I agree with this.
Honza
Quoted 217 lines
Quoted 217 lines
fs/ext4/ext4.h +10
-1};struct move_extent {@@ -952,6 +956,7 @@ struct ext4_inode_info {/* Encryption params */ struct ext4_crypt_info *i_crypt_info;#endif +kprojid_t i_projid; };/* @@ -1566,6 +1571,7 @@ static inline int ext4_encrypted_inode(struct inode *inode)*/ #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400#define EXT4_FEATURE_RO_COMPAT_READONLY 0x1000 +#define EXT4_FEATURE_RO_COMPAT_PROJECT 0x2000#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002@@ -1617,7 +1623,8 @@ static inline int ext4_encrypted_inode(struct inode *inode)EXT4_FEATURE_RO_COMPAT_HUGE_FILE |\EXT4_FEATURE_RO_COMPAT_BIGALLOC |\EXT4_FEATURE_RO_COMPAT_METADATA_CSUM |\ - EXT4_FEATURE_RO_COMPAT_QUOTA) +EXT4_FEATURE_RO_COMPAT_QUOTA |\ + EXT4_FEATURE_RO_COMPAT_PROJECT)/* * Default values for user and/or group using reserved blocks @@ -1625,6 +1632,11 @@ static inline int ext4_encrypted_inode(struct inode *inode)#define EXT4_DEF_RESUID 0#define EXT4_DEF_RESGID 0 +/* +* Default project ID +*/ +#define EXT4_DEF_PROJID 0 +#define EXT4_DEF_INODE_READAHEAD_BLKS 32/* @@ -2317,6 +2329,7 @@ extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, loff_t lstart, loff_t lend);extern int ext4_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf);extern qsize_t *ext4_get_reserved_space (struct inode *inode); +extern int ext4_get_projid (struct inode *inode,kprojid_t *projid);extern void ext4_da_update_reserve_space (struct inode *inode,int used,int quota_claim);fs/ext4/ialloc.c +7
-0@@ -769,6 +769,13 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, inode->i_gid = dir->i_gid; }else inode_init_owner (inode, dir, mode); + +if (EXT4_HAS_RO_COMPAT_FEATURE (sb,EXT4_FEATURE_RO_COMPAT_PROJECT ) && +ext4_test_inode_flag (dir,EXT4_INODE_PROJINHERIT )) + ei->i_projid =EXT4_I (dir)->i_projid; +else + ei->i_projid =make_kprojid (&init_user_ns,EXT4_DEF_PROJID ); + err =dquot_initialize (inode);if (err) goto out;fs/ext4/inode.c +28
-0@@ -4035,6 +4035,14 @@ static inline void ext4_iget_extra_inode(struct inode *inode,EXT4_I (inode)->i_inline_off =0 ; } +int ext4_get_projid (struct inode *inode,kprojid_t *projid) +{ +if (!EXT4_HAS_RO_COMPAT_FEATURE (inode->i_sb,EXT4_FEATURE_RO_COMPAT_PROJECT )) +return -EOPNOTSUPP ; + *projid =EXT4_I (inode)->i_projid; +return 0 ; +} +struct inode *ext4_iget (struct super_block *sb,unsigned long ino) {struct ext4_iloc iloc;@@ -4046,6 +4054,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)int block;uid_t i_uid;gid_t i_gid; +projid_t i_projid; inode =iget_locked (sb, ino);if (!inode)@@ -4095,12 +4104,20 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) inode->i_mode =le16_to_cpu (raw_inode->i_mode); i_uid = (uid_t )le16_to_cpu (raw_inode->i_uid_low); i_gid = (gid_t )le16_to_cpu (raw_inode->i_gid_low); +if (EXT4_HAS_RO_COMPAT_FEATURE (sb,EXT4_FEATURE_RO_COMPAT_PROJECT ) && +EXT4_INODE_SIZE (sb) >EXT4_GOOD_OLD_INODE_SIZE && +EXT4_FITS_IN_INODE (raw_inode, ei, i_projid)) + i_projid = (projid_t )le32_to_cpu (raw_inode->i_projid); +else + i_projid =EXT4_DEF_PROJID ; +if (!(test_opt (inode->i_sb,NO_UID32 ))) { i_uid |=le16_to_cpu (raw_inode->i_uid_high) <<16 ; i_gid |=le16_to_cpu (raw_inode->i_gid_high) <<16 ; }i_uid_write (inode, i_uid);i_gid_write (inode, i_gid); + ei->i_projid =make_kprojid (&init_user_ns, i_projid);set_nlink (inode,le16_to_cpu (raw_inode->i_links_count));ext4_clear_state_flags (ei);/* Only relevant on 32-bit archs */ @@ -4398,6 +4415,7 @@ static int ext4_do_update_inode(handle_t *handle,int need_datasync =0 , set_large_file =0 ;uid_t i_uid;gid_t i_gid; +projid_t i_projid;spin_lock (&ei->i_raw_lock);@@ -4410,6 +4428,7 @@ static int ext4_do_update_inode(handle_t *handle, raw_inode->i_mode =cpu_to_le16 (inode->i_mode); i_uid =i_uid_read (inode); i_gid =i_gid_read (inode); + i_projid =from_kprojid (&init_user_ns, ei->i_projid);if (!(test_opt (inode->i_sb,NO_UID32 ))) { raw_inode->i_uid_low =cpu_to_le16 (low_16_bits (i_uid)); raw_inode->i_gid_low =cpu_to_le16 (low_16_bits (i_gid));@@ -4488,6 +4507,15 @@ static int ext4_do_update_inode(handle_t *handle,cpu_to_le16 (ei->i_extra_isize); } } + +BUG_ON (!EXT4_HAS_RO_COMPAT_FEATURE (inode->i_sb, +EXT4_FEATURE_RO_COMPAT_PROJECT ) && + i_projid !=EXT4_DEF_PROJID ); + +if (EXT4_INODE_SIZE (inode->i_sb) >EXT4_GOOD_OLD_INODE_SIZE && +EXT4_FITS_IN_INODE (raw_inode, ei, i_projid)) + raw_inode->i_projid =cpu_to_le32 (i_projid); +ext4_inode_csum_set (inode, raw_inode, ei);spin_unlock (&ei->i_raw_lock);if (inode->i_sb->s_flags &MS_LAZYTIME )fs/ext4/namei.c +19
-0@@ -3215,6 +3215,12 @@ static int ext4_link(struct dentry *old_dentry,if (ext4_encrypted_inode (dir) && !ext4_is_child_context_consistent_with_parent (dir, inode))return -EPERM ; + +if ((ext4_test_inode_flag (dir,EXT4_INODE_PROJINHERIT )) && + (!projid_eq (EXT4_I (dir)->i_projid, +EXT4_I (old_dentry->d_inode)->i_projid))) +return -EXDEV ; + err =dquot_initialize (dir);if (err)return err;@@ -3496,6 +3502,11 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,int credits;u8 old_file_type; +if ((ext4_test_inode_flag (new_dir,EXT4_INODE_PROJINHERIT )) && + (!projid_eq (EXT4_I (new_dir)->i_projid, +EXT4_I (old_dentry->d_inode)->i_projid))) +return -EXDEV ; + retval =dquot_initialize (old.dir);if (retval)return retval;@@ -3705,6 +3716,14 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, new.inode)))return -EPERM ; +if ((ext4_test_inode_flag (new_dir,EXT4_INODE_PROJINHERIT ) && + !projid_eq (EXT4_I (new_dir)->i_projid, +EXT4_I (old_dentry->d_inode)->i_projid)) || + (ext4_test_inode_flag (old_dir,EXT4_INODE_PROJINHERIT ) && + !projid_eq (EXT4_I (old_dir)->i_projid, +EXT4_I (new_dentry->d_inode)->i_projid))) +return -EXDEV ; + retval =dquot_initialize (old.dir);if (retval)return retval;fs/ext4/super.c +1
-0@@ -1097,6 +1097,7 @@ static const struct dquot_operations ext4_quota_operations = { .write_info = ext4_write_info, .alloc_dquot = dquot_alloc, .destroy_dquot = dquot_destroy, + .get_projid = ext4_get_projid, };static const struct quotactl_ops ext4_qctl_operations = {include/uapi/linux/fs.h +1
-0@@ -197,6 +197,7 @@ struct inodes_stat_t {#define FS_EXTENT_FL 0x00080000/* Extents */ #define FS_DIRECTIO_FL 0x00100000/* Use direct i/o */ #define FS_NOCOW_FL 0x00800000/* Do not cow file */ +#define FS_PROJINHERIT_FL 0x20000000/* Create with parents projid */ #define FS_RESERVED_FL 0x80000000/* reserved for ext2 lib */ #define FS_FL_USER_VISIBLE 0x0003DFFF/* User visible flags */ Signature · 1 line
1.7.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH v15 2/4 ext4: adds project quota support
In reply to a message not in the archiveThis patch adds mount options for enabling/disabling project quota accounting and enforcement. A new specific inode is also used for project quota accounting.
--- fs/ext4/ext4.h | 5 ++- fs/ext4/super.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 7 deletions(-)
fs/ext4/ext4.h +3 -2
@@ -1184,7 +1184,8 @@ struct ext4_super_block {__u8 s_encrypt_algos[4 ];/* Encryption algorithms in use */ __u8 s_encrypt_pw_salt[16 ];/* Salt used for string2key algorithm */ __le32 s_lpf_ino;/* Location of the lost+found inode */ -__le32 s_reserved[100 ];/* Padding to the end of the block */ +__le32 s_prj_quota_inum;/* inode for tracking project quota */ +__le32 s_reserved[99 ];/* Padding to the end of the block */ __le32 s_checksum;/* crc32c(superblock) */ };
@@ -1207,7 +1208,7 @@ struct ext4_super_block {#endif /* Number of quota types we support */ -#define EXT4_MAXQUOTAS 2 +#define EXT4_MAXQUOTAS 3/* * fourth extended-fs super-block data in memory
fs/ext4/super.c +51 -5
98 lines not on this page · raw message
Signature · 1 line
1.7.1
Quoted 8 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
We discussed this on the ext4 developer concall today and tried to move the landing of these patches forward. Some notes below:
- Ted: agreed to reserve EXT4_FEATURE_RO_COMPAT_PROJECT, s_prj_quota_inum, EXT4_PROJINHERIT_FL, and i_projid fields for use by project quota to avoid compatibility issues if patches are not landed immediately.
- Ted: to do final check of inode flag value
- ext4 project quota inode does not need to use a reserved inode, but could after Jan's patch to increase reserved inodes lands
- Li Xi: identify xfstests subtests that are exercising project quota
- submit patches to xfstests that will activate them for ext4
- keep in ext4 xfstests for testing until patches land upstream
- this needs to be done before landing to ensure ext4 code works
- Li Xi: document the behaviour of project quota (if no existing document exists for XFS already), some of this is already below
- update man pages for df(1) and statfs(2) for subdir with project ID (i.e. that it returns only quota usage and limit for project ID)
- Ted: where should document go? linux/Documentation/fs? ext4 wiki?
- not a requirement for testing, can be done after landing
- All: decide on a common tool for setting project ID on file/directory
- don't want to require xfsutils in order to use project quota
- start with chattr (using FS_IOC_FS{GET,SET}XATTR) in e2fsprogs
- allows testing project quota with e2fsprogs/ext4
- chproj (like chown/chgrp) would also be an option
- needs more discussion/development effort, goes into fileutils
- this doesn't need to be decided immediately, and both could be done
Ted, please add in anything that I forgot.
Cheers, Andreas
Quoted 99 lines
The semantics of ext4 project quota is consistent with XFS. Each directory can have
EXT4_INODE_PROJINHERITflag set. When theEXT4_INODE_PROJINHERITflag of a parent directory is not set, a newly created inode under that directory will have a default project ID (i.e. 0). And itsEXT4_INODE_PROJINHERITflag is not set either. When this flag is set on a directory, following rules will be kept:1) The newly created inode under that directory will inherit both the
EXT4_INODE_PROJINHERITflag and the project ID from its parent directory.2) Hard-linking a inode with different project ID into that directory will fail with errno EXDEV.
3) Renaming a inode with different project ID into that directory will fail with errno EXDEV. However, 'mv' command will detect this failure and copy the renamed inode to a new inode in the directory. Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERITflag.4) If the project quota of that ID is being enforced,
statfs()on that directory will take the quotas as another upper limits along with the capacity of the file system, i.e. the total block/inode number will be the minimum of the quota limits and file system capacity.Changelog:
* v15 <- v14:
- Rebase to newest master branch of git repository (b0a1ea51b).
* v14 <- v13:
- Cleanup ioctl of setting project ID;
- Do not check project quota inode number specially;
- Check isize when extract project ID from disk;
- Rebase to latest kernel (4.0.0)
* v13 <- v12:
- Update inode size check of project ID.
* v12 <- v11:
- Relax the permission check when setting project ID.
* v11 <- v10:
- Remove project quota mount option;
- Fix permission check when setting project ID.
* v10 <- v9:
- Remove non-journaled project quota interface;
- Only allow admin to read project quota info;
- Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
- Remove non-journaled project quota;
- Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
- Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
- Map ext4 inode flags to xflags of struct fsxattr;
- Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
- Add project ID check for cross rename;
- Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
- Check project feature when set/get project ID;
- Do not check project feature for project quota;
- Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
- Do not check project feature when set/get project ID;
- UseEXT4_MAXQUOTASinstead of MAXQUOTAS in ext4 patches;
- Remove unnecessary change offs/quota/dquot.c;
- RemoveCONFIG_QUOTA_PROJECT.
* v3 <- v2:
- AddEXT4_INODE_PROJINHERITsemantics.
* v2 <- v1:
- Add ioctl interface for setting/getting project;
- AddEXT4_FEATURE_RO_COMPAT_PROJECT;
- Addget_projid()method in structdquot_operations;
- Add error check of ext4_inode_projid_set/get().v14: http://article.gmane.org/gmane.linux.kernel.api/10345
v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153Any comments or feedbacks are appreciated.
Regards,
- Li XiLi Xi (4):
ext4: adds project ID support
ext4: adds project quota support
ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
ext4: cleanup inode flag definitions
Quoted 10 lines
fs/ext4/ext4.h | 85 +++++++---- fs/ext4/ialloc.c | 7 + fs/ext4/inode.c | 28 ++++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/ext4/namei.c | 19 +++ fs/ext4/super.c | 57 +++++++- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 33 +++++ 8 files changed, 490 insertions(+), 153 deletions(-)
Cheers, Andreas
Quoted 30 lines · Andreas Dilger
Quoted 8 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
We discussed this on the ext4 developer concall today and tried to move the landing of these patches forward. Some notes below:
- Ted: agreed to reserve
EXT4_FEATURE_RO_COMPAT_PROJECT,s_prj_quota_inum,EXT4_PROJINHERIT_FL, andi_projidfields for use by project quota to avoid compatibility issues if patches are not landed immediately.
- Ted: to do final check of inode flag value
- ext4 project quota inode does not need to use a reserved inode, but could after Jan's patch to increase reserved inodes lands
- Li Xi: identify xfstests subtests that are exercising project quota
- submit patches to xfstests that will activate them for ext4
- keep in ext4 xfstests for testing until patches land upstream
- this needs to be done before landing to ensure ext4 code works
- Li Xi: document the behaviour of project quota (if no existing document exists for XFS already), some of this is already below
- update man pages for df(1) and statfs(2) for subdir with project ID (i.e. that it returns only quota usage and limit for project ID)
- Ted: where should document go? linux/Documentation/fs? ext4 wiki?
- not a requirement for testing, can be done after landing
Quoted 8 lines
- All: decide on a common tool for setting project ID on file/directory
- don't want to require xfsutils in order to use project quota
- start with chattr (using FS_IOC_FS{GET,SET}XATTR) in e2fsprogs
- allows testing project quota with e2fsprogs/ext4
- chproj (like chown/chgrp) would also be an option
- needs more discussion/development effort, goes into fileutils
- this doesn't need to be decided immediately, and both could be done
Hi,
I've pushed the patch of Ext4 as well as e2fsprogs. Shilong has added test suits for ext4 project quota in xfstest, and will push patches soon. I will write
necessary documentation both for manual and linux/Documentation/fs.
Hopefully, at least the kernel patches of ext4 project quota will be merged soon.
Regards,
Li Xi
Hello Ted, Andreas,
Shilong posted an email here a week ago below.
http://lists.openwall.net/linux-ext4/2015/10/30/2
we identified 10 project quota related xfstest and ported them into ext4/xxx. test number are 304, 305, 299, 244, 196, 134, 108, 107, 106, 050 in xfs.
We ported 9/10 tests into ext4/xxx
ext4/050 ext4/106 ext4/107 ext4/108 ext4/196 ext4/244 ext4/299 ext4/400 ext4/401
please check https://github.com/wangshilong/xfstests
An another patch was not valid since quota utility is different.
In order to run ported tests, patched quota-tools and Li Xi ported patch of e2fsprogs required.
https://github.com/wangshilong/quota-tools/commits/project
http://lists.openwall.net/linux-ext4/2015/10/29/2
Thanks
Ihara
Quoted 55 lines · 11/5/15, 11:45 PM , "[email protected] (Li Xi の代理)"…
Quoted 30 lines · Andreas Dilger
Quoted 8 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
We discussed this on the ext4 developer concall today and tried to move the landing of these patches forward. Some notes below:
- Ted: agreed to reserve
EXT4_FEATURE_RO_COMPAT_PROJECT,s_prj_quota_inum,EXT4_PROJINHERIT_FL, andi_projidfields for use by project quota to avoid compatibility issues if patches are not landed immediately.
- Ted: to do final check of inode flag value
- ext4 project quota inode does not need to use a reserved inode, but could after Jan's patch to increase reserved inodes lands
- Li Xi: identify xfstests subtests that are exercising project quota
- submit patches to xfstests that will activate them for ext4
- keep in ext4 xfstests for testing until patches land upstream
- this needs to be done before landing to ensure ext4 code works
- Li Xi: document the behaviour of project quota (if no existing document exists for XFS already), some of this is already below
- update man pages for df(1) and statfs(2) for subdir with project ID (i.e. that it returns only quota usage and limit for project ID)
- Ted: where should document go? linux/Documentation/fs? ext4 wiki?
- not a requirement for testing, can be done after landingQuoted 8 lines
- All: decide on a common tool for setting project ID on file/directory
- don't want to require xfsutils in order to use project quota
- start with chattr (using FS_IOC_FS{GET,SET}XATTR) in e2fsprogs
- allows testing project quota with e2fsprogs/ext4
- chproj (like chown/chgrp) would also be an option
- needs more discussion/development effort, goes into fileutils
- this doesn't need to be decided immediately, and both could be doneHi,
I've pushed the patch of Ext4 as well as e2fsprogs. Shilong has added test suits for ext4 project quota in xfstest, and will push patches soon. I will write
necessary documentation both for manual and linux/Documentation/fs.Hopefully, at least the kernel patches of ext4 project quota will be merged soon.
Regards,
Li Xi
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 7360A48E-8576-49DB-878B-DFC2EFC83BC4-LfVdkaOWEx8@public.gmane.org
Quoted 11 lines · Shuichi Ihara
Hello Ted, Andreas,
Shilong posted an email here a week ago below.
http://lists.openwall.net/linux-ext4/2015/10/30/2we identified 10 project quota related xfstest and ported them into ext4/xxx. test number are 304, 305, 299, 244, 196, 134, 108, 107, 106, 050 in xfs.
We ported 9/10 tests into ext4/xxx
ext4/050 ext4/106 ext4/107 ext4/108 ext4/196 ext4/244 ext4/299 ext4/400 ext4/401
Please make them generic tests - the ext4 project quota functioanlity should work with those tests being completely unchanged except for a "_requires_project_quota()" function...
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 10 lines · Dave Chinner
Quoted 9 lines · Shuichi Ihara
Hello Ted, Andreas,
Shilong posted an email here a week ago below.
http://lists.openwall.net/linux-ext4/2015/10/30/2we identified 10 project quota related xfstest and ported them into ext4/xxx. test number are 304, 305, 299, 244, 196, 134, 108, 107, 106, 050 in xfs.
Quoted 6 lines
Quoted 2 lines
We ported 9/10 tests into ext4/xxx
ext4/050 ext4/106 ext4/107 ext4/108 ext4/196 ext4/244 ext4/299 ext4/400 ext4/401Please make them generic tests - the ext4 project quota functioanlity should work with those tests being completely unchanged except for a "
_requires_project_quota()" function...
Right now, we enhanced quotatool to support project quota and above project quota tests in ext4 uses that interface. xfs uses own interface xfs_xx for project quota tests in xfs.
what interface are you looking at if we move ext4's project quota tests into generic tests?
Thanks
Ihara
Quoted 16 lines · Shuichi Ihara
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Shuichi Ihara
Hello Ted, Andreas,
Shilong posted an email here a week ago below.
http://lists.openwall.net/linux-ext4/2015/10/30/2we identified 10 project quota related xfstest and ported them into ext4/xxx. test number are 304, 305, 299, 244, 196, 134, 108, 107, 106, 050 in xfs.
We ported 9/10 tests into ext4/xxx
ext4/050 ext4/106 ext4/107 ext4/108 ext4/196 ext4/244 ext4/299 ext4/400 ext4/401
Quoted 7 lines
Quoted 3 lines
Please make them generic tests - the ext4 project quota functioanlity should work with those tests being completely unchanged except for a "
_requires_project_quota()" function...Right now, we enhanced quotatool to support project quota and above project quota tests in ext4 uses that interface. xfs uses own interface
xfs_xxfor project quota tests in xfs.
what interface are you looking at if we move ext4's project quota tests into generic tests?
The project quota support in the generic quota tool should work XFS as well as ext4. If it doesn't, then it's not a generic tool, right? The whole point of having ext4 use the same userspace API as XFS is so that all quotas can be managed with the one tool. Essentially, if ext4 project quotas cannot be controlled by xfs_quota, then the ext4 code is not compatible with XFS and hence still needs work.
FWIW, if ext4 has implemented the kernel project quota interfaces correctly, then it should not matter whether we use xfs_quota or the generic quotatool because the kernel will translate the filesystem information to whatever format the quota was requested in...
So, you should be able to simply use the xfs_quota tool in the tests you make generic without needing any significant modification to the tests to run them on ext4. Yes, that may mean you need to send a 5 line patch to make xfs_quota run on ext4, but that's trivial compared to duplicating >10 tests and then having to maintain them forever...
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 38 lines · Dave Chinner
Quoted 16 lines · Shuichi Ihara
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Shuichi Ihara
Hello Ted, Andreas,
Shilong posted an email here a week ago below.
http://lists.openwall.net/linux-ext4/2015/10/30/2we identified 10 project quota related xfstest and ported them into ext4/xxx. test number are 304, 305, 299, 244, 196, 134, 108, 107, 106, 050 in xfs.
We ported 9/10 tests into ext4/xxx
ext4/050 ext4/106 ext4/107 ext4/108 ext4/196 ext4/244 ext4/299 ext4/400 ext4/401Quoted 7 lines
Quoted 3 lines
Please make them generic tests - the ext4 project quota functioanlity should work with those tests being completely unchanged except for a "
_requires_project_quota()" function...Right now, we enhanced quotatool to support project quota and above project quota tests in ext4 uses that interface. xfs uses own interface
xfs_xxfor project quota tests in xfs.
what interface are you looking at if we move ext4's project quota tests into generic tests?The project quota support in the generic quota tool should work XFS as well as ext4. If it doesn't, then it's not a generic tool, right? The whole point of having ext4 use the same userspace API as XFS is so that all quotas can be managed with the one tool. Essentially, if ext4 project quotas cannot be controlled by
xfs_quota, then the ext4 code is not compatible with XFS and hence still needs work.FWIW, if ext4 has implemented the kernel project quota interfaces correctly, then it should not matter whether we use
xfs_quotaor the generic quotatool because the kernel will translate the filesystem information to whatever format the quota was requested in...
Quoted 6 lines
So, you should be able to simply use the
xfs_quotatool in the tests you make generic without needing any significant modification to the tests to run them on ext4. Yes, that may mean you need to send a 5 line patch to makexfs_quotarun on ext4, but that's trivial compared to duplicating >10 tests and then having to maintain them forever...
I think it also makes sense to have tests for the generic quota tools, which is what current ext4 users will have installed, and not just xfs_quota. This applies to both ext4 and xfs using the generic quota tools with the new interface. In that light, it makes sense to add new tests that use the new quota tools, in addition to testing xfs_quota on XFS and ext4.
Cheers, Andreas
Quoted 46 lines · Andreas Dilger
Quoted 38 lines · Dave Chinner
Quoted 16 lines · Shuichi Ihara
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Shuichi Ihara
Hello Ted, Andreas,
Shilong posted an email here a week ago below.
http://lists.openwall.net/linux-ext4/2015/10/30/2we identified 10 project quota related xfstest and ported them into ext4/xxx. test number are 304, 305, 299, 244, 196, 134, 108, 107, 106, 050 in xfs.
We ported 9/10 tests into ext4/xxx
ext4/050 ext4/106 ext4/107 ext4/108 ext4/196 ext4/244 ext4/299 ext4/400 ext4/401Quoted 7 lines
Quoted 3 lines
Please make them generic tests - the ext4 project quota functioanlity should work with those tests being completely unchanged except for a "
_requires_project_quota()" function...Right now, we enhanced quotatool to support project quota and above project quota tests in ext4 uses that interface. xfs uses own interface
xfs_xxfor project quota tests in xfs.
what interface are you looking at if we move ext4's project quota tests into generic tests?The project quota support in the generic quota tool should work XFS as well as ext4. If it doesn't, then it's not a generic tool, right? The whole point of having ext4 use the same userspace API as XFS is so that all quotas can be managed with the one tool. Essentially, if ext4 project quotas cannot be controlled by
xfs_quota, then the ext4 code is not compatible with XFS and hence still needs work.FWIW, if ext4 has implemented the kernel project quota interfaces correctly, then it should not matter whether we use
xfs_quotaor the generic quotatool because the kernel will translate the filesystem information to whatever format the quota was requested in...Quoted 6 lines
So, you should be able to simply use the
xfs_quotatool in the tests you make generic without needing any significant modification to the tests to run them on ext4. Yes, that may mean you need to send a 5 line patch to makexfs_quotarun on ext4, but that's trivial compared to duplicating >10 tests and then having to maintain them forever...
Quoted 4 lines
I think it also makes sense to have tests for the generic quota tools, which is what current ext4 users will have installed, and not just
xfs_quota. This applies to both ext4 and xfs using the generic quota tools with the new interface.
Yes, I said as much: "... it should not matter whether we use xfs_quota or the generic quotatool ....". I've been saying that tool compability is an absolute requirement for the ext4 project quota implementation from the very start - I'm not about to say it doesn't matter now.
Yes, eventually we need to have tests for the generic quotatool, but only having generic quotatool tests run only on ext4 does not prove anything about the compatibility of the new ext4 kernel code with the pre-existing quota tools and kernel APIs.
Quoted 3 lines
In that light, it makes sense to add
new tests that use the new quota tools, in addition to testingxfs_quotaon XFS and ext4.
The first step is not "duplicate all the tests with different infrastructure as new one-filesystem-only specific tests". We need to ensure the APIs are compatible *before merging the kernel code*, and these tests do no do that.
IOWs, like all the other tests we've made generic for kernel functionality we've moved from XFS to generic code, the steps are:
1. move the tests from tests/xfs to tests/generic
2. make the xfs specific utilities work on non XFS filesystems and, if necessary, use the new generic kernel API.
3. make the tests also run and passwork on non-XFS filesystems
[ at this point we can say the new ext4 kernel code is good to
commit ]
4. factor the generic tests so that the test core is independent of the infrastructure that needs testing
5. Duplicate the generic tests *as generic tests* using the different tools that need testing /or/ make the tooling selectable by environment/config file variables.
After step 5, we should have tests that run on multiple filesystems using multiple tools, and they all give the same results. The tests as proposed don't provide us with any guarantee that the generic quota tool will work on XFS, nor that ext4 has an API that is compatible with XFS.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Jan Kara
reviewerQuoted 37 lines · Dave Chinner
Quoted 16 lines · Shuichi Ihara
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Shuichi Ihara
Hello Ted, Andreas,
Shilong posted an email here a week ago below.
http://lists.openwall.net/linux-ext4/2015/10/30/2we identified 10 project quota related xfstest and ported them into ext4/xxx. test number are 304, 305, 299, 244, 196, 134, 108, 107, 106, 050 in xfs.
We ported 9/10 tests into ext4/xxx
ext4/050 ext4/106 ext4/107 ext4/108 ext4/196 ext4/244 ext4/299 ext4/400 ext4/401Quoted 7 lines
Quoted 3 lines
Please make them generic tests - the ext4 project quota functioanlity should work with those tests being completely unchanged except for a "
_requires_project_quota()" function...Right now, we enhanced quotatool to support project quota and above project quota tests in ext4 uses that interface. xfs uses own interface
xfs_xxfor project quota tests in xfs.
what interface are you looking at if we move ext4's project quota tests into generic tests?The project quota support in the generic quota tool should work XFS as well as ext4. If it doesn't, then it's not a generic tool, right? The whole point of having ext4 use the same userspace API as XFS is so that all quotas can be managed with the one tool. Essentially, if ext4 project quotas cannot be controlled by
xfs_quota, then the ext4 code is not compatible with XFS and hence still needs work.FWIW, if ext4 has implemented the kernel project quota interfaces correctly, then it should not matter whether we use
xfs_quotaor the generic quotatool because the kernel will translate the filesystem information to whatever format the quota was requested in...
Quoted 6 lines
So, you should be able to simply use the
xfs_quotatool in the tests you make generic without needing any significant modification to the tests to run them on ext4. Yes, that may mean you need to send a 5 line patch to makexfs_quotarun on ext4, but that's trivial compared to duplicating >10 tests and then having to maintain them forever...
Yeah, last time I tried the only modification xfs_quota tool needed to work correctly with ext4 was to remove / modify the check for filesystem type in fs_table_initialise_mounts(). The question is how to properly deal with that. I don't think just removing the fs type check is the right way to go as that will have unexpected side effects for operations working on "all" filesystems - currently these are restricted to "all" *XFS* filesystems.
Maybe we can add a command line option which will disable the fs type check so that non-XFS filesystems can be handled. We used to have an option like this for xfs_io but it seems it got removed so I'm not sure we want to add that into xfs_quota though. Dave?
Another option would be to use generic quota-tools for project quota tests once the patches land. But that would require some more work on xfstests side and so far I didn't get an official submission of patches for quota-tools to support project quota.
Honza
Signature · 2 lines
Jan Kara <jack-IBi9RG/[email protected]> SUSE Labs, CR
Quoted 53 lines · Jan Kara
Quoted 37 lines · Dave Chinner
Quoted 16 lines · Shuichi Ihara
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Shuichi Ihara
Hello Ted, Andreas,
Shilong posted an email here a week ago below.
http://lists.openwall.net/linux-ext4/2015/10/30/2we identified 10 project quota related xfstest and ported them into ext4/xxx. test number are 304, 305, 299, 244, 196, 134, 108, 107, 106, 050 in xfs.
We ported 9/10 tests into ext4/xxx
ext4/050 ext4/106 ext4/107 ext4/108 ext4/196 ext4/244 ext4/299 ext4/400 ext4/401Quoted 7 lines
Quoted 3 lines
Please make them generic tests - the ext4 project quota functioanlity should work with those tests being completely unchanged except for a "
_requires_project_quota()" function...Right now, we enhanced quotatool to support project quota and above project quota tests in ext4 uses that interface. xfs uses own interface
xfs_xxfor project quota tests in xfs.
what interface are you looking at if we move ext4's project quota tests into generic tests?The project quota support in the generic quota tool should work XFS as well as ext4. If it doesn't, then it's not a generic tool, right? The whole point of having ext4 use the same userspace API as XFS is so that all quotas can be managed with the one tool. Essentially, if ext4 project quotas cannot be controlled by
xfs_quota, then the ext4 code is not compatible with XFS and hence still needs work.FWIW, if ext4 has implemented the kernel project quota interfaces correctly, then it should not matter whether we use
xfs_quotaor the generic quotatool because the kernel will translate the filesystem information to whatever format the quota was requested in...Quoted 6 lines
So, you should be able to simply use the
xfs_quotatool in the tests you make generic without needing any significant modification to the tests to run them on ext4. Yes, that may mean you need to send a 5 line patch to makexfs_quotarun on ext4, but that's trivial compared to duplicating >10 tests and then having to maintain them forever...Yeah, last time I tried the only modification
xfs_quotatool needed to work correctly with ext4 was to remove / modify the check for filesystem type infs_table_initialise_mounts(). The question is how to properly deal with that. I don't think just removing the fs type check is the right way to go as that will have unexpected side effects for operations working on "all" filesystems - currently these are restricted to "all" *XFS* filesystems.
Quoted 4 lines
Maybe we can add a command line option which will disable the fs type check so that non-XFS filesystems can be handled. We used to have an option like this for
xfs_iobut it seems it got removed so I'm not sure we want to add that intoxfs_quotathough. Dave?
The option is still there in xfs_io, we just ignore it because we do the detection automatically now via:
if (!platform_test_xfs_fd(c))
flags |= IO_FOREIGN;The rest of the libxcmd infrastructure handles enabling/disabling the commands for foreign filesystems via the io/init.c::init_check_command() function, which does:
if (file && !(ct->flags & CMD_FOREIGN_OK) &&
(file->flags & IO_FOREIGN)) {
fprintf(stderr,
_("foreign file active, %s command is for XFS filesystems only\n"),
ct->name);
return 0;
}It is trivial to add this to xfs_quota (ok, it's 20 lines of code) and so allow the relevant commands the tests need to operate on foreign filesystems.
Quoted 4 lines
Another option would be to use generic quota-tools for project quota tests once the patches land. But that would require some more work on xfstests side and so far I didn't get an official submission of patches for quota-tools to support project quota.
Eventually, yes. But we don't have to wait for that to happen if we use the xfs-quota tool to begin with.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Jan Kara
reviewerQuoted 78 lines · Dave Chinner
Quoted 53 lines · Jan Kara
Quoted 37 lines · Dave Chinner
Quoted 16 lines · Shuichi Ihara
Quoted 13 lines · Dave Chinner
Quoted 11 lines · Shuichi Ihara
Hello Ted, Andreas,
Shilong posted an email here a week ago below.
http://lists.openwall.net/linux-ext4/2015/10/30/2we identified 10 project quota related xfstest and ported them into ext4/xxx. test number are 304, 305, 299, 244, 196, 134, 108, 107, 106, 050 in xfs.
We ported 9/10 tests into ext4/xxx
ext4/050 ext4/106 ext4/107 ext4/108 ext4/196 ext4/244 ext4/299 ext4/400 ext4/401Quoted 7 lines
Quoted 3 lines
Please make them generic tests - the ext4 project quota functioanlity should work with those tests being completely unchanged except for a "
_requires_project_quota()" function...Right now, we enhanced quotatool to support project quota and above project quota tests in ext4 uses that interface. xfs uses own interface
xfs_xxfor project quota tests in xfs.
what interface are you looking at if we move ext4's project quota tests into generic tests?The project quota support in the generic quota tool should work XFS as well as ext4. If it doesn't, then it's not a generic tool, right? The whole point of having ext4 use the same userspace API as XFS is so that all quotas can be managed with the one tool. Essentially, if ext4 project quotas cannot be controlled by
xfs_quota, then the ext4 code is not compatible with XFS and hence still needs work.FWIW, if ext4 has implemented the kernel project quota interfaces correctly, then it should not matter whether we use
xfs_quotaor the generic quotatool because the kernel will translate the filesystem information to whatever format the quota was requested in...Quoted 6 lines
So, you should be able to simply use the
xfs_quotatool in the tests you make generic without needing any significant modification to the tests to run them on ext4. Yes, that may mean you need to send a 5 line patch to makexfs_quotarun on ext4, but that's trivial compared to duplicating >10 tests and then having to maintain them forever...Yeah, last time I tried the only modification
xfs_quotatool needed to work correctly with ext4 was to remove / modify the check for filesystem type infs_table_initialise_mounts(). The question is how to properly deal with that. I don't think just removing the fs type check is the right way to go as that will have unexpected side effects for operations working on "all" filesystems - currently these are restricted to "all" *XFS* filesystems.Quoted 4 lines
Maybe we can add a command line option which will disable the fs type check so that non-XFS filesystems can be handled. We used to have an option like this for
xfs_iobut it seems it got removed so I'm not sure we want to add that intoxfs_quotathough. Dave?The option is still there in
xfs_io, we just ignore it because we do the detection automatically now via:if (!platform_test_xfs_fd(c)) flags |= IO_FOREIGN;The rest of the libxcmd infrastructure handles enabling/disabling the commands for foreign filesystems via the io/init.c::init_check_command() function, which does:
if (file && !(ct->flags & CMD_FOREIGN_OK) && (file->flags & IO_FOREIGN)) { fprintf(stderr, _("foreign file active, %s command is for XFS filesystems only\n"), ct->name); return 0; }
Quoted 3 lines
It is trivial to add this to
xfs_quota(ok, it's 20 lines of code) and so allow the relevant commands the tests need to operate on foreign filesystems.
OK, then I agree that enabling xfs_quota to work for ext4 filesystems is the easiest way to make xfstests project quota tests work for ext4.
For usability of project quota on ext4, we want the support in quota-tools as soon as possible anyway but it is a separate issue...
Honza
Signature · 2 lines
Jan Kara <jack-IBi9RG/[email protected]> SUSE Labs, CR
PATCH v15 3/4 ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
In reply to Li XiThis patch adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR ioctl interface support for ext4. The interface is kept consistent with XFS_IOC_FSGETXATTR/XFS_IOC_FSGETXATTR.
--- fs/ext4/ext4.h | 9 ++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 32 ++++ 4 files changed, 338 insertions(+), 117 deletions(-)
fs/ext4/ext4.h +9 -0
@@ -380,6 +380,13 @@ struct flex_groups {#define EXT4_FL_USER_VISIBLE 0x304BDFFF/* User visible flags */ #define EXT4_FL_USER_MODIFIABLE 0x204380FF/* User modifiable flags */ +#define EXT4_FL_XFLAG_VISIBLE (EXT4_SYNC_FL | \ + EXT4_IMMUTABLE_FL | \ + EXT4_APPEND_FL | \ + EXT4_NODUMP_FL | \ + EXT4_NOATIME_FL | \ + EXT4_PROJINHERIT_FL) +/* Flags that should be inherited by new inodes from their parent. */ #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\
@@ -614,6 +621,8 @@ enum {#define EXT4_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct ext4_encryption_policy)#define EXT4_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16])#define EXT4_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct ext4_encryption_policy) +#define EXT4_IOC_FSGETXATTR FS_IOC_FSGETXATTR +#define EXT4_IOC_FSSETXATTR FS_IOC_FSSETXATTR#if defined(__KERNEL__) && defined(CONFIG_COMPAT )/*
fs/ext4/ioctl.c +280 -87
398 lines not on this page · raw message
fs/xfs/libxfs/xfs_fs.h +17 -30
63 lines not on this page · raw message
include/uapi/linux/fs.h +32 -0
@@ -58,6 +58,36 @@ struct inodes_stat_t {long dummy[5 ];/* padding for sysctl ABI compatibility */ }; +/* +* Structure for FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR. +*/ +struct fsxattr { +__u32 fsx_xflags;/* xflags field value (get/set) */ +__u32 fsx_extsize;/* extsize field value (get/set)*/ +__u32 fsx_nextents;/* nextents field value (get) */ +__u32 fsx_projid;/* project identifier (get/set) */ +unsigned char fsx_pad[12 ]; +}; + +/* +* Flags for the fsx_xflags field +*/ +#define FS_XFLAG_REALTIME 0x00000001/* data in realtime volume */ +#define FS_XFLAG_PREALLOC 0x00000002/* preallocated file extents */ +#define FS_XFLAG_IMMUTABLE 0x00000008/* file cannot be modified */ +#define FS_XFLAG_APPEND 0x00000010/* all writes append */ +#define FS_XFLAG_SYNC 0x00000020/* all writes synchronous */ +#define FS_XFLAG_NOATIME 0x00000040/* do not update access time */ +#define FS_XFLAG_NODUMP 0x00000080/* do not include in backups */ +#define FS_XFLAG_RTINHERIT 0x00000100/* create with rt bit set */ +#define FS_XFLAG_PROJINHERIT 0x00000200/* create with parents projid */ +#define FS_XFLAG_NOSYMLINKS 0x00000400/* disallow symlink creation */ +#define FS_XFLAG_EXTSIZE 0x00000800/* extent size allocator hint */ +#define FS_XFLAG_EXTSZINHERIT 0x00001000/* inherit inode extent size */ +#define FS_XFLAG_NODEFRAG 0x00002000/* do not defragment */ +#define FS_XFLAG_FILESTREAM 0x00004000/* use filestream allocator */ +#define FS_XFLAG_HASATTR 0x80000000/* no DIFLAG for this */ +#define NR_FILE 8192/* this can well be larger on a larger system */
@@ -165,6 +195,8 @@ struct inodes_stat_t {#define FS_IOC_GETVERSION _IOR('v', 1, long)#define FS_IOC_SETVERSION _IOW('v', 2, long)#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap) +#define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr) +#define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr)#define FS_IOC32_GETFLAGS _IOR('f', 1, int)#define FS_IOC32_SETFLAGS _IOW('f', 2, int)#define FS_IOC32_GETVERSION _IOR('v', 1, int)
Signature · 1 line
1.7.1
PATCH 1/1 fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion
Quoted 7 lines · Li Xi
This patch adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR ioctl interface support for ext4. The interface is kept consistent with XFS_IOC_FSGETXATTR/XFS_IOC_FSGETXATTR.
Signed-off-by Li Xi <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Jan Kara <[email protected]>
We need to split this into two patches - one to move the ioctl definition to the VFS layer, the other for all the ext4 changes to use it.
This is the way we've done such changes in the past because it impacts on unrelated userspace code (e.g. xfsprogs shares libxfs/xfs_fs.h) and so these changes have to be specificallly propagated and handled in userspace as there will be systems that have the new xfs_fs.h but the old uapi/linux/fs.h and so xfsprogs compilation will break. Hence the UAPI change needs to be separate to new users of the API.
Having a separate patch also means multiple dev trees can carry the same API change - that will solve the problem that I have conflicting patches in XFS that add new flags to this ioctl (e.g. for per-inode DAX and per-inode lazytime).
I've attached a patch below that is just the UAPI change. If no-one objects, I'll commit this to the XFS tree for the upcoming merge window....
Cheers,
Dave.
Signature · 18 lines
Dave Chinner [email protected] fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion From: Dave Chinner <[email protected]> Hoist the ioctl definitions for the XFS_IOC_FS[SG]SETXATTR API from fs/xfs/libxfs/xfs_fs.h to include/uapi/linux/fs.h so that the ioctls can be used by all filesystems, not just XFS. This enables (initially) ext4 to use the ioctl to set project IDs on inodes. Based-on-patch-from: Li Xi <[email protected]> Signed-off-by: Dave Chinner <[email protected]> --- fs/xfs/libxfs/xfs_fs.h | 51 +++++++++++++++++-------------------------------- include/uapi/linux/fs.h | 32 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 33 deletions(-)
fs/xfs/libxfs/xfs_fs.h +18 -33
@@ -36,38 +36,23 @@ struct dioattr {#endif /* -* Structure for XFS_IOC_FSGETXATTR[A] and XFS_IOC_FSSETXATTR. +* Flags for the bs_xflags/fsx_xflags field in FS_IOC_FS[GS]ETXATTR[A] */ -#ifndef HAVE_FSXATTR -struct fsxattr { -__u32 fsx_xflags;/* xflags field value (get/set) */ -__u32 fsx_extsize;/* extsize field value (get/set)*/ -__u32 fsx_nextents;/* nextents field value (get) */ -__u32 fsx_projid;/* project identifier (get/set) */ -unsigned char fsx_pad[12 ]; -}; -#endif - -/* -* Flags for the bs_xflags/fsx_xflags field -* There should be a one-to-one correspondence between these flags and the -* XFS_DIFLAG_s. -*/ -#define XFS_XFLAG_REALTIME 0x00000001/* data in realtime volume */ -#define XFS_XFLAG_PREALLOC 0x00000002/* preallocated file extents */ -#define XFS_XFLAG_IMMUTABLE 0x00000008/* file cannot be modified */ -#define XFS_XFLAG_APPEND 0x00000010/* all writes append */ -#define XFS_XFLAG_SYNC 0x00000020/* all writes synchronous */ -#define XFS_XFLAG_NOATIME 0x00000040/* do not update access time */ -#define XFS_XFLAG_NODUMP 0x00000080/* do not include in backups */ -#define XFS_XFLAG_RTINHERIT 0x00000100/* create with rt bit set */ -#define XFS_XFLAG_PROJINHERIT 0x00000200/* create with parents projid */ -#define XFS_XFLAG_NOSYMLINKS 0x00000400/* disallow symlink creation */ -#define XFS_XFLAG_EXTSIZE 0x00000800/* extent size allocator hint */ -#define XFS_XFLAG_EXTSZINHERIT 0x00001000/* inherit inode extent size */ -#define XFS_XFLAG_NODEFRAG 0x00002000/* do not defragment */ -#define XFS_XFLAG_FILESTREAM 0x00004000/* use filestream allocator */ -#define XFS_XFLAG_HASATTR 0x80000000/* no DIFLAG for this */ +#define XFS_XFLAG_REALTIME FS_XFLAG_REALTIME +#define XFS_XFLAG_PREALLOC FS_XFLAG_PREALLOC +#define XFS_XFLAG_IMMUTABLE FS_XFLAG_IMMUTABLE +#define XFS_XFLAG_APPEND FS_XFLAG_APPEND +#define XFS_XFLAG_SYNC FS_XFLAG_SYNC +#define XFS_XFLAG_NOATIME FS_XFLAG_NOATIME +#define XFS_XFLAG_NODUMP FS_XFLAG_NODUMP +#define XFS_XFLAG_RTINHERIT FS_XFLAG_RTINHERIT +#define XFS_XFLAG_PROJINHERIT FS_XFLAG_PROJINHERIT +#define XFS_XFLAG_NOSYMLINKS FS_XFLAG_NOSYMLINKS +#define XFS_XFLAG_EXTSIZE FS_XFLAG_EXTSIZE +#define XFS_XFLAG_EXTSZINHERIT FS_XFLAG_EXTSZINHERIT +#define XFS_XFLAG_NODEFRAG FS_XFLAG_NODEFRAG +#define XFS_XFLAG_FILESTREAM FS_XFLAG_FILESTREAM +#define XFS_XFLAG_HASATTR FS_XFLAG_HASATTR/* * Structure for XFS_IOC_GETBMAP.
@@ -514,8 +499,8 @@ typedef struct xfs_swapext#define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64)#define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64)#define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr) -#define XFS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr) -#define XFS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr) +#define XFS_IOC_FSGETXATTR FS_IOC_FSGETXATTR +#define XFS_IOC_FSSETXATTR FS_IOC_FSSETXATTR#define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64)#define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64)#define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap)
include/uapi/linux/fs.h +32 -0
@@ -110,6 +110,36 @@ struct inodes_stat_t {#define MS_MGC_VAL 0xC0ED0000#define MS_MGC_MSK 0xffff0000 +/* +* Structure for FS_IOC_FSGETXATTR[A] and FS_IOC_FSSETXATTR. +*/ +struct fsxattr { +__u32 fsx_xflags;/* xflags field value (get/set) */ +__u32 fsx_extsize;/* extsize field value (get/set)*/ +__u32 fsx_nextents;/* nextents field value (get) */ +__u32 fsx_projid;/* project identifier (get/set) */ +unsigned char fsx_pad[12 ]; +}; + +/* +* Flags for the fsx_xflags field +*/ +#define FS_XFLAG_REALTIME 0x00000001/* data in realtime volume */ +#define FS_XFLAG_PREALLOC 0x00000002/* preallocated file extents */ +#define FS_XFLAG_IMMUTABLE 0x00000008/* file cannot be modified */ +#define FS_XFLAG_APPEND 0x00000010/* all writes append */ +#define FS_XFLAG_SYNC 0x00000020/* all writes synchronous */ +#define FS_XFLAG_NOATIME 0x00000040/* do not update access time */ +#define FS_XFLAG_NODUMP 0x00000080/* do not include in backups */ +#define FS_XFLAG_RTINHERIT 0x00000100/* create with rt bit set */ +#define FS_XFLAG_PROJINHERIT 0x00000200/* create with parents projid */ +#define FS_XFLAG_NOSYMLINKS 0x00000400/* disallow symlink creation */ +#define FS_XFLAG_EXTSIZE 0x00000800/* extent size allocator hint */ +#define FS_XFLAG_EXTSZINHERIT 0x00001000/* inherit inode extent size */ +#define FS_XFLAG_NODEFRAG 0x00002000/* do not defragment */ +#define FS_XFLAG_FILESTREAM 0x00004000/* use filestream allocator */ +#define FS_XFLAG_HASATTR 0x80000000/* no DIFLAG for this */ +/* the read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */
@@ -169,6 +199,8 @@ struct inodes_stat_t {#define FS_IOC32_SETFLAGS _IOW('f', 2, int)#define FS_IOC32_GETVERSION _IOR('v', 1, int)#define FS_IOC32_SETVERSION _IOW('v', 2, int) +#define FS_IOC_FSGETXATTR _IOR ('X', 31, struct fsxattr) +#define FS_IOC_FSSETXATTR _IOW ('X', 32, struct fsxattr)/* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
Theodore Ts'o
maintainerRe: [PATCH] fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion
Quoted 3 lines · Dave Chinner
I've attached a patch below that is just the UAPI change. If no-one objects, I'll commit this to the XFS tree for the upcoming merge window....
No objections. Thanks!!
- Ted
Re: [PATCH] fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
Quoted 7 lines · Li Xi
This patch adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR ioctl interface support for ext4. The interface is kept consistent with XFS_IOC_FSGETXATTR/XFS_IOC_FSGETXATTR.
Signed-off-by Li Xi <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Jan Kara <[email protected]>
Hello,
This commit breaks building latest qemu as follows:
In file included from /usr/include/xfs/xfs.h:58:0,
from /home/pranith/qemu/block/raw-posix.c:96:/usr/include/xfs/xfs_fs.h:42:8: error: redefinition of ‘struct fsxattr’
struct fsxattr {
^
In file included from /home/pranith/qemu/block/raw-posix.c:59:0:
/usr/include/linux/fs.h:155:8: note: originally defined here
struct fsxattr {
^/home/pranith/qemu/rules.mak:57: recipe for target 'block/raw-posix.o' failed
I think this is caused by moving the fsxattr struct around. Is the header inclusion messed up somehow?
Thanks,
Signature · 5 lines
Pranith -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Theodore Ts'o
maintainerRe: [PATCH] fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion
Quoted 2 lines · Pranith Kumar
This commit breaks building latest qemu as follows:
Well, this commit moves where the fsxattr struct is around, but the header files that gcc is complaining about here:
Quoted 10 lines
In file included from
/usr/include/xfs/xfs.h:58:0,
from/home/pranith/qemu/block/raw-posix.c:96:/usr/include/xfs/xfs_fs.h:42:8: error: redefinition of ‘struct fsxattr’struct fsxattr { ^ In file included from /home/pranith/qemu/block/raw-posix.c:59:0: /usr/include/linux/fs.h:155:8: note: originally defined here struct fsxattr { ^
/home/pranith/qemu/rules.mak:57: recipe for target 'block/raw-posix.o' failed
are userspace header files in /usr/include, and so the problem isn't in the kernel, but how the userspace header files have been set up.
You didn't say what distribution you are using, but I suspect what's going on is that you are getting /usr/include/xfs/xfs_fs.h from the xfsprogs package, while the /usr/include/linux/fs.h is getting derived from the include/uapi/linux/fs.h file from the kernel header files.
So the issue is that these two header files are out of sync. It's because of issues like this that I'm not a fan of updating the kernel header files whenever I install a newer kernel version.
So on my Debain system, I don't update linux-libc-dev when I install a new upstream kernel built using "make deb-pkg". I'll still a new version of the linux-image-*.deb file, and maybe a newer version of linux-firmware-*.dev, but I don't bother installing the linux-headers-*.deb file (since I don't compile external kernel modules), and I don't bother installing linux-libc-dev-*.deb (because of situations like this, where the userspace include files need ot be updated in sync, and this should be the distribution's problem to handle).
Cheers,
- Ted
Re: [PATCH] fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion
Quoted 9 lines · Theodore Ts'o
So on my Debain system, I don't update linux-libc-dev when I install a new upstream kernel built using "make deb-pkg". I'll still a new version of the linux-image-*.deb file, and maybe a newer version of linux-firmware-*.dev, but I don't bother installing the linux-headers-*.deb file (since I don't compile external kernel modules), and I don't bother installing linux-libc-dev-*.deb (because of situations like this, where the userspace include files need ot be updated in sync, and this should be the distribution's problem to handle).
I am using a debian system and built the kernel using "make bindeb-pkg". This generated the following debs:
linux-firmware-image-4.5.0-rc1+_4.5.0-rc1+-2_powerpc.deb linux-image-4.5.0-rc1+_4.5.0-rc1+-2_powerpc.deb linux-headers-4.5.0-rc1+_4.5.0-rc1+-2_powerpc.deb linux-libc-dev_4.5.0-rc1+-2_powerpc.deb
which I installed as I usually do to test new system calls or run other tests.
I'll try to update the uapi header files manually and see how it goes...
Thanks!
Signature · 1 line
Pranith
Re: [PATCH] fs: XFS_IOC_FS[SG]SETXATTR to FS_IOC_FS[SG]ETXATTR promotion
Quoted 14 lines · Pranith Kumar
Quoted 9 lines · Theodore Ts'o
So on my Debain system, I don't update linux-libc-dev when I install a new upstream kernel built using "make deb-pkg". I'll still a new version of the linux-image-*.deb file, and maybe a newer version of linux-firmware-*.dev, but I don't bother installing the linux-headers-*.deb file (since I don't compile external kernel modules), and I don't bother installing linux-libc-dev-*.deb (because of situations like this, where the userspace include files need ot be updated in sync, and this should be the distribution's problem to handle).
I am using a debian system and built the kernel using "make bindeb-pkg". This generated the following debs:
Quoted 8 lines
linux-firmware-image-4.5.0-rc1+_4.5.0-rc1+-2_powerpc.deb linux-image-4.5.0-rc1+_4.5.0-rc1+-2_powerpc.deb linux-headers-4.5.0-rc1+_4.5.0-rc1+-2_powerpc.deb linux-libc-dev_4.5.0-rc1+-2_powerpc.deb
which I installed as I usually do to test new system calls or run other tests.
I'll try to update the uapi header files manually and see how it goes...
You need to update qemu's autoconf to define HAVE_FSXATTR if it's found in the uapi/linux/fs.h so that it then isn't defined in xfs/xfs_fs.h.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
PATCH v15 4/4 ext4: cleanup inode flag definitions
In reply to Li XiThe 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.
--- fs/ext4/ext4.h | 50 +++++++++++++++++++++++++------------------------- 1 files changed, 25 insertions(+), 25 deletions(-)
fs/ext4/ext4.h +25 -25
@@ -348,34 +348,34 @@ struct flex_groups {/* * Inode flags */ -#define EXT4_SECRM_FL 0x00000001/* Secure deletion */ -#define EXT4_UNRM_FL 0x00000002/* Undelete */ -#define EXT4_COMPR_FL 0x00000004/* Compress file */ -#define EXT4_SYNC_FL 0x00000008/* Synchronous updates */ -#define EXT4_IMMUTABLE_FL 0x00000010/* Immutable file */ -#define EXT4_APPEND_FL 0x00000020/* writes to file may only append */ -#define EXT4_NODUMP_FL 0x00000040/* do not dump file */ -#define EXT4_NOATIME_FL 0x00000080/* do not update atime */ +#define EXT4_SECRM_FL FS_SECRM_FL/* Secure deletion */ +#define EXT4_UNRM_FL FS_UNRM_FL/* Undelete */ +#define EXT4_COMPR_FL FS_COMPR_FL/* Compress file */ +#define EXT4_SYNC_FL FS_SYNC_FL/* Synchronous updates */ +#define EXT4_IMMUTABLE_FL FS_IMMUTABLE_FL/* Immutable file */ +#define EXT4_APPEND_FL FS_APPEND_FL/* writes to file may only append */ +#define EXT4_NODUMP_FL FS_NODUMP_FL/* do not dump file */ +#define EXT4_NOATIME_FL FS_NOATIME_FL/* do not update atime */ /* Reserved for compression usage... */ -#define EXT4_DIRTY_FL 0x00000100 -#define EXT4_COMPRBLK_FL 0x00000200/* One or more compressed clusters */ -#define EXT4_NOCOMPR_FL 0x00000400/* Don't compress */ +#define EXT4_DIRTY_FL FS_DIRTY_FL +#define EXT4_COMPRBLK_FL FS_COMPRBLK_FL/* One or more compressed clusters */ +#define EXT4_NOCOMPR_FL FS_NOCOMP_FL/* Don't compress */ /* nb: was previously EXT2_ECOMPR_FL */ -#define EXT4_ENCRYPT_FL 0x00000800/* encrypted file */ +#define EXT4_ENCRYPT_FL 0x00000800/* encrypted file */ /* End compression flags --- maybe not all used */ -#define EXT4_INDEX_FL 0x00001000/* hash-indexed directory */ -#define EXT4_IMAGIC_FL 0x00002000/* AFS directory */ -#define EXT4_JOURNAL_DATA_FL 0x00004000/* file data should be journaled */ -#define EXT4_NOTAIL_FL 0x00008000/* file tail should not be merged */ -#define EXT4_DIRSYNC_FL 0x00010000/* dirsync behaviour (directories only) */ -#define EXT4_TOPDIR_FL 0x00020000/* Top of directory hierarchies*/ -#define EXT4_HUGE_FILE_FL 0x00040000/* Set to each huge file */ -#define EXT4_EXTENTS_FL 0x00080000/* Inode uses extents */ -#define EXT4_EA_INODE_FL 0x00200000/* Inode used for large EA */ -#define EXT4_EOFBLOCKS_FL 0x00400000/* Blocks allocated beyond EOF */ -#define EXT4_INLINE_DATA_FL 0x10000000/* Inode has inline data. */ -#define EXT4_PROJINHERIT_FL 0x20000000/* Create with parents projid */ -#define EXT4_RESERVED_FL 0x80000000/* reserved for ext4 lib */ +#define EXT4_INDEX_FL FS_INDEX_FL/* hash-indexed directory */ +#define EXT4_IMAGIC_FL FS_IMAGIC_FL/* AFS directory */ +#define EXT4_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL/* file data should be journaled */ +#define EXT4_NOTAIL_FL FS_NOTAIL_FL/* file tail should not be merged */ +#define EXT4_DIRSYNC_FL FS_DIRSYNC_FL/* dirsync behaviour (directories only) */ +#define EXT4_TOPDIR_FL FS_TOPDIR_FL/* Top of directory hierarchies*/ +#define EXT4_HUGE_FILE_FL 0x00040000/* Set to each huge file */ +#define EXT4_EXTENTS_FL FS_EXTENT_FL/* Inode uses extents */ +#define EXT4_EA_INODE_FL 0x00200000/* Inode used for large EA */ +#define EXT4_EOFBLOCKS_FL 0x00400000/* Blocks allocated beyond EOF */ +#define EXT4_INLINE_DATA_FL 0x10000000/* Inode has inline data. */ +#define EXT4_PROJINHERIT_FL FS_PROJINHERIT_FL/* Create with parents projid */ +#define EXT4_RESERVED_FL FS_RESERVED_FL/* reserved for ext4 lib */ #define EXT4_FL_USER_VISIBLE 0x304BDFFF/* User visible flags */ #define EXT4_FL_USER_MODIFIABLE 0x204380FF/* User modifiable flags */
Signature · 1 line
1.7.1
Theodore Ts'o
maintainerRe: [v15 4/4] ext4: cleanup inode flag definitions
Quoted 6 lines · Li Xi
The inode flags defined in
uapi/linux/fs.hwere migrated fromext4.h. This patch changes the inode flag definitions inext4.hto VFS definitions to make the gaps between them clearer.Signed-off-by Li Xi <[email protected]>Reviewed-by Andreas Dilger <[email protected]>
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 <[email protected]> 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.
include/uapi/linux/fs.h +27 -4
@@ -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 [email protected] and +* linux-api-u79uwXL29TaiAVqoAR/[email protected] */ #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 +* [email protected] and linux-api-u79uwXL29TaiAVqoAR/[email protected] */ #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 */
Jan Kara
reviewerQuoted 7 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
With the last version of the patches, there was only one outstanding issue and that was whether xfstests for XFS pass correctly (especially the project quota related ones). Have you been able to verify this?
Honza
Quoted 110 lines
The semantics of ext4 project quota is consistent with XFS. Each directory can have
EXT4_INODE_PROJINHERITflag set. When theEXT4_INODE_PROJINHERITflag of a parent directory is not set, a newly created inode under that directory will have a default project ID (i.e. 0). And itsEXT4_INODE_PROJINHERITflag is not set either. When this flag is set on a directory, following rules will be kept:1) The newly created inode under that directory will inherit both the
EXT4_INODE_PROJINHERITflag and the project ID from its parent directory.2) Hard-linking a inode with different project ID into that directory will fail with errno EXDEV.
3) Renaming a inode with different project ID into that directory will fail with errno EXDEV. However, 'mv' command will detect this failure and copy the renamed inode to a new inode in the directory. Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERITflag.4) If the project quota of that ID is being enforced,
statfs()on that directory will take the quotas as another upper limits along with the capacity of the file system, i.e. the total block/inode number will be the minimum of the quota limits and file system capacity.Changelog:
* v15 <- v14:
- Rebase to newest master branch of git repository (b0a1ea51b).
* v14 <- v13:
- Cleanup ioctl of setting project ID;
- Do not check project quota inode number specially;
- Check isize when extract project ID from disk;
- Rebase to latest kernel (4.0.0)
* v13 <- v12:
- Update inode size check of project ID.
* v12 <- v11:
- Relax the permission check when setting project ID.
* v11 <- v10:
- Remove project quota mount option;
- Fix permission check when setting project ID.
* v10 <- v9:
- Remove non-journaled project quota interface;
- Only allow admin to read project quota info;
- Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
- Remove non-journaled project quota;
- Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
- Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
- Map ext4 inode flags to xflags of struct fsxattr;
- Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
- Add project ID check for cross rename;
- Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
- Check project feature when set/get project ID;
- Do not check project feature for project quota;
- Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
- Do not check project feature when set/get project ID;
- UseEXT4_MAXQUOTASinstead of MAXQUOTAS in ext4 patches;
- Remove unnecessary change offs/quota/dquot.c;
- RemoveCONFIG_QUOTA_PROJECT.
* v3 <- v2:
- AddEXT4_INODE_PROJINHERITsemantics.
* v2 <- v1:
- Add ioctl interface for setting/getting project;
- AddEXT4_FEATURE_RO_COMPAT_PROJECT;
- Addget_projid()method in structdquot_operations;
- Add error check of ext4_inode_projid_set/get().v14: http://article.gmane.org/gmane.linux.kernel.api/10345
v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153Any comments or feedbacks are appreciated.
Regards,
- Li XiLi Xi (4):
ext4: adds project ID support
ext4: adds project quota support
ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
ext4: cleanup inode flag definitionsfs/ext4/ext4.h | 85 +++++++---- fs/ext4/ialloc.c | 7 + fs/ext4/inode.c | 28 ++++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/ext4/namei.c | 19 +++ fs/ext4/super.c | 57 +++++++- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 33 +++++ 8 files changed, 490 insertions(+), 153 deletions(-)
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
A message that is not in the archive (sent off-list or not yet received): 20150923123119.GA13946-+0h/O2h83AeN3ZZ/[email protected]
Hi Jan Kara,
Sorry, I forgot to mention that we run the xfstests for both XFS and Ext4 with and without these patches. And still, some (but not too many) of the tests fails, but the failed tests are the same no matter the patches are applied or not. And we didn't see any project quota related tests fails.
Regards,
Li Xi
Quoted 128 lines · Jan Kara
Quoted 7 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
With the last version of the patches, there was only one outstanding issue and that was whether xfstests for XFS pass correctly (especially the project quota related ones). Have you been able to verify this?
Honza
Quoted 100 lines
The semantics of ext4 project quota is consistent with XFS. Each directory can have
EXT4_INODE_PROJINHERITflag set. When theEXT4_INODE_PROJINHERITflag of a parent directory is not set, a newly created inode under that directory will have a default project ID (i.e. 0). And itsEXT4_INODE_PROJINHERITflag is not set either. When this flag is set on a directory, following rules will be kept:1) The newly created inode under that directory will inherit both the
EXT4_INODE_PROJINHERITflag and the project ID from its parent directory.2) Hard-linking a inode with different project ID into that directory will fail with errno EXDEV.
3) Renaming a inode with different project ID into that directory will fail with errno EXDEV. However, 'mv' command will detect this failure and copy the renamed inode to a new inode in the directory. Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERITflag.4) If the project quota of that ID is being enforced,
statfs()on that directory will take the quotas as another upper limits along with the capacity of the file system, i.e. the total block/inode number will be the minimum of the quota limits and file system capacity.Changelog:
* v15 <- v14:
- Rebase to newest master branch of git repository (b0a1ea51b).
* v14 <- v13:
- Cleanup ioctl of setting project ID;
- Do not check project quota inode number specially;
- Check isize when extract project ID from disk;
- Rebase to latest kernel (4.0.0)
* v13 <- v12:
- Update inode size check of project ID.
* v12 <- v11:
- Relax the permission check when setting project ID.
* v11 <- v10:
- Remove project quota mount option;
- Fix permission check when setting project ID.
* v10 <- v9:
- Remove non-journaled project quota interface;
- Only allow admin to read project quota info;
- Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
- Remove non-journaled project quota;
- Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
- Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
- Map ext4 inode flags to xflags of struct fsxattr;
- Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
- Add project ID check for cross rename;
- Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
- Check project feature when set/get project ID;
- Do not check project feature for project quota;
- Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
- Do not check project feature when set/get project ID;
- UseEXT4_MAXQUOTASinstead of MAXQUOTAS in ext4 patches;
- Remove unnecessary change offs/quota/dquot.c;
- RemoveCONFIG_QUOTA_PROJECT.
* v3 <- v2:
- AddEXT4_INODE_PROJINHERITsemantics.
* v2 <- v1:
- Add ioctl interface for setting/getting project;
- AddEXT4_FEATURE_RO_COMPAT_PROJECT;
- Addget_projid()method in structdquot_operations;
- Add error check of ext4_inode_projid_set/get().v14: http://article.gmane.org/gmane.linux.kernel.api/10345
v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153Any comments or feedbacks are appreciated.
Regards,
- Li XiLi Xi (4):
ext4: adds project ID support
ext4: adds project quota support
ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
ext4: cleanup inode flag definitionsQuoted 10 lines
fs/ext4/ext4.h | 85 +++++++---- fs/ext4/ialloc.c | 7 + fs/ext4/inode.c | 28 ++++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/ext4/namei.c | 19 +++ fs/ext4/super.c | 57 +++++++- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 33 +++++ 8 files changed, 490 insertions(+), 153 deletions(-)--
Jan Kara <jack-IBi9RG/[email protected]>
SUSE Labs, CR
A message that is not in the archive (sent off-list or not yet received): CAPTn0cBB7h89R7NB+zg+J+TVvKXut_Usixs==S=AWs-v7kZExg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 7 lines · Li Xi
Hi Jan Kara,
Sorry, I forgot to mention that we run the xfstests for both XFS and Ext4 with and without these patches. And still, some (but not too many) of the tests fails, but the failed tests are the same no matter the patches are applied or not. And we didn't see any project quota related tests fails.
BTW. Where I can find userspace tools to play with this feature?
Quoted 133 lines
Regards,
Li XiQuoted 128 lines · Jan Kara
Quoted 7 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
With the last version of the patches, there was only one outstanding issue and that was whether xfstests for XFS pass correctly (especially the project quota related ones). Have you been able to verify this?
Honza
Quoted 100 lines
The semantics of ext4 project quota is consistent with XFS. Each directory can have
EXT4_INODE_PROJINHERITflag set. When theEXT4_INODE_PROJINHERITflag of a parent directory is not set, a newly created inode under that directory will have a default project ID (i.e. 0). And itsEXT4_INODE_PROJINHERITflag is not set either. When this flag is set on a directory, following rules will be kept:1) The newly created inode under that directory will inherit both the
EXT4_INODE_PROJINHERITflag and the project ID from its parent directory.2) Hard-linking a inode with different project ID into that directory will fail with errno EXDEV.
3) Renaming a inode with different project ID into that directory will fail with errno EXDEV. However, 'mv' command will detect this failure and copy the renamed inode to a new inode in the directory. Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERITflag.4) If the project quota of that ID is being enforced,
statfs()on that directory will take the quotas as another upper limits along with the capacity of the file system, i.e. the total block/inode number will be the minimum of the quota limits and file system capacity.Changelog:
* v15 <- v14:
- Rebase to newest master branch of git repository (b0a1ea51b).
* v14 <- v13:
- Cleanup ioctl of setting project ID;
- Do not check project quota inode number specially;
- Check isize when extract project ID from disk;
- Rebase to latest kernel (4.0.0)
* v13 <- v12:
- Update inode size check of project ID.
* v12 <- v11:
- Relax the permission check when setting project ID.
* v11 <- v10:
- Remove project quota mount option;
- Fix permission check when setting project ID.
* v10 <- v9:
- Remove non-journaled project quota interface;
- Only allow admin to read project quota info;
- Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
- Remove non-journaled project quota;
- Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
- Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
- Map ext4 inode flags to xflags of struct fsxattr;
- Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
- Add project ID check for cross rename;
- Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
- Check project feature when set/get project ID;
- Do not check project feature for project quota;
- Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
- Do not check project feature when set/get project ID;
- UseEXT4_MAXQUOTASinstead of MAXQUOTAS in ext4 patches;
- Remove unnecessary change offs/quota/dquot.c;
- RemoveCONFIG_QUOTA_PROJECT.
* v3 <- v2:
- AddEXT4_INODE_PROJINHERITsemantics.
* v2 <- v1:
- Add ioctl interface for setting/getting project;
- AddEXT4_FEATURE_RO_COMPAT_PROJECT;
- Addget_projid()method in structdquot_operations;
- Add error check of ext4_inode_projid_set/get().v14: http://article.gmane.org/gmane.linux.kernel.api/10345
v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153Any comments or feedbacks are appreciated.
Regards,
- Li XiLi Xi (4):
ext4: adds project ID support
ext4: adds project quota support
ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
ext4: cleanup inode flag definitionsQuoted 10 lines
fs/ext4/ext4.h | 85 +++++++---- fs/ext4/ialloc.c | 7 + fs/ext4/inode.c | 28 ++++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/ext4/namei.c | 19 +++ fs/ext4/super.c | 57 +++++++- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 33 +++++ 8 files changed, 490 insertions(+), 153 deletions(-)--
Jan Kara <jack-IBi9RG/[email protected]>
SUSE Labs, CR
Hi Dmitry,
Please check following linkage. It includes all the patches I've made for ext4 project quota. Unfortunately, multiple tools need to be patched, including 1) patch e2fsprogs 2) patch quota-tools 3) patch linux kernel 4) compile project_manage.
Please let me know if there is any problem.
Thanks,
Li Xi
Quoted 143 lines · Dmitry Monakhov
Quoted 7 lines · Li Xi
Hi Jan Kara,
Sorry, I forgot to mention that we run the xfstests for both XFS and Ext4 with and without these patches. And still, some (but not too many) of the tests fails, but the failed tests are the same no matter the patches are applied or not. And we didn't see any project quota related tests fails.
BTW. Where I can find userspace tools to play with this feature?
Quoted 133 lines
Regards,
Li XiQuoted 128 lines · Jan Kara
Quoted 7 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
With the last version of the patches, there was only one outstanding issue and that was whether xfstests for XFS pass correctly (especially the project quota related ones). Have you been able to verify this?
Honza
Quoted 100 lines
The semantics of ext4 project quota is consistent with XFS. Each directory can have
EXT4_INODE_PROJINHERITflag set. When theEXT4_INODE_PROJINHERITflag of a parent directory is not set, a newly created inode under that directory will have a default project ID (i.e. 0). And itsEXT4_INODE_PROJINHERITflag is not set either. When this flag is set on a directory, following rules will be kept:1) The newly created inode under that directory will inherit both the
EXT4_INODE_PROJINHERITflag and the project ID from its parent directory.2) Hard-linking a inode with different project ID into that directory will fail with errno EXDEV.
3) Renaming a inode with different project ID into that directory will fail with errno EXDEV. However, 'mv' command will detect this failure and copy the renamed inode to a new inode in the directory. Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERITflag.4) If the project quota of that ID is being enforced,
statfs()on that directory will take the quotas as another upper limits along with the capacity of the file system, i.e. the total block/inode number will be the minimum of the quota limits and file system capacity.Changelog:
* v15 <- v14:
- Rebase to newest master branch of git repository (b0a1ea51b).
* v14 <- v13:
- Cleanup ioctl of setting project ID;
- Do not check project quota inode number specially;
- Check isize when extract project ID from disk;
- Rebase to latest kernel (4.0.0)
* v13 <- v12:
- Update inode size check of project ID.
* v12 <- v11:
- Relax the permission check when setting project ID.
* v11 <- v10:
- Remove project quota mount option;
- Fix permission check when setting project ID.
* v10 <- v9:
- Remove non-journaled project quota interface;
- Only allow admin to read project quota info;
- Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
- Remove non-journaled project quota;
- Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
- Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
- Map ext4 inode flags to xflags of struct fsxattr;
- Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
- Add project ID check for cross rename;
- Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
- Check project feature when set/get project ID;
- Do not check project feature for project quota;
- Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
- Do not check project feature when set/get project ID;
- UseEXT4_MAXQUOTASinstead of MAXQUOTAS in ext4 patches;
- Remove unnecessary change offs/quota/dquot.c;
- RemoveCONFIG_QUOTA_PROJECT.
* v3 <- v2:
- AddEXT4_INODE_PROJINHERITsemantics.
* v2 <- v1:
- Add ioctl interface for setting/getting project;
- AddEXT4_FEATURE_RO_COMPAT_PROJECT;
- Addget_projid()method in structdquot_operations;
- Add error check of ext4_inode_projid_set/get().v14: http://article.gmane.org/gmane.linux.kernel.api/10345
v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153Any comments or feedbacks are appreciated.
Regards,
- Li XiLi Xi (4):
ext4: adds project ID support
ext4: adds project quota support
ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
ext4: cleanup inode flag definitionsQuoted 10 lines
fs/ext4/ext4.h | 85 +++++++---- fs/ext4/ialloc.c | 7 + fs/ext4/inode.c | 28 ++++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/ext4/namei.c | 19 +++ fs/ext4/super.c | 57 +++++++- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 33 +++++ 8 files changed, 490 insertions(+), 153 deletions(-)--
Jan Kara <[email protected]>
SUSE Labs, CR
A message that is not in the archive (sent off-list or not yet received): CAPTn0cC=1xWCcUMVqhAx4pvqqX9rXC8p6B4Jt7cpm4HfuaFOMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Sorry, the linkage was missing.
https://github.com/ddn-lixi/project_quota_ext4_utils
Quoted 156 lines · Li Xi
Hi Dmitry,
Please check following linkage. It includes all the patches I've made for ext4 project quota. Unfortunately, multiple tools need to be patched, including 1) patch e2fsprogs 2) patch quota-tools 3) patch linux kernel 4) compile
project_manage.Please let me know if there is any problem.
Thanks,
Li XiQuoted 143 lines · Dmitry Monakhov
Quoted 7 lines · Li Xi
Hi Jan Kara,
Sorry, I forgot to mention that we run the xfstests for both XFS and Ext4 with and without these patches. And still, some (but not too many) of the tests fails, but the failed tests are the same no matter the patches are applied or not. And we didn't see any project quota related tests fails.
BTW. Where I can find userspace tools to play with this feature?
Quoted 133 lines
Regards,
Li XiQuoted 128 lines · Jan Kara
Quoted 7 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
With the last version of the patches, there was only one outstanding issue and that was whether xfstests for XFS pass correctly (especially the project quota related ones). Have you been able to verify this?
Honza
Quoted 100 lines
The semantics of ext4 project quota is consistent with XFS. Each directory can have
EXT4_INODE_PROJINHERITflag set. When theEXT4_INODE_PROJINHERITflag of a parent directory is not set, a newly created inode under that directory will have a default project ID (i.e. 0). And itsEXT4_INODE_PROJINHERITflag is not set either. When this flag is set on a directory, following rules will be kept:1) The newly created inode under that directory will inherit both the
EXT4_INODE_PROJINHERITflag and the project ID from its parent directory.2) Hard-linking a inode with different project ID into that directory will fail with errno EXDEV.
3) Renaming a inode with different project ID into that directory will fail with errno EXDEV. However, 'mv' command will detect this failure and copy the renamed inode to a new inode in the directory. Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERITflag.4) If the project quota of that ID is being enforced,
statfs()on that directory will take the quotas as another upper limits along with the capacity of the file system, i.e. the total block/inode number will be the minimum of the quota limits and file system capacity.Changelog:
* v15 <- v14:
- Rebase to newest master branch of git repository (b0a1ea51b).
* v14 <- v13:
- Cleanup ioctl of setting project ID;
- Do not check project quota inode number specially;
- Check isize when extract project ID from disk;
- Rebase to latest kernel (4.0.0)
* v13 <- v12:
- Update inode size check of project ID.
* v12 <- v11:
- Relax the permission check when setting project ID.
* v11 <- v10:
- Remove project quota mount option;
- Fix permission check when setting project ID.
* v10 <- v9:
- Remove non-journaled project quota interface;
- Only allow admin to read project quota info;
- Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
- Remove non-journaled project quota;
- Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
- Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
- Map ext4 inode flags to xflags of struct fsxattr;
- Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
- Add project ID check for cross rename;
- Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
- Check project feature when set/get project ID;
- Do not check project feature for project quota;
- Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
- Do not check project feature when set/get project ID;
- UseEXT4_MAXQUOTASinstead of MAXQUOTAS in ext4 patches;
- Remove unnecessary change offs/quota/dquot.c;
- RemoveCONFIG_QUOTA_PROJECT.
* v3 <- v2:
- AddEXT4_INODE_PROJINHERITsemantics.
* v2 <- v1:
- Add ioctl interface for setting/getting project;
- AddEXT4_FEATURE_RO_COMPAT_PROJECT;
- Addget_projid()method in structdquot_operations;
- Add error check of ext4_inode_projid_set/get().v14: http://article.gmane.org/gmane.linux.kernel.api/10345
v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153Any comments or feedbacks are appreciated.
Regards,
- Li XiLi Xi (4):
ext4: adds project ID support
ext4: adds project quota support
ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
ext4: cleanup inode flag definitionsQuoted 10 lines
fs/ext4/ext4.h | 85 +++++++---- fs/ext4/ialloc.c | 7 + fs/ext4/inode.c | 28 ++++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/ext4/namei.c | 19 +++ fs/ext4/super.c | 57 +++++++- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 33 +++++ 8 files changed, 490 insertions(+), 153 deletions(-)--
Jan Kara <jack-IBi9RG/[email protected]>
SUSE Labs, CR
Quoted 3 lines · Li Xi
Hi Dmitry,
Please check following linkage. It includes all the patches I've made
Which link? According to annotation all links points to previous versions of kernel part. Am I missing something?
Quoted 3 lines
for ext4 project quota. Unfortunately, multiple tools need to be patched, including 1) patch e2fsprogs 2) patch quota-tools 3) patch linux kernel 4) compile
project_manage.
I do believe that.
Quoted 1 line
Please let me know if there is any problem.
It would be very useful for whole community if you just add git-links to modified tools. tools for example like follows:
kernel-pc: http://github.com/blabla/linus.git/prjquota/
e2fsprogs: http://github.com/blabla/e2fsprogs/prjquota/
quota-tools: http://github.com/blabla/quota-tools/prjquota/
This allow others to test whole bundle. For example xfstests-bld users can simply change git-sources to yours and run full xfstests
Quoted 148 lines
Thanks,
Li XiQuoted 143 lines · Dmitry Monakhov
Quoted 7 lines · Li Xi
Hi Jan Kara,
Sorry, I forgot to mention that we run the xfstests for both XFS and Ext4 with and without these patches. And still, some (but not too many) of the tests fails, but the failed tests are the same no matter the patches are applied or not. And we didn't see any project quota related tests fails.
BTW. Where I can find userspace tools to play with this feature?
Quoted 133 lines
Regards,
Li XiQuoted 128 lines · Jan Kara
Quoted 7 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
With the last version of the patches, there was only one outstanding issue and that was whether xfstests for XFS pass correctly (especially the project quota related ones). Have you been able to verify this?
Honza
Quoted 100 lines
The semantics of ext4 project quota is consistent with XFS. Each directory can have
EXT4_INODE_PROJINHERITflag set. When theEXT4_INODE_PROJINHERITflag of a parent directory is not set, a newly created inode under that directory will have a default project ID (i.e. 0). And itsEXT4_INODE_PROJINHERITflag is not set either. When this flag is set on a directory, following rules will be kept:1) The newly created inode under that directory will inherit both the
EXT4_INODE_PROJINHERITflag and the project ID from its parent directory.2) Hard-linking a inode with different project ID into that directory will fail with errno EXDEV.
3) Renaming a inode with different project ID into that directory will fail with errno EXDEV. However, 'mv' command will detect this failure and copy the renamed inode to a new inode in the directory. Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERITflag.4) If the project quota of that ID is being enforced,
statfs()on that directory will take the quotas as another upper limits along with the capacity of the file system, i.e. the total block/inode number will be the minimum of the quota limits and file system capacity.Changelog:
* v15 <- v14:
- Rebase to newest master branch of git repository (b0a1ea51b).
* v14 <- v13:
- Cleanup ioctl of setting project ID;
- Do not check project quota inode number specially;
- Check isize when extract project ID from disk;
- Rebase to latest kernel (4.0.0)
* v13 <- v12:
- Update inode size check of project ID.
* v12 <- v11:
- Relax the permission check when setting project ID.
* v11 <- v10:
- Remove project quota mount option;
- Fix permission check when setting project ID.
* v10 <- v9:
- Remove non-journaled project quota interface;
- Only allow admin to read project quota info;
- Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
- Remove non-journaled project quota;
- Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
- Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
- Map ext4 inode flags to xflags of struct fsxattr;
- Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
- Add project ID check for cross rename;
- Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
- Check project feature when set/get project ID;
- Do not check project feature for project quota;
- Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
- Do not check project feature when set/get project ID;
- UseEXT4_MAXQUOTASinstead of MAXQUOTAS in ext4 patches;
- Remove unnecessary change offs/quota/dquot.c;
- RemoveCONFIG_QUOTA_PROJECT.
* v3 <- v2:
- AddEXT4_INODE_PROJINHERITsemantics.
* v2 <- v1:
- Add ioctl interface for setting/getting project;
- AddEXT4_FEATURE_RO_COMPAT_PROJECT;
- Addget_projid()method in structdquot_operations;
- Add error check of ext4_inode_projid_set/get().v14: http://article.gmane.org/gmane.linux.kernel.api/10345
v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153Any comments or feedbacks are appreciated.
Regards,
- Li XiLi Xi (4):
ext4: adds project ID support
ext4: adds project quota support
ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
ext4: cleanup inode flag definitionsQuoted 10 lines
fs/ext4/ext4.h | 85 +++++++---- fs/ext4/ialloc.c | 7 + fs/ext4/inode.c | 28 ++++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/ext4/namei.c | 19 +++ fs/ext4/super.c | 57 +++++++- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 33 +++++ 8 files changed, 490 insertions(+), 153 deletions(-)--
Jan Kara <jack-IBi9RG/[email protected]>
SUSE Labs, CR
Jan Kara
reviewerHi,
Quoted 6 lines · Li Xi
Please check following linkage. It includes all the patches I've made for ext4 project quota. Unfortunately, multiple tools need to be patched, including 1) patch e2fsprogs 2) patch quota-tools 3) patch linux kernel 4) compile
project_manage.Please let me know if there is any problem.
BTW, do you plan to submit e.g. quota-tools related changes? I've glanced over what you have in your github repo and it looks sensible. Only you can rip out prjjquota mount option and quotacheck support for project quota since that will be all handled in kernel / e2fsprogs...
Honza
Quoted 144 lines · Dmitry Monakhov
Quoted 143 lines
Quoted 7 lines · Li Xi
Hi Jan Kara,
Sorry, I forgot to mention that we run the xfstests for both XFS and Ext4 with and without these patches. And still, some (but not too many) of the tests fails, but the failed tests are the same no matter the patches are applied or not. And we didn't see any project quota related tests fails.
BTW. Where I can find userspace tools to play with this feature?
Quoted 133 lines
Regards,
Li XiQuoted 128 lines · Jan Kara
Quoted 7 lines · Li Xi
The following patches propose an implementation of project quota support for ext4. A project is an aggregate of unrelated inodes which might scatter in different directories. Inodes that belong to the same project possess an identical identification i.e. 'project ID', just like every inode has its user/group identification. The following patches add project quota as supplement to the former uer/group quota types.
With the last version of the patches, there was only one outstanding issue and that was whether xfstests for XFS pass correctly (especially the project quota related ones). Have you been able to verify this?
Honza
Quoted 100 lines
The semantics of ext4 project quota is consistent with XFS. Each directory can have
EXT4_INODE_PROJINHERITflag set. When theEXT4_INODE_PROJINHERITflag of a parent directory is not set, a newly created inode under that directory will have a default project ID (i.e. 0). And itsEXT4_INODE_PROJINHERITflag is not set either. When this flag is set on a directory, following rules will be kept:1) The newly created inode under that directory will inherit both the
EXT4_INODE_PROJINHERITflag and the project ID from its parent directory.2) Hard-linking a inode with different project ID into that directory will fail with errno EXDEV.
3) Renaming a inode with different project ID into that directory will fail with errno EXDEV. However, 'mv' command will detect this failure and copy the renamed inode to a new inode in the directory. Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERITflag.4) If the project quota of that ID is being enforced,
statfs()on that directory will take the quotas as another upper limits along with the capacity of the file system, i.e. the total block/inode number will be the minimum of the quota limits and file system capacity.Changelog:
* v15 <- v14:
- Rebase to newest master branch of git repository (b0a1ea51b).
* v14 <- v13:
- Cleanup ioctl of setting project ID;
- Do not check project quota inode number specially;
- Check isize when extract project ID from disk;
- Rebase to latest kernel (4.0.0)
* v13 <- v12:
- Update inode size check of project ID.
* v12 <- v11:
- Relax the permission check when setting project ID.
* v11 <- v10:
- Remove project quota mount option;
- Fix permission check when setting project ID.
* v10 <- v9:
- Remove non-journaled project quota interface;
- Only allow admin to read project quota info;
- Cleanup FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface.
* v9 <- v8:
- Remove non-journaled project quota;
- Rebase to newest dev branch of ext4 repository (3.19.0-rc3).
* v8 <- v7:
- Rebase to newest dev branch of ext4 repository (3.18.0_rc3).
* v7 <- v6:
- Map ext4 inode flags to xflags of struct fsxattr;
- Add patch to cleanup ext4 inode flag definitions.
* v6 <- v5:
- Add project ID check for cross rename;
- Remove patch of EXT4_IOC_GETPROJECT/EXT4_IOC_SETPROJECT ioctl
* v5 <- v4:
- Check project feature when set/get project ID;
- Do not check project feature for project quota;
- Add support of FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR.
* v4 <- v3:
- Do not check project feature when set/get project ID;
- UseEXT4_MAXQUOTASinstead of MAXQUOTAS in ext4 patches;
- Remove unnecessary change offs/quota/dquot.c;
- RemoveCONFIG_QUOTA_PROJECT.
* v3 <- v2:
- AddEXT4_INODE_PROJINHERITsemantics.
* v2 <- v1:
- Add ioctl interface for setting/getting project;
- AddEXT4_FEATURE_RO_COMPAT_PROJECT;
- Addget_projid()method in structdquot_operations;
- Add error check of ext4_inode_projid_set/get().v14: http://article.gmane.org/gmane.linux.kernel.api/10345
v13: http://www.spinics.net/lists/linux-fsdevel/msg85205.html
v12: http://www.spinics.net/lists/linux-fsdevel/msg84905.html
v11: http://www.spinics.net/lists/linux-ext4/msg47450.html
v10: http://www.spinics.net/lists/linux-ext4/msg47413.html
v9: http://www.spinics.net/lists/linux-ext4/msg47326.html
v8: http://www.spinics.net/lists/linux-ext4/msg46545.html
v7: http://www.spinics.net/lists/linux-fsdevel/msg80404.html
v6: http://www.spinics.net/lists/linux-fsdevel/msg80022.html
v5: http://www.spinics.net/lists/linux-api/msg04840.html
v4: http://lwn.net/Articles/612972/
v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153Any comments or feedbacks are appreciated.
Regards,
- Li XiLi Xi (4):
ext4: adds project ID support
ext4: adds project quota support
ext4: adds FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
ext4: cleanup inode flag definitionsQuoted 10 lines
fs/ext4/ext4.h | 85 +++++++---- fs/ext4/ialloc.c | 7 + fs/ext4/inode.c | 28 ++++ fs/ext4/ioctl.c | 367 ++++++++++++++++++++++++++++++++++++----------- fs/ext4/namei.c | 19 +++ fs/ext4/super.c | 57 +++++++- fs/xfs/libxfs/xfs_fs.h | 47 +++---- include/uapi/linux/fs.h | 33 +++++ 8 files changed, 490 insertions(+), 153 deletions(-)--
Jan Kara <[email protected]>
SUSE Labs, CR
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Theodore Ts'o
maintainerThis is a patch to reserve the code points used by the project quota feature. It should be the no different from the ones used by the project quota patches; please let me know ASAP if you spot any discrepancies, or anything else that I might have missed.
Cheers,
- Ted
commit 8b4953e13f4c5d9a3c869f5fca7d51e1700e7db0
Author: Theodore Ts'o <[email protected]> Date: Sat Oct 17 16:15:18 2015 -0400
ext4: reserve code points for the project quota feature
fs/ext4/ext4.h +7 -1
@@ -374,6 +374,7 @@ struct flex_groups {#define EXT4_EA_INODE_FL 0x00200000/* Inode used for large EA */ #define EXT4_EOFBLOCKS_FL 0x00400000/* Blocks allocated beyond EOF */ #define EXT4_INLINE_DATA_FL 0x10000000/* Inode has inline data. */ +#define EXT4_PROJINHERIT_FL 0x20000000/* Create with parents projid */ #define EXT4_RESERVED_FL 0x80000000/* reserved for ext4 lib */ #define EXT4_FL_USER_VISIBLE 0x004BDFFF/* User visible flags */
@@ -431,6 +432,7 @@ enum {EXT4_INODE_EA_INODE =21 ,/* Inode used for large EA */ EXT4_INODE_EOFBLOCKS =22 ,/* Blocks allocated beyond EOF */ EXT4_INODE_INLINE_DATA =28 ,/* Data in inode. */ +EXT4_INODE_PROJINHERIT =29 ,/* Create with parents projid */ EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */ };
@@ -475,6 +477,7 @@ static inline void ext4_check_flag_values(void)CHECK_FLAG_VALUE (EA_INODE );CHECK_FLAG_VALUE (EOFBLOCKS );CHECK_FLAG_VALUE (INLINE_DATA ); +CHECK_FLAG_VALUE (PROJINHERIT );CHECK_FLAG_VALUE (RESERVED ); }
@@ -692,6 +695,7 @@ struct ext4_inode {__le32 i_crtime;/* File Creation time */ __le32 i_crtime_extra;/* extra FileCreationtime (nsec << 2 | epoch) */ __le32 i_version_hi;/* high 32 bits for 64-bit version */ +__le32 i_projid;/* Project ID */ };struct move_extent {
@@ -1179,7 +1183,8 @@ struct ext4_super_block {__u8 s_encrypt_algos[4 ];/* Encryption algorithms in use */ __u8 s_encrypt_pw_salt[16 ];/* Salt used for string2key algorithm */ __le32 s_lpf_ino;/* Location of the lost+found inode */ -__le32 s_reserved[100 ];/* Padding to the end of the block */ +__le32 s_prj_quota_inum;/* inode for tracking project quota */ +__le32 s_reserved[99 ];/* Padding to the end of the block */ __le32 s_checksum;/* crc32c(superblock) */ };
@@ -1566,6 +1571,7 @@ static inline int ext4_encrypted_inode(struct inode *inode)*/ #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400#define EXT4_FEATURE_RO_COMPAT_READONLY 0x1000 +#define EXT4_FEATURE_RO_COMPAT_PROJECT 0x2000#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
include/uapi/linux/fs.h +1 -0
@@ -197,6 +197,7 @@ struct inodes_stat_t {#define FS_EXTENT_FL 0x00080000/* Extents */ #define FS_DIRECTIO_FL 0x00100000/* Use direct i/o */ #define FS_NOCOW_FL 0x00800000/* Do not cow file */ +#define FS_PROJINHERIT_FL 0x20000000/* Create with parents projid */ #define FS_RESERVED_FL 0x80000000/* reserved for ext2 lib */ #define FS_FL_USER_VISIBLE 0x0003DFFF/* User visible flags */
Hi Ted,
I checked it and didn't find anything missing or different.
Regards,
Li Xi
Quoted 84 lines · Theodore Ts'o
This is a patch to reserve the code points used by the project quota feature. It should be the no different from the ones used by the project quota patches; please let me know ASAP if you spot any discrepancies, or anything else that I might have missed.
Cheers,
- Ted
commit
8b4953e13f4c5d9a3c869f5fca7d51e1700e7db0Author: Theodore Ts'o <[email protected]> Date: Sat Oct 17 16:15:18 2015 -0400ext4: reserve code points for the project quota feature
Signed-off-by Theodore Ts'o <[email protected]>fs/ext4/ext4.h +7
-1@@ -374,6 +374,7 @@ struct flex_groups {#define EXT4_EA_INODE_FL 0x00200000/* Inode used for large EA */ #define EXT4_EOFBLOCKS_FL 0x00400000/* Blocks allocated beyond EOF */ #define EXT4_INLINE_DATA_FL 0x10000000/* Inode has inline data. */ +#define EXT4_PROJINHERIT_FL 0x20000000/* Create with parents projid */ #define EXT4_RESERVED_FL 0x80000000/* reserved for ext4 lib */ #define EXT4_FL_USER_VISIBLE 0x004BDFFF/* User visible flags */ @@ -431,6 +432,7 @@ enum {EXT4_INODE_EA_INODE =21 ,/* Inode used for large EA */ EXT4_INODE_EOFBLOCKS =22 ,/* Blocks allocated beyond EOF */ EXT4_INODE_INLINE_DATA =28 ,/* Data in inode. */ +EXT4_INODE_PROJINHERIT =29 ,/* Create with parents projid */ EXT4_INODE_RESERVED = 31, /* reserved for ext4 lib */ };@@ -475,6 +477,7 @@ static inline void ext4_check_flag_values(void)CHECK_FLAG_VALUE (EA_INODE );CHECK_FLAG_VALUE (EOFBLOCKS );CHECK_FLAG_VALUE (INLINE_DATA ); +CHECK_FLAG_VALUE (PROJINHERIT );CHECK_FLAG_VALUE (RESERVED ); }@@ -692,6 +695,7 @@ struct ext4_inode {__le32 i_crtime;/* File Creation time */ __le32 i_crtime_extra;/* extra FileCreationtime (nsec << 2 | epoch) */ __le32 i_version_hi;/* high 32 bits for 64-bit version */ +__le32 i_projid;/* Project ID */ };struct move_extent {@@ -1179,7 +1183,8 @@ struct ext4_super_block {__u8 s_encrypt_algos[4 ];/* Encryption algorithms in use */ __u8 s_encrypt_pw_salt[16 ];/* Salt used for string2key algorithm */ __le32 s_lpf_ino;/* Location of the lost+found inode */ -__le32 s_reserved[100 ];/* Padding to the end of the block */ +__le32 s_prj_quota_inum;/* inode for tracking project quota */ +__le32 s_reserved[99 ];/* Padding to the end of the block */ __le32 s_checksum;/* crc32c(superblock) */ };@@ -1566,6 +1571,7 @@ static inline int ext4_encrypted_inode(struct inode *inode)*/ #define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400#define EXT4_FEATURE_RO_COMPAT_READONLY 0x1000 +#define EXT4_FEATURE_RO_COMPAT_PROJECT 0x2000#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002include/uapi/linux/fs.h +1
-0@@ -197,6 +197,7 @@ struct inodes_stat_t {#define FS_EXTENT_FL 0x00080000/* Extents */ #define FS_DIRECTIO_FL 0x00100000/* Use direct i/o */ #define FS_NOCOW_FL 0x00800000/* Do not cow file */ +#define FS_PROJINHERIT_FL 0x20000000/* Create with parents projid */ #define FS_RESERVED_FL 0x80000000/* reserved for ext2 lib */ #define FS_FL_USER_VISIBLE 0x0003DFFF/* User visible flags */