forked from Minki/linux
staging: lustre: llite: use d_splice_alias for directories.
In the Linux dcache a directory only ever has one dentry, so d_splice_alias() can be used by ll_splice_alias() for directories. It will find the one dentry whether it is DCACHE_DISCONNECTED or IS_ROOT() or d_lustre_invalid(). Separating out the directories from non-directories will allow us to simplify the non-directory code. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a22c3d41d1
commit
e9d4f0b9f5
@ -434,7 +434,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)
|
|||||||
*/
|
*/
|
||||||
struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
|
struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
|
||||||
{
|
{
|
||||||
if (inode) {
|
if (inode && !S_ISDIR(inode->i_mode)) {
|
||||||
struct dentry *new = ll_find_alias(inode, de);
|
struct dentry *new = ll_find_alias(inode, de);
|
||||||
|
|
||||||
if (new) {
|
if (new) {
|
||||||
@ -445,8 +445,13 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
|
|||||||
new, d_inode(new), d_count(new), new->d_flags);
|
new, d_inode(new), d_count(new), new->d_flags);
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
d_add(de, inode);
|
||||||
|
} else {
|
||||||
|
struct dentry *new = d_splice_alias(inode, de);
|
||||||
|
|
||||||
|
if (new)
|
||||||
|
de = new;
|
||||||
}
|
}
|
||||||
d_add(de, inode);
|
|
||||||
CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
|
CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
|
||||||
de, d_inode(de), d_count(de), de->d_flags);
|
de, d_inode(de), d_count(de), de->d_flags);
|
||||||
return de;
|
return de;
|
||||||
|
Loading…
Reference in New Issue
Block a user