Whamcloud - gitweb
Merge b_md to HEAD for 0.5.19 release.
[fs/lustre-release.git] / lustre / include / linux / lustre_ha.h
index 6598be0..87b0bf3 100644 (file)
@@ -5,33 +5,60 @@
 #ifndef _LUSTRE_HA_H
 #define _LUSTRE_HA_H
 
-#include <linux/lustre_net.h>
-
 #define LUSTRE_HA_NAME "ptlrpc"
 
-#define CONNMGR_CONNECT 1
+struct recovd_data;
+struct recovd_obd;
+struct obd_import;
+struct ptlrpc_connection;
 
-extern struct recovd_obd *ptlrpc_connmgr;
+/* rd_phase/rd_next_phase values */
+#define RD_IDLE              0
+#define RD_TROUBLED          1
+#define RD_PREPARING         2
+#define RD_PREPARED          3
+#define RD_RECOVERING        4
+#define RD_RECOVERED         5
+#define RD_FAILED            6
 
-struct connmgr_thread {
-        struct recovd_obd *mgr;
-        char *name;
-};
+/* recovd_state values */
+#define RECOVD_READY             1
+#define RECOVD_STOPPING          2  /* how cleanup tells recovd to quit */
+#define RECOVD_STOPPED           4  /* after recovd has stopped */
+
+#define PTLRPC_RECOVD_PHASE_PREPARE  1
+#define PTLRPC_RECOVD_PHASE_RECOVER  2
+#define PTLRPC_RECOVD_PHASE_FAILURE  3
+#define PTLRPC_RECOVD_PHASE_NOTCONN  4
 
-struct connmgr_body {
-        __u64 conn;
-        __u64 conn_token;
-        __u32 generation;
-        __u8  conn_uuid[37];
+typedef int (*ptlrpc_recovery_cb_t)(struct recovd_data *, int);
+
+struct recovd_data {
+        /* you must hold recovd->recovd_lock when touching rd_managed_chain */
+        struct list_head     rd_managed_chain;
+        ptlrpc_recovery_cb_t rd_recover;
+        struct recovd_obd   *rd_recovd;
+        __u32                rd_phase;
+        __u32                rd_next_phase;
+        __u32                rd_flags;
 };
 
-int connmgr_connect(struct recovd_obd *mgr, struct ptlrpc_connection *conn);
-int connmgr_handle(struct obd_device *dev, struct ptlrpc_service *svc,
-                   struct ptlrpc_request *req);
-void recovd_cli_fail(struct ptlrpc_client *cli);
-void recovd_cli_manage(struct recovd_obd *mgr, struct ptlrpc_client *cli);
-void recovd_cli_fixed(struct ptlrpc_client *cli);
+void recovd_conn_fail(struct ptlrpc_connection *conn);
+void recovd_conn_manage(struct ptlrpc_connection *conn, struct recovd_obd *mgr,
+                        ptlrpc_recovery_cb_t recover);
+void recovd_conn_unmanage(struct ptlrpc_connection *conn);
+void recovd_conn_fixed(struct ptlrpc_connection *conn);
 int recovd_setup(struct recovd_obd *mgr);
 int recovd_cleanup(struct recovd_obd *mgr);
 
+extern struct recovd_obd *ptlrpc_recovd;
+struct ptlrpc_request;
+
+int ptlrpc_run_recovery_upcall(struct ptlrpc_connection *conn);
+int ptlrpc_reconnect_import(struct obd_import *imp, int rq_opc,
+                            struct ptlrpc_request **reqptr);
+int ptlrpc_replay(struct obd_import *imp);
+int ptlrpc_resend(struct obd_import *imp);
+void ptlrpc_free_committed(struct obd_import *imp);
+void ptlrpc_wake_delayed(struct obd_import *imp);
 #endif