Skip to content

Commit 0b7b777

Browse files
ngkaho1234tytso
authored andcommitted
ext4: remove old feature helpers
Use the ext4_{has,set,clear}_feature_* helpers to replace the old feature helpers. Signed-off-by: Kaho Ng <ngkaho1234@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
1 parent 49da939 commit 0b7b777

4 files changed

Lines changed: 6 additions & 29 deletions

File tree

‎fs/ext4/ext4.h‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,26 +1642,6 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
16421642
* Feature set definitions
16431643
*/
16441644

1645-
/* Use the ext4_{has,set,clear}_feature_* helpers; these will be removed */
1646-
#define EXT4_HAS_COMPAT_FEATURE(sb,mask) \
1647-
((EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask)) != 0)
1648-
#define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \
1649-
((EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask)) != 0)
1650-
#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask) \
1651-
((EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask)) != 0)
1652-
#define EXT4_SET_COMPAT_FEATURE(sb,mask) \
1653-
EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
1654-
#define EXT4_SET_RO_COMPAT_FEATURE(sb,mask) \
1655-
EXT4_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
1656-
#define EXT4_SET_INCOMPAT_FEATURE(sb,mask) \
1657-
EXT4_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
1658-
#define EXT4_CLEAR_COMPAT_FEATURE(sb,mask) \
1659-
EXT4_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
1660-
#define EXT4_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
1661-
EXT4_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
1662-
#define EXT4_CLEAR_INCOMPAT_FEATURE(sb,mask) \
1663-
EXT4_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
1664-
16651645
#define EXT4_FEATURE_COMPAT_DIR_PREALLOC 0x0001
16661646
#define EXT4_FEATURE_COMPAT_IMAGIC_INODES 0x0002
16671647
#define EXT4_FEATURE_COMPAT_HAS_JOURNAL 0x0004

‎fs/ext4/ialloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
802802
} else
803803
inode_init_owner(inode, dir, mode);
804804

805-
if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_PROJECT) &&
805+
if (ext4_has_feature_project(sb) &&
806806
ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT))
807807
ei->i_projid = EXT4_I(dir)->i_projid;
808808
else

‎fs/ext4/inode.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4414,7 +4414,7 @@ static inline void ext4_iget_extra_inode(struct inode *inode,
44144414

44154415
int ext4_get_projid(struct inode *inode, kprojid_t *projid)
44164416
{
4417-
if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_PROJECT))
4417+
if (!ext4_has_feature_project(inode->i_sb))
44184418
return -EOPNOTSUPP;
44194419
*projid = EXT4_I(inode)->i_projid;
44204420
return 0;
@@ -4481,7 +4481,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
44814481
inode->i_mode = le16_to_cpu(raw_inode->i_mode);
44824482
i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
44834483
i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4484-
if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_PROJECT) &&
4484+
if (ext4_has_feature_project(sb) &&
44854485
EXT4_INODE_SIZE(sb) > EXT4_GOOD_OLD_INODE_SIZE &&
44864486
EXT4_FITS_IN_INODE(raw_inode, ei, i_projid))
44874487
i_projid = (projid_t)le32_to_cpu(raw_inode->i_projid);
@@ -4885,8 +4885,7 @@ static int ext4_do_update_inode(handle_t *handle,
48854885
}
48864886
}
48874887

4888-
BUG_ON(!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
4889-
EXT4_FEATURE_RO_COMPAT_PROJECT) &&
4888+
BUG_ON(!ext4_has_feature_project(inode->i_sb) &&
48904889
i_projid != EXT4_DEF_PROJID);
48914890

48924891
if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&

‎fs/ext4/ioctl.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
310310
struct ext4_inode *raw_inode;
311311
struct dquot *transfer_to[MAXQUOTAS] = { };
312312

313-
if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
314-
EXT4_FEATURE_RO_COMPAT_PROJECT)) {
313+
if (!ext4_has_feature_project(sb)) {
315314
if (projid != EXT4_DEF_PROJID)
316315
return -EOPNOTSUPP;
317316
else
@@ -842,8 +841,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
842841
ext4_get_inode_flags(ei);
843842
fa.fsx_xflags = ext4_iflags_to_xflags(ei->i_flags & EXT4_FL_USER_VISIBLE);
844843

845-
if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
846-
EXT4_FEATURE_RO_COMPAT_PROJECT)) {
844+
if (ext4_has_feature_project(inode->i_sb)) {
847845
fa.fsx_projid = (__u32)from_kprojid(&init_user_ns,
848846
EXT4_I(inode)->i_projid);
849847
}

0 commit comments

Comments
 (0)