summaryrefslogtreecommitdiff
path: root/btrfstune.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-03-15 15:32:16 -0400
committerDavid Sterba <dsterba@suse.cz>2013-04-23 18:56:20 +0200
commit7b20da8d525d11dabc98bdd49efef7b8be5576ab (patch)
tree8aed340d9c354b2387fffd9fe4e8b3d5f081ae35 /btrfstune.c
parente5c6852c0c4ce72205dd0bab40924d2ace75cb6f (diff)
Btrfs-progs: add skinny metadata support to progs V3
This fixes up the progs to properly deal with skinny metadata. This adds the -x option to mkfs and btrfstune for enabling the skinny metadata option. This also makes changes to fsck so it can properly deal with the skinny metadata entries. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'btrfstune.c')
-rw-r--r--btrfstune.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/btrfstune.c b/btrfstune.c
index 2f3d0876..993f2d21 100644
--- a/btrfstune.c
+++ b/btrfstune.c
@@ -81,11 +81,28 @@ int enable_extrefs_flag(struct btrfs_root *root)
return 0;
}
+int enable_skinny_metadata(struct btrfs_root *root)
+{
+ struct btrfs_trans_handle *trans;
+ struct btrfs_super_block *disk_super;
+ u64 super_flags;
+
+ disk_super = &root->fs_info->super_copy;
+ super_flags = btrfs_super_incompat_flags(disk_super);
+ super_flags |= BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA;
+ trans = btrfs_start_transaction(root, 1);
+ btrfs_set_super_incompat_flags(disk_super, super_flags);
+ btrfs_commit_transaction(trans, root);
+
+ return 0;
+}
+
static void print_usage(void)
{
fprintf(stderr, "usage: btrfstune [options] device\n");
fprintf(stderr, "\t-S value\tenable/disable seeding\n");
fprintf(stderr, "\t-r \t\tenable extended inode refs\n");
+ fprintf(stderr, "\t-x enable skinny metadata extent refs\n");
}
int main(int argc, char *argv[])
@@ -95,10 +112,11 @@ int main(int argc, char *argv[])
int extrefs_flag = 0;
int seeding_flag = 0;
int seeding_value = 0;
+ int skinny_flag = 0;
int ret;
while(1) {
- int c = getopt(argc, argv, "S:r");
+ int c = getopt(argc, argv, "S:rx");
if (c < 0)
break;
switch(c) {
@@ -109,6 +127,9 @@ int main(int argc, char *argv[])
case 'r':
extrefs_flag = 1;
break;
+ case 'x':
+ skinny_flag = 1;
+ break;
default:
print_usage();
return 1;
@@ -145,6 +166,11 @@ int main(int argc, char *argv[])
success++;
}
+ if (skinny_flag) {
+ enable_skinny_metadata(root);
+ success++;
+ }
+
if (success > 0) {
ret = 0;
} else {