diff mbox series

[2/2] smb: client: remove unnecessary NULL check in open_cached_dir_by_dentry()

Message ID 20241122203901.283703-2-henrique.carvalho@suse.com (mailing list archive)
State New
Headers show
Series [1/2] smb: client: disable directory caching when dir_cache_timeout is zero | expand

Commit Message

Henrique Carvalho Nov. 22, 2024, 8:39 p.m. UTC
The function open_cached_dir_by_dentry() is only called by
cifs_dentry_needs_reval(), and it always passes dentry->d_parent as the
argument to dentry.

Since dentry->d_parent cannot be NULL, the check for dentry == NULL
is unnecessary and can be removed.

Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
---
 fs/smb/client/cached_dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paulo Alcantara Nov. 22, 2024, 10:21 p.m. UTC | #1
Henrique Carvalho <henrique.carvalho@suse.com> writes:

> The function open_cached_dir_by_dentry() is only called by
> cifs_dentry_needs_reval(), and it always passes dentry->d_parent as the
> argument to dentry.
>
> Since dentry->d_parent cannot be NULL, the check for dentry == NULL
> is unnecessary and can be removed.
>
> Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
> ---
>  fs/smb/client/cached_dir.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Looks good,

Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
diff mbox series

Patch

diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c
index d8b1cf1043c35..9ac503dee0793 100644
--- a/fs/smb/client/cached_dir.c
+++ b/fs/smb/client/cached_dir.c
@@ -400,7 +400,7 @@  int open_cached_dir_by_dentry(struct cifs_tcon *tcon,
 
 	spin_lock(&cfids->cfid_list_lock);
 	list_for_each_entry(cfid, &cfids->entries, entry) {
-		if (dentry && cfid->dentry == dentry) {
+		if (cfid->dentry == dentry) {
 			cifs_dbg(FYI, "found a cached file handle by dentry\n");
 			kref_get(&cfid->refcount);
 			*ret_cfid = cfid;