Skip to content

Commit b814279

Browse files
ebiggerstytso
authored andcommitted
ext4: remove redundant checks of s_encoding
Now that ext4 does not allow inodes with the casefold flag to be instantiated when unsupported, it's unnecessary to repeatedly check for support later on during random filesystem operations. Signed-off-by: Eric Biggers <ebiggers@google.com> Link: https://lore.kernel.org/r/20230814182903.37267-3-ebiggers@kernel.org Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 8216776 commit b814279

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fs/ext4/hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
300300
unsigned char *buff;
301301
struct qstr qstr = {.name = name, .len = len };
302302

303-
if (len && IS_CASEFOLDED(dir) && um &&
303+
if (len && IS_CASEFOLDED(dir) &&
304304
(!IS_ENCRYPTED(dir) || fscrypt_has_encryption_key(dir))) {
305305
buff = kzalloc(sizeof(char) * PATH_MAX, GFP_KERNEL);
306306
if (!buff)

fs/ext4/namei.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ int ext4_fname_setup_ci_filename(struct inode *dir, const struct qstr *iname,
14451445
struct dx_hash_info *hinfo = &name->hinfo;
14461446
int len;
14471447

1448-
if (!IS_CASEFOLDED(dir) || !dir->i_sb->s_encoding ||
1448+
if (!IS_CASEFOLDED(dir) ||
14491449
(IS_ENCRYPTED(dir) && !fscrypt_has_encryption_key(dir))) {
14501450
cf_name->name = NULL;
14511451
return 0;
@@ -1496,7 +1496,7 @@ static bool ext4_match(struct inode *parent,
14961496
#endif
14971497

14981498
#if IS_ENABLED(CONFIG_UNICODE)
1499-
if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) &&
1499+
if (IS_CASEFOLDED(parent) &&
15001500
(!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) {
15011501
if (fname->cf_name.name) {
15021502
struct qstr cf = {.name = fname->cf_name.name,
@@ -2393,7 +2393,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
23932393

23942394
#if IS_ENABLED(CONFIG_UNICODE)
23952395
if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
2396-
sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
2396+
utf8_validate(sb->s_encoding, &dentry->d_name))
23972397
return -EINVAL;
23982398
#endif
23992399

0 commit comments

Comments
 (0)