From 3b9e6dd4379ed8f2fb50bee8dce4245038498211 Mon Sep 17 00:00:00 2001 From: Miao Xie Date: Wed, 3 Jul 2013 21:25:19 +0800 Subject: Btrfs-progs: Add chunk rebuild function for RAID1/SINGLE/DUP Add chunk rebuild for RAID1/SINGLE/DUP to chunk-recover command. Before this patch chunk-recover can only scan and reuse the old chunk data to recover. With this patch, chunk-recover can use the reference between chunk/block group/dev extent to rebuild the whole chunk tree even when old chunks are not available. Signed-off-by: Qu Wenruo Signed-off-by: Miao Xie Signed-off-by: Chris Mason --- volumes.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'volumes.c') diff --git a/volumes.c b/volumes.c index 42cd943..ab282d3 100644 --- a/volumes.c +++ b/volumes.c @@ -1386,16 +1386,15 @@ 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 btrfs_device * +btrfs_find_device_by_devid(struct btrfs_fs_devices *fs_devices, + u64 devid, int instance) { - struct list_head *head = &root->fs_info->fs_devices->devices; + struct list_head *head = &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); + list_for_each_entry(dev, head, dev_list) { if (dev->devid == devid && num_found++ == instance) return dev; } -- cgit v1.2.1