Whamcloud - gitweb
current branches now use lnet from HEAD
[fs/lustre-release.git] / lustre / include / linux / lustre_import.h
index c1af641..8164f77 100644 (file)
 #include <linux/lustre_handles.h>
 #include <linux/lustre_idl.h>
 
+enum lustre_imp_state {
+        LUSTRE_IMP_CLOSED     = 1,
+        LUSTRE_IMP_NEW        = 2,
+        LUSTRE_IMP_DISCON     = 3,
+        LUSTRE_IMP_CONNECTING = 4,
+        LUSTRE_IMP_REPLAY     = 5,
+        LUSTRE_IMP_REPLAY_LOCKS = 6,
+        LUSTRE_IMP_REPLAY_WAIT  = 7,
+        LUSTRE_IMP_RECOVER    = 8,
+        LUSTRE_IMP_FULL       = 9,
+        LUSTRE_IMP_EVICTED    = 10,
+};
+
+static inline char * ptlrpc_import_state_name(enum lustre_imp_state state)
+{
+        static char* import_state_names[] = {
+                "<UNKNOWN>", "CLOSED",  "NEW", "DISCONN",
+                "CONNECTING", "REPLAY", "REPLAY_LOCKS", "REPLAY_WAIT",
+                "RECOVER", "FULL", "EVICTED",
+        };
+
+        LASSERT (state <= LUSTRE_IMP_EVICTED);
+        return import_state_names[state];
+}
+
+enum obd_import_event {
+        IMP_EVENT_DISCON     = 0x808001,
+        IMP_EVENT_INACTIVE   = 0x808002,
+        IMP_EVENT_INVALIDATE = 0x808003,
+        IMP_EVENT_ACTIVE     = 0x808004,
+};
+
+struct ptlrpc_sec;
+
+struct obd_import_conn {
+        struct list_head          oic_item;
+        struct ptlrpc_connection *oic_conn;
+        struct obd_uuid           oic_uuid;
+        unsigned long             oic_last_attempt; /* in jiffies */
+};
+
 struct obd_import {
         struct portals_handle     imp_handle;
         atomic_t                  imp_refcount;
@@ -29,21 +70,47 @@ struct obd_import {
         struct list_head          imp_sending_list;
         struct list_head          imp_delayed_list;
 
+        /* list of ongoing raw rpcs (only used by gss) */
+        struct list_head          imp_rawrpc_list;
+
         struct obd_device        *imp_obd;
-        int                       imp_level;
+        struct ptlrpc_sec        *imp_sec;
+        wait_queue_head_t         imp_recovery_waitq;
+        __u64                     imp_last_replay_transno;
+        atomic_t                  imp_inflight;
+        atomic_t                  imp_replay_inflight;
+        enum lustre_imp_state     imp_state;
         int                       imp_generation;
+        __u32                     imp_conn_cnt;
         __u64                     imp_max_transno;
         __u64                     imp_peer_committed_transno;
         struct obd_uuid           imp_target_uuid; /* XXX -> lustre_name */
         struct lustre_handle      imp_remote_handle;
-
-        /* Protects flags, level, generation, *_list */
+        unsigned long             imp_next_ping;
+        unsigned long             imp_connect_start;
+       
+        /* all available obd_import_conn linked here */
+        struct list_head          imp_conn_list;
+        struct obd_import_conn   *imp_conn_current;
+        /* Protects flags, level, generation, conn_cnt, *_list */
         spinlock_t                imp_lock;
 
         /* flags */
         int                       imp_invalid:1, imp_replayable:1,
-                                  imp_dlm_fake:1;
+                                  imp_dlm_fake:1, imp_server_timeout:1,
+                                  imp_initial_recov:1, imp_force_verify:1,
+                                  imp_pingable:1, imp_resend_replay:1,
+                                  imp_deactive:1,
+                                  imp_waiting_ping_reply:1,
+                                  imp_debug_open_replays:1;
         __u32                     imp_connect_op;
+        __u32                     imp_connect_flags;
+        struct obd_connect_data   imp_connect_data;
+
+        unsigned long             imp_last_ping_xid;
+        int                       imp_reqs_replayed;
+        int                       imp_locks_replayed;
 };
 
 typedef void (*obd_import_callback)(struct obd_import *imp, void *closure,
@@ -66,7 +133,8 @@ void class_notify_import_observers(struct obd_import *imp, int event,
 #define IMP_EVENT_INACTIVE 2
 
 /* genops.c */
+struct obd_export;
+extern struct obd_import *class_exp2cliimp(struct obd_export *);
 extern struct obd_import *class_conn2cliimp(struct lustre_handle *);
-extern struct obd_import *class_conn2ldlmimp(struct lustre_handle *);
 
 #endif /* __IMPORT_H */