Skip to content

Commit

Permalink
vfs: skip inodes without pages to free in drop_pagecache_sb()
Browse files Browse the repository at this point in the history
Many inodes have no pagecache, so we can avoid lots of lock-takings.

Signed-off-by: Jan Kara <[email protected]>
Cc: Fengguang Wu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
jankara authored and torvalds committed Apr 29, 2008
1 parent eccb95c commit af065b8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/drop_caches.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit af065b8

Please sign in to comment.