Skip to content

Commit 40c35a0

Browse files
author
Kent Overstreet
committed
bcachefs: Fix build when CONFIG_UNICODE=n
94426e4, which added the killswitch for casefolding, accidentally removed some of the ifdefs we need to avoid build errors. It appears we need better build testing for different configurations, it took two weeks for the robots to catch this one. Fixes: 94426e4 ("bcachefs: opts.casefold_disabled") Signed-off-by: Kent Overstreet <[email protected]>
1 parent c02b943 commit 40c35a0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

fs/bcachefs/dirent.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <linux/dcache.h>
1515

16+
#ifdef CONFIG_UNICODE
1617
int bch2_casefold(struct btree_trans *trans, const struct bch_hash_info *info,
1718
const struct qstr *str, struct qstr *out_cf)
1819
{
@@ -33,6 +34,7 @@ int bch2_casefold(struct btree_trans *trans, const struct bch_hash_info *info,
3334
*out_cf = (struct qstr) QSTR_INIT(buf, ret);
3435
return 0;
3536
}
37+
#endif
3638

3739
static unsigned bch2_dirent_name_bytes(struct bkey_s_c_dirent d)
3840
{
@@ -254,6 +256,7 @@ int bch2_dirent_init_name(struct bch_fs *c,
254256
if (!bch2_fs_casefold_enabled(c))
255257
return -EOPNOTSUPP;
256258

259+
#ifdef CONFIG_UNICODE
257260
memcpy(&dirent->v.d_cf_name_block.d_names[0], name->name, name->len);
258261

259262
char *cf_out = &dirent->v.d_cf_name_block.d_names[name->len];
@@ -279,6 +282,7 @@ int bch2_dirent_init_name(struct bch_fs *c,
279282
dirent->v.d_cf_name_block.d_cf_name_len = cpu_to_le16(cf_len);
280283

281284
EBUG_ON(bch2_dirent_get_casefold_name(dirent_i_to_s_c(dirent)).len != cf_len);
285+
#endif
282286
}
283287

284288
unsigned u64s = dirent_val_u64s(name->len, cf_len);

fs/bcachefs/dirent.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct bch_fs;
2323
struct bch_hash_info;
2424
struct bch_inode_info;
2525

26+
#ifdef CONFIG_UNICODE
2627
int bch2_casefold(struct btree_trans *, const struct bch_hash_info *,
2728
const struct qstr *, struct qstr *);
2829

@@ -37,6 +38,14 @@ static inline int bch2_maybe_casefold(struct btree_trans *trans,
3738
return bch2_casefold(trans, info, str, out_cf);
3839
}
3940
}
41+
#else
42+
static inline int bch2_maybe_casefold(struct btree_trans *trans,
43+
const struct bch_hash_info *info,
44+
const struct qstr *str, struct qstr *out_cf)
45+
{
46+
return -EOPNOTSUPP;
47+
}
48+
#endif
4049

4150
struct qstr bch2_dirent_get_name(struct bkey_s_c_dirent);
4251

0 commit comments

Comments
 (0)