Skip to content

Commit 28add38

Browse files
krisman-at-collaborabrauner
authored andcommitted
f2fs: Move CONFIG_UNICODE defguards into the code flow
Instead of a bunch of ifdefs, make the unicode built checks part of the code flow where possible, as requested by Torvalds. Signed-off-by: Gabriel Krisman Bertazi <[email protected]> [[email protected]: port to 6.10-rc1] Signed-off-by: Eugen Hristev <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Eric Biggers <[email protected]> Reviewed-by: Gabriel Krisman Bertazi <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent d98c822 commit 28add38

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

fs/f2fs/namei.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
576576
goto out_iput;
577577
}
578578
out_splice:
579-
#if IS_ENABLED(CONFIG_UNICODE)
580-
if (!inode && IS_CASEFOLDED(dir)) {
579+
if (IS_ENABLED(CONFIG_UNICODE) && !inode && IS_CASEFOLDED(dir)) {
581580
/* Eventually we want to call d_add_ci(dentry, NULL)
582581
* for negative dentries in the encoding case as
583582
* well. For now, prevent the negative dentry
@@ -586,7 +585,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
586585
trace_f2fs_lookup_end(dir, dentry, ino, err);
587586
return NULL;
588587
}
589-
#endif
588+
590589
new = d_splice_alias(inode, dentry);
591590
trace_f2fs_lookup_end(dir, !IS_ERR_OR_NULL(new) ? new : dentry,
592591
ino, IS_ERR(new) ? PTR_ERR(new) : err);
@@ -639,16 +638,15 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
639638
f2fs_delete_entry(de, page, dir, inode);
640639
f2fs_unlock_op(sbi);
641640

642-
#if IS_ENABLED(CONFIG_UNICODE)
643641
/* VFS negative dentries are incompatible with Encoding and
644642
* Case-insensitiveness. Eventually we'll want avoid
645643
* invalidating the dentries here, alongside with returning the
646644
* negative dentries at f2fs_lookup(), when it is better
647645
* supported by the VFS for the CI case.
648646
*/
649-
if (IS_CASEFOLDED(dir))
647+
if (IS_ENABLED(CONFIG_UNICODE) && IS_CASEFOLDED(dir))
650648
d_invalidate(dentry);
651-
#endif
649+
652650
if (IS_DIRSYNC(dir))
653651
f2fs_sync_fs(sbi->sb, 1);
654652
fail:

fs/f2fs/super.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ struct kmem_cache *f2fs_cf_name_slab;
321321
static int __init f2fs_create_casefold_cache(void)
322322
{
323323
f2fs_cf_name_slab = f2fs_kmem_cache_create("f2fs_casefolded_name",
324-
F2FS_NAME_LEN);
324+
F2FS_NAME_LEN);
325325
return f2fs_cf_name_slab ? 0 : -ENOMEM;
326326
}
327327

@@ -1326,13 +1326,13 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
13261326
return -EINVAL;
13271327
}
13281328
#endif
1329-
#if !IS_ENABLED(CONFIG_UNICODE)
1330-
if (f2fs_sb_has_casefold(sbi)) {
1329+
1330+
if (!IS_ENABLED(CONFIG_UNICODE) && f2fs_sb_has_casefold(sbi)) {
13311331
f2fs_err(sbi,
13321332
"Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE");
13331333
return -EINVAL;
13341334
}
1335-
#endif
1335+
13361336
/*
13371337
* The BLKZONED feature indicates that the drive was formatted with
13381338
* zone alignment optimization. This is optional for host-aware

0 commit comments

Comments
 (0)