btrfs-progs: zoned: add new ZONED feature flag

With the zoned feature enabled, a zoned block device-aware btrfs
allocates block groups aligned to the device zones and always written in
sequential zones at the zone write pointer position.

It also supports "emulated" zoned mode on a non-zoned device. In the
emulated mode, btrfs emulates conventional zones by slicing the device
into fixed-size zones.

We don't support conversion from the ext4 volume with the zoned feature
because we can't be sure all the converted block groups are aligned to
zone boundaries.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Naohiro Aota 2021-04-26 15:27:20 +09:00 committed by David Sterba
parent 7953f4357b
commit 242c8328bc
4 changed files with 15 additions and 3 deletions

View File

@ -100,6 +100,14 @@ static const struct btrfs_feature mkfs_features[] = {
NULL, 0,
NULL, 0,
"RAID1 with 3 or 4 copies" },
#ifdef BTRFS_ZONED
{ "zoned", BTRFS_FEATURE_INCOMPAT_ZONED,
"zoned",
VERSION_TO_STRING2(5,12),
NULL, 0,
NULL, 0,
"support zoned devices" },
#endif
/* Keep this one last */
{ "list-all", BTRFS_FEATURE_LIST_ALL, NULL }
};

View File

@ -25,7 +25,7 @@
| BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA)
/*
* Avoid multi-device features (RAID56) and mixed block groups
* Avoid multi-device features (RAID56), mixed block groups, and zoned mode
*/
#define BTRFS_CONVERT_ALLOWED_FEATURES \
(BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF \
@ -35,7 +35,8 @@
| BTRFS_FEATURE_INCOMPAT_BIG_METADATA \
| BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF \
| BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA \
| BTRFS_FEATURE_INCOMPAT_NO_HOLES)
| BTRFS_FEATURE_INCOMPAT_NO_HOLES \
| BTRFS_FEATURE_INCOMPAT_ZONED)
#define BTRFS_FEATURE_LIST_ALL (1ULL << 63)

View File

@ -495,6 +495,7 @@ struct btrfs_super_block {
#define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9)
#define BTRFS_FEATURE_INCOMPAT_METADATA_UUID (1ULL << 10)
#define BTRFS_FEATURE_INCOMPAT_RAID1C34 (1ULL << 11)
#define BTRFS_FEATURE_INCOMPAT_ZONED (1ULL << 12)
#define BTRFS_FEATURE_COMPAT_SUPP 0ULL
@ -519,7 +520,8 @@ struct btrfs_super_block {
BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA | \
BTRFS_FEATURE_INCOMPAT_NO_HOLES | \
BTRFS_FEATURE_INCOMPAT_RAID1C34 | \
BTRFS_FEATURE_INCOMPAT_METADATA_UUID)
BTRFS_FEATURE_INCOMPAT_METADATA_UUID | \
BTRFS_FEATURE_INCOMPAT_ZONED)
/*
* A leaf is full of items. offset and size tell us where to find

View File

@ -1614,6 +1614,7 @@ static struct readable_flag_entry incompat_flags_array[] = {
DEF_INCOMPAT_FLAG_ENTRY(NO_HOLES),
DEF_INCOMPAT_FLAG_ENTRY(METADATA_UUID),
DEF_INCOMPAT_FLAG_ENTRY(RAID1C34),
DEF_INCOMPAT_FLAG_ENTRY(ZONED),
};
static const int incompat_flags_num = sizeof(incompat_flags_array) /
sizeof(struct readable_flag_entry);