mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
fs: inode.c use atomic_inc_return in __iget
Using atomic_inc_return in __iget(struct inode *inode) makes the intent of this code clearer and generates less code on processors that have this operation. On x86_64 this patch reduces the text size of inode.o by 12 bytes. Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk> ---- patch against 2.6.34-rc7 compiled & tested on x86_64 AMD X2 I've been running with this patch applied for several weeks with no obvious problems. regards Richard Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
a7cf4145bb
commit
2e147f1ef7
1 changed files with 2 additions and 4 deletions
|
@ -286,11 +286,9 @@ static void init_once(void *foo)
|
||||||
*/
|
*/
|
||||||
void __iget(struct inode *inode)
|
void __iget(struct inode *inode)
|
||||||
{
|
{
|
||||||
if (atomic_read(&inode->i_count)) {
|
if (atomic_inc_return(&inode->i_count) != 1)
|
||||||
atomic_inc(&inode->i_count);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
atomic_inc(&inode->i_count);
|
|
||||||
if (!(inode->i_state & (I_DIRTY|I_SYNC)))
|
if (!(inode->i_state & (I_DIRTY|I_SYNC)))
|
||||||
list_move(&inode->i_list, &inode_in_use);
|
list_move(&inode->i_list, &inode_in_use);
|
||||||
inodes_stat.nr_unused--;
|
inodes_stat.nr_unused--;
|
||||||
|
|
Loading…
Reference in a new issue