vfs: skip inodes without pages to free in drop_pagecache_sb()
authorJan Kara <jack@suse.cz>
Tue, 29 Apr 2008 07:59:39 +0000 (00:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Apr 2008 15:06:05 +0000 (08:06 -0700)
Many inodes have no pagecache, so we can avoid lots of lock-takings.

Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Fengguang Wu <wfg@mail.ustc.edu.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/drop_caches.c

index 50f9087..3e5637f 100644 (file)
@@ -20,6 +20,8 @@ static void drop_pagecache_sb(struct super_block *sb)
        list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
                if (inode->i_state & (I_FREEING|I_WILL_FREE))
                        continue;
+               if (inode->i_mapping->nrpages == 0)
+                       continue;
                __iget(inode);
                spin_unlock(&inode_lock);
                __invalidate_mapping_pages(inode->i_mapping, 0, -1, true);