Skip to content

Commit e2b911c

Browse files
djwongtytso
authored andcommitted
ext4: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags, thereby replacing the wordy old macros. Furthermore, clean out the places where we open-coded feature tests. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
1 parent 6a797d2 commit e2b911c

15 files changed

Lines changed: 252 additions & 184 deletions

File tree

‎fs/ext4/balloc.c‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static int ext4_init_block_bitmap(struct super_block *sb,
213213

214214
start = ext4_group_first_block_no(sb, block_group);
215215

216-
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG))
216+
if (ext4_has_feature_flex_bg(sb))
217217
flex_bg = 1;
218218

219219
/* Set bits for block and inode bitmaps, and inode table */
@@ -322,7 +322,7 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,
322322
ext4_fsblk_t blk;
323323
ext4_fsblk_t group_first_block;
324324

325-
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
325+
if (ext4_has_feature_flex_bg(sb)) {
326326
/* with FLEX_BG, the inode/block bitmaps and itable
327327
* blocks may not be in the group at all
328328
* so the bitmap validation will be skipped for those groups
@@ -740,14 +740,13 @@ int ext4_bg_has_super(struct super_block *sb, ext4_group_t group)
740740

741741
if (group == 0)
742742
return 1;
743-
if (EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_SPARSE_SUPER2)) {
743+
if (ext4_has_feature_sparse_super2(sb)) {
744744
if (group == le32_to_cpu(es->s_backup_bgs[0]) ||
745745
group == le32_to_cpu(es->s_backup_bgs[1]))
746746
return 1;
747747
return 0;
748748
}
749-
if ((group <= 1) || !EXT4_HAS_RO_COMPAT_FEATURE(sb,
750-
EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER))
749+
if ((group <= 1) || !ext4_has_feature_sparse_super(sb))
751750
return 1;
752751
if (!(group & 1))
753752
return 0;
@@ -776,7 +775,7 @@ static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb,
776775
if (!ext4_bg_has_super(sb, group))
777776
return 0;
778777

779-
if (EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG))
778+
if (ext4_has_feature_meta_bg(sb))
780779
return le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg);
781780
else
782781
return EXT4_SB(sb)->s_gdb_count;
@@ -797,8 +796,7 @@ unsigned long ext4_bg_num_gdb(struct super_block *sb, ext4_group_t group)
797796
le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg);
798797
unsigned long metagroup = group / EXT4_DESC_PER_BLOCK(sb);
799798

800-
if (!EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG) ||
801-
metagroup < first_meta_bg)
799+
if (!ext4_has_feature_meta_bg(sb) || metagroup < first_meta_bg)
802800
return ext4_bg_num_gdb_nometa(sb, group);
803801

804802
return ext4_bg_num_gdb_meta(sb,group);
@@ -818,7 +816,7 @@ static unsigned ext4_num_base_meta_clusters(struct super_block *sb,
818816
/* Check for superblock and gdt backups in this group */
819817
num = ext4_bg_has_super(sb, block_group);
820818

821-
if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_META_BG) ||
819+
if (!ext4_has_feature_meta_bg(sb) ||
822820
block_group < le32_to_cpu(sbi->s_es->s_first_meta_bg) *
823821
sbi->s_desc_per_block) {
824822
if (num) {

‎fs/ext4/dir.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ static int is_dx_dir(struct inode *inode)
4040
{
4141
struct super_block *sb = inode->i_sb;
4242

43-
if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
44-
EXT4_FEATURE_COMPAT_DIR_INDEX) &&
43+
if (ext4_has_feature_dir_index(inode->i_sb) &&
4544
((ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) ||
4645
((inode->i_size >> sb->s_blocksize_bits) == 1) ||
4746
ext4_has_inline_data(inode)))

‎fs/ext4/ext4.h‎

Lines changed: 132 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,7 @@ static inline int ext4_encrypted_inode(struct inode *inode)
15281528
* Feature set definitions
15291529
*/
15301530

1531+
/* Use the ext4_{has,set,clear}_feature_* helpers; these will be removed */
15311532
#define EXT4_HAS_COMPAT_FEATURE(sb,mask) \
15321533
((EXT4_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask)) != 0)
15331534
#define EXT4_HAS_RO_COMPAT_FEATURE(sb,mask) \
@@ -1590,6 +1591,94 @@ static inline int ext4_encrypted_inode(struct inode *inode)
15901591
#define EXT4_FEATURE_INCOMPAT_INLINE_DATA 0x8000 /* data in inode */
15911592
#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000
15921593

1594+
#define EXT4_FEATURE_COMPAT_FUNCS(name, flagname) \
1595+
static inline bool ext4_has_feature_##name(struct super_block *sb) \
1596+
{ \
1597+
return ((EXT4_SB(sb)->s_es->s_feature_compat & \
1598+
cpu_to_le32(EXT4_FEATURE_COMPAT_##flagname)) != 0); \
1599+
} \
1600+
static inline void ext4_set_feature_##name(struct super_block *sb) \
1601+
{ \
1602+
EXT4_SB(sb)->s_es->s_feature_compat |= \
1603+
cpu_to_le32(EXT4_FEATURE_COMPAT_##flagname); \
1604+
} \
1605+
static inline void ext4_clear_feature_##name(struct super_block *sb) \
1606+
{ \
1607+
EXT4_SB(sb)->s_es->s_feature_compat &= \
1608+
~cpu_to_le32(EXT4_FEATURE_COMPAT_##flagname); \
1609+
}
1610+
1611+
#define EXT4_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
1612+
static inline bool ext4_has_feature_##name(struct super_block *sb) \
1613+
{ \
1614+
return ((EXT4_SB(sb)->s_es->s_feature_ro_compat & \
1615+
cpu_to_le32(EXT4_FEATURE_RO_COMPAT_##flagname)) != 0); \
1616+
} \
1617+
static inline void ext4_set_feature_##name(struct super_block *sb) \
1618+
{ \
1619+
EXT4_SB(sb)->s_es->s_feature_ro_compat |= \
1620+
cpu_to_le32(EXT4_FEATURE_RO_COMPAT_##flagname); \
1621+
} \
1622+
static inline void ext4_clear_feature_##name(struct super_block *sb) \
1623+
{ \
1624+
EXT4_SB(sb)->s_es->s_feature_ro_compat &= \
1625+
~cpu_to_le32(EXT4_FEATURE_RO_COMPAT_##flagname); \
1626+
}
1627+
1628+
#define EXT4_FEATURE_INCOMPAT_FUNCS(name, flagname) \
1629+
static inline bool ext4_has_feature_##name(struct super_block *sb) \
1630+
{ \
1631+
return ((EXT4_SB(sb)->s_es->s_feature_incompat & \
1632+
cpu_to_le32(EXT4_FEATURE_INCOMPAT_##flagname)) != 0); \
1633+
} \
1634+
static inline void ext4_set_feature_##name(struct super_block *sb) \
1635+
{ \
1636+
EXT4_SB(sb)->s_es->s_feature_incompat |= \
1637+
cpu_to_le32(EXT4_FEATURE_INCOMPAT_##flagname); \
1638+
} \
1639+
static inline void ext4_clear_feature_##name(struct super_block *sb) \
1640+
{ \
1641+
EXT4_SB(sb)->s_es->s_feature_incompat &= \
1642+
~cpu_to_le32(EXT4_FEATURE_INCOMPAT_##flagname); \
1643+
}
1644+
1645+
EXT4_FEATURE_COMPAT_FUNCS(dir_prealloc, DIR_PREALLOC)
1646+
EXT4_FEATURE_COMPAT_FUNCS(imagic_inodes, IMAGIC_INODES)
1647+
EXT4_FEATURE_COMPAT_FUNCS(journal, HAS_JOURNAL)
1648+
EXT4_FEATURE_COMPAT_FUNCS(xattr, EXT_ATTR)
1649+
EXT4_FEATURE_COMPAT_FUNCS(resize_inode, RESIZE_INODE)
1650+
EXT4_FEATURE_COMPAT_FUNCS(dir_index, DIR_INDEX)
1651+
EXT4_FEATURE_COMPAT_FUNCS(sparse_super2, SPARSE_SUPER2)
1652+
1653+
EXT4_FEATURE_RO_COMPAT_FUNCS(sparse_super, SPARSE_SUPER)
1654+
EXT4_FEATURE_RO_COMPAT_FUNCS(large_file, LARGE_FILE)
1655+
EXT4_FEATURE_RO_COMPAT_FUNCS(btree_dir, BTREE_DIR)
1656+
EXT4_FEATURE_RO_COMPAT_FUNCS(huge_file, HUGE_FILE)
1657+
EXT4_FEATURE_RO_COMPAT_FUNCS(gdt_csum, GDT_CSUM)
1658+
EXT4_FEATURE_RO_COMPAT_FUNCS(dir_nlink, DIR_NLINK)
1659+
EXT4_FEATURE_RO_COMPAT_FUNCS(extra_isize, EXTRA_ISIZE)
1660+
EXT4_FEATURE_RO_COMPAT_FUNCS(quota, QUOTA)
1661+
EXT4_FEATURE_RO_COMPAT_FUNCS(bigalloc, BIGALLOC)
1662+
EXT4_FEATURE_RO_COMPAT_FUNCS(metadata_csum, METADATA_CSUM)
1663+
EXT4_FEATURE_RO_COMPAT_FUNCS(readonly, READONLY)
1664+
EXT4_FEATURE_RO_COMPAT_FUNCS(project, PROJECT)
1665+
1666+
EXT4_FEATURE_INCOMPAT_FUNCS(compression, COMPRESSION)
1667+
EXT4_FEATURE_INCOMPAT_FUNCS(filetype, FILETYPE)
1668+
EXT4_FEATURE_INCOMPAT_FUNCS(journal_needs_recovery, RECOVER)
1669+
EXT4_FEATURE_INCOMPAT_FUNCS(journal_dev, JOURNAL_DEV)
1670+
EXT4_FEATURE_INCOMPAT_FUNCS(meta_bg, META_BG)
1671+
EXT4_FEATURE_INCOMPAT_FUNCS(extents, EXTENTS)
1672+
EXT4_FEATURE_INCOMPAT_FUNCS(64bit, 64BIT)
1673+
EXT4_FEATURE_INCOMPAT_FUNCS(mmp, MMP)
1674+
EXT4_FEATURE_INCOMPAT_FUNCS(flex_bg, FLEX_BG)
1675+
EXT4_FEATURE_INCOMPAT_FUNCS(ea_inode, EA_INODE)
1676+
EXT4_FEATURE_INCOMPAT_FUNCS(dirdata, DIRDATA)
1677+
EXT4_FEATURE_INCOMPAT_FUNCS(csum_seed, CSUM_SEED)
1678+
EXT4_FEATURE_INCOMPAT_FUNCS(largedir, LARGEDIR)
1679+
EXT4_FEATURE_INCOMPAT_FUNCS(inline_data, INLINE_DATA)
1680+
EXT4_FEATURE_INCOMPAT_FUNCS(encrypt, ENCRYPT)
1681+
15931682
#define EXT2_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR
15941683
#define EXT2_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
15951684
EXT4_FEATURE_INCOMPAT_META_BG)
@@ -1605,7 +1694,7 @@ static inline int ext4_encrypted_inode(struct inode *inode)
16051694
EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
16061695
EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
16071696

1608-
#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
1697+
#define EXT4_FEATURE_COMPAT_SUPP EXT4_FEATURE_COMPAT_EXT_ATTR
16091698
#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
16101699
EXT4_FEATURE_INCOMPAT_RECOVER| \
16111700
EXT4_FEATURE_INCOMPAT_META_BG| \
@@ -1627,6 +1716,40 @@ static inline int ext4_encrypted_inode(struct inode *inode)
16271716
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\
16281717
EXT4_FEATURE_RO_COMPAT_QUOTA)
16291718

1719+
#define EXTN_FEATURE_FUNCS(ver) \
1720+
static inline bool ext4_has_unknown_ext##ver##_compat_features(struct super_block *sb) \
1721+
{ \
1722+
return ((EXT4_SB(sb)->s_es->s_feature_compat & \
1723+
cpu_to_le32(~EXT##ver##_FEATURE_COMPAT_SUPP)) != 0); \
1724+
} \
1725+
static inline bool ext4_has_unknown_ext##ver##_ro_compat_features(struct super_block *sb) \
1726+
{ \
1727+
return ((EXT4_SB(sb)->s_es->s_feature_ro_compat & \
1728+
cpu_to_le32(~EXT##ver##_FEATURE_RO_COMPAT_SUPP)) != 0); \
1729+
} \
1730+
static inline bool ext4_has_unknown_ext##ver##_incompat_features(struct super_block *sb) \
1731+
{ \
1732+
return ((EXT4_SB(sb)->s_es->s_feature_incompat & \
1733+
cpu_to_le32(~EXT##ver##_FEATURE_INCOMPAT_SUPP)) != 0); \
1734+
}
1735+
1736+
EXTN_FEATURE_FUNCS(2)
1737+
EXTN_FEATURE_FUNCS(3)
1738+
EXTN_FEATURE_FUNCS(4)
1739+
1740+
static inline bool ext4_has_compat_features(struct super_block *sb)
1741+
{
1742+
return (EXT4_SB(sb)->s_es->s_feature_compat != 0);
1743+
}
1744+
static inline bool ext4_has_ro_compat_features(struct super_block *sb)
1745+
{
1746+
return (EXT4_SB(sb)->s_es->s_feature_ro_compat != 0);
1747+
}
1748+
static inline bool ext4_has_incompat_features(struct super_block *sb)
1749+
{
1750+
return (EXT4_SB(sb)->s_es->s_feature_incompat != 0);
1751+
}
1752+
16301753
/*
16311754
* Default values for user and/or group using reserved blocks
16321755
*/
@@ -1777,8 +1900,7 @@ static inline __le16 ext4_rec_len_to_disk(unsigned len, unsigned blocksize)
17771900
* (c) Daniel Phillips, 2001
17781901
*/
17791902

1780-
#define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \
1781-
EXT4_FEATURE_COMPAT_DIR_INDEX) && \
1903+
#define is_dx(dir) (ext4_has_feature_dir_index((dir)->i_sb) && \
17821904
ext4_test_inode_flag((dir), EXT4_INODE_INDEX))
17831905
#define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX)
17841906
#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
@@ -2079,7 +2201,7 @@ int ext4_init_crypto(void);
20792201
void ext4_exit_crypto(void);
20802202
static inline int ext4_sb_has_crypto(struct super_block *sb)
20812203
{
2082-
return EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT);
2204+
return ext4_has_feature_encrypt(sb);
20832205
}
20842206
#else
20852207
static inline int ext4_init_crypto(void) { return 0; }
@@ -2200,8 +2322,7 @@ int ext4_insert_dentry(struct inode *dir,
22002322
struct ext4_filename *fname);
22012323
static inline void ext4_update_dx_flag(struct inode *inode)
22022324
{
2203-
if (!EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
2204-
EXT4_FEATURE_COMPAT_DIR_INDEX))
2325+
if (!ext4_has_feature_dir_index(inode->i_sb))
22052326
ext4_clear_inode_flag(inode, EXT4_INODE_INDEX);
22062327
}
22072328
static unsigned char ext4_filetype_table[] = {
@@ -2210,8 +2331,7 @@ static unsigned char ext4_filetype_table[] = {
22102331

22112332
static inline unsigned char get_dtype(struct super_block *sb, int filetype)
22122333
{
2213-
if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FILETYPE) ||
2214-
(filetype >= EXT4_FT_MAX))
2334+
if (!ext4_has_feature_filetype(sb) || filetype >= EXT4_FT_MAX)
22152335
return DT_UNKNOWN;
22162336

22172337
return ext4_filetype_table[filetype];
@@ -2543,15 +2663,13 @@ extern int ext4_register_li_request(struct super_block *sb,
25432663

25442664
static inline int ext4_has_group_desc_csum(struct super_block *sb)
25452665
{
2546-
return EXT4_HAS_RO_COMPAT_FEATURE(sb,
2547-
EXT4_FEATURE_RO_COMPAT_GDT_CSUM) ||
2548-
(EXT4_SB(sb)->s_chksum_driver != NULL);
2666+
return ext4_has_feature_gdt_csum(sb) ||
2667+
EXT4_SB(sb)->s_chksum_driver != NULL;
25492668
}
25502669

25512670
static inline int ext4_has_metadata_csum(struct super_block *sb)
25522671
{
2553-
WARN_ON_ONCE(EXT4_HAS_RO_COMPAT_FEATURE(sb,
2554-
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) &&
2672+
WARN_ON_ONCE(ext4_has_feature_metadata_csum(sb) &&
25552673
!EXT4_SB(sb)->s_chksum_driver);
25562674

25572675
return (EXT4_SB(sb)->s_chksum_driver != NULL);
@@ -2898,7 +3016,7 @@ static unsigned char ext4_type_by_mode[S_IFMT >> S_SHIFT] = {
28983016
static inline void ext4_set_de_type(struct super_block *sb,
28993017
struct ext4_dir_entry_2 *de,
29003018
umode_t mode) {
2901-
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FILETYPE))
3019+
if (ext4_has_feature_filetype(sb))
29023020
de->file_type = ext4_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
29033021
}
29043022

‎fs/ext4/ext4_jbd2.h‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
*/
3535

3636
#define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \
37-
(EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
38-
? 20U : 8U)
37+
(ext4_has_feature_extents(sb) ? 20U : 8U)
3938

4039
/* Extended attribute operations touch at most two data buffers,
4140
* two bitmap buffers, and two group summaries, in addition to the inode
@@ -84,17 +83,16 @@
8483
/* Amount of blocks needed for quota update - we know that the structure was
8584
* allocated so we need to update only data block */
8685
#define EXT4_QUOTA_TRANS_BLOCKS(sb) ((test_opt(sb, QUOTA) ||\
87-
EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) ?\
88-
1 : 0)
86+
ext4_has_feature_quota(sb)) ? 1 : 0)
8987
/* Amount of blocks needed for quota insert/delete - we do some block writes
9088
* but inode, sb and group updates are done only once */
9189
#define EXT4_QUOTA_INIT_BLOCKS(sb) ((test_opt(sb, QUOTA) ||\
92-
EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) ?\
90+
ext4_has_feature_quota(sb)) ?\
9391
(DQUOT_INIT_ALLOC*(EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)\
9492
+3+DQUOT_INIT_REWRITE) : 0)
9593

9694
#define EXT4_QUOTA_DEL_BLOCKS(sb) ((test_opt(sb, QUOTA) ||\
97-
EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) ?\
95+
ext4_has_feature_quota(sb)) ?\
9896
(DQUOT_DEL_ALLOC*(EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)\
9997
+3+DQUOT_DEL_REWRITE) : 0)
10098
#else

‎fs/ext4/extents.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,7 +3055,7 @@ void ext4_ext_init(struct super_block *sb)
30553055
* possible initialization would be here
30563056
*/
30573057

3058-
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
3058+
if (ext4_has_feature_extents(sb)) {
30593059
#if defined(AGGRESSIVE_TEST) || defined(CHECK_BINSEARCH) || defined(EXTENTS_STATS)
30603060
printk(KERN_INFO "EXT4-fs: file extents enabled"
30613061
#ifdef AGGRESSIVE_TEST
@@ -3082,7 +3082,7 @@ void ext4_ext_init(struct super_block *sb)
30823082
*/
30833083
void ext4_ext_release(struct super_block *sb)
30843084
{
3085-
if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
3085+
if (!ext4_has_feature_extents(sb))
30863086
return;
30873087

30883088
#ifdef EXTENTS_STATS

‎fs/ext4/ialloc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
10451045

10461046
ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize;
10471047
ei->i_inline_off = 0;
1048-
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_INLINE_DATA))
1048+
if (ext4_has_feature_inline_data(sb))
10491049
ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
10501050
ret = inode;
10511051
err = dquot_alloc_inode(inode);
@@ -1060,7 +1060,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
10601060
if (err)
10611061
goto fail_free_drop;
10621062

1063-
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
1063+
if (ext4_has_feature_extents(sb)) {
10641064
/* set extent flag only for directory, file and normal symlink*/
10651065
if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
10661066
ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS);

‎fs/ext4/indirect.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
562562
/*
563563
* Okay, we need to do block allocation.
564564
*/
565-
if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb,
566-
EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {
565+
if (ext4_has_feature_bigalloc(inode->i_sb)) {
567566
EXT4_ERROR_INODE(inode, "Can't allocate blocks for "
568567
"non-extent mapped inodes with bigalloc");
569568
return -EFSCORRUPTED;

‎fs/ext4/inline.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle,
434434
memset((void *)ext4_raw_inode(&is.iloc)->i_block,
435435
0, EXT4_MIN_INLINE_DATA_SIZE);
436436

437-
if (EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
438-
EXT4_FEATURE_INCOMPAT_EXTENTS)) {
437+
if (ext4_has_feature_extents(inode->i_sb)) {
439438
if (S_ISDIR(inode->i_mode) ||
440439
S_ISREG(inode->i_mode) || S_ISLNK(inode->i_mode)) {
441440
ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS);

0 commit comments

Comments
 (0)