mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]>
This commit is contained in:
parent
b5fc510c48
commit
a4ffdde6e5
11 changed files with 27 additions and 28 deletions
16
fs/inode.c
16
fs/inode.c
|
|
@ -317,7 +317,7 @@ void clear_inode(struct inode *inode)
|
|||
bd_forget(inode);
|
||||
if (S_ISCHR(inode->i_mode) && inode->i_cdev)
|
||||
cd_forget(inode);
|
||||
inode->i_state = I_CLEAR;
|
||||
inode->i_state = I_FREEING | I_CLEAR;
|
||||
}
|
||||
EXPORT_SYMBOL(clear_inode);
|
||||
|
||||
|
|
@ -553,7 +553,7 @@ repeat:
|
|||
continue;
|
||||
if (!test(inode, data))
|
||||
continue;
|
||||
if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) {
|
||||
if (inode->i_state & (I_FREEING|I_WILL_FREE)) {
|
||||
__wait_on_freeing_inode(inode);
|
||||
goto repeat;
|
||||
}
|
||||
|
|
@ -578,7 +578,7 @@ repeat:
|
|||
continue;
|
||||
if (inode->i_sb != sb)
|
||||
continue;
|
||||
if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) {
|
||||
if (inode->i_state & (I_FREEING|I_WILL_FREE)) {
|
||||
__wait_on_freeing_inode(inode);
|
||||
goto repeat;
|
||||
}
|
||||
|
|
@ -840,7 +840,7 @@ EXPORT_SYMBOL(iunique);
|
|||
struct inode *igrab(struct inode *inode)
|
||||
{
|
||||
spin_lock(&inode_lock);
|
||||
if (!(inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)))
|
||||
if (!(inode->i_state & (I_FREEING|I_WILL_FREE)))
|
||||
__iget(inode);
|
||||
else
|
||||
/*
|
||||
|
|
@ -1089,7 +1089,7 @@ int insert_inode_locked(struct inode *inode)
|
|||
continue;
|
||||
if (old->i_sb != sb)
|
||||
continue;
|
||||
if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE))
|
||||
if (old->i_state & (I_FREEING|I_WILL_FREE))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1128,7 +1128,7 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval,
|
|||
continue;
|
||||
if (!test(old, data))
|
||||
continue;
|
||||
if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE))
|
||||
if (old->i_state & (I_FREEING|I_WILL_FREE))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1218,7 +1218,7 @@ void generic_delete_inode(struct inode *inode)
|
|||
hlist_del_init(&inode->i_hash);
|
||||
spin_unlock(&inode_lock);
|
||||
wake_up_inode(inode);
|
||||
BUG_ON(inode->i_state != I_CLEAR);
|
||||
BUG_ON(inode->i_state != (I_FREEING | I_CLEAR));
|
||||
destroy_inode(inode);
|
||||
}
|
||||
EXPORT_SYMBOL(generic_delete_inode);
|
||||
|
|
@ -1322,7 +1322,7 @@ static inline void iput_final(struct inode *inode)
|
|||
void iput(struct inode *inode)
|
||||
{
|
||||
if (inode) {
|
||||
BUG_ON(inode->i_state == I_CLEAR);
|
||||
BUG_ON(inode->i_state & I_CLEAR);
|
||||
|
||||
if (atomic_dec_and_lock(&inode->i_count, &inode_lock))
|
||||
iput_final(inode);
|
||||
|
|
|
|||
Loading…
Reference in a new issue