diff options
author | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-07-05 10:49:27 +0200 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-07-30 16:00:37 +0200 |
commit | 4b3644ab4ce6df8c7f64c189c12b66627ff3e027 (patch) | |
tree | fe1a8996f70da8f1f8f3680c3fc5b7c4c6978402 /mdadm.h | |
parent | review.yml: fix typo in DEBIAN compiler flag (diff) | |
download | mdadm-4b3644ab4ce6df8c7f64c189c12b66627ff3e027.tar.xz mdadm-4b3644ab4ce6df8c7f64c189c12b66627ff3e027.zip |
mdstat: Rework mdstat external arrays handling
To avoid repeating mdstat_read() in IncrementalRemove(), new function
mdstat_find_by_member_name() has been proposed. With that,
IncrementalRemove() handles own copy of mdstat content and there is no
need to repeat reading for external stop.
Additionally, It proposed few helper to avoid repeating
mdstat_ent->metadata_version checks across code.
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Diffstat (limited to 'mdadm.h')
-rw-r--r-- | mdadm.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -743,8 +743,12 @@ extern int mdstat_wait(int seconds); extern void mdstat_wait_fd(int fd, const sigset_t *sigmask); extern int mddev_busy(char *devnm); extern struct mdstat_ent *mdstat_by_component(char *name); +extern struct mdstat_ent *mdstat_find_by_member_name(struct mdstat_ent *mdstat, char *member_devnm); extern struct mdstat_ent *mdstat_by_subdev(char *subdev, char *container); +extern bool is_mdstat_ent_external(struct mdstat_ent *ent); +extern bool is_mdstat_ent_subarray(struct mdstat_ent *ent); + struct map_ent { struct map_ent *next; char devnm[32]; @@ -1771,7 +1775,7 @@ extern int is_mddev(char *dev); extern int open_container(int fd); extern int metadata_container_matches(char *metadata, char *devnm); extern int metadata_subdev_matches(char *metadata, char *devnm); -extern int is_container_member(struct mdstat_ent *ent, char *devname); +extern bool is_container_member(struct mdstat_ent *ent, char *devname); extern int is_subarray_active(char *subarray, char *devname); extern int open_subarray(char *dev, char *subarray, struct supertype *st, int quiet); extern struct superswitch *version_to_superswitch(char *vers); |