summaryrefslogtreecommitdiff
path: root/cmds-check.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-10-28 14:28:43 -0400
committerChris Mason <chris.mason@fusionio.com>2013-11-07 16:10:40 -0500
commit4735d0bb8248a3900f420cb9144e4f7969f0b44d (patch)
treefebecdd28a64d93816e63a1bf36d6864a732dcd8 /cmds-check.c
parent337f86fea1d06e189f3cf234adba2567a07678bd (diff)
Btrfs-progs: rework open_ctree to take flags, add a new one V2
So I needed to add a flag to not try to read block groups when doing --init-extent-tree since we could hang there, but that meant adding a whole other 0/1 type flag to open_ctree_fs_info. So instead I've converted it all over to using a flags setting and added the flag that I needed. This has been tested with xfstests and make test. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'cmds-check.c')
-rw-r--r--cmds-check.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 3453cac2..37348a94 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -6045,13 +6045,12 @@ int cmd_check(int argc, char **argv)
struct btrfs_fs_info *info;
u64 bytenr = 0;
char uuidbuf[37];
- int backup_root = 0;
int ret;
int num;
int option_index = 0;
int init_csum_tree = 0;
int init_extent_tree = 0;
- int rw = 0;
+ enum btrfs_open_ctree_flags ctree_flags = OPEN_CTREE_PARTIAL;
while(1) {
int c;
@@ -6062,7 +6061,7 @@ int cmd_check(int argc, char **argv)
switch(c) {
case 'a': /* ignored */ break;
case 'b':
- backup_root = 1;
+ ctree_flags |= OPEN_CTREE_BACKUP_ROOT;
break;
case 's':
num = atol(optarg);
@@ -6077,14 +6076,15 @@ int cmd_check(int argc, char **argv)
if (option_index == 1) {
printf("enabling repair mode\n");
repair = 1;
- rw = 1;
+ ctree_flags |= OPEN_CTREE_WRITES;
} else if (option_index == 2) {
printf("Creating a new CRC tree\n");
init_csum_tree = 1;
- rw = 1;
+ ctree_flags |= OPEN_CTREE_WRITES;
} else if (option_index == 3) {
init_extent_tree = 1;
- rw = 1;
+ ctree_flags |= (OPEN_CTREE_WRITES |
+ OPEN_CTREE_NO_BLOCK_GROUPS);
repair = 1;
}
@@ -6105,7 +6105,7 @@ int cmd_check(int argc, char **argv)
return -EBUSY;
}
- info = open_ctree_fs_info(argv[optind], bytenr, 0, rw, 1, backup_root);
+ info = open_ctree_fs_info(argv[optind], bytenr, 0, ctree_flags);
if (!info) {
fprintf(stderr, "Couldn't open file system\n");
return -EIO;