Skip to content

Instantly share code, notes, and snippets.

@kraftb
Created May 10, 2015 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kraftb/5290a1a1ccc9ecb730ad to your computer and use it in GitHub Desktop.
Save kraftb/5290a1a1ccc9ecb730ad to your computer and use it in GitHub Desktop.
ext2 performance improvement: ext2_statfs
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 9f9992b..c7bb6d2 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -1520,17 +1520,3 @@ int ext2_bg_has_super(struct super_block *sb, int group)
return 1;
}
-/**
- * ext2_bg_num_gdb - number of blocks used by the group table in group
- * @sb: superblock for filesystem
- * @group: group number to check
- *
- * Return the number of blocks used by the group descriptor table
- * (primary or backup) in this group. In the future there may be a
- * different number of descriptor blocks in each group.
- */
-unsigned long ext2_bg_num_gdb(struct super_block *sb, int group)
-{
- return ext2_bg_has_super(sb, group) ? EXT2_SB(sb)->s_gdb_count : 0;
-}
-
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 8d15feb..67bcb64 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -721,7 +721,6 @@ static inline struct ext2_inode_info *EXT2_I(struct inode *inode)
/* balloc.c */
extern int ext2_bg_has_super(struct super_block *sb, int group);
-extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
extern ext2_fsblk_t ext2_new_block(struct inode *, unsigned long, int *);
extern ext2_fsblk_t ext2_new_blocks(struct inode *, unsigned long,
unsigned long *, int *);
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index d0e746e..f644871 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1393,8 +1393,8 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
* feature is turned on, then not all groups have this.
*/
for (i = 0; i < sbi->s_groups_count; i++)
- overhead += ext2_bg_has_super(sb, i) +
- ext2_bg_num_gdb(sb, i);
+ if (ext2_bg_has_super(sb, i))
+ overhead += 1 + sbi->s_gdb_count;
/*
* Every block group has an inode bitmap, a block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment