aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorJoern Engel <joern@wohnheim.fh-wedel.de>2007-10-17 02:30:44 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:43:02 -0400
commit1c0eeaf5698597146ed9b873e2f9e0961edcf0f9 (patch)
tree5265eac8437e8ce517a62db8fe2bd99db5b7019b /fs/inode.c
parent2e6883bdf49abd0e7f0d9b6297fc3be7ebb2250b (diff)
introduce I_SYNC
I_LOCK was used for several unrelated purposes, which caused deadlock situations in certain filesystems as a side effect. One of the purposes now uses the new I_SYNC bit. Also document the various bits and change their order from historical to logical. [bunk@stusta.de: make fs/inode.c:wake_up_inode() static] Signed-off-by: Joern Engel <joern@wohnheim.fh-wedel.de> Cc: Dave Kleikamp <shaggy@linux.vnet.ibm.com> Cc: David Chinner <dgc@sgi.com> Cc: Anton Altaparmakov <aia21@cam.ac.uk> Cc: Al Viro <viro@ftp.linux.org.uk> Cc: Christoph Hellwig <hch@infradead.org> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/inode.c b/fs/inode.c
index c6165771e00e..ed35383d0b6c 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -99,6 +99,15 @@ struct inodes_stat_t inodes_stat;
99 99
100static struct kmem_cache * inode_cachep __read_mostly; 100static struct kmem_cache * inode_cachep __read_mostly;
101 101
102static void wake_up_inode(struct inode *inode)
103{
104 /*
105 * Prevent speculative execution through spin_unlock(&inode_lock);
106 */
107 smp_mb();
108 wake_up_bit(&inode->i_state, __I_LOCK);
109}
110
102static struct inode *alloc_inode(struct super_block *sb) 111static struct inode *alloc_inode(struct super_block *sb)
103{ 112{
104 static const struct address_space_operations empty_aops; 113 static const struct address_space_operations empty_aops;
@@ -232,7 +241,7 @@ void __iget(struct inode * inode)
232 return; 241 return;
233 } 242 }
234 atomic_inc(&inode->i_count); 243 atomic_inc(&inode->i_count);
235 if (!(inode->i_state & (I_DIRTY|I_LOCK))) 244 if (!(inode->i_state & (I_DIRTY|I_SYNC)))
236 list_move(&inode->i_list, &inode_in_use); 245 list_move(&inode->i_list, &inode_in_use);
237 inodes_stat.nr_unused--; 246 inodes_stat.nr_unused--;
238} 247}
@@ -253,7 +262,7 @@ void clear_inode(struct inode *inode)
253 BUG_ON(inode->i_data.nrpages); 262 BUG_ON(inode->i_data.nrpages);
254 BUG_ON(!(inode->i_state & I_FREEING)); 263 BUG_ON(!(inode->i_state & I_FREEING));
255 BUG_ON(inode->i_state & I_CLEAR); 264 BUG_ON(inode->i_state & I_CLEAR);
256 wait_on_inode(inode); 265 inode_sync_wait(inode);
257 DQUOT_DROP(inode); 266 DQUOT_DROP(inode);
258 if (inode->i_sb->s_op->clear_inode) 267 if (inode->i_sb->s_op->clear_inode)
259 inode->i_sb->s_op->clear_inode(inode); 268 inode->i_sb->s_op->clear_inode(inode);
@@ -1071,7 +1080,7 @@ static void generic_forget_inode(struct inode *inode)
1071 struct super_block *sb = inode->i_sb; 1080 struct super_block *sb = inode->i_sb;
1072 1081
1073 if (!hlist_unhashed(&inode->i_hash)) { 1082 if (!hlist_unhashed(&inode->i_hash)) {
1074 if (!(inode->i_state & (I_DIRTY|I_LOCK))) 1083 if (!(inode->i_state & (I_DIRTY|I_SYNC)))
1075 list_move(&inode->i_list, &inode_unused); 1084 list_move(&inode->i_list, &inode_unused);
1076 inodes_stat.nr_unused++; 1085 inodes_stat.nr_unused++;
1077 if (sb->s_flags & MS_ACTIVE) { 1086 if (sb->s_flags & MS_ACTIVE) {
@@ -1314,15 +1323,6 @@ static void __wait_on_freeing_inode(struct inode *inode)
1314 spin_lock(&inode_lock); 1323 spin_lock(&inode_lock);
1315} 1324}
1316 1325
1317void wake_up_inode(struct inode *inode)
1318{
1319 /*
1320 * Prevent speculative execution through spin_unlock(&inode_lock);
1321 */
1322 smp_mb();
1323 wake_up_bit(&inode->i_state, __I_LOCK);
1324}
1325
1326/* 1326/*
1327 * We rarely want to lock two inodes that do not have a parent/child 1327 * We rarely want to lock two inodes that do not have a parent/child
1328 * relationship (such as directory, child inode) simultaneously. The 1328 * relationship (such as directory, child inode) simultaneously. The