Re: [PATCH v3 1/5] btrfs: add compat_flags to btrfs_inode_item

David Sterba
2021-05-13T17:24:08Z

On Fri, Apr 09, 2021 at 11:20:32AM -0700, Boris Burkov wrote:
> On Fri, Apr 09, 2021 at 07:40:44AM +0800, Anand Jain wrote:
> > On 09/04/2021 02:33, Boris Burkov wrote:
> > Why not update the tree checker (need to fix stable kernel as well) and
> > inode flags, so that we spare u64 space in the btrfs_inode_item?
>
> I don't understand this suggestion, could you be more specific?

That's probably the same suggestion I made regarding the existing inode
flags split, with some minimal backport to recognize the compat flags.

> > Also, I think we need the incompt flags to check during mount.
>
> Same for this one, sorry. What do you think I should check?

The flag is read-only compat, and once it's added to the set
BTRFS_FEATURE_COMPAT_RO_SUPP it's already checked in open_ctree

3290 /*
3291 * Needn't use the lock because there is no other task which will
3292 * update the flag.
3293 */
3294 btrfs_set_super_incompat_flags(disk_super, features);
3295
3296 features = btrfs_super_compat_ro_flags(disk_super) &
3297 ~BTRFS_FEATURE_COMPAT_RO_SUPP;
3298 if (!sb_rdonly(sb) && features) {
3299 btrfs_err(fs_info,
3300 "cannot mount read-write because of unsupported optional features (%llx)",
3301 features);
3302 err = -EINVAL;
3303 goto fail_alloc;
3304 }

So the mount check is there.