btrfs-progs: kernel-shared: track total_devs in fs devices

Similar to the kernel, introduce the btrfs_fs_devices::total_devs
attribute to know the overall count of devices that are expected to be
present per filesystem.

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-03 07:29:44 +08:00 committed by David Sterba
parent cb53874f6d
commit 26f25402ff
2 changed files with 4 additions and 1 deletions

View File

@ -367,7 +367,8 @@ static int device_list_add(const char *path,
BTRFS_FSID_SIZE);
fs_devices->latest_devid = devid;
fs_devices->latest_trans = found_transid;
/* Below we would set this to found_transid */
fs_devices->latest_trans = 0;
fs_devices->lowest_devid = (u64)-1;
fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR;
device = NULL;
@ -437,6 +438,7 @@ static int device_list_add(const char *path,
if (found_transid > fs_devices->latest_trans) {
fs_devices->latest_devid = devid;
fs_devices->latest_trans = found_transid;
fs_devices->total_devices = device->total_devs;
}
if (fs_devices->lowest_devid > devid) {
fs_devices->lowest_devid = devid;

View File

@ -91,6 +91,7 @@ struct btrfs_fs_devices {
u64 missing_devices;
u64 total_rw_bytes;
u64 total_devices;
int latest_bdev;
int lowest_bdev;
struct list_head devices;