diff mbox

[V1.1,2/7] btrfs-progs: add kernel alias for each of the features in the list

Message ID 1448458564-1037-1-git-send-email-anand.jain@oracle.com
State New, archived
Headers show

Commit Message

Anand Jain Nov. 25, 2015, 1:36 p.m. UTC
We should have maintained feature's name same across progs UI and sysfs UI.
For example, progs mixed-bg is /sys/fs/btrfs/features/mixed_groups
in sysfs. As these are already released and is UIs, there is nothing much
can be done about it, except for creating the alias and making it aware.

Add kernel alias for each of the features in the list.

eg: The string with in () is the sysfs name for the same feaure

mkfs.btrfs -O list-all
Filesystem features available:
mixed-bg (mixed_groups)           - mixed data and metadata block groups (0x4, 2.7.37)
extref (extended_iref)            - increased hardlink limit per file to 65536 (0x40, 3.7, default)
raid56 (raid56)                   - raid56 extended format (0x80, 3.9)
skinny-metadata (skinny_metadata) - reduced-size metadata extent refs (0x100, 3.10, default)
no-holes (no_holes)               - no explicit hole extents for files (0x200, 3.14)

btrfs-convert -O list-all
Filesystem features available:
extref (extended_iref)            - increased hardlink limit per file to 65536 (0x40, 3.7, default)
skinny-metadata (skinny_metadata) - reduced-size metadata extent refs (0x100, 3.10, default)
no-holes (no_holes)               - no explicit hole extents for files (0x200, 3.14)

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
V1.1 add signed-off-by

 utils.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/utils.c b/utils.c
index 0163915..6d2675d 100644
--- a/utils.c
+++ b/utils.c
@@ -648,17 +648,26 @@  void btrfs_process_fs_features(u64 flags)
 void btrfs_list_all_fs_features(u64 mask_disallowed)
 {
 	int i;
+	u64 feature_per_sysfs;
+
+	btrfs_features_allowed_by_sysfs(&feature_per_sysfs);
 
 	fprintf(stderr, "Filesystem features available:\n");
 	for (i = 0; i < ARRAY_SIZE(mkfs_features) - 1; i++) {
 		char *is_default = "";
+		char name[256];
 
 		if (mkfs_features[i].flag & mask_disallowed)
 			continue;
 		if (mkfs_features[i].flag & BTRFS_MKFS_DEFAULT_FEATURES)
 			is_default = ", default";
-		fprintf(stderr, "%-20s- %s (0x%llx, %s%s)\n",
-				mkfs_features[i].name,
+		if (mkfs_features[i].flag & feature_per_sysfs)
+			sprintf(name, "%s (%s)",
+				mkfs_features[i].name, mkfs_features[i].name_ker);
+		else
+			sprintf(name, "%s", mkfs_features[i].name);
+		fprintf(stderr, "%-34s- %s (0x%llx, %s%s)\n",
+				name,
 				mkfs_features[i].desc,
 				mkfs_features[i].flag,
 				mkfs_features[i].min_ker_ver,