add patch create-function-to-read-journal-inode
[ext4-patch-queue.git] / remove-old-feature-helpers
blob3da12d5368243fa34aa80f2b1f51cf5ba1e13d11
1 ext4: remove old feature helpers
3 From: Kaho Ng <ngkaho1234@gmail.com>
5 Use the ext4_{has,set,clear}_feature_* helpers to replace the old
6 feature helpers.
8 Signed-off-by: Kaho Ng <ngkaho1234@gmail.com>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 Reviewed-by: Jan Kara <jack@suse.cz>
11 Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
12 ---
13  fs/ext4/ext4.h   | 20 --------------------
14  fs/ext4/ialloc.c |  2 +-
15  fs/ext4/inode.c  |  7 +++----
16  fs/ext4/ioctl.c  |  6 ++----
17  4 files changed, 6 insertions(+), 29 deletions(-)
19 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
20 index ea31931..81a298c 100644
21 --- a/fs/ext4/ext4.h
22 +++ b/fs/ext4/ext4.h
23 @@ -1636,26 +1636,6 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
24   * Feature set definitions
25   */
27 -/* Use the ext4_{has,set,clear}_feature_* helpers; these will be removed */
28 -#define EXT4_HAS_COMPAT_FEATURE(sb,mask)                       \
29 -       ((EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask)) != 0)
30 -#define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask)                    \
31 -       ((EXT4_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask)) != 0)
32 -#define EXT4_HAS_INCOMPAT_FEATURE(sb,mask)                     \
33 -       ((EXT4_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask)) != 0)
34 -#define EXT4_SET_COMPAT_FEATURE(sb,mask)                       \
35 -       EXT4_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
36 -#define EXT4_SET_RO_COMPAT_FEATURE(sb,mask)                    \
37 -       EXT4_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
38 -#define EXT4_SET_INCOMPAT_FEATURE(sb,mask)                     \
39 -       EXT4_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
40 -#define EXT4_CLEAR_COMPAT_FEATURE(sb,mask)                     \
41 -       EXT4_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
42 -#define EXT4_CLEAR_RO_COMPAT_FEATURE(sb,mask)                  \
43 -       EXT4_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
44 -#define EXT4_CLEAR_INCOMPAT_FEATURE(sb,mask)                   \
45 -       EXT4_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
47  #define EXT4_FEATURE_COMPAT_DIR_PREALLOC       0x0001
48  #define EXT4_FEATURE_COMPAT_IMAGIC_INODES      0x0002
49  #define EXT4_FEATURE_COMPAT_HAS_JOURNAL                0x0004
50 diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
51 index 9e66cd1..170421e 100644
52 --- a/fs/ext4/ialloc.c
53 +++ b/fs/ext4/ialloc.c
54 @@ -802,7 +802,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
55         } else
56                 inode_init_owner(inode, dir, mode);
58 -       if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_PROJECT) &&
59 +       if (ext4_has_feature_project(sb) &&
60             ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT))
61                 ei->i_projid = EXT4_I(dir)->i_projid;
62         else
63 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
64 index 3131747..3265dc8 100644
65 --- a/fs/ext4/inode.c
66 +++ b/fs/ext4/inode.c
67 @@ -4414,7 +4414,7 @@ static inline void ext4_iget_extra_inode(struct inode *inode,
69  int ext4_get_projid(struct inode *inode, kprojid_t *projid)
70  {
71 -       if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_PROJECT))
72 +       if (!ext4_has_feature_project(inode->i_sb))
73                 return -EOPNOTSUPP;
74         *projid = EXT4_I(inode)->i_projid;
75         return 0;
76 @@ -4481,7 +4481,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
77         inode->i_mode = le16_to_cpu(raw_inode->i_mode);
78         i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
79         i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
80 -       if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_PROJECT) &&
81 +       if (ext4_has_feature_project(sb) &&
82             EXT4_INODE_SIZE(sb) > EXT4_GOOD_OLD_INODE_SIZE &&
83             EXT4_FITS_IN_INODE(raw_inode, ei, i_projid))
84                 i_projid = (projid_t)le32_to_cpu(raw_inode->i_projid);
85 @@ -4885,8 +4885,7 @@ static int ext4_do_update_inode(handle_t *handle,
86                 }
87         }
89 -       BUG_ON(!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
90 -                       EXT4_FEATURE_RO_COMPAT_PROJECT) &&
91 +       BUG_ON(!ext4_has_feature_project(inode->i_sb) &&
92                i_projid != EXT4_DEF_PROJID);
94         if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
95 diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
96 index 10686fd..ef4430b 100644
97 --- a/fs/ext4/ioctl.c
98 +++ b/fs/ext4/ioctl.c
99 @@ -310,8 +310,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
100         struct ext4_inode *raw_inode;
101         struct dquot *transfer_to[MAXQUOTAS] = { };
103 -       if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
104 -                       EXT4_FEATURE_RO_COMPAT_PROJECT)) {
105 +       if (!ext4_has_feature_project(sb)) {
106                 if (projid != EXT4_DEF_PROJID)
107                         return -EOPNOTSUPP;
108                 else
109 @@ -842,8 +841,7 @@ resizefs_out:
110                 ext4_get_inode_flags(ei);
111                 fa.fsx_xflags = ext4_iflags_to_xflags(ei->i_flags & EXT4_FL_USER_VISIBLE);
113 -               if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
114 -                               EXT4_FEATURE_RO_COMPAT_PROJECT)) {
115 +               if (ext4_has_feature_project(inode->i_sb)) {
116                         fa.fsx_projid = (__u32)from_kprojid(&init_user_ns,
117                                 EXT4_I(inode)->i_projid);
118                 }
119 -- 
120 2.9.0
122 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
123 the body of a message to majordomo@vger.kernel.org
124 More majordomo info at  http://vger.kernel.org/majordomo-info.html