diff mbox series

[07/11] btrfs-progs: track num_devices per fs_devices

Message ID b7da75a3079804cdd6aaf453e547b57be2dd508c.1688724045.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: fix bugs and CHANGING_FSID_V2 flag | expand

Commit Message

Anand Jain July 7, 2023, 3:52 p.m. UTC
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>
---
 kernel-shared/volumes.c | 1 +
 kernel-shared/volumes.h | 1 +
 2 files changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c
index 51b3a16a39af..1e42e4fe105e 100644
--- a/kernel-shared/volumes.c
+++ b/kernel-shared/volumes.c
@@ -405,6 +405,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;
 
diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h
index 9763c677a7cc..93e02a901d31 100644
--- a/kernel-shared/volumes.h
+++ b/kernel-shared/volumes.h
@@ -90,6 +90,7 @@  struct btrfs_fs_devices {
 
 	u64 total_rw_bytes;
 
+	int num_devices;
 	int missing;
 	int latest_bdev;
 	int lowest_bdev;