From 7e08a9116d9d692e0e298197de55b6b5505373bf Mon Sep 17 00:00:00 2001 From: Stefan Behrens Date: Mon, 7 May 2012 14:00:20 +0200 Subject: Btrfs-progs: add support for device replace procedure This is the user mode part of the device replace patch series. The command group "btrfs replace" is added with three commands: - btrfs replace start srcdev|srcdevid targetdev [-Bfr] mount_point - btrfs replace status mount_point [-1] - btrfs replace cancel mount_point Signed-off-by: Stefan Behrens --- volumes.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'volumes.c') diff --git a/volumes.c b/volumes.c index 581c298f..9c527197 100644 --- a/volumes.c +++ b/volumes.c @@ -1219,6 +1219,22 @@ struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid, return NULL; } +struct btrfs_device *btrfs_find_device_by_devid(struct btrfs_root *root, + u64 devid, int instance) +{ + struct list_head *head = &root->fs_info->fs_devices->devices; + struct btrfs_device *dev; + struct list_head *cur; + int num_found = 0; + + list_for_each(cur, head) { + dev = list_entry(cur, struct btrfs_device, dev_list); + if (dev->devid == devid && num_found++ == instance) + return dev; + } + return NULL; +} + int btrfs_bootstrap_super_map(struct btrfs_mapping_tree *map_tree, struct btrfs_fs_devices *fs_devices) { -- cgit v1.2.3