dev_name.state

Get memebr state when we're getting device names.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-08-17 18:27:02 -04:00
parent 4226cd1854
commit f968aa040b
2 changed files with 12 additions and 5 deletions

View File

@ -910,6 +910,8 @@ dev_names bchu_fs_get_devices(struct bchfs_handle fs)
struct dirent *d;
dev_names devs;
struct bch_sb *sb = bchu_read_super(fs, -1);
darray_init(&devs);
while ((errno = 0), (d = readdir(dir))) {
@ -940,9 +942,13 @@ dev_names bchu_fs_get_devices(struct bchfs_handle fs)
n.durability = read_file_u64(fs.sysfs_fd, durability_attr);
free(durability_attr);
struct bch_member m = bch2_sb_member_get(sb, n.idx);
n.state = BCH_MEMBER_STATE(&m);
darray_push(&devs, n);
}
free(sb);
closedir(dir);
return devs;

View File

@ -313,11 +313,12 @@ static inline void bchu_disk_resize_journal(struct bchfs_handle fs,
int bchu_data(struct bchfs_handle, struct bch_ioctl_data);
struct dev_name {
unsigned idx;
char *dev;
char *label;
uuid_t uuid;
unsigned durability;
unsigned idx;
char *dev;
char *label;
uuid_t uuid;
unsigned durability;
enum bch_member_state state;
};
typedef DARRAY(struct dev_name) dev_names;