mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 15:42:23 +00:00
btrfs-progs: mkfs: add short aliases for long feature names
While we like to have the descriptive names also add short aliases that we also use for reference in changelogs and documentation. $ mkfs.btrfs -O list-all Filesystem features available: mixed-bg - mixed data and metadata block groups (compat=2.6.37, safe=2.6.37) quota - quota support (qgroups) (compat=3.4) extref - increased hardlink limit per file to 65536 (compat=3.7, safe=3.12, default=3.12) raid56 - raid56 extended format (compat=3.9) skinny-metadata - reduced-size metadata extent refs (compat=3.10, safe=3.18, default=3.18) no-holes - no explicit hole extents for files (compat=3.14, safe=4.0, default=5.15) fst - free-space-tree alias free-space-tree - free space tree (space_cache=v2) (compat=4.5, safe=4.9, default=5.15) raid1c34 - RAID1 with 3 or 4 copies (compat=5.5) zoned - support zoned devices (compat=5.12) extent-tree-v2 - new extent tree format (compat=5.15) bgt - block-group-tree alias block-group-tree - block group tree to reduce mount time (compat=6.1) rst - raid-stripe-tree alias raid-stripe-tree - raid stripe tree (compat=6.7) squota - squota support (simple accounting qgroups) (compat=6.7) Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
723137547b
commit
166db10ceb
@ -47,6 +47,17 @@
|
||||
.name ## _str = NULL, \
|
||||
.name ## _ver = 0
|
||||
|
||||
/*
|
||||
* For feature names that are only an alias we don't need to duplicate
|
||||
* versions.
|
||||
*
|
||||
* When compat_str is NULL, the feature descriptor is an alias.
|
||||
*/
|
||||
#define VERSION_ALIAS \
|
||||
VERSION_NULL(compat), \
|
||||
VERSION_NULL(safe), \
|
||||
VERSION_NULL(default)
|
||||
|
||||
enum feature_source {
|
||||
FS_FEATURES,
|
||||
RUNTIME_FEATURES,
|
||||
@ -145,6 +156,14 @@ static const struct btrfs_feature mkfs_features[] = {
|
||||
VERSION_TO_STRING2(default, 5,15),
|
||||
.desc = "no explicit hole extents for files"
|
||||
},
|
||||
{
|
||||
.name = "fst",
|
||||
.compat_ro_flag = BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE |
|
||||
BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID,
|
||||
.sysfs_name = "free_space_tree",
|
||||
VERSION_ALIAS,
|
||||
.desc = "free-space-tree alias"
|
||||
},
|
||||
{
|
||||
.name = "free-space-tree",
|
||||
.compat_ro_flag = BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE |
|
||||
@ -186,6 +205,13 @@ static const struct btrfs_feature mkfs_features[] = {
|
||||
.desc = "new extent tree format"
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.name = "bgt",
|
||||
.compat_ro_flag = BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE,
|
||||
.sysfs_name = "block_group_tree",
|
||||
VERSION_ALIAS,
|
||||
.desc = "block-group-tree alias"
|
||||
},
|
||||
{
|
||||
.name = "block-group-tree",
|
||||
.compat_ro_flag = BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE,
|
||||
@ -196,6 +222,13 @@ static const struct btrfs_feature mkfs_features[] = {
|
||||
.desc = "block group tree to reduce mount time"
|
||||
},
|
||||
#if EXPERIMENTAL
|
||||
{
|
||||
.name = "rst",
|
||||
.incompat_flag = BTRFS_FEATURE_INCOMPAT_RAID_STRIPE_TREE,
|
||||
.sysfs_name = NULL,
|
||||
VERSION_ALIAS,
|
||||
.desc = "raid-stripe-tree alias"
|
||||
},
|
||||
{
|
||||
.name = "raid-stripe-tree",
|
||||
.incompat_flag = BTRFS_FEATURE_INCOMPAT_RAID_STRIPE_TREE,
|
||||
@ -258,6 +291,11 @@ static const struct btrfs_feature runtime_features[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static bool feature_name_is_alias(const struct btrfs_feature *feature)
|
||||
{
|
||||
return feature->compat_str == NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a sanity check to make sure BTRFS_FEATURE_STRING_BUF_SIZE is large
|
||||
* enough to contain all strings.
|
||||
@ -341,6 +379,9 @@ static void parse_features_to_string(char *buf,
|
||||
for (i = 0; i < array_size; i++) {
|
||||
const struct btrfs_feature *feat = get_feature(i, source);
|
||||
|
||||
if (feature_name_is_alias(feat))
|
||||
continue;
|
||||
|
||||
if (features->compat_ro_flags & feat->compat_ro_flag ||
|
||||
features->incompat_flags & feat->incompat_flag ||
|
||||
features->runtime_flags & feat->runtime_flag) {
|
||||
@ -418,7 +459,12 @@ static void list_all_features(const struct btrfs_mkfs_features *allowed,
|
||||
feat->runtime_flag & allowed->runtime_flags))
|
||||
continue;
|
||||
|
||||
fprintf(stderr, "%-20s- %s (", feat->name, feat->desc);
|
||||
fprintf(stderr, "%-20s- %s", feat->name, feat->desc);
|
||||
if (feature_name_is_alias(feat)) {
|
||||
fprintf(stderr, "\n");
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, " (");
|
||||
if (feat->compat_ver) {
|
||||
fprintf(stderr, "compat=%s", feat->compat_str);
|
||||
sep = ", ";
|
||||
|
Loading…
Reference in New Issue
Block a user