]>
Commit | Line | Data |
---|---|---|
1 | enum array_state { clear, inactive, suspended, readonly, read_auto, | |
2 | clean, active, write_pending, active_idle, bad_word}; | |
3 | ||
4 | enum sync_action { idle, reshape, resync, recover, check, repair, bad_action }; | |
5 | ||
6 | ||
7 | struct active_array { | |
8 | struct mdinfo info; | |
9 | struct supertype *container; | |
10 | struct active_array *next, *replaces; | |
11 | ||
12 | int action_fd; | |
13 | int resync_start_fd; | |
14 | int metadata_fd; /* for monitoring rw/ro status */ | |
15 | ||
16 | enum array_state prev_state, curr_state, next_state; | |
17 | enum sync_action prev_action, curr_action, next_action; | |
18 | ||
19 | int check_degraded; /* flag set by mon, read by manage */ | |
20 | ||
21 | int devnum; | |
22 | ||
23 | unsigned long long resync_start; | |
24 | }; | |
25 | ||
26 | /* | |
27 | * Metadata updates are handled by the monitor thread, | |
28 | * as it has exclusive access to the metadata. | |
29 | * When the manager want to updates metadata, either | |
30 | * for it's own reason (e.g. committing a spare) or | |
31 | * on behalf of mdadm, it creates a metadata_update | |
32 | * structure and queues it to the monitor. | |
33 | * Updates are created and processed by code under the | |
34 | * superswitch. All common code sees them as opaque | |
35 | * blobs. | |
36 | */ | |
37 | extern struct metadata_update *update_queue, *update_queue_handled; | |
38 | ||
39 | #define MD_MAJOR 9 | |
40 | ||
41 | extern struct active_array *container; | |
42 | extern struct active_array *discard_this; | |
43 | extern struct active_array *pending_discard; | |
44 | extern struct md_generic_cmd *active_cmd; | |
45 | ||
46 | ||
47 | void remove_pidfile(char *devname); | |
48 | void do_monitor(struct supertype *container); | |
49 | void do_manager(struct supertype *container); | |
50 | int make_control_sock(char *devname); | |
51 | int make_pidfile(char *devname, int o_excl); | |
52 | extern int socket_hup_requested; | |
53 | ||
54 | int read_dev_state(int fd); | |
55 | int get_resync_start(struct active_array *a); | |
56 | ||
57 | struct mdstat_ent *mdstat_read(int hold, int start); | |
58 | ||
59 | extern int exit_now, manager_ready; | |
60 | extern int mon_tid, mgr_tid; | |
61 | extern int monitor_loop_cnt; | |
62 | ||
63 | /* helper routine to determine resync completion since MaxSector is a | |
64 | * moving target | |
65 | */ | |
66 | static inline int is_resync_complete(struct active_array *a) | |
67 | { | |
68 | if (a->resync_start >= a->info.component_size) | |
69 | return 1; | |
70 | return 0; | |
71 | } | |
72 |