linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/kernfs: remove the double check of dentry->inode
@ 2020-11-13 13:21 Hui Su
  2020-11-25 12:49 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Su @ 2020-11-13 13:21 UTC (permalink / raw)
  To: gregkh, tj, linux-kernel; +Cc: sh_def

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().

Signed-off-by: Hui Su <sh_def@163.com>
---
 fs/kernfs/dir.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 9aec80b9d7c6..b062c666df05 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -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;
 }
-- 
2.29.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/kernfs: remove the double check of dentry->inode
  2020-11-13 13:21 [PATCH] fs/kernfs: remove the double check of dentry->inode Hui Su
@ 2020-11-25 12:49 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2020-11-25 12:49 UTC (permalink / raw)
  To: Hui Su; +Cc: gregkh, linux-kernel

On Fri, Nov 13, 2020 at 09:21:43PM +0800, Hui Su wrote:
> 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().
> 
> Signed-off-by: Hui Su <sh_def@163.com>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-25 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 13:21 [PATCH] fs/kernfs: remove the double check of dentry->inode Hui Su
2020-11-25 12:49 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).