Skip to content

Commit

Permalink
hfs: use d_splice_alias()
Browse files Browse the repository at this point in the history
code is simpler that way

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed May 22, 2018
1 parent 18fbbfc commit 6b9ccee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
20 changes: 7 additions & 13 deletions fs/hfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,15 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry,
hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name);
res = hfs_brec_read(&fd, &rec, sizeof(rec));
if (res) {
hfs_find_exit(&fd);
if (res == -ENOENT) {
/* No such entry */
inode = NULL;
goto done;
}
return ERR_PTR(res);
if (res != -ENOENT)
inode = ERR_PTR(res);
} else {
inode = hfs_iget(dir->i_sb, &fd.search_key->cat, &rec);
if (!inode)
inode = ERR_PTR(-EACCES);
}
inode = hfs_iget(dir->i_sb, &fd.search_key->cat, &rec);
hfs_find_exit(&fd);
if (!inode)
return ERR_PTR(-EACCES);
done:
d_add(dentry, inode);
return NULL;
return d_splice_alias(inode, dentry);
}

/*
Expand Down
3 changes: 1 addition & 2 deletions fs/hfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,7 @@ static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry,
hlist_add_fake(&inode->i_hash);
mark_inode_dirty(inode);
out:
d_add(dentry, inode);
return NULL;
return d_splice_alias(inode, dentry);
}

void hfs_evict_inode(struct inode *inode)
Expand Down

0 comments on commit 6b9ccee

Please sign in to comment.