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