1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001 Cluster File Systems, Inc.
6 * This code is issued under the GNU General Public License.
7 * See the file COPYING in this distribution
13 #include <linux/lustre_handles.h>
14 #include <linux/lustre_idl.h>
16 enum lustre_imp_state {
17 // LUSTRE_IMP_INVALID = 1,
19 LUSTRE_IMP_DISCON = 3,
20 LUSTRE_IMP_CONNECTING = 4,
21 LUSTRE_IMP_REPLAY = 5,
22 LUSTRE_IMP_RECOVER = 6,
24 LUSTRE_IMP_EVICTED = 8,
29 struct portals_handle imp_handle;
30 atomic_t imp_refcount;
31 struct lustre_handle imp_dlm_handle; /* client's ldlm export */
32 struct ptlrpc_connection *imp_connection;
33 struct ptlrpc_client *imp_client;
34 struct list_head imp_observers;
35 struct list_head imp_pinger_chain;
37 /* Lists of requests that are retained for replay, waiting for a reply,
38 * or waiting for recovery to complete, respectively.
40 struct list_head imp_replay_list;
41 struct list_head imp_sending_list;
42 struct list_head imp_delayed_list;
44 struct obd_device *imp_obd;
45 struct semaphore imp_recovery_sem;
46 enum lustre_imp_state imp_state;
49 __u64 imp_max_transno;
50 __u64 imp_peer_committed_transno;
51 struct obd_uuid imp_target_uuid; /* XXX -> lustre_name */
52 struct lustre_handle imp_remote_handle;
53 unsigned long imp_next_ping;
55 /* Protects flags, level, generation, conn_cnt, *_list */
59 int imp_invalid:1, imp_replayable:1,
60 imp_dlm_fake:1, imp_server_timeout:1;
64 typedef void (*obd_import_callback)(struct obd_import *imp, void *closure,
65 int event, void *event_arg, void *cb_data);
67 struct obd_import_observer {
68 struct list_head oio_chain;
69 obd_import_callback oio_cb;
73 void class_observe_import(struct obd_import *imp, obd_import_callback cb,
75 void class_unobserve_import(struct obd_import *imp, obd_import_callback cb,
77 void class_notify_import_observers(struct obd_import *imp, int event,
80 #define IMP_EVENT_ACTIVE 1
81 #define IMP_EVENT_INACTIVE 2
85 extern struct obd_import *class_exp2cliimp(struct obd_export *);
86 extern struct obd_import *class_conn2cliimp(struct lustre_handle *);
88 #endif /* __IMPORT_H */