1 // SPDX-License-Identifier: GPL-2.0
8 void __btrfs_set_fs_incompat(struct btrfs_fs_info
*fs_info
, u64 flag
,
11 struct btrfs_super_block
*disk_super
;
14 disk_super
= fs_info
->super_copy
;
15 features
= btrfs_super_incompat_flags(disk_super
);
16 if (!(features
& flag
)) {
17 spin_lock(&fs_info
->super_lock
);
18 features
= btrfs_super_incompat_flags(disk_super
);
19 if (!(features
& flag
)) {
21 btrfs_set_super_incompat_flags(disk_super
, features
);
23 "setting incompat feature flag for %s (0x%llx)",
26 spin_unlock(&fs_info
->super_lock
);
27 set_bit(BTRFS_FS_FEATURE_CHANGED
, &fs_info
->flags
);
31 void __btrfs_clear_fs_incompat(struct btrfs_fs_info
*fs_info
, u64 flag
,
34 struct btrfs_super_block
*disk_super
;
37 disk_super
= fs_info
->super_copy
;
38 features
= btrfs_super_incompat_flags(disk_super
);
39 if (features
& flag
) {
40 spin_lock(&fs_info
->super_lock
);
41 features
= btrfs_super_incompat_flags(disk_super
);
42 if (features
& flag
) {
44 btrfs_set_super_incompat_flags(disk_super
, features
);
46 "clearing incompat feature flag for %s (0x%llx)",
49 spin_unlock(&fs_info
->super_lock
);
50 set_bit(BTRFS_FS_FEATURE_CHANGED
, &fs_info
->flags
);
54 void __btrfs_set_fs_compat_ro(struct btrfs_fs_info
*fs_info
, u64 flag
,
57 struct btrfs_super_block
*disk_super
;
60 disk_super
= fs_info
->super_copy
;
61 features
= btrfs_super_compat_ro_flags(disk_super
);
62 if (!(features
& flag
)) {
63 spin_lock(&fs_info
->super_lock
);
64 features
= btrfs_super_compat_ro_flags(disk_super
);
65 if (!(features
& flag
)) {
67 btrfs_set_super_compat_ro_flags(disk_super
, features
);
69 "setting compat-ro feature flag for %s (0x%llx)",
72 spin_unlock(&fs_info
->super_lock
);
73 set_bit(BTRFS_FS_FEATURE_CHANGED
, &fs_info
->flags
);
77 void __btrfs_clear_fs_compat_ro(struct btrfs_fs_info
*fs_info
, u64 flag
,
80 struct btrfs_super_block
*disk_super
;
83 disk_super
= fs_info
->super_copy
;
84 features
= btrfs_super_compat_ro_flags(disk_super
);
85 if (features
& flag
) {
86 spin_lock(&fs_info
->super_lock
);
87 features
= btrfs_super_compat_ro_flags(disk_super
);
88 if (features
& flag
) {
90 btrfs_set_super_compat_ro_flags(disk_super
, features
);
92 "clearing compat-ro feature flag for %s (0x%llx)",
95 spin_unlock(&fs_info
->super_lock
);
96 set_bit(BTRFS_FS_FEATURE_CHANGED
, &fs_info
->flags
);