@@ -124,8 +124,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
124124 "directory leaf block found instead of index block" );
125125 return ERR_PTR (- EIO );
126126 }
127- if (!EXT4_HAS_RO_COMPAT_FEATURE (inode -> i_sb ,
128- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ) ||
127+ if (!ext4_has_metadata_csum (inode -> i_sb ) ||
129128 buffer_verified (bh ))
130129 return bh ;
131130
@@ -338,8 +337,7 @@ int ext4_dirent_csum_verify(struct inode *inode, struct ext4_dir_entry *dirent)
338337{
339338 struct ext4_dir_entry_tail * t ;
340339
341- if (!EXT4_HAS_RO_COMPAT_FEATURE (inode -> i_sb ,
342- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
340+ if (!ext4_has_metadata_csum (inode -> i_sb ))
343341 return 1 ;
344342
345343 t = get_dirent_tail (inode , dirent );
@@ -360,8 +358,7 @@ static void ext4_dirent_csum_set(struct inode *inode,
360358{
361359 struct ext4_dir_entry_tail * t ;
362360
363- if (!EXT4_HAS_RO_COMPAT_FEATURE (inode -> i_sb ,
364- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
361+ if (!ext4_has_metadata_csum (inode -> i_sb ))
365362 return ;
366363
367364 t = get_dirent_tail (inode , dirent );
@@ -436,8 +433,7 @@ static int ext4_dx_csum_verify(struct inode *inode,
436433 struct dx_tail * t ;
437434 int count_offset , limit , count ;
438435
439- if (!EXT4_HAS_RO_COMPAT_FEATURE (inode -> i_sb ,
440- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
436+ if (!ext4_has_metadata_csum (inode -> i_sb ))
441437 return 1 ;
442438
443439 c = get_dx_countlimit (inode , dirent , & count_offset );
@@ -466,8 +462,7 @@ static void ext4_dx_csum_set(struct inode *inode, struct ext4_dir_entry *dirent)
466462 struct dx_tail * t ;
467463 int count_offset , limit , count ;
468464
469- if (!EXT4_HAS_RO_COMPAT_FEATURE (inode -> i_sb ,
470- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
465+ if (!ext4_has_metadata_csum (inode -> i_sb ))
471466 return ;
472467
473468 c = get_dx_countlimit (inode , dirent , & count_offset );
@@ -555,8 +550,7 @@ static inline unsigned dx_root_limit(struct inode *dir, unsigned infosize)
555550 unsigned entry_space = dir -> i_sb -> s_blocksize - EXT4_DIR_REC_LEN (1 ) -
556551 EXT4_DIR_REC_LEN (2 ) - infosize ;
557552
558- if (EXT4_HAS_RO_COMPAT_FEATURE (dir -> i_sb ,
559- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
553+ if (ext4_has_metadata_csum (dir -> i_sb ))
560554 entry_space -= sizeof (struct dx_tail );
561555 return entry_space / sizeof (struct dx_entry );
562556}
@@ -565,8 +559,7 @@ static inline unsigned dx_node_limit(struct inode *dir)
565559{
566560 unsigned entry_space = dir -> i_sb -> s_blocksize - EXT4_DIR_REC_LEN (0 );
567561
568- if (EXT4_HAS_RO_COMPAT_FEATURE (dir -> i_sb ,
569- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
562+ if (ext4_has_metadata_csum (dir -> i_sb ))
570563 entry_space -= sizeof (struct dx_tail );
571564 return entry_space / sizeof (struct dx_entry );
572565}
@@ -1524,8 +1517,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
15241517 int csum_size = 0 ;
15251518 int err = 0 , i ;
15261519
1527- if (EXT4_HAS_RO_COMPAT_FEATURE (dir -> i_sb ,
1528- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
1520+ if (ext4_has_metadata_csum (dir -> i_sb ))
15291521 csum_size = sizeof (struct ext4_dir_entry_tail );
15301522
15311523 bh2 = ext4_append (handle , dir , & newblock );
@@ -1691,8 +1683,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
16911683 int csum_size = 0 ;
16921684 int err ;
16931685
1694- if (EXT4_HAS_RO_COMPAT_FEATURE (inode -> i_sb ,
1695- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
1686+ if (ext4_has_metadata_csum (inode -> i_sb ))
16961687 csum_size = sizeof (struct ext4_dir_entry_tail );
16971688
16981689 if (!de ) {
@@ -1759,8 +1750,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
17591750 struct fake_dirent * fde ;
17601751 int csum_size = 0 ;
17611752
1762- if (EXT4_HAS_RO_COMPAT_FEATURE (inode -> i_sb ,
1763- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
1753+ if (ext4_has_metadata_csum (inode -> i_sb ))
17641754 csum_size = sizeof (struct ext4_dir_entry_tail );
17651755
17661756 blocksize = dir -> i_sb -> s_blocksize ;
@@ -1877,8 +1867,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
18771867 ext4_lblk_t block , blocks ;
18781868 int csum_size = 0 ;
18791869
1880- if (EXT4_HAS_RO_COMPAT_FEATURE (inode -> i_sb ,
1881- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
1870+ if (ext4_has_metadata_csum (inode -> i_sb ))
18821871 csum_size = sizeof (struct ext4_dir_entry_tail );
18831872
18841873 sb = dir -> i_sb ;
@@ -2142,8 +2131,7 @@ static int ext4_delete_entry(handle_t *handle,
21422131 return err ;
21432132 }
21442133
2145- if (EXT4_HAS_RO_COMPAT_FEATURE (dir -> i_sb ,
2146- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
2134+ if (ext4_has_metadata_csum (dir -> i_sb ))
21472135 csum_size = sizeof (struct ext4_dir_entry_tail );
21482136
21492137 BUFFER_TRACE (bh , "get_write_access" );
@@ -2362,8 +2350,7 @@ static int ext4_init_new_dir(handle_t *handle, struct inode *dir,
23622350 int csum_size = 0 ;
23632351 int err ;
23642352
2365- if (EXT4_HAS_RO_COMPAT_FEATURE (dir -> i_sb ,
2366- EXT4_FEATURE_RO_COMPAT_METADATA_CSUM ))
2353+ if (ext4_has_metadata_csum (dir -> i_sb ))
23672354 csum_size = sizeof (struct ext4_dir_entry_tail );
23682355
23692356 if (ext4_test_inode_state (inode , EXT4_STATE_MAY_INLINE_DATA )) {
0 commit comments