aboutsummaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-06-02 17:38:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-08-09 16:47:44 -0400
commita4ffdde6e56fdf8c34ddadc2674d6eb978083369 (patch)
tree0fa07df92d804cb7d0482135195e4835cb16403a /fs/inode.c
parentb5fc510c48f631882ccec3c0f02a25d5b67de09f (diff)
simplify checks for I_CLEAR/I_FREEING
add I_CLEAR instead of replacing I_FREEING with it. I_CLEAR is equivalent to I_FREEING for almost all code looking at either; it's there to keep track of having called clear_inode() exactly once per inode lifetime, at some point after having set I_FREEING. I_CLEAR and I_FREEING never get set at the same time with the current code, so we can switch to setting i_flags to I_FREEING | I_CLEAR instead of I_CLEAR without loss of information. As the result of such change, checks become simpler and the amount of code that needs to know about I_CLEAR shrinks a lot. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 722860b323a9..71fe079ca32a 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -317,7 +317,7 @@ void clear_inode(struct inode *inode)
317 bd_forget(inode); 317 bd_forget(inode);
318 if (S_ISCHR(inode->i_mode) && inode->i_cdev) 318 if (S_ISCHR(inode->i_mode) && inode->i_cdev)
319 cd_forget(inode); 319 cd_forget(inode);
320 inode->i_state = I_CLEAR; 320 inode->i_state = I_FREEING | I_CLEAR;
321} 321}
322EXPORT_SYMBOL(clear_inode); 322EXPORT_SYMBOL(clear_inode);
323 323
@@ -553,7 +553,7 @@ repeat:
553 continue; 553 continue;
554 if (!test(inode, data)) 554 if (!test(inode, data))
555 continue; 555 continue;
556 if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) { 556 if (inode->i_state & (I_FREEING|I_WILL_FREE)) {
557 __wait_on_freeing_inode(inode); 557 __wait_on_freeing_inode(inode);
558 goto repeat; 558 goto repeat;
559 } 559 }
@@ -578,7 +578,7 @@ repeat:
578 continue; 578 continue;
579 if (inode->i_sb != sb) 579 if (inode->i_sb != sb)
580 continue; 580 continue;
581 if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) { 581 if (inode->i_state & (I_FREEING|I_WILL_FREE)) {
582 __wait_on_freeing_inode(inode); 582 __wait_on_freeing_inode(inode);
583 goto repeat; 583 goto repeat;
584 } 584 }
@@ -840,7 +840,7 @@ EXPORT_SYMBOL(iunique);
840struct inode *igrab(struct inode *inode) 840struct inode *igrab(struct inode *inode)
841{ 841{
842 spin_lock(&inode_lock); 842 spin_lock(&inode_lock);
843 if (!(inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE))) 843 if (!(inode->i_state & (I_FREEING|I_WILL_FREE)))
844 __iget(inode); 844 __iget(inode);
845 else 845 else
846 /* 846 /*
@@ -1089,7 +1089,7 @@ int insert_inode_locked(struct inode *inode)
1089 continue; 1089 continue;
1090 if (old->i_sb != sb) 1090 if (old->i_sb != sb)
1091 continue; 1091 continue;
1092 if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) 1092 if (old->i_state & (I_FREEING|I_WILL_FREE))
1093 continue; 1093 continue;
1094 break; 1094 break;
1095 } 1095 }
@@ -1128,7 +1128,7 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval,
1128 continue; 1128 continue;
1129 if (!test(old, data)) 1129 if (!test(old, data))
1130 continue; 1130 continue;
1131 if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) 1131 if (old->i_state & (I_FREEING|I_WILL_FREE))
1132 continue; 1132 continue;
1133 break; 1133 break;
1134 } 1134 }
@@ -1218,7 +1218,7 @@ void generic_delete_inode(struct inode *inode)
1218 hlist_del_init(&inode->i_hash); 1218 hlist_del_init(&inode->i_hash);
1219 spin_unlock(&inode_lock); 1219 spin_unlock(&inode_lock);
1220 wake_up_inode(inode); 1220 wake_up_inode(inode);
1221 BUG_ON(inode->i_state != I_CLEAR); 1221 BUG_ON(inode->i_state != (I_FREEING | I_CLEAR));
1222 destroy_inode(inode); 1222 destroy_inode(inode);
1223} 1223}
1224EXPORT_SYMBOL(generic_delete_inode); 1224EXPORT_SYMBOL(generic_delete_inode);
@@ -1322,7 +1322,7 @@ static inline void iput_final(struct inode *inode)
1322void iput(struct inode *inode) 1322void iput(struct inode *inode)
1323{ 1323{
1324 if (inode) { 1324 if (inode) {
1325 BUG_ON(inode->i_state == I_CLEAR); 1325 BUG_ON(inode->i_state & I_CLEAR);
1326 1326
1327 if (atomic_dec_and_lock(&inode->i_count, &inode_lock)) 1327 if (atomic_dec_and_lock(&inode->i_count, &inode_lock))
1328 iput_final(inode); 1328 iput_final(inode);