]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bcachefs: Emit unicode version message on startup
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 26 Apr 2025 16:09:33 +0000 (12:09 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 28 Apr 2025 20:46:12 +0000 (16:46 -0400)
fstests expects this

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/super.c

index e4ab0595c0aef66eff53f9bdc520ff514ad16ede..32fccca350ed8e4feeceba4eb095c5030760fffa 100644 (file)
@@ -823,25 +823,6 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
        if (ret)
                goto err;
 
-#ifdef CONFIG_UNICODE
-       /* Default encoding until we can potentially have more as an option. */
-       c->cf_encoding = utf8_load(BCH_FS_DEFAULT_UTF8_ENCODING);
-       if (IS_ERR(c->cf_encoding)) {
-               printk(KERN_ERR "Cannot load UTF-8 encoding for filesystem. Version: %u.%u.%u",
-                       unicode_major(BCH_FS_DEFAULT_UTF8_ENCODING),
-                       unicode_minor(BCH_FS_DEFAULT_UTF8_ENCODING),
-                       unicode_rev(BCH_FS_DEFAULT_UTF8_ENCODING));
-               ret = -EINVAL;
-               goto err;
-       }
-#else
-       if (c->sb.features & BIT_ULL(BCH_FEATURE_casefolding)) {
-               printk(KERN_ERR "Cannot mount a filesystem with casefolding on a kernel without CONFIG_UNICODE\n");
-               ret = -EINVAL;
-               goto err;
-       }
-#endif
-
        pr_uuid(&name, c->sb.user_uuid.b);
        ret = name.allocation_failure ? -BCH_ERR_ENOMEM_fs_name_alloc : 0;
        if (ret)
@@ -941,6 +922,29 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
        if (ret)
                goto err;
 
+#ifdef CONFIG_UNICODE
+       /* Default encoding until we can potentially have more as an option. */
+       c->cf_encoding = utf8_load(BCH_FS_DEFAULT_UTF8_ENCODING);
+       if (IS_ERR(c->cf_encoding)) {
+               printk(KERN_ERR "Cannot load UTF-8 encoding for filesystem. Version: %u.%u.%u",
+                       unicode_major(BCH_FS_DEFAULT_UTF8_ENCODING),
+                       unicode_minor(BCH_FS_DEFAULT_UTF8_ENCODING),
+                       unicode_rev(BCH_FS_DEFAULT_UTF8_ENCODING));
+               ret = -EINVAL;
+               goto err;
+       }
+       bch_info(c, "Using encoding defined by superblock: utf8-%u.%u.%u",
+                unicode_major(BCH_FS_DEFAULT_UTF8_ENCODING),
+                unicode_minor(BCH_FS_DEFAULT_UTF8_ENCODING),
+                unicode_rev(BCH_FS_DEFAULT_UTF8_ENCODING));
+#else
+       if (c->sb.features & BIT_ULL(BCH_FEATURE_casefolding)) {
+               printk(KERN_ERR "Cannot mount a filesystem with casefolding on a kernel without CONFIG_UNICODE\n");
+               ret = -EINVAL;
+               goto err;
+       }
+#endif
+
        for (i = 0; i < c->sb.nr_devices; i++) {
                if (!bch2_member_exists(c->disk_sb.sb, i))
                        continue;