Commit f7899bd5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro

fs: move i_count increments into find_inode/find_inode_fast

Now that iunique is not abusing find_inode anymore we can move the i_ref
increment back to where it belongs.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent ad5e195a
...@@ -634,9 +634,6 @@ static struct shrinker icache_shrinker = { ...@@ -634,9 +634,6 @@ static struct shrinker icache_shrinker = {
static void __wait_on_freeing_inode(struct inode *inode); static void __wait_on_freeing_inode(struct inode *inode);
/* /*
* Called with the inode lock held. * 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, static struct inode *find_inode(struct super_block *sb,
struct hlist_head *head, struct hlist_head *head,
...@@ -656,9 +653,10 @@ static struct inode *find_inode(struct super_block *sb, ...@@ -656,9 +653,10 @@ static struct inode *find_inode(struct super_block *sb,
__wait_on_freeing_inode(inode); __wait_on_freeing_inode(inode);
goto repeat; goto repeat;
} }
break; __iget(inode);
return inode;
} }
return node ? inode : NULL; return NULL;
} }
/* /*
...@@ -681,9 +679,10 @@ static struct inode *find_inode_fast(struct super_block *sb, ...@@ -681,9 +679,10 @@ static struct inode *find_inode_fast(struct super_block *sb,
__wait_on_freeing_inode(inode); __wait_on_freeing_inode(inode);
goto repeat; goto repeat;
} }
break; __iget(inode);
return inode;
} }
return node ? inode : NULL; return NULL;
} }
static inline void static inline void
...@@ -828,7 +827,6 @@ static struct inode *get_new_inode(struct super_block *sb, ...@@ -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 * us. Use the old inode instead of the one we just
* allocated. * allocated.
*/ */
__iget(old);
spin_unlock(&inode_lock); spin_unlock(&inode_lock);
destroy_inode(inode); destroy_inode(inode);
inode = old; inode = old;
...@@ -875,7 +873,6 @@ static struct inode *get_new_inode_fast(struct super_block *sb, ...@@ -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 * us. Use the old inode instead of the one we just
* allocated. * allocated.
*/ */
__iget(old);
spin_unlock(&inode_lock); spin_unlock(&inode_lock);
destroy_inode(inode); destroy_inode(inode);
inode = old; inode = old;
...@@ -989,7 +986,6 @@ static struct inode *ifind(struct super_block *sb, ...@@ -989,7 +986,6 @@ static struct inode *ifind(struct super_block *sb,
spin_lock(&inode_lock); spin_lock(&inode_lock);
inode = find_inode(sb, head, test, data); inode = find_inode(sb, head, test, data);
if (inode) { if (inode) {
__iget(inode);
spin_unlock(&inode_lock); spin_unlock(&inode_lock);
if (likely(wait)) if (likely(wait))
wait_on_inode(inode); wait_on_inode(inode);
...@@ -1022,7 +1018,6 @@ static struct inode *ifind_fast(struct super_block *sb, ...@@ -1022,7 +1018,6 @@ static struct inode *ifind_fast(struct super_block *sb,
spin_lock(&inode_lock); spin_lock(&inode_lock);
inode = find_inode_fast(sb, head, ino); inode = find_inode_fast(sb, head, ino);
if (inode) { if (inode) {
__iget(inode);
spin_unlock(&inode_lock); spin_unlock(&inode_lock);
wait_on_inode(inode); wait_on_inode(inode);
return inode; return inode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment