shithub: lwext4

Download patch

ref: e0099ab67ad94cce497c1a04da78511344dafc31
parent: cfc7b2cf39210f7c38b6d42fb4fc678576499343
author: gkostka <kostka.grzegorz@gmail.com>
date: Tue Oct 27 16:34:37 EDT 2015

Refactoring superblock features getters

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -201,8 +201,7 @@
 
 #if CONFIG_DIR_INDEX_ENABLE
 		/* Initialize directory index if supported */
-		if (ext4_sb_has_feature_compatible(
-			&mp->fs.sb, EXT4_FCOM_DIR_INDEX)) {
+		if (ext4_sb_feature_com(&mp->fs.sb, EXT4_FCOM_DIR_INDEX)) {
 			rc = ext4_dir_dx_init(child, parent);
 			if (rc != EOK)
 				return rc;
--- a/lwext4/ext4_balloc.c
+++ b/lwext4/ext4_balloc.c
@@ -82,8 +82,7 @@
 					void *bitmap)
 {
 	uint32_t checksum = 0;
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		uint32_t blocks_per_group =
 			ext4_get32(sb, blocks_per_group);
 
@@ -196,8 +195,7 @@
 	uint32_t block_group_last =
 	    ext4_balloc_get_bgid_of_block(sb, first + count - 1);
 
-	if (!ext4_sb_has_feature_incompatible(sb,
-					      EXT4_FINCOM_FLEX_BG)) {
+	if (!ext4_sb_feature_incom(sb, EXT4_FINCOM_FLEX_BG)) {
 		/*It is not possible without flex_bg that blocks are continuous
 		 * and and last block belongs to other bg.*/
 		ext4_assert(block_group_first == ext4_balloc_get_bgid_of_block(
--- a/lwext4/ext4_dir.c
+++ b/lwext4/ext4_dir.c
@@ -99,8 +99,7 @@
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
 
 	/* Compute the checksum only if the filesystem supports it */
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		t = ext4_dir_get_tail(inode_ref, dirent);
 		if (!t) {
 			/* There is no space to hold the checksum */
@@ -130,8 +129,7 @@
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
 
 	/* Compute the checksum only if the filesystem supports it */
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		t = ext4_dir_get_tail(inode_ref, dirent);
 		if (!t) {
 			/* There is no space to hold the checksum */
@@ -337,8 +335,7 @@
 
 #if CONFIG_DIR_INDEX_ENABLE
 	/* Index adding (if allowed) */
-	if ((ext4_sb_has_feature_compatible(&fs->sb,
-					    EXT4_FCOM_DIR_INDEX)) &&
+	if ((ext4_sb_feature_com(&fs->sb, EXT4_FCOM_DIR_INDEX)) &&
 	    (ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX))) {
 		int rc = ext4_dir_dx_add_entry(parent, child, name);
 
@@ -412,8 +409,7 @@
 	struct ext4_directory_entry_ll *block_entry = (void *)new_block.data;
 
 	/* Save new block */
-	if (ext4_sb_has_feature_read_only(&fs->sb,
-					  EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(&fs->sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		ext4_dir_write_entry(&fs->sb, block_entry,
 				block_size - sizeof(struct ext4_directory_entry_tail),
 				child,
@@ -440,8 +436,7 @@
 
 #if CONFIG_DIR_INDEX_ENABLE
 	/* Index search */
-	if ((ext4_sb_has_feature_compatible(sb,
-					    EXT4_FCOM_DIR_INDEX)) &&
+	if ((ext4_sb_feature_com(sb, EXT4_FCOM_DIR_INDEX)) &&
 	    (ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX))) {
 		int rc = ext4_dir_dx_find_entry(result, parent, name_len, name);
 
--- a/lwext4/ext4_dir_idx.c
+++ b/lwext4/ext4_dir_idx.c
@@ -214,8 +214,7 @@
 	int size;
 
 	/* Compute the checksum only if the filesystem supports it */
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		uint32_t ino_index = to_le32(inode_ref->index);
 		uint32_t ino_gen =
 			to_le32(ext4_inode_get_generation(inode_ref->inode));
@@ -284,8 +283,7 @@
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
 	int count_offset, limit, count;
 
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		struct ext4_directory_dx_countlimit *countlimit =
 			ext4_dir_dx_get_countlimit(inode_ref, dirent, &count_offset);
 		if (!countlimit) {
@@ -320,8 +318,7 @@
 	int count_offset, limit, count;
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
 
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		struct ext4_directory_dx_countlimit *countlimit =
 			ext4_dir_dx_get_countlimit(inode_ref, dirent, &count_offset);
 		if (!countlimit) {
@@ -398,8 +395,7 @@
 	uint32_t entry_space = block_size -
 			       2 * sizeof(struct ext4_directory_dx_dot_entry) -
 			       sizeof(struct ext4_directory_dx_root_info);
-	if (ext4_sb_has_feature_read_only(sb,
-					  EXT4_FRO_COM_METADATA_CSUM))
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
 		entry_space -= sizeof(struct ext4_directory_dx_tail);
 
 	uint16_t root_limit =
@@ -425,8 +421,7 @@
 	/* Fill the whole block with empty entry */
 	struct ext4_directory_entry_ll *block_entry = (void *)new_block.data;
 
-	if (ext4_sb_has_feature_read_only(sb,
-					  EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		ext4_dir_entry_ll_set_entry_length(block_entry,
 				block_size -
 				sizeof(struct ext4_directory_entry_tail));
@@ -499,8 +494,7 @@
 	uint32_t entry_space = block_size;
 	entry_space -= 2 * sizeof(struct ext4_directory_dx_dot_entry);
 	entry_space -= sizeof(struct ext4_directory_dx_root_info);
-	if (ext4_sb_has_feature_read_only(sb,
-					  EXT4_FRO_COM_METADATA_CSUM))
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
 		entry_space -= sizeof(struct ext4_directory_dx_tail);
 	entry_space = entry_space / sizeof(struct ext4_directory_dx_entry);
 
@@ -618,8 +612,8 @@
 		    ext4_sb_get_block_size(&inode_ref->fs->sb) -
 		    sizeof(struct ext4_fake_directory_entry);
 
-		if (ext4_sb_has_feature_read_only(&inode_ref->fs->sb,
-						  EXT4_FRO_COM_METADATA_CSUM))
+		if (ext4_sb_feature_ro_com(&inode_ref->fs->sb,
+				EXT4_FRO_COM_METADATA_CSUM))
 			entry_space -= sizeof(struct ext4_directory_dx_tail);
 
 		entry_space =
@@ -1039,9 +1033,8 @@
 
 	uint32_t offset = 0;
 	void *ptr;
-
-	if (ext4_sb_has_feature_read_only(&inode_ref->fs->sb,
-					  EXT4_FRO_COM_METADATA_CSUM))
+	struct ext4_sblock *sb = &inode_ref->fs->sb;
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
 		block_size -= sizeof(struct ext4_directory_entry_tail);
 
 	/* First part - to the old block */
@@ -1080,8 +1073,8 @@
 	block_size = ext4_sb_get_block_size(&inode_ref->fs->sb);
 
 	/* Do some steps to finish operation */
-	if (ext4_sb_has_feature_read_only(&inode_ref->fs->sb,
-					  EXT4_FRO_COM_METADATA_CSUM)) {
+	sb = &inode_ref->fs->sb;
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		initialize_dir_tail(EXT4_DIRENT_TAIL(old_data_block->data,
 					block_size));
 		initialize_dir_tail(EXT4_DIRENT_TAIL(new_data_block_tmp.data,
@@ -1209,12 +1202,11 @@
 			uint32_t entry_space =
 			    block_size -
 			    sizeof(struct ext4_fake_directory_entry);
-			if (ext4_sb_has_feature_read_only(sb,
-							  EXT4_FRO_COM_METADATA_CSUM))
+			if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
 				entry_space -= sizeof(struct ext4_directory_dx_tail);
+
 			uint32_t node_limit =
-			    entry_space /
-			    sizeof(struct ext4_directory_dx_entry);
+			    entry_space / sizeof(struct ext4_directory_dx_entry);
 
 			ext4_dir_dx_countlimit_set_limit(right_countlimit,
 							 node_limit);
@@ -1272,12 +1264,11 @@
 			uint32_t entry_space =
 			    block_size -
 			    sizeof(struct ext4_fake_directory_entry);
-			if (ext4_sb_has_feature_read_only(sb,
-							  EXT4_FRO_COM_METADATA_CSUM))
+			if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
 				entry_space -= sizeof(struct ext4_directory_dx_tail);
+
 			uint32_t node_limit =
-			    entry_space /
-			    sizeof(struct ext4_directory_dx_entry);
+			    entry_space / sizeof(struct ext4_directory_dx_entry);
 			ext4_dir_dx_countlimit_set_limit(new_countlimit,
 							 node_limit);
 
--- a/lwext4/ext4_extent_full.c
+++ b/lwext4/ext4_extent_full.c
@@ -315,8 +315,7 @@
 	uint32_t checksum = 0;
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
 
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		uint32_t ino_index = to_le32(inode_ref->index);
 		uint32_t ino_gen =
 			to_le32(ext4_inode_get_generation(inode_ref->inode));
@@ -409,8 +408,8 @@
 	}
 
 	tail = find_ext4_extent_tail(eh);
-	if (ext4_sb_has_feature_read_only(&inode_ref->fs->sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	struct ext4_sblock *sb = &inode_ref->fs->sb;
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		if (tail->et_checksum != to_le32(ext4_ext_block_csum(inode_ref, eh))) {
 			/* FIXME: Warning: extent checksum damaged? */
 		}
--- a/lwext4/ext4_fs.c
+++ b/lwext4/ext4_fs.c
@@ -300,8 +300,7 @@
 	    ext4_sb_get_desc_size(&bg_ref->fs->sb);
 
 	bool flex_bg =
-		ext4_sb_has_feature_incompatible(&bg_ref->fs->sb,
-						 EXT4_FINCOM_FLEX_BG);
+		ext4_sb_feature_incom(&bg_ref->fs->sb, EXT4_FINCOM_FLEX_BG);
 
 	uint32_t inode_table_bcnt = inodes_per_group * inode_size / block_size;
 
@@ -314,8 +313,7 @@
 	memset(block_bitmap.data, 0, block_size);
 
 	bit_max = ext4_sb_is_super_in_bg(&bg_ref->fs->sb, bg_ref->index);
-	if (!ext4_sb_has_feature_incompatible(&bg_ref->fs->sb,
-					      EXT4_FINCOM_META_BG) ||
+	if (!ext4_sb_feature_incom(&bg_ref->fs->sb, EXT4_FINCOM_META_BG) ||
 			bg_ref->index < ext4_sb_first_meta_bg(&bg_ref->fs->sb) *
 			dsc_per_block) {
 		if (bit_max) {
@@ -481,8 +479,7 @@
 	dsc_id = bgid / dsc_per_block;
 	first_meta_bg = ext4_sb_first_meta_bg(s);
 
-	if (!ext4_sb_has_feature_incompatible(s,
-					      EXT4_FINCOM_META_BG) ||
+	if (!ext4_sb_feature_incom(s, EXT4_FINCOM_META_BG) ||
 	    dsc_id < first_meta_bg)
 		return ext4_get32(s, first_data_block) + dsc_id + 1;
 
@@ -575,8 +572,7 @@
 	uint16_t crc = 0;
 
 	/* Compute the checksum only if the filesystem supports it */
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		/* Use metadata_csum algorithm instead */
 		uint32_t le32_bgid = to_le32(bgid);
 		uint32_t orig_checksum, checksum;
@@ -596,8 +592,7 @@
 		bg->checksum = orig_checksum;
 
 		crc = checksum & 0xFFFF;
-	} else if (ext4_sb_has_feature_read_only(sb,
-					EXT4_FRO_COM_GDT_CSUM)) {
+	} else if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_GDT_CSUM)) {
 		uint8_t *base = (uint8_t *)bg;
 		uint8_t *checksum = (uint8_t *)&bg->checksum;
 
@@ -621,8 +616,7 @@
 		offset += sizeof(bg->checksum);
 
 		/* Checksum of the rest of block group descriptor */
-		if ((ext4_sb_has_feature_incompatible(
-			sb, EXT4_FINCOM_64BIT)) &&
+		if ((ext4_sb_feature_incom(sb, EXT4_FINCOM_64BIT)) &&
 		    (offset < ext4_sb_get_desc_size(sb)))
 
 			crc = ext4_bg_crc16(crc, ((uint8_t *)bg) + offset,
@@ -655,8 +649,7 @@
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
 	uint16_t inode_size = ext4_get16(sb, inode_size);
 
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		uint32_t orig_checksum;
 
 		uint32_t ino_index = to_le32(inode_ref->index);
@@ -688,8 +681,7 @@
 static void ext4_fs_set_inode_checksum(struct ext4_inode_ref *inode_ref)
 {
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
-	if (!ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM))
+	if (!ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
 		return;
 
 	ext4_inode_set_checksum(sb, inode_ref->inode,
@@ -778,8 +770,7 @@
 	(void)fs;
 #if CONFIG_EXTENT_ENABLE
 	/* Initialize extents if needed */
-	if (ext4_sb_has_feature_incompatible(&fs->sb,
-				EXT4_FINCOM_EXTENTS)) {
+	if (ext4_sb_feature_incom(&fs->sb, EXT4_FINCOM_EXTENTS)) {
 		ext4_inode_set_flag(inode, EXT4_INODE_FLAG_EXTENTS);
 
 		/* Initialize extent root header */
@@ -889,8 +880,7 @@
 	int rc;
 #if CONFIG_EXTENT_ENABLE
 	/* For extents must be data block destroyed by other way */
-	if ((ext4_sb_has_feature_incompatible(&fs->sb,
-					      EXT4_FINCOM_EXTENTS)) &&
+	if ((ext4_sb_feature_incom(&fs->sb, EXT4_FINCOM_EXTENTS)) &&
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
 		/* Data structures are released during truncate operation... */
 		goto finish;
@@ -1037,8 +1027,7 @@
 	/* Extents are handled otherwise = there is not support in this function
 	 */
 	ext4_assert(!(
-	    ext4_sb_has_feature_incompatible(&fs->sb,
-					     EXT4_FINCOM_EXTENTS) &&
+	    ext4_sb_feature_incom(&fs->sb, EXT4_FINCOM_EXTENTS) &&
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))));
 
 	struct ext4_inode *inode = inode_ref->inode;
@@ -1166,8 +1155,7 @@
 				    block_size;
 	uint32_t diff_blocks_count = old_blocks_count - new_blocks_count;
 #if CONFIG_EXTENT_ENABLE
-	if ((ext4_sb_has_feature_incompatible(sb,
-					      EXT4_FINCOM_EXTENTS)) &&
+	if ((ext4_sb_feature_incom(sb, EXT4_FINCOM_EXTENTS)) &&
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
 
 		/* Extents require special operation */
@@ -1305,8 +1293,7 @@
 	(void)extent_create;
 #if CONFIG_EXTENT_ENABLE
 	/* Handle i-node using extents */
-	if ((ext4_sb_has_feature_incompatible(&fs->sb,
-					      EXT4_FINCOM_EXTENTS)) &&
+	if ((ext4_sb_feature_incom(&fs->sb, EXT4_FINCOM_EXTENTS)) &&
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
 
 		ext4_fsblk_t current_fsblk;
@@ -1428,8 +1415,7 @@
 
 #if CONFIG_EXTENT_ENABLE
 	/* Handle inode using extents */
-	if ((ext4_sb_has_feature_incompatible(&fs->sb,
-					      EXT4_FINCOM_EXTENTS)) &&
+	if ((ext4_sb_feature_incom(&fs->sb, EXT4_FINCOM_EXTENTS)) &&
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
 		/* Not reachable */
 		return ENOTSUP;
@@ -1600,8 +1586,7 @@
 {
 #if CONFIG_EXTENT_ENABLE
 	/* Handle extents separately */
-	if ((ext4_sb_has_feature_incompatible(&inode_ref->fs->sb,
-					      EXT4_FINCOM_EXTENTS)) &&
+	if ((ext4_sb_feature_incom(&inode_ref->fs->sb, EXT4_FINCOM_EXTENTS)) &&
 	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
 		int rc;
 		ext4_fsblk_t current_fsblk;
@@ -1676,8 +1661,7 @@
 	ext4_inode_set_links_count(inode_ref->inode, link);
 
 	bool is_dx =
-	    ext4_sb_has_feature_compatible(&inode_ref->fs->sb,
-					   EXT4_FCOM_DIR_INDEX) &&
+	    ext4_sb_feature_com(&inode_ref->fs->sb, EXT4_FCOM_DIR_INDEX) &&
 	    ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_INDEX);
 
 	if (is_dx && link > 1) {
--- a/lwext4/ext4_ialloc.c
+++ b/lwext4/ext4_ialloc.c
@@ -90,8 +90,7 @@
 					void *bitmap)
 {
 	uint32_t checksum = 0;
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		uint32_t inodes_per_group =
 			ext4_get32(sb, inodes_per_group);
 
--- a/lwext4/ext4_inode.c
+++ b/lwext4/ext4_inode.c
@@ -194,8 +194,7 @@
 {
 	uint64_t count = to_le32(inode->blocks_count_lo);
 
-	if (ext4_sb_has_feature_read_only(sb,
-					  EXT4_FRO_COM_HUGE_FILE)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_HUGE_FILE)) {
 
 		/* 48-bit field */
 		count |= ((uint64_t)to_le16(inode->osd2.linux2.blocks_high))
@@ -228,8 +227,7 @@
 	}
 
 	/* Check if there can be used huge files (many blocks) */
-	if (!ext4_sb_has_feature_read_only(sb,
-					   EXT4_FRO_COM_HUGE_FILE))
+	if (!ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_HUGE_FILE))
 		return EINVAL;
 
 	/* 48-bit maximum */
--- a/lwext4/ext4_super.c
+++ b/lwext4/ext4_super.c
@@ -88,8 +88,7 @@
 
 static bool ext4_sb_verify_csum(struct ext4_sblock *s)
 {
-	if (!ext4_sb_has_feature_read_only(s,
-					   EXT4_FRO_COM_METADATA_CSUM))
+	if (!ext4_sb_feature_ro_com(s, EXT4_FRO_COM_METADATA_CSUM))
 		return true;
 
 	if (s->checksum_type != to_le32(EXT4_CHECKSUM_CRC32C))
@@ -100,8 +99,7 @@
 
 static void ext4_sb_set_csum(struct ext4_sblock *s)
 {
-	if (!ext4_sb_has_feature_read_only(s,
-					   EXT4_FRO_COM_METADATA_CSUM))
+	if (!ext4_sb_feature_ro_com(s, EXT4_FRO_COM_METADATA_CSUM))
 		return;
 
 	s->checksum = to_le32(ext4_sb_csum(s));
@@ -182,8 +180,7 @@
 
 bool ext4_sb_is_super_in_bg(struct ext4_sblock *s, uint32_t group)
 {
-	if (ext4_sb_has_feature_read_only(
-		s, EXT4_FRO_COM_SPARSE_SUPER) &&
+	if (ext4_sb_feature_ro_com(s, EXT4_FRO_COM_SPARSE_SUPER) &&
 	    !ext4_sb_sparse(group))
 		return false;
 	return true;
@@ -213,7 +210,7 @@
 	uint32_t db_count =
 	    (ext4_block_group_cnt(s) + dsc_per_block - 1) / dsc_per_block;
 
-	if (ext4_sb_has_feature_incompatible(s, EXT4_FINCOM_META_BG))
+	if (ext4_sb_feature_incom(s, EXT4_FINCOM_META_BG))
 		return ext4_sb_first_meta_bg(s);
 
 	return db_count;
@@ -226,8 +223,7 @@
 	uint32_t first_meta_bg = ext4_sb_first_meta_bg(s);
 	uint32_t metagroup = group / dsc_per_block;
 
-	if (!ext4_sb_has_feature_incompatible(s,
-					      EXT4_FINCOM_META_BG) ||
+	if (!ext4_sb_feature_incom(s,EXT4_FINCOM_META_BG) ||
 	    metagroup < first_meta_bg)
 		return ext4_bg_num_gdb_nometa(s, group);
 
@@ -243,8 +239,7 @@
 
 	num = ext4_sb_is_super_in_bg(s, block_group);
 
-	if (!ext4_sb_has_feature_incompatible(s,
-					      EXT4_FINCOM_META_BG) ||
+	if (!ext4_sb_feature_incom(s, EXT4_FINCOM_META_BG) ||
 	    block_group < ext4_sb_first_meta_bg(s) * dsc_per_block) {
 		if (num) {
 			num += ext4_bg_num_gdb(s, block_group);
--- a/lwext4/ext4_super.h
+++ b/lwext4/ext4_super.h
@@ -108,8 +108,7 @@
  * @param   s superblock descriptor
  * @param   v feature to check
  * @return  true if feature is supported*/
-static inline bool ext4_sb_has_feature_compatible(struct ext4_sblock *s,
-						  uint32_t v)
+static inline bool ext4_sb_feature_com(struct ext4_sblock *s, uint32_t v)
 {
 	return to_le32(s->features_compatible) & v;
 }
@@ -118,8 +117,7 @@
  * @param   s superblock descriptor
  * @param   v feature to check
  * @return  true if feature is supported*/
-static inline bool ext4_sb_has_feature_incompatible(struct ext4_sblock *s,
-						    uint32_t v)
+static inline bool ext4_sb_feature_incom(struct ext4_sblock *s, uint32_t v)
 {
 	return to_le32(s->features_incompatible) & v;
 }
@@ -128,8 +126,7 @@
  * @param   s superblock descriptor
  * @param   v flag to check
  * @return  true if flag is supported*/
-static inline bool ext4_sb_has_feature_read_only(struct ext4_sblock *s,
-						 uint32_t v)
+static inline bool ext4_sb_feature_ro_com(struct ext4_sblock *s, uint32_t v)
 {
 	return to_le32(s->features_read_only) & v;
 }
--- a/lwext4/ext4_xattr.c
+++ b/lwext4/ext4_xattr.c
@@ -121,8 +121,7 @@
 	uint64_t le64_blocknr = blocknr;
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
 
-	if (ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM)) {
+	if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
 		uint32_t orig_checksum;
 
 		/* Preparation: temporarily set bg checksum to 0 */
@@ -148,8 +147,7 @@
 			      struct ext4_xattr_header *header)
 {
 	struct ext4_sblock *sb = &inode_ref->fs->sb;
-	if (!ext4_sb_has_feature_read_only(sb,
-				EXT4_FRO_COM_METADATA_CSUM))
+	if (!ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM))
 		return;
 
 	header->h_checksum =