aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-07-26 05:36:34 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-26 12:57:09 -0400
commita209dfc7b0d94bd6fa94553c097836a2e6d0f0ba (patch)
tree7dacc92b08264c675a0dfcbae83982b7d3ad5135 /fs/inode.c
parent5b9f4567726513a359e70f85029482c7c3714dbd (diff)
vfs: dont chain pipe/anon/socket on superblock s_inodes list
Workloads using pipes and sockets hit inode_sb_list_lock contention. superblock s_inodes list is needed for quota, dirty, pagecache and fsnotify management. pipe/anon/socket fs are clearly not candidates for these. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 96c77b81167c..319b93b55570 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -362,9 +362,11 @@ EXPORT_SYMBOL_GPL(inode_sb_list_add);
362 362
363static inline void inode_sb_list_del(struct inode *inode) 363static inline void inode_sb_list_del(struct inode *inode)
364{ 364{
365 spin_lock(&inode_sb_list_lock); 365 if (!list_empty(&inode->i_sb_list)) {
366 list_del_init(&inode->i_sb_list); 366 spin_lock(&inode_sb_list_lock);
367 spin_unlock(&inode_sb_list_lock); 367 list_del_init(&inode->i_sb_list);
368 spin_unlock(&inode_sb_list_lock);
369 }
368} 370}
369 371
370static unsigned long hash(struct super_block *sb, unsigned long hashval) 372static unsigned long hash(struct super_block *sb, unsigned long hashval)
@@ -797,6 +799,29 @@ unsigned int get_next_ino(void)
797EXPORT_SYMBOL(get_next_ino); 799EXPORT_SYMBOL(get_next_ino);
798 800
799/** 801/**
802 * new_inode_pseudo - obtain an inode
803 * @sb: superblock
804 *
805 * Allocates a new inode for given superblock.
806 * Inode wont be chained in superblock s_inodes list
807 * This means :
808 * - fs can't be unmount
809 * - quotas, fsnotify, writeback can't work
810 */
811struct inode *new_inode_pseudo(struct super_block *sb)
812{
813 struct inode *inode = alloc_inode(sb);
814
815 if (inode) {
816 spin_lock(&inode->i_lock);
817 inode->i_state = 0;
818 spin_unlock(&inode->i_lock);
819 INIT_LIST_HEAD(&inode->i_sb_list);
820 }
821 return inode;
822}
823
824/**
800 * new_inode - obtain an inode 825 * new_inode - obtain an inode
801 * @sb: superblock 826 * @sb: superblock
802 * 827 *
@@ -814,13 +839,9 @@ struct inode *new_inode(struct super_block *sb)
814 839
815 spin_lock_prefetch(&inode_sb_list_lock); 840 spin_lock_prefetch(&inode_sb_list_lock);
816 841
817 inode = alloc_inode(sb); 842 inode = new_inode_pseudo(sb);
818 if (inode) { 843 if (inode)
819 spin_lock(&inode->i_lock);
820 inode->i_state = 0;
821 spin_unlock(&inode->i_lock);
822 inode_sb_list_add(inode); 844 inode_sb_list_add(inode);
823 }
824 return inode; 845 return inode;
825} 846}
826EXPORT_SYMBOL(new_inode); 847EXPORT_SYMBOL(new_inode);