[PATCH] EXT2: Remove superblock lock contention in ext2_statfs
authorDave Kleikamp <shaggy@austin.ibm.com>
Tue, 19 Sep 2006 03:12:33 +0000 (20:12 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 19 Sep 2006 14:59:59 +0000 (07:59 -0700)
Fix a performance degradation introduced in 2.6.17.  (30% degradation
running dbench with 16 threads)

Commit 21730eed11de42f22afcbd43f450a1872a0b5ea1, which claims to make
EXT2_DEBUG work again, moves the taking of the kernel lock out of
debug-only code in ext2_count_free_inodes and ext2_count_free_blocks and
into ext2_statfs.

The same problem was fixed in ext3 by removing the lock completely (commit
5b11687924e40790deb0d5f959247ade82196665)

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/ext2/balloc.c
fs/ext2/ialloc.c
fs/ext2/super.c

index d4870432ecfc9be0d6d3b35807a57501c2d517f6..b1981d0e95ad624e42595e3aace23044716c7770 100644 (file)
@@ -539,7 +539,6 @@ unsigned long ext2_count_free (struct buffer_head * map, unsigned int numchars)
 
 #endif  /*  EXT2FS_DEBUG  */
 
-/* Superblock must be locked */
 unsigned long ext2_count_free_blocks (struct super_block * sb)
 {
        struct ext2_group_desc * desc;
index de85c61c58c57548cd302ebace431b29bfee8241..695f69ccf9088a072e4a899ec431629a14d44ebd 100644 (file)
@@ -637,7 +637,6 @@ fail:
        return ERR_PTR(err);
 }
 
-/* Superblock must be locked */
 unsigned long ext2_count_free_inodes (struct super_block * sb)
 {
        struct ext2_group_desc *desc;
index ca5bfb6914d269afa7106c5a569a3aa80f666f72..4286ff6330b6a0b006ca159e5041b6e75ed2075b 100644 (file)
@@ -1083,7 +1083,6 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
        unsigned long overhead;
        int i;
 
-       lock_super(sb);
        if (test_opt (sb, MINIX_DF))
                overhead = 0;
        else {
@@ -1124,7 +1123,6 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
        buf->f_files = le32_to_cpu(sbi->s_es->s_inodes_count);
        buf->f_ffree = ext2_count_free_inodes (sb);
        buf->f_namelen = EXT2_NAME_LEN;
-       unlock_super(sb);
        return 0;
 }