btrfs-progs: track num_devices per fs_devices

Similar to the kernel we need to track the number of devices scanned
per fs_devices. A preparation patch to fix incomplete fsid changing.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2023-08-14 23:27:57 +08:00 committed by David Sterba
parent 5c7f36b141
commit 4a253f713e
2 changed files with 2 additions and 0 deletions

View File

@ -406,6 +406,7 @@ static int device_list_add(const char *path,
btrfs_stack_device_bytes_used(&disk_super->dev_item);
list_add(&device->dev_list, &fs_devices->devices);
device->fs_devices = fs_devices;
fs_devices->num_devices++;
} else if (!device->name || strcmp(device->name, path)) {
char *name;

View File

@ -88,6 +88,7 @@ struct btrfs_fs_devices {
u64 latest_trans;
u64 lowest_devid;
u64 num_devices;
u64 missing_devices;
u64 total_rw_bytes;