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.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
David Sterba 2013-11-14 14:30:45 +01:00 committed by Chris Mason
parent e11a9ae9bd
commit 492fc44828

6
mkfs.c
View file

@ -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;
}