Skip to contentSkip to conversation

btrfs-progs: mkfs: extend -O syntax to disable features

PATCH In review David Sterba 2 participants 4 messages Nov 14, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: mkfs: extend -O syntax to disable features

A way of disabling features that are on by default in case it's not wanted, eg. due to lack of support in the used kernel.

---
 mkfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
mkfs.c +5 -1
index cd0af9ef8b4f..f825e1b6bc2d 100644
@@ -1168,7 +1168,11 @@ static int parse_one_fs_feature(const char *name, u64 *flags)
 	int found = 0;
 
 	for (i = 0; i < ARRAY_SIZE(mkfs_features); i++) {
-		if (!strcmp(mkfs_features[i].name, name)) {
+		if (name[0] == '^' &&
+			!strcmp(mkfs_features[i].name, name + 1)) {
+			*flags &= ~ mkfs_features[i].flag;
+			found = 1;
+		} else if (!strcmp(mkfs_features[i].name, name)) {
 			*flags |= mkfs_features[i].flag;
 			found = 1;
 		}
Signature · 1 line
1.8.4.2
#1 lore raw

Quoting David Sterba (2013-11-14 08:30:45)

Quoted 15 lines

A way of disabling features that are on by default in case it's not wanted, eg. due to lack of support in the used kernel.

---
 mkfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
mkfs.c +0 -0
index cd0af9ef8b4f..f825e1b6bc2d 100644
@@ -1168,7 +1168,11 @@ static int parse_one_fs_feature(const char *name, u64 *flags)
        int found = 0;
 

mkfs.c static int parse_one_fs_feature(const char *name, u64 *flags) · line 1178

Quoted 10 lines
mkfs.c +5 -1
        for (i = 0; i < ARRAY_SIZE(mkfs_features); i++) {
-               if (!strcmp(mkfs_features[i].name, name)) {
+               if (name[0] == '^' &&
+                       !strcmp(mkfs_features[i].name, name + 1)) {
+                       *flags &= ~ mkfs_features[i].flag;
+                       found = 1;
+               } else if (!strcmp(mkfs_features[i].name, name)) {
                        *flags |= mkfs_features[i].flag;
                        found = 1;
                }

Perfect, I was going to do this today so I can enable extrefs.

-chris

#2 lore raw
Quoted 16 lines · Chris Mason

Quoting David Sterba (2013-11-14 08:30:45)

Quoted 15 lines

A way of disabling features that are on by default in case it's not wanted, eg. due to lack of support in the used kernel.

---
 mkfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
mkfs.c +0 -0
index cd0af9ef8b4f..f825e1b6bc2d 100644
@@ -1168,7 +1168,11 @@ static int parse_one_fs_feature(const char *name, u64 *flags)
        int found = 0;
 
Quoted 12 lines

mkfs.c static int parse_one_fs_feature(const char *name, u64 *flags) · line 1178

Quoted 10 lines
mkfs.c +5 -1
        for (i = 0; i < ARRAY_SIZE(mkfs_features); i++) {
-               if (!strcmp(mkfs_features[i].name, name)) {
+               if (name[0] == '^' &&
+                       !strcmp(mkfs_features[i].name, name + 1)) {
+                       *flags &= ~ mkfs_features[i].flag;
+                       found = 1;
+               } else if (!strcmp(mkfs_features[i].name, name)) {
                        *flags |= mkfs_features[i].flag;
                        found = 1;
                }

Perfect, I was going to do this today so I can enable extrefs.

Just sent :)

#3 lore raw

Quoting David Sterba (2013-11-14 09:14:14)

Quoted 31 lines · Chris Mason
Quoted 16 lines

Quoting David Sterba (2013-11-14 08:30:45)

Quoted 15 lines

A way of disabling features that are on by default in case it's not wanted, eg. due to lack of support in the used kernel.

---
 mkfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
mkfs.c +0 -0
index cd0af9ef8b4f..f825e1b6bc2d 100644
@@ -1168,7 +1168,11 @@ static int parse_one_fs_feature(const char *name, u64 *flags)
        int found = 0;
 
Quoted 12 lines

mkfs.c static int parse_one_fs_feature(const char *name, u64 *flags) · line 1178

Quoted 10 lines
mkfs.c +5 -1
        for (i = 0; i < ARRAY_SIZE(mkfs_features); i++) {
-               if (!strcmp(mkfs_features[i].name, name)) {
+               if (name[0] == '^' &&
+                       !strcmp(mkfs_features[i].name, name + 1)) {
+                       *flags &= ~ mkfs_features[i].flag;
+                       found = 1;
+               } else if (!strcmp(mkfs_features[i].name, name)) {
                        *flags |= mkfs_features[i].flag;
                        found = 1;
                }

Perfect, I was going to do this today so I can enable extrefs.

Just sent :)