Skip to contentSkip to conversation

fs/kernfs: remove the double check of dentry->inode

PATCH In review Hui Su 2 participants 2 messages Nov 13, 2020 – Nov 25, 2020 kernfs

lore
Share & tools
lore

Hui Su

author
#0 lore raw

PATCH 1/1 fs/kernfs: remove the double check of dentry->inode

In both kernfs_node_from_dentry() and in kernfs_dentry_node(), we will check the dentry->inode is NULL or not, which is superfluous.

So remove the check in kernfs_node_from_dentry().

---
 fs/kernfs/dir.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/kernfs/dir.c +1 -2
index 9aec80b9d7c6..b062c666df05 100644
@@ -604,8 +604,7 @@ const struct dentry_operations kernfs_dops = {
  */
 struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry)
 {
-	if (dentry->d_sb->s_op == &kernfs_sops &&
-	    !d_really_is_negative(dentry))
+	if (dentry->d_sb->s_op == &kernfs_sops)
 		return kernfs_dentry_node(dentry);
 	return NULL;
 }
Signature · 1 line
2.29.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Hui Su

In both kernfs_node_from_dentry() and in kernfs_dentry_node(), we will check the dentry->inode is NULL or not, which is superfluous.

So remove the check in kernfs_node_from_dentry().

Thanks.

Signature · 1 line
tejun