diff options
author | Len Brown <len.brown@intel.com> | 2011-03-23 07:33:54 +0100 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-03-23 07:33:54 +0100 |
commit | 5c129a8600100a5d0f5fdbc1014c5dba1d307bc4 (patch) | |
tree | 9877a14b49cff43d0ba10c12f407ec551c77daa5 /fs/dcache.c | |
parent | Merge branch 'bugfix-thermal' into release (diff) | |
parent | Linux 2.6.38 (diff) | |
download | linux-5c129a8600100a5d0f5fdbc1014c5dba1d307bc4.tar.xz linux-5c129a8600100a5d0f5fdbc1014c5dba1d307bc4.zip |
Merge commit 'v2.6.38' into release
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 2a6bd9a4ae97..611ffe928c03 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1523,6 +1523,28 @@ struct dentry * d_alloc_root(struct inode * root_inode) } EXPORT_SYMBOL(d_alloc_root); +static struct dentry * __d_find_any_alias(struct inode *inode) +{ + struct dentry *alias; + + if (list_empty(&inode->i_dentry)) + return NULL; + alias = list_first_entry(&inode->i_dentry, struct dentry, d_alias); + __dget(alias); + return alias; +} + +static struct dentry * d_find_any_alias(struct inode *inode) +{ + struct dentry *de; + + spin_lock(&inode->i_lock); + de = __d_find_any_alias(inode); + spin_unlock(&inode->i_lock); + return de; +} + + /** * d_obtain_alias - find or allocate a dentry for a given inode * @inode: inode to allocate the dentry for @@ -1552,7 +1574,7 @@ struct dentry *d_obtain_alias(struct inode *inode) if (IS_ERR(inode)) return ERR_CAST(inode); - res = d_find_alias(inode); + res = d_find_any_alias(inode); if (res) goto out_iput; @@ -1565,7 +1587,7 @@ struct dentry *d_obtain_alias(struct inode *inode) spin_lock(&inode->i_lock); - res = __d_find_alias(inode, 0); + res = __d_find_any_alias(inode); if (res) { spin_unlock(&inode->i_lock); dput(tmp); |