FLEX_BG Kernel support.
PATCH 1/1 FLEX_BG Kernel support.
From: Jose R. Santos <[email protected]>
FLEX_BG Kernel support.
This feature relaxes check restrictions on where each block groups meta data is located within the storage media. This allows for the allocation of bitmaps or inode tables outside the block group boundaries in cases where bad blocks forces us to look for new blocks which the owning block group can not satisfy. This will also allow for new meta-data allocation schemes to improve performance and scalability.
--
fs/ext4/super.c | 7 +++++-- include/linux/ext4_fs.h | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-)
fs/ext4/super.c +5 -2
@@ -1254,7 +1254,8 @@ static int ext4_check_descriptors (struct super_block * sb)for (i =0 ; i < sbi->s_groups_count; i++) { -if (i == sbi->s_groups_count -1 ) +if (i == sbi->s_groups_count -1 ||EXT4_HAS_INCOMPAT_FEATURE (sb, +EXT4_FEATURE_INCOMPAT_FLEX_BG )) last_block =ext4_blocks_count (sbi->s_es) -1 ;else last_block = first_block +
@@ -1291,7 +1292,9 @@ static int ext4_check_descriptors (struct super_block * sb) i, inode_table);return 0 ; } - first_block +=EXT4_BLOCKS_PER_GROUP (sb); +if (!EXT4_HAS_INCOMPAT_FEATURE (sb, +EXT4_FEATURE_INCOMPAT_FLEX_BG )) + first_block +=EXT4_BLOCKS_PER_GROUP (sb); gdp = (struct ext4_group_desc *) ((__u8 *)gdp +EXT4_DESC_SIZE (sb)); }
include/linux/ext4_fs.h +3 -1
@@ -702,13 +702,15 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)#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_FLEX_BG 0x0200#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ EXT4_FEATURE_INCOMPAT_RECOVER| \ EXT4_FEATURE_INCOMPAT_META_BG| \ EXT4_FEATURE_INCOMPAT_EXTENTS| \ - EXT4_FEATURE_INCOMPAT_64BIT) + EXT4_FEATURE_INCOMPAT_64BIT| \ + EXT4_FEATURE_INCOMPAT_FLEX_BG)#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
fs/ext4/super.c static int ext4_check_descriptors (struct super_block * sb) · line 1259
Quoted 8 lines · Jose R. Santos
fs/ext4/super.c +2
-1@@ -1254,7 +1254,8 @@ static int ext4_check_descriptors (struct super_block * sb)for (i =0 ; i < sbi->s_groups_count; i++) { -if (i == sbi->s_groups_count -1 ) +if (i == sbi->s_groups_count -1 ||EXT4_HAS_INCOMPAT_FEATURE (sb, +EXT4_FEATURE_INCOMPAT_FLEX_BG )) last_block =ext4_blocks_count (sbi->s_es) -1 ;
No need to check this featyre for every group, once at the beginning of the function is enough.
Quoted 13 lines · On Tue, 11 Sep 2007 00:04:43 -0600 "Andreas Dilger" <[email protected]>…
fs/ext4/super.c static int ext4_check_descriptors (struct super_block * sb) · line 1259
Quoted 8 lines · Jose R. Santos
fs/ext4/super.c +2
-1@@ -1254,7 +1254,8 @@ static int ext4_check_descriptors (struct super_block * sb)for (i =0 ; i < sbi->s_groups_count; i++) { -if (i == sbi->s_groups_count -1 ) +if (i == sbi->s_groups_count -1 ||EXT4_HAS_INCOMPAT_FEATURE (sb, +EXT4_FEATURE_INCOMPAT_FLEX_BG )) last_block =ext4_blocks_count (sbi->s_es) -1 ;No need to check this featyre for every group, once at the beginning of the function is enough.
Do you mean something like the original patch?
http://lists.openwall.net/linux-ext4/2007/07/12/20
Wouldn't we need to check all the descriptor for corruption if checksum is not enable on the filesystem?
-JRS
Quoted 16 lines · Jose R. Santos
Quoted 13 lines · On Tue, 11 Sep 2007 00:04:43 -0600 "Andreas Dilger" <[email protected]>…
fs/ext4/super.c static int ext4_check_descriptors (struct super_block * sb) · line 1259
Quoted 8 lines · Jose R. Santos
fs/ext4/super.c +2
-1@@ -1254,7 +1254,8 @@ static int ext4_check_descriptors (struct super_block * sb)for (i =0 ; i < sbi->s_groups_count; i++) { -if (i == sbi->s_groups_count -1 ) +if (i == sbi->s_groups_count -1 ||EXT4_HAS_INCOMPAT_FEATURE (sb, +EXT4_FEATURE_INCOMPAT_FLEX_BG )) last_block =ext4_blocks_count (sbi->s_es) -1 ;No need to check this featyre for every group, once at the beginning of the function is enough.
Quoted 5 lines
Do you mean something like the original patch?
http://lists.openwall.net/linux-ext4/2007/07/12/20Wouldn't we need to check all the descriptor for corruption if checksum is not enable on the filesystem?
Yes, I just meant you don't need to have:
EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG))
for each time through the loop. That loop is walked 8000 times per TB at mount, so if we can make it faster we should do so.
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.
Quoted 23 lines · On Tue, 11 Sep 2007 17:21:39 -0600 Andreas Dilger <[email protected]> wrote:
Quoted 16 lines · Jose R. Santos
Quoted 13 lines · On Tue, 11 Sep 2007 00:04:43 -0600 "Andreas Dilger" <[email protected]>…
fs/ext4/super.c static int ext4_check_descriptors (struct super_block * sb) · line 1259
Quoted 8 lines · Jose R. Santos
fs/ext4/super.c +2
-1@@ -1254,7 +1254,8 @@ static int ext4_check_descriptors (struct super_block * sb)for (i =0 ; i < sbi->s_groups_count; i++) { -if (i == sbi->s_groups_count -1 ) +if (i == sbi->s_groups_count -1 ||EXT4_HAS_INCOMPAT_FEATURE (sb, +EXT4_FEATURE_INCOMPAT_FLEX_BG )) last_block =ext4_blocks_count (sbi->s_es) -1 ;No need to check this featyre for every group, once at the beginning of the function is enough.
Quoted 5 lines
Do you mean something like the original patch?
http://lists.openwall.net/linux-ext4/2007/07/12/20Wouldn't we need to check all the descriptor for corruption if checksum is not enable on the filesystem?
Quoted 6 lines
Yes, I just meant you don't need to have:
EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG))for each time through the loop. That loop is walked 8000 times per TB at mount, so if we can make it faster we should do so.
Good point, I'll send an updated patch.
-JRS