summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>2014-10-06 18:16:46 +0800
committerDavid Sterba <dsterba@suse.cz>2014-10-10 10:52:41 +0200
commit2513077f2f830b4bc83d528bfb6979eb461918bd (patch)
tree3a84f559b63262532814af5afd4c80ec74844fea /volumes.c
parentd601190a7df193ecf37a445fbb5a9a0999f28b21 (diff)
btrfs-progs: fix device missing of btrfs fi show with seed devices
*Note* this handles the problem under umounted state, the similar problem under mounted state is already fixed by Anand. Steps to reproduce: # mkfs.btrfs -f /dev/sda1 # btrfstune -S 1 /dev/sda1 # mount /dev/sda1 /mnt # btrfs dev add /dev/sda2 /mnt # umount /mnt <== (umounted) # btrfs fi show /dev/sda2 result: Label: none uuid: XXXXXXXXXXXXXXXXXX Total devices 2 FS bytes used 368.00KiB devid 2 size 9.31GiB used 1.25GiB path /dev/sda2 *** Some devices missing Btrfs v3.16-67-g69f54ea-dirty It is because @btrfs_scan_lblkid() won't establish mappinig between the seed and sprout devices. So seeding devices are missing. We could use @open_ctree_* to detect all seed/sprout mappings for each fs scanned after @btrfs_scan_lblkid(). sth worthes mention: o If there are multi-level of seeds, all devices in them will be shown in the ascending order of @devid o If device replace is execed on a sprout fs with a device in a seed fs, the replaced device still exist in the seed fs together with the replacing device in the sprout fs, so we only keep the latest device with the newest generation Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/volumes.c b/volumes.c
index b47bce6b..5b007fc8 100644
--- a/volumes.c
+++ b/volumes.c
@@ -116,6 +116,7 @@ static int device_list_add(const char *path,
}
device->fd = -1;
device->devid = devid;
+ device->generation = found_transid;
memcpy(device->uuid, disk_super->dev_item.uuid,
BTRFS_UUID_SIZE);
device->name = kstrdup(path, GFP_NOFS);