From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: loosen the block-group-tree feature dependency check
Date: Wed, 21 Sep 2022 12:02:48 +0200 [thread overview]
Message-ID: <20220921100248.GD32411@twin.jikos.cz> (raw)
In-Reply-To: <d43e26ecf12268e8bc75986052cc6021a096db74.1662961395.git.wqu@suse.com>
On Mon, Sep 12, 2022 at 01:44:37PM +0800, Qu Wenruo wrote:
> +int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb)
> +{
> + struct btrfs_super_block *disk_super = fs_info->super_copy;
> + u64 incompat = btrfs_super_incompat_flags(disk_super);
> + u64 compat_ro = btrfs_super_compat_ro_flags(disk_super);
> +
> + if (incompat & ~BTRFS_FEATURE_INCOMPAT_SUPP) {
> + btrfs_err(fs_info,
> + "cannot mount because of unsupported optional features (0x%llx)",
I've reworded this as "cannot mount because of unknown incompat features
(0x%llx)"
> + incompat);
> + return -EINVAL;
> + }
> +
> + /* Runtime limitation for mixed block groups. */
> + if ((incompat & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) &&
> + (fs_info->sectorsize != fs_info->nodesize)) {
> + btrfs_err(fs_info,
> +"unequal nodesize/sectorsize (%u != %u) are not allowed for mixed block groups",
> + fs_info->nodesize, fs_info->sectorsize);
> + return -EINVAL;
> + }
> +
> + /* Mixed backref is an always-enabled feature. */
> + incompat |= BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF;
> +
> + /* Set compression related flags just in case. */
> + if (fs_info->compress_type == BTRFS_COMPRESS_LZO)
> + incompat |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO;
> + else if (fs_info->compress_type == BTRFS_COMPRESS_ZSTD)
> + incompat |= BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD;
> +
> + /*
> + * An ancient flag, which should really be marked deprecated.
> + * Such runtime limitation doesn't really need a incompat flag.
> + */
> + if (btrfs_super_nodesize(disk_super) > PAGE_SIZE)
> + incompat |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
> +
> + if (compat_ro & ~BTRFS_FEATURE_COMPAT_RO_SUPP && !sb_rdonly(sb)) {
> + btrfs_err(fs_info,
> + "cannot mount read-write because of unsupported optional features (0x%llx)",
and "cannot mount read-write because of unknown compat_ro features
(0x%llx)"
so it can be matched agains the incompat and compat_ro fields eg. in the
super block dump.
next prev parent reply other threads:[~2022-09-21 10:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-12 5:44 [PATCH] btrfs: loosen the block-group-tree feature dependency check Qu Wenruo
2022-09-20 23:40 ` Qu Wenruo
2022-09-21 9:46 ` David Sterba
2022-09-21 10:02 ` David Sterba [this message]
2022-09-23 3:31 ` Wang Yugui
2022-09-23 7:26 ` [PATCH] fixup btrfs: relax block-group-tree feature dependency checks Wang Yugui
2022-09-23 8:23 ` Qu Wenruo
2022-09-23 10:48 ` David Sterba
2022-09-23 8:27 ` [PATCH] btrfs: loosen the block-group-tree feature dependency check Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220921100248.GD32411@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox