summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--btrfs-find-root.c2
-rw-r--r--cmds-chunk.c2
-rw-r--r--disk-io.c9
-rw-r--r--disk-io.h2
4 files changed, 9 insertions, 6 deletions
diff --git a/btrfs-find-root.c b/btrfs-find-root.c
index 989535f6..f63789da 100644
--- a/btrfs-find-root.c
+++ b/btrfs-find-root.c
@@ -82,7 +82,7 @@ static struct btrfs_root *open_ctree_broken(int fd, const char *device)
return NULL;
}
- ret = btrfs_scan_fs_devices(fd, device, &fs_devices);
+ ret = btrfs_scan_fs_devices(fd, device, &fs_devices, 0);
if (ret)
goto out;
diff --git a/cmds-chunk.c b/cmds-chunk.c
index 03314deb..6ada328f 100644
--- a/cmds-chunk.c
+++ b/cmds-chunk.c
@@ -1291,7 +1291,7 @@ static int recover_prepare(struct recover_control *rc, char *path)
goto fail_free_sb;
}
- ret = btrfs_scan_fs_devices(fd, path, &fs_devices);
+ ret = btrfs_scan_fs_devices(fd, path, &fs_devices, 0);
if (ret)
goto fail_free_sb;
diff --git a/disk-io.c b/disk-io.c
index 970f38ad..a19b58ab 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -909,13 +909,16 @@ void btrfs_cleanup_all_caches(struct btrfs_fs_info *fs_info)
}
int btrfs_scan_fs_devices(int fd, const char *path,
- struct btrfs_fs_devices **fs_devices)
+ struct btrfs_fs_devices **fs_devices,
+ u64 sb_bytenr)
{
u64 total_devs;
int ret;
+ if (!sb_bytenr)
+ sb_bytenr = BTRFS_SUPER_INFO_OFFSET;
ret = btrfs_scan_one_device(fd, path, fs_devices,
- &total_devs, BTRFS_SUPER_INFO_OFFSET);
+ &total_devs, sb_bytenr);
if (ret) {
fprintf(stderr, "No valid Btrfs found on %s\n", path);
return ret;
@@ -1001,7 +1004,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
if (restore)
fs_info->on_restoring = 1;
- ret = btrfs_scan_fs_devices(fp, path, &fs_devices);
+ ret = btrfs_scan_fs_devices(fp, path, &fs_devices, sb_bytenr);
if (ret)
goto out;
diff --git a/disk-io.h b/disk-io.h
index effaa9fd..bc749c33 100644
--- a/disk-io.h
+++ b/disk-io.h
@@ -59,7 +59,7 @@ int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info,
void btrfs_release_all_roots(struct btrfs_fs_info *fs_info);
void btrfs_cleanup_all_caches(struct btrfs_fs_info *fs_info);
int btrfs_scan_fs_devices(int fd, const char *path,
- struct btrfs_fs_devices **fs_devices);
+ struct btrfs_fs_devices **fs_devices, u64 sb_bytenr);
int btrfs_setup_chunk_tree_and_device_map(struct btrfs_fs_info *fs_info);
struct btrfs_root *open_ctree(const char *filename, u64 sb_bytenr, int writes);