Skip to content

Commit cfbb825

Browse files
committed
btrfs: add incompat for raid1 with 3, 4 copies
The new raid1c3 and raid1c4 profiles are backward incompatible and the name shall be 'raid1c34', the status can be found in the global supported features in /sys/fs/btrfs/features or in the per-filesystem directory. Signed-off-by: David Sterba <[email protected]>
1 parent 8d6fac0 commit cfbb825

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

fs/btrfs/ctree.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ struct btrfs_super_block {
292292
BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF | \
293293
BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA | \
294294
BTRFS_FEATURE_INCOMPAT_NO_HOLES | \
295-
BTRFS_FEATURE_INCOMPAT_METADATA_UUID)
295+
BTRFS_FEATURE_INCOMPAT_METADATA_UUID | \
296+
BTRFS_FEATURE_INCOMPAT_RAID1C34)
296297

297298
#define BTRFS_FEATURE_INCOMPAT_SAFE_SET \
298299
(BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF)

fs/btrfs/sysfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ BTRFS_FEAT_ATTR_INCOMPAT(skinny_metadata, SKINNY_METADATA);
259259
BTRFS_FEAT_ATTR_INCOMPAT(no_holes, NO_HOLES);
260260
BTRFS_FEAT_ATTR_INCOMPAT(metadata_uuid, METADATA_UUID);
261261
BTRFS_FEAT_ATTR_COMPAT_RO(free_space_tree, FREE_SPACE_TREE);
262+
BTRFS_FEAT_ATTR_INCOMPAT(raid1c34, RAID1C34);
262263

263264
static struct attribute *btrfs_supported_feature_attrs[] = {
264265
BTRFS_FEAT_ATTR_PTR(mixed_backref),
@@ -273,6 +274,7 @@ static struct attribute *btrfs_supported_feature_attrs[] = {
273274
BTRFS_FEAT_ATTR_PTR(no_holes),
274275
BTRFS_FEAT_ATTR_PTR(metadata_uuid),
275276
BTRFS_FEAT_ATTR_PTR(free_space_tree),
277+
BTRFS_FEAT_ATTR_PTR(raid1c34),
276278
NULL
277279
};
278280

fs/btrfs/volumes.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4717,6 +4717,14 @@ static void check_raid56_incompat_flag(struct btrfs_fs_info *info, u64 type)
47174717
btrfs_set_fs_incompat(info, RAID56);
47184718
}
47194719

4720+
static void check_raid1c34_incompat_flag(struct btrfs_fs_info *info, u64 type)
4721+
{
4722+
if (!(type & (BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4)))
4723+
return;
4724+
4725+
btrfs_set_fs_incompat(info, RAID1C34);
4726+
}
4727+
47204728
static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
47214729
u64 start, u64 type)
47224730
{
@@ -4983,6 +4991,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
49834991

49844992
free_extent_map(em);
49854993
check_raid56_incompat_flag(info, type);
4994+
check_raid1c34_incompat_flag(info, type);
49864995

49874996
kfree(devices_info);
49884997
return 0;

include/uapi/linux/btrfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ struct btrfs_ioctl_fs_info_args {
270270
#define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA (1ULL << 8)
271271
#define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9)
272272
#define BTRFS_FEATURE_INCOMPAT_METADATA_UUID (1ULL << 10)
273+
#define BTRFS_FEATURE_INCOMPAT_RAID1C34 (1ULL << 11)
273274

274275
struct btrfs_ioctl_feature_flags {
275276
__u64 compat_flags;

0 commit comments

Comments
 (0)