Commit 70c3d89f authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: Emit unicode version message on startup



fstests expects this

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent c83311c5
Loading
Loading
Loading
Loading
+23 −19
Original line number Diff line number Diff line
@@ -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;