ref: 7879c285ab00cf261988b46638fe347b39cb142e
parent: c3ad7832038f84531ff13bd964fce2b8981237d9
author: gkostka <[email protected]>
date: Tue Oct 27 16:02:13 EDT 2015
Refactor FEATURE_INCOMPAT to FINCOM
--- a/lwext4/ext4_balloc.c
+++ b/lwext4/ext4_balloc.c
@@ -197,7 +197,7 @@
ext4_balloc_get_bgid_of_block(sb, first + count - 1);
if (!ext4_sb_has_feature_incompatible(sb,
- EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
+ 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_fs.c
+++ b/lwext4/ext4_fs.c
@@ -128,33 +128,33 @@
static void ext4_fs_debug_features_inc(uint32_t features_incompatible)
{
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_COMPRESSION)
+ if (features_incompatible & EXT4_FINCOM_COMPRESSION)
ext4_dbg(DEBUG_FS, DBG_NONE "compression\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_FILETYPE)
+ if (features_incompatible & EXT4_FINCOM_FILETYPE)
ext4_dbg(DEBUG_FS, DBG_NONE "filetype\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_RECOVER)
+ if (features_incompatible & EXT4_FINCOM_RECOVER)
ext4_dbg(DEBUG_FS, DBG_NONE "recover\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_JOURNAL_DEV)
+ if (features_incompatible & EXT4_FINCOM_JOURNAL_DEV)
ext4_dbg(DEBUG_FS, DBG_NONE "journal_dev\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_META_BG)
+ if (features_incompatible & EXT4_FINCOM_META_BG)
ext4_dbg(DEBUG_FS, DBG_NONE "meta_bg\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_EXTENTS)
+ if (features_incompatible & EXT4_FINCOM_EXTENTS)
ext4_dbg(DEBUG_FS, DBG_NONE "extents\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_64BIT)
+ if (features_incompatible & EXT4_FINCOM_64BIT)
ext4_dbg(DEBUG_FS, DBG_NONE "64bit\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_MMP)
+ if (features_incompatible & EXT4_FINCOM_MMP)
ext4_dbg(DEBUG_FS, DBG_NONE "mnp\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_FLEX_BG)
+ if (features_incompatible & EXT4_FINCOM_FLEX_BG)
ext4_dbg(DEBUG_FS, DBG_NONE "flex_bg\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_EA_INODE)
+ if (features_incompatible & EXT4_FINCOM_EA_INODE)
ext4_dbg(DEBUG_FS, DBG_NONE "ea_inode\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_DIRDATA)
+ if (features_incompatible & EXT4_FINCOM_DIRDATA)
ext4_dbg(DEBUG_FS, DBG_NONE "dirdata\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM)
+ if (features_incompatible & EXT4_FINCOM_BG_USE_META_CSUM)
ext4_dbg(DEBUG_FS, DBG_NONE "meta_csum\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_LARGEDIR)
+ if (features_incompatible & EXT4_FINCOM_LARGEDIR)
ext4_dbg(DEBUG_FS, DBG_NONE "largedir\n");
- if (features_incompatible & EXT4_FEATURE_INCOMPAT_INLINE_DATA)
+ if (features_incompatible & EXT4_FINCOM_INLINE_DATA)
ext4_dbg(DEBUG_FS, DBG_NONE "inline_data\n");
}
static void ext4_fs_debug_features_comp(uint32_t features_compatible)
@@ -301,7 +301,7 @@
bool flex_bg =
ext4_sb_has_feature_incompatible(&bg_ref->fs->sb,
- EXT4_FEATURE_INCOMPAT_FLEX_BG);
+ EXT4_FINCOM_FLEX_BG);
uint32_t inode_table_bcnt = inodes_per_group * inode_size / block_size;
@@ -315,7 +315,7 @@
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_FEATURE_INCOMPAT_META_BG) ||
+ EXT4_FINCOM_META_BG) ||
bg_ref->index < ext4_sb_first_meta_bg(&bg_ref->fs->sb) *
dsc_per_block) {
if (bit_max) {
@@ -482,7 +482,7 @@
first_meta_bg = ext4_sb_first_meta_bg(s);
if (!ext4_sb_has_feature_incompatible(s,
- EXT4_FEATURE_INCOMPAT_META_BG) ||
+ EXT4_FINCOM_META_BG) ||
dsc_id < first_meta_bg)
return ext4_get32(s, first_data_block) + dsc_id + 1;
@@ -622,7 +622,7 @@
/* Checksum of the rest of block group descriptor */
if ((ext4_sb_has_feature_incompatible(
- sb, EXT4_FEATURE_INCOMPAT_64BIT)) &&
+ sb, EXT4_FINCOM_64BIT)) &&
(offset < ext4_sb_get_desc_size(sb)))
crc = ext4_bg_crc16(crc, ((uint8_t *)bg) + offset,
@@ -779,7 +779,7 @@
#if CONFIG_EXTENT_ENABLE
/* Initialize extents if needed */
if (ext4_sb_has_feature_incompatible(&fs->sb,
- EXT4_FEATURE_INCOMPAT_EXTENTS)) {
+ EXT4_FINCOM_EXTENTS)) {
ext4_inode_set_flag(inode, EXT4_INODE_FLAG_EXTENTS);
/* Initialize extent root header */
@@ -890,7 +890,7 @@
#if CONFIG_EXTENT_ENABLE
/* For extents must be data block destroyed by other way */
if ((ext4_sb_has_feature_incompatible(&fs->sb,
- EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
+ EXT4_FINCOM_EXTENTS)) &&
(ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
/* Data structures are released during truncate operation... */
goto finish;
@@ -1038,7 +1038,7 @@
*/
ext4_assert(!(
ext4_sb_has_feature_incompatible(&fs->sb,
- EXT4_FEATURE_INCOMPAT_EXTENTS) &&
+ EXT4_FINCOM_EXTENTS) &&
(ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))));
struct ext4_inode *inode = inode_ref->inode;
@@ -1167,7 +1167,7 @@
uint32_t diff_blocks_count = old_blocks_count - new_blocks_count;
#if CONFIG_EXTENT_ENABLE
if ((ext4_sb_has_feature_incompatible(sb,
- EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
+ EXT4_FINCOM_EXTENTS)) &&
(ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
/* Extents require special operation */
@@ -1306,7 +1306,7 @@
#if CONFIG_EXTENT_ENABLE
/* Handle i-node using extents */
if ((ext4_sb_has_feature_incompatible(&fs->sb,
- EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
+ EXT4_FINCOM_EXTENTS)) &&
(ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
ext4_fsblk_t current_fsblk;
@@ -1429,7 +1429,7 @@
#if CONFIG_EXTENT_ENABLE
/* Handle inode using extents */
if ((ext4_sb_has_feature_incompatible(&fs->sb,
- EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
+ EXT4_FINCOM_EXTENTS)) &&
(ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
/* Not reachable */
return ENOTSUP;
@@ -1601,7 +1601,7 @@
#if CONFIG_EXTENT_ENABLE
/* Handle extents separately */
if ((ext4_sb_has_feature_incompatible(&inode_ref->fs->sb,
- EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
+ EXT4_FINCOM_EXTENTS)) &&
(ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
int rc;
ext4_fsblk_t current_fsblk;
--- a/lwext4/ext4_super.c
+++ b/lwext4/ext4_super.c
@@ -213,7 +213,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_FEATURE_INCOMPAT_META_BG))
+ if (ext4_sb_has_feature_incompatible(s, EXT4_FINCOM_META_BG))
return ext4_sb_first_meta_bg(s);
return db_count;
@@ -227,7 +227,7 @@
uint32_t metagroup = group / dsc_per_block;
if (!ext4_sb_has_feature_incompatible(s,
- EXT4_FEATURE_INCOMPAT_META_BG) ||
+ EXT4_FINCOM_META_BG) ||
metagroup < first_meta_bg)
return ext4_bg_num_gdb_nometa(s, group);
@@ -244,7 +244,7 @@
num = ext4_sb_is_super_in_bg(s, block_group);
if (!ext4_sb_has_feature_incompatible(s,
- EXT4_FEATURE_INCOMPAT_META_BG) ||
+ 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_types.h
+++ b/lwext4/ext4_types.h
@@ -217,20 +217,20 @@
/*
* Incompatible features
*/
-#define EXT4_FEATURE_INCOMPAT_COMPRESSION 0x0001
-#define EXT4_FEATURE_INCOMPAT_FILETYPE 0x0002
-#define EXT4_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
-#define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
-#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
-#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
-#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
-#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
-#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
-#define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 /* EA in inode */
-#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 /* data in dirent */
-#define EXT4_FEATURE_INCOMPAT_BG_USE_META_CSUM 0x2000 /* use crc32c for bg */
-#define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */
-#define EXT4_FEATURE_INCOMPAT_INLINE_DATA 0x8000 /* data in inode */
+#define EXT4_FINCOM_COMPRESSION 0x0001
+#define EXT4_FINCOM_FILETYPE 0x0002
+#define EXT4_FINCOM_RECOVER 0x0004 /* Needs recovery */
+#define EXT4_FINCOM_JOURNAL_DEV 0x0008 /* Journal device */
+#define EXT4_FINCOM_META_BG 0x0010
+#define EXT4_FINCOM_EXTENTS 0x0040 /* extents support */
+#define EXT4_FINCOM_64BIT 0x0080
+#define EXT4_FINCOM_MMP 0x0100
+#define EXT4_FINCOM_FLEX_BG 0x0200
+#define EXT4_FINCOM_EA_INODE 0x0400 /* EA in inode */
+#define EXT4_FINCOM_DIRDATA 0x1000 /* data in dirent */
+#define EXT4_FINCOM_BG_USE_META_CSUM 0x2000 /* use crc32c for bg */
+#define EXT4_FINCOM_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */
+#define EXT4_FINCOM_INLINE_DATA 0x8000 /* data in inode */
/*
* EXT2 supported feature set
@@ -237,10 +237,10 @@
*/
#define EXT2_FEATURE_COMPAT_SUPP 0x0000
-#define EXT2_FEATURE_INCOMPAT_SUPP \
- (EXT4_FEATURE_INCOMPAT_FILETYPE | EXT4_FEATURE_INCOMPAT_META_BG)
+#define EXT2_FEATURE_INCOMPAT_SUPP \
+ (EXT4_FINCOM_FILETYPE | EXT4_FINCOM_META_BG)
-#define EXT2_FEATURE_RO_COMPAT_SUPP \
+#define EXT2_FEATURE_RO_COMPAT_SUPP \
(EXT4_FRO_COM_SPARSE_SUPER | \
EXT4_FRO_COM_LARGE_FILE | EXT4_FRO_COM_BTREE_DIR)
@@ -249,11 +249,11 @@
*/
#define EXT3_FEATURE_COMPAT_SUPP (EXT4_FCOM_DIR_INDEX)
-#define EXT3_FEATURE_INCOMPAT_SUPP \
- (EXT4_FEATURE_INCOMPAT_FILETYPE | EXT4_FEATURE_INCOMPAT_META_BG)
+#define EXT3_FEATURE_INCOMPAT_SUPP \
+ (EXT4_FINCOM_FILETYPE | EXT4_FINCOM_META_BG)
-#define EXT3_FEATURE_RO_COMPAT_SUPP \
- (EXT4_FRO_COM_SPARSE_SUPER | \
+#define EXT3_FEATURE_RO_COMPAT_SUPP \
+ (EXT4_FRO_COM_SPARSE_SUPER | \
EXT4_FRO_COM_LARGE_FILE | EXT4_FRO_COM_BTREE_DIR)
/*
@@ -261,17 +261,17 @@
*/
#define EXT4_FEATURE_COMPAT_SUPP (EXT4_FCOM_DIR_INDEX)
-#define EXT4_FEATURE_INCOMPAT_SUPP \
- (EXT4_FEATURE_INCOMPAT_FILETYPE | EXT4_FEATURE_INCOMPAT_META_BG | \
- EXT4_FEATURE_INCOMPAT_EXTENTS | EXT4_FEATURE_INCOMPAT_FLEX_BG | \
- EXT4_FEATURE_INCOMPAT_64BIT)
+#define EXT4_FEATURE_INCOMPAT_SUPP \
+ (EXT4_FINCOM_FILETYPE | EXT4_FINCOM_META_BG | \
+ EXT4_FINCOM_EXTENTS | EXT4_FINCOM_FLEX_BG | \
+ EXT4_FINCOM_64BIT)
-#define EXT4_FEATURE_RO_COMPAT_SUPP \
- (EXT4_FRO_COM_SPARSE_SUPER | \
- EXT4_FRO_COM_METADATA_CSUM | \
+#define EXT4_FEATURE_RO_COMPAT_SUPP \
+ (EXT4_FRO_COM_SPARSE_SUPER | \
+ EXT4_FRO_COM_METADATA_CSUM | \
EXT4_FRO_COM_LARGE_FILE | EXT4_FRO_COM_GDT_CSUM | \
- EXT4_FRO_COM_DIR_NLINK | \
- EXT4_FRO_COM_EXTRA_ISIZE | \
+ EXT4_FRO_COM_DIR_NLINK | \
+ EXT4_FRO_COM_EXTRA_ISIZE | \
EXT4_FRO_COM_BTREE_DIR | EXT4_FRO_COM_HUGE_FILE)
/*Ignored features:
@@ -279,18 +279,17 @@
* (probably won't be ever...)
* MMP - multi-mout protection (impossible scenario)
* */
-#define FEATURE_INCOMPAT_IGNORED \
- EXT4_FEATURE_INCOMPAT_RECOVER | EXT4_FEATURE_INCOMPAT_MMP
+#define FEATURE_INCOMPAT_IGNORED \
+ EXT4_FINCOM_RECOVER | EXT4_FINCOM_MMP
#if 0
/*TODO: Features incompatible to implement*/
#define EXT4_FEATURE_INCOMPAT_SUPP
- (EXT4_FEATURE_INCOMPAT_INLINE_DATA)
+ (EXT4_FINCOM_INLINE_DATA)
/*TODO: Features read only to implement*/
#define EXT4_FEATURE_RO_COMPAT_SUPP
EXT4_FRO_COM_BIGALLOC |\
- EXT4_FRO_COM_METADATA_CSUM|\
EXT4_FRO_COM_QUOTA)
#endif