Skip to content

Commit af494af

Browse files
ebiggerstytso
authored andcommitted
libfs: remove redundant checks of s_encoding
Now that neither ext4 nor f2fs allows 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-4-ebiggers@kernel.org Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent b814279 commit af494af

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

fs/libfs.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,16 +1381,6 @@ bool is_empty_dir_inode(struct inode *inode)
13811381
}
13821382

13831383
#if IS_ENABLED(CONFIG_UNICODE)
1384-
/*
1385-
* Determine if the name of a dentry should be casefolded.
1386-
*
1387-
* Return: if names will need casefolding
1388-
*/
1389-
static bool needs_casefold(const struct inode *dir)
1390-
{
1391-
return IS_CASEFOLDED(dir) && dir->i_sb->s_encoding;
1392-
}
1393-
13941384
/**
13951385
* generic_ci_d_compare - generic d_compare implementation for casefolding filesystems
13961386
* @dentry: dentry whose name we are checking against
@@ -1411,7 +1401,7 @@ static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
14111401
char strbuf[DNAME_INLINE_LEN];
14121402
int ret;
14131403

1414-
if (!dir || !needs_casefold(dir))
1404+
if (!dir || !IS_CASEFOLDED(dir))
14151405
goto fallback;
14161406
/*
14171407
* If the dentry name is stored in-line, then it may be concurrently
@@ -1453,7 +1443,7 @@ static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
14531443
const struct unicode_map *um = sb->s_encoding;
14541444
int ret = 0;
14551445

1456-
if (!dir || !needs_casefold(dir))
1446+
if (!dir || !IS_CASEFOLDED(dir))
14571447
return 0;
14581448

14591449
ret = utf8_casefold_hash(um, dentry, str);

0 commit comments

Comments
 (0)