summaryrefslogtreecommitdiff
path: root/btrfsck.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2012-02-05 16:11:48 -0500
committerChris Mason <chris.mason@oracle.com>2012-02-05 16:11:48 -0500
commite7580bb29644128d19cfe70a16df713bdcc58a43 (patch)
tree25889d9d37f26e4c796c2955032a2dfbe645e47d /btrfsck.c
parent6cd813b6fc18ba75edfcfad5857d27f0265c2c28 (diff)
Add open_ctree_fs_info for partial FS opens
fsck needs to be able to open a damaged FS, which means open_ctree needs to be able to return a damaged FS. This adds a new open_ctree_fs_info which can be used to open any and all roots that are valid. btrfs-debug-tree is changed to use it. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'btrfsck.c')
-rw-r--r--btrfsck.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/btrfsck.c b/btrfsck.c
index 3a23e665..a56bb4bf 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -2809,6 +2809,7 @@ int main(int ac, char **av)
{
struct cache_tree root_cache;
struct btrfs_root *root;
+ struct btrfs_fs_info *info;
u64 bytenr = 0;
int ret;
int num;
@@ -2845,11 +2846,13 @@ int main(int ac, char **av)
return -EBUSY;
}
- root = open_ctree(av[optind], bytenr, 0);
+ info = open_ctree_fs_info(av[optind], bytenr, 0, 0);
- if (root == NULL)
+ if (info == NULL)
return 1;
+ root = info->fs_root;
+
ret = check_extents(root);
if (ret)
goto out;