@@ -823,25 +823,6 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
823823 if (ret )
824824 goto err ;
825825
826- #ifdef CONFIG_UNICODE
827- /* Default encoding until we can potentially have more as an option. */
828- c -> cf_encoding = utf8_load (BCH_FS_DEFAULT_UTF8_ENCODING );
829- if (IS_ERR (c -> cf_encoding )) {
830- printk (KERN_ERR "Cannot load UTF-8 encoding for filesystem. Version: %u.%u.%u" ,
831- unicode_major (BCH_FS_DEFAULT_UTF8_ENCODING ),
832- unicode_minor (BCH_FS_DEFAULT_UTF8_ENCODING ),
833- unicode_rev (BCH_FS_DEFAULT_UTF8_ENCODING ));
834- ret = - EINVAL ;
835- goto err ;
836- }
837- #else
838- if (c -> sb .features & BIT_ULL (BCH_FEATURE_casefolding )) {
839- printk (KERN_ERR "Cannot mount a filesystem with casefolding on a kernel without CONFIG_UNICODE\n" );
840- ret = - EINVAL ;
841- goto err ;
842- }
843- #endif
844-
845826 pr_uuid (& name , c -> sb .user_uuid .b );
846827 ret = name .allocation_failure ? - BCH_ERR_ENOMEM_fs_name_alloc : 0 ;
847828 if (ret )
@@ -941,6 +922,29 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
941922 if (ret )
942923 goto err ;
943924
925+ #ifdef CONFIG_UNICODE
926+ /* Default encoding until we can potentially have more as an option. */
927+ c -> cf_encoding = utf8_load (BCH_FS_DEFAULT_UTF8_ENCODING );
928+ if (IS_ERR (c -> cf_encoding )) {
929+ printk (KERN_ERR "Cannot load UTF-8 encoding for filesystem. Version: %u.%u.%u" ,
930+ unicode_major (BCH_FS_DEFAULT_UTF8_ENCODING ),
931+ unicode_minor (BCH_FS_DEFAULT_UTF8_ENCODING ),
932+ unicode_rev (BCH_FS_DEFAULT_UTF8_ENCODING ));
933+ ret = - EINVAL ;
934+ goto err ;
935+ }
936+ bch_info (c , "Using encoding defined by superblock: utf8-%u.%u.%u" ,
937+ unicode_major (BCH_FS_DEFAULT_UTF8_ENCODING ),
938+ unicode_minor (BCH_FS_DEFAULT_UTF8_ENCODING ),
939+ unicode_rev (BCH_FS_DEFAULT_UTF8_ENCODING ));
940+ #else
941+ if (c -> sb .features & BIT_ULL (BCH_FEATURE_casefolding )) {
942+ printk (KERN_ERR "Cannot mount a filesystem with casefolding on a kernel without CONFIG_UNICODE\n" );
943+ ret = - EINVAL ;
944+ goto err ;
945+ }
946+ #endif
947+
944948 for (i = 0 ; i < c -> sb .nr_devices ; i ++ ) {
945949 if (!bch2_member_exists (c -> disk_sb .sb , i ))
946950 continue ;
0 commit comments