summaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorRichard Kennedy <richard@rsk.demon.co.uk>2010-05-14 10:49:22 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2010-05-21 18:31:21 -0400
commit2e147f1ef7d593b36c0e27a393b7d7ec0765f54b (patch)
treecc7746744467dfcedd8e5068eac982fc9c308515 /fs/inode.c
parenta7cf4145bb86aaf85d4d4d29a69b50b688e2e49d (diff)
downloadop-kernel-dev-2e147f1ef7d593b36c0e27a393b7d7ec0765f54b.zip
op-kernel-dev-2e147f1ef7d593b36c0e27a393b7d7ec0765f54b.tar.gz
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>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 258ec22..498b10f 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -286,11 +286,9 @@ static void init_once(void *foo)
*/
void __iget(struct inode *inode)
{
- if (atomic_read(&inode->i_count)) {
- atomic_inc(&inode->i_count);
+ if (atomic_inc_return(&inode->i_count) != 1)
return;
- }
- atomic_inc(&inode->i_count);
+
if (!(inode->i_state & (I_DIRTY|I_SYNC)))
list_move(&inode->i_list, &inode_in_use);
inodes_stat.nr_unused--;
OpenPOWER on IntegriCloud