[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220322030004.148560-5-krisman@collabora.com>
Date: Mon, 21 Mar 2022 23:00:03 -0400
From: Gabriel Krisman Bertazi <krisman@...labora.com>
To: tytso@....edu
Cc: ebiggers@...nel.org, jaegeuk@...nel.org,
linux-ext4@...r.kernel.org,
Gabriel Krisman Bertazi <krisman@...labora.com>,
kernel@...labora.com
Subject: [PATCH 4/5] ext4: Simplify hash check on ext4_match
The existence of fname->cf_name.name requires s_encoding & IS_CASEFOLDED,
therefore this can be simplified.
Signed-off-by: Gabriel Krisman Bertazi <krisman@...labora.com>
---
fs/ext4/namei.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 71b4b05fae89..8520115cd5c2 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1442,19 +1442,13 @@ static bool ext4_match(struct inode *parent,
#if IS_ENABLED(CONFIG_UNICODE)
f.cf_name = fname->cf_name;
- if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) &&
- (!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) {
- if (fname->cf_name.name) {
- if (IS_ENCRYPTED(parent)) {
- if (fname->hinfo.hash != EXT4_DIRENT_HASH(de) ||
- fname->hinfo.minor_hash !=
- EXT4_DIRENT_MINOR_HASH(de)) {
-
- return false;
- }
- }
- }
+ if (IS_ENCRYPTED(parent) && fname->cf_name.name) {
+ if (fname->hinfo.hash != EXT4_DIRENT_HASH(de) ||
+ fname->hinfo.minor_hash != EXT4_DIRENT_MINOR_HASH(de))
+ return false;
+ }
+ if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent)) {
ret = ext4_ci_compare(parent, &f, de->name, de->name_len);
if (ret < 0) {
/*
--
2.35.1
Powered by blists - more mailing lists