diff options
author | Mark Fasheh <mfasheh@suse.de> | 2013-01-31 10:57:53 -0800 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-21 14:30:23 -0500 |
commit | 704a08cb8ae8735f8538e637a1be822e76e69d3c (patch) | |
tree | 061e5e7ed1b2b4b13a710a1cb464dfbbc927c70b /btrfstune.c | |
parent | e5701088e2186c48d1b4fa5dcb418afd150e484a (diff) |
btrfsprogs: btrfstune support for extended inode refs
This patch adds an option to btrfstune, '-r' which will enable the extended
inode refs flag on the provided btrfs superblock. We don't have a disable
option at the moment as that would require far more work.
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Diffstat (limited to 'btrfstune.c')
-rw-r--r-- | btrfstune.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/btrfstune.c b/btrfstune.c index 6950f74d..6e68bda9 100644 --- a/btrfstune.c +++ b/btrfstune.c @@ -65,22 +65,40 @@ int update_seeding_flag(struct btrfs_root *root, int set_flag) return 0; } +int enable_extrefs_flag(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_EXTENDED_IREF; + 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"); } int main(int argc, char *argv[]) { struct btrfs_root *root; int success = 0; + int extrefs_flag = 0; int seeding_flag = 0; int seeding_value = 0; int ret; while(1) { - int c = getopt(argc, argv, "S:"); + int c = getopt(argc, argv, "S:r"); if (c < 0) break; switch(c) { @@ -88,6 +106,9 @@ int main(int argc, char *argv[]) seeding_flag = 1; seeding_value = atoi(optarg); break; + case 'r': + extrefs_flag = 1; + break; default: print_usage(); return 1; @@ -119,6 +140,11 @@ int main(int argc, char *argv[]) success++; } + if (extrefs_flag) { + enable_extrefs_flag(root); + success++; + } + if (success > 0) { ret = 0; } else { |