Skip to content

Commit

Permalink
fs: move i_count increments into find_inode/find_inode_fast
Browse files Browse the repository at this point in the history
Now that iunique is not abusing find_inode anymore we can move the i_ref
increment back to where it belongs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Christoph Hellwig authored and Al Viro committed Oct 26, 2010
1 parent ad5e195 commit f7899bd
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,6 @@ static struct shrinker icache_shrinker = {
static void __wait_on_freeing_inode(struct inode *inode);
/*
* Called with the inode lock held.
* NOTE: we are not increasing the inode-refcount, you must call __iget()
* by hand after calling find_inode now! This simplifies iunique and won't
* add any additional branch in the common code.
*/
static struct inode *find_inode(struct super_block *sb,
struct hlist_head *head,
Expand All @@ -656,9 +653,10 @@ static struct inode *find_inode(struct super_block *sb,
__wait_on_freeing_inode(inode);
goto repeat;
}
break;
__iget(inode);
return inode;
}
return node ? inode : NULL;
return NULL;
}

/*
Expand All @@ -681,9 +679,10 @@ static struct inode *find_inode_fast(struct super_block *sb,
__wait_on_freeing_inode(inode);
goto repeat;
}
break;
__iget(inode);
return inode;
}
return node ? inode : NULL;
return NULL;
}

static inline void
Expand Down Expand Up @@ -828,7 +827,6 @@ static struct inode *get_new_inode(struct super_block *sb,
* us. Use the old inode instead of the one we just
* allocated.
*/
__iget(old);
spin_unlock(&inode_lock);
destroy_inode(inode);
inode = old;
Expand Down Expand Up @@ -875,7 +873,6 @@ static struct inode *get_new_inode_fast(struct super_block *sb,
* us. Use the old inode instead of the one we just
* allocated.
*/
__iget(old);
spin_unlock(&inode_lock);
destroy_inode(inode);
inode = old;
Expand Down Expand Up @@ -989,7 +986,6 @@ static struct inode *ifind(struct super_block *sb,
spin_lock(&inode_lock);
inode = find_inode(sb, head, test, data);
if (inode) {
__iget(inode);
spin_unlock(&inode_lock);
if (likely(wait))
wait_on_inode(inode);
Expand Down Expand Up @@ -1022,7 +1018,6 @@ static struct inode *ifind_fast(struct super_block *sb,
spin_lock(&inode_lock);
inode = find_inode_fast(sb, head, ino);
if (inode) {
__iget(inode);
spin_unlock(&inode_lock);
wait_on_inode(inode);
return inode;
Expand Down

0 comments on commit f7899bd

Please sign in to comment.