Skip to content

Commit c83311c

Browse files
author
Kent Overstreet
committed
bcachefs: Use generic_set_sb_d_ops for standard casefolding d_ops
Suggested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent a2f5463 commit c83311c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

fs/bcachefs/fs.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ static inline void bch2_inode_flags_to_vfs(struct bch_fs *c, struct bch_inode_in
6666

6767
if (bch2_inode_casefold(c, &inode->ei_inode))
6868
inode->v.i_flags |= S_CASEFOLD;
69+
else
70+
inode->v.i_flags &= ~S_CASEFOLD;
6971
}
7072

7173
void bch2_inode_update_after_write(struct btree_trans *trans,
@@ -848,10 +850,8 @@ int __bch2_unlink(struct inode *vdir, struct dentry *dentry,
848850
set_nlink(&inode->v, 0);
849851
}
850852

851-
if (IS_CASEFOLDED(vdir)) {
853+
if (IS_CASEFOLDED(vdir))
852854
d_invalidate(dentry);
853-
d_prune_aliases(&inode->v);
854-
}
855855
err:
856856
bch2_trans_put(trans);
857857
bch2_unlock_inodes(INODE_UPDATE_LOCK, dir, inode);
@@ -2571,6 +2571,11 @@ static int bch2_fs_get_tree(struct fs_context *fc)
25712571
if (ret)
25722572
goto err_put_super;
25732573

2574+
#ifdef CONFIG_UNICODE
2575+
sb->s_encoding = c->cf_encoding;
2576+
#endif
2577+
generic_set_sb_d_ops(sb);
2578+
25742579
vinode = bch2_vfs_inode_get(c, BCACHEFS_ROOT_SUBVOL_INUM);
25752580
ret = PTR_ERR_OR_ZERO(vinode);
25762581
bch_err_msg(c, ret, "mounting: error getting root inode");

fs/bcachefs/namei.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ bool bch2_reinherit_attrs(struct bch_inode_unpacked *dst_u,
343343
bool ret = false;
344344

345345
for (id = 0; id < Inode_opt_nr; id++) {
346+
if (!S_ISDIR(dst_u->bi_mode) && id == Inode_opt_casefold)
347+
continue;
348+
346349
/* Skip attributes that were explicitly set on this inode */
347350
if (dst_u->bi_fields_set & (1 << id))
348351
continue;

0 commit comments

Comments
 (0)