Skip to contentSkip to conversation

cramfs_lookup(): use d_splice_alias()

RFC PATCH In review Al Viro 3 participants 3 messages May 13, 2018

Subsystems (2)
lore
Share & tools
lore

Al Viro

author
#0 lore raw

RFC PATCH 1/1 cramfs_lookup(): use d_splice_alias()

simpler code that way, actually

---
 fs/cramfs/inode.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/cramfs/inode.c +1 -4
index 017b0ab19bc4..4756e9daa0b2 100644
@@ -808,10 +808,7 @@ static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, un
 	}
 out:
 	mutex_unlock(&read_mutex);
-	if (IS_ERR(inode))
-		return ERR_CAST(inode);
-	d_add(dentry, inode);
-	return NULL;
+	return d_splice_alias(inode, dentry);
 }
 
 static int cramfs_readpage(struct file *file, struct page *page)
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Al Viro

simpler code that way, actually

Agreed.

Please feel free to carry this patch in your repo as you see fit. Mine is empty wrt cramfs at the moment and generating a pull req to Linus to bounce only one patch from you would be silly.

Quoted 25 lines
---
 fs/cramfs/inode.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/cramfs/inode.c +1 -4
index 017b0ab19bc4..4756e9daa0b2 100644
@@ -808,10 +808,7 @@ static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, un
 	}
 out:
 	mutex_unlock(&read_mutex);
-	if (IS_ERR(inode))
-		return ERR_CAST(inode);
-	d_add(dentry, inode);
-	return NULL;
+	return d_splice_alias(inode, dentry);
 }
 
 static int cramfs_readpage(struct file *file, struct page *page)
Signature · 1 line
2.11.0
maintainer
#2 lore raw
Quoted 7 lines · Nicolas Pitre
Quoted 4 lines · Al Viro

simpler code that way, actually

Quoted 7 lines

Agreed.

Please feel free to carry this patch in your repo as you see fit. Mine is empty wrt cramfs at the moment and generating a pull req to Linus to bounce only one patch from you would be silly.

Sure; apologies for duplicate you'll get - I should've used git-send-email to start with ;-/