Commit 15fc1283 authored by Anand Jain's avatar Anand Jain Committed by David Sterba

btrfs: open code btrfs_init_dev_replace_tgtdev_for_resume()

btrfs_init_dev_replace_tgtdev_for_resume() initializes replace
target device in a few simple steps, so do it at the parent function.
Moreover, there isn't any other caller so just open code it.
Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 18e67c73
...@@ -173,8 +173,14 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info) ...@@ -173,8 +173,14 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
} }
set_bit(BTRFS_DEV_STATE_REPLACE_TGT, set_bit(BTRFS_DEV_STATE_REPLACE_TGT,
&dev_replace->tgtdev->dev_state); &dev_replace->tgtdev->dev_state);
btrfs_init_dev_replace_tgtdev_for_resume(fs_info,
dev_replace->tgtdev); WARN_ON(fs_info->fs_devices->rw_devices == 0);
dev_replace->tgtdev->io_width = fs_info->sectorsize;
dev_replace->tgtdev->io_align = fs_info->sectorsize;
dev_replace->tgtdev->sector_size = fs_info->sectorsize;
dev_replace->tgtdev->fs_info = fs_info;
set_bit(BTRFS_DEV_STATE_IN_FS_METADATA,
&dev_replace->tgtdev->dev_state);
} }
break; break;
} }
......
...@@ -2666,19 +2666,6 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info, ...@@ -2666,19 +2666,6 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
return ret; return ret;
} }
void btrfs_init_dev_replace_tgtdev_for_resume(struct btrfs_fs_info *fs_info,
struct btrfs_device *tgtdev)
{
u32 sectorsize = fs_info->sectorsize;
WARN_ON(fs_info->fs_devices->rw_devices == 0);
tgtdev->io_width = sectorsize;
tgtdev->io_align = sectorsize;
tgtdev->sector_size = sectorsize;
tgtdev->fs_info = fs_info;
set_bit(BTRFS_DEV_STATE_IN_FS_METADATA, &tgtdev->dev_state);
}
static noinline int btrfs_update_device(struct btrfs_trans_handle *trans, static noinline int btrfs_update_device(struct btrfs_trans_handle *trans,
struct btrfs_device *device) struct btrfs_device *device)
{ {
......
...@@ -476,8 +476,6 @@ void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info, ...@@ -476,8 +476,6 @@ void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info,
struct btrfs_device *srcdev); struct btrfs_device *srcdev);
void btrfs_destroy_dev_replace_tgtdev(struct btrfs_fs_info *fs_info, void btrfs_destroy_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
struct btrfs_device *tgtdev); struct btrfs_device *tgtdev);
void btrfs_init_dev_replace_tgtdev_for_resume(struct btrfs_fs_info *fs_info,
struct btrfs_device *tgtdev);
void btrfs_scratch_superblocks(struct block_device *bdev, const char *device_path); void btrfs_scratch_superblocks(struct block_device *bdev, const char *device_path);
int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info, int btrfs_is_parity_mirror(struct btrfs_fs_info *fs_info,
u64 logical, u64 len); u64 logical, u64 len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment