Skip to content

Commit

Permalink
libfs: remove redundant checks of s_encoding
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ebiggers authored and tytso committed Aug 27, 2023
1 parent b814279 commit af494af
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions fs/libfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,16 +1381,6 @@ bool is_empty_dir_inode(struct inode *inode)
}

#if IS_ENABLED(CONFIG_UNICODE)
/*
* Determine if the name of a dentry should be casefolded.
*
* Return: if names will need casefolding
*/
static bool needs_casefold(const struct inode *dir)
{
return IS_CASEFOLDED(dir) && dir->i_sb->s_encoding;
}

/**
* generic_ci_d_compare - generic d_compare implementation for casefolding filesystems
* @dentry: dentry whose name we are checking against
Expand All @@ -1411,7 +1401,7 @@ static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
char strbuf[DNAME_INLINE_LEN];
int ret;

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

if (!dir || !needs_casefold(dir))
if (!dir || !IS_CASEFOLDED(dir))
return 0;

ret = utf8_casefold_hash(um, dentry, str);
Expand Down

0 comments on commit af494af

Please sign in to comment.