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>
+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");
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 main(int argc, char *argv[])
{
struct btrfs_root *root;
int success = 0;
int seeding_flag = 0;
int seeding_value = 0;
int ret;
while(1) {
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) {
if (c < 0)
break;
switch(c) {
seeding_flag = 1;
seeding_value = atoi(optarg);
break;
seeding_flag = 1;
seeding_value = atoi(optarg);
break;
+ case 'r':
+ extrefs_flag = 1;
+ break;
default:
print_usage();
return 1;
default:
print_usage();
return 1;
+ if (extrefs_flag) {
+ enable_extrefs_flag(root);
+ success++;
+ }
+
if (success > 0) {
ret = 0;
} else {
if (success > 0) {
ret = 0;
} else {