Whamcloud - gitweb
- Rename the ptlrpc-general reconnection and replay functions, and export them
[fs/lustre-release.git] / lustre / include / linux / lustre_ha.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4
5 #ifndef _LUSTRE_HA_H
6 #define _LUSTRE_HA_H
7
8 #define LUSTRE_HA_NAME "ptlrpc"
9
10 struct recovd_data;
11 struct recovd_obd;
12 struct ptlrpc_connection;
13
14 /* rd_phase/rd_next_phase values */
15 #define RD_IDLE              0
16 #define RD_TROUBLED          1
17 #define RD_PREPARING         2
18 #define RD_PREPARED          3
19 #define RD_RECOVERING        4
20 #define RD_RECOVERED         5
21 #define RD_FAILED            6
22
23 /* recovd_state values */
24 #define RECOVD_READY             1
25 #define RECOVD_STOPPING          2  /* how cleanup tells recovd to quit */
26 #define RECOVD_STOPPED           4  /* after recovd has stopped */
27
28 #define PTLRPC_RECOVD_PHASE_PREPARE  1
29 #define PTLRPC_RECOVD_PHASE_RECOVER  2
30 #define PTLRPC_RECOVD_PHASE_FAILURE  3
31
32 typedef int (*ptlrpc_recovery_cb_t)(struct recovd_data *, int);
33
34 struct recovd_data {
35         struct list_head     rd_managed_chain;
36         ptlrpc_recovery_cb_t rd_recover;
37         struct recovd_obd   *rd_recovd;
38         __u32                rd_phase;
39         __u32                rd_next_phase;
40         __u32                rd_flags;
41 };
42
43 void recovd_conn_fail(struct ptlrpc_connection *conn);
44 void recovd_conn_manage(struct ptlrpc_connection *conn, struct recovd_obd *mgr,
45                         ptlrpc_recovery_cb_t recover);
46 void recovd_conn_fixed(struct ptlrpc_connection *conn);
47 int recovd_setup(struct recovd_obd *mgr);
48 int recovd_cleanup(struct recovd_obd *mgr);
49
50 extern struct recovd_obd *ptlrpc_recovd;
51
52 int ptlrpc_run_recovery_upcall(struct ptlrpc_connection *conn);
53 int ptlrpc_reconnect_and_replay(struct ptlrpc_connection *conn);
54
55 #endif