@@ -280,7 +280,7 @@ static int cmd_start_replace(int argc, char **argv)
goto leave_with_error;
}
ret = btrfs_scan_one_device(fddstdev, dstdev, &fs_devices_mnt,
- &total_devs, BTRFS_SUPER_INFO_OFFSET);
+ &total_devs, BTRFS_SUPER_INFO_OFFSET, 0ull);
if (ret >= 0 && !force_using_targetdev) {
fprintf(stderr,
"Error, target device %s contains filesystem, use '-f' to force overwriting.\n",
@@ -827,7 +827,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
fprintf(stderr, "Warning, could not drop caches\n");
ret = btrfs_scan_one_device(fp, path, &fs_devices,
- &total_devs, sb_bytenr);
+ &total_devs, sb_bytenr, 0ull);
if (ret) {
fprintf(stderr, "No valid Btrfs found on %s\n", path);
@@ -102,7 +102,8 @@ static struct btrfs_root *open_ctree_broken(int fd, const char *device)
u64 features;
ret = btrfs_scan_one_device(fd, device, &fs_devices,
- &total_devs, BTRFS_SUPER_INFO_OFFSET);
+ &total_devs, BTRFS_SUPER_INFO_OFFSET,
+ 0ull);
if (ret) {
fprintf(stderr, "No valid Btrfs found on %s\n", device);
@@ -922,7 +922,8 @@ int check_mounted_where(int fd, const char *file, char *where, int size,
/* scan the initial device */
ret = btrfs_scan_one_device(fd, file, &fs_devices_mnt,
- &total_devs, BTRFS_SUPER_INFO_OFFSET);
+ &total_devs, BTRFS_SUPER_INFO_OFFSET,
+ 0ull);
is_btrfs = (ret >= 0);
/* scan other devices */
@@ -1121,7 +1122,8 @@ again:
}
ret = btrfs_scan_one_device(fd, fullpath, &tmp_devices,
&num_devices,
- BTRFS_SUPER_INFO_OFFSET);
+ BTRFS_SUPER_INFO_OFFSET,
+ 0ull);
if (ret == 0 && flags & BTRFS_SCAN_REGISTER) {
btrfs_register_one_device(fullpath);
}
@@ -1452,7 +1454,8 @@ scan_again:
}
ret = btrfs_scan_one_device(fd, fullpath, &tmp_devices,
&num_devices,
- BTRFS_SUPER_INFO_OFFSET);
+ BTRFS_SUPER_INFO_OFFSET,
+ 0ull);
if (ret == 0 && flags & BTRFS_SCAN_REGISTER) {
btrfs_register_one_device(fullpath);
}
@@ -213,7 +213,7 @@ fail:
int btrfs_scan_one_device(int fd, const char *path,
struct btrfs_fs_devices **fs_devices_ret,
- u64 *total_devs, u64 super_offset)
+ u64 *total_devs, u64 super_offset, u64 flags)
{
struct btrfs_super_block *disk_super;
char *buf;
@@ -179,7 +179,7 @@ int btrfs_update_device(struct btrfs_trans_handle *trans,
struct btrfs_device *device);
int btrfs_scan_one_device(int fd, const char *path,
struct btrfs_fs_devices **fs_devices_ret,
- u64 *total_devs, u64 super_offset);
+ u64 *total_devs, u64 super_offset, u64 flags);
int btrfs_num_copies(struct btrfs_mapping_tree *map_tree, u64 logical, u64 len);
int btrfs_bootstrap_super_map(struct btrfs_mapping_tree *map_tree,
struct btrfs_fs_devices *fs_devices);
check_mounted would need to check backup SB to see if the device is mounted to accommodate the situation when the primary SB is corrupted (even in multi dev btrfs). so we need flag to communicate to btrfs_read_dev_super to check backup SB. this patch will just introduce the flag with access to backup SB disable. Signed-off-by: Anand Jain <anand.jain@oracle.com> --- cmds-replace.c | 2 +- disk-io.c | 2 +- find-root.c | 3 ++- utils.c | 9 ++++++--- volumes.c | 2 +- volumes.h | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-)